aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/build.l6
-rw-r--r--src/build.y11
-rw-r--r--src/buildparser.cpp (renamed from src/builder.cpp)78
-rw-r--r--src/buildparser.h (renamed from src/builder.h)10
-rw-r--r--src/function.h2
-rw-r--r--src/main.cpp4
6 files changed, 55 insertions, 56 deletions
diff --git a/src/build.l b/src/build.l
index 3e95132..41abaf4 100644
--- a/src/build.l
+++ b/src/build.l
@@ -1,6 +1,6 @@
1%{ 1%{
2# include <string> 2# include <string>
3# include "builder.h" 3# include "buildparser.h"
4# include "build.tab.h" 4# include "build.tab.h"
5# include "stringrep.h" 5# include "stringrep.h"
6 6
@@ -116,7 +116,7 @@ std::string strbuf;
116 116
117%% 117%%
118 118
119void Builder::scanBegin() 119void BuildParser::scanBegin()
120{ 120{
121 yy_flex_debug = false; 121 yy_flex_debug = false;
122 if( !(yyin = fopen( file.c_str(), "r" )) ) 122 if( !(yyin = fopen( file.c_str(), "r" )) )
@@ -125,7 +125,7 @@ void Builder::scanBegin()
125 } 125 }
126} 126}
127 127
128void Builder::scanEnd() 128void BuildParser::scanEnd()
129{ 129{
130 fclose( yyin ); 130 fclose( yyin );
131} 131}
diff --git a/src/build.y b/src/build.y
index e9c0083..bb30d84 100644
--- a/src/build.y
+++ b/src/build.y
@@ -1,14 +1,14 @@
1%defines 1%defines
2%{ 2%{
3# include <string> 3# include <string>
4# include "builder.h" 4# include "buildparser.h"
5# include "build.tab.h" 5# include "build.tab.h"
6# include "action.h" 6# include "action.h"
7void yyerror( YYLTYPE *locp, Builder &bld, char const *msg ); 7void yyerror( YYLTYPE *locp, BuildParser &bld, char const *msg );
8%} 8%}
9 9
10%parse-param { Builder &bld } 10%parse-param { BuildParser &bld }
11%lex-param { Builder &bld } 11%lex-param { BuildParser &bld }
12%pure-parser 12%pure-parser
13 13
14%locations 14%locations
@@ -254,8 +254,7 @@ perfparams:
254 ; 254 ;
255%% 255%%
256 256
257void yyerror( YYLTYPE *locp, Builder &bld, char const *msg ) 257void yyerror( YYLTYPE *locp, BuildParser &bld, char const *msg )
258{ 258{
259 bld.error( locp, msg ); 259 bld.error( locp, msg );
260} 260}
261
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
9Builder::Builder() : 9BuildParser::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
16Builder::~Builder() 16BuildParser::~BuildParser()
17{ 17{
18} 18}
19 19
20void yyparse( Builder &bld ); 20void yyparse( BuildParser &bld );
21extern int yydebug; 21extern int yydebug;
22 22
23Build *Builder::load( const std::string &sFile ) 23Build *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
34void Builder::error( YYLTYPE *locp, const char *msg ) 34void 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
44void Builder::error( const std::string &msg ) 44void 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//
53bool Builder::isTarget( const char *sType ) 53bool BuildParser::isTarget( const char *sType )
54{ 54{
55 return fTarget.hasPlugin( sType ); 55 return fTarget.hasPlugin( sType );
56} 56}
57 57
58void Builder::newTarget() 58void BuildParser::newTarget()
59{ 59{
60 lTargetTmp.push_back( TargetTmp(lTmp, TargetInfo()) ); 60 lTargetTmp.push_back( TargetTmp(lTmp, TargetInfo()) );
61} 61}
62 62
63void Builder::setTargetRule( const char *sRule ) 63void BuildParser::setTargetRule( const char *sRule )
64{ 64{
65 lTargetTmp.back().second.sRule = sRule; 65 lTargetTmp.back().second.sRule = sRule;
66} 66}
67 67
68void Builder::setTargetPrefix( const char *sPrefix ) 68void BuildParser::setTargetPrefix( const char *sPrefix )
69{ 69{
70 lTargetTmp.back().second.sPrefix = sPrefix; 70 lTargetTmp.back().second.sPrefix = sPrefix;
71} 71}
72 72
73void Builder::setTargetType( const char *sType ) 73void BuildParser::setTargetType( const char *sType )
74{ 74{
75 lTargetTmp.back().second.sType = sType; 75 lTargetTmp.back().second.sType = sType;
76} 76}
77 77
78void Builder::addTargetInput() 78void 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
86void Builder::addTargetRequires() 86void 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
94void Builder::addTargetSet( const char *sVar, const char *sVal, int nHow ) 94void 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//
102bool Builder::isFunction( const char *sFunc ) 102bool BuildParser::isFunction( const char *sFunc )
103{ 103{
104 return fFunction.hasPlugin( sFunc ); 104 return fFunction.hasPlugin( sFunc );
105} 105}
106 106
107void Builder::newFunctionCall( const char *sName ) 107void BuildParser::newFunctionCall( const char *sName )
108{ 108{
109 pTmpFunc = fFunction.instantiate( sName ); 109 pTmpFunc = fFunction.instantiate( sName );
110} 110}
111 111
112void Builder::addFunctionParam( const char *sParam ) 112void 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//
120void Builder::newList() 120void BuildParser::newList()
121{ 121{
122 lTmp.clear(); 122 lTmp.clear();
123} 123}
124 124
125void Builder::addListString( const char *str ) 125void 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
130void Builder::addListFunc() 130void BuildParser::addListFunc()
131{ 131{
132 lTmp.push_back( BuildListItem("", pTmpFunc ) ); 132 lTmp.push_back( BuildListItem("", pTmpFunc ) );
133} 133}
134 134
135void Builder::filterList() 135void 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
147StringList Builder::buildToStringList( const BuildList &lSrc, const StringList &lIn ) 147StringList 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//
169void Builder::addRule( const char *sName ) 169void 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
175void Builder::addRuleMatches() 175void BuildParser::addRuleMatches()
176{ 176{
177 lRuleTmp.back().pMatches = pTmpFunc; 177 lRuleTmp.back().pMatches = pTmpFunc;
178} 178}
179 179
180void Builder::addRuleProduces() 180void 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
188void Builder::addRuleRequires() 188void 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
196void Builder::addRuleInputFilter() 196void BuildParser::addRuleInputFilter()
197{ 197{
198 lRuleTmp.back().lFilter.push_back( pTmpFunc ); 198 lRuleTmp.back().lFilter.push_back( pTmpFunc );
199} 199}
200 200
201void Builder::addRulePerform() 201void 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//
209bool Builder::isPerform( const char *sPerf ) 209bool BuildParser::isPerform( const char *sPerf )
210{ 210{
211 return fPerform.hasPlugin( sPerf ); 211 return fPerform.hasPlugin( sPerf );
212} 212}
213 213
214void Builder::newPerform( const char *sName ) 214void BuildParser::newPerform( const char *sName )
215{ 215{
216 pTmpPerform = fPerform.instantiate( sName ); 216 pTmpPerform = fPerform.instantiate( sName );
217} 217}
218 218
219void Builder::addPerformParam( const char *sParam ) 219void 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//
227void Builder::addAction() 227void BuildParser::addAction()
228{ 228{
229 lActions.push_back( ActionTmp("", ActionTmpCmdList()) ); 229 lActions.push_back( ActionTmp("", ActionTmpCmdList()) );
230} 230}
231 231
232void Builder::addAction( const char *sName ) 232void 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
237void Builder::addCommand( int nType ) 237void 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//
245void Builder::addGlobalSet( const char *sVar, const char *sValue, int nHow ) 245void 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//
253void Builder::debugDump() 253void 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
334void Builder::printBuildList( const BuildList &lst ) 334void 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//
359Build *Builder::genBuild() 359Build *BuildParser::genBuild()
360{ 360{
361 Build *bld = new Build; 361 Build *bld = new Build;
362 362
diff --git a/src/builder.h b/src/buildparser.h
index 367769f..642cc73 100644
--- a/src/builder.h
+++ b/src/buildparser.h
@@ -8,7 +8,7 @@
8#include "build.tab.h" 8#include "build.tab.h"
9 9
10class Build; 10class Build;
11class Builder; 11class BuildParser;
12class Function; 12class Function;
13class FunctionFactory; 13class FunctionFactory;
14class Perform; 14class Perform;
@@ -16,7 +16,7 @@ class PerformFactory;
16class Target; 16class Target;
17class TargetFactory; 17class TargetFactory;
18 18
19#define YY_DECL int yylex( YYSTYPE *yylval_param, YYLTYPE *yylloc_param, Builder &bld ) 19#define YY_DECL int yylex( YYSTYPE *yylval_param, YYLTYPE *yylloc_param, BuildParser &bld )
20YY_DECL; 20YY_DECL;
21 21
22typedef std::list<std::string> StringList; 22typedef std::list<std::string> StringList;
@@ -46,15 +46,15 @@ enum eSetHow
46 setAdd 46 setAdd
47}; 47};
48 48
49class Builder 49class BuildParser
50{ 50{
51 typedef std::pair<std::string, Function *> BuildListItem; 51 typedef std::pair<std::string, Function *> BuildListItem;
52 typedef std::list<BuildListItem> BuildList; 52 typedef std::list<BuildListItem> BuildList;
53 typedef Triplet<std::string, std::string, int> SetVar; 53 typedef Triplet<std::string, std::string, int> SetVar;
54 typedef std::list<SetVar> SetVarList; 54 typedef std::list<SetVar> SetVarList;
55public: 55public:
56 Builder(); 56 BuildParser();
57 virtual ~Builder(); 57 virtual ~BuildParser();
58 58
59 void error( YYLTYPE *locp, const char *msg ); 59 void error( YYLTYPE *locp, const char *msg );
60 void error( const std::string &msg ); 60 void error( const std::string &msg );
diff --git a/src/function.h b/src/function.h
index 0e8f49e..73dcb01 100644
--- a/src/function.h
+++ b/src/function.h
@@ -2,7 +2,7 @@
2#define FUNCTION_H 2#define FUNCTION_H
3 3
4#include <stdint.h> 4#include <stdint.h>
5#include "builder.h" 5#include "build.h"
6 6
7class Function 7class Function
8{ 8{
diff --git a/src/main.cpp b/src/main.cpp
index be95f07..9dbf046 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,4 +1,4 @@
1#include "builder.h" 1#include "buildparser.h"
2//#include "viewerplain.h" 2//#include "viewerplain.h"
3//#include "viewerpercent.h" 3//#include "viewerpercent.h"
4//#include "viewermake.h" 4//#include "viewermake.h"
@@ -72,7 +72,7 @@ int main( int argc, char *argv[] )
72 Param prm; 72 Param prm;
73 prm.process( argc, argv ); 73 prm.process( argc, argv );
74 74
75 Builder bld;//*prm.pViewer ); 75 BuildParser bld;//*prm.pViewer );
76 76
77 //bld.setCache( prm.sCache ); 77 //bld.setCache( prm.sCache );
78 //try 78 //try