else\r
tokend += 3;\r
}\r
+ else if ( !strncmp ( _p, "<?", 2 ) )\r
+ {\r
+ tokend = strstr ( _p, "?>" );\r
+ if ( !tokend )\r
+ tokend = _end;\r
+ else\r
+ tokend += 2;\r
+ }\r
else if ( *_p == '<' )\r
{\r
tokend = strchr ( _p, '>' );\r
return NULL;\r
bool end_tag;\r
\r
- while ( token[0] != '<' || !strncmp ( token.c_str(), "<!--", 4 ) )\r
+ while ( token[0] != '<'\r
+ || !strncmp ( token.c_str(), "<!--", 4 )\r
+ || !strncmp ( token.c_str(), "<?", 2 ) )\r
{\r
if ( token[0] != '<' )\r
throw XMLSyntaxErrorException ( f.Location(),\r
\r
#include "../../pch.h"\r
+#include <assert.h>\r
\r
#include "../../rbuild.h"\r
#include "mingw.h"\r
archiveFilename.c_str (),\r
importLibraryDependencies.c_str () );\r
fprintf ( fMakefile,\r
- "\t${gcc} -Wl,--base-file,%s/base.tmp -o %s/junk.tmp %s %s\n",\r
+ "\t${gcc} -Wl,--base-file,%s" SSEP "base.tmp -o %s" SSEP "junk.tmp %s %s\n",\r
workingDirectory.c_str (),\r
workingDirectory.c_str (),\r
archiveFilename.c_str (),\r
importLibraryDependencies.c_str () );\r
fprintf ( fMakefile,\r
- "\t${rm} %s/junk.tmp\n",\r
+ "\t${rm} %s" SSEP "junk.tmp\n",\r
workingDirectory.c_str () );\r
fprintf ( fMakefile,\r
- "\t${dlltool} --dllname %s --base-file %s/base.tmp --output-exp %s/temp.exp --kill-at\n",\r
+ "\t${dlltool} --dllname %s --base-file %s" SSEP "base.tmp --output-exp %s" SSEP "temp.exp --kill-at\n",\r
module.GetPath ().c_str (),\r
workingDirectory.c_str (),\r
workingDirectory.c_str ());\r
fprintf ( fMakefile,\r
- "\t${rm} %s/base.tmp\n",\r
+ "\t${rm} %s" SSEP "base.tmp\n",\r
workingDirectory.c_str () );\r
fprintf ( fMakefile,\r
- "\t${ld} -Wl,%s/temp.exp -o %s %s %s\n",\r
+ "\t${ld} -Wl,%s" SSEP "temp.exp -o %s %s %s\n",\r
workingDirectory.c_str (),\r
module.GetPath ().c_str (),\r
archiveFilename.c_str (),\r
importLibraryDependencies.c_str () );\r
fprintf ( fMakefile,\r
- "\t${rm} %s/temp.exp\n",\r
+ "\t${rm} %s" SSEP "temp.exp\n",\r
workingDirectory.c_str () );\r
\r
GenerateArchiveTarget ( module );\r
using std::string;\r
using std::vector;\r
\r
-#ifdef WIN32\r
-#define EXEPOSTFIX ".exe"\r
-#define SEP "\\"\r
string\r
FixSeparator ( const string& s )\r
{\r
string s2(s);\r
- char* p = strchr ( &s2[0], '/' );\r
+ char* p = strchr ( &s2[0], CBAD_SEP );\r
while ( p )\r
{\r
- *p++ = '\\';\r
- p = strchr ( p, '/' );\r
+ *p++ = CSEP;\r
+ p = strchr ( p, CBAD_SEP );\r
}\r
return s2;\r
}\r
-#else\r
-#define EXEPOSTFIX\r
-#define SEP "/"\r
-string\r
-FixSeparator ( const string& s )\r
-{\r
- string s2(s);\r
- char* p = strchr ( &s2[0], '\\' );\r
- while ( p )\r
- {\r
- *p++ = '/';\r
- p = strchr ( p, '\\' );\r
- }\r
- return s2;\r
-}\r
-#endif\r
\r
Module::Module ( Project* project,\r
const XMLElement& moduleNode,\r
string subpath ( path );\r
if ( e.name == "file" && e.value.size () )\r
{\r
- files.push_back ( new File ( path + "/" + e.value ) );\r
+ files.push_back ( new File ( path + CSEP + e.value ) );\r
}\r
else if ( e.name == "library" && e.value.size () )\r
{\r
{\r
const XMLAttribute* att = e.GetAttribute ( "name", true );\r
assert(att);\r
- subpath = path + "/" + att->value;\r
+ subpath = path + CSEP + att->value;\r
}\r
for ( size_t i = 0; i < e.subElements.size (); i++ )\r
ProcessXML ( *e.subElements[i], subpath );\r
string\r
Module::GetPath ()\r
{\r
- return FixSeparator (path) + SEP + name + EXEPOSTFIX;\r
+ return FixSeparator (path) + CSEP + name + EXEPOSTFIX;\r
}\r
\r
\r
{\r
Path path;\r
\r
- head = XMLParse ( xmlfile, path );\r
- if ( !head )\r
- throw InvalidBuildFileException ( "Document contains no 'project' tag." );\r
-\r
- if ( head->name != "project" )\r
+ do\r
{\r
- throw InvalidBuildFileException ( "Expected 'project', got '%s'.",\r
- head->name.c_str());\r
- }\r
+ head = XMLParse ( xmlfile, path );\r
+ if ( !head )\r
+ throw InvalidBuildFileException ( "Document contains no 'project' tag." );\r
+ } while ( head->name != "project" );\r
\r
this->ProcessXML ( *head, "." );\r
}\r
{\r
const XMLAttribute* att = e.GetAttribute ( "name", true );\r
assert(att);\r
- subpath = path + "/" + att->value;\r
+ subpath = path + CSEP + att->value;\r
}\r
for ( size_t i = 0; i < e.subElements.size (); i++ )\r
ProcessXML ( *e.subElements[i], subpath );\r
#include "exception.h"\r
#include "XML.h"\r
\r
+#ifdef WIN32\r
+#define EXEPOSTFIX ".exe"\r
+#define CSEP '\\'\r
+#define CBAD_SEP '/'\r
+#define SSEP "\\"\r
+#define SBAD_SEP "/"\r
+#else\r
+#define EXEPOSTFIX\r
+#define CSEP '/'\r
+#define CBAD_SEP '\\'\r
+#define SSEP "/"\r
+#define SBAD_SEP "\\"\r
+#endif\r
+\r
class Project;\r
class Module;\r
class File;\r
Library ( const std::string& _name );\r
};\r
\r
+extern std::string\r
+FixSeparator ( const std::string& s );\r
+\r
#endif /* __RBUILD_H */\r
+<?xml version="1.0" ?>\r
<project name="Project" makefile="Makefile">\r
<directory name="dir1">\r
<module name="module1" type="buildtool">\r
+<?xml version="1.0" ?>\r
<project name="Project" makefile="Makefile">\r
<directory name="dir1">\r
<module name="module1" type="buildtool">\r
Module& module1 = *project.modules[0];\r
IS_TRUE(module1.type == BuildTool);\r
ARE_EQUAL(2, module1.files.size());\r
- ARE_EQUAL("./dir1/file1.c", module1.files[0]->name);\r
- ARE_EQUAL("./dir1/file2.c", module1.files[1]->name);\r
+ ARE_EQUAL("." SSEP "dir1" SSEP "file1.c", module1.files[0]->name);\r
+ ARE_EQUAL("." SSEP "dir1" SSEP "file2.c", module1.files[1]->name);\r
\r
ARE_EQUAL(0, module1.libraries.size());\r
\r
Module& module2 = *project.modules[1];\r
IS_TRUE(module2.type == KernelModeDLL);\r
ARE_EQUAL(2, module2.files.size());\r
- ARE_EQUAL("./dir2/file3.c", module2.files[0]->name);\r
- ARE_EQUAL("./dir2/file4.c", module2.files[1]->name);\r
+ ARE_EQUAL("." SSEP "dir2" SSEP "file3.c", module2.files[0]->name);\r
+ ARE_EQUAL("." SSEP "dir2" SSEP "file4.c", module2.files[1]->name);\r
\r
ARE_EQUAL(1, module2.libraries.size());\r
Library& library1 = *module2.libraries[0];\r