author | Michael Krelin <hacker@klever.net> | 2005-03-30 21:58:44 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2005-03-30 21:58:44 (UTC) |
commit | 5c757590c7561f6d85b3f9011aa0695c4111b379 (patch) (unidiff) | |
tree | e0bf20ca58b3e7bd9cc4eda54db5674ba1d71db0 /include/sitecing | |
parent | 3ddbfeafde93d1aab16a710498d86eef4e787406 (diff) | |
download | sitecing-5c757590c7561f6d85b3f9011aa0695c4111b379.zip sitecing-5c757590c7561f6d85b3f9011aa0695c4111b379.tar.gz sitecing-5c757590c7561f6d85b3f9011aa0695c4111b379.tar.bz2 |
1. fixed a bug just introduced, preventing the last skeleton-generated file
from being written.
2. introduced pragma directive and pragma main=class
3. minor changes of no importance
-rw-r--r-- | include/sitecing/sitecing_enflesher.h | 9 | ||||
-rw-r--r-- | include/sitecing/sitecing_parser.h | 8 |
2 files changed, 17 insertions, 0 deletions
diff --git a/include/sitecing/sitecing_enflesher.h b/include/sitecing/sitecing_enflesher.h index 8bc43a0..db15bc3 100644 --- a/include/sitecing/sitecing_enflesher.h +++ b/include/sitecing/sitecing_enflesher.h | |||
@@ -1,79 +1,88 @@ | |||
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> |
6 | using namespace std; | 6 | using 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 | #define yyFlexLexer sitecing_enflesherFlexLexer | 16 | #define yyFlexLexer sitecing_enflesherFlexLexer |
17 | #include <FlexLexer.h> | 17 | #include <FlexLexer.h> |
18 | #undef yyFlexLexerOnce | 18 | #undef yyFlexLexerOnce |
19 | #endif | 19 | #endif |
20 | 20 | ||
21 | class sitecing_parser; | 21 | class sitecing_parser; |
22 | /** | 22 | /** |
23 | * The enfleshing of the skeleton file according to the in-memory parsed | 23 | * The enfleshing of the skeleton file according to the in-memory parsed |
24 | * component source. | 24 | * component source. |
25 | */ | 25 | */ |
26 | class sitecing_enflesher : public sitecing_enflesherFlexLexer { | 26 | class sitecing_enflesher : public sitecing_enflesherFlexLexer { |
27 | public: | 27 | public: |
28 | /** | 28 | /** |
29 | * It is time to anchor output with the #line directive. | 29 | * It is time to anchor output with the #line directive. |
30 | */ | 30 | */ |
31 | bool anchor_time; | 31 | bool anchor_time; |
32 | /** | 32 | /** |
33 | * The file currently being written is supposed to have #line | 33 | * The file currently being written is supposed to have #line |
34 | * directives all around the place. | 34 | * directives all around the place. |
35 | */ | 35 | */ |
36 | bool anchoraged; | 36 | bool anchoraged; |
37 | /** | 37 | /** |
38 | * The reference to the parser object containg the parsed source. | 38 | * The reference to the parser object containg the parsed source. |
39 | */ | 39 | */ |
40 | sitecing_parser& parser; | 40 | sitecing_parser& parser; |
41 | /** | 41 | /** |
42 | * The output stream. | 42 | * The output stream. |
43 | */ | 43 | */ |
44 | ofstream outs; | 44 | ofstream outs; |
45 | /** | 45 | /** |
46 | * the outs stream destination file. | 46 | * the outs stream destination file. |
47 | * @see outs | 47 | * @see outs |
48 | */ | 48 | */ |
49 | string outs_filename; | 49 | string outs_filename; |
50 | 50 | ||
51 | /** | 51 | /** |
52 | * @param p The parser object containing preparsed data. | 52 | * @param p The parser object containing preparsed data. |
53 | */ | 53 | */ |
54 | sitecing_enflesher(sitecing_parser& p) | 54 | sitecing_enflesher(sitecing_parser& p) |
55 | : parser(p), anchor_time(true) { } | 55 | : parser(p), anchor_time(true) { } |
56 | 56 | ||
57 | /** | 57 | /** |
58 | * Do the job. | 58 | * Do the job. |
59 | */ | 59 | */ |
60 | void enflesh(); | 60 | void enflesh(); |
61 | 61 | ||
62 | virtual void LexerOutput(const char *buf,int size); | 62 | virtual void LexerOutput(const char *buf,int size); |
63 | virtual int yylex(); | 63 | virtual int yylex(); |
64 | 64 | ||
65 | /** | 65 | /** |
66 | * Put a #line anchor into output. | 66 | * Put a #line anchor into output. |
67 | */ | 67 | */ |
68 | void anchor(); | 68 | void anchor(); |
69 | 69 | ||
70 | /** | 70 | /** |
71 | * Close previously opened output stream, rename to the 'correct' | 71 | * Close previously opened output stream, rename to the 'correct' |
72 | * destination filename, if needed, and open new file. | 72 | * destination filename, if needed, and open new file. |
73 | * @see outs | 73 | * @see outs |
74 | * @see outs_filename | 74 | * @see outs_filename |
75 | * @see outs_close | ||
75 | */ | 76 | */ |
76 | void outs_open(const string& nfile); | 77 | void outs_open(const string& nfile); |
78 | /** | ||
79 | * Close previously opened output stream, and rename to the 'correct' | ||
80 | * destination filename, if needed. | ||
81 | * @see outs_open | ||
82 | * @see outs | ||
83 | * @see outs_filename | ||
84 | */ | ||
85 | void outs_close(); | ||
77 | }; | 86 | }; |
78 | 87 | ||
79 | #endif /* __SITECING_SITECING_ENFLESHER_H */ | 88 | #endif /* __SITECING_SITECING_ENFLESHER_H */ |
diff --git a/include/sitecing/sitecing_parser.h b/include/sitecing/sitecing_parser.h index 22d716f..a8474f3 100644 --- a/include/sitecing/sitecing_parser.h +++ b/include/sitecing/sitecing_parser.h | |||
@@ -198,129 +198,137 @@ class sitecing_parser : public sitecing_parserFlexLexer { | |||
198 | /** | 198 | /** |
199 | * The processing flags. | 199 | * The processing flags. |
200 | */ | 200 | */ |
201 | int flags; | 201 | int flags; |
202 | /** | 202 | /** |
203 | * Output being built. | 203 | * Output being built. |
204 | */ | 204 | */ |
205 | string output; | 205 | string output; |
206 | /** | 206 | /** |
207 | * The type for compound modes. | 207 | * The type for compound modes. |
208 | */ | 208 | */ |
209 | string _type; | 209 | string _type; |
210 | /** | 210 | /** |
211 | * The last id encountered. | 211 | * The last id encountered. |
212 | */ | 212 | */ |
213 | string _lastid; | 213 | string _lastid; |
214 | /** | 214 | /** |
215 | * The name for compound modes. | 215 | * The name for compound modes. |
216 | */ | 216 | */ |
217 | string _name; | 217 | string _name; |
218 | /** | 218 | /** |
219 | * The argument declaration. Obviously for member functions. | 219 | * The argument declaration. Obviously for member functions. |
220 | */ | 220 | */ |
221 | string _args; | 221 | string _args; |
222 | 222 | ||
223 | /** | 223 | /** |
224 | * @param flags. | 224 | * @param flags. |
225 | * @see flags | 225 | * @see flags |
226 | */ | 226 | */ |
227 | modus_operandi(int f = 0) | 227 | modus_operandi(int f = 0) |
228 | : modus(modus_code), flags(f) { } | 228 | : modus(modus_code), flags(f) { } |
229 | 229 | ||
230 | /** | 230 | /** |
231 | * Change the processing mode. | 231 | * Change the processing mode. |
232 | */ | 232 | */ |
233 | void modify(modus_t m); | 233 | void modify(modus_t m); |
234 | 234 | ||
235 | /** | 235 | /** |
236 | * See if we're eating up whitespaces. | 236 | * See if we're eating up whitespaces. |
237 | */ | 237 | */ |
238 | bool devour_whitespace() { return flags&flag_devour_whitespace; } | 238 | bool devour_whitespace() { return flags&flag_devour_whitespace; } |
239 | /** | 239 | /** |
240 | * See if we're eating up the comments. | 240 | * See if we're eating up the comments. |
241 | */ | 241 | */ |
242 | bool devour_comments() { return flags&flag_devour_comments; } | 242 | bool devour_comments() { return flags&flag_devour_comments; } |
243 | }; | 243 | }; |
244 | /** | 244 | /** |
245 | * The modes stack type. | 245 | * The modes stack type. |
246 | */ | 246 | */ |
247 | typedef list<modus_operandi> modi_operandi; | 247 | typedef list<modus_operandi> modi_operandi; |
248 | /** | 248 | /** |
249 | * The modes stack. | 249 | * The modes stack. |
250 | */ | 250 | */ |
251 | modi_operandi modi; | 251 | modi_operandi modi; |
252 | /** | 252 | /** |
253 | * Input file name. | 253 | * Input file name. |
254 | */ | 254 | */ |
255 | string input_file; | 255 | string input_file; |
256 | /** | 256 | /** |
257 | * Base class name. | 257 | * Base class name. |
258 | */ | 258 | */ |
259 | string base_class; | 259 | string base_class; |
260 | /** | 260 | /** |
261 | * Base class header. | 261 | * Base class header. |
262 | */ | 262 | */ |
263 | string base_header; | 263 | string base_header; |
264 | /** | 264 | /** |
265 | * Component's basename. | 265 | * Component's basename. |
266 | * @todo TODO: wish I could remember the details -- document me. | 266 | * @todo TODO: wish I could remember the details -- document me. |
267 | */ | 267 | */ |
268 | string component_basename; | 268 | string component_basename; |
269 | /** | 269 | /** |
270 | * The skeleton file name. | 270 | * The skeleton file name. |
271 | */ | 271 | */ |
272 | string skeleton; | 272 | string skeleton; |
273 | /** | 273 | /** |
274 | * The component class name. | 274 | * The component class name. |
275 | */ | 275 | */ |
276 | string class_name; | 276 | string class_name; |
277 | /** | 277 | /** |
278 | * Output basename. | 278 | * Output basename. |
279 | * @todo TODO: wish I could remember the details -- document me. | 279 | * @todo TODO: wish I could remember the details -- document me. |
280 | */ | 280 | */ |
281 | string output_basename; | 281 | string output_basename; |
282 | /** | 282 | /** |
283 | * Verbatim declaration part. | 283 | * Verbatim declaration part. |
284 | */ | 284 | */ |
285 | string decl; | 285 | string decl; |
286 | /** | 286 | /** |
287 | * Verbatim implementation part. | 287 | * Verbatim implementation part. |
288 | */ | 288 | */ |
289 | string impl; | 289 | string impl; |
290 | /** | 290 | /** |
291 | * The reference to the component factory object. | 291 | * The reference to the component factory object. |
292 | */ | 292 | */ |
293 | component_factory& factory; | 293 | component_factory& factory; |
294 | /** | ||
295 | * Pragma map type. | ||
296 | */ | ||
297 | typedef map<string,string> pragmas_t; | ||
298 | /** | ||
299 | * Pragma's found in the component. | ||
300 | */ | ||
301 | pragmas_t pragmas; | ||
294 | 302 | ||
295 | /** | 303 | /** |
296 | * @param f the component factory. | 304 | * @param f the component factory. |
297 | */ | 305 | */ |
298 | sitecing_parser(component_factory& f); | 306 | sitecing_parser(component_factory& f); |
299 | 307 | ||
300 | /** | 308 | /** |
301 | * Preprocess file. | 309 | * Preprocess file. |
302 | * @param in input file name. | 310 | * @param in input file name. |
303 | */ | 311 | */ |
304 | void preprocess(const string& in); | 312 | void preprocess(const string& in); |
305 | 313 | ||
306 | virtual void LexerOutput(const char *buf,int size); | 314 | virtual void LexerOutput(const char *buf,int size); |
307 | virtual int yylex(); | 315 | virtual int yylex(); |
308 | 316 | ||
309 | /** | 317 | /** |
310 | * Retrieve reference to the to of the modes stack. | 318 | * Retrieve reference to the to of the modes stack. |
311 | * @return the reference in question. | 319 | * @return the reference in question. |
312 | */ | 320 | */ |
313 | modus_operandi& M() { | 321 | modus_operandi& M() { |
314 | return modi.front(); | 322 | return modi.front(); |
315 | } | 323 | } |
316 | /** | 324 | /** |
317 | * Anchor the output with the #line, if we're not in the text output mode. | 325 | * Anchor the output with the #line, if we're not in the text output mode. |
318 | */ | 326 | */ |
319 | void soft_anchor(); | 327 | void soft_anchor(); |
320 | /** | 328 | /** |
321 | * Anchor the output with the #line directive, changing to the appropriate output mode if needed. | 329 | * Anchor the output with the #line directive, changing to the appropriate output mode if needed. |
322 | */ | 330 | */ |
323 | void anchor(); | 331 | void anchor(); |
324 | }; | 332 | }; |
325 | 333 | ||
326 | #endif /* __SITECING_SITECING_PARSER_H */ | 334 | #endif /* __SITECING_SITECING_PARSER_H */ |