summaryrefslogtreecommitdiffabout
path: root/include
authorMichael Krelin <hacker@klever.net>2007-03-04 00:51:48 (UTC)
committer Michael Krelin <hacker@klever.net>2007-03-04 00:51:48 (UTC)
commit8677376c6669ad29bf24e237f626fd8296558f9b (patch) (unidiff)
tree1690b574355458356ea87a66387db1758c2ac9b1 /include
parenta3f38aafb288db5791b8dea34154cacc3c039971 (diff)
downloadsitecing-8677376c6669ad29bf24e237f626fd8296558f9b.zip
sitecing-8677376c6669ad29bf24e237f626fd8296558f9b.tar.gz
sitecing-8677376c6669ad29bf24e237f626fd8296558f9b.tar.bz2
doxygen update
Diffstat (limited to 'include') (more/less context) (ignore whitespace changes)
-rw-r--r--include/sitecing/sitecing_enflesher.h18
-rw-r--r--include/sitecing/sitecing_parser.h16
2 files changed, 29 insertions, 5 deletions
diff --git a/include/sitecing/sitecing_enflesher.h b/include/sitecing/sitecing_enflesher.h
index db15bc3..9eefdcc 100644
--- a/include/sitecing/sitecing_enflesher.h
+++ b/include/sitecing/sitecing_enflesher.h
@@ -1,88 +1,100 @@
1#ifndef __SITECING_SITECING_ENFLESHER_H 1#ifndef __SITECING_SITECING_ENFLESHER_H
2#define __SITECING_SITECING_ENFLESHER_H 2#define __SITECING_SITECING_ENFLESHER_H
3 3
4#include <fstream> 4#include <fstream>
5#include <string> 5#include <string>
6using namespace std; 6using namespace std;
7 7
8/** 8/**
9 * @file 9 * @file
10 * @brief The preprocessed source builder. 10 * @brief The preprocessed source builder.
11 */ 11 */
12 12
13#ifndef sitecing_enflesher_flexlexer_once 13#ifndef sitecing_enflesher_flexlexer_once
14#define sitecing_enflesher_flexlexer_once 14#define sitecing_enflesher_flexlexer_once
15#undef yyFlexLexer 15#undef yyFlexLexer
16/**
17 * nevermind me
18 */
16#define yyFlexLexer sitecing_enflesherFlexLexer 19#define yyFlexLexer sitecing_enflesherFlexLexer
17#include <FlexLexer.h> 20#include <FlexLexer.h>
18#undef yyFlexLexerOnce 21#undef yyFlexLexerOnce
19#endif 22#endif
20 23
21class sitecing_parser; 24class sitecing_parser;
22/** 25/**
23 * The enfleshing of the skeleton file according to the in-memory parsed 26 * The enfleshing of the skeleton file according to the in-memory parsed
24 * component source. 27 * component source.
25 */ 28 */
26class sitecing_enflesher : public sitecing_enflesherFlexLexer { 29class sitecing_enflesher : public sitecing_enflesherFlexLexer {
27 public: 30 public:
28 /** 31 /**
29 * It is time to anchor output with the #line directive. 32 * It is time to anchor output with the \#line directive.
30 */ 33 */
31 bool anchor_time; 34 bool anchor_time;
32 /** 35 /**
33 * The file currently being written is supposed to have #line 36 * The file currently being written is supposed to have \#line
34 * directives all around the place. 37 * directives all around the place.
35 */ 38 */
36 bool anchoraged; 39 bool anchoraged;
37 /** 40 /**
38 * The reference to the parser object containg the parsed source. 41 * The reference to the parser object containg the parsed source.
39 */ 42 */
40 sitecing_parser& parser; 43 sitecing_parser& parser;
41 /** 44 /**
42 * The output stream. 45 * The output stream.
43 */ 46 */
44 ofstream outs; 47 ofstream outs;
45 /** 48 /**
46 * the outs stream destination file. 49 * the outs stream destination file.
47 * @see outs 50 * @see outs
48 */ 51 */
49 string outs_filename; 52 string outs_filename;
50 53
51 /** 54 /**
52 * @param p The parser object containing preparsed data. 55 * @param p The parser object containing preparsed data.
53 */ 56 */
54 sitecing_enflesher(sitecing_parser& p) 57 sitecing_enflesher(sitecing_parser& p)
55 : parser(p), anchor_time(true) { } 58 : parser(p), anchor_time(true) { }
56 59
57 /** 60 /**
58 * Do the job. 61 * Do the job.
59 */ 62 */
60 void enflesh(); 63 void enflesh();
61 64
65 /**
66 * Output parsed data
67 * @param buf pointer to the data
68 * @param size length of the buffer pointed by buf
69 */
62 virtual void LexerOutput(const char *buf,int size); 70 virtual void LexerOutput(const char *buf,int size);
71 /**
72 * Lexer generated by flex
73 * @return zero on success
74 */
63 virtual int yylex(); 75 virtual int yylex();
64 76
65 /** 77 /**
66 * Put a #line anchor into output. 78 * Put a \#line anchor into output.
67 */ 79 */
68 void anchor(); 80 void anchor();
69 81
70 /** 82 /**
71 * Close previously opened output stream, rename to the 'correct' 83 * Close previously opened output stream, rename to the 'correct'
72 * destination filename, if needed, and open new file. 84 * destination filename, if needed, and open new file.
73 * @see outs 85 * @see outs
74 * @see outs_filename 86 * @see outs_filename
75 * @see outs_close 87 * @see outs_close
76 */ 88 */
77 void outs_open(const string& nfile); 89 void outs_open(const string& nfile);
78 /** 90 /**
79 * Close previously opened output stream, and rename to the 'correct' 91 * Close previously opened output stream, and rename to the 'correct'
80 * destination filename, if needed. 92 * destination filename, if needed.
81 * @see outs_open 93 * @see outs_open
82 * @see outs 94 * @see outs
83 * @see outs_filename 95 * @see outs_filename
84 */ 96 */
85 void outs_close(); 97 void outs_close();
86}; 98};
87 99
88#endif /* __SITECING_SITECING_ENFLESHER_H */ 100#endif /* __SITECING_SITECING_ENFLESHER_H */
diff --git a/include/sitecing/sitecing_parser.h b/include/sitecing/sitecing_parser.h
index a53ef22..bcabc5c 100644
--- a/include/sitecing/sitecing_parser.h
+++ b/include/sitecing/sitecing_parser.h
@@ -1,334 +1,346 @@
1#ifndef __SITECING_SITECING_PARSER_H 1#ifndef __SITECING_SITECING_PARSER_H
2#define __SITECING_SITECING_PARSER_H 2#define __SITECING_SITECING_PARSER_H
3 3
4#include <string> 4#include <string>
5#include <list> 5#include <list>
6#include <map> 6#include <map>
7#include <stdexcept> 7#include <stdexcept>
8using namespace std; 8using namespace std;
9 9
10#include "sitecing/component_factory.h" 10#include "sitecing/component_factory.h"
11using namespace sitecing; 11using namespace sitecing;
12 12
13/** 13/**
14 * @file 14 * @file
15 * @brief The component source parser. 15 * @brief The component source parser.
16 */ 16 */
17 17
18#ifndef sitecing_parser_flexlexer_once 18#ifndef sitecing_parser_flexlexer_once
19#define sitecing_parser_flexlexer_once 19#define sitecing_parser_flexlexer_once
20#undef yyFlexLexer 20#undef yyFlexLexer
21/**
22 * nevermind me
23 */
21#define yyFlexLexer sitecing_parserFlexLexer 24#define yyFlexLexer sitecing_parserFlexLexer
22#include <FlexLexer.h> 25#include <FlexLexer.h>
23#undef yyFlexLexerOnce 26#undef yyFlexLexerOnce
24#endif 27#endif
25 28
26/** 29/**
27 * The component source parser. 30 * The component source parser.
28 */ 31 */
29class sitecing_parser : public sitecing_parserFlexLexer { 32class sitecing_parser : public sitecing_parserFlexLexer {
30 public: 33 public:
31 /** 34 /**
32 * The ancestor class definition. 35 * The ancestor class definition.
33 */ 36 */
34 class ancestor_class { 37 class ancestor_class {
35 public: 38 public:
36 /** 39 /**
37 * The class name. 40 * The class name.
38 */ 41 */
39 string name; 42 string name;
40 /** 43 /**
41 * The source component path. 44 * The source component path.
42 */ 45 */
43 string path; 46 string path;
44 47
45 /** 48 /**
46 * @param n the class name. 49 * @param n the class name.
47 * @param p the component path. 50 * @param p the component path.
48 */ 51 */
49 ancestor_class(const string& n,const string& p) 52 ancestor_class(const string& n,const string& p)
50 : name(n), path(p) { } 53 : name(n), path(p) { }
51 }; 54 };
52 /** 55 /**
53 * The list of ancestor classes. 56 * The list of ancestor classes.
54 */ 57 */
55 typedef list<ancestor_class> ancestor_classes_t; 58 typedef list<ancestor_class> ancestor_classes_t;
56 /** 59 /**
57 * The ancestor classes. 60 * The ancestor classes.
58 */ 61 */
59 ancestor_classes_t ancestor_classes; 62 ancestor_classes_t ancestor_classes;
60 /** 63 /**
61 * The member variable definition. 64 * The member variable definition.
62 */ 65 */
63 class member_variable { 66 class member_variable {
64 public: 67 public:
65 /** 68 /**
66 * The member variable type. 69 * The member variable type.
67 */ 70 */
68 string type; 71 string type;
69 /** 72 /**
70 * The member variable name. 73 * The member variable name.
71 */ 74 */
72 string name; 75 string name;
73 /** 76 /**
74 * The member variable is a component. 77 * The member variable is a component.
75 */ 78 */
76 bool bComponent; 79 bool bComponent;
77 /** 80 /**
78 * The variable initializer. 81 * The variable initializer.
79 */ 82 */
80 string initializer; 83 string initializer;
81 /** 84 /**
82 * @todo TODO: wish I could remember -- document me. 85 * @todo TODO: wish I could remember -- document me.
83 */ 86 */
84 bool bTypeOnly; 87 bool bTypeOnly;
85 88
86 /** 89 /**
87 * @param t type. 90 * @param t type.
88 * @param n name. 91 * @param n name.
89 * @param i initializer. 92 * @param i initializer.
90 * @param bc whether it is a component. 93 * @param bc whether it is a component.
91 * @param bto document me @todo TODO: 94 * @param bto document me @todo TODO:
92 * @see bTypeOnly. 95 * @see bTypeOnly.
93 */ 96 */
94 member_variable(const string& t,const string& n,const string& i,bool bc = false,bool bto = false) 97 member_variable(const string& t,const string& n,const string& i,bool bc = false,bool bto = false)
95 : type(t), name(n), initializer(i), bComponent(bc), bTypeOnly(bto) { } 98 : type(t), name(n), initializer(i), bComponent(bc), bTypeOnly(bto) { }
96 }; 99 };
97 /** 100 /**
98 * The list of member variables. 101 * The list of member variables.
99 */ 102 */
100 typedef list<member_variable> member_variables_t; 103 typedef list<member_variable> member_variables_t;
101 /** 104 /**
102 * Member variables. 105 * Member variables.
103 */ 106 */
104 member_variables_t member_variables; 107 member_variables_t member_variables;
105 /** 108 /**
106 * @todo TODO: wish I could remember the details -- document me. 109 * @todo TODO: wish I could remember the details -- document me.
107 */ 110 */
108 bool have_initializers; 111 bool have_initializers;
109 /** 112 /**
110 * Whether the component has a constructor defined. 113 * Whether the component has a constructor defined.
111 */ 114 */
112 bool have_constructor; 115 bool have_constructor;
113 /** 116 /**
114 * Member function definition. 117 * Member function definition.
115 */ 118 */
116 class member_function { 119 class member_function {
117 public: 120 public:
118 /** 121 /**
119 * Return type. 122 * Return type.
120 */ 123 */
121 string type; 124 string type;
122 /** 125 /**
123 * Function name. 126 * Function name.
124 */ 127 */
125 string name; 128 string name;
126 /** 129 /**
127 * Arguments declaration. 130 * Arguments declaration.
128 */ 131 */
129 string args; 132 string args;
130 /** 133 /**
131 * Function body. 134 * Function body.
132 */ 135 */
133 string body; 136 string body;
134 137
135 /** 138 /**
136 * @param t type. 139 * @param t type.
137 * @param n name. 140 * @param n name.
138 * @param a arguments. 141 * @param a arguments.
139 * @param b body. 142 * @param b body.
140 */ 143 */
141 member_function(const string& t,const string& n,const string& a,const string& b) 144 member_function(const string& t,const string& n,const string& a,const string& b)
142 : type(t), name(n), args(a), body(b) { } 145 : type(t), name(n), args(a), body(b) { }
143 }; 146 };
144 /** 147 /**
145 * The list of member functions. 148 * The list of member functions.
146 */ 149 */
147 typedef list<member_function> member_functions_t; 150 typedef list<member_function> member_functions_t;
148 /** 151 /**
149 * Member functions. 152 * Member functions.
150 */ 153 */
151 member_functions_t member_functions; 154 member_functions_t member_functions;
152 /** 155 /**
153 * Current mode of operation. 156 * Current mode of operation.
154 */ 157 */
155 class modus_operandi { 158 class modus_operandi {
156 public: 159 public:
157 /** 160 /**
158 * The state enumeration. 161 * The state enumeration.
159 */ 162 */
160 enum modus_t { 163 enum modus_t {
161 /** 164 /**
162 * Building the code. 165 * Building the code.
163 */ 166 */
164 modus_code = 0, 167 modus_code = 0,
165 /** 168 /**
166 * Ready to do the '<<' thing. 169 * Ready to do the '<<' thing.
167 */ 170 */
168 modus_preop, 171 modus_preop,
169 /** 172 /**
170 * Just made a '<<'. 173 * Just made a '<<'.
171 */ 174 */
172 modus_postop, 175 modus_postop,
173 /** 176 /**
174 * Outputting raw output data. 177 * Outputting raw output data.
175 */ 178 */
176 modus_text, 179 modus_text,
177 /** 180 /**
178 * The number of modes. 181 * The number of modes.
179 */ 182 */
180 modi 183 modi
181 }; 184 };
182 /** 185 /**
183 * Processing flags enumeration. 186 * Processing flags enumeration.
184 */ 187 */
185 enum { 188 enum {
186 /** 189 /**
187 * Eat the comments. 190 * Eat the comments.
188 */ 191 */
189 flag_devour_comments = 0x0001, 192 flag_devour_comments = 0x0001,
190 /** 193 /**
191 * Eat whitespace. 194 * Eat whitespace.
192 */ 195 */
193 flag_devour_whitespace = 0x0002 196 flag_devour_whitespace = 0x0002
194 }; 197 };
195 /** 198 /**
196 * The processing mode. 199 * The processing mode.
197 */ 200 */
198 modus_t modus; 201 modus_t modus;
199 /** 202 /**
200 * The processing flags. 203 * The processing flags.
201 */ 204 */
202 int flags; 205 int flags;
203 /** 206 /**
204 * Output being built. 207 * Output being built.
205 */ 208 */
206 string output; 209 string output;
207 /** 210 /**
208 * The type for compound modes. 211 * The type for compound modes.
209 */ 212 */
210 string _type; 213 string _type;
211 /** 214 /**
212 * The last id encountered. 215 * The last id encountered.
213 */ 216 */
214 string _lastid; 217 string _lastid;
215 /** 218 /**
216 * The name for compound modes. 219 * The name for compound modes.
217 */ 220 */
218 string _name; 221 string _name;
219 /** 222 /**
220 * The argument declaration. Obviously for member functions. 223 * The argument declaration. Obviously for member functions.
221 */ 224 */
222 string _args; 225 string _args;
223 226
224 /** 227 /**
225 * @param f processing flags @see flags 228 * @param f processing flags @see flags
226 */ 229 */
227 modus_operandi(int f = 0) 230 modus_operandi(int f = 0)
228 : modus(modus_code), flags(f) { } 231 : modus(modus_code), flags(f) { }
229 232
230 /** 233 /**
231 * Change the processing mode. 234 * Change the processing mode.
232 */ 235 */
233 void modify(modus_t m); 236 void modify(modus_t m);
234 237
235 /** 238 /**
236 * See if we're eating up whitespaces. 239 * See if we're eating up whitespaces.
237 */ 240 */
238 bool devour_whitespace() { return flags&flag_devour_whitespace; } 241 bool devour_whitespace() { return flags&flag_devour_whitespace; }
239 /** 242 /**
240 * See if we're eating up the comments. 243 * See if we're eating up the comments.
241 */ 244 */
242 bool devour_comments() { return flags&flag_devour_comments; } 245 bool devour_comments() { return flags&flag_devour_comments; }
243 }; 246 };
244 /** 247 /**
245 * The modes stack type. 248 * The modes stack type.
246 */ 249 */
247 typedef list<modus_operandi> modi_operandi; 250 typedef list<modus_operandi> modi_operandi;
248 /** 251 /**
249 * The modes stack. 252 * The modes stack.
250 */ 253 */
251 modi_operandi modi; 254 modi_operandi modi;
252 /** 255 /**
253 * Input file name. 256 * Input file name.
254 */ 257 */
255 string input_file; 258 string input_file;
256 /** 259 /**
257 * Base class name. 260 * Base class name.
258 */ 261 */
259 string base_class; 262 string base_class;
260 /** 263 /**
261 * Base class header. 264 * Base class header.
262 */ 265 */
263 string base_header; 266 string base_header;
264 /** 267 /**
265 * Component's basename. 268 * Component's basename.
266 * @todo TODO: wish I could remember the details -- document me. 269 * @todo TODO: wish I could remember the details -- document me.
267 */ 270 */
268 string component_basename; 271 string component_basename;
269 /** 272 /**
270 * The skeleton file name. 273 * The skeleton file name.
271 */ 274 */
272 string skeleton; 275 string skeleton;
273 /** 276 /**
274 * The component class name. 277 * The component class name.
275 */ 278 */
276 string class_name; 279 string class_name;
277 /** 280 /**
278 * Output basename. 281 * Output basename.
279 * @todo TODO: wish I could remember the details -- document me. 282 * @todo TODO: wish I could remember the details -- document me.
280 */ 283 */
281 string output_basename; 284 string output_basename;
282 /** 285 /**
283 * Verbatim declaration part. 286 * Verbatim declaration part.
284 */ 287 */
285 string decl; 288 string decl;
286 /** 289 /**
287 * Verbatim implementation part. 290 * Verbatim implementation part.
288 */ 291 */
289 string impl; 292 string impl;
290 /** 293 /**
291 * The reference to the component factory object. 294 * The reference to the component factory object.
292 */ 295 */
293 component_factory& factory; 296 component_factory& factory;
294 /** 297 /**
295 * Pragma map type. 298 * Pragma map type.
296 */ 299 */
297 typedef map<string,string> pragmas_t; 300 typedef map<string,string> pragmas_t;
298 /** 301 /**
299 * Pragma's found in the component. 302 * Pragma's found in the component.
300 */ 303 */
301 pragmas_t pragmas; 304 pragmas_t pragmas;
302 305
303 /** 306 /**
304 * @param f the component factory. 307 * @param f the component factory.
305 */ 308 */
306 sitecing_parser(component_factory& f); 309 sitecing_parser(component_factory& f);
307 310
308 /** 311 /**
309 * Preprocess file. 312 * Preprocess file.
310 * @param in input file name. 313 * @param in input file name.
311 */ 314 */
312 void preprocess(const string& in); 315 void preprocess(const string& in);
313 316
317 /**
318 * Output parsed data
319 * @param buf pointer to the data
320 * @param size length of the buffer pointed by buf
321 */
314 virtual void LexerOutput(const char *buf,int size); 322 virtual void LexerOutput(const char *buf,int size);
323 /**
324 * Lexer generated by flex
325 * @return zero on success
326 */
315 virtual int yylex(); 327 virtual int yylex();
316 328
317 /** 329 /**
318 * Retrieve reference to the to of the modes stack. 330 * Retrieve reference to the to of the modes stack.
319 * @return the reference in question. 331 * @return the reference in question.
320 */ 332 */
321 modus_operandi& M() { 333 modus_operandi& M() {
322 return modi.front(); 334 return modi.front();
323 } 335 }
324 /** 336 /**
325 * Anchor the output with the #line, if we're not in the text output mode. 337 * Anchor the output with the \#line, if we're not in the text output mode.
326 */ 338 */
327 void soft_anchor(); 339 void soft_anchor();
328 /** 340 /**
329 * Anchor the output with the #line directive, changing to the appropriate output mode if needed. 341 * Anchor the output with the \#line directive, changing to the appropriate output mode if needed.
330 */ 342 */
331 void anchor(); 343 void anchor();
332}; 344};
333 345
334#endif /* __SITECING_SITECING_PARSER_H */ 346#endif /* __SITECING_SITECING_PARSER_H */