diff options
Diffstat (limited to '')
-rw-r--r-- | src/buildparser.cpp (renamed from src/builder.cpp) | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/src/builder.cpp b/src/buildparser.cpp index 1e916ab..cb285d4 100644 --- a/src/builder.cpp +++ b/src/buildparser.cpp | |||
@@ -1,4 +1,4 @@ | |||
1 | #include "builder.h" | 1 | #include "buildparser.h" |
2 | #include "functionfactory.h" | 2 | #include "functionfactory.h" |
3 | #include "performfactory.h" | 3 | #include "performfactory.h" |
4 | #include "targetfactory.h" | 4 | #include "targetfactory.h" |
@@ -6,21 +6,21 @@ | |||
6 | #include "build.h" | 6 | #include "build.h" |
7 | #include "rule.h" | 7 | #include "rule.h" |
8 | 8 | ||
9 | Builder::Builder() : | 9 | BuildParser::BuildParser() : |
10 | fFunction( FunctionFactory::getInstance() ), | 10 | fFunction( FunctionFactory::getInstance() ), |
11 | fPerform( PerformFactory::getInstance() ), | 11 | fPerform( PerformFactory::getInstance() ), |
12 | fTarget( TargetFactory::getInstance() ) | 12 | fTarget( TargetFactory::getInstance() ) |
13 | { | 13 | { |
14 | } | 14 | } |
15 | 15 | ||
16 | Builder::~Builder() | 16 | BuildParser::~BuildParser() |
17 | { | 17 | { |
18 | } | 18 | } |
19 | 19 | ||
20 | void yyparse( Builder &bld ); | 20 | void yyparse( BuildParser &bld ); |
21 | extern int yydebug; | 21 | extern int yydebug; |
22 | 22 | ||
23 | Build *Builder::load( const std::string &sFile ) | 23 | Build *BuildParser::load( const std::string &sFile ) |
24 | { | 24 | { |
25 | file = sFile; | 25 | file = sFile; |
26 | scanBegin(); | 26 | scanBegin(); |
@@ -31,7 +31,7 @@ Build *Builder::load( const std::string &sFile ) | |||
31 | return genBuild(); | 31 | return genBuild(); |
32 | } | 32 | } |
33 | 33 | ||
34 | void Builder::error( YYLTYPE *locp, const char *msg ) | 34 | void BuildParser::error( YYLTYPE *locp, const char *msg ) |
35 | { | 35 | { |
36 | fflush( stdout ); | 36 | fflush( stdout ); |
37 | throw BuildException("%s: %d.%d-%d.%d: %s", | 37 | throw BuildException("%s: %d.%d-%d.%d: %s", |
@@ -41,7 +41,7 @@ void Builder::error( YYLTYPE *locp, const char *msg ) | |||
41 | msg ); | 41 | msg ); |
42 | } | 42 | } |
43 | 43 | ||
44 | void Builder::error( const std::string &msg ) | 44 | void BuildParser::error( const std::string &msg ) |
45 | { | 45 | { |
46 | fflush( stdout ); | 46 | fflush( stdout ); |
47 | throw BuildException("%s", msg.c_str() ); | 47 | throw BuildException("%s", msg.c_str() ); |
@@ -50,32 +50,32 @@ void Builder::error( const std::string &msg ) | |||
50 | // | 50 | // |
51 | // Target functions | 51 | // Target functions |
52 | // | 52 | // |
53 | bool Builder::isTarget( const char *sType ) | 53 | bool BuildParser::isTarget( const char *sType ) |
54 | { | 54 | { |
55 | return fTarget.hasPlugin( sType ); | 55 | return fTarget.hasPlugin( sType ); |
56 | } | 56 | } |
57 | 57 | ||
58 | void Builder::newTarget() | 58 | void BuildParser::newTarget() |
59 | { | 59 | { |
60 | lTargetTmp.push_back( TargetTmp(lTmp, TargetInfo()) ); | 60 | lTargetTmp.push_back( TargetTmp(lTmp, TargetInfo()) ); |
61 | } | 61 | } |
62 | 62 | ||
63 | void Builder::setTargetRule( const char *sRule ) | 63 | void BuildParser::setTargetRule( const char *sRule ) |
64 | { | 64 | { |
65 | lTargetTmp.back().second.sRule = sRule; | 65 | lTargetTmp.back().second.sRule = sRule; |
66 | } | 66 | } |
67 | 67 | ||
68 | void Builder::setTargetPrefix( const char *sPrefix ) | 68 | void BuildParser::setTargetPrefix( const char *sPrefix ) |
69 | { | 69 | { |
70 | lTargetTmp.back().second.sPrefix = sPrefix; | 70 | lTargetTmp.back().second.sPrefix = sPrefix; |
71 | } | 71 | } |
72 | 72 | ||
73 | void Builder::setTargetType( const char *sType ) | 73 | void BuildParser::setTargetType( const char *sType ) |
74 | { | 74 | { |
75 | lTargetTmp.back().second.sType = sType; | 75 | lTargetTmp.back().second.sType = sType; |
76 | } | 76 | } |
77 | 77 | ||
78 | void Builder::addTargetInput() | 78 | void BuildParser::addTargetInput() |
79 | { | 79 | { |
80 | lTargetTmp.back().second.lInput.insert( | 80 | lTargetTmp.back().second.lInput.insert( |
81 | lTargetTmp.back().second.lInput.end(), | 81 | lTargetTmp.back().second.lInput.end(), |
@@ -83,7 +83,7 @@ void Builder::addTargetInput() | |||
83 | ); | 83 | ); |
84 | } | 84 | } |
85 | 85 | ||
86 | void Builder::addTargetRequires() | 86 | void BuildParser::addTargetRequires() |
87 | { | 87 | { |
88 | lTargetTmp.back().second.lRequires.insert( | 88 | lTargetTmp.back().second.lRequires.insert( |
89 | lTargetTmp.back().second.lRequires.end(), | 89 | lTargetTmp.back().second.lRequires.end(), |
@@ -91,7 +91,7 @@ void Builder::addTargetRequires() | |||
91 | ); | 91 | ); |
92 | } | 92 | } |
93 | 93 | ||
94 | void Builder::addTargetSet( const char *sVar, const char *sVal, int nHow ) | 94 | void BuildParser::addTargetSet( const char *sVar, const char *sVal, int nHow ) |
95 | { | 95 | { |
96 | lTargetTmp.back().second.lVar.push_back( SetVar( sVar, sVal, nHow ) ); | 96 | lTargetTmp.back().second.lVar.push_back( SetVar( sVar, sVal, nHow ) ); |
97 | } | 97 | } |
@@ -99,17 +99,17 @@ void Builder::addTargetSet( const char *sVar, const char *sVal, int nHow ) | |||
99 | // | 99 | // |
100 | // Function functions | 100 | // Function functions |
101 | // | 101 | // |
102 | bool Builder::isFunction( const char *sFunc ) | 102 | bool BuildParser::isFunction( const char *sFunc ) |
103 | { | 103 | { |
104 | return fFunction.hasPlugin( sFunc ); | 104 | return fFunction.hasPlugin( sFunc ); |
105 | } | 105 | } |
106 | 106 | ||
107 | void Builder::newFunctionCall( const char *sName ) | 107 | void BuildParser::newFunctionCall( const char *sName ) |
108 | { | 108 | { |
109 | pTmpFunc = fFunction.instantiate( sName ); | 109 | pTmpFunc = fFunction.instantiate( sName ); |
110 | } | 110 | } |
111 | 111 | ||
112 | void Builder::addFunctionParam( const char *sParam ) | 112 | void BuildParser::addFunctionParam( const char *sParam ) |
113 | { | 113 | { |
114 | pTmpFunc->addParam( sParam ); | 114 | pTmpFunc->addParam( sParam ); |
115 | } | 115 | } |
@@ -117,22 +117,22 @@ void Builder::addFunctionParam( const char *sParam ) | |||
117 | // | 117 | // |
118 | // List functions | 118 | // List functions |
119 | // | 119 | // |
120 | void Builder::newList() | 120 | void BuildParser::newList() |
121 | { | 121 | { |
122 | lTmp.clear(); | 122 | lTmp.clear(); |
123 | } | 123 | } |
124 | 124 | ||
125 | void Builder::addListString( const char *str ) | 125 | void BuildParser::addListString( const char *str ) |
126 | { | 126 | { |
127 | lTmp.push_back( BuildListItem(str, NULL) ); | 127 | lTmp.push_back( BuildListItem(str, NULL) ); |
128 | } | 128 | } |
129 | 129 | ||
130 | void Builder::addListFunc() | 130 | void BuildParser::addListFunc() |
131 | { | 131 | { |
132 | lTmp.push_back( BuildListItem("", pTmpFunc ) ); | 132 | lTmp.push_back( BuildListItem("", pTmpFunc ) ); |
133 | } | 133 | } |
134 | 134 | ||
135 | void Builder::filterList() | 135 | void BuildParser::filterList() |
136 | { | 136 | { |
137 | StringList lTmp2; | 137 | StringList lTmp2; |
138 | StringList lIn = buildToStringList( lTmp, StringList() ); | 138 | StringList lIn = buildToStringList( lTmp, StringList() ); |
@@ -144,7 +144,7 @@ void Builder::filterList() | |||
144 | } | 144 | } |
145 | } | 145 | } |
146 | 146 | ||
147 | StringList Builder::buildToStringList( const BuildList &lSrc, const StringList &lIn ) | 147 | StringList BuildParser::buildToStringList( const BuildList &lSrc, const StringList &lIn ) |
148 | { | 148 | { |
149 | StringList lOut; | 149 | StringList lOut; |
150 | 150 | ||
@@ -166,18 +166,18 @@ StringList Builder::buildToStringList( const BuildList &lSrc, const StringList & | |||
166 | // | 166 | // |
167 | // Rule functions | 167 | // Rule functions |
168 | // | 168 | // |
169 | void Builder::addRule( const char *sName ) | 169 | void BuildParser::addRule( const char *sName ) |
170 | { | 170 | { |
171 | lRuleTmp.push_back( RuleInfo() ); | 171 | lRuleTmp.push_back( RuleInfo() ); |
172 | lRuleTmp.back().sName = sName; | 172 | lRuleTmp.back().sName = sName; |
173 | } | 173 | } |
174 | 174 | ||
175 | void Builder::addRuleMatches() | 175 | void BuildParser::addRuleMatches() |
176 | { | 176 | { |
177 | lRuleTmp.back().pMatches = pTmpFunc; | 177 | lRuleTmp.back().pMatches = pTmpFunc; |
178 | } | 178 | } |
179 | 179 | ||
180 | void Builder::addRuleProduces() | 180 | void BuildParser::addRuleProduces() |
181 | { | 181 | { |
182 | lRuleTmp.back().lProduces.insert( | 182 | lRuleTmp.back().lProduces.insert( |
183 | lRuleTmp.back().lProduces.end(), | 183 | lRuleTmp.back().lProduces.end(), |
@@ -185,7 +185,7 @@ void Builder::addRuleProduces() | |||
185 | ); | 185 | ); |
186 | } | 186 | } |
187 | 187 | ||
188 | void Builder::addRuleRequires() | 188 | void BuildParser::addRuleRequires() |
189 | { | 189 | { |
190 | lRuleTmp.back().lRequires.insert( | 190 | lRuleTmp.back().lRequires.insert( |
191 | lRuleTmp.back().lRequires.end(), | 191 | lRuleTmp.back().lRequires.end(), |
@@ -193,12 +193,12 @@ void Builder::addRuleRequires() | |||
193 | ); | 193 | ); |
194 | } | 194 | } |
195 | 195 | ||
196 | void Builder::addRuleInputFilter() | 196 | void BuildParser::addRuleInputFilter() |
197 | { | 197 | { |
198 | lRuleTmp.back().lFilter.push_back( pTmpFunc ); | 198 | lRuleTmp.back().lFilter.push_back( pTmpFunc ); |
199 | } | 199 | } |
200 | 200 | ||
201 | void Builder::addRulePerform() | 201 | void BuildParser::addRulePerform() |
202 | { | 202 | { |
203 | lRuleTmp.back().lPerform.push_back( pTmpPerform ); | 203 | lRuleTmp.back().lPerform.push_back( pTmpPerform ); |
204 | } | 204 | } |
@@ -206,17 +206,17 @@ void Builder::addRulePerform() | |||
206 | // | 206 | // |
207 | // Perform functions | 207 | // Perform functions |
208 | // | 208 | // |
209 | bool Builder::isPerform( const char *sPerf ) | 209 | bool BuildParser::isPerform( const char *sPerf ) |
210 | { | 210 | { |
211 | return fPerform.hasPlugin( sPerf ); | 211 | return fPerform.hasPlugin( sPerf ); |
212 | } | 212 | } |
213 | 213 | ||
214 | void Builder::newPerform( const char *sName ) | 214 | void BuildParser::newPerform( const char *sName ) |
215 | { | 215 | { |
216 | pTmpPerform = fPerform.instantiate( sName ); | 216 | pTmpPerform = fPerform.instantiate( sName ); |
217 | } | 217 | } |
218 | 218 | ||
219 | void Builder::addPerformParam( const char *sParam ) | 219 | void BuildParser::addPerformParam( const char *sParam ) |
220 | { | 220 | { |
221 | pTmpPerform->addParam( sParam ); | 221 | pTmpPerform->addParam( sParam ); |
222 | } | 222 | } |
@@ -224,17 +224,17 @@ void Builder::addPerformParam( const char *sParam ) | |||
224 | // | 224 | // |
225 | // Functions for dealing with actions | 225 | // Functions for dealing with actions |
226 | // | 226 | // |
227 | void Builder::addAction() | 227 | void BuildParser::addAction() |
228 | { | 228 | { |
229 | lActions.push_back( ActionTmp("", ActionTmpCmdList()) ); | 229 | lActions.push_back( ActionTmp("", ActionTmpCmdList()) ); |
230 | } | 230 | } |
231 | 231 | ||
232 | void Builder::addAction( const char *sName ) | 232 | void BuildParser::addAction( const char *sName ) |
233 | { | 233 | { |
234 | lActions.push_back( ActionTmp(sName, ActionTmpCmdList()) ); | 234 | lActions.push_back( ActionTmp(sName, ActionTmpCmdList()) ); |
235 | } | 235 | } |
236 | 236 | ||
237 | void Builder::addCommand( int nType ) | 237 | void BuildParser::addCommand( int nType ) |
238 | { | 238 | { |
239 | lActions.back().second.push_back( ActionTmpCmd( nType, lTmp ) ); | 239 | lActions.back().second.push_back( ActionTmpCmd( nType, lTmp ) ); |
240 | } | 240 | } |
@@ -242,7 +242,7 @@ void Builder::addCommand( int nType ) | |||
242 | // | 242 | // |
243 | // Global variable functions | 243 | // Global variable functions |
244 | // | 244 | // |
245 | void Builder::addGlobalSet( const char *sVar, const char *sValue, int nHow ) | 245 | void BuildParser::addGlobalSet( const char *sVar, const char *sValue, int nHow ) |
246 | { | 246 | { |
247 | lGlobalVars.push_back( SetVar( sVar, sValue, nHow ) ); | 247 | lGlobalVars.push_back( SetVar( sVar, sValue, nHow ) ); |
248 | } | 248 | } |
@@ -250,7 +250,7 @@ void Builder::addGlobalSet( const char *sVar, const char *sValue, int nHow ) | |||
250 | // | 250 | // |
251 | // Debug | 251 | // Debug |
252 | // | 252 | // |
253 | void Builder::debugDump() | 253 | void BuildParser::debugDump() |
254 | { | 254 | { |
255 | printf("Actions:\n"); | 255 | printf("Actions:\n"); |
256 | for( ActionTmpList::iterator i = lActions.begin(); | 256 | for( ActionTmpList::iterator i = lActions.begin(); |
@@ -331,7 +331,7 @@ void Builder::debugDump() | |||
331 | } | 331 | } |
332 | } | 332 | } |
333 | 333 | ||
334 | void Builder::printBuildList( const BuildList &lst ) | 334 | void BuildParser::printBuildList( const BuildList &lst ) |
335 | { | 335 | { |
336 | printf("["); | 336 | printf("["); |
337 | for( BuildList::const_iterator k = lst.begin(); | 337 | for( BuildList::const_iterator k = lst.begin(); |
@@ -356,7 +356,7 @@ void Builder::printBuildList( const BuildList &lst ) | |||
356 | // | 356 | // |
357 | // Actually make a build object | 357 | // Actually make a build object |
358 | // | 358 | // |
359 | Build *Builder::genBuild() | 359 | Build *BuildParser::genBuild() |
360 | { | 360 | { |
361 | Build *bld = new Build; | 361 | Build *bld = new Build; |
362 | 362 | ||