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
--- 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 )
{
}
--- 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;
};
--- 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 () );
+}
--- 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 */
--- 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 )
+{
+}
--- 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 */
--- 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
--- 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 );
}
--- 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() );
--- 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 ();