diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/build.cpp | 33 | ||||
| -rw-r--r-- | src/build.h | 4 | ||||
| -rw-r--r-- | src/buildparser.cpp | 4 | ||||
| -rw-r--r-- | src/function.cpp | 2 | ||||
| -rw-r--r-- | src/function.h | 4 | ||||
| -rw-r--r-- | src/functioncommandtolist.cpp | 2 | ||||
| -rw-r--r-- | src/functioncommandtolist.h | 2 | ||||
| -rw-r--r-- | src/functiondirectoriesin.cpp | 2 | ||||
| -rw-r--r-- | src/functiondirectoriesin.h | 2 | ||||
| -rw-r--r-- | src/functionfilesin.cpp | 2 | ||||
| -rw-r--r-- | src/functionfilesin.h | 2 | ||||
| -rw-r--r-- | src/functionregexp.cpp | 2 | ||||
| -rw-r--r-- | src/functionregexp.h | 2 | ||||
| -rw-r--r-- | src/functiontargets.cpp | 2 | ||||
| -rw-r--r-- | src/functiontargets.h | 2 | ||||
| -rw-r--r-- | src/functiontostring.cpp | 2 | ||||
| -rw-r--r-- | src/functiontostring.h | 2 | ||||
| -rw-r--r-- | src/perform.cpp | 2 | ||||
| -rw-r--r-- | src/perform.h | 5 | ||||
| -rw-r--r-- | src/performcommand.cpp | 2 | ||||
| -rw-r--r-- | src/performcommand.h | 2 | ||||
| -rw-r--r-- | src/rule.cpp | 15 | ||||
| -rw-r--r-- | src/stringproc.h | 4 | ||||
| -rw-r--r-- | src/stringprocbuild.cpp | 4 | ||||
| -rw-r--r-- | src/stringprocbuild.h | 2 |
25 files changed, 65 insertions, 42 deletions
diff --git a/src/build.cpp b/src/build.cpp index 89366f9..b48e9f1 100644 --- a/src/build.cpp +++ b/src/build.cpp | |||
| @@ -54,14 +54,14 @@ void Build::setStringProc( StringProc *pStrProc ) | |||
| 54 | this->pStrProc = pStrProc; | 54 | this->pStrProc = pStrProc; |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | std::string Build::replVars( const std::string &sSrc, const std::string &sCont, VarMap *mExtra ) | 57 | std::string Build::replVars( const std::string &sSrc, const StringList *pCont, VarMap *mExtra ) |
| 58 | { | 58 | { |
| 59 | if( pStrProc == NULL ) | 59 | if( pStrProc == NULL ) |
| 60 | throw BuildException( | 60 | throw BuildException( |
| 61 | "No valid string processor was registered with the Build object." | 61 | "No valid string processor was registered with the Build object." |
| 62 | ); | 62 | ); |
| 63 | 63 | ||
| 64 | return pStrProc->replVars( sSrc, sCont, mExtra ); | 64 | return pStrProc->replVars( sSrc, pCont, mExtra ); |
| 65 | } | 65 | } |
| 66 | 66 | ||
| 67 | void Build::execAction( const std::string &sWhat ) | 67 | void Build::execAction( const std::string &sWhat ) |
| @@ -144,11 +144,13 @@ void Build::set( const std::string &cont, const std::string &var, const std::str | |||
| 144 | { | 144 | { |
| 145 | if( cont == "" ) | 145 | if( cont == "" ) |
| 146 | { | 146 | { |
| 147 | mVars[var] = replVars( val, cont, NULL ); | 147 | mVars[var] = replVars( val, NULL, NULL ); |
| 148 | } | 148 | } |
| 149 | else | 149 | else |
| 150 | { | 150 | { |
| 151 | mContVars[cont][var] = replVars( val, cont, NULL ); | 151 | StringList cl; |
| 152 | cl.push_front( cont ); | ||
| 153 | mContVars[cont][var] = replVars( val, &cl, NULL ); | ||
| 152 | } | 154 | } |
| 153 | } | 155 | } |
| 154 | 156 | ||
| @@ -156,15 +158,17 @@ void Build::setAdd( const std::string &cont, const std::string &var, const std:: | |||
| 156 | { | 158 | { |
| 157 | if( cont == "" ) | 159 | if( cont == "" ) |
| 158 | { | 160 | { |
| 159 | mVars[var] = getVar( cont, var, NULL ) + " " + replVars( val, cont, NULL ); | 161 | mVars[var] = getVar( NULL, var, NULL ) + " " + replVars( val, NULL, NULL ); |
| 160 | } | 162 | } |
| 161 | else | 163 | else |
| 162 | { | 164 | { |
| 163 | mContVars[cont][var] = getVar( cont, var, NULL ) + " " + replVars( val, cont, NULL ); | 165 | StringList cl; |
| 166 | cl.push_front( cont ); | ||
| 167 | mContVars[cont][var] = getVar( &cl, var, NULL ) + " " + replVars( val, &cl, NULL ); | ||
| 164 | } | 168 | } |
| 165 | } | 169 | } |
| 166 | 170 | ||
| 167 | std::string Build::getVar( const std::string &cont, const std::string &var, VarMap *mExtra ) | 171 | std::string Build::getVar( const StringList *cont, const std::string &var, VarMap *mExtra ) |
| 168 | { | 172 | { |
| 169 | if( mExtra != NULL ) | 173 | if( mExtra != NULL ) |
| 170 | { | 174 | { |
| @@ -175,7 +179,7 @@ std::string Build::getVar( const std::string &cont, const std::string &var, VarM | |||
| 175 | return (*mExtra)[var]; | 179 | return (*mExtra)[var]; |
| 176 | } | 180 | } |
| 177 | 181 | ||
| 178 | if( cont == "" ) | 182 | if( cont == NULL ) |
| 179 | { | 183 | { |
| 180 | if( mVars.find(var) == mVars.end() ) | 184 | if( mVars.find(var) == mVars.end() ) |
| 181 | { | 185 | { |
| @@ -192,11 +196,18 @@ std::string Build::getVar( const std::string &cont, const std::string &var, VarM | |||
| 192 | } | 196 | } |
| 193 | else | 197 | else |
| 194 | { | 198 | { |
| 195 | if( mContVars[cont].find(var) == mContVars[cont].end() ) | 199 | if( cont->empty() ) |
| 200 | { | ||
| 201 | return getVar( NULL, var, NULL ); | ||
| 202 | } | ||
| 203 | std::string sTop = cont->front(); | ||
| 204 | if( mContVars[sTop].find(var) == mContVars[sTop].end() ) | ||
| 196 | { | 205 | { |
| 197 | mContVars[cont][var] = getVar( "", var, NULL ); | 206 | ((StringList *)cont)->pop_front(); |
| 207 | mContVars[sTop][var] = getVar( cont, var, NULL ); | ||
| 208 | ((StringList *)cont)->push_front( sTop ); | ||
| 198 | } | 209 | } |
| 199 | return mContVars[cont][var]; | 210 | return mContVars[sTop][var]; |
| 200 | } | 211 | } |
| 201 | } | 212 | } |
| 202 | 213 | ||
diff --git a/src/build.h b/src/build.h index e0f60ec..82e4998 100644 --- a/src/build.h +++ b/src/build.h | |||
| @@ -46,14 +46,14 @@ public: | |||
| 46 | 46 | ||
| 47 | void set( const std::string &cont, const std::string &var, const std::string &val ); | 47 | void set( const std::string &cont, const std::string &var, const std::string &val ); |
| 48 | void setAdd( const std::string &cont, const std::string &var, const std::string &val ); | 48 | void setAdd( const std::string &cont, const std::string &var, const std::string &val ); |
| 49 | std::string getVar( const std::string &cont, const std::string &var, VarMap *mExtra ); | 49 | std::string getVar( const StringList *cont, const std::string &var, VarMap *mExtra ); |
| 50 | 50 | ||
| 51 | Rule *getRule( const std::string &name ); | 51 | Rule *getRule( const std::string &name ); |
| 52 | 52 | ||
| 53 | void debugDump(); | 53 | void debugDump(); |
| 54 | 54 | ||
| 55 | void setStringProc( StringProc *pStrProc ); | 55 | void setStringProc( StringProc *pStrProc ); |
| 56 | std::string replVars( const std::string &sSrc, const std::string &sCont, VarMap *mExtra ); | 56 | std::string replVars( const std::string &sSrc, const StringList *pCont, VarMap *mExtra ); |
| 57 | RuleList findChainRules( Rule *pHead ); | 57 | RuleList findChainRules( Rule *pHead ); |
| 58 | StringList &getRequires( std::string sName ); | 58 | StringList &getRequires( std::string sName ); |
| 59 | 59 | ||
diff --git a/src/buildparser.cpp b/src/buildparser.cpp index 0aa409f..f5b87c7 100644 --- a/src/buildparser.cpp +++ b/src/buildparser.cpp | |||
| @@ -185,7 +185,9 @@ StringList BuildParser::buildToStringListDup( const BuildList &lSrc, const Strin | |||
| 185 | { | 185 | { |
| 186 | if( (*i).second ) | 186 | if( (*i).second ) |
| 187 | { | 187 | { |
| 188 | Function *pTmp = (*i).second->duplicate( bld, sCont, mExtra ); | 188 | StringList l; |
| 189 | l.push_back( sCont ); | ||
| 190 | Function *pTmp = (*i).second->duplicate( bld, &l, mExtra ); | ||
| 189 | pTmp->execute( pPass, lIn, lOut ); | 191 | pTmp->execute( pPass, lIn, lOut ); |
| 190 | delete pTmp; | 192 | delete pTmp; |
| 191 | } | 193 | } |
diff --git a/src/function.cpp b/src/function.cpp index 8debbe9..6e4f1d7 100644 --- a/src/function.cpp +++ b/src/function.cpp | |||
| @@ -13,7 +13,7 @@ void Function::addParam( const char *str ) | |||
| 13 | lParams.push_back( str ); | 13 | lParams.push_back( str ); |
| 14 | } | 14 | } |
| 15 | 15 | ||
| 16 | void Function::copyData( Function *pSrc, Build &bld, const std::string &cont, VarMap *mExtra ) | 16 | void Function::copyData( Function *pSrc, Build &bld, const StringList *cont, VarMap *mExtra ) |
| 17 | { | 17 | { |
| 18 | lParams.clear(); | 18 | lParams.clear(); |
| 19 | for( std::list<std::string>::iterator i = pSrc->lParams.begin(); | 19 | for( std::list<std::string>::iterator i = pSrc->lParams.begin(); |
diff --git a/src/function.h b/src/function.h index 7035d2f..af0d3fc 100644 --- a/src/function.h +++ b/src/function.h | |||
| @@ -12,8 +12,8 @@ public: | |||
| 12 | 12 | ||
| 13 | void addParam( const char *str ); | 13 | void addParam( const char *str ); |
| 14 | virtual void execute( Build *bld, const StringList &lInput, StringList &lOutput )=0; | 14 | virtual void execute( Build *bld, const StringList &lInput, StringList &lOutput )=0; |
| 15 | virtual Function *duplicate( Build &bld, const std::string &cont, VarMap *mExtra ) = 0; | 15 | virtual Function *duplicate( Build &bld, const StringList *cont, VarMap *mExtra ) = 0; |
| 16 | void copyData( Function *pSrc, Build &bld, const std::string &cont, VarMap *mExtra ); | 16 | void copyData( Function *pSrc, Build &bld, const StringList *cont, VarMap *mExtra ); |
| 17 | 17 | ||
| 18 | protected: | 18 | protected: |
| 19 | StringList lParams; | 19 | StringList lParams; |
diff --git a/src/functioncommandtolist.cpp b/src/functioncommandtolist.cpp index 708db5b..3653135 100644 --- a/src/functioncommandtolist.cpp +++ b/src/functioncommandtolist.cpp | |||
| @@ -59,7 +59,7 @@ void FunctionCommandToList::execute( Build *bld, const StringList &lInput, Strin | |||
| 59 | //rView.endExtraRequiresCheck(); | 59 | //rView.endExtraRequiresCheck(); |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | Function *FunctionCommandToList::duplicate( Build &bld, const std::string &cont, VarMap *mExtra ) | 62 | Function *FunctionCommandToList::duplicate( Build &bld, const StringList *cont, VarMap *mExtra ) |
| 63 | { | 63 | { |
| 64 | Function *pRet = new FunctionCommandToList(); | 64 | Function *pRet = new FunctionCommandToList(); |
| 65 | pRet->copyData( this, bld, cont, mExtra ); | 65 | pRet->copyData( this, bld, cont, mExtra ); |
diff --git a/src/functioncommandtolist.h b/src/functioncommandtolist.h index c74ce29..05bc393 100644 --- a/src/functioncommandtolist.h +++ b/src/functioncommandtolist.h | |||
| @@ -12,7 +12,7 @@ public: | |||
| 12 | virtual ~FunctionCommandToList(); | 12 | virtual ~FunctionCommandToList(); |
| 13 | 13 | ||
| 14 | virtual void execute( Build *bld, const StringList &lInput, StringList &lOutput ); | 14 | virtual void execute( Build *bld, const StringList &lInput, StringList &lOutput ); |
| 15 | virtual Function *duplicate( Build &bld, const std::string &cont, VarMap *mExtra ); | 15 | virtual Function *duplicate( Build &bld, const StringList *cont, VarMap *mExtra ); |
| 16 | 16 | ||
| 17 | private: | 17 | private: |
| 18 | 18 | ||
diff --git a/src/functiondirectoriesin.cpp b/src/functiondirectoriesin.cpp index cafea81..052125e 100644 --- a/src/functiondirectoriesin.cpp +++ b/src/functiondirectoriesin.cpp | |||
| @@ -39,7 +39,7 @@ void FunctionDirectoriesIn::execute( Build *bld, const StringList &lInput, Strin | |||
| 39 | closedir( d ); | 39 | closedir( d ); |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | Function *FunctionDirectoriesIn::duplicate( Build &bld, const std::string &cont, VarMap *mExtra ) | 42 | Function *FunctionDirectoriesIn::duplicate( Build &bld, const StringList *cont, VarMap *mExtra ) |
| 43 | { | 43 | { |
| 44 | Function *pRet = new FunctionDirectoriesIn(); | 44 | Function *pRet = new FunctionDirectoriesIn(); |
| 45 | pRet->copyData( this, bld, cont, mExtra ); | 45 | pRet->copyData( this, bld, cont, mExtra ); |
diff --git a/src/functiondirectoriesin.h b/src/functiondirectoriesin.h index c387577..7ec86e3 100644 --- a/src/functiondirectoriesin.h +++ b/src/functiondirectoriesin.h | |||
| @@ -12,7 +12,7 @@ public: | |||
| 12 | virtual ~FunctionDirectoriesIn(); | 12 | virtual ~FunctionDirectoriesIn(); |
| 13 | 13 | ||
| 14 | virtual void execute( Build *bld, const StringList &lInput, StringList &lOutput ); | 14 | virtual void execute( Build *bld, const StringList &lInput, StringList &lOutput ); |
| 15 | virtual Function *duplicate( Build &bld, const std::string &cont, VarMap *mExtra ); | 15 | virtual Function *duplicate( Build &bld, const StringList *cont, VarMap *mExtra ); |
| 16 | 16 | ||
| 17 | private: | 17 | private: |
| 18 | 18 | ||
diff --git a/src/functionfilesin.cpp b/src/functionfilesin.cpp index 6b47f9f..e1a4c2b 100644 --- a/src/functionfilesin.cpp +++ b/src/functionfilesin.cpp | |||
| @@ -39,7 +39,7 @@ void FunctionFilesIn::execute( Build *bld, const StringList &lInput, StringList | |||
| 39 | closedir( d ); | 39 | closedir( d ); |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | Function *FunctionFilesIn::duplicate( Build &bld, const std::string &cont, VarMap *mExtra ) | 42 | Function *FunctionFilesIn::duplicate( Build &bld, const StringList *cont, VarMap *mExtra ) |
| 43 | { | 43 | { |
| 44 | Function *pRet = new FunctionFilesIn(); | 44 | Function *pRet = new FunctionFilesIn(); |
| 45 | pRet->copyData( this, bld, cont, mExtra ); | 45 | pRet->copyData( this, bld, cont, mExtra ); |
diff --git a/src/functionfilesin.h b/src/functionfilesin.h index dc504b9..904837f 100644 --- a/src/functionfilesin.h +++ b/src/functionfilesin.h | |||
| @@ -12,7 +12,7 @@ public: | |||
| 12 | virtual ~FunctionFilesIn(); | 12 | virtual ~FunctionFilesIn(); |
| 13 | 13 | ||
| 14 | virtual void execute( Build *bld, const StringList &lInput, StringList &lOutput ); | 14 | virtual void execute( Build *bld, const StringList &lInput, StringList &lOutput ); |
| 15 | virtual Function *duplicate( Build &bld, const std::string &cont, VarMap *mExtra ); | 15 | virtual Function *duplicate( Build &bld, const StringList *cont, VarMap *mExtra ); |
| 16 | 16 | ||
| 17 | private: | 17 | private: |
| 18 | 18 | ||
diff --git a/src/functionregexp.cpp b/src/functionregexp.cpp index 57a1725..74c19ee 100644 --- a/src/functionregexp.cpp +++ b/src/functionregexp.cpp | |||
| @@ -42,7 +42,7 @@ void FunctionRegexp::execute( Build *bld, const StringList &lInput, StringList & | |||
| 42 | } | 42 | } |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | Function *FunctionRegexp::duplicate( Build &bld, const std::string &cont, VarMap *mExtra ) | 45 | Function *FunctionRegexp::duplicate( Build &bld, const StringList *cont, VarMap *mExtra ) |
| 46 | { | 46 | { |
| 47 | Function *pRet = new FunctionRegexp(); | 47 | Function *pRet = new FunctionRegexp(); |
| 48 | pRet->copyData( this, bld, cont, mExtra ); | 48 | pRet->copyData( this, bld, cont, mExtra ); |
diff --git a/src/functionregexp.h b/src/functionregexp.h index 1dfd91e..42fe811 100644 --- a/src/functionregexp.h +++ b/src/functionregexp.h | |||
| @@ -12,7 +12,7 @@ public: | |||
| 12 | virtual ~FunctionRegexp(); | 12 | virtual ~FunctionRegexp(); |
| 13 | 13 | ||
| 14 | virtual void execute( Build *bld, const StringList &lInput, StringList &lOutput ); | 14 | virtual void execute( Build *bld, const StringList &lInput, StringList &lOutput ); |
| 15 | virtual Function *duplicate( Build &bld, const std::string &cont, VarMap *mExtra ); | 15 | virtual Function *duplicate( Build &bld, const StringList *cont, VarMap *mExtra ); |
| 16 | 16 | ||
| 17 | private: | 17 | private: |
| 18 | 18 | ||
diff --git a/src/functiontargets.cpp b/src/functiontargets.cpp index 253b585..29a92d3 100644 --- a/src/functiontargets.cpp +++ b/src/functiontargets.cpp | |||
| @@ -26,7 +26,7 @@ void FunctionTargets::execute( Build *bld, const StringList &lInput, StringList | |||
| 26 | } | 26 | } |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | Function *FunctionTargets::duplicate( Build &bld, const std::string &cont, VarMap *mExtra ) | 29 | Function *FunctionTargets::duplicate( Build &bld, const StringList *cont, VarMap *mExtra ) |
| 30 | { | 30 | { |
| 31 | Function *pRet = new FunctionTargets(); | 31 | Function *pRet = new FunctionTargets(); |
| 32 | pRet->copyData( this, bld, cont, mExtra ); | 32 | pRet->copyData( this, bld, cont, mExtra ); |
diff --git a/src/functiontargets.h b/src/functiontargets.h index 8d3a0ed..f42ce96 100644 --- a/src/functiontargets.h +++ b/src/functiontargets.h | |||
| @@ -12,7 +12,7 @@ public: | |||
| 12 | virtual ~FunctionTargets(); | 12 | virtual ~FunctionTargets(); |
| 13 | 13 | ||
| 14 | virtual void execute( Build *bld, const StringList &lInput, StringList &lOutput ); | 14 | virtual void execute( Build *bld, const StringList &lInput, StringList &lOutput ); |
| 15 | virtual Function *duplicate( Build &bld, const std::string &cont, VarMap *mExtra ); | 15 | virtual Function *duplicate( Build &bld, const StringList *cont, VarMap *mExtra ); |
| 16 | 16 | ||
| 17 | private: | 17 | private: |
| 18 | 18 | ||
diff --git a/src/functiontostring.cpp b/src/functiontostring.cpp index 0a7bb48..81ea77d 100644 --- a/src/functiontostring.cpp +++ b/src/functiontostring.cpp | |||
| @@ -24,7 +24,7 @@ void FunctionToString::execute( Build *bld, const StringList &lInput, StringList | |||
| 24 | lOutput.push_back( sOut ); | 24 | lOutput.push_back( sOut ); |
| 25 | } | 25 | } |
| 26 | 26 | ||
| 27 | Function *FunctionToString::duplicate( Build &bld, const std::string &cont, VarMap *mExtra ) | 27 | Function *FunctionToString::duplicate( Build &bld, const StringList *cont, VarMap *mExtra ) |
| 28 | { | 28 | { |
| 29 | Function *pRet = new FunctionToString(); | 29 | Function *pRet = new FunctionToString(); |
| 30 | pRet->copyData( this, bld, cont, mExtra ); | 30 | pRet->copyData( this, bld, cont, mExtra ); |
diff --git a/src/functiontostring.h b/src/functiontostring.h index 4779712..d9c5af7 100644 --- a/src/functiontostring.h +++ b/src/functiontostring.h | |||
| @@ -12,7 +12,7 @@ public: | |||
| 12 | virtual ~FunctionToString(); | 12 | virtual ~FunctionToString(); |
| 13 | 13 | ||
| 14 | virtual void execute( Build *bld, const StringList &lInput, StringList &lOutput ); | 14 | virtual void execute( Build *bld, const StringList &lInput, StringList &lOutput ); |
| 15 | virtual Function *duplicate( Build &bld, const std::string &cont, VarMap *mExtra ); | 15 | virtual Function *duplicate( Build &bld, const StringList *cont, VarMap *mExtra ); |
| 16 | 16 | ||
| 17 | private: | 17 | private: |
| 18 | 18 | ||
diff --git a/src/perform.cpp b/src/perform.cpp index 64e6bab..25d54c7 100644 --- a/src/perform.cpp +++ b/src/perform.cpp | |||
| @@ -14,7 +14,7 @@ void Perform::addParam( const char *sParam ) | |||
| 14 | lParam.push_back( sParam ); | 14 | lParam.push_back( sParam ); |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | void Perform::copyData( Perform *pSrc, Build &bld, const std::string &cont, VarMap *mExtra ) | 17 | void Perform::copyData( Perform *pSrc, Build &bld, const StringList *cont, VarMap *mExtra ) |
| 18 | { | 18 | { |
| 19 | lParam.clear(); | 19 | lParam.clear(); |
| 20 | for( std::list<std::string>::iterator i = pSrc->lParam.begin(); | 20 | for( std::list<std::string>::iterator i = pSrc->lParam.begin(); |
diff --git a/src/perform.h b/src/perform.h index ea8d5e3..031e007 100644 --- a/src/perform.h +++ b/src/perform.h | |||
| @@ -7,6 +7,7 @@ | |||
| 7 | #include <map> | 7 | #include <map> |
| 8 | 8 | ||
| 9 | typedef std::map<std::string,std::string> VarMap; | 9 | typedef std::map<std::string,std::string> VarMap; |
| 10 | typedef std::list<std::string> StringList; | ||
| 10 | 11 | ||
| 11 | class Build; | 12 | class Build; |
| 12 | 13 | ||
| @@ -17,9 +18,9 @@ public: | |||
| 17 | virtual ~Perform(); | 18 | virtual ~Perform(); |
| 18 | 19 | ||
| 19 | void addParam( const char *sParam ); | 20 | void addParam( const char *sParam ); |
| 20 | virtual Perform *duplicate( Build &bld, const std::string &cont, VarMap *mExtra ) = 0; | 21 | virtual Perform *duplicate( Build &bld, const StringList *cont, VarMap *mExtra ) = 0; |
| 21 | virtual void execute( Build &bld ) = 0; | 22 | virtual void execute( Build &bld ) = 0; |
| 22 | void copyData( Perform *pSrc, Build &bld, const std::string &cont, VarMap *mExtra ); | 23 | void copyData( Perform *pSrc, Build &bld, const StringList *cont, VarMap *mExtra ); |
| 23 | std::string getTarget() | 24 | std::string getTarget() |
| 24 | { | 25 | { |
| 25 | return sTarget; | 26 | return sTarget; |
diff --git a/src/performcommand.cpp b/src/performcommand.cpp index e901b0e..46ac05a 100644 --- a/src/performcommand.cpp +++ b/src/performcommand.cpp | |||
| @@ -13,7 +13,7 @@ PerformCommand::~PerformCommand() | |||
| 13 | { | 13 | { |
| 14 | } | 14 | } |
| 15 | 15 | ||
| 16 | Perform *PerformCommand::duplicate( Build &bld, const std::string &cont, VarMap *mExtra ) | 16 | Perform *PerformCommand::duplicate( Build &bld, const StringList *cont, VarMap *mExtra ) |
| 17 | { | 17 | { |
| 18 | Perform *pRet = new PerformCommand(); | 18 | Perform *pRet = new PerformCommand(); |
| 19 | pRet->copyData( this, bld, cont, mExtra ); | 19 | pRet->copyData( this, bld, cont, mExtra ); |
diff --git a/src/performcommand.h b/src/performcommand.h index d128845..62bf61e 100644 --- a/src/performcommand.h +++ b/src/performcommand.h | |||
| @@ -11,7 +11,7 @@ public: | |||
| 11 | PerformCommand(); | 11 | PerformCommand(); |
| 12 | virtual ~PerformCommand(); | 12 | virtual ~PerformCommand(); |
| 13 | 13 | ||
| 14 | virtual Perform *duplicate( Build &bld, const std::string &cont, VarMap *mExtra ); | 14 | virtual Perform *duplicate( Build &bld, const StringList *cont, VarMap *mExtra ); |
| 15 | virtual void execute( Build &bld ); | 15 | virtual void execute( Build &bld ); |
| 16 | 16 | ||
| 17 | private: | 17 | private: |
diff --git a/src/rule.cpp b/src/rule.cpp index dcf62d4..f1b0317 100644 --- a/src/rule.cpp +++ b/src/rule.cpp | |||
| @@ -70,7 +70,9 @@ StringList Rule::execute( Build &bld, StringList &lInput, PerformList &lPerf ) | |||
| 70 | for( PerformList::iterator k = lPerform.begin(); | 70 | for( PerformList::iterator k = lPerform.begin(); |
| 71 | k != lPerform.end(); k++ ) | 71 | k != lPerform.end(); k++ ) |
| 72 | { | 72 | { |
| 73 | Perform *p = (*k)->duplicate( bld, target, &mTmp ); | 73 | StringList cont; |
| 74 | cont.push_front( target ); | ||
| 75 | Perform *p = (*k)->duplicate( bld, &cont, &mTmp ); | ||
| 74 | p->setTarget( target ); | 76 | p->setTarget( target ); |
| 75 | p->setRule( sName ); | 77 | p->setRule( sName ); |
| 76 | //p->setReqFuncs( &lReqFuncs ); | 78 | //p->setReqFuncs( &lReqFuncs ); |
| @@ -86,7 +88,9 @@ StringList Rule::execute( Build &bld, StringList &lInput, PerformList &lPerf ) | |||
| 86 | StringList::iterator j = lProduces.begin(); | 88 | StringList::iterator j = lProduces.begin(); |
| 87 | { | 89 | { |
| 88 | VarMap mTmp; | 90 | VarMap mTmp; |
| 89 | std::string target = bld.replVars( (*j), (*i), NULL ); | 91 | StringList cont; |
| 92 | cont.push_front( (*i) ); | ||
| 93 | std::string target = bld.replVars( (*j), &cont, NULL ); | ||
| 90 | mTmp["target"] = target; | 94 | mTmp["target"] = target; |
| 91 | lNewOut.push_back( target ); | 95 | lNewOut.push_back( target ); |
| 92 | mTmp["match"] = (*i); | 96 | mTmp["match"] = (*i); |
| @@ -99,14 +103,17 @@ StringList Rule::execute( Build &bld, StringList &lInput, PerformList &lPerf ) | |||
| 99 | for( PerformList::iterator k = lPerform.begin(); | 103 | for( PerformList::iterator k = lPerform.begin(); |
| 100 | k != lPerform.end(); k++ ) | 104 | k != lPerform.end(); k++ ) |
| 101 | { | 105 | { |
| 102 | Perform *p = (*k)->duplicate( bld, target, &mTmp ); | 106 | StringList cont2; |
| 107 | cont2.push_front( (*i) ); | ||
| 108 | cont2.push_front( target ); | ||
| 109 | Perform *p = (*k)->duplicate( bld, &cont2, &mTmp ); | ||
| 103 | p->setTarget( target ); | 110 | p->setTarget( target ); |
| 104 | p->setRule( sName ); | 111 | p->setRule( sName ); |
| 105 | for( FunctionList::iterator f = lReqFuncs.begin(); | 112 | for( FunctionList::iterator f = lReqFuncs.begin(); |
| 106 | f != lReqFuncs.end(); f++ ) | 113 | f != lReqFuncs.end(); f++ ) |
| 107 | { | 114 | { |
| 108 | p->getReqFuncs().push_back( | 115 | p->getReqFuncs().push_back( |
| 109 | (*f)->duplicate( bld, target, &mTmp ) | 116 | (*f)->duplicate( bld, &cont2, &mTmp ) |
| 110 | ); | 117 | ); |
| 111 | } | 118 | } |
| 112 | lPerf.push_back( p ); | 119 | lPerf.push_back( p ); |
diff --git a/src/stringproc.h b/src/stringproc.h index 860579f..d408601 100644 --- a/src/stringproc.h +++ b/src/stringproc.h | |||
| @@ -4,10 +4,12 @@ | |||
| 4 | #include <stdint.h> | 4 | #include <stdint.h> |
| 5 | #include <string> | 5 | #include <string> |
| 6 | #include <map> | 6 | #include <map> |
| 7 | #include <list> | ||
| 7 | 8 | ||
| 8 | class Build; | 9 | class Build; |
| 9 | 10 | ||
| 10 | typedef std::map<std::string,std::string> VarMap; | 11 | typedef std::map<std::string,std::string> VarMap; |
| 12 | typedef std::list<std::string> StringList; | ||
| 11 | 13 | ||
| 12 | class StringProc | 14 | class StringProc |
| 13 | { | 15 | { |
| @@ -15,7 +17,7 @@ public: | |||
| 15 | StringProc( Build *pBld ); | 17 | StringProc( Build *pBld ); |
| 16 | virtual ~StringProc(); | 18 | virtual ~StringProc(); |
| 17 | 19 | ||
| 18 | virtual std::string replVars( const std::string &sSrc, const std::string &sCont, VarMap *mExtra )=0; | 20 | virtual std::string replVars( const std::string &sSrc, const StringList *pCont, VarMap *mExtra )=0; |
| 19 | 21 | ||
| 20 | protected: | 22 | protected: |
| 21 | Build *getBuild() | 23 | Build *getBuild() |
diff --git a/src/stringprocbuild.cpp b/src/stringprocbuild.cpp index 071e941..419d819 100644 --- a/src/stringprocbuild.cpp +++ b/src/stringprocbuild.cpp | |||
| @@ -10,7 +10,7 @@ StringProcBuild::~StringProcBuild() | |||
| 10 | { | 10 | { |
| 11 | } | 11 | } |
| 12 | 12 | ||
| 13 | std::string StringProcBuild::replVars( const std::string &sSrc, const std::string &sCont, VarMap *mExtra ) | 13 | std::string StringProcBuild::replVars( const std::string &sSrc, const StringList *pCont, VarMap *mExtra ) |
| 14 | { | 14 | { |
| 15 | std::string sDes, sBuf; | 15 | std::string sDes, sBuf; |
| 16 | int nMode = 0; | 16 | int nMode = 0; |
| @@ -31,7 +31,7 @@ std::string StringProcBuild::replVars( const std::string &sSrc, const std::strin | |||
| 31 | { | 31 | { |
| 32 | if( sSrc[j] == '}' ) | 32 | if( sSrc[j] == '}' ) |
| 33 | { | 33 | { |
| 34 | sDes += getBuild()->getVar( sCont, sBuf, mExtra ); | 34 | sDes += getBuild()->getVar( pCont, sBuf, mExtra ); |
| 35 | nMode = 0; | 35 | nMode = 0; |
| 36 | } | 36 | } |
| 37 | else | 37 | else |
diff --git a/src/stringprocbuild.h b/src/stringprocbuild.h index d940507..f3cf3b4 100644 --- a/src/stringprocbuild.h +++ b/src/stringprocbuild.h | |||
| @@ -11,7 +11,7 @@ public: | |||
| 11 | StringProcBuild( Build *pBld ); | 11 | StringProcBuild( Build *pBld ); |
| 12 | virtual ~StringProcBuild(); | 12 | virtual ~StringProcBuild(); |
| 13 | 13 | ||
| 14 | virtual std::string replVars( const std::string &sSrc, const std::string &sCont, VarMap *mExtra ); | 14 | virtual std::string replVars( const std::string &sSrc, const StringList *pCont, VarMap *mExtra ); |
| 15 | 15 | ||
| 16 | private: | 16 | private: |
| 17 | 17 | ||
