mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 07:32:57 +00:00
fixed some warnings, and added some asserts
svn path=/branches/xmlbuildsystem/; revision=12843
This commit is contained in:
parent
7d876c4d0c
commit
c6916243d1
4 changed files with 30 additions and 22 deletions
|
@ -197,10 +197,10 @@ XMLFile::close()
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
XMLFile::open(const string& filename)
|
XMLFile::open(const string& filename_)
|
||||||
{
|
{
|
||||||
close();
|
close();
|
||||||
FILE* f = fopen ( filename.c_str(), "rb" );
|
FILE* f = fopen ( filename_.c_str(), "rb" );
|
||||||
if ( !f )
|
if ( !f )
|
||||||
return false;
|
return false;
|
||||||
unsigned long len = (unsigned long)filelen(f);
|
unsigned long len = (unsigned long)filelen(f);
|
||||||
|
@ -209,6 +209,7 @@ XMLFile::open(const string& filename)
|
||||||
fclose ( f );
|
fclose ( f );
|
||||||
_p = _buf.c_str();
|
_p = _buf.c_str();
|
||||||
_end = _p + len;
|
_end = _p + len;
|
||||||
|
_filename = filename_;
|
||||||
next_token();
|
next_token();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -456,24 +457,23 @@ XMLParse(XMLFile& f,
|
||||||
{
|
{
|
||||||
XMLAttribute* att;
|
XMLAttribute* att;
|
||||||
att = e->GetAttribute("href",true);
|
att = e->GetAttribute("href",true);
|
||||||
if ( att )
|
assert(att);
|
||||||
|
|
||||||
|
string file ( path.Fixup(att->value,true) );
|
||||||
|
string top_file ( Path::RelativeFromWorkingDirectory ( file ) );
|
||||||
|
e->attributes.push_back ( new XMLAttribute ( "top_href", top_file ) );
|
||||||
|
XMLFile fInc;
|
||||||
|
if ( !fInc.open ( file ) )
|
||||||
|
throw FileNotFoundException ( file );
|
||||||
|
else
|
||||||
{
|
{
|
||||||
string file ( path.Fixup(att->value,true) );
|
Path path2 ( path, att->value );
|
||||||
string top_file ( Path::RelativeFromWorkingDirectory ( file ) );
|
for ( ;; )
|
||||||
e->attributes.push_back ( new XMLAttribute ( "top_href", top_file ) );
|
|
||||||
XMLFile fInc;
|
|
||||||
if ( !fInc.open ( file ) )
|
|
||||||
throw FileNotFoundException ( file );
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
Path path2 ( path, att->value );
|
XMLElement* e2 = XMLParse ( fInc, path2 );
|
||||||
for ( ;; )
|
if ( !e2 )
|
||||||
{
|
break;
|
||||||
XMLElement* e2 = XMLParse ( fInc, path2 );
|
e->AddSubElement ( e2 );
|
||||||
if ( !e2 )
|
|
||||||
break;
|
|
||||||
e->AddSubElement ( e2 );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -519,7 +519,7 @@ XMLParse(XMLFile& f,
|
||||||
if ( end_tag )
|
if ( end_tag )
|
||||||
{
|
{
|
||||||
if ( e->name != e2->name )
|
if ( e->name != e2->name )
|
||||||
printf ( "end tag name mismatch\n" );
|
printf ( "syntax error: end tag name mismatch\n" );
|
||||||
delete e2;
|
delete e2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,9 +34,10 @@ public:
|
||||||
bool next_is_text();
|
bool next_is_text();
|
||||||
bool more_tokens();
|
bool more_tokens();
|
||||||
bool get_token(std::string& token);
|
bool get_token(std::string& token);
|
||||||
|
const std::string& filename() { return _filename; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string _buf;
|
std::string _buf, _filename;
|
||||||
|
|
||||||
const char *_p, *_end;
|
const char *_p, *_end;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// module.cpp
|
// module.cpp
|
||||||
|
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
#include "rbuild.h"
|
#include "rbuild.h"
|
||||||
|
|
||||||
|
@ -19,9 +20,10 @@ Module::Module ( const XMLElement& moduleNode,
|
||||||
|
|
||||||
Module::~Module ()
|
Module::~Module ()
|
||||||
{
|
{
|
||||||
for ( size_t i = 0; i < files.size(); i++ )
|
size_t i;
|
||||||
|
for ( i = 0; i < files.size(); i++ )
|
||||||
delete files[i];
|
delete files[i];
|
||||||
for ( size_t i = 0; i < libraries.size(); i++ )
|
for ( i = 0; i < libraries.size(); i++ )
|
||||||
delete libraries[i];
|
delete libraries[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,6 +42,7 @@ void Module::ProcessXML ( const XMLElement& e,
|
||||||
else if ( e.name == "directory" )
|
else if ( e.name == "directory" )
|
||||||
{
|
{
|
||||||
const XMLAttribute* att = e.GetAttribute ( "name", true );
|
const XMLAttribute* att = e.GetAttribute ( "name", true );
|
||||||
|
assert(att);
|
||||||
subpath = path + "/" + att->value;
|
subpath = path + "/" + att->value;
|
||||||
}
|
}
|
||||||
for ( size_t i = 0; i < e.subElements.size (); i++ )
|
for ( size_t i = 0; i < e.subElements.size (); i++ )
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
|
|
||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
#include "rbuild.h"
|
#include "rbuild.h"
|
||||||
|
|
||||||
|
@ -55,11 +56,13 @@ Project::ProcessXML ( const XMLElement& e, const string& path )
|
||||||
name = att->value;
|
name = att->value;
|
||||||
|
|
||||||
att = e.GetAttribute ( "makefile", true );
|
att = e.GetAttribute ( "makefile", true );
|
||||||
|
assert(att);
|
||||||
makefile = att->value;
|
makefile = att->value;
|
||||||
}
|
}
|
||||||
else if ( e.name == "module" )
|
else if ( e.name == "module" )
|
||||||
{
|
{
|
||||||
att = e.GetAttribute ( "name", true );
|
att = e.GetAttribute ( "name", true );
|
||||||
|
assert(att);
|
||||||
Module* module = new Module ( e, att->value, path );
|
Module* module = new Module ( e, att->value, path );
|
||||||
modules.push_back ( module );
|
modules.push_back ( module );
|
||||||
module->ProcessXML ( e, path );
|
module->ProcessXML ( e, path );
|
||||||
|
@ -68,6 +71,7 @@ Project::ProcessXML ( const XMLElement& e, const string& path )
|
||||||
else if ( e.name == "directory" )
|
else if ( e.name == "directory" )
|
||||||
{
|
{
|
||||||
const XMLAttribute* att = e.GetAttribute ( "name", true );
|
const XMLAttribute* att = e.GetAttribute ( "name", true );
|
||||||
|
assert(att);
|
||||||
subpath = path + "/" + att->value;
|
subpath = path + "/" + att->value;
|
||||||
}
|
}
|
||||||
for ( size_t i = 0; i < e.subElements.size (); i++ )
|
for ( size_t i = 0; i < e.subElements.size (); i++ )
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue