aboutsummaryrefslogtreecommitdiff
path: root/src/builder.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2006-08-23 03:22:03 +0000
committerMike Buland <eichlan@xagasoft.com>2006-08-23 03:22:03 +0000
commit7a7390337e04d0163b97c1da7bdaa198bacaff72 (patch)
tree019eb3f455b0e8b35be9ae4560da319f377ea14e /src/builder.h
parentf5cf5725026ecb2fa63d729fb6745b4da15e69d8 (diff)
downloadbuild-7a7390337e04d0163b97c1da7bdaa198bacaff72.tar.gz
build-7a7390337e04d0163b97c1da7bdaa198bacaff72.tar.bz2
build-7a7390337e04d0163b97c1da7bdaa198bacaff72.tar.xz
build-7a7390337e04d0163b97c1da7bdaa198bacaff72.zip
Loads more stuff...it's nearly working now.
Diffstat (limited to 'src/builder.h')
-rw-r--r--src/builder.h94
1 files changed, 83 insertions, 11 deletions
diff --git a/src/builder.h b/src/builder.h
index 1d126dc..8d72627 100644
--- a/src/builder.h
+++ b/src/builder.h
@@ -6,8 +6,8 @@
6#include <list> 6#include <list>
7#include <utility> 7#include <utility>
8#include "build.tab.h" 8#include "build.tab.h"
9#include "exceptions.h"
10 9
10class Build;
11class Builder; 11class Builder;
12class Function; 12class Function;
13class FunctionFactory; 13class FunctionFactory;
@@ -19,12 +19,37 @@ class TargetFactory;
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, Builder &bld )
20YY_DECL; 20YY_DECL;
21 21
22subExceptionDecl( BuildException );
23
24typedef std::list<std::string> StringList; 22typedef std::list<std::string> StringList;
25 23
24template<class tx, class ty, class tz>
25class Triplet
26{
27public:
28 Triplet( const tx &x, const ty &y, const tz &z ) :
29 first( x ), second( y ), third( z )
30 {}
31
32 Triplet( const Triplet &src ) :
33 first( src.first ), second( src.second ), third( src.third )
34 {}
35
36 tx first;
37 ty second;
38 tz third;
39};
40
41enum eSetHow
42{
43 setSet,
44 setAdd
45};
46
26class Builder 47class Builder
27{ 48{
49 typedef std::pair<std::string, Function *> BuildListItem;
50 typedef std::list<BuildListItem> BuildList;
51 typedef Triplet<std::string, std::string, int> SetVar;
52 typedef std::list<SetVar> SetVarList;
28public: 53public:
29 Builder(); 54 Builder();
30 virtual ~Builder(); 55 virtual ~Builder();
@@ -32,19 +57,40 @@ public:
32 void error( YYLTYPE *locp, const char *msg ); 57 void error( YYLTYPE *locp, const char *msg );
33 void error( const std::string &msg ); 58 void error( const std::string &msg );
34 59
35 void load( const std::string &sFile ); 60 Build *load( const std::string &sFile );
36 61
37private: 62private:
38 std::string file; 63 std::string file;
39 void scanBegin(); 64 void scanBegin();
40 void scanEnd(); 65 void scanEnd();
41 66
67 Build *genBuild();
68
42public: // Target functions 69public: // Target functions
43 bool isTarget( const char *sType ); 70 bool isTarget( const char *sType );
71 void newTarget();
72 void setTargetRule( const char *sRule );
73 void setTargetPrefix( const char *sPrefix );
74 void setTargetType( const char *sType );
75 void addTargetInput();
76 void addTargetRequires();
77 void addTargetSet( const char *sVar, const char *sVal, int nHow );
44 78
45private: // Target variables 79private: // Target variables
46 Target *pTmpTarget;
47 TargetFactory &fTarget; 80 TargetFactory &fTarget;
81 class TargetInfo
82 {
83 public:
84 std::string sRule;
85 std::string sPrefix;
86 std::string sType;
87 BuildList lInput;
88 BuildList lRequires;
89 SetVarList lVar;
90 };
91 typedef std::pair<BuildList,TargetInfo> TargetTmp;
92 typedef std::list<TargetTmp> TargetTmpList;
93 TargetTmpList lTargetTmp;
48 94
49public: // Function functions 95public: // Function functions
50 bool isFunction( const char *sFunc ); 96 bool isFunction( const char *sFunc );
@@ -68,16 +114,35 @@ public: // List functions
68 void newList(); 114 void newList();
69 void addListString( const char *str ); 115 void addListString( const char *str );
70 void addListFunc(); 116 void addListFunc();
117 void filterList();
71 118
72 typedef std::pair<std::string, Function *> BuildListItem; 119 StringList buildToStringList( const BuildList &lSrc, const StringList &lIn );
73 typedef std::list<BuildListItem> BuildList;
74 120
75 StringList buildToStringList( BuildList &lSrc, StringList &lIn ); 121private: // List variables
76
77private:
78 BuildList lTmp; 122 BuildList lTmp;
79 123
80public: // Functions for dealing with rules 124public: // Rules functions
125 void addRule( const char *sName );
126 void addRuleMatches();
127 void addRuleProduces();
128 void addRuleRequires();
129 void addRuleInputFilter();
130 void addRulePerform();
131
132private: // Rule variables
133 class RuleInfo
134 {
135 public:
136 std::string sName;
137 Function *pMatches;
138 BuildList lProduces;
139 BuildList lRequires;
140 std::list<Function *> lFilter;
141 std::list<Perform *> lPerform;
142 };
143
144 typedef std::list<RuleInfo> RuleTmpList;
145 RuleTmpList lRuleTmp;
81 146
82public: // Functions for dealing with actions 147public: // Functions for dealing with actions
83 void addAction(); 148 void addAction();
@@ -91,8 +156,15 @@ private: // Action variables
91 typedef std::list<ActionTmp> ActionTmpList; 156 typedef std::list<ActionTmp> ActionTmpList;
92 ActionTmpList lActions; 157 ActionTmpList lActions;
93 158
159public: // Global variable functions
160 void addGlobalSet( const char *sVar, const char *sValue, int nHow );
161
162private: // Global variable variables
163 SetVarList lGlobalVars;
164
94public: // Debug 165public: // Debug
95 void debugDump(); 166 void debugDump();
167 void printBuildList( const BuildList &lst );
96}; 168};
97 169
98#endif 170#endif