XML: better descriptions on a couple errors, more accurate line number
reporting ( was overshooting ), better clean-up of memory
mingw/directory: move msvc fix for popen with the rest of the code that
got moved
rbuild.dsp: added new files to project
Modified: trunk/reactos/tools/rbuild/XML.cpp
Modified: trunk/reactos/tools/rbuild/XML.h
Modified: trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp
Modified: trunk/reactos/tools/rbuild/directory.cpp
Modified: trunk/reactos/tools/rbuild/rbuild.dsp
_____
Modified: trunk/reactos/tools/rbuild/XML.cpp
--- trunk/reactos/tools/rbuild/XML.cpp 2005-11-26 04:07:39 UTC (rev
19610)
+++ trunk/reactos/tools/rbuild/XML.cpp 2005-11-26 04:24:17 UTC (rev
19611)
@@ -348,6 +348,13 @@
return true;
}
+bool
+XMLFile::get_token ( string& token, string& location )
+{
+ location = Location();
+ return get_token ( token );
+}
+
string
XMLFile::Location() const
{
@@ -547,8 +554,8 @@
const Path& path,
bool* pend_tag = NULL )
{
- string token;
- if ( !f.get_token(token) )
+ string token, location;
+ if ( !f.get_token(token,location) )
return NULL;
bool end_tag, is_include = false;
@@ -557,15 +564,15 @@
|| !strncmp ( token.c_str (), "<?", 2 ) )
{
if ( token[0] != '<' )
- throw XMLSyntaxErrorException ( f.Location (),
+ throw XMLSyntaxErrorException ( location,
"expecting xml
tag, not '%s'",
token.c_str ()
);
- if ( !f.get_token(token) )
+ if ( !f.get_token(token,location) )
return NULL;
}
XMLElement* e = new XMLElement ( &f,
- f.Location () );
+ location );
bool bNeedEnd = e->Parse ( token, end_tag );
if ( e->name == "xi:include" && includes )
@@ -586,7 +593,7 @@
else if ( end_tag )
{
delete e;
- throw XMLSyntaxErrorException ( f.Location (),
+ throw XMLSyntaxErrorException ( location,
"end tag '%s'
not expected",
token.c_str() );
return NULL;
@@ -598,27 +605,27 @@
{
if ( f.next_is_text () )
{
- if ( !f.get_token ( token ) || token.size () ==
0 )
+ if ( !f.get_token ( token, location ) ||
token.size () == 0 )
{
throw InvalidBuildFileException (
- f.Location(),
+ location,
"internal tool error -
get_token() failed when more_tokens() returned true" );
break;
}
if ( e->subElements.size() &&
!bThisMixingErrorReported )
{
- throw XMLSyntaxErrorException (
f.Location (),
+ throw XMLSyntaxErrorException (
location,
"mixing
of inner text with sub elements" );
bThisMixingErrorReported = true;
}
if ( strchr ( token.c_str (), '>' ) )
{
- throw XMLSyntaxErrorException (
f.Location (),
+ throw XMLSyntaxErrorException (
location,
"invalid
symbol '>'" );
}
if ( e->value.size() > 0 )
{
- throw XMLSyntaxErrorException (
f.Location (),
+ throw XMLSyntaxErrorException (
location,
"multiple instances of inner text" );
e->value += " " + token;
}
@@ -628,20 +635,33 @@
else
{
XMLElement* e2 = XMLParse ( f, is_include ? NULL
: includes, path, &end_tag );
+ if ( e->name == "project" && e2->name == "1" )
+ e = e;
if ( !e2 )
{
+ string e_location = e->location;
+ string e_name = e->name;
+ delete e;
throw InvalidBuildFileException (
- e->location,
- "end of file found looking for
end tag" );
+ e_location,
+ "end of file found looking for
end tag: </%s>",
+ e_name.c_str() );
break;
}
if ( end_tag )
{
if ( e->name != e2->name )
{
+ string e2_location =
e2->location;
+ string e_name = e->name;
+ string e2_name = e2->name;
+ delete e;
delete e2;
- throw XMLSyntaxErrorException (
f.Location (),
-
"end tag name mismatch" );
+ throw XMLSyntaxErrorException (
+ e2_location,
+ "end tag name mismatch -
found </%s> but was expecting </%s>",
+ e2_name.c_str(),
+ e_name.c_str() );
break;
}
delete e2;
@@ -649,7 +669,9 @@
}
if ( e->value.size () > 0 &&
!bThisMixingErrorReported )
{
- throw XMLSyntaxErrorException (
f.Location (),
+ string e_location = e->location;
+ delete e;
+ throw XMLSyntaxErrorException (
e_location,
"mixing
of inner text with sub elements" );
bThisMixingErrorReported = true;
}
_____
Modified: trunk/reactos/tools/rbuild/XML.h
--- trunk/reactos/tools/rbuild/XML.h 2005-11-26 04:07:39 UTC (rev
19610)
+++ trunk/reactos/tools/rbuild/XML.h 2005-11-26 04:24:17 UTC (rev
19611)
@@ -81,7 +81,8 @@
void next_token();
bool next_is_text();
bool more_tokens();
- bool get_token(std::string& token);
+ bool get_token ( std::string& token );
+ bool get_token ( std::string& token, std::string& location );
const std::string& filename() { return _filename; }
std::string Location() const;
_____
Modified: trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp
--- trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-11-26
04:07:39 UTC (rev 19610)
+++ trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-11-26
04:24:17 UTC (rev 19611)
@@ -21,6 +21,11 @@
#include <assert.h>
#include "modulehandler.h"
+#ifdef _MSC_VER
+#define popen _popen
+#define pclose _pclose
+#endif//_MSC_VER
+
using std::string;
using std::vector;
using std::set;
_____
Modified: trunk/reactos/tools/rbuild/directory.cpp
--- trunk/reactos/tools/rbuild/directory.cpp 2005-11-26 04:07:39 UTC
(rev 19610)
+++ trunk/reactos/tools/rbuild/directory.cpp 2005-11-26 04:24:17 UTC
(rev 19611)
@@ -19,10 +19,7 @@
#include <assert.h>
#include "rbuild.h"
-#ifdef _MSC_VER
-#define popen _popen
-#define pclose _pclose
-#else
+#ifndef _MSC_VER
#include <dirent.h>
#endif//_MSC_VER
_____
Modified: trunk/reactos/tools/rbuild/rbuild.dsp
--- trunk/reactos/tools/rbuild/rbuild.dsp 2005-11-26 04:07:39 UTC
(rev 19610)
+++ trunk/reactos/tools/rbuild/rbuild.dsp 2005-11-26 04:24:17 UTC
(rev 19611)
@@ -181,6 +181,14 @@
# End Source File
# Begin Source File
+SOURCE=.\compilationunit.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=.\compilationunitsupportcode.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\compilerflag.cpp
# End Source File
# Begin Source File
@@ -193,6 +201,10 @@
# End Source File
# Begin Source File
+SOURCE=.\directory.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\exception.cpp
# End Source File
# Begin Source File
@@ -201,6 +213,10 @@
# End Source File
# Begin Source File
+SOURCE=.\global.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\include.cpp
# End Source File
# Begin Source File
@@ -213,6 +229,10 @@
# End Source File
# Begin Source File
+SOURCE=.\linkerscript.cpp
+# End Source File
+# Begin Source File
+
SOURCE=.\module.cpp
# End Source File
# Begin Source File