Modified: branches/expat-rbuild/reactos/tools/buildno/buildno.cpp
Added: branches/expat-rbuild/reactos/tools/buildno/buildno.dsp
Added: branches/expat-rbuild/reactos/tools/buildno/buildno.dsw
Modified: branches/expat-rbuild/reactos/tools/buildno/buildno.mak
Property changes on: branches/expat-rbuild/reactos/tools/buildno
___________________________________________________________________
Name: svn:ignore
+ Debug
Release
*.opt
*.ncb
--- branches/expat-rbuild/reactos/tools/buildno/buildno.cpp 2006-02-12 22:21:11 UTC (rev 111)
+++ branches/expat-rbuild/reactos/tools/buildno/buildno.cpp 2006-02-12 22:21:56 UTC (rev 112)
@@ -35,7 +35,10 @@
#define ros_mkdir(dir, mode) mkdir((dir), (mode))
#endif
#include "version.h"
+
#include "xml.h"
+using namespace XMLStorage;
+using namespace std;
#define FALSE 0
#define TRUE 1
@@ -115,6 +118,9 @@
unsigned int length;
int dllversion = KERNEL_VERSION_MAJOR + 42;
+ if (!filename || !*filename)
+ return 1;
+
s1 = s = (char *) malloc(256 * 1024);
s = s + sprintf (s, "/* Do not edit - Machine generated */\n");
@@ -236,73 +242,42 @@
return 0;
}
-static char *
+static string
GetRev(void)
{
- static char Unknown[] = "UNKNOWN";
- static char Revision[10]; /* 999999999 revisions should be enough for everyone... */
+ try {
+ XMLDoc doc;
- try
- {
- XMLElement *head;
+ if (!doc.read(".svn/entries"))
+ doc.read("_svn/entries");
- try
- {
- head = XMLLoadFile(".svn/entries");
- }
- catch(XMLFileNotFoundException)
- {
- head = XMLLoadFile("_svn/entries");
- }
- XMLElement *entries = head->subElements[0];
- for (size_t i = 0; i < entries->subElements.size(); i++)
- {
- XMLElement *entry = entries->subElements[i];
- if ("entry" == entry->name)
- {
- bool GotName = false;
- bool GotKind = false;
- bool GotRevision = false;
- for (size_t j = 0; j < entry->attributes.size(); j++)
- {
- XMLAttribute *Attribute = entry->attributes[j];
- if ("name" == Attribute->name && "" == Attribute->value)
- {
- GotName = true;
- }
- if ("kind" == Attribute->name && "dir" == Attribute->value)
- {
- GotKind = true;
- }
- if ("revision" == Attribute->name)
- {
- if (sizeof(Revision) <= Attribute->value.length() + 1)
- {
- strcpy(Revision, "revtoobig");
- }
- else
- {
- strcpy(Revision, Attribute->value.c_str());
- }
- GotRevision = true;
- }
- if (GotName && GotKind && GotRevision)
- {
- delete head;
- return Revision;
- }
- }
- }
- }
+ XMLPos pos(&doc);
- delete head;
- }
- catch(...)
- {
- ;
- }
+ // enter the "wc-entries" root element
+ if (pos.go_down("wc-entries")) {
+ // enumerate all "entry" children elements
+ const_XMLChildrenFilter entries(pos, "entry");
- return Unknown;
+ for(const_XMLChildrenFilter::const_iterator it=entries.begin(); it!=entries.end(); ++it) {
+ const XMLNode& entry = **it;
+
+ string kind = entry.get("kind");
+ string name = entry.get("name");
+ string revision = entry.get("revision");
+
+ if (kind=="dir" && name=="" && !revision.empty())
+ return revision;
+ }
+
+ pos.back();
+ }
+ }
+ catch(exception& e)
+ {
+ fprintf(stderr, "Exception: %s\n", e.what());
+ }
+
+ return "UNKNOWN";
}
@@ -402,7 +377,7 @@
*/
build = t1_tm->tm_year * 10000 + (t1_tm->tm_mon + 1) * 100 + t1_tm->tm_mday;
- sprintf(buildstr, "%d-r%s", build, GetRev());
+ sprintf(buildstr, "%d-r%s", build, GetRev().c_str());
if (! quiet)
{
--- branches/expat-rbuild/reactos/tools/buildno/buildno.dsp 2006-02-12 22:21:11 UTC (rev 111)
+++ branches/expat-rbuild/reactos/tools/buildno/buildno.dsp 2006-02-12 22:21:56 UTC (rev 112)
@@ -0,0 +1,104 @@
+# Microsoft Developer Studio Project File - Name="buildno" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=buildno - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "buildno.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "buildno.mak" CFG="buildno - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "buildno - Win32 Release" (based on "Win32 (x86) Console Application")
+!MESSAGE "buildno - Win32 Debug" (based on "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP AllowPerConfigDependencies 0
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "buildno - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir "Release"
+# PROP BASE Intermediate_Dir "Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir "Release"
+# PROP Intermediate_Dir "Release"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /W3 /GX /O2 /I ".." /I "..\..\include\reactos" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_ROS_" /D "HAVE_EXPAT_CONFIG_H" /D XMLCALL="" /D XMLIMPORT="" /D "_NO_COMMENT" /D "XMLNODE_LOCATION" /YX /FD /c
+# ADD BASE RSC /l 0x407 /d "NDEBUG"
+# ADD RSC /l 0x407 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
+
+!ELSEIF "$(CFG)" == "buildno - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "Debug"
+# PROP BASE Intermediate_Dir "Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir "Debug"
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I ".." /I "..\..\include\reactos" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_ROS_" /D "HAVE_EXPAT_CONFIG_H" /D XMLCALL="" /D XMLIMPORT="" /D "_NO_COMMENT" /D "XMLNODE_LOCATION" /FR /YX /FD /GZ /c
+# ADD BASE RSC /l 0x407 /d "_DEBUG"
+# ADD RSC /l 0x407 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+
+!ENDIF
+
+# Begin Target
+
+# Name "buildno - Win32 Release"
+# Name "buildno - Win32 Debug"
+# Begin Source File
+
+SOURCE=.\buildno.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\expat\xmlparse.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\expat\xmlrole.c
+# End Source File
+# Begin Source File
+
+SOURCE=..\xmlstorage.cpp
+# End Source File
+# Begin Source File
+
+SOURCE=..\expat\xmltok.c
+# End Source File
+# End Target
+# End Project
Property changes on: branches/expat-rbuild/reactos/tools/buildno/buildno.dsp
___________________________________________________________________
Name: svn:eol-style
+ CRLF
--- branches/expat-rbuild/reactos/tools/buildno/buildno.dsw 2006-02-12 22:21:11 UTC (rev 111)
+++ branches/expat-rbuild/reactos/tools/buildno/buildno.dsw 2006-02-12 22:21:56 UTC (rev 112)
@@ -0,0 +1,29 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00
+# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
+
+###############################################################################
+
+Project: "buildno"=".\buildno.dsp" - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
+Global:
+
+Package=<5>
+{{{
+}}}
+
+Package=<3>
+{{{
+}}}
+
+###############################################################################
+
Property changes on: branches/expat-rbuild/reactos/tools/buildno/buildno.dsw
___________________________________________________________________
Name: svn:eol-style
+ CRLF
--- branches/expat-rbuild/reactos/tools/buildno/buildno.mak 2006-02-12 22:21:11 UTC (rev 111)
+++ branches/expat-rbuild/reactos/tools/buildno/buildno.mak 2006-02-12 22:21:56 UTC (rev 112)
@@ -25,14 +25,15 @@
BUILDNO_OBJECTS = \
$(addprefix $(INTERMEDIATE_), $(BUILDNO_SOURCES:.cpp=.o))
-BUILDNO_HOST_CXXFLAGS = -I$(TOOLS_BASE) -Iinclude/reactos $(TOOLS_CPPFLAGS)
+BUILDNO_HOST_CXXFLAGS = -I$(TOOLS_BASE) -Iinclude/reactos $(TOOLS_CPPFLAGS) \
+ -DXMLNODE_LOCATION -DHAVE_EXPAT_CONFIG_H -DXMLCALL="" -DXMLIMPORT="" -D_ROS_
BUILDNO_HOST_LFLAGS = $(TOOLS_LFLAGS)
.PHONY: buildno
buildno: $(BUILDNO_TARGET)
-$(BUILDNO_TARGET): $(BUILDNO_OBJECTS) $(XML_SSPRINTF_OBJECTS) | $(BUILDNO_OUT)
+$(BUILDNO_TARGET): $(BUILDNO_OBJECTS) $(TOOLS_OBJECTS) $(EXPAT_OBJECTS) | $(BUILDNO_OUT)
$(ECHO_LD)
${host_gpp} $^ $(BUILDNO_HOST_LFLAGS) -o $@