ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
January 2005
----- 2024 -----
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
28 participants
703 discussions
Start a n
N
ew thread
[royce] 12844: file & line # reporting on xml syntax errors
by royce@svn.reactos.com
file & line # reporting on xml syntax errors Modified: branches/xmlbuildsystem/reactos/tools/rbuild/XML.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/XML.h Modified: branches/xmlbuildsystem/reactos/tools/rbuild/exception.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/exception.h _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/XML.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/XML.cpp 2005-01-06 01:35:01 UTC (rev 12843) +++ branches/xmlbuildsystem/reactos/tools/rbuild/XML.cpp 2005-01-06 02:06:44 UTC (rev 12844) @@ -7,7 +7,8 @@ #include <assert.h> #include "XML.h" -#include "rbuild.h" +#include "exception.h" +#include "ssprintf.h" using std::string; using std::vector; @@ -274,6 +275,19 @@ return true; } +string +XMLFile::Location() const +{ + int line = 1; + const char* p = strchr ( _buf.c_str(), '\n' ); + while ( p && p < _p ) + { + ++line; + p = strchr ( p+1, '\n' ); + } + return ssprintf ( "%s(%i)",_filename.c_str(), line ); +} + XMLAttribute::XMLAttribute() { } @@ -445,7 +459,9 @@ while ( token[0] != '<' || !strncmp ( token.c_str(), "<!--", 4 ) ) { if ( token[0] != '<' ) - printf ( "syntax error: expecting xml tag, not '%s'\n", token.c_str() ); + throw XMLSyntaxErrorException ( f.Location(), + "expecting xml tag, not '%s'", + token.c_str() ); if ( !f.get_token(token) ) return NULL; } @@ -464,7 +480,10 @@ e->attributes.push_back ( new XMLAttribute ( "top_href", top_file ) ); XMLFile fInc; if ( !fInc.open ( file ) ) - throw FileNotFoundException ( file ); + throw FileNotFoundException ( + ssprintf("%s (referenced from %s)", + file.c_str(), + f.Location().c_str() ) ); else { Path path2 ( path, att->value ); @@ -485,7 +504,9 @@ else if ( end_tag ) { delete e; - printf ( "syntax error: end tag '%s' not expected\n", token.c_str() ); + throw XMLSyntaxErrorException ( f.Location(), + "end tag '%s' not expected", + token.c_str() ); return NULL; } return e; @@ -497,17 +518,24 @@ { if ( !f.get_token ( token ) || !token.size() ) { - printf ( "internal tool error - get_token() failed when more_tokens() returned true\n" ); + throw Exception ( "internal tool error - get_token() failed when more_tokens() returned true" ); break; } if ( e->subElements.size() && !bThisMixingErrorReported ) { - printf ( "syntax error: mixing of inner text with sub elements\n" ); + throw XMLSyntaxErrorException ( f.Location(), + "mixing of inner text with sub elements" ); bThisMixingErrorReported = true; } + if ( strchr ( token.c_str(), '>' ) ) + { + throw XMLSyntaxErrorException ( f.Location(), + "invalid symbol '>'" ); + } if ( e->value.size() ) { - printf ( "syntax error: multiple instances of inner text\n" ); + throw XMLSyntaxErrorException ( f.Location(), + "multiple instances of inner text" ); e->value += " " + token; } else @@ -519,13 +547,15 @@ if ( end_tag ) { if ( e->name != e2->name ) - printf ( "syntax error: end tag name mismatch\n" ); + throw XMLSyntaxErrorException ( f.Location(), + "end tag name mismatch" ); delete e2; break; } if ( e->value.size() && !bThisMixingErrorReported ) { - printf ( "syntax error: mixing of inner text with sub elements\n" ); + throw XMLSyntaxErrorException ( f.Location(), + "mixing of inner text with sub elements" ); bThisMixingErrorReported = true; } e->AddSubElement ( e2 ); _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/XML.h --- branches/xmlbuildsystem/reactos/tools/rbuild/XML.h 2005-01-06 01:35:01 UTC (rev 12843) +++ branches/xmlbuildsystem/reactos/tools/rbuild/XML.h 2005-01-06 02:06:44 UTC (rev 12844) @@ -35,6 +35,7 @@ bool more_tokens(); bool get_token(std::string& token); const std::string& filename() { return _filename; } + std::string Location() const; private: std::string _buf, _filename; _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/exception.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/exception.cpp 2005-01-06 01:35:01 UTC (rev 12843) +++ branches/xmlbuildsystem/reactos/tools/rbuild/exception.cpp 2005-01-06 02:06:44 UTC (rev 12844) @@ -56,7 +56,22 @@ va_end(args); } +InvalidBuildFileException::InvalidBuildFileException() +{ +} + +XMLSyntaxErrorException::XMLSyntaxErrorException ( const std::string& location, + const char* message, + ... ) +{ + va_list args; + va_start ( args, message ); + Message = location + ": " + ssvprintf ( message, args ); + va_end ( args ); +} + + RequiredAttributeNotFoundException::RequiredAttributeNotFoundException(c onst std::string& attributeName, const std::string& elementName) : InvalidBuildFileException ( "Required attribute '%s' not found on '%s'.", _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/exception.h --- branches/xmlbuildsystem/reactos/tools/rbuild/exception.h 2005-01-06 01:35:01 UTC (rev 12843) +++ branches/xmlbuildsystem/reactos/tools/rbuild/exception.h 2005-01-06 02:06:44 UTC (rev 12844) @@ -36,11 +36,22 @@ class InvalidBuildFileException : public Exception { public: - InvalidBuildFileException(const char* message, - ...); + InvalidBuildFileException ( const char* message, + ...); +protected: + InvalidBuildFileException(); }; +class XMLSyntaxErrorException : public InvalidBuildFileException +{ +public: + XMLSyntaxErrorException ( const std::string& location, + const char* message, + ... ); +}; + + class RequiredAttributeNotFoundException : public InvalidBuildFileException { public:
19 years, 10 months
1
0
0
0
[royce] 12843: fixed some warnings, and added some asserts
by royce@svn.reactos.com
fixed some warnings, and added some asserts Modified: branches/xmlbuildsystem/reactos/tools/rbuild/XML.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/XML.h Modified: branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/XML.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/XML.cpp 2005-01-06 01:28:10 UTC (rev 12842) +++ branches/xmlbuildsystem/reactos/tools/rbuild/XML.cpp 2005-01-06 01:35:01 UTC (rev 12843) @@ -197,10 +197,10 @@ } bool -XMLFile::open(const string& filename) +XMLFile::open(const string& filename_) { close(); - FILE* f = fopen ( filename.c_str(), "rb" ); + FILE* f = fopen ( filename_.c_str(), "rb" ); if ( !f ) return false; unsigned long len = (unsigned long)filelen(f); @@ -209,6 +209,7 @@ fclose ( f ); _p = _buf.c_str(); _end = _p + len; + _filename = filename_; next_token(); return true; } @@ -456,24 +457,23 @@ { XMLAttribute* att; 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) ); - 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 + Path path2 ( path, att->value ); + for ( ;; ) { - Path path2 ( path, att->value ); - for ( ;; ) - { - XMLElement* e2 = XMLParse ( fInc, path2 ); - if ( !e2 ) - break; - e->AddSubElement ( e2 ); - } + XMLElement* e2 = XMLParse ( fInc, path2 ); + if ( !e2 ) + break; + e->AddSubElement ( e2 ); } } } @@ -519,7 +519,7 @@ if ( end_tag ) { if ( e->name != e2->name ) - printf ( "end tag name mismatch\n" ); + printf ( "syntax error: end tag name mismatch\n" ); delete e2; break; } _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/XML.h --- branches/xmlbuildsystem/reactos/tools/rbuild/XML.h 2005-01-06 01:28:10 UTC (rev 12842) +++ branches/xmlbuildsystem/reactos/tools/rbuild/XML.h 2005-01-06 01:35:01 UTC (rev 12843) @@ -34,9 +34,10 @@ bool next_is_text(); bool more_tokens(); bool get_token(std::string& token); + const std::string& filename() { return _filename; } private: - std::string _buf; + std::string _buf, _filename; const char *_p, *_end; }; _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp 2005-01-06 01:28:10 UTC (rev 12842) +++ branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp 2005-01-06 01:35:01 UTC (rev 12843) @@ -1,6 +1,7 @@ // module.cpp #include "pch.h" +#include <assert.h> #include "rbuild.h" @@ -19,9 +20,10 @@ Module::~Module () { - for ( size_t i = 0; i < files.size(); i++ ) + size_t i; + for ( i = 0; i < files.size(); i++ ) delete files[i]; - for ( size_t i = 0; i < libraries.size(); i++ ) + for ( i = 0; i < libraries.size(); i++ ) delete libraries[i]; } @@ -40,6 +42,7 @@ else if ( e.name == "directory" ) { const XMLAttribute* att = e.GetAttribute ( "name", true ); + assert(att); subpath = path + "/" + att->value; } for ( size_t i = 0; i < e.subElements.size (); i++ ) _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp 2005-01-06 01:28:10 UTC (rev 12842) +++ branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp 2005-01-06 01:35:01 UTC (rev 12843) @@ -1,5 +1,6 @@ #include "pch.h" +#include <assert.h> #include "rbuild.h" @@ -55,11 +56,13 @@ name = att->value; att = e.GetAttribute ( "makefile", true ); + assert(att); makefile = att->value; } else if ( e.name == "module" ) { att = e.GetAttribute ( "name", true ); + assert(att); Module* module = new Module ( e, att->value, path ); modules.push_back ( module ); module->ProcessXML ( e, path ); @@ -68,6 +71,7 @@ else if ( e.name == "directory" ) { const XMLAttribute* att = e.GetAttribute ( "name", true ); + assert(att); subpath = path + "/" + att->value; } for ( size_t i = 0; i < e.subElements.size (); i++ )
19 years, 10 months
1
0
0
0
[ekohl] 12842: - Remove __USE_W32API support.
by ekohl@svn.reactos.com
- Remove __USE_W32API support. - Add definition of _ttoi64. Modified: trunk/reactos/include/tchar.h _____ Modified: trunk/reactos/include/tchar.h --- trunk/reactos/include/tchar.h 2005-01-06 01:20:13 UTC (rev 12841) +++ trunk/reactos/include/tchar.h 2005-01-06 01:28:10 UTC (rev 12842) @@ -38,12 +38,6 @@ #ifndef _ROS_TCHAR_H_ #define _ROS_TCHAR_H_ -#ifdef __USE_W32API - -#include_next <tchar.h> - -#else - #include <msvcrt/string.h> /* @@ -154,6 +148,7 @@ #define _totupper towupper #define _totlower towlower #define _ttoi _wtoi +#define _ttoi64 _wtoi64 #define _tcsftime wcsftime #define _tsplitpath _wsplitpath #define _tmakepath _wmakepath @@ -262,6 +257,7 @@ #define _totupper toupper #define _totlower tolower #define _ttoi atoi +#define _ttoi64 _atoi64 #define _tcsftime strftime #define _tsplitpath _splitpath #define _tmakepath _makepath @@ -269,6 +265,4 @@ #endif /* Not _UNICODE */ -#endif /* Not __USE_W32API */ - #endif /* Not _TCHAR_H_ */
19 years, 10 months
1
0
0
0
[arty] 12841: Corrected off-by-one error retrieving adapter index.
by arty@svn.reactos.com
Corrected off-by-one error retrieving adapter index. Modified: trunk/reactos/drivers/net/tcpip/tcpip/ninfo.c _____ Modified: trunk/reactos/drivers/net/tcpip/tcpip/ninfo.c --- trunk/reactos/drivers/net/tcpip/tcpip/ninfo.c 2005-01-05 22:36:17 UTC (rev 12840) +++ trunk/reactos/drivers/net/tcpip/tcpip/ninfo.c 2005-01-06 01:20:13 UTC (rev 12841) @@ -121,7 +121,7 @@ EntityList[RtCurrent->Index - 1].context; RtCurrent->Index-- ); - RtCurrent->Index = EntityList[RtCurrent->Index].tei_instance; + RtCurrent->Index = EntityList[RtCurrent->Index - 1].tei_instance; TcpipReleaseSpinLock(&EntityListLock, OldIrql); RtCurrent++; RCacheCur++;
19 years, 10 months
1
0
0
0
[chorns] 12840: Parse libraries.
by chorns@svn.reactos.com
Parse libraries. Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .h Modified: branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h Modified: branches/xmlbuildsystem/reactos/tools/rbuild/tests/data/module.xml Modified: branches/xmlbuildsystem/reactos/tools/rbuild/tests/moduletest.cpp _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-01-05 21:29:54 UTC (rev 12839) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-01-05 22:36:17 UTC (rev 12840) @@ -103,5 +103,5 @@ void MingwBackend::GetModuleHandlers ( MingwModuleHandlerList& moduleHandlers ) { - moduleHandlers.push_back ( new MingwKernelModuleHandler () ); + moduleHandlers.push_back ( new MingwKernelModuleHandler ( fMakefile ) ); } _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp 2005-01-05 21:29:54 UTC (rev 12839) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp 2005-01-05 22:36:17 UTC (rev 12840) @@ -5,12 +5,29 @@ #include "mingw.h" #include "modulehandler.h" -MingwModuleHandler::MingwModuleHandler () +using std::string; + +MingwModuleHandler::MingwModuleHandler ( FILE* fMakefile ) + : fMakefile ( fMakefile ) { } +string MingwModuleHandler::GetModuleDependencies ( Module& module ) +{ + string dependencies ( "" ); + + for ( size_t i = 0; i < module.libraries.size(); i++ ) + { + if (dependencies.size () > 0) + dependencies += " "; + dependencies += module.libraries[i]->name; + } + return dependencies; +} -MingwKernelModuleHandler::MingwKernelModuleHandler () + +MingwKernelModuleHandler::MingwKernelModuleHandler ( FILE* fMakefile ) + : MingwModuleHandler ( fMakefile ) { } @@ -21,4 +38,15 @@ void MingwKernelModuleHandler::Process ( Module& module ) { + GenerateKernelModuleTarget ( module ); } + +void MingwKernelModuleHandler::GenerateKernelModuleTarget ( Module& module ) +{ + fprintf ( fMakefile, "%s: %s", + module.name.c_str (), + GetModuleDependencies ( module ).c_str () ); + fprintf ( fMakefile, "\n" ); + fprintf ( fMakefile, "\t" ); + fprintf ( fMakefile, "\n\n" ); +} _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .h --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .h 2005-01-05 21:29:54 UTC (rev 12839) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .h 2005-01-05 22:36:17 UTC (rev 12840) @@ -6,18 +6,23 @@ class MingwModuleHandler { public: - MingwModuleHandler (); + MingwModuleHandler ( FILE* fMakefile ); virtual bool CanHandleModule ( Module& module ) = 0; virtual void Process ( Module& module ) = 0; +protected: + FILE* fMakefile; + std::string GetModuleDependencies ( Module& module ); }; class MingwKernelModuleHandler : public MingwModuleHandler { public: - MingwKernelModuleHandler (); + MingwKernelModuleHandler ( FILE* fMakefile ); virtual bool CanHandleModule ( Module& module ); virtual void Process ( Module& module ); +private: + void GenerateKernelModuleTarget ( Module& module ); }; #endif /* MINGW_MODULEHANDLER_H */ _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp 2005-01-05 21:29:54 UTC (rev 12839) +++ branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp 2005-01-05 22:36:17 UTC (rev 12840) @@ -21,6 +21,8 @@ { for ( size_t i = 0; i < files.size(); i++ ) delete files[i]; + for ( size_t i = 0; i < libraries.size(); i++ ) + delete libraries[i]; } void Module::ProcessXML ( const XMLElement& e, @@ -31,6 +33,10 @@ { files.push_back ( new File ( path + "/" + e.value ) ); } + else if ( e.name == "library" && e.value.size () ) + { + libraries.push_back ( new Library ( e.value ) ); + } else if ( e.name == "directory" ) { const XMLAttribute* att = e.GetAttribute ( "name", true ); @@ -50,7 +56,14 @@ attribute.value ); } + File::File ( const string& _name ) : name(_name) { } + + +Library::Library ( const string& _name ) + : name(_name) +{ +} _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp 2005-01-05 21:29:54 UTC (rev 12839) +++ branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp 2005-01-05 22:36:17 UTC (rev 12840) @@ -60,8 +60,6 @@ else if ( e.name == "module" ) { att = e.GetAttribute ( "name", true ); - if ( !att ) - return; Module* module = new Module ( e, att->value, path ); modules.push_back ( module ); module->ProcessXML ( e, path ); @@ -69,10 +67,7 @@ } else if ( e.name == "directory" ) { - // this code is duplicated between Project::ProcessXML() and Module::ProcessXML() :( const XMLAttribute* att = e.GetAttribute ( "name", true ); - if ( !att ) - return; subpath = path + "/" + att->value; } for ( size_t i = 0; i < e.subElements.size (); i++ ) _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h --- branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h 2005-01-05 21:29:54 UTC (rev 12839) +++ branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h 2005-01-05 22:36:17 UTC (rev 12840) @@ -10,6 +10,7 @@ class Project; class Module; class File; +class Library; class Project { @@ -42,8 +43,9 @@ const XMLElement& node; std::string name; std::string path; + ModuleType type; std::vector<File*> files; - ModuleType type; + std::vector<Library*> libraries; Module ( const XMLElement& moduleNode, const std::string& moduleName, @@ -64,4 +66,13 @@ File ( const std::string& _name ); }; + +class Library +{ +public: + std::string name; + + Library ( const std::string& _name ); +}; + #endif /* __RBUILD_H */ _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/tests/data/module.xml --- branches/xmlbuildsystem/reactos/tools/rbuild/tests/data/module.xml 2005-01-05 21:29:54 UTC (rev 12839) +++ branches/xmlbuildsystem/reactos/tools/rbuild/tests/data/module.xml 2005-01-05 22:36:17 UTC (rev 12840) @@ -7,6 +7,7 @@ </directory> <directory name="dir2"> <module name="module2" type="kernelmodedll"> + <library>module1</library> <file>file3.c</file> <file>file4.c</file> </module> _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/tests/moduletest.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/tests/moduletest.cpp 2005-01-05 21:29:54 UTC (rev 12839) +++ branches/xmlbuildsystem/reactos/tools/rbuild/tests/moduletest.cpp 2005-01-05 22:36:17 UTC (rev 12840) @@ -13,10 +13,17 @@ ARE_EQUAL(2, module1.files.size()); ARE_EQUAL("./dir1/file1.c", module1.files[0]->name); ARE_EQUAL("./dir1/file2.c", module1.files[1]->name); - + + ARE_EQUAL(0, module1.libraries.size()); + Module& module2 = *project.modules[1]; IS_TRUE(module2.type == KernelModeDLL); ARE_EQUAL(2, module2.files.size()); ARE_EQUAL("./dir2/file3.c", module2.files[0]->name); ARE_EQUAL("./dir2/file4.c", module2.files[1]->name); + + ARE_EQUAL(1, module2.libraries.size()); + Library& library1 = *module2.libraries[0]; + + ARE_EQUAL("module1", library1.name); }
19 years, 10 months
1
0
0
0
[chorns] 12839: Parse module type.
by chorns@svn.reactos.com
Parse module type. Modified: branches/xmlbuildsystem/reactos/tools/rbuild/exception.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/exception.h Modified: branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h Modified: branches/xmlbuildsystem/reactos/tools/rbuild/tests/data/module.xml Modified: branches/xmlbuildsystem/reactos/tools/rbuild/tests/moduletest.cpp _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/exception.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/exception.cpp 2005-01-05 21:00:51 UTC (rev 12838) +++ branches/xmlbuildsystem/reactos/tools/rbuild/exception.cpp 2005-01-05 21:29:54 UTC (rev 12839) @@ -63,5 +63,13 @@ attributeName.c_str (), elementName.c_str ()) { +} + +InvalidAttributeValueException::InvalidAttributeValueException(const std::string& name, + const std::string& value) + : InvalidBuildFileException ( "Attribute '%s' has an invalid value '%s'.", + name.c_str (), + value.c_str ()) +{ } _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/exception.h --- branches/xmlbuildsystem/reactos/tools/rbuild/exception.h 2005-01-05 21:00:51 UTC (rev 12838) +++ branches/xmlbuildsystem/reactos/tools/rbuild/exception.h 2005-01-05 21:29:54 UTC (rev 12839) @@ -48,4 +48,12 @@ const std::string& elementName); }; + +class InvalidAttributeValueException : public InvalidBuildFileException +{ +public: + InvalidAttributeValueException(const std::string& name, + const std::string& value); +}; + #endif /* __EXCEPTION_H */ _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp 2005-01-05 21:00:51 UTC (rev 12838) +++ branches/xmlbuildsystem/reactos/tools/rbuild/module.cpp 2005-01-05 21:29:54 UTC (rev 12839) @@ -14,35 +14,43 @@ name(moduleName), path(modulePath) { + type = GetModuleType ( *moduleNode.GetAttribute ( "type", true ) ); } -Module::~Module() +Module::~Module () { for ( size_t i = 0; i < files.size(); i++ ) delete files[i]; } -void -Module::ProcessXML ( const XMLElement& e, const string& path ) +void Module::ProcessXML ( const XMLElement& e, + const string& path ) { string subpath ( path ); - if ( e.name == "file" && e.value.size() ) + if ( e.name == "file" && e.value.size () ) { - files.push_back ( new File(path + "/" + e.value) ); + files.push_back ( new File ( path + "/" + e.value ) ); } else if ( e.name == "directory" ) { - // this code is duplicated between Project::ProcessXML() and Module::ProcessXML() :( const XMLAttribute* att = e.GetAttribute ( "name", true ); - if ( !att ) - return; subpath = path + "/" + att->value; } - for ( size_t i = 0; i < e.subElements.size(); i++ ) + for ( size_t i = 0; i < e.subElements.size (); i++ ) ProcessXML ( *e.subElements[i], subpath ); } -File::File ( const std::string& _name ) +ModuleType Module::GetModuleType ( const XMLAttribute& attribute ) +{ + if ( attribute.value == "buildtool" ) + return BuildTool; + if ( attribute.value == "kernelmodedll" ) + return KernelModeDLL; + throw InvalidAttributeValueException ( attribute.name, + attribute.value ); +} + +File::File ( const string& _name ) : name(_name) { } _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h --- branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h 2005-01-05 21:00:51 UTC (rev 12838) +++ branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h 2005-01-05 21:29:54 UTC (rev 12839) @@ -30,6 +30,12 @@ }; +enum ModuleType +{ + BuildTool, + KernelModeDLL +}; + class Module { public: @@ -37,10 +43,12 @@ std::string name; std::string path; std::vector<File*> files; + ModuleType type; Module ( const XMLElement& moduleNode, const std::string& moduleName, const std::string& modulePath ); + ModuleType GetModuleType (const XMLAttribute& attribute ); ~Module(); _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/tests/data/module.xml --- branches/xmlbuildsystem/reactos/tools/rbuild/tests/data/module.xml 2005-01-05 21:00:51 UTC (rev 12838) +++ branches/xmlbuildsystem/reactos/tools/rbuild/tests/data/module.xml 2005-01-05 21:29:54 UTC (rev 12839) @@ -6,7 +6,7 @@ </module> </directory> <directory name="dir2"> - <module name="module2" type="buildtool"> + <module name="module2" type="kernelmodedll"> <file>file3.c</file> <file>file4.c</file> </module> _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/tests/moduletest.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/tests/moduletest.cpp 2005-01-05 21:00:51 UTC (rev 12838) +++ branches/xmlbuildsystem/reactos/tools/rbuild/tests/moduletest.cpp 2005-01-05 21:29:54 UTC (rev 12839) @@ -9,11 +9,13 @@ ARE_EQUAL(2, project.modules.size()); Module& module1 = *project.modules[0]; + IS_TRUE(module1.type == BuildTool); ARE_EQUAL(2, module1.files.size()); ARE_EQUAL("./dir1/file1.c", module1.files[0]->name); ARE_EQUAL("./dir1/file2.c", module1.files[1]->name); Module& module2 = *project.modules[1]; + IS_TRUE(module2.type == KernelModeDLL); ARE_EQUAL(2, module2.files.size()); ARE_EQUAL("./dir2/file3.c", module2.files[0]->name); ARE_EQUAL("./dir2/file4.c", module2.files[1]->name);
19 years, 10 months
1
0
0
0
[hyperion] 12838: honor __USE_W32API
by hyperion@svn.reactos.com
honor __USE_W32API Modified: trunk/reactos/include/tchar.h _____ Modified: trunk/reactos/include/tchar.h --- trunk/reactos/include/tchar.h 2005-01-05 20:59:10 UTC (rev 12837) +++ trunk/reactos/include/tchar.h 2005-01-05 21:00:51 UTC (rev 12838) @@ -30,14 +30,20 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * $Revision: 1.14 $ - * $Author: navaraf $ - * $Date: 2004/08/02 15:04:24 $ + * $Author$ + * $Date$ * */ #ifndef _ROS_TCHAR_H_ #define _ROS_TCHAR_H_ +#ifdef __USE_W32API + +#include_next <tchar.h> + +#else + #include <msvcrt/string.h> /* @@ -263,4 +269,6 @@ #endif /* Not _UNICODE */ +#endif /* Not __USE_W32API */ + #endif /* Not _TCHAR_H_ */
19 years, 10 months
1
0
0
0
[chorns] 12837: Generate MinGW makefile in the backend.
by chorns@svn.reactos.com
Generate MinGW makefile in the backend. Modified: branches/xmlbuildsystem/reactos/tools/rbuild/XML.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.h Modified: branches/xmlbuildsystem/reactos/tools/rbuild/exception.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/exception.h Modified: branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h Modified: branches/xmlbuildsystem/reactos/tools/rbuild/tests/data/module.xml Modified: branches/xmlbuildsystem/reactos/tools/rbuild/tests/data/project.xml Modified: branches/xmlbuildsystem/reactos/tools/rbuild/tests/moduletest.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/tests/projecttest.cpp _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/XML.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/XML.cpp 2005-01-05 19:47:10 UTC (rev 12836) +++ branches/xmlbuildsystem/reactos/tools/rbuild/XML.cpp 2005-01-05 20:59:10 UTC (rev 12837) @@ -7,6 +7,7 @@ #include <assert.h> #include "XML.h" +#include "rbuild.h" using std::string; using std::vector; @@ -397,8 +398,8 @@ } if ( required ) { - printf ( "syntax error: attribute '%s' required for <%s>\n", - attribute.c_str(), name.c_str() ); + throw RequiredAttributeNotFoundException ( attribute, + name ); } return NULL; } @@ -416,8 +417,8 @@ } if ( required ) { - printf ( "syntax error: attribute '%s' required for <%s>\n", - attribute.c_str(), name.c_str() ); + throw RequiredAttributeNotFoundException ( attribute, + name ); } return NULL; } @@ -462,7 +463,7 @@ e->attributes.push_back ( new XMLAttribute ( "top_href", top_file ) ); XMLFile fInc; if ( !fInc.open ( file ) ) - printf ( "xi:include error, couldn't find file '%s'\n", file.c_str() ); + throw FileNotFoundException ( file ); else { Path path2 ( path, att->value ); _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-01-05 19:47:10 UTC (rev 12836) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-01-05 20:59:10 UTC (rev 12837) @@ -6,6 +6,36 @@ using std::string; using std::vector; +#ifdef WIN32 +#define EXEPOSTFIX ".exe" +#define SEP "\\" +string FixSep ( const string& s ) +{ + string s2(s); + char* p = strchr ( &s2[0], '/' ); + while ( p ) + { + *p++ = '\\'; + p = strchr ( p, '/' ); + } + return s2; +} +#else +#define EXEPOSTFIX +#define SEP "/" +string FixSep ( const string& s ) +{ + string s2(s); + char* p = strchr ( &s2[0], '\\' ); + while ( p ) + { + *p++ = '/'; + p = strchr ( p, '\\' ); + } + return s2; +} +#endif + MingwBackend::MingwBackend ( Project& project ) : Backend ( project ) { @@ -13,18 +43,54 @@ void MingwBackend::Process () { + CreateMakefile (); + GenerateHeader (); + GenerateAllTarget (); for ( size_t i = 0; i < ProjectNode.modules.size (); i++ ) { Module& module = *ProjectNode.modules[i]; ProcessModule ( module ); } + CloseMakefile (); } +void MingwBackend::CreateMakefile () +{ + fMakefile = fopen ( ProjectNode.makefile.c_str (), "w" ); + if ( !fMakefile ) + throw AccessDeniedException ( ProjectNode.makefile ); +} + +void MingwBackend::CloseMakefile () +{ + if (fMakefile) + fclose ( fMakefile ); +} + +void MingwBackend::GenerateHeader () +{ + fprintf ( fMakefile, "# THIS FILE IS AUTOMATICALLY GENERATED, EDIT 'ReactOS.xml' INSTEAD\n\n" ); +} + +void MingwBackend::GenerateAllTarget () +{ + fprintf ( fMakefile, "all: " ); + for ( size_t i = 0; i < ProjectNode.modules.size (); i++ ) + { + Module& module = *ProjectNode.modules[i]; + fprintf ( fMakefile, + " %s" SEP "%s" EXEPOSTFIX, + FixSep(module.path).c_str (), + module.name.c_str () ); + } + fprintf ( fMakefile, "\n\n" ); +} + void MingwBackend::ProcessModule ( Module& module ) { MingwModuleHandlerList moduleHandlers; GetModuleHandlers ( moduleHandlers ); - for (size_t i = 0; i < moduleHandlers.size(); i++) + for (size_t i = 0; i < moduleHandlers.size (); i++) { MingwModuleHandler& moduleHandler = *moduleHandlers[i]; if (moduleHandler.CanHandleModule ( module ) ) _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.h --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.h 2005-01-05 19:47:10 UTC (rev 12836) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.h 2005-01-05 20:59:10 UTC (rev 12837) @@ -25,6 +25,11 @@ private: void ProcessModule ( Module& module ); void GetModuleHandlers ( MingwModuleHandlerList& moduleHandlers ); + void CreateMakefile (); + void CloseMakefile (); + void GenerateHeader (); + void GenerateAllTarget (); + FILE* fMakefile; }; #endif /* MINGW_H */ _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/exception.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/exception.cpp 2005-01-05 19:47:10 UTC (rev 12836) +++ branches/xmlbuildsystem/reactos/tools/rbuild/exception.cpp 2005-01-05 20:59:10 UTC (rev 12837) @@ -40,6 +40,13 @@ } +AccessDeniedException::AccessDeniedException(const string& filename) + : Exception ( "Access denied to file '%s'.", filename.c_str() ) +{ + Filename = filename; +} + + InvalidBuildFileException::InvalidBuildFileException(const char* message, ...) { @@ -48,3 +55,13 @@ SetMessage(message, args); va_end(args); } + + +RequiredAttributeNotFoundException::RequiredAttributeNotFoundException( const std::string& attributeName, + const std::string& elementName) + : InvalidBuildFileException ( "Required attribute '%s' not found on '%s'.", + attributeName.c_str (), + elementName.c_str ()) +{ + +} _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/exception.h --- branches/xmlbuildsystem/reactos/tools/rbuild/exception.h 2005-01-05 19:47:10 UTC (rev 12836) +++ branches/xmlbuildsystem/reactos/tools/rbuild/exception.h 2005-01-05 20:59:10 UTC (rev 12837) @@ -25,6 +25,14 @@ }; +class AccessDeniedException : public Exception +{ +public: + AccessDeniedException(const std::string& filename); + std::string Filename; +}; + + class InvalidBuildFileException : public Exception { public: @@ -32,4 +40,12 @@ ...); }; + +class RequiredAttributeNotFoundException : public InvalidBuildFileException +{ +public: + RequiredAttributeNotFoundException(const std::string& attributeName, + const std::string& elementName); +}; + #endif /* __EXCEPTION_H */ _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp 2005-01-05 19:47:10 UTC (rev 12836) +++ branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp 2005-01-05 20:59:10 UTC (rev 12837) @@ -6,36 +6,6 @@ using std::string; using std::vector; -#ifdef WIN32 -#define EXEPOSTFIX ".exe" -#define SEP "\\" -string FixSep ( const string& s ) -{ - string s2(s); - char* p = strchr ( &s2[0], '/' ); - while ( p ) - { - *p++ = '\\'; - p = strchr ( p, '/' ); - } - return s2; -} -#else -#define EXEPOSTFIX -#define SEP "/" -string FixSep ( const string& s ) -{ - string s2(s); - char* p = strchr ( &s2[0], '\\' ); - while ( p ) - { - *p++ = '/'; - p = strchr ( p, '\\' ); - } - return s2; -} -#endif - Project::Project() { } @@ -83,6 +53,9 @@ name = "Unnamed"; else name = att->value; + + att = e.GetAttribute ( "makefile", true ); + makefile = att->value; } else if ( e.name == "module" ) { @@ -105,32 +78,3 @@ for ( size_t i = 0; i < e.subElements.size (); i++ ) ProcessXML ( *e.subElements[i], subpath ); } - -bool -Project::GenerateOutput() -{ - const XMLAttribute* att; - size_t i; - - att = head->GetAttribute ( "makefile", true ); - if ( !att ) - return false; - FILE* f = fopen ( att->value.c_str(), "w" ); - if ( !f ) - { - throw Exception ( "Unable to open '%s' for output", att->value.c_str() ); - return false; - } - fprintf ( f, "# THIS FILE IS AUTOMATICALLY GENERATED, EDIT 'ReactOS.xml' INSTEAD\n\n" ); - - // generate module list: - fprintf ( f, "all: " ); - for ( i = 0; i < modules.size(); i++ ) - { - Module& m = *modules[i]; - fprintf ( f, " %s" SEP "%s" EXEPOSTFIX, FixSep(m.path).c_str(), m.name.c_str() ); - } - fprintf ( f, "\n\n" ); - - return true; -} _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.cpp 2005-01-05 19:47:10 UTC (rev 12836) +++ branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.cpp 2005-01-05 20:59:10 UTC (rev 12837) @@ -20,9 +20,10 @@ try { string projectFilename ( "ReactOS.xml" ); - Project project = Project ( projectFilename ); + Project project ( projectFilename ); Backend* backend = new MingwBackend ( project ); backend->Process (); + delete backend; // REM TODO FIXME actually do something with Project object... #if 0 _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h --- branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h 2005-01-05 19:47:10 UTC (rev 12836) +++ branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h 2005-01-05 20:59:10 UTC (rev 12837) @@ -15,6 +15,7 @@ { public: std::string name; + std::string makefile; std::vector<Module*> modules; Project (); @@ -22,13 +23,13 @@ ~Project (); void ProcessXML ( const XMLElement& e, const std::string& path ); - bool GenerateOutput(); private: void ReadXml (); XMLFile xmlfile; XMLElement* head; }; + class Module { public: @@ -46,6 +47,7 @@ void ProcessXML ( const XMLElement& e, const std::string& path ); }; + class File { public: _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/tests/data/module.xml --- branches/xmlbuildsystem/reactos/tools/rbuild/tests/data/module.xml 2005-01-05 19:47:10 UTC (rev 12836) +++ branches/xmlbuildsystem/reactos/tools/rbuild/tests/data/module.xml 2005-01-05 20:59:10 UTC (rev 12837) @@ -1,4 +1,4 @@ -<project name="Project"> +<project name="Project" makefile="Makefile"> <directory name="dir1"> <module name="module1" type="buildtool"> <file>file1.c</file> _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/tests/data/project.xml --- branches/xmlbuildsystem/reactos/tools/rbuild/tests/data/project.xml 2005-01-05 19:47:10 UTC (rev 12836) +++ branches/xmlbuildsystem/reactos/tools/rbuild/tests/data/project.xml 2005-01-05 20:59:10 UTC (rev 12837) @@ -1,4 +1,4 @@ -<project name="Project"> +<project name="Project" makefile="Makefile"> <directory name="dir1"> <module name="module1" type="buildtool"> </module> _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/tests/moduletest.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/tests/moduletest.cpp 2005-01-05 19:47:10 UTC (rev 12836) +++ branches/xmlbuildsystem/reactos/tools/rbuild/tests/moduletest.cpp 2005-01-05 20:59:10 UTC (rev 12837) @@ -5,15 +5,15 @@ void ModuleTest::Run() { string projectFilename ( "tests/data/module.xml" ); - Project* project = new Project( projectFilename ); - ARE_EQUAL(2, project->modules.size()); + Project project ( projectFilename ); + ARE_EQUAL(2, project.modules.size()); - Module& module1 = *project->modules[0]; + Module& module1 = *project.modules[0]; ARE_EQUAL(2, module1.files.size()); ARE_EQUAL("./dir1/file1.c", module1.files[0]->name); ARE_EQUAL("./dir1/file2.c", module1.files[1]->name); - Module& module2 = *project->modules[1]; + Module& module2 = *project.modules[1]; ARE_EQUAL(2, module2.files.size()); ARE_EQUAL("./dir2/file3.c", module2.files[0]->name); ARE_EQUAL("./dir2/file4.c", module2.files[1]->name); _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/tests/projecttest.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/tests/projecttest.cpp 2005-01-05 19:47:10 UTC (rev 12836) +++ branches/xmlbuildsystem/reactos/tools/rbuild/tests/projecttest.cpp 2005-01-05 20:59:10 UTC (rev 12837) @@ -5,6 +5,6 @@ void ProjectTest::Run() { string projectFilename ( "tests/data/project.xml" ); - Project* project = new Project( projectFilename ); - ARE_EQUAL(2, project->modules.size()); + Project project( projectFilename ); + ARE_EQUAL(2, project.modules.size()); }
19 years, 10 months
1
0
0
0
[chorns] 12836: Handle modules.
by chorns@svn.reactos.com
Handle modules. Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/backend.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/backend.h Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.h Added: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp Added: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .h Modified: branches/xmlbuildsystem/reactos/tools/rbuild/makefile Modified: branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.cpp Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/backend.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/backend.cpp 2005-01-05 19:28:55 UTC (rev 12835) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/backend.cpp 2005-01-05 19:47:10 UTC (rev 12836) @@ -4,6 +4,7 @@ #include "../Rbuild.h" #include "backend.h" -Backend::Backend ( Project& project ) : ProjectNode(project) +Backend::Backend ( Project& project ) + : ProjectNode ( project ) { } _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/backend.h --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/backend.h 2005-01-05 19:28:55 UTC (rev 12835) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/backend.h 2005-01-05 19:47:10 UTC (rev 12836) @@ -6,7 +6,8 @@ class Backend { public: - Backend ( Project& ); + Backend ( Project& project ); + virtual void Process () = 0; protected: Project& ProjectNode; }; _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-01-05 19:28:55 UTC (rev 12835) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-01-05 19:47:10 UTC (rev 12836) @@ -3,7 +3,39 @@ #include "mingw.h" -MingwBackend::MingwBackend(Project& project) - : Backend(project) +using std::string; +using std::vector; + +MingwBackend::MingwBackend ( Project& project ) + : Backend ( project ) { } + +void MingwBackend::Process () +{ + for ( size_t i = 0; i < ProjectNode.modules.size (); i++ ) + { + Module& module = *ProjectNode.modules[i]; + ProcessModule ( module ); + } +} + +void MingwBackend::ProcessModule ( Module& module ) +{ + MingwModuleHandlerList moduleHandlers; + GetModuleHandlers ( moduleHandlers ); + for (size_t i = 0; i < moduleHandlers.size(); i++) + { + MingwModuleHandler& moduleHandler = *moduleHandlers[i]; + if (moduleHandler.CanHandleModule ( module ) ) + { + moduleHandler.Process ( module ); + return; + } + } +} + +void MingwBackend::GetModuleHandlers ( MingwModuleHandlerList& moduleHandlers ) +{ + moduleHandlers.push_back ( new MingwKernelModuleHandler () ); +} _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.h --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.h 2005-01-05 19:28:55 UTC (rev 12835) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/mingw.h 2005-01-05 19:47:10 UTC (rev 12836) @@ -2,11 +2,29 @@ #define MINGW_H #include "../backend.h" +#include "modulehandler.h" +class MingwModuleHandlerList : public std::vector<MingwModuleHandler*> +{ +public: + ~MingwModuleHandlerList() + { + for ( size_t i = 0; i < size(); i++ ) + { + delete (*this)[i]; + } + } +}; + + class MingwBackend : public Backend { public: - MingwBackend ( Project& ); + MingwBackend ( Project& project ); + virtual void Process (); +private: + void ProcessModule ( Module& module ); + void GetModuleHandlers ( MingwModuleHandlerList& moduleHandlers ); }; #endif /* MINGW_H */ _____ Added: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp 2005-01-05 19:28:55 UTC (rev 12835) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .cpp 2005-01-05 19:47:10 UTC (rev 12836) @@ -0,0 +1,24 @@ + +#include "../../pch.h" + +#include "../../rbuild.h" +#include "mingw.h" +#include "modulehandler.h" + +MingwModuleHandler::MingwModuleHandler () +{ +} + + +MingwKernelModuleHandler::MingwKernelModuleHandler () +{ +} + +bool MingwKernelModuleHandler::CanHandleModule ( Module& module ) +{ + return true; +} + +void MingwKernelModuleHandler::Process ( Module& module ) +{ +} _____ Added: branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .h --- branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .h 2005-01-05 19:28:55 UTC (rev 12835) +++ branches/xmlbuildsystem/reactos/tools/rbuild/backend/mingw/modulehandler .h 2005-01-05 19:47:10 UTC (rev 12836) @@ -0,0 +1,23 @@ +#ifndef MINGW_MODULEHANDLER_H +#define MINGW_MODULEHANDLER_H + +#include "../backend.h" + +class MingwModuleHandler +{ +public: + MingwModuleHandler (); + virtual bool CanHandleModule ( Module& module ) = 0; + virtual void Process ( Module& module ) = 0; +}; + + +class MingwKernelModuleHandler : public MingwModuleHandler +{ +public: + MingwKernelModuleHandler (); + virtual bool CanHandleModule ( Module& module ); + virtual void Process ( Module& module ); +}; + +#endif /* MINGW_MODULEHANDLER_H */ _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/makefile --- branches/xmlbuildsystem/reactos/tools/rbuild/makefile 2005-01-05 19:28:55 UTC (rev 12835) +++ branches/xmlbuildsystem/reactos/tools/rbuild/makefile 2005-01-05 19:47:10 UTC (rev 12836) @@ -5,8 +5,9 @@ all: $(TARGET) BACKEND_MINGW_BASE_OBJECTS = \ - backend/mingw/mingw.cpp - + backend/mingw/mingw.cpp \ + backend/mingw/modulehandler.cpp + BACKEND_BASE_OBJECTS = \ $(BACKEND_MINGW_BASE_OBJECTS) \ backend/backend.cpp _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp 2005-01-05 19:28:55 UTC (rev 12835) +++ branches/xmlbuildsystem/reactos/tools/rbuild/project.cpp 2005-01-05 19:47:10 UTC (rev 12836) @@ -40,21 +40,21 @@ { } -Project::Project(const string& filename) +Project::Project ( const string& filename ) { if ( !xmlfile.open ( filename ) ) throw FileNotFoundException ( filename ); ReadXml(); } -Project::~Project() +Project::~Project () { - for ( size_t i = 0; i < modules.size(); i++ ) + for ( size_t i = 0; i < modules.size (); i++ ) delete modules[i]; delete head; } -void Project::ReadXml() +void Project::ReadXml () { Path path; @@ -102,7 +102,7 @@ return; subpath = path + "/" + att->value; } - for ( size_t i = 0; i < e.subElements.size(); i++ ) + for ( size_t i = 0; i < e.subElements.size (); i++ ) ProcessXML ( *e.subElements[i], subpath ); } _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.cpp --- branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.cpp 2005-01-05 19:28:55 UTC (rev 12835) +++ branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.cpp 2005-01-05 19:47:10 UTC (rev 12836) @@ -8,6 +8,8 @@ #include <assert.h> #include "rbuild.h" +#include "backend/backend.h" +#include "backend/mingw/mingw.h" using std::string; using std::vector; @@ -18,9 +20,10 @@ try { string projectFilename ( "ReactOS.xml" ); - Project project ( projectFilename ); - project.GenerateOutput(); - + Project project = Project ( projectFilename ); + Backend* backend = new MingwBackend ( project ); + backend->Process (); + // REM TODO FIXME actually do something with Project object... #if 0 printf ( "Found %d modules:\n", project.modules.size() ); _____ Modified: branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h --- branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h 2005-01-05 19:28:55 UTC (rev 12835) +++ branches/xmlbuildsystem/reactos/tools/rbuild/rbuild.h 2005-01-05 19:47:10 UTC (rev 12836) @@ -20,7 +20,8 @@ Project (); Project ( const std::string& filename ); ~Project (); - void ProcessXML ( const XMLElement& e, const std::string& path ); + void ProcessXML ( const XMLElement& e, + const std::string& path ); bool GenerateOutput(); private: void ReadXml ();
19 years, 10 months
1
0
0
0
[hbirr] 12835: - Used a system thread to shutdown various kernel components.
by hbirr@svn.reactos.com
- Used a system thread to shutdown various kernel components. - Halt also the other processors on a smp machine. Modified: trunk/reactos/ntoskrnl/ex/power.c _____ Modified: trunk/reactos/ntoskrnl/ex/power.c --- trunk/reactos/ntoskrnl/ex/power.c 2005-01-05 19:27:58 UTC (rev 12834) +++ trunk/reactos/ntoskrnl/ex/power.c 2005-01-05 19:28:55 UTC (rev 12835) @@ -16,6 +16,96 @@ /* FUNCTIONS *****************************************************************/ +VOID STDCALL +KeSetTargetProcessorDpc (IN PKDPC Dpc, + IN CCHAR Number); + +VOID STDCALL +KiHaltProcessorDpcRoutine(IN PKDPC Dpc, + IN PVOID DeferredContext, + IN PVOID SystemArgument1, + IN PVOID SystemArgument2) +{ + if (DeferredContext) + { + ExFreePool(DeferredContext); + } + while (TRUE) + { + KfRaiseIrql(SYNCH_LEVEL); + Ke386HaltProcessor(); + } +} + +VOID STDCALL +ShutdownThreadMain(PVOID Context) +{ + SHUTDOWN_ACTION Action = (SHUTDOWN_ACTION)Context; + LARGE_INTEGER Waittime; + + /* Run the thread on the boot processor */ + KeSetSystemAffinityThread(1); + + IoShutdownRegisteredDevices(); + CmShutdownRegistry(); + IoShutdownRegisteredFileSystems(); + + PiShutdownProcessManager(); + MiShutdownMemoryManager(); + + Waittime.QuadPart = (LONGLONG)-10000000; /* 1sec */ + KeDelayExecutionThread(KernelMode, FALSE, &Waittime); + + if (Action == ShutdownNoReboot) + { + +#if 0 + /* Switch off */ + HalReturnToFirmware (FIRMWARE_OFF); +#else +#ifdef CONFIG_SMP + ULONG i; + KIRQL OldIrql; + + OldIrql = KeRaiseIrqlToDpcLevel(); + /* Halt all other processors */ + for (i = 0; i < KeNumberProcessors; i++) + { + if (i != KeGetCurrentProcessorNumber()) + { + PKDPC Dpc = ExAllocatePool(NonPagedPool, sizeof(KDPC)); + if (Dpc == NULL) + { + KEBUGCHECK(0); + } + KeInitializeDpc(Dpc, KiHaltProcessorDpcRoutine, (PVOID)Dpc); + KeSetTargetProcessorDpc(Dpc, i); + KeInsertQueueDpc(Dpc, NULL, NULL); + KiIpiSendRequest(1 << i, IPI_REQUEST_DPC); + } + } + KeLowerIrql(OldIrql); +#endif /* CONFIG_SMP */ + PopSetSystemPowerState(PowerSystemShutdown); + + CHECKPOINT1; + + KiHaltProcessorDpcRoutine(NULL, NULL, NULL, NULL); + /* KiHaltProcessor does never return */ + +#endif + } + else if (Action == ShutdownReboot) + { + HalReturnToFirmware (FIRMWARE_REBOOT); + } + else + { + HalReturnToFirmware (FIRMWARE_HALT); + } +} + + NTSTATUS STDCALL NtSetSystemPowerState(IN POWER_ACTION SystemAction, IN SYSTEM_POWER_STATE MinSystemState, @@ -31,6 +121,10 @@ NTSTATUS STDCALL NtShutdownSystem(IN SHUTDOWN_ACTION Action) { + NTSTATUS Status; + HANDLE ThreadHandle; + PETHREAD ShutdownThread; + static PCH FamousLastWords[] = { "So long, and thanks for all the fish\n", @@ -84,42 +178,41 @@ ZwQuerySystemTime(&Now); Now.u.LowPart = Now.u.LowPart >> 8; /* Seems to give a somewhat better "random" number */ - IoShutdownRegisteredDevices(); - CmShutdownRegistry(); - IoShutdownRegisteredFileSystems(); - - PiShutdownProcessManager(); - MiShutdownMemoryManager(); - if (Action == ShutdownNoReboot) { HalReleaseDisplayOwnership(); HalDisplayString("\nYou can switch off your computer now\n\n"); HalDisplayString(FamousLastWords[Now.u.LowPart % (sizeof(FamousLastWords) / sizeof(PCH))]); -#if 0 - /* Switch off */ - HalReturnToFirmware (FIRMWARE_OFF); -#else - PopSetSystemPowerState(PowerSystemShutdown); - - while (TRUE) - { - Ke386DisableInterrupts(); - Ke386HaltProcessor(); - } -#endif } - else if (Action == ShutdownReboot) + Status = PsCreateSystemThread(&ThreadHandle, + THREAD_ALL_ACCESS, + NULL, + NULL, + NULL, + ShutdownThreadMain, + (PVOID)Action); + if (!NT_SUCCESS(Status)) + { + KEBUGCHECK(0); + } + Status = ObReferenceObjectByHandle(ThreadHandle, + THREAD_ALL_ACCESS, + PsThreadType, + KernelMode, + (PVOID*)&ShutdownThread, + NULL); + NtClose(ThreadHandle); + if (!NT_SUCCESS(Status)) { - HalReturnToFirmware (FIRMWARE_REBOOT); + KEBUGCHECK(0); } - else - { - HalReturnToFirmware (FIRMWARE_HALT); - } - + + KeSetPriorityThread(&ShutdownThread->Tcb, LOW_REALTIME_PRIORITY + 1); + ObDereferenceObject(ShutdownThread); + return STATUS_SUCCESS; } + /* EOF */
19 years, 10 months
1
0
0
0
← Newer
1
...
51
52
53
54
55
56
57
...
71
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
Results per page:
10
25
50
100
200