From 7a7390337e04d0163b97c1da7bdaa198bacaff72 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Wed, 23 Aug 2006 03:22:03 +0000 Subject: Loads more stuff...it's nearly working now. --- build.conf | 48 ++++---- src/build.cpp | 40 +++++++ src/build.h | 30 +++++ src/build.y | 108 ++++++++++++++---- src/builder.cpp | 255 ++++++++++++++++++++++++++++++++++++++---- src/builder.h | 94 ++++++++++++++-- src/function.h | 2 +- src/functioncommandtolist.cpp | 2 +- src/functioncommandtolist.h | 2 +- src/functiondirectoriesin.cpp | 2 +- src/functiondirectoriesin.h | 2 +- src/functionfilesin.cpp | 2 +- src/functionfilesin.h | 2 +- src/functionregexp.cpp | 2 +- src/functionregexp.h | 2 +- src/functiontostring.cpp | 2 +- src/functiontostring.h | 2 +- src/main.cpp | 5 +- src/perform.cpp | 6 + src/perform.h | 6 +- src/rule.cpp | 9 ++ src/rule.h | 17 +++ src/target.cpp | 1 + src/target.h | 33 +++++- 24 files changed, 577 insertions(+), 97 deletions(-) create mode 100644 src/rule.cpp create mode 100644 src/rule.h diff --git a/build.conf b/build.conf index 4d2e61b..6a1b611 100644 --- a/build.conf +++ b/build.conf @@ -1,43 +1,35 @@ # build.conf for build, kind of whacky, eh? -default action: check "build", check "cleanup" -"clean" action: clean ["build", "cleanup"] +default action: check "build" +"clean" action: clean "build" +"rebuild" action: clean "build", check "build" set "CXXFLAGS" += "-ggdb" -["build", "cleanup"]: - rule "exe", - target file, - set "CXXFLAGS" = "-lBob", - input [filesIn("src/{target}"), filesIn("src/shared")] - -[directoriesIn("src/tests")] filter regexp("src/tests/(.*)", "tests/{re:1}"): - rule "exe", - target prefix "tests/", - target file, - input filesIn("src/tests/{target}") - -[directoriesIn("src/tests"), "aoeua"]: +"build": rule "exe", target file, - input filesIn("src/{target}") - -"build": - input [filesIn("src"), "boy.cpp"] filter regexp(".*\\.cpp$"), - input filter regexp(".*\\.cpp$"), - requires ["bob.cpp", "libbuild.a", "libbu++/libbu++.a"] - -"bob.cpp": set "aoeu" = "food", requires "bob.bastard" + requires "libbu++/libbu++.a", + set "CXXFLAGS" += "-Ilibbu++/src", + input filesIn("src") rule "exe": matches regexp("(.*)\\.o$"), input filter toString(), - perform command("stuff") + perform command("g++ {LDFLAGS} -o {target} {match}") rule "cpp": matches regexp("(.*)\\.cpp$"), produces "{re:1}.o", - requires commandToList("make", "g++ -M {match}"), - perform command("stuff") - - + requires commandToList("g++ -M {match}", "make"), + perform command("g++ {CXXFLAGS} -c -o {target} {match}") + +rule "bison": + matches regexp("(.*)\\.y$"), + produces ["{re:1}.tab.c", "{re:1}.tab.h", "{re:1}.output"], + perform command("bison -v -b{re:1} {match}") + +rule "flex": + matches regexp("(.*)\\.l$"), + produces "{re:1}.yy.c", + perform command("flex --bison-bridge --bison-locations -o {target} {match}") diff --git a/src/build.cpp b/src/build.cpp index d3bd960..d9a8b39 100644 --- a/src/build.cpp +++ b/src/build.cpp @@ -1,5 +1,8 @@ #include "build.h" +subExceptionDef( BuildException ); + + Build::Build() { } @@ -7,3 +10,40 @@ Build::Build() Build::~Build() { } + +void Build::addTarget( Target *pTarget ) +{ + TargetMap::iterator i = mTarget.find( pTarget->getName() ); + if( i == mTarget.end() ) + { + mTarget[pTarget->getName()] = pTarget; + } + else + { + throw BuildException("Merging targets isn't working yet."); + } +} + +void Build::addRequires( const std::string &who, const std::string &what ) +{ + mRequires[who].push_back( what ); +} + +void Build::debugDump() +{ + printf("Requires:\n"); + for( ReqMap::iterator i = mRequires.begin(); i != mRequires.end(); i++ ) + { + printf(" %s: ", (*i).first.c_str() ); + + for( StringList::iterator j = (*i).second.begin(); + j != (*i).second.end(); j++ ) + { + if( j != (*i).second.begin() ) + printf(", "); + printf("%s", (*j).c_str() ); + } + printf("\n"); + } +} + diff --git a/src/build.h b/src/build.h index a2bf3ed..00acbfc 100644 --- a/src/build.h +++ b/src/build.h @@ -3,6 +3,15 @@ #include +#include +#include + +#include "exceptions.h" +#include "rule.h" +#include "target.h" +#include "action.h" + +subExceptionDecl( BuildException ); class Build { @@ -10,7 +19,28 @@ public: Build(); virtual ~Build(); + /** + * Adds a target to the build. If the target already exists, this will + * attempt to merge them as best it can. If there are any conflicts, it + * will throw an exception. + *@param pTarget A pointer to a Target object that Build takes ownership of. + */ + void addTarget( Target *pTarget ); + void addRequires( const std::string &who, const std::string &what ); + + void debugDump(); + private: + typedef std::map TargetMap; + typedef std::list StringList; + typedef std::map ReqMap; + + TargetMap mTarget; + ReqMap mRequires; + + //std::map mRule; + //Action *pActDefault; + //std::map mAction; }; diff --git a/src/build.y b/src/build.y index 40f8d34..e9c0083 100644 --- a/src/build.y +++ b/src/build.y @@ -55,18 +55,37 @@ input: ; // Rule interpretation -rule: TOK_RULE STRING {printf("Rule %s:\n", $2 ); } ':' rulecmds +rule: TOK_RULE STRING ':' + { + bld.addRule( $2 ); + } + rulecmds ; rulecmds: rulecmd | rulecmds ',' rulecmd ; -rulecmd: TOK_MATCHES { printf(" Matches: " ); } func { printf("\n"); } - | TOK_PRODUCES STRING { printf(" Produces: %s\n", $2 ); } - | TOK_REQUIRES { printf(" Requires:\n"); } list {printf("\n");} - | TOK_INPUT TOK_FILTER { printf(" Input Filter: "); } func {printf("\n");} - | TOK_PERFORM { printf(" Perform: "); } perf {printf("\n");} +rulecmd: TOK_MATCHES func + { + bld.addRuleMatches(); + } + | TOK_PRODUCES list + { + bld.addRuleProduces(); + } + | TOK_REQUIRES list + { + bld.addRuleRequires(); + } + | TOK_INPUT TOK_FILTER func + { + bld.addRuleInputFilter(); + } + | TOK_PERFORM perf + { + bld.addRulePerform(); + } ; // Action interpretation @@ -102,32 +121,62 @@ actioncmd: TOK_CHECK list ; // Target interpretation -target: list ':' { printf(" are targets:\n"); } targetcmds +target: list ':' + { + bld.newTarget(); + } + targetcmds ; targetcmds: targetcmd | targetcmds ',' targetcmd ; -targetcmd: TOK_RULE STRING { printf(" Rule %s\n", $2 ); } - | TOK_TARGET TOK_PREFIX STRING { printf(" Target prefix: %s\n", $3 ); } - | TOK_TARGET TARGETTYPE { printf(" Target Type: %s\n", $2 ); } - | TOK_INPUT { printf(" Input: "); } list { printf("\n"); } - | TOK_INPUT TOK_FILTER { printf(" Input filter: "); } func { printf("\n"); } - | TOK_REQUIRES { printf(" Requires: "); } list { printf("\n"); } - | TOK_SET { printf(" Set: "); } targetset +targetcmd: TOK_RULE STRING + { + bld.setTargetRule( $2 ); + } + | TOK_TARGET TOK_PREFIX STRING + { + bld.setTargetPrefix( $3 ); + } + | TOK_TARGET TARGETTYPE + { + bld.setTargetType( $2 ); + } + | TOK_INPUT list + { + bld.addTargetInput(); + } + | TOK_REQUIRES list + { + bld.addTargetRequires(); + } + | TOK_SET targetset ; -targetset: STRING '=' STRING { printf("%s = %s\n", $1, $3 ); } - | STRING TOK_ADDSET STRING { printf("%s += %s\n", $1, $3 ); } +targetset: STRING '=' STRING + { + bld.addTargetSet( $1, $3, setSet ); + } + | STRING TOK_ADDSET STRING + { + bld.addTargetSet( $1, $3, setAdd ); + } ; // global set -set: TOK_SET { printf("Set: "); } setwhat +set: TOK_SET setwhat ; -setwhat: STRING '=' STRING { printf("%s = %s\n", $1, $3 ); } - | STRING TOK_ADDSET STRING { printf("%s += %s\n", $1, $3 ); } +setwhat: STRING '=' STRING + { + bld.addGlobalSet( $1, $3, setSet ); + } + | STRING TOK_ADDSET STRING + { + bld.addGlobalSet( $1, $3, setAdd ); + } ; // list goo @@ -140,7 +189,10 @@ list: singlelistitem listfilter ; listfilter: - | TOK_FILTER { printf(" filtered by "); } func + | TOK_FILTER func + { + bld.filterList(); + } ; listitems: listitem @@ -183,12 +235,22 @@ funcparams: ; // Perform -perf: PERFORM { printf("%s(", $1 ); } '(' perfparams ')' { printf(")"); } +perf: PERFORM + { + bld.newPerform( $1 ); + } + '(' perfparams ')' ; perfparams: - | STRING { printf("%s", $1 ); } - | perfparams ',' STRING { printf(", %s", $3 ); } + | STRING + { + bld.addPerformParam( $1 ); + } + | perfparams ',' STRING + { + bld.addPerformParam( $3 ); + } ; %% diff --git a/src/builder.cpp b/src/builder.cpp index 70be725..4d377a8 100644 --- a/src/builder.cpp +++ b/src/builder.cpp @@ -3,8 +3,8 @@ #include "performfactory.h" #include "targetfactory.h" #include "action.h" - -subExceptionDef( BuildException ); +#include "build.h" +#include "rule.h" Builder::Builder() : fFunction( FunctionFactory::getInstance() ), @@ -20,13 +20,15 @@ Builder::~Builder() void yyparse( Builder &bld ); extern int yydebug; -void Builder::load( const std::string &sFile ) +Build *Builder::load( const std::string &sFile ) { file = sFile; scanBegin(); //yydebug = 1; yyparse( *this ); scanEnd(); + + return genBuild(); } void Builder::error( YYLTYPE *locp, const char *msg ) @@ -52,6 +54,47 @@ bool Builder::isTarget( const char *sType ) { return fTarget.hasPlugin( sType ); } + +void Builder::newTarget() +{ + lTargetTmp.push_back( TargetTmp(lTmp, TargetInfo()) ); +} + +void Builder::setTargetRule( const char *sRule ) +{ + lTargetTmp.back().second.sRule = sRule; +} + +void Builder::setTargetPrefix( const char *sPrefix ) +{ + lTargetTmp.back().second.sPrefix = sPrefix; +} + +void Builder::setTargetType( const char *sType ) +{ + lTargetTmp.back().second.sType = sType; +} + +void Builder::addTargetInput() +{ + lTargetTmp.back().second.lInput.insert( + lTargetTmp.back().second.lInput.end(), + lTmp.begin(), lTmp.end() + ); +} + +void Builder::addTargetRequires() +{ + lTargetTmp.back().second.lRequires.insert( + lTargetTmp.back().second.lRequires.end(), + lTmp.begin(), lTmp.end() + ); +} + +void Builder::addTargetSet( const char *sVar, const char *sVal, int nHow ) +{ + lTargetTmp.back().second.lVar.push_back( SetVar( sVar, sVal, nHow ) ); +} // // Function functions @@ -71,6 +114,9 @@ void Builder::addFunctionParam( const char *sParam ) pTmpFunc->addParam( sParam ); } +// +// List functions +// void Builder::newList() { lTmp.clear(); @@ -86,11 +132,16 @@ void Builder::addListFunc() lTmp.push_back( BuildListItem("", pTmpFunc ) ); } -StringList Builder::buildToStringList( Builder::BuildList &lSrc, StringList &lIn ) +void Builder::filterList() +{ + printf("Filters aren't done yet.\n"); +} + +StringList Builder::buildToStringList( const BuildList &lSrc, const StringList &lIn ) { StringList lOut; - for( BuildList::iterator i = lSrc.begin(); i != lSrc.end(); i++ ) + for( BuildList::const_iterator i = lSrc.begin(); i != lSrc.end(); i++ ) { if( (*i).second ) { @@ -105,6 +156,46 @@ StringList Builder::buildToStringList( Builder::BuildList &lSrc, StringList &lIn return lOut; } +// +// Rule functions +// +void Builder::addRule( const char *sName ) +{ + lRuleTmp.push_back( RuleInfo() ); + lRuleTmp.back().sName = sName; +} + +void Builder::addRuleMatches() +{ + lRuleTmp.back().pMatches = pTmpFunc; +} + +void Builder::addRuleProduces() +{ + lRuleTmp.back().lProduces.insert( + lRuleTmp.back().lProduces.end(), + lTmp.begin(), lTmp.end() + ); +} + +void Builder::addRuleRequires() +{ + lRuleTmp.back().lRequires.insert( + lRuleTmp.back().lRequires.end(), + lTmp.begin(), lTmp.end() + ); +} + +void Builder::addRuleInputFilter() +{ + lRuleTmp.back().lFilter.push_back( pTmpFunc ); +} + +void Builder::addRulePerform() +{ + lRuleTmp.back().lPerform.push_back( pTmpPerform ); +} + // // Perform functions // @@ -115,10 +206,12 @@ bool Builder::isPerform( const char *sPerf ) void Builder::newPerform( const char *sName ) { + pTmpPerform = fPerform.instantiate( sName ); } void Builder::addPerformParam( const char *sParam ) { + pTmpPerform->addParam( sParam ); } // @@ -139,6 +232,14 @@ void Builder::addCommand( int nType ) lActions.back().second.push_back( ActionTmpCmd( nType, lTmp ) ); } +// +// Global variable functions +// +void Builder::addGlobalSet( const char *sVar, const char *sValue, int nHow ) +{ + lGlobalVars.push_back( SetVar( sVar, sValue, nHow ) ); +} + // // Debug // @@ -159,25 +260,137 @@ void Builder::debugDump() for( ActionTmpCmdList::iterator j = (*i).second.begin(); j != (*i).second.end(); j++ ) { - printf(" %d [", (*j).first ); - for( BuildList::iterator k = (*j).second.begin(); - k != (*j).second.end(); k++ ) + printf(" %d ", (*j).first ); + printBuildList( (*j).second ); + printf("\n"); + } + } + + printf("\nTargets:\n"); + for( TargetTmpList::iterator i = lTargetTmp.begin(); + i != lTargetTmp.end(); i++ ) + { + printf(" "); + printBuildList( (*i).first ); + printf(":\n"); + + printf(" Rule: %s\n", (*i).second.sRule.c_str() ); + printf(" Prefix: %s\n", (*i).second.sPrefix.c_str() ); + printf(" Type: %s\n", (*i).second.sType.c_str() ); + printf(" Input: "); + printBuildList( (*i).second.lInput ); + printf("\n Requires: "); + printBuildList( (*i).second.lRequires ); + printf("\n Vars:\n"); + + for( SetVarList::iterator j = (*i).second.lVar.begin(); + j != (*i).second.lVar.end(); j++ ) + { + char *op; + switch( (*j).third ) { - if( k != (*j).second.begin() ) - { - printf(", "); - } - if( (*k).second ) - { - printf("func()"); - } - else - { - printf("\"%s\"", (*k).first.c_str() ); - } + case setSet: op = "="; break; + case setAdd: op = "+="; break; } - printf("]\n"); + printf(" %s %s %s\n", (*j).first.c_str(), op, (*j).second.c_str() ); + } + } + + printf("\nGlobals:\n"); + for( SetVarList::iterator j = lGlobalVars.begin(); + j != lGlobalVars.end(); j++ ) + { + char *op; + switch( (*j).third ) + { + case setSet: op = "="; break; + case setAdd: op = "+="; break; } + printf(" %s %s %s\n", (*j).first.c_str(), op, (*j).second.c_str() ); + } + + printf("\nRules:\n"); + for( RuleTmpList::iterator i = lRuleTmp.begin(); + i != lRuleTmp.end(); i++ ) + { + printf(" %s:\n", (*i).sName.c_str() ); + printf(" Matches: func()\n"); + printf(" Produces: "); + printBuildList( (*i).lProduces ); + printf("\n Requires: "); + printBuildList( (*i).lRequires ); + printf("\n Filters: %d\n", (*i).lFilter.size() ); + printf(" Performs: %d\n", (*i).lPerform.size() ); } } +void Builder::printBuildList( const BuildList &lst ) +{ + printf("["); + for( BuildList::const_iterator k = lst.begin(); + k != lst.end(); k++ ) + { + if( k != lst.begin() ) + { + printf(", "); + } + if( (*k).second ) + { + printf("func()"); + } + else + { + printf("\"%s\"", (*k).first.c_str() ); + } + } + printf("]"); +} + +// +// Actually make a build object +// +Build *Builder::genBuild() +{ + Build *bld = new Build; + + for( TargetTmpList::iterator i = lTargetTmp.begin(); + i != lTargetTmp.end(); i++ ) + { + StringList lTargetNames = buildToStringList( + (*i).first, StringList() + ); + for( StringList::iterator j = lTargetNames.begin(); + j != lTargetNames.end(); j++ ) + { + if( (*i).second.sType != "" ) + { + Target *pTarget = fTarget.instantiate( + (*i).second.sType.c_str() + ); + pTarget->setName( *j ); + pTarget->setRule( (*i).second.sRule ); + + StringList lInputs = buildToStringList( + (*i).second.lInput, StringList() + ); + pTarget->getInput().insert( + pTarget->getInput().end(), + lInputs.begin(), lInputs.end() + ); + + bld->addTarget( pTarget ); + } + StringList lReqs = buildToStringList( + (*i).second.lRequires, StringList() + ); + for( StringList::iterator k = lReqs.begin(); + k != lReqs.end(); k++ ) + { + bld->addRequires( (*j), (*k) ); + } + } + } + + return bld; +} + diff --git a/src/builder.h b/src/builder.h index 1d126dc..8d72627 100644 --- a/src/builder.h +++ b/src/builder.h @@ -6,8 +6,8 @@ #include #include #include "build.tab.h" -#include "exceptions.h" +class Build; class Builder; class Function; class FunctionFactory; @@ -19,12 +19,37 @@ class TargetFactory; #define YY_DECL int yylex( YYSTYPE *yylval_param, YYLTYPE *yylloc_param, Builder &bld ) YY_DECL; -subExceptionDecl( BuildException ); - typedef std::list StringList; +template +class Triplet +{ +public: + Triplet( const tx &x, const ty &y, const tz &z ) : + first( x ), second( y ), third( z ) + {} + + Triplet( const Triplet &src ) : + first( src.first ), second( src.second ), third( src.third ) + {} + + tx first; + ty second; + tz third; +}; + +enum eSetHow +{ + setSet, + setAdd +}; + class Builder { + typedef std::pair BuildListItem; + typedef std::list BuildList; + typedef Triplet SetVar; + typedef std::list SetVarList; public: Builder(); virtual ~Builder(); @@ -32,19 +57,40 @@ public: void error( YYLTYPE *locp, const char *msg ); void error( const std::string &msg ); - void load( const std::string &sFile ); + Build *load( const std::string &sFile ); private: std::string file; void scanBegin(); void scanEnd(); + Build *genBuild(); + public: // Target functions bool isTarget( const char *sType ); + void newTarget(); + void setTargetRule( const char *sRule ); + void setTargetPrefix( const char *sPrefix ); + void setTargetType( const char *sType ); + void addTargetInput(); + void addTargetRequires(); + void addTargetSet( const char *sVar, const char *sVal, int nHow ); private: // Target variables - Target *pTmpTarget; TargetFactory &fTarget; + class TargetInfo + { + public: + std::string sRule; + std::string sPrefix; + std::string sType; + BuildList lInput; + BuildList lRequires; + SetVarList lVar; + }; + typedef std::pair TargetTmp; + typedef std::list TargetTmpList; + TargetTmpList lTargetTmp; public: // Function functions bool isFunction( const char *sFunc ); @@ -68,16 +114,35 @@ public: // List functions void newList(); void addListString( const char *str ); void addListFunc(); + void filterList(); - typedef std::pair BuildListItem; - typedef std::list BuildList; + StringList buildToStringList( const BuildList &lSrc, const StringList &lIn ); - StringList buildToStringList( BuildList &lSrc, StringList &lIn ); - -private: +private: // List variables BuildList lTmp; -public: // Functions for dealing with rules +public: // Rules functions + void addRule( const char *sName ); + void addRuleMatches(); + void addRuleProduces(); + void addRuleRequires(); + void addRuleInputFilter(); + void addRulePerform(); + +private: // Rule variables + class RuleInfo + { + public: + std::string sName; + Function *pMatches; + BuildList lProduces; + BuildList lRequires; + std::list lFilter; + std::list lPerform; + }; + + typedef std::list RuleTmpList; + RuleTmpList lRuleTmp; public: // Functions for dealing with actions void addAction(); @@ -91,8 +156,15 @@ private: // Action variables typedef std::list ActionTmpList; ActionTmpList lActions; +public: // Global variable functions + void addGlobalSet( const char *sVar, const char *sValue, int nHow ); + +private: // Global variable variables + SetVarList lGlobalVars; + public: // Debug void debugDump(); + void printBuildList( const BuildList &lst ); }; #endif diff --git a/src/function.h b/src/function.h index c840922..1a71f8a 100644 --- a/src/function.h +++ b/src/function.h @@ -11,7 +11,7 @@ public: virtual ~Function(); void addParam( const char *str ); - virtual void execute( StringList &lInput, StringList &lOutput )=0; + virtual void execute( const StringList &lInput, StringList &lOutput )=0; private: StringList lParams; diff --git a/src/functioncommandtolist.cpp b/src/functioncommandtolist.cpp index 6299f6f..46762b5 100644 --- a/src/functioncommandtolist.cpp +++ b/src/functioncommandtolist.cpp @@ -11,7 +11,7 @@ FunctionCommandToList::~FunctionCommandToList() { } -void FunctionCommandToList::execute( StringList &lInput, StringList &lOutput ) +void FunctionCommandToList::execute( const StringList &lInput, StringList &lOutput ) { } diff --git a/src/functioncommandtolist.h b/src/functioncommandtolist.h index 5bebe16..176e40f 100644 --- a/src/functioncommandtolist.h +++ b/src/functioncommandtolist.h @@ -11,7 +11,7 @@ public: FunctionCommandToList(); virtual ~FunctionCommandToList(); - virtual void execute( StringList &lInput, StringList &lOutput ); + virtual void execute( const StringList &lInput, StringList &lOutput ); private: diff --git a/src/functiondirectoriesin.cpp b/src/functiondirectoriesin.cpp index a22e5d7..9452489 100644 --- a/src/functiondirectoriesin.cpp +++ b/src/functiondirectoriesin.cpp @@ -11,7 +11,7 @@ FunctionDirectoriesIn::~FunctionDirectoriesIn() { } -void FunctionDirectoriesIn::execute( StringList &lInput, StringList &lOutput ) +void FunctionDirectoriesIn::execute( const StringList &lInput, StringList &lOutput ) { } diff --git a/src/functiondirectoriesin.h b/src/functiondirectoriesin.h index d769a0d..ba1b2e4 100644 --- a/src/functiondirectoriesin.h +++ b/src/functiondirectoriesin.h @@ -11,7 +11,7 @@ public: FunctionDirectoriesIn(); virtual ~FunctionDirectoriesIn(); - virtual void execute( StringList &lInput, StringList &lOutput ); + virtual void execute( const StringList &lInput, StringList &lOutput ); private: diff --git a/src/functionfilesin.cpp b/src/functionfilesin.cpp index 7dc073b..0d65c13 100644 --- a/src/functionfilesin.cpp +++ b/src/functionfilesin.cpp @@ -11,7 +11,7 @@ FunctionFilesIn::~FunctionFilesIn() { } -void FunctionFilesIn::execute( StringList &lInput, StringList &lOutput ) +void FunctionFilesIn::execute( const StringList &lInput, StringList &lOutput ) { } diff --git a/src/functionfilesin.h b/src/functionfilesin.h index 2ad23f9..b660301 100644 --- a/src/functionfilesin.h +++ b/src/functionfilesin.h @@ -11,7 +11,7 @@ public: FunctionFilesIn(); virtual ~FunctionFilesIn(); - virtual void execute( StringList &lInput, StringList &lOutput ); + virtual void execute( const StringList &lInput, StringList &lOutput ); private: diff --git a/src/functionregexp.cpp b/src/functionregexp.cpp index 045f745..462e93c 100644 --- a/src/functionregexp.cpp +++ b/src/functionregexp.cpp @@ -11,7 +11,7 @@ FunctionRegexp::~FunctionRegexp() { } -void FunctionRegexp::execute( StringList &lInput, StringList &lOutput ) +void FunctionRegexp::execute( const StringList &lInput, StringList &lOutput ) { } diff --git a/src/functionregexp.h b/src/functionregexp.h index 80a8220..9fa2eb4 100644 --- a/src/functionregexp.h +++ b/src/functionregexp.h @@ -11,7 +11,7 @@ public: FunctionRegexp(); virtual ~FunctionRegexp(); - virtual void execute( StringList &lInput, StringList &lOutput ); + virtual void execute( const StringList &lInput, StringList &lOutput ); private: diff --git a/src/functiontostring.cpp b/src/functiontostring.cpp index f5f43b2..a76705a 100644 --- a/src/functiontostring.cpp +++ b/src/functiontostring.cpp @@ -11,7 +11,7 @@ FunctionToString::~FunctionToString() { } -void FunctionToString::execute( StringList &lInput, StringList &lOutput ) +void FunctionToString::execute( const StringList &lInput, StringList &lOutput ) { } diff --git a/src/functiontostring.h b/src/functiontostring.h index 93bc20f..5e64256 100644 --- a/src/functiontostring.h +++ b/src/functiontostring.h @@ -11,7 +11,7 @@ public: FunctionToString(); virtual ~FunctionToString(); - virtual void execute( StringList &lInput, StringList &lOutput ); + virtual void execute( const StringList &lInput, StringList &lOutput ); private: diff --git a/src/main.cpp b/src/main.cpp index 97c2708..be95f07 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4,6 +4,7 @@ //#include "viewermake.h" #include "paramproc.h" #include "staticstring.h" +#include "build.h" class Param : public ParamProc { @@ -76,7 +77,7 @@ int main( int argc, char *argv[] ) //bld.setCache( prm.sCache ); //try //{ - bld.load( prm.sFile.c_str() ); + Build *pBuild = bld.load( prm.sFile.c_str() ); //} //catch( BuildException &e ) //{ @@ -90,6 +91,8 @@ int main( int argc, char *argv[] ) printf("\n\n----------\nDebug dump\n----------\n"); bld.debugDump(); } + printf("\n\n----------\nDebug dump\n----------\n"); + pBuild->debugDump(); //else { //if( prm.sAction > 0 ) diff --git a/src/perform.cpp b/src/perform.cpp index 937a76c..4e4a78e 100644 --- a/src/perform.cpp +++ b/src/perform.cpp @@ -7,3 +7,9 @@ Perform::Perform() Perform::~Perform() { } + +void Perform::addParam( const char *sParam ) +{ + lParam.push_back( sParam ); +} + diff --git a/src/perform.h b/src/perform.h index 0b6a16d..020af42 100644 --- a/src/perform.h +++ b/src/perform.h @@ -2,7 +2,8 @@ #define PERFORM_H #include - +#include +#include class Perform { @@ -10,7 +11,10 @@ public: Perform(); virtual ~Perform(); + void addParam( const char *sParam ); + private: + std::list lParam; }; diff --git a/src/rule.cpp b/src/rule.cpp new file mode 100644 index 0000000..22af322 --- /dev/null +++ b/src/rule.cpp @@ -0,0 +1,9 @@ +#include "rule.h" + +Rule::Rule() +{ +} + +Rule::~Rule() +{ +} diff --git a/src/rule.h b/src/rule.h new file mode 100644 index 0000000..065ab9e --- /dev/null +++ b/src/rule.h @@ -0,0 +1,17 @@ +#ifndef RULE_H +#define RULE_H + +#include + + +class Rule +{ +public: + Rule(); + virtual ~Rule(); + +private: + +}; + +#endif diff --git a/src/target.cpp b/src/target.cpp index f22bc54..834dbaa 100644 --- a/src/target.cpp +++ b/src/target.cpp @@ -7,3 +7,4 @@ Target::Target() Target::~Target() { } + diff --git a/src/target.h b/src/target.h index b7bee83..75fcb50 100644 --- a/src/target.h +++ b/src/target.h @@ -3,6 +3,10 @@ #include +#include +#include + +typedef std::list StringList; class Target { @@ -10,8 +14,35 @@ public: Target(); virtual ~Target(); -private: + void setName( const std::string &sName ) + { + this->sName = sName; + } + + std::string getName() + { + return sName; + } + + void setRule( const std::string &sRule ) + { + this->sRule = sRule; + } + std::string getRule() + { + return sRule; + } + + StringList &getInput() + { + return lInput; + } + +private: + std::string sName; + std::string sRule; + StringList lInput; }; #endif -- cgit v1.2.3