diff options
Diffstat (limited to 'src/builder.h')
-rw-r--r-- | src/builder.h | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/src/builder.h b/src/builder.h index 89810c0..d7c0891 100644 --- a/src/builder.h +++ b/src/builder.h | |||
@@ -7,6 +7,7 @@ | |||
7 | #include "build.tab.h" | 7 | #include "build.tab.h" |
8 | #include "exceptionbase.h" | 8 | #include "exceptionbase.h" |
9 | #include "staticstring.h" | 9 | #include "staticstring.h" |
10 | #include "regexp.h" | ||
10 | 11 | ||
11 | subExceptionDecl( BuildException ) | 12 | subExceptionDecl( BuildException ) |
12 | 13 | ||
@@ -34,6 +35,8 @@ public: | |||
34 | virtual ~Builder(); | 35 | virtual ~Builder(); |
35 | 36 | ||
36 | void load( const char *sFN ); | 37 | void load( const char *sFN ); |
38 | void build( const char *sAct=NULL ); | ||
39 | void execute( Action *pAct ); | ||
37 | 40 | ||
38 | //void error( const yy::location &l, const std::string &m ); | 41 | //void error( const yy::location &l, const std::string &m ); |
39 | //void error( const std::string &m ); | 42 | //void error( const std::string &m ); |
@@ -46,7 +49,19 @@ public: | |||
46 | void add( Target *pTarg ); | 49 | void add( Target *pTarg ); |
47 | void varSet( const char *sName, const char *sValue ); | 50 | void varSet( const char *sName, const char *sValue ); |
48 | void varAddSet( const char *sName, const char *sValue ); | 51 | void varAddSet( const char *sName, const char *sValue ); |
52 | Rule *getRule( const char *sName ); | ||
53 | std::list<Rule *> findRuleChain( Rule *pRule ); | ||
54 | void processRequires( std::list<std::string> &lInput ); | ||
49 | void requires( const char *sBase, const char *sReq ); | 55 | void requires( const char *sBase, const char *sReq ); |
56 | void requiresFromCommand( const char *sBase, const char *sReq ); | ||
57 | void requiresRegexp( bool on ) | ||
58 | { | ||
59 | bReqRegexp = on; | ||
60 | } | ||
61 | bool isRequiresRegexp() | ||
62 | { | ||
63 | return bReqRegexp; | ||
64 | } | ||
50 | void setContext( const char *sCont ); | 65 | void setContext( const char *sCont ); |
51 | void setContext(); | 66 | void setContext(); |
52 | 67 | ||
@@ -77,10 +92,26 @@ public: | |||
77 | return sTmp; | 92 | return sTmp; |
78 | } | 93 | } |
79 | 94 | ||
95 | Target *getTarget( const char *sName ) | ||
96 | { | ||
97 | if( mTarget.find( sName ) == mTarget.end() ) | ||
98 | throw BuildException("Target %s not found.", sName ); | ||
99 | |||
100 | return mTarget[sName]; | ||
101 | } | ||
102 | |||
80 | private: | 103 | private: |
104 | typedef std::map<std::string, std::string> varmap; | ||
105 | |||
106 | void requiresNormal( const char *sBase, const char *sReq ); | ||
107 | void requiresRegexp( const char *sBase, const char *sReq ); | ||
81 | void checkVar( const char *cont, const char *sName ); | 108 | void checkVar( const char *cont, const char *sName ); |
82 | void scanBegin(); | 109 | void scanBegin(); |
83 | void scanEnd(); | 110 | void scanEnd(); |
111 | varmap *regexVars( RegExp *re ); | ||
112 | |||
113 | bool hasVar( varmap *pMap, std::string &var ); | ||
114 | std::string varRepl( const char *sSrc, const char *cont, varmap *mExtra ); | ||
84 | 115 | ||
85 | Action *pDefaultAction; | 116 | Action *pDefaultAction; |
86 | Action *pLastAddedAction; | 117 | Action *pLastAddedAction; |
@@ -92,14 +123,20 @@ private: | |||
92 | Target *pLastAddedTarget; | 123 | Target *pLastAddedTarget; |
93 | std::map<const char *, Target *, ltstr> mTarget; | 124 | std::map<const char *, Target *, ltstr> mTarget; |
94 | 125 | ||
95 | typedef std::map<std::string, std::string> varmap; | ||
96 | varmap mVar; | 126 | varmap mVar; |
127 | |||
97 | std::map<std::string, std::list<std::string> *> mRequires; | 128 | std::map<std::string, std::list<std::string> *> mRequires; |
98 | 129 | ||
130 | typedef std::list<std::pair<RegExp *, std::string> > regreqlist; | ||
131 | regreqlist lRequiresRegexp; | ||
132 | regreqlist lRequiresRegexpCommand; | ||
133 | |||
99 | std::map<std::string, varmap> mContVar; | 134 | std::map<std::string, varmap> mContVar; |
100 | StaticString sContext; | 135 | StaticString sContext; |
101 | 136 | ||
102 | StaticString sTmp; | 137 | StaticString sTmp; |
138 | |||
139 | bool bReqRegexp; | ||
103 | }; | 140 | }; |
104 | 141 | ||
105 | #endif | 142 | #endif |