From 2913e17def90109ac83922e55a9df8999844ec58 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 3 Jul 2007 00:55:31 +0000 Subject: Since libbu++-reorg is now the trunk, build has been updated to work with it. --- src/build.cpp | 13 ++++++++----- src/build.h | 2 +- src/build.l | 9 ++++++++- src/cache.cpp | 12 ++++++------ src/cache.h | 6 +++--- src/functioncommandtolist.cpp | 2 +- src/functiondirectoriesin.cpp | 2 +- src/functionfactory.cpp | 12 ++++++------ src/functionfactory.h | 6 +++--- src/functionfilesin.cpp | 2 +- src/functionregexp.cpp | 2 +- src/functiontargets.cpp | 2 +- src/functiontostring.cpp | 2 +- src/main.cpp | 10 +++++----- src/performcommand.cpp | 2 +- src/performfactory.cpp | 2 +- src/performfactory.h | 6 +++--- src/regexp.cpp | 8 ++++---- src/regexp.h | 8 ++++---- src/targetfactory.cpp | 2 +- src/targetfactory.h | 6 +++--- src/targetfile.cpp | 2 +- src/viewercolorpct.cpp | 4 ++-- src/viewerfactory.cpp | 10 +++++----- src/viewerfactory.h | 6 +++--- src/viewermake.cpp | 2 +- src/viewerpercent.cpp | 2 +- src/viewerplain.cpp | 2 +- src/viewerplainpct.cpp | 2 +- 29 files changed, 78 insertions(+), 68 deletions(-) (limited to 'src') diff --git a/src/build.cpp b/src/build.cpp index 113f61f..c92d804 100644 --- a/src/build.cpp +++ b/src/build.cpp @@ -1,7 +1,8 @@ #include "build.h" #include "function.h" #include "viewerfactory.h" -#include "serializerbinary.h" +#include "bu/archive.h" +#include "bu/file.h" subExceptionDef( BuildException ); @@ -18,11 +19,12 @@ Build::~Build() { try { - SerializerBinary ar( sCacheName.c_str(), Serializer::save ); + Bu::File f( sCacheName.c_str(), "wb" ); + Bu::Archive ar( f, Bu::Archive::save ); ar << cRequires; } - catch( ExceptionBase &e ) + catch( Bu::ExceptionBase &e ) { } } @@ -39,11 +41,12 @@ void Build::setCache( const std::string &sFileName ) try { - SerializerBinary ar( sCacheName.c_str(), Serializer::load ); + Bu::File f( sCacheName.c_str(), "rb" ); + Bu::Archive ar( f, Bu::Archive::load ); ar >> cRequires; } - catch( ExceptionBase &e ) + catch( Bu::ExceptionBase &e ) { } } diff --git a/src/build.h b/src/build.h index 0bbad0e..c436ae1 100644 --- a/src/build.h +++ b/src/build.h @@ -6,7 +6,7 @@ #include #include -#include "exceptions.h" +#include "bu/exceptions.h" #include "rule.h" #include "target.h" #include "action.h" diff --git a/src/build.l b/src/build.l index 5b69177..9065a49 100644 --- a/src/build.l +++ b/src/build.l @@ -1,8 +1,15 @@ %{ # include +# include # include "buildparser.h" # include "build.tab.h" -# include "stringrep.h" + +char *stringdup( const char *sin ) +{ + char *n = new char[strlen(sin)+1]; + strcpy( n, sin ); + return n; +} std::string strbuf; %} diff --git a/src/cache.cpp b/src/cache.cpp index 61d0d28..b8e94ec 100644 --- a/src/cache.cpp +++ b/src/cache.cpp @@ -1,6 +1,6 @@ #include "cache.h" -#include "serializer.h" -#include "staticstring.h" +#include "bu/fstring.h" +#include "bu/archive.h" Cache::Cache() { @@ -15,14 +15,14 @@ Cache::~Cache() } } -void Cache::serialize( class Serializer &ar ) +void Cache::archive( class Bu::Archive &ar ) { if( ar.isLoading() ) { uint32_t sCache, sData, sIndex; ar >> sIndex; - StaticString *Index = new StaticString[sIndex]; + Bu::FString *Index = new Bu::FString[sIndex]; for( uint32_t i = 0; i < sIndex; i++ ) { ar >> Index[i]; @@ -39,10 +39,10 @@ void Cache::serialize( class Serializer &ar ) for( uint32_t j = 0; j < sData; j++ ) { ar >> nTmp; - lData.push_back( Index[nTmp].getString() ); + lData.push_back( Index[nTmp].getStr() ); } ar >> nTmp; - mCache[Index[nTmp].getString()] = e; + mCache[Index[nTmp].getStr()] = e; } /* uint32_t sCache, sData; diff --git a/src/cache.h b/src/cache.h index 16c4782..93b546c 100644 --- a/src/cache.h +++ b/src/cache.h @@ -3,18 +3,18 @@ #include #include -#include "serializable.h" +#include "bu/archival.h" #include #include #include -class Cache : public Serializable +class Cache : public Bu::Archival { public: Cache(); virtual ~Cache(); - virtual void serialize( class Serializer &ar ); + virtual void archive( class Bu::Archive &ar ); class Entry { diff --git a/src/functioncommandtolist.cpp b/src/functioncommandtolist.cpp index 3653135..68c4564 100644 --- a/src/functioncommandtolist.cpp +++ b/src/functioncommandtolist.cpp @@ -1,5 +1,5 @@ #include "functioncommandtolist.h" -#include "plugger.h" +#include "bu/plugger.h" PluginInterface2(commandToList, FunctionCommandToList, Function, "Mike Buland", 0, 1 ); diff --git a/src/functiondirectoriesin.cpp b/src/functiondirectoriesin.cpp index c68fa5c..0ebbbc8 100644 --- a/src/functiondirectoriesin.cpp +++ b/src/functiondirectoriesin.cpp @@ -1,7 +1,7 @@ #include #include "functiondirectoriesin.h" -#include "plugger.h" +#include "bu/plugger.h" PluginInterface2(directoriesIn, FunctionDirectoriesIn, Function, "Mike Buland", 0, 1 ); diff --git a/src/functionfactory.cpp b/src/functionfactory.cpp index 4a2cd15..f72e8f6 100644 --- a/src/functionfactory.cpp +++ b/src/functionfactory.cpp @@ -1,11 +1,11 @@ #include "functionfactory.h" -extern struct PluginInfo directoriesIn; -extern struct PluginInfo filesIn; -extern struct PluginInfo regexp; -extern struct PluginInfo toString; -extern struct PluginInfo commandToList; -extern struct PluginInfo targets; +extern struct Bu::PluginInfo directoriesIn; +extern struct Bu::PluginInfo filesIn; +extern struct Bu::PluginInfo regexp; +extern struct Bu::PluginInfo toString; +extern struct Bu::PluginInfo commandToList; +extern struct Bu::PluginInfo targets; FunctionFactory::FunctionFactory() { diff --git a/src/functionfactory.h b/src/functionfactory.h index 0541143..2cc28fe 100644 --- a/src/functionfactory.h +++ b/src/functionfactory.h @@ -3,11 +3,11 @@ #include -#include "plugger.h" -#include "singleton.h" +#include "bu/plugger.h" +#include "bu/singleton.h" #include "function.h" -class FunctionFactory : public Plugger, public Singleton +class FunctionFactory : public Bu::Plugger, public Bu::Singleton { public: FunctionFactory(); diff --git a/src/functionfilesin.cpp b/src/functionfilesin.cpp index 9b9187d..5301cd2 100644 --- a/src/functionfilesin.cpp +++ b/src/functionfilesin.cpp @@ -1,7 +1,7 @@ #include #include "functionfilesin.h" -#include "plugger.h" +#include "bu/plugger.h" #include "build.h" PluginInterface2(filesIn, FunctionFilesIn, Function, "Mike Buland", 0, 1 ); diff --git a/src/functionregexp.cpp b/src/functionregexp.cpp index 27fdbbd..2dc18b2 100644 --- a/src/functionregexp.cpp +++ b/src/functionregexp.cpp @@ -1,5 +1,5 @@ #include "functionregexp.h" -#include "plugger.h" +#include "bu/plugger.h" #include "regexp.h" PluginInterface2(regexp, FunctionRegexp, Function, "Mike Buland", 0, 1 ); diff --git a/src/functiontargets.cpp b/src/functiontargets.cpp index 29a92d3..a94f43e 100644 --- a/src/functiontargets.cpp +++ b/src/functiontargets.cpp @@ -1,5 +1,5 @@ #include "functiontargets.h" -#include "plugger.h" +#include "bu/plugger.h" #include "build.h" PluginInterface2(targets, FunctionTargets, Function, "Mike Buland", 0, 1 ); diff --git a/src/functiontostring.cpp b/src/functiontostring.cpp index 81ea77d..2fdcc1c 100644 --- a/src/functiontostring.cpp +++ b/src/functiontostring.cpp @@ -1,5 +1,5 @@ #include "functiontostring.h" -#include "plugger.h" +#include "bu/plugger.h" PluginInterface2(toString, FunctionToString, Function, "Mike Buland", 0, 1 ); diff --git a/src/main.cpp b/src/main.cpp index d2cc3c2..376df43 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2,12 +2,12 @@ //#include "viewerplain.h" //#include "viewerpercent.h" //#include "viewermake.h" -#include "paramproc.h" -#include "staticstring.h" +#include "bu/paramproc.h" +#include "bu/fstring.h" #include "build.h" #include "action.h" -class Param : public ParamProc +class Param : public Bu::ParamProc { public: Param() : @@ -88,7 +88,7 @@ public: std::string sFile; std::string sView; std::string sDir; - StaticString sAction; + Bu::FString sAction; //Viewer *pViewer; bool bDebug; bool bPostDebug; @@ -138,7 +138,7 @@ int main( int argc, char *argv[] ) else { if( prm.sAction > 0 ) - pBuild->execAction( prm.sAction.getString() ); + pBuild->execAction( prm.sAction.getStr() ); else pBuild->execAction(""); } diff --git a/src/performcommand.cpp b/src/performcommand.cpp index 46ac05a..3f3aa32 100644 --- a/src/performcommand.cpp +++ b/src/performcommand.cpp @@ -1,5 +1,5 @@ #include "performcommand.h" -#include "plugger.h" +#include "bu/plugger.h" #include "build.h" #include "viewer.h" diff --git a/src/performfactory.cpp b/src/performfactory.cpp index 6c7d57a..6926a3b 100644 --- a/src/performfactory.cpp +++ b/src/performfactory.cpp @@ -1,6 +1,6 @@ #include "performfactory.h" -extern struct PluginInfo command; +extern struct Bu::PluginInfo command; PerformFactory::PerformFactory() { diff --git a/src/performfactory.h b/src/performfactory.h index f5ce5c0..435d9c6 100644 --- a/src/performfactory.h +++ b/src/performfactory.h @@ -4,10 +4,10 @@ #include #include "perform.h" -#include "plugger.h" -#include "singleton.h" +#include "bu/plugger.h" +#include "bu/singleton.h" -class PerformFactory : public Plugger, public Singleton +class PerformFactory : public Bu::Plugger, public Bu::Singleton { public: PerformFactory(); diff --git a/src/regexp.cpp b/src/regexp.cpp index f79be97..4370667 100644 --- a/src/regexp.cpp +++ b/src/regexp.cpp @@ -1,6 +1,6 @@ #include "regexp.h" #include "build.h" // For BuildException -#include "staticstring.h" +#include "bu/fstring.h" RegExp::RegExp() : bCompiled( false ), @@ -39,9 +39,9 @@ void RegExp::compile( const char *sSrc ) size_t length = regerror( nErr, &re, NULL, 0 ); char *buffer = new char[length]; (void) regerror( nErr, &re, buffer, length ); - StaticString s( buffer ); + Bu::FString s( buffer ); delete[] buffer; - throw BuildException( s.getString() ); + throw BuildException( s.getStr() ); } bCompiled = true; this->sSrc = sSrc; @@ -71,7 +71,7 @@ std::pair RegExp::getSubStringRange( int nIndex ) std::string RegExp::getSubString( int nIndex ) { return std::string( - sTest.getString()+aSubStr[nIndex].rm_so, + sTest.getStr()+aSubStr[nIndex].rm_so, aSubStr[nIndex].rm_eo - aSubStr[nIndex].rm_so ); } diff --git a/src/regexp.h b/src/regexp.h index 96f3747..a5fab14 100644 --- a/src/regexp.h +++ b/src/regexp.h @@ -5,7 +5,7 @@ #include #include #include -#include "staticstring.h" +#include "bu/fstring.h" class RegExp { @@ -21,12 +21,12 @@ public: std::string getSubString( int nIndex ); const char *getSource() { - return sSrc; + return sSrc.getStr(); } private: - StaticString sSrc; - StaticString sTest; + Bu::FString sSrc; + Bu::FString sTest; regex_t re; bool bCompiled; int nSubStr; diff --git a/src/targetfactory.cpp b/src/targetfactory.cpp index ad7d090..a0bc0b0 100644 --- a/src/targetfactory.cpp +++ b/src/targetfactory.cpp @@ -1,6 +1,6 @@ #include "targetfactory.h" -extern struct PluginInfo file; +extern struct Bu::PluginInfo file; TargetFactory::TargetFactory() { diff --git a/src/targetfactory.h b/src/targetfactory.h index bf8862f..ee1fc2a 100644 --- a/src/targetfactory.h +++ b/src/targetfactory.h @@ -3,11 +3,11 @@ #include -#include "plugger.h" -#include "singleton.h" +#include "bu/plugger.h" +#include "bu/singleton.h" #include "target.h" -class TargetFactory : public Plugger, public Singleton +class TargetFactory : public Bu::Plugger, public Bu::Singleton { public: TargetFactory(); diff --git a/src/targetfile.cpp b/src/targetfile.cpp index 73cd3ff..0e2d43e 100644 --- a/src/targetfile.cpp +++ b/src/targetfile.cpp @@ -1,5 +1,5 @@ #include "targetfile.h" -#include "plugger.h" +#include "bu/plugger.h" #include "rule.h" #include "build.h" #include "perform.h" diff --git a/src/viewercolorpct.cpp b/src/viewercolorpct.cpp index 4dd9b34..5bc3cba 100644 --- a/src/viewercolorpct.cpp +++ b/src/viewercolorpct.cpp @@ -1,7 +1,7 @@ #include "viewercolorpct.h" #include "perform.h" -#include "plugger.h" -#include "math.h" +#include "bu/plugger.h" +#include PluginInterface2( colorpct, ViewerColorPct, Viewer, "Mike Buland", 0, 1 ); diff --git a/src/viewerfactory.cpp b/src/viewerfactory.cpp index 7826a6a..5726e56 100644 --- a/src/viewerfactory.cpp +++ b/src/viewerfactory.cpp @@ -1,10 +1,10 @@ #include "viewerfactory.h" -extern struct PluginInfo plain; -extern struct PluginInfo percent; -extern struct PluginInfo make; -extern struct PluginInfo plainpct; -extern struct PluginInfo colorpct; +extern struct Bu::PluginInfo plain; +extern struct Bu::PluginInfo percent; +extern struct Bu::PluginInfo make; +extern struct Bu::PluginInfo plainpct; +extern struct Bu::PluginInfo colorpct; ViewerFactory::ViewerFactory() { diff --git a/src/viewerfactory.h b/src/viewerfactory.h index 8704e03..ffa5b31 100644 --- a/src/viewerfactory.h +++ b/src/viewerfactory.h @@ -4,10 +4,10 @@ #include #include "viewer.h" -#include "plugger.h" -#include "singleton.h" +#include "bu/plugger.h" +#include "bu/singleton.h" -class ViewerFactory : public Plugger, public Singleton +class ViewerFactory : public Bu::Plugger, public Bu::Singleton { public: ViewerFactory(); diff --git a/src/viewermake.cpp b/src/viewermake.cpp index 0f88f7f..ed11b5f 100644 --- a/src/viewermake.cpp +++ b/src/viewermake.cpp @@ -1,6 +1,6 @@ #include "viewermake.h" #include "perform.h" -#include "plugger.h" +#include "bu/plugger.h" PluginInterface2( make, ViewerMake, Viewer, "Mike Buland", 0, 1 ); diff --git a/src/viewerpercent.cpp b/src/viewerpercent.cpp index aa7b3c8..baca82a 100644 --- a/src/viewerpercent.cpp +++ b/src/viewerpercent.cpp @@ -1,6 +1,6 @@ #include "viewerpercent.h" #include "perform.h" -#include "plugger.h" +#include "bu/plugger.h" #include #include diff --git a/src/viewerplain.cpp b/src/viewerplain.cpp index 9037a40..3e65f21 100644 --- a/src/viewerplain.cpp +++ b/src/viewerplain.cpp @@ -1,6 +1,6 @@ #include "viewerplain.h" #include "perform.h" -#include "plugger.h" +#include "bu/plugger.h" PluginInterface2( plain, ViewerPlain, Viewer, "Mike Buland", 0, 1 ); diff --git a/src/viewerplainpct.cpp b/src/viewerplainpct.cpp index 9988ca7..4d9fa7b 100644 --- a/src/viewerplainpct.cpp +++ b/src/viewerplainpct.cpp @@ -1,6 +1,6 @@ #include "viewerplainpct.h" #include "perform.h" -#include "plugger.h" +#include "bu/plugger.h" #include "math.h" PluginInterface2( plainpct, ViewerPlainPct, Viewer, "Mike Buland", 0, 1 ); -- cgit v1.2.3