move xml.h/cpp and ssprintf.h/cpp up a directory, make both rbuild and buildno use these same files Modified: trunk/reactos/tools/buildno/buildno.cpp Modified: trunk/reactos/tools/buildno/buildno.mak Deleted: trunk/reactos/tools/buildno/exception.cpp Deleted: trunk/reactos/tools/buildno/exception.h Deleted: trunk/reactos/tools/buildno/ssprintf.cpp Deleted: trunk/reactos/tools/buildno/ssprintf.h Deleted: trunk/reactos/tools/buildno/xml.cpp Deleted: trunk/reactos/tools/buildno/xml.h Modified: trunk/reactos/tools/rbuild/rbuild.dsp Modified: trunk/reactos/tools/rbuild/rbuild.mak Deleted: trunk/reactos/tools/rbuild/ssprintf.cpp Deleted: trunk/reactos/tools/rbuild/ssprintf.h Deleted: trunk/reactos/tools/rbuild/xml.cpp Deleted: trunk/reactos/tools/rbuild/xml.h Added: trunk/reactos/tools/ssprintf.cpp Added: trunk/reactos/tools/ssprintf.h Modified: trunk/reactos/tools/tools.mak Added: trunk/reactos/tools/xml.cpp Added: trunk/reactos/tools/xml.h _____
Modified: trunk/reactos/tools/buildno/buildno.cpp --- trunk/reactos/tools/buildno/buildno.cpp 2005-11-27 23:04:05 UTC (rev 19707) +++ trunk/reactos/tools/buildno/buildno.cpp 2005-11-27 23:04:51 UTC (rev 19708) @@ -29,7 +29,6 @@
#include <string.h> #include "version.h" #include "xml.h" -#include "exception.h"
#define FALSE 0 #define TRUE 1 @@ -179,20 +178,19 @@
try { - Path path; XMLElement *head;
try { - head = XMLLoadFile(".svn/entries", path); + head = XMLLoadFile(".svn/entries"); } - catch(FileNotFoundException) + catch(XMLFileNotFoundException) { - head = XMLLoadFile("_svn/entries", path); + 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) { _____
Modified: trunk/reactos/tools/buildno/buildno.mak --- trunk/reactos/tools/buildno/buildno.mak 2005-11-27 23:04:05 UTC (rev 19707) +++ trunk/reactos/tools/buildno/buildno.mak 2005-11-27 23:04:51 UTC (rev 19708) @@ -20,38 +20,26 @@
BUILDNO_SOURCES = $(addprefix $(BUILDNO_BASE_), \ buildno.cpp \ - exception.cpp \ - ssprintf.cpp \ - xml.cpp \ )
BUILDNO_OBJECTS = \ - $(addprefix $(INTERMEDIATE_), $(BUILDNO_SOURCES:.cpp=.o)) + $(addprefix $(INTERMEDIATE_), $(BUILDNO_SOURCES:.cpp=.o))
-BUILDNO_HOST_CXXFLAGS = -Iinclude/reactos $(TOOLS_CPPFLAGS) +BUILDNO_HOST_CXXFLAGS = -I$(TOOLS_BASE) -Iinclude/reactos $(TOOLS_CPPFLAGS)
BUILDNO_HOST_LFLAGS = $(TOOLS_LFLAGS)
-$(BUILDNO_TARGET): $(BUILDNO_OBJECTS) | $(BUILDNO_OUT) +.PHONY: buildno +buildno: $(BUILDNO_TARGET) + +$(BUILDNO_TARGET): $(BUILDNO_OBJECTS) $(XML_SSPRINTF_OBJECTS) | $(BUILDNO_OUT) $(ECHO_LD) - ${host_gpp} $(BUILDNO_OBJECTS) $(BUILDNO_HOST_LFLAGS) -o $@ + ${host_gpp} $^ $(BUILDNO_HOST_LFLAGS) -o $@
$(BUILDNO_INT_)buildno.o: $(BUILDNO_BASE_)buildno.cpp | $(BUILDNO_INT) $(ECHO_CC) ${host_gpp} $(BUILDNO_HOST_CXXFLAGS) -c $< -o $@
-$(BUILDNO_INT_)exception.o: $(BUILDNO_BASE_)exception.cpp | $(BUILDNO_INT) - $(ECHO_CC) - ${host_gpp} $(BUILDNO_HOST_CXXFLAGS) -c $< -o $@ - -$(BUILDNO_INT_)ssprintf.o: $(BUILDNO_BASE_)ssprintf.cpp | $(BUILDNO_INT) - $(ECHO_CC) - ${host_gpp} $(BUILDNO_HOST_CXXFLAGS) -c $< -o $@ - -$(BUILDNO_INT_)xml.o: $(BUILDNO_BASE_)xml.cpp | $(BUILDNO_INT) - $(ECHO_CC) - ${host_gpp} $(BUILDNO_HOST_CXXFLAGS) -c $< -o $@ - .PHONY: buildno_clean buildno_clean: -@$(rm) $(BUILDNO_TARGET) $(BUILDNO_OBJECTS) 2>$(NUL) _____
Deleted: trunk/reactos/tools/buildno/exception.cpp --- trunk/reactos/tools/buildno/exception.cpp 2005-11-27 23:04:05 UTC (rev 19707) +++ trunk/reactos/tools/buildno/exception.cpp 2005-11-27 23:04:51 UTC (rev 19708) @@ -1,178 +0,0 @@
-#include "pch.h" - -#ifdef RBUILD -#include "rbuild.h" -#else -#include "exception.h" -#include "ssprintf.h" -#endif - -using std::string; - -Exception::Exception () -{ -} - -Exception::Exception ( const string& message ) -{ - Message = message; -} - -Exception::Exception ( const char* format, - ...) -{ - va_list args; - va_start ( args, - format); - Message = ssvprintf ( format, - args); - va_end ( args ); -} - -void Exception::SetMessage ( const char* message, - va_list args) -{ - Message = ssvprintf ( message, - args); -} - - -OutOfMemoryException::OutOfMemoryException () - : Exception ( "Out of memory" ) -{ -} - - -InvalidOperationException::InvalidOperationException ( const char* filename, - const int linenumber ) -{ - Message = ssprintf ( "%s:%d", - filename, - linenumber ); -} - -InvalidOperationException::InvalidOperationException ( const char* filename, - const int linenumber, - const char* message, - ... ) -{ - string errorMessage; - va_list args; - va_start ( args, - message ); - errorMessage = ssvprintf ( message, - args ); - va_end ( args ); - Message = ssprintf ( "%s:%d %s", - filename, - linenumber, - errorMessage.c_str () ); -} - - -FileNotFoundException::FileNotFoundException ( const string& filename ) - : Exception ( "File '%s' not found.", - filename.c_str() ) -{ - Filename = filename; -} - - -AccessDeniedException::AccessDeniedException ( const string& filename) - : Exception ( "Access denied to file '%s'.", - filename.c_str() ) -{ - Filename = filename; -} - - -InvalidBuildFileException::InvalidBuildFileException ( const string& location, - const char* message, - ...) -{ - va_list args; - va_start ( args, - message ); - SetLocationMessage ( location, message, args ); - va_end ( args ); -} - -InvalidBuildFileException::InvalidBuildFileException () -{ -} - -void -InvalidBuildFileException::SetLocationMessage ( const std::string& location, - const char* message, - va_list args ) -{ - Message = location + ": " + ssvprintf ( message, args ); -} - -XMLSyntaxErrorException::XMLSyntaxErrorException ( const string& location, - const char* message, - ... ) -{ - va_list args; - va_start ( args, - message ); - SetLocationMessage ( location, message, args ); - va_end ( args ); -} - - -RequiredAttributeNotFoundException::RequiredAttributeNotFoundException ( - const string& location, - const string& attributeName, - const string& elementName ) - : InvalidBuildFileException ( location, - "Required attribute '%s' not found on '%s'.", - attributeName.c_str (), - elementName.c_str ()) -{ -} - -InvalidAttributeValueException::InvalidAttributeValueException ( - const string& location, - const string& name, - const string& value ) - : InvalidBuildFileException ( location, - "Attribute '%s' has an invalid value '%s'.", - name.c_str (), - value.c_str () ) -{ - -} - -BackendNameConflictException::BackendNameConflictException ( const string& name ) - : Exception ( "Backend name conflict: '%s'", - name.c_str() ) -{ -} - - -UnknownBackendException::UnknownBackendException ( const string& name ) - : Exception ( "Unknown Backend requested: '%s'", - name.c_str() ) -{ -} - - -UnknownModuleTypeException::UnknownModuleTypeException ( const string& location, - int moduletype ) - : InvalidBuildFileException ( location, - "module type requested: %i", - moduletype ) -{ -} - - -InvocationFailedException::InvocationFailedException ( const std::string& command, - int exitcode ) - : Exception ( "Failed to execute '%s' (exit code %d)", - command.c_str (), - exitcode ) -{ - Command = command; - ExitCode = exitcode; -} _____
Deleted: trunk/reactos/tools/buildno/exception.h --- trunk/reactos/tools/buildno/exception.h 2005-11-27 23:04:05 UTC (rev 19707) +++ trunk/reactos/tools/buildno/exception.h 2005-11-27 23:04:51 UTC (rev 19708) @@ -1,125 +0,0 @@
-#ifndef __EXCEPTION_H -#define __EXCEPTION_H - -#include "pch.h" - -class Exception -{ -public: - Exception ( const std::string& message ); - Exception ( const char* format, - ...); - std::string Message; -protected: - Exception (); - void SetMessage ( const char* message, - va_list args); -}; - - -class InvalidOperationException : public Exception -{ -public: - InvalidOperationException ( const char* filename, - const int linenumber); - InvalidOperationException ( const char* filename, - const int linenumber, - const char* message, - ... ); -}; - - -class OutOfMemoryException : public Exception -{ -public: - OutOfMemoryException (); -}; - - -class FileNotFoundException : public Exception -{ -public: - FileNotFoundException ( const std::string& filename ); - std::string Filename; -}; - - -class AccessDeniedException : public Exception -{ -public: - AccessDeniedException ( const std::string& filename ); - std::string Filename; -}; - -class InvalidBuildFileException : public Exception -{ -public: - InvalidBuildFileException ( const std::string& location, - const char* message, - ...); - void SetLocationMessage ( const std::string& location, - const char* message, - va_list args ); -protected: - InvalidBuildFileException (); -}; - - -class XMLSyntaxErrorException : public InvalidBuildFileException -{ -public: - XMLSyntaxErrorException ( const std::string& location, - const char* message, - ... ); -}; - - -class RequiredAttributeNotFoundException : public InvalidBuildFileException -{ -public: - RequiredAttributeNotFoundException ( const std::string& location, - const std::string& attributeName, - const std::string& elementName ); -}; - - -class InvalidAttributeValueException : public InvalidBuildFileException -{ -public: - InvalidAttributeValueException ( const std::string& location, - const std::string& name, - const std::string& value ); -}; - - -class BackendNameConflictException : public Exception -{ -public: - BackendNameConflictException ( const std::string& name ); -}; - - -class UnknownBackendException : public Exception -{ -public: - UnknownBackendException ( const std::string& name ); -}; - -class UnknownModuleTypeException : public InvalidBuildFileException -{ -public: - UnknownModuleTypeException ( const std::string& location, - int moduletype ); -}; - - -class InvocationFailedException : public Exception -{ -public: - InvocationFailedException ( const std::string& command, - int exitcode ); - std::string Command; - int ExitCode; -}; - -#endif /* __EXCEPTION_H */ _____
Deleted: trunk/reactos/tools/buildno/ssprintf.cpp --- trunk/reactos/tools/buildno/ssprintf.cpp 2005-11-27 23:04:05 UTC (rev 19707) +++ trunk/reactos/tools/buildno/ssprintf.cpp 2005-11-27 23:04:51 UTC (rev 19708) @@ -1,1931 +0,0 @@
-// ssprintf.cpp - -#include "pch.h" - -#ifdef __FreeBSD__ -# include <stdlib.h> -#else -# include <malloc.h> -#endif // __FreeBSD__ -#include <math.h> -#include <float.h> -#include <assert.h> -#include "ssprintf.h" - -#ifdef __FreeBSD__ -# define __isnan isnan -# define __finite finite -# define powl __builtin_powl -# define modfl __builtin_modfl -#endif // _FreeBSD__ - -#ifdef _MSC_VER -#define alloca _alloca -#endif//_MSC_VER - -#ifdef _MSC_VER -typedef __int64 LONGLONG; -typedef unsigned __int64 ULONGLONG; -#else -typedef long long LONGLONG; -typedef unsigned long long ULONGLONG; -#endif - -typedef struct { - unsigned int mantissa:23; - unsigned int exponent:8; - unsigned int sign:1; -} ieee_float_t; - -typedef struct { - unsigned int mantissal:32; - unsigned int mantissah:20; - unsigned int exponent:11; - unsigned int sign:1; -} ieee_double_t; - -typedef struct { - unsigned int mantissal:32; - unsigned int mantissah:32; - unsigned int exponent:15; - unsigned int sign:1; - unsigned int empty:16; -} ieee_long_double_t; - -std::string -ssprintf ( const char* fmt, ... ) -{ - va_list arg; - va_start(arg, fmt); - std::string f = ssvprintf ( fmt, arg ); - va_end(arg); - return f; -} - -std::wstring -sswprintf ( const wchar_t* fmt, ... ) -{ - va_list arg; - va_start(arg, fmt); - std::wstring f = sswvprintf ( fmt, arg ); - va_end(arg); - return f; -} - -#define ZEROPAD 1 /* pad with zero */ -#define SIGN 2 /* unsigned/signed long */ -#define PLUS 4 /* show plus */ -#define SPACE 8 /* space if plus */ -#define LEFT 16 /* left justified */ -#define SPECIAL 32 /* 0x */ -#define LARGE 64 /* use 'ABCDEF' instead of 'abcdef' */ -#define ZEROTRUNC 128 /* truncate zero 's */ - - -static int -skip_atoi(const char **s) -{ - int i=0; - - while (isdigit(**s)) - i = i*10 + *((*s)++) - '0'; - return i; -} - -static int -skip_wtoi(const wchar_t **s) -{ - int i=0; - - while (iswdigit(**s)) - i = i*10 + *((*s)++) - L'0'; - return i; -} - - -static int -do_div(LONGLONG *n,int base) -{ - int __res = ((ULONGLONG) *n) % (unsigned) base; - *n = ((ULONGLONG) *n) / (unsigned) base; - return __res; -} - - -static bool -number(std::string& f, LONGLONG num, int base, int size, int precision ,int type) -{ - char c,sign,tmp[66]; - const char *digits="0123456789abcdefghijklmnopqrstuvwxyz"; - int i; - - if (type & LARGE) - digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - if (type & LEFT) - type &= ~ZEROPAD; - if (base < 2 || base > 36) - return 0; - c = (type & ZEROPAD) ? '0' : ' '; - sign = 0; - if (type & SIGN) { - if (num < 0) { - sign = '-'; - num = -num; - size--; - } else if (type & PLUS) { - sign = '+'; - size--; - } else if (type & SPACE) { - sign = ' '; - size--; - } - } - if (type & SPECIAL) { - if (base == 16) - size -= 2; - else if (base == 8) - size--; - } - i = 0; - if (num == 0) - tmp[i++]='0'; - else while (num != 0) - tmp[i++] = digits[do_div(&num,base)]; - if (i > precision) - precision = i; - size -= precision; - if (!(type&(ZEROPAD+LEFT))) - while(size-->0) - f += ' '; - if (sign) - f += sign; - if (type & SPECIAL) - { - if (base==8) - f += '0'; - else if (base==16) - { - f += '0'; - f += digits[33]; - } - } - if (!(type & LEFT)) - { - while (size-- > 0) - f += c; - } - while (i < precision--) - { - f += '0'; - } - while (i-- > 0) - { - f += tmp[i]; - } - while (size-- > 0) - { - f += ' '; - } - return true; -} - -static bool -wnumber(std::wstring& f, LONGLONG num, int base, int size, int precision ,int type) -{ - wchar_t c,sign,tmp[66]; - const wchar_t *digits = L"0123456789abcdefghijklmnopqrstuvwxyz"; - int i; - - if (type & LARGE) - digits = L"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - if (type & LEFT) - type &= ~ZEROPAD; - if (base < 2 || base > 36) - return 0; - c = (type & ZEROPAD) ? L'0' : L' '; - sign = 0; - if (type & SIGN) { - if (num < 0) { - sign = L'-'; - num = -num; - size--; - } else if (type & PLUS) { - sign = L'+'; - size--; - } else if (type & SPACE) { - sign = L' '; - - size--; - } - } - if (type & SPECIAL) { - if (base == 16) - size -= 2; - else if (base == 8) - size--; - } - i = 0; - if (num == 0) - tmp[i++]=L'0'; - else while (num != 0) - tmp[i++] = digits[do_div(&num,base)]; - if (i > precision) - precision = i; - size -= precision; - if (!(type&(ZEROPAD+LEFT))) - while(size-->0) - f += L' '; - if (sign) - f += sign; - if (type & SPECIAL) - { - if (base==8) - f += L'0'; - else if (base==16) - { - f += L'0'; - f += digits[33]; - } - } - if (!(type & LEFT)) - { - while (size-- > 0) - f += c; - } - while (i < precision--) - { - f += L'0'; - } - while (i-- > 0) - { - f += tmp[i]; - } - while (size-- > 0) - { - f += L' '; - } - return true; -} - - -static bool -numberf(std::string& f, double __n, char exp_sign, int size, int precision, int type) -{ - double exponent = 0.0; - double e; - long ie; - - //int x; - char *buf, *tmp; - int i = 0; - int j = 0; - //int k = 0; - - double frac, intr; - double p; - char sign; - char c; - char ro = 0; - int result; - - union - { - double* __n; - ieee_double_t* n; - } n; - - n.__n = &__n; - - if ( exp_sign == 'g' || exp_sign == 'G' || exp_sign == 'e' || exp_sign == 'E' ) { - ie = ((unsigned int)n.n->exponent - (unsigned int)0x3ff); - exponent = ie/3.321928; - } - - if ( exp_sign == 'g' || exp_sign == 'G' ) { - type |= ZEROTRUNC; - if ( exponent < -4 || fabs(exponent) >= precision ) - exp_sign -= 2; // g -> e and G -> E - } - - if ( exp_sign == 'e' || exp_sign == 'E' ) { - frac = modf(exponent,&e); - if ( frac > 0.5 ) - e++; - else if ( frac < -0.5 ) - e--; - - result = numberf(f,__n/pow(10.0L,e),'f',size-4, precision, type); - if (result < 0) - return false; - f += exp_sign; - size--; - ie = (long)e; - type = LEFT | PLUS; - if ( ie < 0 ) - type |= SIGN; - - result = number(f,ie, 10,2, 2,type ); - if (result < 0) - return false; - return true; - } - - if ( exp_sign == 'f' ) { - buf = (char*)alloca(4096); - if (type & LEFT) { - type &= ~ZEROPAD; - } - - c = (type & ZEROPAD) ? '0' : ' '; - sign = 0; - if (type & SIGN) { - if (__n < 0) { - sign = '-'; - __n = fabs(__n); - size--; - } else if (type & PLUS) { - sign = '+'; - size--; - } else if (type & SPACE) { - sign = ' '; - size--; - } - } - - frac = modf(__n,&intr); - - // # flags forces a . and prevents trucation of trailing zero's - - if ( precision > 0 ) { - //frac = modfl(__n,&intr); - i = precision-1; - while ( i >= 0 ) { - frac*=10.0L; - frac = modf(frac, &p); - buf[i] = (int)p + '0'; - i--; - } - i = precision; - size -= precision; - - ro = 0; - if ( frac > 0.5 ) { - ro = 1; - } - - if ( precision >= 1 || type & SPECIAL) { - buf[i++] = '.'; - size--; - } - } - - if ( intr == 0.0 ) { - buf[i++] = '0'; - size--; - } - else { - while ( intr > 0.0 ) { - p = intr; - intr/=10.0L; - modf(intr, &intr); - - p -= 10.0*intr; - - buf[i++] = (int)p + '0'; - size--; - } - } - - j = 0; - while ( j < i && ro == 1) { - if ( buf[j] >= '0' && buf[j] <= '8' ) { - buf[j]++; - ro = 0; - } - else if ( buf[j] == '9' ) { - buf[j] = '0'; - } - j++; - } - if ( ro == 1 ) - buf[i++] = '1'; - - buf[i] = 0; - - size -= precision; - if (!(type&(ZEROPAD+LEFT))) - { - while(size-->0) - f += ' '; - } - if (sign) - { - f += sign; - } - - if (!(type&(ZEROPAD+LEFT))) - while(size-->0) - { - f += ' '; - } - if (type & SPECIAL) { - } - - if (!(type & LEFT)) - while (size-- > 0) - { - f += c; - } - - tmp = buf; - if ( type & ZEROTRUNC && ((type & SPECIAL) != SPECIAL) ) - { - j = 0; - while ( j < i && ( *tmp == '0' || *tmp == '.' )) - { - tmp++; - i--; - } - } -// else -// while (i < precision--) -// putc('0', f); - while (i-- > 0) - { - f += tmp[i]; - } - while (size-- > 0) - { - f += ' '; - } - } - return true; -} - -static bool -wnumberf(std::wstring& f, double __n, wchar_t exp_sign, int size, int precision, int type) -{ - double exponent = 0.0; - double e; - long ie; - - int i = 0; - int j = 0; - - double frac, intr; - double p; - wchar_t *buf, *tmp, sign, c, ro = 0; - int result; - - union - { - double* __n; - ieee_double_t* n; - } n; - - n.__n = &__n; - - if ( exp_sign == L'g' || exp_sign == L'G' || exp_sign == L'e' || exp_sign == L'E' ) { - ie = ((unsigned int)n.n->exponent - (unsigned int)0x3ff); - exponent = ie/3.321928; - } - - if ( exp_sign == L'g' || exp_sign == L'G' ) - { - type |= ZEROTRUNC; - if ( exponent < -4 || fabs(exponent) >= precision ) - exp_sign -= 2; // g -> e and G -> E - } - - if ( exp_sign == L'e' || exp_sign == L'E' ) - { - frac = modf(exponent,&e); - if ( frac > 0.5 ) - e++; - else if ( frac < -0.5 ) - e--; - - result = wnumberf(f,__n/pow(10.0L,e),L'f',size-4, precision, type); - if (result < 0) - return false; - f += exp_sign; - size--; - ie = (long)e; - type = LEFT | PLUS; - if ( ie < 0 ) - type |= SIGN; - - result = wnumber(f,ie, 10,2, 2,type ); - if (result < 0) - return false; - return true; - } - - if ( exp_sign == L'f' ) - { - buf = (wchar_t*)alloca(4096*sizeof(wchar_t)); - if (type & LEFT) - type &= ~ZEROPAD; - - c = (type & ZEROPAD) ? L'0' : L' '; - sign = 0; - if (type & SIGN) - { - if (__n < 0) - { - sign = L'-'; - __n = fabs(__n); - size--; - } - else if (type & PLUS) - { - sign = L'+'; - size--; - } - else if (type & SPACE) - { - sign = L' '; - size--; - } - } - - frac = modf(__n,&intr); - - // # flags forces a . and prevents trucation of trailing zero's - - if ( precision > 0 ) { - //frac = modfl(__n,&intr); - i = precision-1; - while ( i >= 0 ) { - frac*=10.0L; - frac = modf(frac, &p); - buf[i] = (int)p + L'0'; - i--; - } - i = precision; - size -= precision; - - ro = 0; - if ( frac > 0.5 ) { - ro = 1; - } - - if ( precision >= 1 || type & SPECIAL) { - buf[i++] = L'.'; - size--; - } - } - - if ( intr == 0.0 ) { - buf[i++] = L'0'; - size--; - } - else { - while ( intr > 0.0 ) { - p = intr; - intr/=10.0L; - modf(intr, &intr); - - p -= 10.0*intr; - - buf[i++] = (int)p + L'0'; - size--; - } - } - [truncated at 1000 lines; 5553 more skipped]