diff options
| author | Mike Buland <eichlan@xagasoft.com> | 2006-07-31 17:23:04 +0000 |
|---|---|---|
| committer | Mike Buland <eichlan@xagasoft.com> | 2006-07-31 17:23:04 +0000 |
| commit | b672fa69c4c98509f8ee251b87300e3fcbe6bdc8 (patch) | |
| tree | 064212cec710fc5bfd5f2b75dd2a502ba9f66eba /src/builder.h | |
| parent | 9139f1df4cda80b91ab68e5de27e85eaa4c54682 (diff) | |
| download | build-b672fa69c4c98509f8ee251b87300e3fcbe6bdc8.tar.gz build-b672fa69c4c98509f8ee251b87300e3fcbe6bdc8.tar.bz2 build-b672fa69c4c98509f8ee251b87300e3fcbe6bdc8.tar.xz build-b672fa69c4c98509f8ee251b87300e3fcbe6bdc8.zip | |
We're almost to rule/command generation, then only a couple of steps before it
will do it all!
Diffstat (limited to '')
| -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 |
