diff options
author | Mike Buland <eichlan@xagasoft.com> | 2006-09-12 01:22:25 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2006-09-12 01:22:25 +0000 |
commit | 6011f825ca62dec32013af01d876e95174410cf6 (patch) | |
tree | 2415f38285d5f0cc035a79660206f1f779dc1693 /src/buildparser.cpp | |
parent | afd6d53eb6b3f169fa50cea360b982b60e589e6f (diff) | |
download | build-6011f825ca62dec32013af01d876e95174410cf6.tar.gz build-6011f825ca62dec32013af01d876e95174410cf6.tar.bz2 build-6011f825ca62dec32013af01d876e95174410cf6.tar.xz build-6011f825ca62dec32013af01d876e95174410cf6.zip |
Auto targets from functions now work well, but filtering is completely disabled.
Fortunately, filtering is more of a nicety, and build is still useful. I'll put
filtering back in next.
Diffstat (limited to 'src/buildparser.cpp')
-rw-r--r-- | src/buildparser.cpp | 74 |
1 files changed, 47 insertions, 27 deletions
diff --git a/src/buildparser.cpp b/src/buildparser.cpp index 04147d8..b8de35e 100644 --- a/src/buildparser.cpp +++ b/src/buildparser.cpp | |||
@@ -62,17 +62,17 @@ void BuildParser::setTargetType( const char *sType ) | |||
62 | 62 | ||
63 | void BuildParser::addTargetInput() | 63 | void BuildParser::addTargetInput() |
64 | { | 64 | { |
65 | lTargetTmp.back().second.lInput.insert( | 65 | lTargetTmp.back().second.lInput.first.insert( |
66 | lTargetTmp.back().second.lInput.end(), | 66 | lTargetTmp.back().second.lInput.first.end(), |
67 | lTmp.begin(), lTmp.end() | 67 | lTmp.first.begin(), lTmp.first.end() |
68 | ); | 68 | ); |
69 | } | 69 | } |
70 | 70 | ||
71 | void BuildParser::addTargetRequires() | 71 | void BuildParser::addTargetRequires() |
72 | { | 72 | { |
73 | lTargetTmp.back().second.lRequires.insert( | 73 | lTargetTmp.back().second.lRequires.first.insert( |
74 | lTargetTmp.back().second.lRequires.end(), | 74 | lTargetTmp.back().second.lRequires.first.end(), |
75 | lTmp.begin(), lTmp.end() | 75 | lTmp.first.begin(), lTmp.first.end() |
76 | ); | 76 | ); |
77 | } | 77 | } |
78 | 78 | ||
@@ -104,28 +104,46 @@ void BuildParser::addFunctionParam( const char *sParam ) | |||
104 | // | 104 | // |
105 | void BuildParser::newList() | 105 | void BuildParser::newList() |
106 | { | 106 | { |
107 | lTmp.clear(); | 107 | lTmp.first.clear(); |
108 | lTmp.second = NULL; | ||
108 | } | 109 | } |
109 | 110 | ||
110 | void BuildParser::addListString( const char *str ) | 111 | void BuildParser::addListString( const char *str ) |
111 | { | 112 | { |
112 | lTmp.push_back( BuildListItem(str, NULL) ); | 113 | lTmp.first.push_back( BuildListItem(str, NULL) ); |
113 | } | 114 | } |
114 | 115 | ||
115 | void BuildParser::addListFunc() | 116 | void BuildParser::addListFunc() |
116 | { | 117 | { |
117 | lTmp.push_back( BuildListItem("", pTmpFunc ) ); | 118 | lTmp.first.push_back( BuildListItem("", pTmpFunc ) ); |
118 | } | 119 | } |
119 | 120 | ||
120 | void BuildParser::filterList() | 121 | void BuildParser::filterList() |
121 | { | 122 | { |
123 | lTmp.second = pTmpFunc; | ||
124 | //StringList lTmp2; | ||
125 | //StringList lIn = buildToStringList( lTmp, StringList() ); | ||
126 | //pTmpFunc->execute( NULL, lIn, lTmp2 ); | ||
127 | //lTmp.clear(); | ||
128 | //for( StringList::iterator i = lTmp2.begin(); i != lTmp2.end(); i++ ) | ||
129 | //{ | ||
130 | // lTmp.push_back( BuildListItem( *i, NULL ) ); | ||
131 | //} | ||
132 | } | ||
133 | |||
134 | void BuildParser::buildListFilter( BuildList &lSrc ) | ||
135 | { | ||
136 | if( lSrc.second == NULL ) | ||
137 | return; | ||
138 | |||
122 | StringList lTmp2; | 139 | StringList lTmp2; |
123 | StringList lIn = buildToStringList( lTmp, StringList() ); | 140 | StringList lIn = buildToStringList( lSrc, StringList() ); |
124 | pTmpFunc->execute( NULL, lIn, lTmp2 ); | 141 | pTmpFunc->execute( NULL, lIn, lTmp2 ); |
125 | lTmp.clear(); | 142 | lSrc.first.clear(); |
143 | delete lSrc.second; | ||
126 | for( StringList::iterator i = lTmp2.begin(); i != lTmp2.end(); i++ ) | 144 | for( StringList::iterator i = lTmp2.begin(); i != lTmp2.end(); i++ ) |
127 | { | 145 | { |
128 | lTmp.push_back( BuildListItem( *i, NULL ) ); | 146 | lSrc.first.push_back( BuildListItem( *i, NULL ) ); |
129 | } | 147 | } |
130 | } | 148 | } |
131 | 149 | ||
@@ -133,7 +151,8 @@ StringList BuildParser::buildToStringList( const BuildList &lSrc, const StringLi | |||
133 | { | 151 | { |
134 | StringList lOut; | 152 | StringList lOut; |
135 | 153 | ||
136 | for( BuildList::const_iterator i = lSrc.begin(); i != lSrc.end(); i++ ) | 154 | for( BuildListCore::const_iterator i = lSrc.first.begin(); |
155 | i != lSrc.first.end(); i++ ) | ||
137 | { | 156 | { |
138 | if( (*i).second ) | 157 | if( (*i).second ) |
139 | { | 158 | { |
@@ -152,7 +171,8 @@ StringList BuildParser::buildToStringListDup( const BuildList &lSrc, const Strin | |||
152 | { | 171 | { |
153 | StringList lOut; | 172 | StringList lOut; |
154 | 173 | ||
155 | for( BuildList::const_iterator i = lSrc.begin(); i != lSrc.end(); i++ ) | 174 | for( BuildListCore::const_iterator i = lSrc.first.begin(); |
175 | i != lSrc.first.end(); i++ ) | ||
156 | { | 176 | { |
157 | if( (*i).second ) | 177 | if( (*i).second ) |
158 | { | 178 | { |
@@ -186,17 +206,17 @@ void BuildParser::addRuleMatches() | |||
186 | 206 | ||
187 | void BuildParser::addRuleProduces() | 207 | void BuildParser::addRuleProduces() |
188 | { | 208 | { |
189 | lRuleTmp.back().lProduces.insert( | 209 | lRuleTmp.back().lProduces.first.insert( |
190 | lRuleTmp.back().lProduces.end(), | 210 | lRuleTmp.back().lProduces.first.end(), |
191 | lTmp.begin(), lTmp.end() | 211 | lTmp.first.begin(), lTmp.first.end() |
192 | ); | 212 | ); |
193 | } | 213 | } |
194 | 214 | ||
195 | void BuildParser::addRuleRequires() | 215 | void BuildParser::addRuleRequires() |
196 | { | 216 | { |
197 | lRuleTmp.back().lRequires.insert( | 217 | lRuleTmp.back().lRequires.first.insert( |
198 | lRuleTmp.back().lRequires.end(), | 218 | lRuleTmp.back().lRequires.first.end(), |
199 | lTmp.begin(), lTmp.end() | 219 | lTmp.first.begin(), lTmp.first.end() |
200 | ); | 220 | ); |
201 | } | 221 | } |
202 | 222 | ||
@@ -346,10 +366,10 @@ void BuildParser::debugDump() | |||
346 | void BuildParser::printBuildList( const BuildList &lst ) | 366 | void BuildParser::printBuildList( const BuildList &lst ) |
347 | { | 367 | { |
348 | printf("["); | 368 | printf("["); |
349 | for( BuildList::const_iterator k = lst.begin(); | 369 | for( BuildListCore::const_iterator k = lst.first.begin(); |
350 | k != lst.end(); k++ ) | 370 | k != lst.first.end(); k++ ) |
351 | { | 371 | { |
352 | if( k != lst.begin() ) | 372 | if( k != lst.first.begin() ) |
353 | { | 373 | { |
354 | printf(", "); | 374 | printf(", "); |
355 | } | 375 | } |
@@ -462,8 +482,8 @@ Build *BuildParser::genBuild() | |||
462 | pRule->getPerformList().push_back( *j ); | 482 | pRule->getPerformList().push_back( *j ); |
463 | } | 483 | } |
464 | 484 | ||
465 | for( BuildList::iterator j = (*i).lProduces.begin(); | 485 | for( BuildListCore::iterator j = (*i).lProduces.first.begin(); |
466 | j != (*i).lProduces.end(); j++ ) | 486 | j != (*i).lProduces.first.end(); j++ ) |
467 | { | 487 | { |
468 | if( (*j).second ) | 488 | if( (*j).second ) |
469 | { | 489 | { |
@@ -479,8 +499,8 @@ Build *BuildParser::genBuild() | |||
479 | pRule->setAggregate( (*i).pAggregate ); | 499 | pRule->setAggregate( (*i).pAggregate ); |
480 | } | 500 | } |
481 | 501 | ||
482 | for( BuildList::iterator j = (*i).lRequires.begin(); | 502 | for( BuildListCore::iterator j = (*i).lRequires.first.begin(); |
483 | j != (*i).lRequires.end(); j++ ) | 503 | j != (*i).lRequires.first.end(); j++ ) |
484 | { | 504 | { |
485 | if( (*j).second ) | 505 | if( (*j).second ) |
486 | { | 506 | { |