1 | #include <ctype.h> |
---|
2 | |
---|
3 | #define yy_create_buffer vs10__create_buffer |
---|
4 | #define yy_delete_buffer vs10__delete_buffer |
---|
5 | #define yy_scan_buffer vs10__scan_buffer |
---|
6 | #define yy_scan_string vs10__scan_string |
---|
7 | #define yy_scan_bytes vs10__scan_bytes |
---|
8 | #define yy_flex_debug vs10__flex_debug |
---|
9 | #define yy_init_buffer vs10__init_buffer |
---|
10 | #define yy_flush_buffer vs10__flush_buffer |
---|
11 | #define yy_load_buffer_state vs10__load_buffer_state |
---|
12 | #define yy_switch_to_buffer vs10__switch_to_buffer |
---|
13 | #define yyin vs10_in |
---|
14 | #define yyleng vs10_leng |
---|
15 | #define yylex vs10_lex |
---|
16 | #define yyout vs10_out |
---|
17 | #define yyrestart vs10_restart |
---|
18 | #define yytext vs10_text |
---|
19 | #define yywrap vs10_wrap |
---|
20 | |
---|
21 | #line 20 "_vs1.0_lexer.cpp" |
---|
22 | /* A lexical scanner generated by flex */ |
---|
23 | |
---|
24 | /* Scanner skeleton version: |
---|
25 | * $Header: /cvsroot/ogre/ogrenew/RenderSystems/GL/src/nvparse/_vs1.0_lexer.cpp,v 1.4 2005/11/10 07:24:20 nfz Exp $ |
---|
26 | */ |
---|
27 | |
---|
28 | #define FLEX_SCANNER |
---|
29 | #define YY_FLEX_MAJOR_VERSION 2 |
---|
30 | #define YY_FLEX_MINOR_VERSION 5 |
---|
31 | |
---|
32 | #include <stdio.h> |
---|
33 | #include <unistd.h> |
---|
34 | |
---|
35 | |
---|
36 | /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */ |
---|
37 | #ifdef c_plusplus |
---|
38 | #ifndef __cplusplus |
---|
39 | #define __cplusplus |
---|
40 | #endif |
---|
41 | #endif |
---|
42 | |
---|
43 | |
---|
44 | #ifdef __cplusplus |
---|
45 | |
---|
46 | #include <stdlib.h> |
---|
47 | |
---|
48 | /* Use prototypes in function declarations. */ |
---|
49 | #define YY_USE_PROTOS |
---|
50 | |
---|
51 | /* The "const" storage-class-modifier is valid. */ |
---|
52 | #define YY_USE_CONST |
---|
53 | |
---|
54 | #else /* ! __cplusplus */ |
---|
55 | |
---|
56 | #if __STDC__ |
---|
57 | |
---|
58 | #define YY_USE_PROTOS |
---|
59 | #define YY_USE_CONST |
---|
60 | |
---|
61 | #endif /* __STDC__ */ |
---|
62 | #endif /* ! __cplusplus */ |
---|
63 | |
---|
64 | #ifdef __TURBOC__ |
---|
65 | #pragma warn -rch |
---|
66 | #pragma warn -use |
---|
67 | #include <io.h> |
---|
68 | #include <stdlib.h> |
---|
69 | #define YY_USE_CONST |
---|
70 | #define YY_USE_PROTOS |
---|
71 | #endif |
---|
72 | |
---|
73 | #ifdef YY_USE_CONST |
---|
74 | #define yyconst const |
---|
75 | #else |
---|
76 | #define yyconst |
---|
77 | #endif |
---|
78 | |
---|
79 | |
---|
80 | #ifdef YY_USE_PROTOS |
---|
81 | #define YY_PROTO(proto) proto |
---|
82 | #else |
---|
83 | #define YY_PROTO(proto) () |
---|
84 | #endif |
---|
85 | |
---|
86 | /* Returned upon end-of-file. */ |
---|
87 | #define YY_NULL 0 |
---|
88 | |
---|
89 | /* Promotes a possibly negative, possibly signed char to an unsigned |
---|
90 | * integer for use as an array index. If the signed char is negative, |
---|
91 | * we want to instead treat it as an 8-bit unsigned char, hence the |
---|
92 | * double cast. |
---|
93 | */ |
---|
94 | #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) |
---|
95 | |
---|
96 | /* Enter a start condition. This macro really ought to take a parameter, |
---|
97 | * but we do it the disgusting crufty way forced on us by the ()-less |
---|
98 | * definition of BEGIN. |
---|
99 | */ |
---|
100 | #define BEGIN yy_start = 1 + 2 * |
---|
101 | |
---|
102 | /* Translate the current start state into a value that can be later handed |
---|
103 | * to BEGIN to return to the state. The YYSTATE alias is for lex |
---|
104 | * compatibility. |
---|
105 | */ |
---|
106 | #define YY_START ((yy_start - 1) / 2) |
---|
107 | #define YYSTATE YY_START |
---|
108 | |
---|
109 | /* Action number for EOF rule of a given start state. */ |
---|
110 | #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) |
---|
111 | |
---|
112 | /* Special action meaning "start processing a new file". */ |
---|
113 | #define YY_NEW_FILE yyrestart( yyin ) |
---|
114 | |
---|
115 | #define YY_END_OF_BUFFER_CHAR 0 |
---|
116 | |
---|
117 | /* Size of default input buffer. */ |
---|
118 | #define YY_BUF_SIZE 16384 |
---|
119 | |
---|
120 | typedef struct yy_buffer_state *YY_BUFFER_STATE; |
---|
121 | |
---|
122 | extern int yyleng; |
---|
123 | extern FILE *yyin, *yyout; |
---|
124 | |
---|
125 | #define EOB_ACT_CONTINUE_SCAN 0 |
---|
126 | #define EOB_ACT_END_OF_FILE 1 |
---|
127 | #define EOB_ACT_LAST_MATCH 2 |
---|
128 | |
---|
129 | /* The funky do-while in the following #define is used to turn the definition |
---|
130 | * int a single C statement (which needs a semi-colon terminator). This |
---|
131 | * avoids problems with code like: |
---|
132 | * |
---|
133 | * if ( condition_holds ) |
---|
134 | * yyless( 5 ); |
---|
135 | * else |
---|
136 | * do_something_else(); |
---|
137 | * |
---|
138 | * Prior to using the do-while the compiler would get upset at the |
---|
139 | * "else" because it interpreted the "if" statement as being all |
---|
140 | * done when it reached the ';' after the yyless() call. |
---|
141 | */ |
---|
142 | |
---|
143 | /* Return all but the first 'n' matched characters back to the input stream. */ |
---|
144 | |
---|
145 | #define yyless(n) \ |
---|
146 | do \ |
---|
147 | { \ |
---|
148 | /* Undo effects of setting up yytext. */ \ |
---|
149 | *yy_cp = yy_hold_char; \ |
---|
150 | YY_RESTORE_YY_MORE_OFFSET \ |
---|
151 | yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \ |
---|
152 | YY_DO_BEFORE_ACTION; /* set up yytext again */ \ |
---|
153 | } \ |
---|
154 | while ( 0 ) |
---|
155 | |
---|
156 | #define unput(c) yyunput( c, yytext_ptr ) |
---|
157 | |
---|
158 | /* The following is because we cannot portably get our hands on size_t |
---|
159 | * (without autoconf's help, which isn't available because we want |
---|
160 | * flex-generated scanners to compile on their own). |
---|
161 | */ |
---|
162 | typedef unsigned int yy_size_t; |
---|
163 | |
---|
164 | |
---|
165 | struct yy_buffer_state |
---|
166 | { |
---|
167 | FILE *yy_input_file; |
---|
168 | |
---|
169 | char *yy_ch_buf; /* input buffer */ |
---|
170 | char *yy_buf_pos; /* current position in input buffer */ |
---|
171 | |
---|
172 | /* Size of input buffer in bytes, not including room for EOB |
---|
173 | * characters. |
---|
174 | */ |
---|
175 | yy_size_t yy_buf_size; |
---|
176 | |
---|
177 | /* Number of characters read into yy_ch_buf, not including EOB |
---|
178 | * characters. |
---|
179 | */ |
---|
180 | int yy_n_chars; |
---|
181 | |
---|
182 | /* Whether we "own" the buffer - i.e., we know we created it, |
---|
183 | * and can realloc() it to grow it, and should free() it to |
---|
184 | * delete it. |
---|
185 | */ |
---|
186 | int yy_is_our_buffer; |
---|
187 | |
---|
188 | /* Whether this is an "interactive" input source; if so, and |
---|
189 | * if we're using stdio for input, then we want to use getc() |
---|
190 | * instead of fread(), to make sure we stop fetching input after |
---|
191 | * each newline. |
---|
192 | */ |
---|
193 | int yy_is_interactive; |
---|
194 | |
---|
195 | /* Whether we're considered to be at the beginning of a line. |
---|
196 | * If so, '^' rules will be active on the next match, otherwise |
---|
197 | * not. |
---|
198 | */ |
---|
199 | int yy_at_bol; |
---|
200 | |
---|
201 | /* Whether to try to fill the input buffer when we reach the |
---|
202 | * end of it. |
---|
203 | */ |
---|
204 | int yy_fill_buffer; |
---|
205 | |
---|
206 | int yy_buffer_status; |
---|
207 | #define YY_BUFFER_NEW 0 |
---|
208 | #define YY_BUFFER_NORMAL 1 |
---|
209 | /* When an EOF's been seen but there's still some text to process |
---|
210 | * then we mark the buffer as YY_EOF_PENDING, to indicate that we |
---|
211 | * shouldn't try reading from the input source any more. We might |
---|
212 | * still have a bunch of tokens to match, though, because of |
---|
213 | * possible backing-up. |
---|
214 | * |
---|
215 | * When we actually see the EOF, we change the status to "new" |
---|
216 | * (via yyrestart()), so that the user can continue scanning by |
---|
217 | * just pointing yyin at a new input file. |
---|
218 | */ |
---|
219 | #define YY_BUFFER_EOF_PENDING 2 |
---|
220 | }; |
---|
221 | |
---|
222 | static YY_BUFFER_STATE yy_current_buffer = 0; |
---|
223 | |
---|
224 | /* We provide macros for accessing buffer states in case in the |
---|
225 | * future we want to put the buffer states in a more general |
---|
226 | * "scanner state". |
---|
227 | */ |
---|
228 | #define YY_CURRENT_BUFFER yy_current_buffer |
---|
229 | |
---|
230 | |
---|
231 | /* yy_hold_char holds the character lost when yytext is formed. */ |
---|
232 | static char yy_hold_char; |
---|
233 | |
---|
234 | static int yy_n_chars; /* number of characters read into yy_ch_buf */ |
---|
235 | |
---|
236 | |
---|
237 | int yyleng; |
---|
238 | |
---|
239 | /* Points to current character in buffer. */ |
---|
240 | static char *yy_c_buf_p = (char *) 0; |
---|
241 | static int yy_init = 1; /* whether we need to initialize */ |
---|
242 | static int yy_start = 0; /* start state number */ |
---|
243 | |
---|
244 | /* Flag which is used to allow yywrap()'s to do buffer switches |
---|
245 | * instead of setting up a fresh yyin. A bit of a hack ... |
---|
246 | */ |
---|
247 | static int yy_did_buffer_switch_on_eof; |
---|
248 | |
---|
249 | void yyrestart YY_PROTO(( FILE *input_file )); |
---|
250 | |
---|
251 | void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer )); |
---|
252 | void yy_load_buffer_state YY_PROTO(( void )); |
---|
253 | YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size )); |
---|
254 | void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b )); |
---|
255 | void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file )); |
---|
256 | void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b )); |
---|
257 | #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer ) |
---|
258 | |
---|
259 | YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size )); |
---|
260 | YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str )); |
---|
261 | YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len )); |
---|
262 | |
---|
263 | static void *yy_flex_alloc YY_PROTO(( yy_size_t )); |
---|
264 | static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t )); |
---|
265 | static void yy_flex_free YY_PROTO(( void * )); |
---|
266 | |
---|
267 | #define yy_new_buffer yy_create_buffer |
---|
268 | |
---|
269 | #define yy_set_interactive(is_interactive) \ |
---|
270 | { \ |
---|
271 | if ( ! yy_current_buffer ) \ |
---|
272 | yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ |
---|
273 | yy_current_buffer->yy_is_interactive = is_interactive; \ |
---|
274 | } |
---|
275 | |
---|
276 | #define yy_set_bol(at_bol) \ |
---|
277 | { \ |
---|
278 | if ( ! yy_current_buffer ) \ |
---|
279 | yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \ |
---|
280 | yy_current_buffer->yy_at_bol = at_bol; \ |
---|
281 | } |
---|
282 | |
---|
283 | #define YY_AT_BOL() (yy_current_buffer->yy_at_bol) |
---|
284 | |
---|
285 | |
---|
286 | #define YY_USES_REJECT |
---|
287 | typedef unsigned char YY_CHAR; |
---|
288 | FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; |
---|
289 | typedef int yy_state_type; |
---|
290 | extern char *yytext; |
---|
291 | #define yytext_ptr yytext |
---|
292 | |
---|
293 | static yy_state_type yy_get_previous_state YY_PROTO(( void )); |
---|
294 | static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state )); |
---|
295 | static int yy_get_next_buffer YY_PROTO(( void )); |
---|
296 | static void yy_fatal_error YY_PROTO(( yyconst char msg[] )); |
---|
297 | |
---|
298 | /* Done after the current pattern has been matched and before the |
---|
299 | * corresponding action - sets up yytext. |
---|
300 | */ |
---|
301 | #define YY_DO_BEFORE_ACTION \ |
---|
302 | yytext_ptr = yy_bp; \ |
---|
303 | yyleng = (int) (yy_cp - yy_bp); \ |
---|
304 | yy_hold_char = *yy_cp; \ |
---|
305 | *yy_cp = '\0'; \ |
---|
306 | yy_c_buf_p = yy_cp; |
---|
307 | |
---|
308 | #define YY_NUM_RULES 72 |
---|
309 | #define YY_END_OF_BUFFER 73 |
---|
310 | static yyconst short int yy_acclist[406] = |
---|
311 | { 0, |
---|
312 | 2, 2, 56, 56, 46, 46, 31, 31, 29, 29, |
---|
313 | 73, 69, 71, 72, 64, 69, 71, 72, 66, 69, |
---|
314 | 72, 71, 72, 71, 72, 63, 71, 72, 63, 71, |
---|
315 | 72, 37, 63, 71, 72, 63, 71, 72, 36, 71, |
---|
316 | 72, 13, 71, 72, 62, 71, 72, 62, 63, 71, |
---|
317 | 72, 62, 71, 72, 62, 71, 72, 62, 71, 72, |
---|
318 | 62, 71, 72, 62, 71, 72, 64, 69, 71, 72, |
---|
319 | 16, 63, 71, 72, 72, 72, 22, 65, 72, 21, |
---|
320 | 72, 23, 72, 72, 34, 72, 72, 20, 72, 68, |
---|
321 | 70, 72, 68, 72, 70, 72, 67, 70, 72, 2, |
---|
322 | |
---|
323 | 72, 1, 72, 41, 72, 41, 42, 72, 56, 72, |
---|
324 | 56, 72, 57, 72, 56, 72, 56, 72, 56, 72, |
---|
325 | 50, 72, 46, 50, 72, 49, 72, 48, 72, 50, |
---|
326 | 72, 47, 50, 72, 72, 72, 59, 72, 72, 72, |
---|
327 | 61, 72, 72, 40, 72, 40, 62, 72, 39, 40, |
---|
328 | 62, 72, 45, 72, 44, 45, 72, 43, 45, 72, |
---|
329 | 72, 27, 72, 31, 72, 31, 72, 32, 72, 31, |
---|
330 | 72, 29, 72, 30, 72, 51, 72, 64, 15, 17, |
---|
331 | 14, 36, 13, 62, 62, 3, 62, 6, 62, 62, |
---|
332 | 62, 62, 62, 5, 62, 4, 62, 62, 64, 16, |
---|
333 | |
---|
334 | 16, 19, 34, 20, 67, 2, 1, 41, 56, 56, |
---|
335 | 56, 56, 17, 56, 56, 54, 56, 50, 46, 50, |
---|
336 | 47, 50, 47, 50, 47, 59, 61, 60, 61, 39, |
---|
337 | 39, 39, 62, 44, 27, 31, 31, 31, 31, 29, |
---|
338 | 51, 53, 51, 51, 14, 12, 12, 62, 3, 12, |
---|
339 | 3, 12, 6, 12, 6, 12, 8, 62, 62, 62, |
---|
340 | 62, 7, 62, 5, 12, 5, 12, 4, 12, 4, |
---|
341 | 12, 16, 56, 39, 62, 31, 31, 31, 52, 3, |
---|
342 | 3, 6, 6, 8, 12, 8, 12, 9, 62, 10, |
---|
343 | 62, 11, 62, 7, 12, 7, 12, 5, 5, 4, |
---|
344 | |
---|
345 | 4, 55, 56, 38, 39, 62, 31, 31, 26, 8, |
---|
346 | 8, 9, 12, 9, 12, 10, 12, 10, 12, 11, |
---|
347 | 12, 11, 12, 7, 7, 55, 56, 56, 55, 56, |
---|
348 | 58, 59, 38, 39, 38, 39, 26, 31, 31, 26, |
---|
349 | 26, 28, 9, 9, 10, 10, 11, 11, 35, 55, |
---|
350 | 56, 55, 56, 55, 56, 55, 56, 26, 31, 31, |
---|
351 | 26, 31, 28, 31, 26, 26, 26, 28, 28, 24, |
---|
352 | 35, 35, 55, 56, 55, 56, 26, 31, 26, 31, |
---|
353 | 26, 31, 28, 31, 31, 28, 31, 33, 26, 28, |
---|
354 | 28, 28, 25, 26, 31, 28, 31, 28, 31, 28, |
---|
355 | |
---|
356 | 31, 28, 18, 28, 31 |
---|
357 | } ; |
---|
358 | |
---|
359 | static yyconst short int yy_accept[330] = |
---|
360 | { 0, |
---|
361 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
---|
362 | 1, 1, 1, 1, 1, 1, 1, 2, 3, 3, |
---|
363 | 3, 4, 5, 6, 7, 7, 7, 7, 7, 7, |
---|
364 | 7, 7, 7, 7, 7, 8, 9, 10, 11, 11, |
---|
365 | 11, 12, 15, 19, 22, 24, 26, 29, 32, 36, |
---|
366 | 39, 42, 45, 48, 52, 55, 58, 61, 64, 67, |
---|
367 | 71, 75, 76, 77, 80, 82, 84, 85, 87, 88, |
---|
368 | 90, 93, 95, 97, 100, 102, 104, 106, 109, 111, |
---|
369 | 113, 115, 117, 119, 121, 123, 126, 128, 130, 132, |
---|
370 | 135, 136, 137, 139, 140, 141, 143, 144, 146, 149, |
---|
371 | |
---|
372 | 153, 155, 158, 161, 162, 164, 166, 168, 170, 172, |
---|
373 | 174, 176, 178, 179, 179, 179, 179, 179, 179, 180, |
---|
374 | 181, 182, 183, 184, 185, 186, 188, 190, 191, 192, |
---|
375 | 193, 194, 196, 198, 199, 200, 201, 202, 202, 203, |
---|
376 | 203, 204, 204, 205, 206, 207, 208, 209, 210, 211, |
---|
377 | 212, 213, 215, 216, 217, 218, 219, 221, 223, 225, |
---|
378 | 226, 226, 227, 227, 227, 227, 227, 228, 228, 230, |
---|
379 | 231, 232, 234, 235, 235, 236, 237, 238, 239, 240, |
---|
380 | 241, 243, 244, 244, 244, 245, 245, 245, 245, 245, |
---|
381 | 245, 245, 246, 247, 249, 251, 253, 255, 257, 259, |
---|
382 | |
---|
383 | 260, 261, 262, 264, 266, 268, 270, 272, 272, 273, |
---|
384 | 274, 274, 276, 277, 278, 279, 279, 280, 280, 280, |
---|
385 | 280, 280, 280, 280, 281, 282, 283, 284, 286, 288, |
---|
386 | 290, 292, 294, 296, 298, 299, 300, 301, 302, 302, |
---|
387 | 304, 304, 307, 308, 309, 309, 310, 310, 310, 310, |
---|
388 | 310, 311, 312, 314, 316, 318, 320, 322, 324, 325, |
---|
389 | 326, 326, 328, 329, 331, 331, 333, 335, 337, 339, |
---|
390 | 340, 340, 341, 341, 342, 343, 343, 343, 343, 344, |
---|
391 | 345, 346, 347, 348, 349, 350, 352, 354, 356, 358, |
---|
392 | 360, 361, 363, 365, 365, 366, 367, 368, 369, 369, |
---|
393 | |
---|
394 | 370, 371, 371, 371, 372, 373, 375, 377, 379, 381, |
---|
395 | 383, 385, 386, 388, 389, 390, 391, 392, 393, 394, |
---|
396 | 394, 396, 398, 400, 402, 403, 404, 406, 406 |
---|
397 | } ; |
---|
398 | |
---|
399 | static yyconst int yy_ec[256] = |
---|
400 | { 0, |
---|
401 | 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, |
---|
402 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
---|
403 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
---|
404 | 1, 2, 4, 4, 5, 4, 6, 4, 4, 7, |
---|
405 | 8, 9, 10, 11, 6, 12, 13, 14, 14, 14, |
---|
406 | 14, 14, 14, 14, 14, 14, 14, 4, 15, 6, |
---|
407 | 4, 6, 4, 4, 16, 16, 16, 17, 16, 18, |
---|
408 | 16, 16, 16, 16, 16, 16, 16, 16, 16, 19, |
---|
409 | 16, 16, 16, 20, 16, 16, 16, 16, 16, 16, |
---|
410 | 6, 21, 6, 4, 22, 4, 23, 16, 24, 25, |
---|
411 | |
---|
412 | 26, 27, 28, 16, 29, 16, 16, 30, 31, 32, |
---|
413 | 33, 16, 16, 34, 35, 36, 37, 38, 39, 39, |
---|
414 | 39, 39, 4, 4, 4, 4, 4, 4, 4, 4, |
---|
415 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, |
---|
416 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, |
---|
417 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, |
---|
418 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, |
---|
419 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, |
---|
420 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, |
---|
421 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, |
---|
422 | |
---|
423 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, |
---|
424 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, |
---|
425 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, |
---|
426 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, |
---|
427 | 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, |
---|
428 | 4, 4, 4, 4, 4 |
---|
429 | } ; |
---|
430 | |
---|
431 | static yyconst int yy_meta[40] = |
---|
432 | { 0, |
---|
433 | 1, 2, 3, 1, 1, 1, 2, 1, 1, 1, |
---|
434 | 4, 1, 1, 5, 1, 5, 5, 5, 5, 5, |
---|
435 | 1, 5, 5, 5, 5, 5, 5, 5, 5, 5, |
---|
436 | 5, 5, 5, 5, 5, 5, 5, 5, 5 |
---|
437 | } ; |
---|
438 | |
---|
439 | static yyconst short int yy_base[369] = |
---|
440 | { 0, |
---|
441 | 0, 38, 764, 763, 761, 760, 759, 758, 757, 756, |
---|
442 | 755, 754, 753, 752, 48, 69, 751, 750, 39, 84, |
---|
443 | 86, 90, 93, 107, 41, 95, 44, 80, 122, 0, |
---|
444 | 112, 160, 749, 748, 163, 167, 747, 746, 740, 739, |
---|
445 | 746, 767, 100, 767, 767, 148, 767, 173, 767, 53, |
---|
446 | 731, 0, 722, 0, 157, 164, 163, 170, 173, 186, |
---|
447 | 187, 740, 767, 767, 767, 767, 739, 767, 738, 767, |
---|
448 | 767, 767, 767, 0, 737, 767, 0, 0, 718, 191, |
---|
449 | 767, 185, 195, 178, 0, 736, 767, 767, 724, 725, |
---|
450 | 732, 198, 767, 199, 200, 767, 201, 767, 0, 211, |
---|
451 | |
---|
452 | 767, 732, 767, 730, 767, 0, 213, 767, 706, 0, |
---|
453 | 767, 217, 221, 705, 704, 175, 201, 232, 767, 767, |
---|
454 | 0, 715, 0, 234, 0, 237, 239, 241, 243, 245, |
---|
455 | 255, 268, 270, 277, 281, 726, 272, 724, 767, 723, |
---|
456 | 767, 722, 767, 0, 721, 767, 0, 702, 285, 283, |
---|
457 | 228, 701, 291, 767, 43, 0, 719, 709, 708, 0, |
---|
458 | 715, 767, 293, 222, 295, 206, 767, 208, 767, 298, |
---|
459 | 767, 300, 715, 713, 767, 0, 303, 689, 232, 0, |
---|
460 | 308, 711, 700, 709, 294, 679, 683, 674, 683, 282, |
---|
461 | 683, 0, 767, 0, 314, 767, 322, 767, 324, 328, |
---|
462 | |
---|
463 | 330, 332, 339, 334, 767, 341, 767, 692, 703, 297, |
---|
464 | 82, 345, 672, 668, 675, 692, 767, 661, 659, 651, |
---|
465 | 644, 640, 630, 355, 767, 357, 767, 360, 767, 366, |
---|
466 | 368, 370, 372, 767, 374, 767, 376, 767, 254, 378, |
---|
467 | 379, 383, 629, 606, 599, 381, 603, 598, 593, 558, |
---|
468 | 395, 767, 398, 767, 400, 767, 402, 767, 404, 767, |
---|
469 | 502, 406, 374, 396, 410, 767, 412, 767, 416, 453, |
---|
470 | 439, 420, 445, 336, 421, 452, 423, 395, 422, 767, |
---|
471 | 435, 767, 437, 767, 439, 430, 431, 434, 454, 446, |
---|
472 | 403, 351, 458, 408, 413, 417, 449, 461, 376, 453, |
---|
473 | |
---|
474 | 353, 343, 314, 475, 767, 466, 480, 457, 471, 475, |
---|
475 | 483, 309, 476, 311, 479, 484, 487, 490, 250, 162, |
---|
476 | 491, 494, 495, 498, 499, 115, 502, 767, 517, 522, |
---|
477 | 527, 532, 537, 542, 547, 552, 557, 562, 567, 572, |
---|
478 | 577, 582, 587, 592, 95, 89, 597, 602, 607, 40, |
---|
479 | 612, 617, 622, 627, 632, 637, 642, 647, 652, 657, |
---|
480 | 662, 667, 672, 677, 682, 687, 692, 697 |
---|
481 | } ; |
---|
482 | |
---|
483 | static yyconst short int yy_def[369] = |
---|
484 | { 0, |
---|
485 | 328, 1, 329, 329, 330, 330, 330, 330, 330, 330, |
---|
486 | 331, 331, 332, 332, 333, 333, 334, 334, 335, 335, |
---|
487 | 336, 336, 337, 337, 338, 338, 339, 339, 328, 29, |
---|
488 | 340, 340, 341, 341, 342, 342, 343, 343, 330, 330, |
---|
489 | 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, |
---|
490 | 328, 344, 345, 346, 345, 345, 345, 345, 345, 328, |
---|
491 | 328, 347, 328, 328, 328, 328, 348, 328, 349, 328, |
---|
492 | 328, 328, 328, 350, 351, 328, 352, 352, 353, 353, |
---|
493 | 328, 353, 353, 353, 354, 354, 328, 328, 354, 355, |
---|
494 | 356, 356, 328, 356, 357, 328, 357, 328, 346, 346, |
---|
495 | |
---|
496 | 328, 328, 328, 358, 328, 359, 359, 328, 359, 360, |
---|
497 | 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, |
---|
498 | 361, 328, 344, 345, 346, 345, 345, 345, 345, 345, |
---|
499 | 345, 345, 345, 345, 328, 328, 328, 347, 328, 348, |
---|
500 | 328, 349, 328, 350, 351, 328, 352, 353, 353, 353, |
---|
501 | 353, 353, 353, 328, 353, 354, 354, 355, 355, 362, |
---|
502 | 356, 328, 356, 356, 356, 357, 328, 357, 328, 328, |
---|
503 | 328, 346, 328, 358, 328, 359, 359, 359, 359, 360, |
---|
504 | 328, 328, 328, 363, 328, 328, 328, 328, 328, 328, |
---|
505 | 328, 361, 328, 346, 328, 328, 328, 328, 345, 345, |
---|
506 | |
---|
507 | 345, 345, 345, 328, 328, 328, 328, 328, 328, 353, |
---|
508 | 356, 346, 359, 359, 359, 363, 328, 328, 328, 328, |
---|
509 | 328, 328, 328, 328, 328, 328, 328, 328, 328, 345, |
---|
510 | 345, 345, 328, 328, 328, 328, 328, 328, 328, 353, |
---|
511 | 356, 346, 359, 359, 328, 328, 328, 328, 328, 328, |
---|
512 | 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, |
---|
513 | 328, 353, 353, 364, 356, 328, 328, 328, 359, 359, |
---|
514 | 328, 328, 328, 365, 328, 328, 328, 328, 328, 328, |
---|
515 | 328, 328, 328, 328, 328, 364, 364, 364, 364, 359, |
---|
516 | 359, 366, 359, 328, 365, 365, 365, 328, 328, 367, |
---|
517 | |
---|
518 | 328, 328, 328, 328, 328, 364, 364, 366, 366, 366, |
---|
519 | 359, 359, 368, 328, 365, 367, 367, 367, 328, 328, |
---|
520 | 366, 368, 368, 368, 367, 328, 368, 0, 328, 328, |
---|
521 | 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, |
---|
522 | 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, |
---|
523 | 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, |
---|
524 | 328, 328, 328, 328, 328, 328, 328, 328 |
---|
525 | } ; |
---|
526 | |
---|
527 | static yyconst short int yy_nxt[807] = |
---|
528 | { 0, |
---|
529 | 42, 43, 44, 45, 46, 47, 47, 47, 47, 48, |
---|
530 | 47, 49, 50, 51, 52, 53, 53, 53, 53, 53, |
---|
531 | 45, 54, 55, 56, 53, 53, 53, 53, 53, 53, |
---|
532 | 53, 53, 57, 58, 53, 53, 53, 59, 53, 60, |
---|
533 | 63, 78, 92, 93, 144, 63, 96, 61, 71, 71, |
---|
534 | 72, 73, 73, 73, 73, 73, 73, 73, 73, 73, |
---|
535 | 73, 120, 73, 149, 97, 121, 94, 210, 73, 71, |
---|
536 | 71, 72, 73, 73, 73, 73, 73, 73, 73, 73, |
---|
537 | 73, 73, 96, 73, 162, 63, 78, 80, 81, 73, |
---|
538 | 63, 80, 81, 125, 86, 87, 92, 93, 82, 124, |
---|
539 | |
---|
540 | 97, 113, 82, 88, 114, 89, 83, 90, 86, 87, |
---|
541 | 83, 84, 241, 102, 63, 84, 326, 88, 103, 89, |
---|
542 | 94, 90, 98, 98, 63, 98, 98, 98, 98, 98, |
---|
543 | 98, 98, 98, 98, 98, 98, 98, 99, 99, 99, |
---|
544 | 99, 99, 98, 99, 99, 99, 99, 99, 99, 99, |
---|
545 | 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, |
---|
546 | 100, 102, 63, 326, 107, 108, 103, 109, 107, 108, |
---|
547 | 126, 109, 115, 116, 118, 119, 117, 127, 125, 128, |
---|
548 | 129, 130, 131, 132, 125, 125, 133, 135, 137, 119, |
---|
549 | 114, 125, 150, 152, 125, 136, 153, 154, 149, 163, |
---|
550 | |
---|
551 | 162, 162, 167, 169, 188, 149, 189, 134, 167, 155, |
---|
552 | 169, 149, 170, 171, 177, 149, 151, 178, 181, 182, |
---|
553 | 168, 168, 113, 164, 162, 114, 168, 190, 168, 183, |
---|
554 | 165, 184, 191, 118, 119, 193, 193, 185, 195, 196, |
---|
555 | 197, 198, 193, 193, 193, 193, 193, 193, 149, 172, |
---|
556 | 126, 319, 127, 165, 199, 194, 193, 193, 194, 155, |
---|
557 | 194, 214, 194, 215, 194, 261, 194, 239, 203, 204, |
---|
558 | 205, 206, 207, 137, 119, 200, 194, 201, 193, 193, |
---|
559 | 202, 132, 135, 133, 150, 114, 153, 154, 208, 194, |
---|
560 | 136, 194, 153, 154, 163, 162, 182, 162, 194, 170, |
---|
561 | |
---|
562 | 171, 170, 171, 149, 177, 149, 221, 178, 151, 181, |
---|
563 | 182, 149, 314, 222, 185, 224, 225, 149, 164, 211, |
---|
564 | 183, 313, 184, 226, 227, 228, 229, 240, 185, 193, |
---|
565 | 193, 193, 193, 193, 193, 235, 236, 199, 212, 320, |
---|
566 | 233, 234, 237, 238, 319, 194, 170, 171, 296, 194, |
---|
567 | 297, 194, 203, 194, 301, 230, 224, 225, 226, 227, |
---|
568 | 194, 251, 252, 309, 231, 310, 232, 253, 254, 255, |
---|
569 | 256, 257, 258, 259, 260, 235, 236, 237, 238, 262, |
---|
570 | 265, 266, 272, 242, 267, 268, 264, 194, 300, 194, |
---|
571 | 263, 194, 264, 273, 149, 274, 251, 252, 149, 279, |
---|
572 | |
---|
573 | 280, 281, 282, 283, 284, 259, 260, 262, 287, 314, |
---|
574 | 288, 265, 266, 267, 268, 292, 289, 290, 263, 303, |
---|
575 | 264, 272, 298, 279, 280, 296, 149, 297, 291, 315, |
---|
576 | 292, 297, 273, 299, 274, 300, 281, 282, 283, 284, |
---|
577 | 304, 305, 287, 306, 288, 288, 287, 290, 288, 302, |
---|
578 | 289, 289, 285, 301, 289, 307, 154, 274, 291, 311, |
---|
579 | 292, 296, 298, 297, 294, 317, 287, 318, 288, 309, |
---|
580 | 312, 310, 313, 299, 289, 300, 304, 305, 306, 293, |
---|
581 | 288, 307, 154, 321, 311, 310, 289, 309, 323, 310, |
---|
582 | 324, 315, 287, 297, 288, 312, 317, 313, 318, 325, |
---|
583 | |
---|
584 | 289, 318, 317, 321, 318, 310, 323, 327, 324, 324, |
---|
585 | 323, 325, 324, 318, 327, 285, 324, 62, 62, 62, |
---|
586 | 62, 62, 63, 63, 63, 63, 63, 67, 67, 67, |
---|
587 | 67, 67, 69, 69, 69, 69, 69, 74, 74, 74, |
---|
588 | 74, 74, 75, 75, 75, 75, 75, 77, 77, 77, |
---|
589 | 77, 77, 79, 79, 79, 79, 79, 85, 85, 85, |
---|
590 | 85, 85, 91, 91, 91, 91, 91, 95, 95, 95, |
---|
591 | 95, 95, 101, 101, 101, 101, 101, 104, 104, 104, |
---|
592 | 104, 104, 106, 106, 106, 106, 106, 110, 110, 110, |
---|
593 | 110, 110, 123, 123, 278, 123, 123, 138, 138, 138, |
---|
594 | |
---|
595 | 138, 138, 140, 140, 140, 140, 140, 142, 142, 142, |
---|
596 | 142, 142, 145, 145, 145, 145, 145, 147, 277, 147, |
---|
597 | 147, 147, 148, 148, 276, 148, 148, 156, 156, 275, |
---|
598 | 271, 156, 159, 159, 270, 159, 159, 161, 161, 161, |
---|
599 | 161, 161, 166, 166, 166, 166, 166, 174, 174, 174, |
---|
600 | 174, 174, 176, 176, 269, 176, 176, 180, 180, 250, |
---|
601 | 180, 180, 192, 192, 249, 192, 192, 160, 160, 248, |
---|
602 | 160, 160, 216, 216, 216, 216, 216, 286, 286, 247, |
---|
603 | 286, 286, 295, 295, 246, 295, 295, 308, 308, 245, |
---|
604 | 308, 308, 316, 316, 217, 316, 316, 322, 322, 244, |
---|
605 | |
---|
606 | 322, 322, 243, 215, 209, 239, 223, 220, 219, 218, |
---|
607 | 189, 217, 184, 182, 213, 175, 173, 162, 160, 160, |
---|
608 | 157, 149, 149, 146, 143, 141, 139, 209, 122, 187, |
---|
609 | 186, 179, 175, 173, 162, 160, 158, 157, 149, 146, |
---|
610 | 143, 141, 139, 125, 122, 328, 112, 112, 111, 111, |
---|
611 | 105, 105, 76, 76, 70, 70, 68, 68, 66, 66, |
---|
612 | 65, 65, 64, 64, 63, 63, 41, 328, 328, 328, |
---|
613 | 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, |
---|
614 | 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, |
---|
615 | 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, |
---|
616 | |
---|
617 | 328, 328, 328, 328, 328, 328 |
---|
618 | } ; |
---|
619 | |
---|
620 | static yyconst short int yy_chk[807] = |
---|
621 | { 0, |
---|
622 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
---|
623 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
---|
624 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
---|
625 | 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, |
---|
626 | 19, 19, 25, 25, 350, 19, 27, 2, 15, 15, |
---|
627 | 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, |
---|
628 | 15, 50, 15, 155, 27, 50, 25, 155, 15, 16, |
---|
629 | 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, |
---|
630 | 16, 16, 28, 16, 211, 20, 20, 21, 21, 16, |
---|
631 | 20, 22, 22, 346, 23, 23, 26, 26, 21, 345, |
---|
632 | |
---|
633 | 28, 43, 22, 23, 43, 23, 21, 23, 24, 24, |
---|
634 | 22, 21, 211, 31, 31, 22, 326, 24, 31, 24, |
---|
635 | 26, 24, 29, 29, 29, 29, 29, 29, 29, 29, |
---|
636 | 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, |
---|
637 | 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, |
---|
638 | 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, |
---|
639 | 29, 32, 32, 320, 35, 35, 32, 35, 36, 36, |
---|
640 | 55, 36, 46, 46, 48, 48, 46, 56, 55, 57, |
---|
641 | 57, 57, 57, 58, 57, 56, 59, 60, 61, 61, |
---|
642 | 60, 58, 80, 82, 59, 60, 83, 83, 84, 92, |
---|
643 | |
---|
644 | 92, 94, 95, 97, 116, 82, 116, 59, 166, 84, |
---|
645 | 168, 80, 100, 100, 107, 83, 80, 107, 112, 112, |
---|
646 | 95, 97, 113, 92, 164, 113, 166, 117, 168, 112, |
---|
647 | 94, 112, 117, 118, 118, 124, 124, 112, 126, 126, |
---|
648 | 127, 127, 128, 128, 129, 129, 130, 130, 151, 100, |
---|
649 | 126, 319, 127, 164, 128, 124, 131, 131, 126, 151, |
---|
650 | 127, 179, 128, 179, 129, 239, 130, 239, 131, 132, |
---|
651 | 132, 133, 133, 137, 137, 129, 131, 130, 134, 134, |
---|
652 | 130, 132, 135, 133, 150, 135, 149, 149, 134, 132, |
---|
653 | 135, 133, 153, 153, 163, 163, 185, 165, 134, 170, |
---|
654 | |
---|
655 | 170, 172, 172, 150, 177, 149, 190, 177, 150, 181, |
---|
656 | 181, 153, 314, 190, 185, 195, 195, 210, 163, 165, |
---|
657 | 181, 312, 181, 197, 197, 199, 199, 210, 181, 200, |
---|
658 | 200, 201, 201, 202, 202, 204, 204, 199, 172, 303, |
---|
659 | 203, 203, 206, 206, 302, 199, 212, 212, 274, 200, |
---|
660 | 274, 201, 203, 202, 301, 200, 224, 224, 226, 226, |
---|
661 | 203, 228, 228, 292, 201, 292, 202, 230, 230, 231, |
---|
662 | 231, 232, 232, 233, 233, 235, 235, 237, 237, 240, |
---|
663 | 241, 241, 246, 212, 242, 242, 263, 230, 299, 231, |
---|
664 | 240, 232, 240, 246, 263, 246, 251, 251, 240, 253, |
---|
665 | |
---|
666 | 253, 255, 255, 257, 257, 259, 259, 262, 264, 294, |
---|
667 | 264, 265, 265, 267, 267, 291, 264, 269, 262, 278, |
---|
668 | 262, 272, 275, 279, 279, 295, 262, 295, 269, 296, |
---|
669 | 269, 296, 272, 275, 272, 275, 281, 281, 283, 283, |
---|
670 | 285, 285, 286, 287, 286, 287, 288, 290, 288, 277, |
---|
671 | 286, 287, 285, 276, 288, 289, 289, 273, 290, 293, |
---|
672 | 290, 297, 298, 297, 271, 300, 289, 300, 289, 308, |
---|
673 | 293, 308, 293, 298, 289, 298, 304, 304, 306, 270, |
---|
674 | 306, 307, 307, 309, 311, 309, 306, 310, 313, 310, |
---|
675 | 313, 315, 307, 315, 307, 311, 316, 311, 316, 317, |
---|
676 | |
---|
677 | 307, 317, 318, 321, 318, 321, 322, 323, 322, 323, |
---|
678 | 324, 325, 324, 325, 327, 261, 327, 329, 329, 329, |
---|
679 | 329, 329, 330, 330, 330, 330, 330, 331, 331, 331, |
---|
680 | 331, 331, 332, 332, 332, 332, 332, 333, 333, 333, |
---|
681 | 333, 333, 334, 334, 334, 334, 334, 335, 335, 335, |
---|
682 | 335, 335, 336, 336, 336, 336, 336, 337, 337, 337, |
---|
683 | 337, 337, 338, 338, 338, 338, 338, 339, 339, 339, |
---|
684 | 339, 339, 340, 340, 340, 340, 340, 341, 341, 341, |
---|
685 | 341, 341, 342, 342, 342, 342, 342, 343, 343, 343, |
---|
686 | 343, 343, 344, 344, 250, 344, 344, 347, 347, 347, |
---|
687 | |
---|
688 | 347, 347, 348, 348, 348, 348, 348, 349, 349, 349, |
---|
689 | 349, 349, 351, 351, 351, 351, 351, 352, 249, 352, |
---|
690 | 352, 352, 353, 353, 248, 353, 353, 354, 354, 247, |
---|
691 | 245, 354, 355, 355, 244, 355, 355, 356, 356, 356, |
---|
692 | 356, 356, 357, 357, 357, 357, 357, 358, 358, 358, |
---|
693 | 358, 358, 359, 359, 243, 359, 359, 360, 360, 223, |
---|
694 | 360, 360, 361, 361, 222, 361, 361, 362, 362, 221, |
---|
695 | 362, 362, 363, 363, 363, 363, 363, 364, 364, 220, |
---|
696 | 364, 364, 365, 365, 219, 365, 365, 366, 366, 218, |
---|
697 | 366, 366, 367, 367, 216, 367, 367, 368, 368, 215, |
---|
698 | |
---|
699 | 368, 368, 214, 213, 209, 208, 191, 189, 188, 187, |
---|
700 | 186, 184, 183, 182, 178, 174, 173, 161, 159, 158, |
---|
701 | 157, 152, 148, 145, 142, 140, 138, 136, 122, 115, |
---|
702 | 114, 109, 104, 102, 91, 90, 89, 86, 79, 75, |
---|
703 | 69, 67, 62, 53, 51, 41, 40, 39, 38, 37, |
---|
704 | 34, 33, 18, 17, 14, 13, 12, 11, 10, 9, |
---|
705 | 8, 7, 6, 5, 4, 3, 328, 328, 328, 328, |
---|
706 | 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, |
---|
707 | 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, |
---|
708 | 328, 328, 328, 328, 328, 328, 328, 328, 328, 328, |
---|
709 | |
---|
710 | 328, 328, 328, 328, 328, 328 |
---|
711 | } ; |
---|
712 | |
---|
713 | static yy_state_type yy_state_buf[YY_BUF_SIZE + 2], *yy_state_ptr; |
---|
714 | static char *yy_full_match; |
---|
715 | static int yy_lp; |
---|
716 | #define REJECT \ |
---|
717 | { \ |
---|
718 | *yy_cp = yy_hold_char; /* undo effects of setting up yytext */ \ |
---|
719 | yy_cp = yy_full_match; /* restore poss. backed-over text */ \ |
---|
720 | ++yy_lp; \ |
---|
721 | goto find_rule; \ |
---|
722 | } |
---|
723 | #define yymore() yymore_used_but_not_detected |
---|
724 | #define YY_MORE_ADJ 0 |
---|
725 | #define YY_RESTORE_YY_MORE_OFFSET |
---|
726 | char *yytext; |
---|
727 | #line 1 "vs1.0_tokens.l" |
---|
728 | #define INITIAL 0 |
---|
729 | #define INCLUDE 1 |
---|
730 | #define DEFINE 2 |
---|
731 | #define DEFSTR 3 |
---|
732 | #define DEFSPACE 4 |
---|
733 | #define SKIPLINE 5 |
---|
734 | #define EATCOMMENT 6 |
---|
735 | #define EATSTRING 7 |
---|
736 | #define SAVELINE 8 |
---|
737 | |
---|
738 | #define MACRONAME 9 |
---|
739 | #define MACROBODY 10 |
---|
740 | #define MACROPARM 11 |
---|
741 | #define EATMACRO 12 |
---|
742 | #define EATDEFINE 13 |
---|
743 | #define MODIFIER 14 |
---|
744 | #define MACROPARMSTART 15 |
---|
745 | |
---|
746 | #define IFDEFNAME 16 |
---|
747 | #define IFDEFBODY 17 |
---|
748 | #define ENDMACRO 18 |
---|
749 | #define MACROPARMEND 19 |
---|
750 | |
---|
751 | #line 8 "vs1.0_tokens.l" |
---|
752 | |
---|
753 | #include <stdarg.h> |
---|
754 | #include <stdlib.h> |
---|
755 | #ifdef _WIN32 |
---|
756 | #include <io.h> |
---|
757 | # ifdef __GNUC__ |
---|
758 | # include <sys/types.h> |
---|
759 | # include <ctype.h> |
---|
760 | # endif |
---|
761 | #else |
---|
762 | #include <sys/types.h> |
---|
763 | #include <ctype.h> |
---|
764 | #define _stat stat |
---|
765 | #define _open open |
---|
766 | #define _O_RDONLY O_RDONLY |
---|
767 | #define _fstat fstat |
---|
768 | #define _close close |
---|
769 | #define stricmp strcasecmp |
---|
770 | |
---|
771 | #endif |
---|
772 | #include <sys/stat.h> |
---|
773 | #include <fcntl.h> |
---|
774 | #include <string.h> |
---|
775 | #include "macro.h" |
---|
776 | #include "nvparse_errors.h" |
---|
777 | #include "vs1.0_inst_list.h" |
---|
778 | #include "_vs1.0_parser.h" |
---|
779 | #define yylineno line_number |
---|
780 | #include "nvparse_externs.h" |
---|
781 | |
---|
782 | #define yylineno line_number |
---|
783 | int line_incr; |
---|
784 | void LexError(char *format, ...); |
---|
785 | void LexWarning(char *format, ...); |
---|
786 | char *ReadTextFile(const char * filename); |
---|
787 | |
---|
788 | unsigned int MakeRegisterMask(char *findName); |
---|
789 | unsigned int FindSwizzleValue(char *swizzleText); |
---|
790 | |
---|
791 | |
---|
792 | enum ERROR_VALUES { |
---|
793 | ERROR_NONE = 0, |
---|
794 | ERROR_MEMORY_ALLOC, |
---|
795 | ERROR_FILE_OPEN, |
---|
796 | ERROR_UNSUCCESSFUL_ASSEMBLE, |
---|
797 | ERROR_TOO_MANY_PARMS, |
---|
798 | ERROR_DEST_WRITE, |
---|
799 | ERROR_LIST_OPEN, |
---|
800 | ERROR_DEST_OPEN, |
---|
801 | ERROR_NO_ARGUMENTS, |
---|
802 | ERROR_MACRO_OVERRUN |
---|
803 | }; |
---|
804 | |
---|
805 | |
---|
806 | |
---|
807 | //extern void GenSwitchFileNames(char *fileName); |
---|
808 | //extern unsigned int gLinesAssembled; |
---|
809 | unsigned int gLinesAssembled; |
---|
810 | |
---|
811 | #define YY_INPUT(buf,result,max_size) \ |
---|
812 | { \ |
---|
813 | int c = *myin++; \ |
---|
814 | result = (c == 0) ? YY_NULL : (buf[0] = c, 1); \ |
---|
815 | } |
---|
816 | |
---|
817 | #define SAFEDELETEARRAY(x) if ((x) != NULL) \ |
---|
818 | delete [] (x) |
---|
819 | #define SAFEFREE(x) if ((x) != NULL) \ |
---|
820 | free((x)) |
---|
821 | |
---|
822 | #define MAXREPLACESTRING 255 |
---|
823 | |
---|
824 | char gReplaceText[MAXREPLACESTRING+1]; |
---|
825 | |
---|
826 | // |
---|
827 | // forward prototypes for macro functions |
---|
828 | // |
---|
829 | void MacroIncFunction(char *, unsigned int *, char **); |
---|
830 | void MacroDecFunction(char *, unsigned int *, char **); |
---|
831 | void MacroAddFunction(char *, unsigned int *, char **); |
---|
832 | void MacroSubFunction(char *, unsigned int *, char **); |
---|
833 | |
---|
834 | MACROFUNCTIONS gMacroFunctions[] = { |
---|
835 | { "inc(", MacroIncFunction }, |
---|
836 | { "dec(", MacroDecFunction }, |
---|
837 | { "add(", MacroAddFunction }, |
---|
838 | { "sub(", MacroSubFunction } |
---|
839 | }; |
---|
840 | |
---|
841 | #define NUM_MACRO_FUNCTIONS (sizeof(gMacroFunctions) / sizeof(MACROFUNCTIONS)) |
---|
842 | |
---|
843 | #define MAX_INCLUDE_DEPTH 1024 |
---|
844 | typedef struct INCLUDEINFO |
---|
845 | { |
---|
846 | char *fileName; |
---|
847 | unsigned int lineNo; |
---|
848 | YY_BUFFER_STATE buffer; |
---|
849 | MACROENTRY *lastInvokeMacro; // save off in case nested macros. |
---|
850 | MACROENTRY *lastParseMacro; // recursive macros |
---|
851 | MACROTEXT *lastMacroLineParse; // save off for recursive lines of macros working on. |
---|
852 | bool lastbInsideMacro; // save off for recursive macros |
---|
853 | bool lastbInsideDefine; // save off for recursive macros/defines |
---|
854 | bool lastbInsideInclude; |
---|
855 | bool lastbProcessingIFDEF; // save off #define information |
---|
856 | // FILE *fileHandle; |
---|
857 | char *prevString; |
---|
858 | char *nextString; |
---|
859 | } INCLUDEINFO; |
---|
860 | |
---|
861 | INCLUDEINFO gIncludeStack[MAX_INCLUDE_DEPTH]; |
---|
862 | int gIncludeStackIndex = 0; |
---|
863 | |
---|
864 | IFDEFINFO gIfDefStack[MAX_IFDEF_DEPTH]; |
---|
865 | int gIfDefStackIndex = 0; |
---|
866 | |
---|
867 | unsigned int &base_linenumber = gIncludeStack[0].lineNo; |
---|
868 | |
---|
869 | bool gbInsideInclude = false; |
---|
870 | bool gbProcessingBuiltIn = false; |
---|
871 | bool gbProcessingDefine = false; |
---|
872 | unsigned int gCountParen = 0; |
---|
873 | |
---|
874 | bool gbProcessingIFDEF = false; |
---|
875 | bool gbIFDEF = false; |
---|
876 | bool gbCompareDefine = false; |
---|
877 | unsigned int gIfDefStartLine; |
---|
878 | |
---|
879 | |
---|
880 | MACROENTRY *gLastMacro; |
---|
881 | MACROENTRY *gInvokeMacro; |
---|
882 | MACROENTRY *gTempMacro; // until all the parameters are read |
---|
883 | MACROENTRY *FindMacro(char *macroName); |
---|
884 | MACROENTRY *FindNMacro(char *macroName, unsigned int sLen); |
---|
885 | |
---|
886 | MACROFUNCTIONPTR gMacroCallFunction; |
---|
887 | |
---|
888 | char *builtInMacros = "macro m3x2 reg1, reg2, reg3\n" |
---|
889 | " dp3 %reg1.x, %reg2, %reg3\n" |
---|
890 | " dp3 %reg1.y, %reg2, %inc(%reg3)\n" |
---|
891 | "endm"; |
---|
892 | |
---|
893 | // |
---|
894 | // local prototypes |
---|
895 | // |
---|
896 | void CleanUp(); |
---|
897 | void ReplaceMacroParms(char *srcLine, char *destLine, |
---|
898 | MACROENTRY *srcParms, MACROENTRY *invParms); |
---|
899 | |
---|
900 | MACROTEXT *SaveMacroText(char *srcText, MACROTEXT *lastMacroText); |
---|
901 | void FreeMacroEntry(MACROENTRY *macEntry); |
---|
902 | void EndMacroParms(); |
---|
903 | char *FindAlphaNum(char *srcStr, unsigned int *sLen); |
---|
904 | void DebugUnhandledState(); |
---|
905 | |
---|
906 | |
---|
907 | unsigned int gCommentStartLine; |
---|
908 | unsigned int gMacroStartLine; |
---|
909 | |
---|
910 | char *gCurFileName = NULL; |
---|
911 | |
---|
912 | #define MAXSAVELINE 4095 |
---|
913 | |
---|
914 | char gSaveLine[MAXSAVELINE+1]; |
---|
915 | char gMacroLine[MAXSAVELINE+1]; |
---|
916 | |
---|
917 | #if 1 |
---|
918 | #ifdef _DEBUG |
---|
919 | #define ECHO DebugUnhandledState(); |
---|
920 | #else |
---|
921 | #define ECHO |
---|
922 | #endif |
---|
923 | #endif |
---|
924 | |
---|
925 | bool gbInsideMacro = false; // flag if we are doing a macro replace or not. |
---|
926 | bool gbTempInsideMacro = false; |
---|
927 | unsigned int gInvokeState = INITIAL; |
---|
928 | |
---|
929 | |
---|
930 | MACROENTRY *gParseMacro; // which source macro entry we are using |
---|
931 | MACROENTRY *gTempParseMacro; // temporary holder until parameters are received. |
---|
932 | MACROTEXT *gMacroLineParse; // which line we are currently parsing inside the macro invocation |
---|
933 | |
---|
934 | typedef enum OPCODETYPE |
---|
935 | { |
---|
936 | TYPE_NONE = 0, |
---|
937 | TYPE_VERTEX_SHADER = 1, |
---|
938 | TYPE_PIXEL_SHADER = 2 |
---|
939 | }; |
---|
940 | typedef struct OPCODEMAP |
---|
941 | { |
---|
942 | char *string; // string for opcode |
---|
943 | int tokenName; // name of the corresponding token |
---|
944 | int numArguments; // number of arguments for opcode |
---|
945 | float version; // minimum version supported in. |
---|
946 | int opcodeTypeFlags; // whether opcode can be used in vertex shader or pixel shader |
---|
947 | bool opcodeModify; // if opcode modifiers can be used |
---|
948 | bool textureOpcode; // only outputs to the texture unit |
---|
949 | } OPCODEMAP; |
---|
950 | |
---|
951 | #ifndef TRUE |
---|
952 | #define TRUE true |
---|
953 | #endif |
---|
954 | #ifndef FALSE |
---|
955 | #define FALSE false |
---|
956 | #endif |
---|
957 | |
---|
958 | OPCODEMAP theOpcodes[] = { |
---|
959 | { "add", ADD_INSTR, 3, 1.0f, TYPE_VERTEX_SHADER | TYPE_PIXEL_SHADER, TRUE, FALSE }, |
---|
960 | { "dp3", DP3_INSTR, 3, 1.0f, TYPE_VERTEX_SHADER | TYPE_PIXEL_SHADER, TRUE, FALSE }, |
---|
961 | { "dp4", DP4_INSTR, 3, 1.0f, TYPE_VERTEX_SHADER, FALSE, FALSE }, |
---|
962 | { "dst", DST_INSTR, 3, 1.0f, TYPE_VERTEX_SHADER, FALSE, FALSE }, |
---|
963 | { "exp", EXP_INSTR, 2, 1.0f, TYPE_VERTEX_SHADER, FALSE, FALSE }, |
---|
964 | { "expp", EXPP_INSTR, 2, 1.0f, TYPE_VERTEX_SHADER, FALSE, FALSE }, |
---|
965 | { "frc", FRC_INSTR, 2, 1.0f, TYPE_VERTEX_SHADER, FALSE, FALSE }, |
---|
966 | { "lit", LIT_INSTR, 2, 1.0f, TYPE_VERTEX_SHADER, FALSE, FALSE }, |
---|
967 | { "log", LOG_INSTR, 2, 1.0f, TYPE_VERTEX_SHADER, FALSE, FALSE }, |
---|
968 | { "logp", LOGP_INSTR, 2, 1.0f, TYPE_VERTEX_SHADER, FALSE, FALSE }, |
---|
969 | { "m3x2", M3X2_INSTR, 3, 1.0f, TYPE_VERTEX_SHADER, FALSE, FALSE }, |
---|
970 | { "m3x3", M3X3_INSTR, 3, 1.0f, TYPE_VERTEX_SHADER, FALSE, FALSE }, |
---|
971 | { "m3x4", M3X4_INSTR, 3, 1.0f, TYPE_VERTEX_SHADER, FALSE, FALSE }, |
---|
972 | { "m4x3", M4X3_INSTR, 3, 1.0f, TYPE_VERTEX_SHADER, FALSE, FALSE }, |
---|
973 | { "m4x4", M4X4_INSTR, 3, 1.0f, TYPE_VERTEX_SHADER, FALSE, FALSE }, |
---|
974 | { "mad", MAD_INSTR, 4, 1.0f, TYPE_VERTEX_SHADER | TYPE_PIXEL_SHADER, TRUE, FALSE }, |
---|
975 | { "max", MAX_INSTR, 3, 1.0f, TYPE_VERTEX_SHADER, FALSE, FALSE }, |
---|
976 | { "min", MIN_INSTR, 3, 1.0f, TYPE_VERTEX_SHADER, FALSE, FALSE }, |
---|
977 | { "mov", MOV_INSTR, 2, 1.0f, TYPE_VERTEX_SHADER | TYPE_PIXEL_SHADER, TRUE, FALSE }, |
---|
978 | { "mul", MUL_INSTR, 3, 1.0f, TYPE_VERTEX_SHADER | TYPE_PIXEL_SHADER, TRUE, FALSE }, |
---|
979 | { "nop", NOP_INSTR, 0, 1.0f, TYPE_VERTEX_SHADER | TYPE_PIXEL_SHADER, TRUE, FALSE }, |
---|
980 | { "rcp", RCP_INSTR, 2, 1.0f, TYPE_VERTEX_SHADER, FALSE, FALSE }, |
---|
981 | { "rsq", RSQ_INSTR, 2, 1.0f, TYPE_VERTEX_SHADER, FALSE, FALSE }, |
---|
982 | { "sge", SGE_INSTR, 3, 1.0f, TYPE_VERTEX_SHADER, FALSE, FALSE }, |
---|
983 | { "slt", SLT_INSTR, 3, 1.0f, TYPE_VERTEX_SHADER, FALSE, FALSE }, |
---|
984 | { "sub", SUB_INSTR, 3, 1.0f, TYPE_VERTEX_SHADER | TYPE_PIXEL_SHADER, TRUE, FALSE }, |
---|
985 | }; |
---|
986 | |
---|
987 | #define NUMOPCODES (sizeof(theOpcodes) / sizeof(OPCODEMAP)) |
---|
988 | OPCODEMAP *FindOpcode(char *findName); |
---|
989 | |
---|
990 | |
---|
991 | #line 990 "_vs1.0_lexer.cpp" |
---|
992 | |
---|
993 | /* Macros after this point can all be overridden by user definitions in |
---|
994 | * section 1. |
---|
995 | */ |
---|
996 | |
---|
997 | #ifndef YY_SKIP_YYWRAP |
---|
998 | #ifdef __cplusplus |
---|
999 | extern "C" int yywrap YY_PROTO(( void )); |
---|
1000 | #else |
---|
1001 | extern int yywrap YY_PROTO(( void )); |
---|
1002 | #endif |
---|
1003 | #endif |
---|
1004 | |
---|
1005 | #ifndef YY_NO_UNPUT |
---|
1006 | static void yyunput YY_PROTO(( int c, char *buf_ptr )); |
---|
1007 | #endif |
---|
1008 | |
---|
1009 | #ifndef yytext_ptr |
---|
1010 | static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int )); |
---|
1011 | #endif |
---|
1012 | |
---|
1013 | #ifdef YY_NEED_STRLEN |
---|
1014 | static int yy_flex_strlen YY_PROTO(( yyconst char * )); |
---|
1015 | #endif |
---|
1016 | |
---|
1017 | #ifndef YY_NO_INPUT |
---|
1018 | #ifdef __cplusplus |
---|
1019 | static int yyinput YY_PROTO(( void )); |
---|
1020 | #else |
---|
1021 | static int input YY_PROTO(( void )); |
---|
1022 | #endif |
---|
1023 | #endif |
---|
1024 | |
---|
1025 | #if YY_STACK_USED |
---|
1026 | static int yy_start_stack_ptr = 0; |
---|
1027 | static int yy_start_stack_depth = 0; |
---|
1028 | static int *yy_start_stack = 0; |
---|
1029 | #ifndef YY_NO_PUSH_STATE |
---|
1030 | static void yy_push_state YY_PROTO(( int new_state )); |
---|
1031 | #endif |
---|
1032 | #ifndef YY_NO_POP_STATE |
---|
1033 | static void yy_pop_state YY_PROTO(( void )); |
---|
1034 | #endif |
---|
1035 | #ifndef YY_NO_TOP_STATE |
---|
1036 | static int yy_top_state YY_PROTO(( void )); |
---|
1037 | #endif |
---|
1038 | |
---|
1039 | #else |
---|
1040 | #define YY_NO_PUSH_STATE 1 |
---|
1041 | #define YY_NO_POP_STATE 1 |
---|
1042 | #define YY_NO_TOP_STATE 1 |
---|
1043 | #endif |
---|
1044 | |
---|
1045 | #ifdef YY_MALLOC_DECL |
---|
1046 | YY_MALLOC_DECL |
---|
1047 | #else |
---|
1048 | #if __STDC__ |
---|
1049 | #ifndef __cplusplus |
---|
1050 | #include <stdlib.h> |
---|
1051 | #endif |
---|
1052 | #else |
---|
1053 | /* Just try to get by without declaring the routines. This will fail |
---|
1054 | * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int) |
---|
1055 | * or sizeof(void*) != sizeof(int). |
---|
1056 | */ |
---|
1057 | #endif |
---|
1058 | #endif |
---|
1059 | |
---|
1060 | /* Amount of stuff to slurp up with each read. */ |
---|
1061 | #ifndef YY_READ_BUF_SIZE |
---|
1062 | #define YY_READ_BUF_SIZE 8192 |
---|
1063 | #endif |
---|
1064 | |
---|
1065 | /* Copy whatever the last rule matched to the standard output. */ |
---|
1066 | |
---|
1067 | #ifndef ECHO |
---|
1068 | /* This used to be an fputs(), but since the string might contain NUL's, |
---|
1069 | * we now use fwrite(). |
---|
1070 | */ |
---|
1071 | #define ECHO (void) fwrite( yytext, yyleng, 1, yyout ) |
---|
1072 | #endif |
---|
1073 | |
---|
1074 | /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, |
---|
1075 | * is returned in "result". |
---|
1076 | */ |
---|
1077 | #ifndef YY_INPUT |
---|
1078 | #define YY_INPUT(buf,result,max_size) \ |
---|
1079 | if ( yy_current_buffer->yy_is_interactive ) \ |
---|
1080 | { \ |
---|
1081 | int c = '*', n; \ |
---|
1082 | for ( n = 0; n < max_size && \ |
---|
1083 | (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ |
---|
1084 | buf[n] = (char) c; \ |
---|
1085 | if ( c == '\n' ) \ |
---|
1086 | buf[n++] = (char) c; \ |
---|
1087 | if ( c == EOF && ferror( yyin ) ) \ |
---|
1088 | YY_FATAL_ERROR( "input in flex scanner failed" ); \ |
---|
1089 | result = n; \ |
---|
1090 | } \ |
---|
1091 | else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \ |
---|
1092 | && ferror( yyin ) ) \ |
---|
1093 | YY_FATAL_ERROR( "input in flex scanner failed" ); |
---|
1094 | #endif |
---|
1095 | |
---|
1096 | /* No semi-colon after return; correct usage is to write "yyterminate();" - |
---|
1097 | * we don't want an extra ';' after the "return" because that will cause |
---|
1098 | * some compilers to complain about unreachable statements. |
---|
1099 | */ |
---|
1100 | #ifndef yyterminate |
---|
1101 | #define yyterminate() return YY_NULL |
---|
1102 | #endif |
---|
1103 | |
---|
1104 | /* Number of entries by which start-condition stack grows. */ |
---|
1105 | #ifndef YY_START_STACK_INCR |
---|
1106 | #define YY_START_STACK_INCR 25 |
---|
1107 | #endif |
---|
1108 | |
---|
1109 | /* Report a fatal error. */ |
---|
1110 | #ifndef YY_FATAL_ERROR |
---|
1111 | #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) |
---|
1112 | #endif |
---|
1113 | |
---|
1114 | /* Default declaration of generated scanner - a define so the user can |
---|
1115 | * easily add parameters. |
---|
1116 | */ |
---|
1117 | #ifndef YY_DECL |
---|
1118 | #define YY_DECL int yylex YY_PROTO(( void )) |
---|
1119 | #endif |
---|
1120 | |
---|
1121 | /* Code executed at the beginning of each rule, after yytext and yyleng |
---|
1122 | * have been set up. |
---|
1123 | */ |
---|
1124 | #ifndef YY_USER_ACTION |
---|
1125 | #define YY_USER_ACTION |
---|
1126 | #endif |
---|
1127 | |
---|
1128 | /* Code executed at the end of each rule. */ |
---|
1129 | #ifndef YY_BREAK |
---|
1130 | #define YY_BREAK break; |
---|
1131 | #endif |
---|
1132 | |
---|
1133 | #define YY_RULE_SETUP \ |
---|
1134 | if ( yyleng > 0 ) \ |
---|
1135 | yy_current_buffer->yy_at_bol = \ |
---|
1136 | (yytext[yyleng - 1] == '\n'); \ |
---|
1137 | YY_USER_ACTION |
---|
1138 | |
---|
1139 | YY_DECL |
---|
1140 | { |
---|
1141 | register yy_state_type yy_current_state; |
---|
1142 | register char *yy_cp = NULL, *yy_bp = NULL; |
---|
1143 | register int yy_act; |
---|
1144 | |
---|
1145 | #line 261 "vs1.0_tokens.l" |
---|
1146 | |
---|
1147 | |
---|
1148 | #line 1147 "_vs1.0_lexer.cpp" |
---|
1149 | |
---|
1150 | if ( yy_init ) |
---|
1151 | { |
---|
1152 | yy_init = 0; |
---|
1153 | |
---|
1154 | #ifdef YY_USER_INIT |
---|
1155 | YY_USER_INIT; |
---|
1156 | #endif |
---|
1157 | |
---|
1158 | if ( ! yy_start ) |
---|
1159 | yy_start = 1; /* first start state */ |
---|
1160 | |
---|
1161 | if ( ! yyin ) |
---|
1162 | yyin = stdin; |
---|
1163 | |
---|
1164 | if ( ! yyout ) |
---|
1165 | yyout = stdout; |
---|
1166 | |
---|
1167 | if ( ! yy_current_buffer ) |
---|
1168 | yy_current_buffer = |
---|
1169 | yy_create_buffer( yyin, YY_BUF_SIZE ); |
---|
1170 | |
---|
1171 | yy_load_buffer_state(); |
---|
1172 | } |
---|
1173 | |
---|
1174 | while ( 1 ) /* loops until end-of-file is reached */ |
---|
1175 | { |
---|
1176 | yy_cp = yy_c_buf_p; |
---|
1177 | |
---|
1178 | /* Support of yytext. */ |
---|
1179 | *yy_cp = yy_hold_char; |
---|
1180 | |
---|
1181 | /* yy_bp points to the position in yy_ch_buf of the start of |
---|
1182 | * the current run. |
---|
1183 | */ |
---|
1184 | yy_bp = yy_cp; |
---|
1185 | |
---|
1186 | yy_current_state = yy_start; |
---|
1187 | yy_current_state += YY_AT_BOL(); |
---|
1188 | yy_state_ptr = yy_state_buf; |
---|
1189 | *yy_state_ptr++ = yy_current_state; |
---|
1190 | yy_match: |
---|
1191 | do |
---|
1192 | { |
---|
1193 | register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; |
---|
1194 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
---|
1195 | { |
---|
1196 | yy_current_state = (int) yy_def[yy_current_state]; |
---|
1197 | if ( yy_current_state >= 329 ) |
---|
1198 | yy_c = yy_meta[(unsigned int) yy_c]; |
---|
1199 | } |
---|
1200 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; |
---|
1201 | *yy_state_ptr++ = yy_current_state; |
---|
1202 | ++yy_cp; |
---|
1203 | } |
---|
1204 | while ( yy_base[yy_current_state] != 767 ); |
---|
1205 | |
---|
1206 | yy_find_action: |
---|
1207 | yy_current_state = *--yy_state_ptr; |
---|
1208 | yy_lp = yy_accept[yy_current_state]; |
---|
1209 | find_rule: /* we branch to this label when backing up */ |
---|
1210 | for ( ; ; ) /* until we find what rule we matched */ |
---|
1211 | { |
---|
1212 | if ( yy_lp && yy_lp < yy_accept[yy_current_state + 1] ) |
---|
1213 | { |
---|
1214 | yy_act = yy_acclist[yy_lp]; |
---|
1215 | { |
---|
1216 | yy_full_match = yy_cp; |
---|
1217 | break; |
---|
1218 | } |
---|
1219 | } |
---|
1220 | --yy_cp; |
---|
1221 | yy_current_state = *--yy_state_ptr; |
---|
1222 | yy_lp = yy_accept[yy_current_state]; |
---|
1223 | } |
---|
1224 | |
---|
1225 | YY_DO_BEFORE_ACTION; |
---|
1226 | |
---|
1227 | |
---|
1228 | do_action: /* This label is used only to access EOF actions. */ |
---|
1229 | |
---|
1230 | |
---|
1231 | switch ( yy_act ) |
---|
1232 | { /* beginning of action switch */ |
---|
1233 | case 1: |
---|
1234 | YY_RULE_SETUP |
---|
1235 | #line 263 "vs1.0_tokens.l" |
---|
1236 | { |
---|
1237 | gbProcessingDefine = false; |
---|
1238 | gSaveLine[0] = '\0'; |
---|
1239 | strncat(gSaveLine, yytext, MAXSAVELINE); |
---|
1240 | // GenDebugLine(); |
---|
1241 | if (gbProcessingIFDEF && (gbCompareDefine != gbIFDEF)) |
---|
1242 | { |
---|
1243 | BEGIN(IFDEFBODY); |
---|
1244 | } |
---|
1245 | else |
---|
1246 | { |
---|
1247 | BEGIN(INITIAL); |
---|
1248 | } |
---|
1249 | yyless(0); |
---|
1250 | } |
---|
1251 | YY_BREAK |
---|
1252 | case 2: |
---|
1253 | YY_RULE_SETUP |
---|
1254 | #line 279 "vs1.0_tokens.l" |
---|
1255 | { |
---|
1256 | gbProcessingDefine = false; |
---|
1257 | gSaveLine[0] = '\0'; |
---|
1258 | strncat(gSaveLine, yytext, MAXSAVELINE); |
---|
1259 | // GenDebugLine(); |
---|
1260 | if (gbProcessingIFDEF && (gbCompareDefine != gbIFDEF)) |
---|
1261 | { |
---|
1262 | BEGIN(IFDEFBODY); |
---|
1263 | } |
---|
1264 | else |
---|
1265 | { |
---|
1266 | BEGIN(INITIAL); |
---|
1267 | } |
---|
1268 | yyless(0); |
---|
1269 | } |
---|
1270 | YY_BREAK |
---|
1271 | case 3: |
---|
1272 | YY_RULE_SETUP |
---|
1273 | #line 295 "vs1.0_tokens.l" |
---|
1274 | { |
---|
1275 | // fprintf( stderr, "%s", yytext ); |
---|
1276 | vs10_lval.reg.type = TYPE_ADDRESS_REG; |
---|
1277 | vs10_lval.reg.index = atoi(&yytext[1]); |
---|
1278 | if ( yytext[yyleng-1] == '\n' ) |
---|
1279 | line_incr = 1; |
---|
1280 | return REGISTER; |
---|
1281 | } |
---|
1282 | YY_BREAK |
---|
1283 | case 4: |
---|
1284 | YY_RULE_SETUP |
---|
1285 | #line 304 "vs1.0_tokens.l" |
---|
1286 | { |
---|
1287 | // fprintf( stderr, "%s", yytext ); |
---|
1288 | vs10_lval.reg.type = TYPE_VERTEX_ATTRIB_REG; |
---|
1289 | vs10_lval.reg.index = atoi(&yytext[1]); |
---|
1290 | if ( yytext[yyleng-1] == '\n' ) |
---|
1291 | line_incr = 1; |
---|
1292 | return REGISTER; |
---|
1293 | } |
---|
1294 | YY_BREAK |
---|
1295 | case 5: |
---|
1296 | YY_RULE_SETUP |
---|
1297 | #line 313 "vs1.0_tokens.l" |
---|
1298 | { |
---|
1299 | // fprintf( stderr, "%s", yytext ); |
---|
1300 | vs10_lval.reg.type = TYPE_TEMPORARY_REG; |
---|
1301 | vs10_lval.reg.index = atoi(&yytext[1]); |
---|
1302 | if ( yytext[yyleng-1] == '\n' ) |
---|
1303 | line_incr = 1; |
---|
1304 | return REGISTER; |
---|
1305 | } |
---|
1306 | YY_BREAK |
---|
1307 | case 6: |
---|
1308 | YY_RULE_SETUP |
---|
1309 | #line 322 "vs1.0_tokens.l" |
---|
1310 | { |
---|
1311 | // fprintf( stderr, "%s", yytext ); |
---|
1312 | vs10_lval.reg.type = TYPE_CONSTANT_MEM_REG; |
---|
1313 | vs10_lval.reg.index = atoi(&yytext[1]); |
---|
1314 | if ( yytext[yyleng-1] == '\n' ) |
---|
1315 | line_incr = 1; |
---|
1316 | return REGISTER; |
---|
1317 | } |
---|
1318 | YY_BREAK |
---|
1319 | case 7: |
---|
1320 | YY_RULE_SETUP |
---|
1321 | #line 331 "vs1.0_tokens.l" |
---|
1322 | { |
---|
1323 | // fprintf( stderr, "%s", yytext ); |
---|
1324 | vs10_lval.reg.type = TYPE_TEXTURE_RESULT_REG; |
---|
1325 | vs10_lval.reg.index = atoi(&yytext[2]); |
---|
1326 | if ( yytext[yyleng-1] == '\n' ) |
---|
1327 | line_incr = 1; |
---|
1328 | return REGISTER; |
---|
1329 | } |
---|
1330 | YY_BREAK |
---|
1331 | case 8: |
---|
1332 | YY_RULE_SETUP |
---|
1333 | #line 340 "vs1.0_tokens.l" |
---|
1334 | { |
---|
1335 | // fprintf( stderr, "%s", yytext ); |
---|
1336 | vs10_lval.reg.type = TYPE_COLOR_RESULT_REG; |
---|
1337 | vs10_lval.reg.index = atoi(&yytext[2]); |
---|
1338 | if ( yytext[yyleng-1] == '\n' ) |
---|
1339 | line_incr = 1; |
---|
1340 | return REGISTER; |
---|
1341 | } |
---|
1342 | YY_BREAK |
---|
1343 | case 9: |
---|
1344 | YY_RULE_SETUP |
---|
1345 | #line 349 "vs1.0_tokens.l" |
---|
1346 | { |
---|
1347 | // fprintf( stderr, "%s", yytext ); |
---|
1348 | vs10_lval.reg.type = TYPE_FOG_RESULT_REG; |
---|
1349 | if ( yytext[yyleng-1] == '\n' ) |
---|
1350 | line_incr = 1; |
---|
1351 | return REGISTER; |
---|
1352 | } |
---|
1353 | YY_BREAK |
---|
1354 | case 10: |
---|
1355 | YY_RULE_SETUP |
---|
1356 | #line 357 "vs1.0_tokens.l" |
---|
1357 | { |
---|
1358 | // fprintf( stderr, "%s", yytext ); |
---|
1359 | vs10_lval.reg.type = TYPE_POSITION_RESULT_REG; |
---|
1360 | if ( yytext[yyleng-1] == '\n' ) |
---|
1361 | line_incr = 1; |
---|
1362 | return REGISTER; |
---|
1363 | } |
---|
1364 | YY_BREAK |
---|
1365 | case 11: |
---|
1366 | YY_RULE_SETUP |
---|
1367 | #line 365 "vs1.0_tokens.l" |
---|
1368 | { |
---|
1369 | // fprintf( stderr, "%s", yytext ); |
---|
1370 | vs10_lval.reg.type = TYPE_POINTS_RESULT_REG; |
---|
1371 | if ( yytext[yyleng-1] == '\n' ) |
---|
1372 | line_incr = 1; |
---|
1373 | return REGISTER; |
---|
1374 | } |
---|
1375 | YY_BREAK |
---|
1376 | case 12: |
---|
1377 | YY_RULE_SETUP |
---|
1378 | #line 373 "vs1.0_tokens.l" |
---|
1379 | { |
---|
1380 | |
---|
1381 | unsigned int offset; |
---|
1382 | |
---|
1383 | offset = strcspn(yytext, " \t\n_"); |
---|
1384 | yyless(offset); |
---|
1385 | |
---|
1386 | OPCODEMAP *opcodeMap = FindOpcode(yytext); |
---|
1387 | if ( opcodeMap != NULL ) |
---|
1388 | { |
---|
1389 | // fprintf( stderr, "%s\t", opcodeMap->string ); |
---|
1390 | return( opcodeMap->tokenName ); |
---|
1391 | } |
---|
1392 | else |
---|
1393 | { |
---|
1394 | gTempParseMacro = FindMacro(yytext); |
---|
1395 | |
---|
1396 | if (gTempParseMacro != NULL) |
---|
1397 | { |
---|
1398 | if (gIncludeStackIndex >= MAX_INCLUDE_DEPTH ) |
---|
1399 | { |
---|
1400 | LexError("macros nested too deeply"); |
---|
1401 | exit( 1 ); |
---|
1402 | } |
---|
1403 | |
---|
1404 | if (gTempParseMacro->firstMacroLines != NULL) |
---|
1405 | { |
---|
1406 | |
---|
1407 | gTempMacro = (MACROENTRY *)malloc(sizeof(MACROENTRY)); |
---|
1408 | if (gTempMacro == NULL) |
---|
1409 | { |
---|
1410 | LexError("Out of memory allocating MACROENTRY structure.\n"); |
---|
1411 | } |
---|
1412 | else |
---|
1413 | { |
---|
1414 | |
---|
1415 | gTempMacro->next = NULL; |
---|
1416 | gTempMacro->prev = NULL; |
---|
1417 | gTempMacro->macroName = NULL; |
---|
1418 | gTempMacro->firstMacroParms = NULL; |
---|
1419 | gTempMacro->lastMacroParms = NULL; |
---|
1420 | gTempMacro->firstMacroLines = NULL; |
---|
1421 | gTempMacro->lastMacroLines = NULL; |
---|
1422 | gTempMacro->numParms = 0; |
---|
1423 | gTempMacro->nLines = 0; |
---|
1424 | |
---|
1425 | gbTempInsideMacro = true; // flag we are currently doing a macro replace. |
---|
1426 | gInvokeState = YYSTATE; |
---|
1427 | if (gTempParseMacro->numParms > 0) |
---|
1428 | { |
---|
1429 | BEGIN(MACROPARMSTART); |
---|
1430 | } |
---|
1431 | else |
---|
1432 | { |
---|
1433 | EndMacroParms(); |
---|
1434 | gbTempInsideMacro = false; // no longer waiting for macro invocation |
---|
1435 | } |
---|
1436 | |
---|
1437 | |
---|
1438 | } |
---|
1439 | } |
---|
1440 | } |
---|
1441 | else |
---|
1442 | { |
---|
1443 | // fprintf( stderr, "Opcode: \"%s\" not found\n", yytext ); |
---|
1444 | REJECT; |
---|
1445 | } |
---|
1446 | } |
---|
1447 | |
---|
1448 | //unsigned int offset; |
---|
1449 | // |
---|
1450 | //INSTRMAP *opcodeMap; |
---|
1451 | // |
---|
1452 | //offset = strcspn(yytext, " \t\n_"); |
---|
1453 | //yyless(offset); |
---|
1454 | //opcodeMap = FindInstruction(yytext); |
---|
1455 | //if (opcodeMap == NULL) |
---|
1456 | //{ |
---|
1457 | // REJECT; |
---|
1458 | //} |
---|
1459 | // |
---|
1460 | //yylval.opcodeInfo.opcodeMap = opcodeMap; |
---|
1461 | // |
---|
1462 | //return OPCODE; |
---|
1463 | } |
---|
1464 | YY_BREAK |
---|
1465 | case 13: |
---|
1466 | YY_RULE_SETUP |
---|
1467 | #line 460 "vs1.0_tokens.l" |
---|
1468 | { |
---|
1469 | // fprintf( stderr, "%s", yytext ); |
---|
1470 | char *cmt = new char[yyleng+1]; |
---|
1471 | strncpy( cmt, yytext, yyleng ); |
---|
1472 | cmt[0] = '#'; |
---|
1473 | cmt[yyleng] = '\0'; |
---|
1474 | vs10_lval.comment = cmt; |
---|
1475 | return COMMENT; |
---|
1476 | } |
---|
1477 | YY_BREAK |
---|
1478 | case 14: |
---|
1479 | YY_RULE_SETUP |
---|
1480 | #line 470 "vs1.0_tokens.l" |
---|
1481 | { |
---|
1482 | // fprintf( stderr, "%s", yytext ); |
---|
1483 | char *cmt = new char[yyleng+1]; |
---|
1484 | strncpy( cmt+1, yytext+1, yyleng-1 ); |
---|
1485 | cmt[0] = '#'; |
---|
1486 | cmt[1] = ' '; |
---|
1487 | cmt[yyleng] = '\0'; |
---|
1488 | vs10_lval.comment = cmt; |
---|
1489 | return COMMENT; |
---|
1490 | } |
---|
1491 | YY_BREAK |
---|
1492 | case 15: |
---|
1493 | YY_RULE_SETUP |
---|
1494 | #line 481 "vs1.0_tokens.l" |
---|
1495 | { |
---|
1496 | fprintf( stderr, "COISSUE found\n" ); |
---|
1497 | yyless(yyleng-1); |
---|
1498 | //return COISSUE; |
---|
1499 | } |
---|
1500 | YY_BREAK |
---|
1501 | case 16: |
---|
1502 | YY_RULE_SETUP |
---|
1503 | #line 487 "vs1.0_tokens.l" |
---|
1504 | { |
---|
1505 | fprintf( stderr, "COISSUE found\n" ); |
---|
1506 | //return COISSUE; |
---|
1507 | } |
---|
1508 | YY_BREAK |
---|
1509 | case 17: |
---|
1510 | YY_RULE_SETUP |
---|
1511 | #line 492 "vs1.0_tokens.l" |
---|
1512 | { |
---|
1513 | gCommentStartLine = yylineno; |
---|
1514 | yyless(0); |
---|
1515 | BEGIN(EATCOMMENT); |
---|
1516 | } |
---|
1517 | YY_BREAK |
---|
1518 | case 18: |
---|
1519 | YY_RULE_SETUP |
---|
1520 | #line 498 "vs1.0_tokens.l" |
---|
1521 | { |
---|
1522 | BEGIN(INCLUDE); |
---|
1523 | } |
---|
1524 | YY_BREAK |
---|
1525 | case 19: |
---|
1526 | YY_RULE_SETUP |
---|
1527 | #line 502 "vs1.0_tokens.l" |
---|
1528 | { /* got the include file name */ |
---|
1529 | |
---|
1530 | // FILE *newyyin; |
---|
1531 | char *newyyin; |
---|
1532 | char incFileName[1024]; |
---|
1533 | unsigned long sLen; |
---|
1534 | bool validFileName; |
---|
1535 | |
---|
1536 | if ( gIncludeStackIndex >= MAX_INCLUDE_DEPTH ) |
---|
1537 | { |
---|
1538 | LexError("Includes nested too deeply, aborting\n"); |
---|
1539 | exit( 1 ); |
---|
1540 | } |
---|
1541 | |
---|
1542 | // GenDebugLine(); |
---|
1543 | // GenListString(); |
---|
1544 | yylineno++; |
---|
1545 | gLinesAssembled++; |
---|
1546 | |
---|
1547 | validFileName = true; |
---|
1548 | // zap "" and <> |
---|
1549 | if ((yytext[0] == '"') || (yytext[0] == '<')) |
---|
1550 | { |
---|
1551 | char *endQuote; |
---|
1552 | endQuote = strchr(&yytext[1], yytext[0]); |
---|
1553 | sLen = (endQuote - yytext)-1; |
---|
1554 | if (endQuote == NULL) |
---|
1555 | { |
---|
1556 | LexError("Unable to open include file %s\n", incFileName); |
---|
1557 | BEGIN(INITIAL); |
---|
1558 | validFileName = false; |
---|
1559 | } |
---|
1560 | else |
---|
1561 | { |
---|
1562 | incFileName[0] ='\0'; |
---|
1563 | strncat(incFileName, &yytext[1], sLen); |
---|
1564 | } |
---|
1565 | } |
---|
1566 | else |
---|
1567 | { |
---|
1568 | strcpy(incFileName, yytext); |
---|
1569 | } |
---|
1570 | |
---|
1571 | if (validFileName) |
---|
1572 | { |
---|
1573 | sLen = strlen(incFileName); |
---|
1574 | if ((incFileName[sLen-1] == '"') || (incFileName[sLen-1] == '>')) |
---|
1575 | { |
---|
1576 | incFileName[sLen-1] = '\0'; |
---|
1577 | } |
---|
1578 | |
---|
1579 | |
---|
1580 | newyyin = ReadTextFile( incFileName ); |
---|
1581 | // newyyin = fopen( incFileName, "r" ); |
---|
1582 | |
---|
1583 | if ( ! newyyin ) |
---|
1584 | { |
---|
1585 | LexError("Unable to open include file %s\n", incFileName); |
---|
1586 | BEGIN(SAVELINE); |
---|
1587 | } |
---|
1588 | else |
---|
1589 | { |
---|
1590 | gIncludeStack[gIncludeStackIndex].fileName = gCurFileName; |
---|
1591 | gIncludeStack[gIncludeStackIndex].lineNo = yylineno; |
---|
1592 | // gIncludeStack[gIncludeStackIndex].fileHandle = yyin; |
---|
1593 | gIncludeStack[gIncludeStackIndex].prevString = myin; |
---|
1594 | gIncludeStack[gIncludeStackIndex].nextString = newyyin; |
---|
1595 | gIncludeStack[gIncludeStackIndex].lastInvokeMacro = gInvokeMacro; |
---|
1596 | gIncludeStack[gIncludeStackIndex].lastParseMacro = gParseMacro; |
---|
1597 | gIncludeStack[gIncludeStackIndex].lastMacroLineParse = gMacroLineParse; |
---|
1598 | gIncludeStack[gIncludeStackIndex].lastbInsideMacro = gbInsideMacro; |
---|
1599 | gIncludeStack[gIncludeStackIndex].lastbInsideInclude = gbInsideInclude; |
---|
1600 | gIncludeStack[gIncludeStackIndex].buffer = YY_CURRENT_BUFFER; |
---|
1601 | gIncludeStack[gIncludeStackIndex].lastbProcessingIFDEF = gbProcessingIFDEF; |
---|
1602 | gIncludeStackIndex++; |
---|
1603 | |
---|
1604 | gbProcessingIFDEF = false; |
---|
1605 | |
---|
1606 | gCurFileName = strdup(incFileName); |
---|
1607 | // yyin = newyyin; |
---|
1608 | myin = newyyin; |
---|
1609 | |
---|
1610 | // GenSwitchFileNames(gCurFileName); |
---|
1611 | |
---|
1612 | yylineno = 1; |
---|
1613 | |
---|
1614 | yy_switch_to_buffer(yy_create_buffer( yyin, YY_BUF_SIZE ) ); |
---|
1615 | |
---|
1616 | gbInsideInclude = true; |
---|
1617 | |
---|
1618 | BEGIN(SAVELINE); |
---|
1619 | } |
---|
1620 | } |
---|
1621 | } |
---|
1622 | YY_BREAK |
---|
1623 | case YY_STATE_EOF(EATCOMMENT): |
---|
1624 | #line 597 "vs1.0_tokens.l" |
---|
1625 | { |
---|
1626 | LexError("End of file reached before end of comment started on line %d.\n", gCommentStartLine); |
---|
1627 | BEGIN(INITIAL); |
---|
1628 | } |
---|
1629 | YY_BREAK |
---|
1630 | case 20: |
---|
1631 | YY_RULE_SETUP |
---|
1632 | #line 602 "vs1.0_tokens.l" |
---|
1633 | { |
---|
1634 | char *endComment; |
---|
1635 | unsigned int keepSize; |
---|
1636 | |
---|
1637 | strcpy(gSaveLine, yytext); |
---|
1638 | endComment = strstr(yytext, "*/"); |
---|
1639 | |
---|
1640 | char *cmt; |
---|
1641 | if (endComment != NULL) |
---|
1642 | { |
---|
1643 | keepSize = (endComment - yytext+2); |
---|
1644 | yyless(keepSize); |
---|
1645 | BEGIN(INITIAL); |
---|
1646 | |
---|
1647 | if ( yytext[0] == '/' && yytext[1] == '*' ) |
---|
1648 | { |
---|
1649 | cmt = new char[yyleng]; |
---|
1650 | strncpy( cmt+3, yytext+2, yyleng-2 ); |
---|
1651 | cmt[0] = '#'; |
---|
1652 | cmt[1] = ' '; |
---|
1653 | cmt[2] = ' '; |
---|
1654 | cmt[yyleng-1] = '\0'; |
---|
1655 | } |
---|
1656 | else |
---|
1657 | { |
---|
1658 | cmt = new char[yyleng]; |
---|
1659 | strncpy( cmt+1, yytext, yyleng-2 ); |
---|
1660 | cmt[0] = '#'; |
---|
1661 | cmt[yyleng-1] = '\0'; |
---|
1662 | } |
---|
1663 | vs10_lval.comment = cmt; |
---|
1664 | return COMMENT; |
---|
1665 | } |
---|
1666 | else |
---|
1667 | { |
---|
1668 | // GenDebugLine(); |
---|
1669 | // GenListString(); |
---|
1670 | gLinesAssembled++; |
---|
1671 | yylineno++; |
---|
1672 | |
---|
1673 | if ( yytext[0] == '/' && yytext[1] == '*' ) |
---|
1674 | { |
---|
1675 | cmt = new char[yyleng+2]; |
---|
1676 | strncpy( cmt+3, yytext+2, yyleng-2 ); |
---|
1677 | cmt[0] = '#'; |
---|
1678 | cmt[1] = ' '; |
---|
1679 | cmt[2] = ' '; |
---|
1680 | cmt[yyleng+1] = '\0'; |
---|
1681 | } |
---|
1682 | else |
---|
1683 | { |
---|
1684 | cmt = new char[yyleng+2]; |
---|
1685 | strncpy( cmt+1, yytext, yyleng ); |
---|
1686 | cmt[0] = '#'; |
---|
1687 | cmt[yyleng+1] = '\0'; |
---|
1688 | } |
---|
1689 | vs10_lval.comment = cmt; |
---|
1690 | return COMMENT; |
---|
1691 | } |
---|
1692 | } |
---|
1693 | YY_BREAK |
---|
1694 | case YY_STATE_EOF(DEFSTR): |
---|
1695 | #line 663 "vs1.0_tokens.l" |
---|
1696 | { |
---|
1697 | LexError("#define was incomplete before end of file\n"); |
---|
1698 | BEGIN(INITIAL); |
---|
1699 | } |
---|
1700 | YY_BREAK |
---|
1701 | case YY_STATE_EOF(DEFINE): |
---|
1702 | #line 668 "vs1.0_tokens.l" |
---|
1703 | { |
---|
1704 | LexError("#define was incomplete before end of file\n"); |
---|
1705 | BEGIN(INITIAL); |
---|
1706 | } |
---|
1707 | YY_BREAK |
---|
1708 | case YY_STATE_EOF(DEFSPACE): |
---|
1709 | #line 673 "vs1.0_tokens.l" |
---|
1710 | { |
---|
1711 | LexError("#define was incomplete before end of file\n"); |
---|
1712 | BEGIN(INITIAL); |
---|
1713 | } |
---|
1714 | YY_BREAK |
---|
1715 | case YY_STATE_EOF(INCLUDE): |
---|
1716 | #line 678 "vs1.0_tokens.l" |
---|
1717 | { |
---|
1718 | LexError("#include was incomplete before end of file\n"); |
---|
1719 | BEGIN(INITIAL); |
---|
1720 | } |
---|
1721 | YY_BREAK |
---|
1722 | case YY_STATE_EOF(MACROBODY): |
---|
1723 | #line 683 "vs1.0_tokens.l" |
---|
1724 | { |
---|
1725 | LexError("End of file reached before end of #define or endm was found, macro started on line %d.\n", gMacroStartLine); |
---|
1726 | BEGIN(INITIAL); |
---|
1727 | } |
---|
1728 | YY_BREAK |
---|
1729 | case YY_STATE_EOF(IFDEFBODY): |
---|
1730 | #line 688 "vs1.0_tokens.l" |
---|
1731 | { |
---|
1732 | LexError("End of file reached before #endif found, macro started on line %d.\n", gIfDefStartLine); |
---|
1733 | BEGIN(INITIAL); |
---|
1734 | } |
---|
1735 | YY_BREAK |
---|
1736 | case 21: |
---|
1737 | YY_RULE_SETUP |
---|
1738 | #line 693 "vs1.0_tokens.l" |
---|
1739 | { |
---|
1740 | LexError("#define was incomplete before end of line\n"); |
---|
1741 | BEGIN(SAVELINE); |
---|
1742 | // GenDebugLine(); |
---|
1743 | // GenListString(); |
---|
1744 | gLinesAssembled++; |
---|
1745 | yylineno++; |
---|
1746 | } |
---|
1747 | YY_BREAK |
---|
1748 | case 22: |
---|
1749 | YY_RULE_SETUP |
---|
1750 | #line 702 "vs1.0_tokens.l" |
---|
1751 | { |
---|
1752 | LexError("#define was incomplete before end of line\n"); |
---|
1753 | BEGIN(SAVELINE); |
---|
1754 | // GenDebugLine(); |
---|
1755 | // GenListString(); |
---|
1756 | gLinesAssembled++; |
---|
1757 | yylineno++; |
---|
1758 | } |
---|
1759 | YY_BREAK |
---|
1760 | case 23: |
---|
1761 | YY_RULE_SETUP |
---|
1762 | #line 711 "vs1.0_tokens.l" |
---|
1763 | { |
---|
1764 | LexError("#define was incomplete before end of line\n"); |
---|
1765 | BEGIN(SAVELINE); |
---|
1766 | // GenDebugLine(); |
---|
1767 | // GenListString(); |
---|
1768 | gLinesAssembled++; |
---|
1769 | yylineno++; |
---|
1770 | } |
---|
1771 | YY_BREAK |
---|
1772 | case 24: |
---|
1773 | YY_RULE_SETUP |
---|
1774 | #line 720 "vs1.0_tokens.l" |
---|
1775 | { |
---|
1776 | if (gIfDefStackIndex >= MAX_IFDEF_DEPTH) |
---|
1777 | { |
---|
1778 | LexError("Out of stack space for #ifdef, aborting.\n"); |
---|
1779 | exit( 1 ); |
---|
1780 | } |
---|
1781 | else |
---|
1782 | { |
---|
1783 | gIfDefStack[gIfDefStackIndex].lastbProcessingIFDEF = gbProcessingIFDEF; |
---|
1784 | gIfDefStack[gIfDefStackIndex].lastbIFDEF = gbIFDEF; |
---|
1785 | gIfDefStack[gIfDefStackIndex].lastbCompareDefine = gbCompareDefine; |
---|
1786 | gIfDefStack[gIfDefStackIndex].lastIfDefStartLine = gIfDefStartLine; |
---|
1787 | gIfDefStackIndex++; |
---|
1788 | gIfDefStartLine = yylineno; |
---|
1789 | |
---|
1790 | gbCompareDefine = true; |
---|
1791 | BEGIN(IFDEFNAME); |
---|
1792 | } |
---|
1793 | } |
---|
1794 | YY_BREAK |
---|
1795 | case 25: |
---|
1796 | YY_RULE_SETUP |
---|
1797 | #line 740 "vs1.0_tokens.l" |
---|
1798 | { |
---|
1799 | if (gIfDefStackIndex >= MAX_IFDEF_DEPTH) |
---|
1800 | { |
---|
1801 | LexError("Out of stack space for #ifdef, aborting.\n"); |
---|
1802 | exit( 1 ); |
---|
1803 | } |
---|
1804 | else |
---|
1805 | { |
---|
1806 | gIfDefStack[gIfDefStackIndex].lastbProcessingIFDEF = gbProcessingIFDEF; |
---|
1807 | gIfDefStack[gIfDefStackIndex].lastbIFDEF = gbIFDEF; |
---|
1808 | gIfDefStack[gIfDefStackIndex].lastbCompareDefine = gbCompareDefine; |
---|
1809 | gIfDefStack[gIfDefStackIndex].lastIfDefStartLine = gIfDefStartLine; |
---|
1810 | gIfDefStackIndex++; |
---|
1811 | gIfDefStartLine = yylineno; |
---|
1812 | |
---|
1813 | gbCompareDefine = false; |
---|
1814 | BEGIN(IFDEFNAME); |
---|
1815 | } |
---|
1816 | } |
---|
1817 | YY_BREAK |
---|
1818 | case 26: |
---|
1819 | YY_RULE_SETUP |
---|
1820 | #line 760 "vs1.0_tokens.l" |
---|
1821 | { |
---|
1822 | if (!gbProcessingIFDEF) |
---|
1823 | { |
---|
1824 | LexError("Unexpected #else found at line %d, skipping.\n", yylineno); |
---|
1825 | } |
---|
1826 | else |
---|
1827 | { |
---|
1828 | gbCompareDefine = !gbCompareDefine; |
---|
1829 | BEGIN(INITIAL); |
---|
1830 | } |
---|
1831 | } |
---|
1832 | YY_BREAK |
---|
1833 | case 27: |
---|
1834 | YY_RULE_SETUP |
---|
1835 | #line 772 "vs1.0_tokens.l" |
---|
1836 | { |
---|
1837 | char *defineName; |
---|
1838 | unsigned int sLen; |
---|
1839 | |
---|
1840 | |
---|
1841 | defineName = FindAlphaNum(yytext, &sLen); |
---|
1842 | if (defineName == NULL) |
---|
1843 | { |
---|
1844 | defineName = strdup(yytext); |
---|
1845 | defineName[yyleng-1] = '\0'; // kill \n |
---|
1846 | LexWarning("Mangled name (%s) for #ifdef, assuming not defined.\n", defineName); |
---|
1847 | free(defineName); |
---|
1848 | gbIFDEF = false; |
---|
1849 | } |
---|
1850 | else |
---|
1851 | { |
---|
1852 | if (FindNMacro(defineName, sLen) != NULL) |
---|
1853 | { |
---|
1854 | gbIFDEF = true; |
---|
1855 | } |
---|
1856 | else |
---|
1857 | { |
---|
1858 | gbIFDEF = false; |
---|
1859 | } |
---|
1860 | } |
---|
1861 | |
---|
1862 | gbProcessingIFDEF = true; |
---|
1863 | if (gbIFDEF != gbCompareDefine) |
---|
1864 | { |
---|
1865 | BEGIN(IFDEFBODY); |
---|
1866 | } |
---|
1867 | else |
---|
1868 | { |
---|
1869 | BEGIN(SAVELINE); |
---|
1870 | } |
---|
1871 | |
---|
1872 | // GenDebugLine(); |
---|
1873 | // GenListString(); |
---|
1874 | gLinesAssembled++; |
---|
1875 | yylineno++; |
---|
1876 | } |
---|
1877 | YY_BREAK |
---|
1878 | case 28: |
---|
1879 | YY_RULE_SETUP |
---|
1880 | #line 814 "vs1.0_tokens.l" |
---|
1881 | { |
---|
1882 | if (!gbProcessingIFDEF) |
---|
1883 | { |
---|
1884 | LexError("Unexpected #endif found at line %d, skipping.\n", yylineno); |
---|
1885 | } |
---|
1886 | else |
---|
1887 | { |
---|
1888 | gIfDefStackIndex--; |
---|
1889 | gbProcessingIFDEF = gIfDefStack[gIfDefStackIndex].lastbProcessingIFDEF; |
---|
1890 | gbIFDEF = gIfDefStack[gIfDefStackIndex].lastbIFDEF; |
---|
1891 | gbCompareDefine = gIfDefStack[gIfDefStackIndex].lastbCompareDefine; |
---|
1892 | gIfDefStartLine = gIfDefStack[gIfDefStackIndex].lastIfDefStartLine; |
---|
1893 | |
---|
1894 | } |
---|
1895 | |
---|
1896 | if (YYSTATE == IFDEFBODY) |
---|
1897 | { |
---|
1898 | strncpy(gSaveLine, yytext, MAXSAVELINE); |
---|
1899 | } |
---|
1900 | |
---|
1901 | BEGIN(ENDMACRO); |
---|
1902 | |
---|
1903 | } |
---|
1904 | YY_BREAK |
---|
1905 | case 29: |
---|
1906 | YY_RULE_SETUP |
---|
1907 | #line 838 "vs1.0_tokens.l" |
---|
1908 | { |
---|
1909 | LexWarning("Garbage at end of #endif or endm will be ignored.\n"); |
---|
1910 | } |
---|
1911 | YY_BREAK |
---|
1912 | case 30: |
---|
1913 | YY_RULE_SETUP |
---|
1914 | #line 842 "vs1.0_tokens.l" |
---|
1915 | { |
---|
1916 | BEGIN(SAVELINE); |
---|
1917 | return '\n'; |
---|
1918 | } |
---|
1919 | YY_BREAK |
---|
1920 | case YY_STATE_EOF(ENDMACRO): |
---|
1921 | #line 847 "vs1.0_tokens.l" |
---|
1922 | { |
---|
1923 | BEGIN(INITIAL); |
---|
1924 | } |
---|
1925 | YY_BREAK |
---|
1926 | case 31: |
---|
1927 | YY_RULE_SETUP |
---|
1928 | #line 851 "vs1.0_tokens.l" |
---|
1929 | { |
---|
1930 | // eat line, because we are not in a TRUE #ifdef, or FALSE #ifndef |
---|
1931 | strncpy(gSaveLine, yytext, MAXSAVELINE); |
---|
1932 | } |
---|
1933 | YY_BREAK |
---|
1934 | case 32: |
---|
1935 | YY_RULE_SETUP |
---|
1936 | #line 856 "vs1.0_tokens.l" |
---|
1937 | { |
---|
1938 | strcat(gSaveLine, yytext); |
---|
1939 | // GenDebugLine(); |
---|
1940 | // GenListString(); |
---|
1941 | yylineno++; |
---|
1942 | gLinesAssembled++; |
---|
1943 | } |
---|
1944 | YY_BREAK |
---|
1945 | case 33: |
---|
1946 | YY_RULE_SETUP |
---|
1947 | #line 864 "vs1.0_tokens.l" |
---|
1948 | { |
---|
1949 | gbProcessingDefine = true; |
---|
1950 | gMacroStartLine = yylineno; |
---|
1951 | gCountParen = 0; |
---|
1952 | BEGIN(MACRONAME); |
---|
1953 | } |
---|
1954 | YY_BREAK |
---|
1955 | case 34: |
---|
1956 | YY_RULE_SETUP |
---|
1957 | #line 871 "vs1.0_tokens.l" |
---|
1958 | { |
---|
1959 | BEGIN(SAVELINE); |
---|
1960 | // GenDebugLine(); |
---|
1961 | // GenListString(); |
---|
1962 | gLinesAssembled++; |
---|
1963 | yylineno++; |
---|
1964 | } |
---|
1965 | YY_BREAK |
---|
1966 | case 35: |
---|
1967 | YY_RULE_SETUP |
---|
1968 | #line 879 "vs1.0_tokens.l" |
---|
1969 | { |
---|
1970 | // unsigned int majorVersion; |
---|
1971 | // unsigned int minorVersion; |
---|
1972 | // int minorOffset; |
---|
1973 | // |
---|
1974 | // |
---|
1975 | // majorVersion = (unsigned int)(atoi(&yytext[3])); |
---|
1976 | // // skip "ps." + second '.' |
---|
1977 | // minorOffset = strcspn(&yytext[3], ".")+4; |
---|
1978 | // minorVersion = (unsigned int)(atoi(&yytext[minorOffset])); |
---|
1979 | // yylval.ival = D3DVS_VERSION(majorVersion, minorVersion); |
---|
1980 | // |
---|
1981 | |
---|
1982 | // fprintf( stderr, "%s", yytext ); |
---|
1983 | if ( yytext[yyleng-1] == '\n' ) |
---|
1984 | line_incr = 1; |
---|
1985 | return VERTEX_SHADER; |
---|
1986 | } |
---|
1987 | YY_BREAK |
---|
1988 | case 36: |
---|
1989 | YY_RULE_SETUP |
---|
1990 | #line 898 "vs1.0_tokens.l" |
---|
1991 | { |
---|
1992 | // fprintf( stderr, "%s", yytext ); |
---|
1993 | vs10_lval.ival = atoi(yytext); |
---|
1994 | return INTVAL; |
---|
1995 | } |
---|
1996 | YY_BREAK |
---|
1997 | case 37: |
---|
1998 | YY_RULE_SETUP |
---|
1999 | #line 905 "vs1.0_tokens.l" |
---|
2000 | { |
---|
2001 | BEGIN(MODIFIER); |
---|
2002 | //fprintf( stderr, "." ); |
---|
2003 | return yytext[0]; |
---|
2004 | } |
---|
2005 | YY_BREAK |
---|
2006 | case 38: |
---|
2007 | YY_RULE_SETUP |
---|
2008 | #line 911 "vs1.0_tokens.l" |
---|
2009 | { |
---|
2010 | // fprintf( stderr, "%s", yytext ); |
---|
2011 | BEGIN(INITIAL); |
---|
2012 | |
---|
2013 | vs10_lval.mask[0] = tolower(yytext[0]); |
---|
2014 | vs10_lval.mask[1] = tolower(yytext[1]); |
---|
2015 | vs10_lval.mask[2] = tolower(yytext[2]); |
---|
2016 | vs10_lval.mask[3] = tolower(yytext[3]); |
---|
2017 | |
---|
2018 | if ( yytext[yyleng-1] == '\n' ) |
---|
2019 | line_incr = 1; |
---|
2020 | |
---|
2021 | return XYZW_MODIFIER; |
---|
2022 | |
---|
2023 | #if 0 |
---|
2024 | char temp[6]; |
---|
2025 | |
---|
2026 | temp[0] = '\0'; |
---|
2027 | strncat(temp, yytext, 4); |
---|
2028 | strlwr(temp); |
---|
2029 | vs10_lval.lval = FindSwizzleValue(temp); |
---|
2030 | |
---|
2031 | BEGIN(INITIAL); |
---|
2032 | return SWIZZLE_MODIFIER; |
---|
2033 | #endif |
---|
2034 | |
---|
2035 | } |
---|
2036 | YY_BREAK |
---|
2037 | case 39: |
---|
2038 | YY_RULE_SETUP |
---|
2039 | #line 939 "vs1.0_tokens.l" |
---|
2040 | { |
---|
2041 | // fprintf( stderr, "%s", yytext ); |
---|
2042 | BEGIN(INITIAL); |
---|
2043 | |
---|
2044 | int validLen = strspn(yytext, "xyzw"); |
---|
2045 | int i; |
---|
2046 | for ( i = 0; i < validLen; i++ ) |
---|
2047 | vs10_lval.mask[i] = tolower( yytext[i] ); |
---|
2048 | while ( i < 4 ) |
---|
2049 | { |
---|
2050 | vs10_lval.mask[i] = 0; |
---|
2051 | i++; |
---|
2052 | } |
---|
2053 | |
---|
2054 | if ( yytext[yyleng-1] == '\n' ) |
---|
2055 | line_incr = 1; |
---|
2056 | |
---|
2057 | return XYZW_MODIFIER; |
---|
2058 | |
---|
2059 | #if 0 |
---|
2060 | //char temp[6]; |
---|
2061 | char *temp = new char[6]; |
---|
2062 | unsigned int registerMask; |
---|
2063 | unsigned int validLen; |
---|
2064 | |
---|
2065 | temp[0] = '\0'; |
---|
2066 | validLen = strspn(yytext, "xyzw"); |
---|
2067 | strncat(temp, yytext, validLen); |
---|
2068 | for ( int i = 0; i < validLen; i++ ) |
---|
2069 | temp[i] = tolower( temp[i] ); |
---|
2070 | registerMask = MakeRegisterMask(temp); |
---|
2071 | |
---|
2072 | if (registerMask != 0) |
---|
2073 | { |
---|
2074 | //vs10_lval.sval = temp; |
---|
2075 | vs10_lval.lval = registerMask; |
---|
2076 | BEGIN(INITIAL); |
---|
2077 | return XYZW_MODIFIER; |
---|
2078 | } |
---|
2079 | else |
---|
2080 | { |
---|
2081 | //vs10_lval.sval = temp; |
---|
2082 | vs10_lval.lval = FindSwizzleValue(temp); |
---|
2083 | BEGIN(INITIAL); |
---|
2084 | return SWIZZLE_MODIFIER; |
---|
2085 | } |
---|
2086 | #endif |
---|
2087 | } |
---|
2088 | YY_BREAK |
---|
2089 | case 40: |
---|
2090 | YY_RULE_SETUP |
---|
2091 | #line 988 "vs1.0_tokens.l" |
---|
2092 | { |
---|
2093 | BEGIN(INITIAL); |
---|
2094 | yyless(0); |
---|
2095 | } |
---|
2096 | YY_BREAK |
---|
2097 | case 41: |
---|
2098 | YY_RULE_SETUP |
---|
2099 | #line 993 "vs1.0_tokens.l" |
---|
2100 | { |
---|
2101 | /* setup and save off #define/macro name */ |
---|
2102 | if (FindMacro(yytext) != NULL) |
---|
2103 | { |
---|
2104 | LexWarning("Redefinition of #define/macro %s, ignoring.\n", yytext); |
---|
2105 | if (gbProcessingDefine) |
---|
2106 | { |
---|
2107 | BEGIN(EATDEFINE); |
---|
2108 | } |
---|
2109 | else |
---|
2110 | { |
---|
2111 | BEGIN(EATMACRO); |
---|
2112 | } |
---|
2113 | } |
---|
2114 | else |
---|
2115 | { |
---|
2116 | |
---|
2117 | BEGIN(MACROPARMSTART); |
---|
2118 | // %%%%% This should be setup to use memory pools |
---|
2119 | gTempMacro = (MACROENTRY *)malloc(sizeof(MACROENTRY)); |
---|
2120 | if (gTempMacro == NULL) |
---|
2121 | { |
---|
2122 | LexError("Out of memory for macro table.\n"); |
---|
2123 | if (gbProcessingDefine) |
---|
2124 | { |
---|
2125 | BEGIN(EATDEFINE); |
---|
2126 | } |
---|
2127 | else |
---|
2128 | { |
---|
2129 | BEGIN(EATMACRO); |
---|
2130 | } |
---|
2131 | } |
---|
2132 | else |
---|
2133 | { |
---|
2134 | gTempMacro->prev = gLastMacro; |
---|
2135 | gTempMacro->next = NULL; |
---|
2136 | |
---|
2137 | gTempMacro->firstMacroParms = NULL; |
---|
2138 | gTempMacro->lastMacroParms = NULL; |
---|
2139 | gTempMacro->firstMacroLines = NULL; |
---|
2140 | gTempMacro->lastMacroLines = NULL; |
---|
2141 | gTempMacro->numParms = 0; |
---|
2142 | gTempMacro->bIsDefine = gbProcessingDefine; |
---|
2143 | gTempMacro->nLines = 0; |
---|
2144 | |
---|
2145 | if (gCurFileName != NULL) |
---|
2146 | { |
---|
2147 | gTempMacro->fileName = strdup(gCurFileName); |
---|
2148 | } |
---|
2149 | else |
---|
2150 | { |
---|
2151 | gTempMacro->fileName = NULL; |
---|
2152 | } |
---|
2153 | |
---|
2154 | gTempMacro->lineNo = yylineno; |
---|
2155 | |
---|
2156 | /* %%%%% this should be set up in memory pools. */ |
---|
2157 | gTempMacro->macroName = (char *)malloc(strlen(yytext)+1); |
---|
2158 | if (gTempMacro->macroName == NULL) |
---|
2159 | { |
---|
2160 | LexError("Out of memory for string table.\n"); |
---|
2161 | SAFEFREE(gTempMacro); |
---|
2162 | if (gbProcessingDefine) |
---|
2163 | { |
---|
2164 | BEGIN(EATDEFINE); |
---|
2165 | } |
---|
2166 | else |
---|
2167 | { |
---|
2168 | BEGIN(EATMACRO); |
---|
2169 | } |
---|
2170 | } |
---|
2171 | else |
---|
2172 | { |
---|
2173 | strcpy(gTempMacro->macroName, yytext); |
---|
2174 | } |
---|
2175 | } |
---|
2176 | } |
---|
2177 | } |
---|
2178 | YY_BREAK |
---|
2179 | case 42: |
---|
2180 | YY_RULE_SETUP |
---|
2181 | #line 1072 "vs1.0_tokens.l" |
---|
2182 | { |
---|
2183 | LexError("No macro name specified, skipping macro definition.\n"); |
---|
2184 | SAFEFREE(gTempMacro->fileName); |
---|
2185 | SAFEFREE(gTempMacro); |
---|
2186 | if (gbProcessingDefine) |
---|
2187 | { |
---|
2188 | BEGIN(EATDEFINE); |
---|
2189 | } |
---|
2190 | else |
---|
2191 | { |
---|
2192 | BEGIN(EATMACRO); |
---|
2193 | } |
---|
2194 | |
---|
2195 | // GenDebugLine(); |
---|
2196 | // GenListString(); |
---|
2197 | gLinesAssembled++; |
---|
2198 | yylineno++; |
---|
2199 | } |
---|
2200 | YY_BREAK |
---|
2201 | case 43: |
---|
2202 | YY_RULE_SETUP |
---|
2203 | #line 1091 "vs1.0_tokens.l" |
---|
2204 | { |
---|
2205 | gCountParen++; |
---|
2206 | } |
---|
2207 | YY_BREAK |
---|
2208 | case 44: |
---|
2209 | YY_RULE_SETUP |
---|
2210 | #line 1095 "vs1.0_tokens.l" |
---|
2211 | {} |
---|
2212 | YY_BREAK |
---|
2213 | case 45: |
---|
2214 | YY_RULE_SETUP |
---|
2215 | #line 1097 "vs1.0_tokens.l" |
---|
2216 | { |
---|
2217 | if (gbProcessingDefine && (gCountParen == 0)) |
---|
2218 | { |
---|
2219 | EndMacroParms(); |
---|
2220 | } |
---|
2221 | else |
---|
2222 | { |
---|
2223 | BEGIN(MACROPARM); |
---|
2224 | } |
---|
2225 | yyless(0); |
---|
2226 | } |
---|
2227 | YY_BREAK |
---|
2228 | case 46: |
---|
2229 | YY_RULE_SETUP |
---|
2230 | #line 1109 "vs1.0_tokens.l" |
---|
2231 | { |
---|
2232 | if ((gCountParen == 0) && gbProcessingDefine) |
---|
2233 | { |
---|
2234 | EndMacroParms(); |
---|
2235 | } |
---|
2236 | } |
---|
2237 | YY_BREAK |
---|
2238 | case 47: |
---|
2239 | YY_RULE_SETUP |
---|
2240 | #line 1116 "vs1.0_tokens.l" |
---|
2241 | { |
---|
2242 | if (gCountParen == 0) |
---|
2243 | { |
---|
2244 | EndMacroParms(); |
---|
2245 | } |
---|
2246 | } |
---|
2247 | YY_BREAK |
---|
2248 | case 48: |
---|
2249 | YY_RULE_SETUP |
---|
2250 | #line 1123 "vs1.0_tokens.l" |
---|
2251 | {} |
---|
2252 | YY_BREAK |
---|
2253 | case YY_STATE_EOF(MACROPARM): |
---|
2254 | #line 1125 "vs1.0_tokens.l" |
---|
2255 | { |
---|
2256 | EndMacroParms(); |
---|
2257 | // GenDebugLine(); |
---|
2258 | // GenListString(); |
---|
2259 | yylineno++; |
---|
2260 | gLinesAssembled++; |
---|
2261 | BEGIN(INITIAL); |
---|
2262 | } |
---|
2263 | YY_BREAK |
---|
2264 | case 49: |
---|
2265 | YY_RULE_SETUP |
---|
2266 | #line 1134 "vs1.0_tokens.l" |
---|
2267 | { |
---|
2268 | if (gbProcessingDefine && (gCountParen > 0)) |
---|
2269 | { |
---|
2270 | LexError("Malformed #define, skipping.\n"); |
---|
2271 | BEGIN(SAVELINE); |
---|
2272 | } |
---|
2273 | else |
---|
2274 | { |
---|
2275 | EndMacroParms(); |
---|
2276 | // GenDebugLine(); |
---|
2277 | // GenListString(); |
---|
2278 | yylineno++; |
---|
2279 | gLinesAssembled++; |
---|
2280 | if (gbProcessingDefine) |
---|
2281 | { |
---|
2282 | gbProcessingDefine = false; |
---|
2283 | BEGIN(SAVELINE); |
---|
2284 | } |
---|
2285 | } |
---|
2286 | } |
---|
2287 | YY_BREAK |
---|
2288 | case 50: |
---|
2289 | YY_RULE_SETUP |
---|
2290 | #line 1156 "vs1.0_tokens.l" |
---|
2291 | { |
---|
2292 | |
---|
2293 | MACROTEXT *tMacro; |
---|
2294 | char *macroParmEnd; |
---|
2295 | unsigned int startOffset; |
---|
2296 | bool bFoundEndParen; |
---|
2297 | unsigned int leftParenCount; |
---|
2298 | unsigned int rightParenCount; |
---|
2299 | |
---|
2300 | bFoundEndParen = false; |
---|
2301 | |
---|
2302 | // sheesh, we gotta count the parenthesis.... |
---|
2303 | macroParmEnd = yytext; |
---|
2304 | leftParenCount = 0; |
---|
2305 | rightParenCount = 0; |
---|
2306 | while (*macroParmEnd) |
---|
2307 | { |
---|
2308 | if (*macroParmEnd == ')') |
---|
2309 | { |
---|
2310 | rightParenCount++; |
---|
2311 | } |
---|
2312 | if (*macroParmEnd == '(') |
---|
2313 | { |
---|
2314 | leftParenCount++; |
---|
2315 | } |
---|
2316 | |
---|
2317 | macroParmEnd++; |
---|
2318 | } |
---|
2319 | |
---|
2320 | // if we found the last right parenthesis. |
---|
2321 | if (rightParenCount == leftParenCount+1) |
---|
2322 | { |
---|
2323 | // find if we got the last parenthesis on this line |
---|
2324 | macroParmEnd = strrchr(yytext, ')'); |
---|
2325 | yyless((macroParmEnd - yytext)); |
---|
2326 | BEGIN(MACROPARMEND); |
---|
2327 | } |
---|
2328 | |
---|
2329 | startOffset = strspn(yytext, " \t"); |
---|
2330 | |
---|
2331 | tMacro = SaveMacroText(&yytext[startOffset], gTempMacro->lastMacroParms); |
---|
2332 | if (tMacro == NULL) |
---|
2333 | { |
---|
2334 | LexError("Out of memory for string table for macro parameter(s).\n"); |
---|
2335 | FreeMacroEntry(gTempMacro); |
---|
2336 | BEGIN(EATMACRO); |
---|
2337 | } |
---|
2338 | else |
---|
2339 | { |
---|
2340 | // if first one wasn't set then set it |
---|
2341 | if (gTempMacro->firstMacroParms == NULL) |
---|
2342 | { |
---|
2343 | gTempMacro->firstMacroParms = tMacro; |
---|
2344 | } |
---|
2345 | |
---|
2346 | gTempMacro->lastMacroParms = tMacro; |
---|
2347 | |
---|
2348 | gTempMacro->numParms++; |
---|
2349 | } |
---|
2350 | |
---|
2351 | } |
---|
2352 | YY_BREAK |
---|
2353 | case 51: |
---|
2354 | YY_RULE_SETUP |
---|
2355 | #line 1218 "vs1.0_tokens.l" |
---|
2356 | { |
---|
2357 | if (!gbProcessingDefine && !gbTempInsideMacro) |
---|
2358 | { |
---|
2359 | LexError("Malformed macro, skipping.\n"); |
---|
2360 | BEGIN(EATMACRO); |
---|
2361 | } |
---|
2362 | else |
---|
2363 | { |
---|
2364 | gCountParen--; |
---|
2365 | |
---|
2366 | // we can get multiple \n's here |
---|
2367 | while (yytext[yyleng-2] == '\n') |
---|
2368 | { |
---|
2369 | yyleng--; |
---|
2370 | } |
---|
2371 | yyless(yyleng); |
---|
2372 | |
---|
2373 | // if there isn't a \n on this line, macro starts on this line, |
---|
2374 | // not next, like in a macro definition |
---|
2375 | if (yytext[yyleng-1] != '\n') |
---|
2376 | { |
---|
2377 | EndMacroParms(); |
---|
2378 | } |
---|
2379 | else |
---|
2380 | { |
---|
2381 | if (yytext[yyleng-1] == '\n') |
---|
2382 | { |
---|
2383 | gTempMacro->lineNo++; |
---|
2384 | } |
---|
2385 | // count this line |
---|
2386 | gTempMacro->nLines++; |
---|
2387 | // GenDebugLine(); |
---|
2388 | // GenListString(); |
---|
2389 | EndMacroParms(); |
---|
2390 | if (!gbInsideMacro) |
---|
2391 | { |
---|
2392 | yylineno++; |
---|
2393 | } |
---|
2394 | |
---|
2395 | gLinesAssembled++; |
---|
2396 | } |
---|
2397 | |
---|
2398 | } |
---|
2399 | } |
---|
2400 | YY_BREAK |
---|
2401 | case 52: |
---|
2402 | YY_RULE_SETUP |
---|
2403 | #line 1263 "vs1.0_tokens.l" |
---|
2404 | { |
---|
2405 | if (!gbProcessingDefine && !gbTempInsideMacro) |
---|
2406 | { |
---|
2407 | LexError("Malformed macro, skipping.\n"); |
---|
2408 | BEGIN(EATMACRO); |
---|
2409 | } |
---|
2410 | else |
---|
2411 | { |
---|
2412 | |
---|
2413 | // no matter what count this line |
---|
2414 | gTempMacro->nLines++; |
---|
2415 | gCountParen--; |
---|
2416 | EndMacroParms(); |
---|
2417 | if (!gbInsideMacro) |
---|
2418 | { |
---|
2419 | yylineno++; |
---|
2420 | } |
---|
2421 | |
---|
2422 | gLinesAssembled++; |
---|
2423 | } |
---|
2424 | } |
---|
2425 | YY_BREAK |
---|
2426 | case 53: |
---|
2427 | YY_RULE_SETUP |
---|
2428 | #line 1285 "vs1.0_tokens.l" |
---|
2429 | { |
---|
2430 | if (!gbProcessingDefine && !gbTempInsideMacro) |
---|
2431 | { |
---|
2432 | LexError("Malformed macro, skipping.\n"); |
---|
2433 | BEGIN(EATMACRO); |
---|
2434 | } |
---|
2435 | else |
---|
2436 | { |
---|
2437 | gCountParen--; |
---|
2438 | if (gCountParen == 0) |
---|
2439 | { |
---|
2440 | // no matter what count this line |
---|
2441 | gTempMacro->nLines++; |
---|
2442 | EndMacroParms(); |
---|
2443 | if (!gbInsideMacro) |
---|
2444 | { |
---|
2445 | yylineno++; |
---|
2446 | } |
---|
2447 | |
---|
2448 | gLinesAssembled++; |
---|
2449 | } |
---|
2450 | else |
---|
2451 | { |
---|
2452 | REJECT; |
---|
2453 | } |
---|
2454 | } |
---|
2455 | } |
---|
2456 | YY_BREAK |
---|
2457 | case 54: |
---|
2458 | YY_RULE_SETUP |
---|
2459 | #line 1313 "vs1.0_tokens.l" |
---|
2460 | { |
---|
2461 | MACROTEXT *tMacro; |
---|
2462 | unsigned int copyLen; |
---|
2463 | char *endLine; |
---|
2464 | |
---|
2465 | gSaveLine[0] ='\0'; |
---|
2466 | endLine = strchr(yytext, '\\'); |
---|
2467 | copyLen = (endLine - yytext); |
---|
2468 | if (copyLen > MAXSAVELINE) |
---|
2469 | { |
---|
2470 | copyLen = MAXSAVELINE; |
---|
2471 | } |
---|
2472 | |
---|
2473 | strncat(gSaveLine, yytext, copyLen); |
---|
2474 | strcat(gSaveLine, "\n"); |
---|
2475 | tMacro = SaveMacroText(gSaveLine, gLastMacro->lastMacroLines); |
---|
2476 | if (tMacro == NULL) |
---|
2477 | { |
---|
2478 | LexError("Out of memory for string table for macro parameter(s).\n"); |
---|
2479 | BEGIN(EATDEFINE); |
---|
2480 | } |
---|
2481 | else |
---|
2482 | { |
---|
2483 | gLastMacro->nLines++; |
---|
2484 | // if first one wasn't set then set it |
---|
2485 | if (gLastMacro->firstMacroLines == NULL) |
---|
2486 | { |
---|
2487 | gLastMacro->firstMacroLines = tMacro; |
---|
2488 | } |
---|
2489 | |
---|
2490 | gLastMacro->lastMacroLines = tMacro; |
---|
2491 | } |
---|
2492 | |
---|
2493 | // GenDebugLine(); |
---|
2494 | // GenListString(); |
---|
2495 | yylineno++; |
---|
2496 | gLinesAssembled++; |
---|
2497 | } |
---|
2498 | YY_BREAK |
---|
2499 | case 55: |
---|
2500 | YY_RULE_SETUP |
---|
2501 | #line 1352 "vs1.0_tokens.l" |
---|
2502 | { |
---|
2503 | |
---|
2504 | strncpy(gSaveLine, yytext, MAXSAVELINE); |
---|
2505 | if (gbProcessingDefine) |
---|
2506 | { |
---|
2507 | LexError("Malformed #define, skipping.\n"); |
---|
2508 | } |
---|
2509 | |
---|
2510 | BEGIN(ENDMACRO); |
---|
2511 | } |
---|
2512 | YY_BREAK |
---|
2513 | case 56: |
---|
2514 | YY_RULE_SETUP |
---|
2515 | #line 1363 "vs1.0_tokens.l" |
---|
2516 | { |
---|
2517 | MACROTEXT *tMacro; |
---|
2518 | |
---|
2519 | // check if processing #define and only one line, if not then append \n |
---|
2520 | if (!gbProcessingDefine || (gLastMacro->nLines >= 1)) |
---|
2521 | { |
---|
2522 | gSaveLine[0] = '\0'; |
---|
2523 | strncat(gSaveLine, yytext, MAXSAVELINE); |
---|
2524 | strcat(gSaveLine, "\n"); |
---|
2525 | tMacro = SaveMacroText(gSaveLine, gLastMacro->lastMacroLines); |
---|
2526 | gLastMacro->nLines++; |
---|
2527 | } |
---|
2528 | else if (gLastMacro->numParms > 0) // check if parameters were there |
---|
2529 | { |
---|
2530 | // if so, we need the '\n' appended |
---|
2531 | gMacroLine[0] = '\0'; |
---|
2532 | strncat(gMacroLine, yytext, MAXSAVELINE); |
---|
2533 | strcat(gMacroLine, "\n"); |
---|
2534 | tMacro = SaveMacroText(gMacroLine, gLastMacro->lastMacroLines); |
---|
2535 | gLastMacro->nLines++; |
---|
2536 | } |
---|
2537 | else // straight no newline macro replace |
---|
2538 | { |
---|
2539 | tMacro = SaveMacroText(yytext, gLastMacro->lastMacroLines); |
---|
2540 | } |
---|
2541 | |
---|
2542 | if (tMacro == NULL) |
---|
2543 | { |
---|
2544 | LexError("Out of memory for string table for macro parameter(s).\n"); |
---|
2545 | BEGIN(EATMACRO); |
---|
2546 | } |
---|
2547 | else |
---|
2548 | { |
---|
2549 | // if first one wasn't set then set it |
---|
2550 | if (gLastMacro->firstMacroLines == NULL) |
---|
2551 | { |
---|
2552 | gLastMacro->firstMacroLines = tMacro; |
---|
2553 | } |
---|
2554 | |
---|
2555 | gLastMacro->lastMacroLines = tMacro; |
---|
2556 | } |
---|
2557 | } |
---|
2558 | YY_BREAK |
---|
2559 | case 57: |
---|
2560 | YY_RULE_SETUP |
---|
2561 | #line 1406 "vs1.0_tokens.l" |
---|
2562 | { |
---|
2563 | |
---|
2564 | MACROTEXT *tMacro; |
---|
2565 | // GenDebugLine(); |
---|
2566 | // GenListString(); |
---|
2567 | yylineno++; |
---|
2568 | gLinesAssembled++; |
---|
2569 | if (gbProcessingDefine) |
---|
2570 | { |
---|
2571 | gbProcessingDefine = false; |
---|
2572 | BEGIN(SAVELINE); |
---|
2573 | } |
---|
2574 | else |
---|
2575 | { |
---|
2576 | // this means \n by itself inside macro body |
---|
2577 | if (((yylineno-1) - gLastMacro->lineNo) != gLastMacro->nLines) |
---|
2578 | { |
---|
2579 | strcpy(gMacroLine, "\n"); |
---|
2580 | tMacro = SaveMacroText(gMacroLine, gLastMacro->lastMacroLines); |
---|
2581 | gLastMacro->nLines++; |
---|
2582 | |
---|
2583 | if (tMacro == NULL) |
---|
2584 | { |
---|
2585 | LexError("Out of memory for string table for macro parameter(s).\n"); |
---|
2586 | BEGIN(EATMACRO); |
---|
2587 | } |
---|
2588 | else |
---|
2589 | { |
---|
2590 | // if first one wasn't set then set it |
---|
2591 | if (gLastMacro->firstMacroLines == NULL) |
---|
2592 | { |
---|
2593 | gLastMacro->firstMacroLines = tMacro; |
---|
2594 | } |
---|
2595 | |
---|
2596 | gLastMacro->lastMacroLines = tMacro; |
---|
2597 | } |
---|
2598 | } |
---|
2599 | } |
---|
2600 | } |
---|
2601 | YY_BREAK |
---|
2602 | case 58: |
---|
2603 | YY_RULE_SETUP |
---|
2604 | #line 1446 "vs1.0_tokens.l" |
---|
2605 | { |
---|
2606 | BEGIN(SAVELINE); |
---|
2607 | // GenDebugLine(); |
---|
2608 | // GenListString(); |
---|
2609 | gLinesAssembled++; |
---|
2610 | yylineno++; |
---|
2611 | } |
---|
2612 | YY_BREAK |
---|
2613 | case 59: |
---|
2614 | YY_RULE_SETUP |
---|
2615 | #line 1454 "vs1.0_tokens.l" |
---|
2616 | { |
---|
2617 | strncpy(gSaveLine, yytext, MAXSAVELINE); |
---|
2618 | // GenDebugLine(); |
---|
2619 | // GenListString(); |
---|
2620 | gLinesAssembled++; |
---|
2621 | yylineno++; |
---|
2622 | } |
---|
2623 | YY_BREAK |
---|
2624 | case 60: |
---|
2625 | YY_RULE_SETUP |
---|
2626 | #line 1462 "vs1.0_tokens.l" |
---|
2627 | { |
---|
2628 | strncpy(gSaveLine, yytext, MAXSAVELINE); |
---|
2629 | // GenDebugLine(); |
---|
2630 | // GenListString(); |
---|
2631 | gLinesAssembled++; |
---|
2632 | yylineno++; |
---|
2633 | } |
---|
2634 | YY_BREAK |
---|
2635 | case 61: |
---|
2636 | YY_RULE_SETUP |
---|
2637 | #line 1470 "vs1.0_tokens.l" |
---|
2638 | { |
---|
2639 | strncpy(gSaveLine, yytext, MAXSAVELINE); |
---|
2640 | // GenDebugLine(); |
---|
2641 | // GenListString(); |
---|
2642 | gLinesAssembled++; |
---|
2643 | yylineno++; |
---|
2644 | BEGIN(SAVELINE); |
---|
2645 | } |
---|
2646 | YY_BREAK |
---|
2647 | case 62: |
---|
2648 | YY_RULE_SETUP |
---|
2649 | #line 1479 "vs1.0_tokens.l" |
---|
2650 | { |
---|
2651 | |
---|
2652 | gTempParseMacro = FindMacro(yytext); |
---|
2653 | |
---|
2654 | if (gTempParseMacro != NULL) |
---|
2655 | { |
---|
2656 | if (gIncludeStackIndex >= MAX_INCLUDE_DEPTH ) |
---|
2657 | { |
---|
2658 | LexError("macros nested too deeply"); |
---|
2659 | exit( 1 ); |
---|
2660 | } |
---|
2661 | |
---|
2662 | if (gTempParseMacro->firstMacroLines != NULL) |
---|
2663 | { |
---|
2664 | |
---|
2665 | gTempMacro = (MACROENTRY *)malloc(sizeof(MACROENTRY)); |
---|
2666 | if (gTempMacro == NULL) |
---|
2667 | { |
---|
2668 | LexError("Out of memory allocating MACROENTRY structure.\n"); |
---|
2669 | } |
---|
2670 | else |
---|
2671 | { |
---|
2672 | |
---|
2673 | gTempMacro->next = NULL; |
---|
2674 | gTempMacro->prev = NULL; |
---|
2675 | gTempMacro->macroName = NULL; |
---|
2676 | gTempMacro->firstMacroParms = NULL; |
---|
2677 | gTempMacro->lastMacroParms = NULL; |
---|
2678 | gTempMacro->firstMacroLines = NULL; |
---|
2679 | gTempMacro->lastMacroLines = NULL; |
---|
2680 | gTempMacro->numParms = 0; |
---|
2681 | gTempMacro->nLines = 0; |
---|
2682 | |
---|
2683 | gbTempInsideMacro = true; // flag we are currently doing a macro replace. |
---|
2684 | gInvokeState = YYSTATE; |
---|
2685 | if (gTempParseMacro->numParms > 0) |
---|
2686 | { |
---|
2687 | BEGIN(MACROPARMSTART); |
---|
2688 | } |
---|
2689 | else |
---|
2690 | { |
---|
2691 | EndMacroParms(); |
---|
2692 | gbTempInsideMacro = false; // no longer waiting for macro invocation |
---|
2693 | } |
---|
2694 | } |
---|
2695 | } |
---|
2696 | } |
---|
2697 | else |
---|
2698 | { |
---|
2699 | BEGIN(INITIAL); |
---|
2700 | REJECT; |
---|
2701 | } |
---|
2702 | } |
---|
2703 | YY_BREAK |
---|
2704 | case 63: |
---|
2705 | YY_RULE_SETUP |
---|
2706 | #line 1533 "vs1.0_tokens.l" |
---|
2707 | { |
---|
2708 | // fprintf( stderr, "%c ", yytext[0] ); |
---|
2709 | return yytext[0]; |
---|
2710 | } |
---|
2711 | YY_BREAK |
---|
2712 | case 64: |
---|
2713 | YY_RULE_SETUP |
---|
2714 | #line 1539 "vs1.0_tokens.l" |
---|
2715 | {} |
---|
2716 | YY_BREAK |
---|
2717 | case 65: |
---|
2718 | YY_RULE_SETUP |
---|
2719 | #line 1541 "vs1.0_tokens.l" |
---|
2720 | { |
---|
2721 | LexError("Didn't find label string for #define.\n"); |
---|
2722 | BEGIN(SAVELINE); |
---|
2723 | // return '\n'; |
---|
2724 | } |
---|
2725 | YY_BREAK |
---|
2726 | case 66: |
---|
2727 | YY_RULE_SETUP |
---|
2728 | #line 1547 "vs1.0_tokens.l" |
---|
2729 | { |
---|
2730 | //fprintf(stderr, "\n"); |
---|
2731 | // line_incr = 1; |
---|
2732 | line_incr++; |
---|
2733 | BEGIN(SAVELINE); |
---|
2734 | return '\n'; |
---|
2735 | } |
---|
2736 | YY_BREAK |
---|
2737 | case 67: |
---|
2738 | YY_RULE_SETUP |
---|
2739 | #line 1555 "vs1.0_tokens.l" |
---|
2740 | { |
---|
2741 | BEGIN(INITIAL); |
---|
2742 | // fprintf( stderr, "%s", yytext ); |
---|
2743 | if (yyleng == 1) |
---|
2744 | return yytext[0]; |
---|
2745 | else |
---|
2746 | LexError("Unrecognized Token: %s\n", yytext); |
---|
2747 | return UNKNOWN_STRING; |
---|
2748 | } |
---|
2749 | YY_BREAK |
---|
2750 | case 68: |
---|
2751 | YY_RULE_SETUP |
---|
2752 | #line 1565 "vs1.0_tokens.l" |
---|
2753 | { |
---|
2754 | // vs10_lval.ival = yytext[0]; |
---|
2755 | LexError("Illegal character: %d decimal.\n", yytext[0]); |
---|
2756 | return(ILLEGAL); |
---|
2757 | } |
---|
2758 | YY_BREAK |
---|
2759 | case 69: |
---|
2760 | YY_RULE_SETUP |
---|
2761 | #line 1571 "vs1.0_tokens.l" |
---|
2762 | { |
---|
2763 | // vs10_lval.ival = yytext[0]; |
---|
2764 | LexError("Illegal character: %d decimal.\n", yytext[0]); |
---|
2765 | return(ILLEGAL); |
---|
2766 | } |
---|
2767 | YY_BREAK |
---|
2768 | case 70: |
---|
2769 | YY_RULE_SETUP |
---|
2770 | #line 1577 "vs1.0_tokens.l" |
---|
2771 | { |
---|
2772 | return yytext[0]; |
---|
2773 | } |
---|
2774 | YY_BREAK |
---|
2775 | case 71: |
---|
2776 | YY_RULE_SETUP |
---|
2777 | #line 1581 "vs1.0_tokens.l" |
---|
2778 | { |
---|
2779 | BEGIN(EATSTRING); |
---|
2780 | yyless(0); |
---|
2781 | } |
---|
2782 | YY_BREAK |
---|
2783 | case YY_STATE_EOF(INITIAL): |
---|
2784 | case YY_STATE_EOF(SKIPLINE): |
---|
2785 | case YY_STATE_EOF(EATSTRING): |
---|
2786 | case YY_STATE_EOF(SAVELINE): |
---|
2787 | case YY_STATE_EOF(MACRONAME): |
---|
2788 | case YY_STATE_EOF(EATMACRO): |
---|
2789 | case YY_STATE_EOF(EATDEFINE): |
---|
2790 | case YY_STATE_EOF(MODIFIER): |
---|
2791 | case YY_STATE_EOF(MACROPARMSTART): |
---|
2792 | case YY_STATE_EOF(IFDEFNAME): |
---|
2793 | case YY_STATE_EOF(MACROPARMEND): |
---|
2794 | #line 1586 "vs1.0_tokens.l" |
---|
2795 | { |
---|
2796 | bool wasInMacro; |
---|
2797 | bool oneLiner; |
---|
2798 | char *macroText; |
---|
2799 | |
---|
2800 | wasInMacro = gbInsideMacro; |
---|
2801 | oneLiner = false; |
---|
2802 | |
---|
2803 | |
---|
2804 | // if we are inside the macro then do next line until their are no more |
---|
2805 | if (gbInsideMacro) |
---|
2806 | { |
---|
2807 | oneLiner = (gParseMacro->nLines == 0); |
---|
2808 | |
---|
2809 | // free the temporary parameter replaced line we were working on. |
---|
2810 | // get next line in macro text, if any |
---|
2811 | gMacroLineParse = gMacroLineParse->next; |
---|
2812 | // more lines to parse? |
---|
2813 | if (gMacroLineParse != NULL) |
---|
2814 | { |
---|
2815 | macroText = gMacroLine; |
---|
2816 | // if no replacement text, just use source line |
---|
2817 | if (gParseMacro->firstMacroParms == NULL) |
---|
2818 | { |
---|
2819 | macroText = gMacroLineParse->macroText; |
---|
2820 | } |
---|
2821 | else |
---|
2822 | { |
---|
2823 | // replace the macro parameters |
---|
2824 | ReplaceMacroParms(gMacroLineParse->macroText, gMacroLine, gParseMacro, gInvokeMacro); |
---|
2825 | } |
---|
2826 | |
---|
2827 | // if (gExpandMacros) |
---|
2828 | // { |
---|
2829 | // strcpy(gSaveLine, macroText); |
---|
2830 | // } |
---|
2831 | |
---|
2832 | BEGIN(INITIAL); |
---|
2833 | // and lex it. |
---|
2834 | yy_scan_string(macroText); |
---|
2835 | } |
---|
2836 | else |
---|
2837 | { |
---|
2838 | // no more lines in this macro, so free the working macro |
---|
2839 | SAFEFREE(gInvokeMacro); |
---|
2840 | // shut off flag for inside a macro replacement state. |
---|
2841 | gbInsideMacro = false; |
---|
2842 | } |
---|
2843 | } |
---|
2844 | |
---|
2845 | if (gbProcessingIFDEF && !wasInMacro) |
---|
2846 | { |
---|
2847 | LexError("End of file reached before #endif found, macro started on line %d.\n", gIfDefStartLine); |
---|
2848 | } |
---|
2849 | |
---|
2850 | if (!gbInsideMacro) |
---|
2851 | { |
---|
2852 | if ( gIncludeStackIndex == 0 ) |
---|
2853 | { |
---|
2854 | if (!gbProcessingBuiltIn) |
---|
2855 | CleanUp(); |
---|
2856 | return 0; |
---|
2857 | // return TOKEN_EOF; |
---|
2858 | } |
---|
2859 | else |
---|
2860 | { |
---|
2861 | yy_delete_buffer( YY_CURRENT_BUFFER ); |
---|
2862 | SAFEFREE(gCurFileName); |
---|
2863 | // SAFEDELETE(myin); |
---|
2864 | // SAFECLOSE(yyin); |
---|
2865 | } |
---|
2866 | |
---|
2867 | gIncludeStackIndex--; |
---|
2868 | SAFEDELETEARRAY( gIncludeStack[gIncludeStackIndex].nextString ); |
---|
2869 | yy_switch_to_buffer(gIncludeStack[gIncludeStackIndex].buffer ); |
---|
2870 | gCurFileName = gIncludeStack[gIncludeStackIndex].fileName; |
---|
2871 | // yyin = gIncludeStack[gIncludeStackIndex].fileHandle; |
---|
2872 | myin = gIncludeStack[gIncludeStackIndex].prevString; |
---|
2873 | yylineno = gIncludeStack[gIncludeStackIndex].lineNo; |
---|
2874 | gInvokeMacro = gIncludeStack[gIncludeStackIndex].lastInvokeMacro; |
---|
2875 | gParseMacro = gIncludeStack[gIncludeStackIndex].lastParseMacro; |
---|
2876 | gMacroLineParse = gIncludeStack[gIncludeStackIndex].lastMacroLineParse; |
---|
2877 | gbInsideInclude = gIncludeStack[gIncludeStackIndex].lastbInsideInclude; |
---|
2878 | gbInsideMacro = gIncludeStack[gIncludeStackIndex].lastbInsideMacro; |
---|
2879 | gbProcessingIFDEF = gIncludeStack[gIncludeStackIndex].lastbProcessingIFDEF; |
---|
2880 | |
---|
2881 | if (!gbInsideMacro && !oneLiner) |
---|
2882 | { |
---|
2883 | // GenSwitchFileNames(gCurFileName); |
---|
2884 | BEGIN(SAVELINE); |
---|
2885 | } |
---|
2886 | else |
---|
2887 | { |
---|
2888 | BEGIN(INITIAL); |
---|
2889 | } |
---|
2890 | |
---|
2891 | // gSaveLine was last line saved, before macro invocation |
---|
2892 | if (wasInMacro && !gbInsideMacro && !oneLiner) |
---|
2893 | { |
---|
2894 | // GenDebugLine(); |
---|
2895 | // GenListString(); |
---|
2896 | gLinesAssembled++; |
---|
2897 | yylineno++; |
---|
2898 | } |
---|
2899 | |
---|
2900 | } |
---|
2901 | |
---|
2902 | } |
---|
2903 | YY_BREAK |
---|
2904 | case 72: |
---|
2905 | YY_RULE_SETUP |
---|
2906 | #line 1695 "vs1.0_tokens.l" |
---|
2907 | ECHO; |
---|
2908 | YY_BREAK |
---|
2909 | #line 2908 "_vs1.0_lexer.cpp" |
---|
2910 | |
---|
2911 | case YY_END_OF_BUFFER: |
---|
2912 | { |
---|
2913 | /* Amount of text matched not including the EOB char. */ |
---|
2914 | int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1; |
---|
2915 | |
---|
2916 | /* Undo the effects of YY_DO_BEFORE_ACTION. */ |
---|
2917 | *yy_cp = yy_hold_char; |
---|
2918 | YY_RESTORE_YY_MORE_OFFSET |
---|
2919 | |
---|
2920 | if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW ) |
---|
2921 | { |
---|
2922 | /* We're scanning a new file or input source. It's |
---|
2923 | * possible that this happened because the user |
---|
2924 | * just pointed yyin at a new source and called |
---|
2925 | * yylex(). If so, then we have to assure |
---|
2926 | * consistency between yy_current_buffer and our |
---|
2927 | * globals. Here is the right place to do so, because |
---|
2928 | * this is the first action (other than possibly a |
---|
2929 | * back-up) that will match for the new input source. |
---|
2930 | */ |
---|
2931 | yy_n_chars = yy_current_buffer->yy_n_chars; |
---|
2932 | yy_current_buffer->yy_input_file = yyin; |
---|
2933 | yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL; |
---|
2934 | } |
---|
2935 | |
---|
2936 | /* Note that here we test for yy_c_buf_p "<=" to the position |
---|
2937 | * of the first EOB in the buffer, since yy_c_buf_p will |
---|
2938 | * already have been incremented past the NUL character |
---|
2939 | * (since all states make transitions on EOB to the |
---|
2940 | * end-of-buffer state). Contrast this with the test |
---|
2941 | * in input(). |
---|
2942 | */ |
---|
2943 | if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] ) |
---|
2944 | { /* This was really a NUL. */ |
---|
2945 | yy_state_type yy_next_state; |
---|
2946 | |
---|
2947 | yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text; |
---|
2948 | |
---|
2949 | yy_current_state = yy_get_previous_state(); |
---|
2950 | |
---|
2951 | /* Okay, we're now positioned to make the NUL |
---|
2952 | * transition. We couldn't have |
---|
2953 | * yy_get_previous_state() go ahead and do it |
---|
2954 | * for us because it doesn't know how to deal |
---|
2955 | * with the possibility of jamming (and we don't |
---|
2956 | * want to build jamming into it because then it |
---|
2957 | * will run more slowly). |
---|
2958 | */ |
---|
2959 | |
---|
2960 | yy_next_state = yy_try_NUL_trans( yy_current_state ); |
---|
2961 | |
---|
2962 | yy_bp = yytext_ptr + YY_MORE_ADJ; |
---|
2963 | |
---|
2964 | if ( yy_next_state ) |
---|
2965 | { |
---|
2966 | /* Consume the NUL. */ |
---|
2967 | yy_cp = ++yy_c_buf_p; |
---|
2968 | yy_current_state = yy_next_state; |
---|
2969 | goto yy_match; |
---|
2970 | } |
---|
2971 | |
---|
2972 | else |
---|
2973 | { |
---|
2974 | yy_cp = yy_c_buf_p; |
---|
2975 | goto yy_find_action; |
---|
2976 | } |
---|
2977 | } |
---|
2978 | |
---|
2979 | else switch ( yy_get_next_buffer() ) |
---|
2980 | { |
---|
2981 | case EOB_ACT_END_OF_FILE: |
---|
2982 | { |
---|
2983 | yy_did_buffer_switch_on_eof = 0; |
---|
2984 | |
---|
2985 | if ( yywrap() ) |
---|
2986 | { |
---|
2987 | /* Note: because we've taken care in |
---|
2988 | * yy_get_next_buffer() to have set up |
---|
2989 | * yytext, we can now set up |
---|
2990 | * yy_c_buf_p so that if some total |
---|
2991 | * hoser (like flex itself) wants to |
---|
2992 | * call the scanner after we return the |
---|
2993 | * YY_NULL, it'll still work - another |
---|
2994 | * YY_NULL will get returned. |
---|
2995 | */ |
---|
2996 | yy_c_buf_p = yytext_ptr + YY_MORE_ADJ; |
---|
2997 | |
---|
2998 | yy_act = YY_STATE_EOF(YY_START); |
---|
2999 | goto do_action; |
---|
3000 | } |
---|
3001 | |
---|
3002 | else |
---|
3003 | { |
---|
3004 | if ( ! yy_did_buffer_switch_on_eof ) |
---|
3005 | YY_NEW_FILE; |
---|
3006 | } |
---|
3007 | break; |
---|
3008 | } |
---|
3009 | |
---|
3010 | case EOB_ACT_CONTINUE_SCAN: |
---|
3011 | yy_c_buf_p = |
---|
3012 | yytext_ptr + yy_amount_of_matched_text; |
---|
3013 | |
---|
3014 | yy_current_state = yy_get_previous_state(); |
---|
3015 | |
---|
3016 | yy_cp = yy_c_buf_p; |
---|
3017 | yy_bp = yytext_ptr + YY_MORE_ADJ; |
---|
3018 | goto yy_match; |
---|
3019 | |
---|
3020 | case EOB_ACT_LAST_MATCH: |
---|
3021 | yy_c_buf_p = |
---|
3022 | &yy_current_buffer->yy_ch_buf[yy_n_chars]; |
---|
3023 | |
---|
3024 | yy_current_state = yy_get_previous_state(); |
---|
3025 | |
---|
3026 | yy_cp = yy_c_buf_p; |
---|
3027 | yy_bp = yytext_ptr + YY_MORE_ADJ; |
---|
3028 | goto yy_find_action; |
---|
3029 | } |
---|
3030 | break; |
---|
3031 | } |
---|
3032 | |
---|
3033 | default: |
---|
3034 | YY_FATAL_ERROR( |
---|
3035 | "fatal flex scanner internal error--no action found" ); |
---|
3036 | } /* end of action switch */ |
---|
3037 | } /* end of scanning one token */ |
---|
3038 | } /* end of yylex */ |
---|
3039 | |
---|
3040 | |
---|
3041 | /* yy_get_next_buffer - try to read in a new buffer |
---|
3042 | * |
---|
3043 | * Returns a code representing an action: |
---|
3044 | * EOB_ACT_LAST_MATCH - |
---|
3045 | * EOB_ACT_CONTINUE_SCAN - continue scanning from current position |
---|
3046 | * EOB_ACT_END_OF_FILE - end of file |
---|
3047 | */ |
---|
3048 | |
---|
3049 | static int yy_get_next_buffer() |
---|
3050 | { |
---|
3051 | register char *dest = yy_current_buffer->yy_ch_buf; |
---|
3052 | register char *source = yytext_ptr; |
---|
3053 | register int number_to_move, i; |
---|
3054 | int ret_val; |
---|
3055 | |
---|
3056 | if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] ) |
---|
3057 | YY_FATAL_ERROR( |
---|
3058 | "fatal flex scanner internal error--end of buffer missed" ); |
---|
3059 | |
---|
3060 | if ( yy_current_buffer->yy_fill_buffer == 0 ) |
---|
3061 | { /* Don't try to fill the buffer, so this is an EOF. */ |
---|
3062 | if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 ) |
---|
3063 | { |
---|
3064 | /* We matched a single character, the EOB, so |
---|
3065 | * treat this as a final EOF. |
---|
3066 | */ |
---|
3067 | return EOB_ACT_END_OF_FILE; |
---|
3068 | } |
---|
3069 | |
---|
3070 | else |
---|
3071 | { |
---|
3072 | /* We matched some text prior to the EOB, first |
---|
3073 | * process it. |
---|
3074 | */ |
---|
3075 | return EOB_ACT_LAST_MATCH; |
---|
3076 | } |
---|
3077 | } |
---|
3078 | |
---|
3079 | /* Try to read more data. */ |
---|
3080 | |
---|
3081 | /* First move last chars to start of buffer. */ |
---|
3082 | number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1; |
---|
3083 | |
---|
3084 | for ( i = 0; i < number_to_move; ++i ) |
---|
3085 | *(dest++) = *(source++); |
---|
3086 | |
---|
3087 | if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING ) |
---|
3088 | /* don't do the read, it's not guaranteed to return an EOF, |
---|
3089 | * just force an EOF |
---|
3090 | */ |
---|
3091 | yy_current_buffer->yy_n_chars = yy_n_chars = 0; |
---|
3092 | |
---|
3093 | else |
---|
3094 | { |
---|
3095 | int num_to_read = |
---|
3096 | yy_current_buffer->yy_buf_size - number_to_move - 1; |
---|
3097 | |
---|
3098 | while ( num_to_read <= 0 ) |
---|
3099 | { /* Not enough room in the buffer - grow it. */ |
---|
3100 | #ifdef YY_USES_REJECT |
---|
3101 | YY_FATAL_ERROR( |
---|
3102 | "input buffer overflow, can't enlarge buffer because scanner uses REJECT" ); |
---|
3103 | #else |
---|
3104 | |
---|
3105 | /* just a shorter name for the current buffer */ |
---|
3106 | YY_BUFFER_STATE b = yy_current_buffer; |
---|
3107 | |
---|
3108 | int yy_c_buf_p_offset = |
---|
3109 | (int) (yy_c_buf_p - b->yy_ch_buf); |
---|
3110 | |
---|
3111 | if ( b->yy_is_our_buffer ) |
---|
3112 | { |
---|
3113 | int new_size = b->yy_buf_size * 2; |
---|
3114 | |
---|
3115 | if ( new_size <= 0 ) |
---|
3116 | b->yy_buf_size += b->yy_buf_size / 8; |
---|
3117 | else |
---|
3118 | b->yy_buf_size *= 2; |
---|
3119 | |
---|
3120 | b->yy_ch_buf = (char *) |
---|
3121 | /* Include room in for 2 EOB chars. */ |
---|
3122 | yy_flex_realloc( (void *) b->yy_ch_buf, |
---|
3123 | b->yy_buf_size + 2 ); |
---|
3124 | } |
---|
3125 | else |
---|
3126 | /* Can't grow it, we don't own it. */ |
---|
3127 | b->yy_ch_buf = 0; |
---|
3128 | |
---|
3129 | if ( ! b->yy_ch_buf ) |
---|
3130 | YY_FATAL_ERROR( |
---|
3131 | "fatal error - scanner input buffer overflow" ); |
---|
3132 | |
---|
3133 | yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; |
---|
3134 | |
---|
3135 | num_to_read = yy_current_buffer->yy_buf_size - |
---|
3136 | number_to_move - 1; |
---|
3137 | #endif |
---|
3138 | } |
---|
3139 | |
---|
3140 | if ( num_to_read > YY_READ_BUF_SIZE ) |
---|
3141 | num_to_read = YY_READ_BUF_SIZE; |
---|
3142 | |
---|
3143 | /* Read in more data. */ |
---|
3144 | YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]), |
---|
3145 | yy_n_chars, num_to_read ); |
---|
3146 | |
---|
3147 | yy_current_buffer->yy_n_chars = yy_n_chars; |
---|
3148 | } |
---|
3149 | |
---|
3150 | if ( yy_n_chars == 0 ) |
---|
3151 | { |
---|
3152 | if ( number_to_move == YY_MORE_ADJ ) |
---|
3153 | { |
---|
3154 | ret_val = EOB_ACT_END_OF_FILE; |
---|
3155 | yyrestart( yyin ); |
---|
3156 | } |
---|
3157 | |
---|
3158 | else |
---|
3159 | { |
---|
3160 | ret_val = EOB_ACT_LAST_MATCH; |
---|
3161 | yy_current_buffer->yy_buffer_status = |
---|
3162 | YY_BUFFER_EOF_PENDING; |
---|
3163 | } |
---|
3164 | } |
---|
3165 | |
---|
3166 | else |
---|
3167 | ret_val = EOB_ACT_CONTINUE_SCAN; |
---|
3168 | |
---|
3169 | yy_n_chars += number_to_move; |
---|
3170 | yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR; |
---|
3171 | yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; |
---|
3172 | |
---|
3173 | yytext_ptr = &yy_current_buffer->yy_ch_buf[0]; |
---|
3174 | |
---|
3175 | return ret_val; |
---|
3176 | } |
---|
3177 | |
---|
3178 | |
---|
3179 | /* yy_get_previous_state - get the state just before the EOB char was reached */ |
---|
3180 | |
---|
3181 | static yy_state_type yy_get_previous_state() |
---|
3182 | { |
---|
3183 | register yy_state_type yy_current_state; |
---|
3184 | register char *yy_cp; |
---|
3185 | |
---|
3186 | yy_current_state = yy_start; |
---|
3187 | yy_current_state += YY_AT_BOL(); |
---|
3188 | yy_state_ptr = yy_state_buf; |
---|
3189 | *yy_state_ptr++ = yy_current_state; |
---|
3190 | |
---|
3191 | for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp ) |
---|
3192 | { |
---|
3193 | register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 4); |
---|
3194 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
---|
3195 | { |
---|
3196 | yy_current_state = (int) yy_def[yy_current_state]; |
---|
3197 | if ( yy_current_state >= 329 ) |
---|
3198 | yy_c = yy_meta[(unsigned int) yy_c]; |
---|
3199 | } |
---|
3200 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; |
---|
3201 | *yy_state_ptr++ = yy_current_state; |
---|
3202 | } |
---|
3203 | |
---|
3204 | return yy_current_state; |
---|
3205 | } |
---|
3206 | |
---|
3207 | |
---|
3208 | /* yy_try_NUL_trans - try to make a transition on the NUL character |
---|
3209 | * |
---|
3210 | * synopsis |
---|
3211 | * next_state = yy_try_NUL_trans( current_state ); |
---|
3212 | */ |
---|
3213 | |
---|
3214 | #ifdef YY_USE_PROTOS |
---|
3215 | static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state ) |
---|
3216 | #else |
---|
3217 | static yy_state_type yy_try_NUL_trans( yy_current_state ) |
---|
3218 | yy_state_type yy_current_state; |
---|
3219 | #endif |
---|
3220 | { |
---|
3221 | register int yy_is_jam; |
---|
3222 | |
---|
3223 | register YY_CHAR yy_c = 4; |
---|
3224 | while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) |
---|
3225 | { |
---|
3226 | yy_current_state = (int) yy_def[yy_current_state]; |
---|
3227 | if ( yy_current_state >= 329 ) |
---|
3228 | yy_c = yy_meta[(unsigned int) yy_c]; |
---|
3229 | } |
---|
3230 | yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; |
---|
3231 | yy_is_jam = (yy_current_state == 328); |
---|
3232 | if ( ! yy_is_jam ) |
---|
3233 | *yy_state_ptr++ = yy_current_state; |
---|
3234 | |
---|
3235 | return yy_is_jam ? 0 : yy_current_state; |
---|
3236 | } |
---|
3237 | |
---|
3238 | |
---|
3239 | #ifndef YY_NO_UNPUT |
---|
3240 | #ifdef YY_USE_PROTOS |
---|
3241 | static void yyunput( int c, register char *yy_bp ) |
---|
3242 | #else |
---|
3243 | static void yyunput( c, yy_bp ) |
---|
3244 | int c; |
---|
3245 | register char *yy_bp; |
---|
3246 | #endif |
---|
3247 | { |
---|
3248 | register char *yy_cp = yy_c_buf_p; |
---|
3249 | |
---|
3250 | /* undo effects of setting up yytext */ |
---|
3251 | *yy_cp = yy_hold_char; |
---|
3252 | |
---|
3253 | if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) |
---|
3254 | { /* need to shift things up to make room */ |
---|
3255 | /* +2 for EOB chars. */ |
---|
3256 | register int number_to_move = yy_n_chars + 2; |
---|
3257 | register char *dest = &yy_current_buffer->yy_ch_buf[ |
---|
3258 | yy_current_buffer->yy_buf_size + 2]; |
---|
3259 | register char *source = |
---|
3260 | &yy_current_buffer->yy_ch_buf[number_to_move]; |
---|
3261 | |
---|
3262 | while ( source > yy_current_buffer->yy_ch_buf ) |
---|
3263 | *--dest = *--source; |
---|
3264 | |
---|
3265 | yy_cp += (int) (dest - source); |
---|
3266 | yy_bp += (int) (dest - source); |
---|
3267 | yy_current_buffer->yy_n_chars = |
---|
3268 | yy_n_chars = yy_current_buffer->yy_buf_size; |
---|
3269 | |
---|
3270 | if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 ) |
---|
3271 | YY_FATAL_ERROR( "flex scanner push-back overflow" ); |
---|
3272 | } |
---|
3273 | |
---|
3274 | *--yy_cp = (char) c; |
---|
3275 | |
---|
3276 | |
---|
3277 | yytext_ptr = yy_bp; |
---|
3278 | yy_hold_char = *yy_cp; |
---|
3279 | yy_c_buf_p = yy_cp; |
---|
3280 | } |
---|
3281 | #endif /* ifndef YY_NO_UNPUT */ |
---|
3282 | |
---|
3283 | |
---|
3284 | #ifdef __cplusplus |
---|
3285 | static int yyinput() |
---|
3286 | #else |
---|
3287 | static int input() |
---|
3288 | #endif |
---|
3289 | { |
---|
3290 | int c; |
---|
3291 | |
---|
3292 | *yy_c_buf_p = yy_hold_char; |
---|
3293 | |
---|
3294 | if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR ) |
---|
3295 | { |
---|
3296 | /* yy_c_buf_p now points to the character we want to return. |
---|
3297 | * If this occurs *before* the EOB characters, then it's a |
---|
3298 | * valid NUL; if not, then we've hit the end of the buffer. |
---|
3299 | */ |
---|
3300 | if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] ) |
---|
3301 | /* This was really a NUL. */ |
---|
3302 | *yy_c_buf_p = '\0'; |
---|
3303 | |
---|
3304 | else |
---|
3305 | { /* need more input */ |
---|
3306 | int offset = yy_c_buf_p - yytext_ptr; |
---|
3307 | ++yy_c_buf_p; |
---|
3308 | |
---|
3309 | switch ( yy_get_next_buffer() ) |
---|
3310 | { |
---|
3311 | case EOB_ACT_LAST_MATCH: |
---|
3312 | /* This happens because yy_g_n_b() |
---|
3313 | * sees that we've accumulated a |
---|
3314 | * token and flags that we need to |
---|
3315 | * try matching the token before |
---|
3316 | * proceeding. But for input(), |
---|
3317 | * there's no matching to consider. |
---|
3318 | * So convert the EOB_ACT_LAST_MATCH |
---|
3319 | * to EOB_ACT_END_OF_FILE. |
---|
3320 | */ |
---|
3321 | |
---|
3322 | /* Reset buffer status. */ |
---|
3323 | yyrestart( yyin ); |
---|
3324 | |
---|
3325 | /* fall through */ |
---|
3326 | |
---|
3327 | case EOB_ACT_END_OF_FILE: |
---|
3328 | { |
---|
3329 | if ( yywrap() ) |
---|
3330 | return EOF; |
---|
3331 | |
---|
3332 | if ( ! yy_did_buffer_switch_on_eof ) |
---|
3333 | YY_NEW_FILE; |
---|
3334 | #ifdef __cplusplus |
---|
3335 | return yyinput(); |
---|
3336 | #else |
---|
3337 | return input(); |
---|
3338 | #endif |
---|
3339 | } |
---|
3340 | |
---|
3341 | case EOB_ACT_CONTINUE_SCAN: |
---|
3342 | yy_c_buf_p = yytext_ptr + offset; |
---|
3343 | break; |
---|
3344 | } |
---|
3345 | } |
---|
3346 | } |
---|
3347 | |
---|
3348 | c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */ |
---|
3349 | *yy_c_buf_p = '\0'; /* preserve yytext */ |
---|
3350 | yy_hold_char = *++yy_c_buf_p; |
---|
3351 | |
---|
3352 | yy_current_buffer->yy_at_bol = (c == '\n'); |
---|
3353 | |
---|
3354 | return c; |
---|
3355 | } |
---|
3356 | |
---|
3357 | |
---|
3358 | #ifdef YY_USE_PROTOS |
---|
3359 | void yyrestart( FILE *input_file ) |
---|
3360 | #else |
---|
3361 | void yyrestart( input_file ) |
---|
3362 | FILE *input_file; |
---|
3363 | #endif |
---|
3364 | { |
---|
3365 | if ( ! yy_current_buffer ) |
---|
3366 | yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); |
---|
3367 | |
---|
3368 | yy_init_buffer( yy_current_buffer, input_file ); |
---|
3369 | yy_load_buffer_state(); |
---|
3370 | } |
---|
3371 | |
---|
3372 | |
---|
3373 | #ifdef YY_USE_PROTOS |
---|
3374 | void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer ) |
---|
3375 | #else |
---|
3376 | void yy_switch_to_buffer( new_buffer ) |
---|
3377 | YY_BUFFER_STATE new_buffer; |
---|
3378 | #endif |
---|
3379 | { |
---|
3380 | if ( yy_current_buffer == new_buffer ) |
---|
3381 | return; |
---|
3382 | |
---|
3383 | if ( yy_current_buffer ) |
---|
3384 | { |
---|
3385 | /* Flush out information for old buffer. */ |
---|
3386 | *yy_c_buf_p = yy_hold_char; |
---|
3387 | yy_current_buffer->yy_buf_pos = yy_c_buf_p; |
---|
3388 | yy_current_buffer->yy_n_chars = yy_n_chars; |
---|
3389 | } |
---|
3390 | |
---|
3391 | yy_current_buffer = new_buffer; |
---|
3392 | yy_load_buffer_state(); |
---|
3393 | |
---|
3394 | /* We don't actually know whether we did this switch during |
---|
3395 | * EOF (yywrap()) processing, but the only time this flag |
---|
3396 | * is looked at is after yywrap() is called, so it's safe |
---|
3397 | * to go ahead and always set it. |
---|
3398 | */ |
---|
3399 | yy_did_buffer_switch_on_eof = 1; |
---|
3400 | } |
---|
3401 | |
---|
3402 | |
---|
3403 | #ifdef YY_USE_PROTOS |
---|
3404 | void yy_load_buffer_state( void ) |
---|
3405 | #else |
---|
3406 | void yy_load_buffer_state() |
---|
3407 | #endif |
---|
3408 | { |
---|
3409 | yy_n_chars = yy_current_buffer->yy_n_chars; |
---|
3410 | yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos; |
---|
3411 | yyin = yy_current_buffer->yy_input_file; |
---|
3412 | yy_hold_char = *yy_c_buf_p; |
---|
3413 | } |
---|
3414 | |
---|
3415 | |
---|
3416 | #ifdef YY_USE_PROTOS |
---|
3417 | YY_BUFFER_STATE yy_create_buffer( FILE *file, int size ) |
---|
3418 | #else |
---|
3419 | YY_BUFFER_STATE yy_create_buffer( file, size ) |
---|
3420 | FILE *file; |
---|
3421 | int size; |
---|
3422 | #endif |
---|
3423 | { |
---|
3424 | YY_BUFFER_STATE b; |
---|
3425 | |
---|
3426 | b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); |
---|
3427 | if ( ! b ) |
---|
3428 | YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); |
---|
3429 | |
---|
3430 | b->yy_buf_size = size; |
---|
3431 | |
---|
3432 | /* yy_ch_buf has to be 2 characters longer than the size given because |
---|
3433 | * we need to put in 2 end-of-buffer characters. |
---|
3434 | */ |
---|
3435 | b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 ); |
---|
3436 | if ( ! b->yy_ch_buf ) |
---|
3437 | YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); |
---|
3438 | |
---|
3439 | b->yy_is_our_buffer = 1; |
---|
3440 | |
---|
3441 | yy_init_buffer( b, file ); |
---|
3442 | |
---|
3443 | return b; |
---|
3444 | } |
---|
3445 | |
---|
3446 | |
---|
3447 | #ifdef YY_USE_PROTOS |
---|
3448 | void yy_delete_buffer( YY_BUFFER_STATE b ) |
---|
3449 | #else |
---|
3450 | void yy_delete_buffer( b ) |
---|
3451 | YY_BUFFER_STATE b; |
---|
3452 | #endif |
---|
3453 | { |
---|
3454 | if ( ! b ) |
---|
3455 | return; |
---|
3456 | |
---|
3457 | if ( b == yy_current_buffer ) |
---|
3458 | yy_current_buffer = (YY_BUFFER_STATE) 0; |
---|
3459 | |
---|
3460 | if ( b->yy_is_our_buffer ) |
---|
3461 | yy_flex_free( (void *) b->yy_ch_buf ); |
---|
3462 | |
---|
3463 | yy_flex_free( (void *) b ); |
---|
3464 | } |
---|
3465 | |
---|
3466 | |
---|
3467 | |
---|
3468 | #ifdef YY_USE_PROTOS |
---|
3469 | void yy_init_buffer( YY_BUFFER_STATE b, FILE *file ) |
---|
3470 | #else |
---|
3471 | void yy_init_buffer( b, file ) |
---|
3472 | YY_BUFFER_STATE b; |
---|
3473 | FILE *file; |
---|
3474 | #endif |
---|
3475 | |
---|
3476 | |
---|
3477 | { |
---|
3478 | yy_flush_buffer( b ); |
---|
3479 | |
---|
3480 | b->yy_input_file = file; |
---|
3481 | b->yy_fill_buffer = 1; |
---|
3482 | |
---|
3483 | #if YY_ALWAYS_INTERACTIVE |
---|
3484 | b->yy_is_interactive = 1; |
---|
3485 | #else |
---|
3486 | #if YY_NEVER_INTERACTIVE |
---|
3487 | b->yy_is_interactive = 0; |
---|
3488 | #else |
---|
3489 | b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; |
---|
3490 | #endif |
---|
3491 | #endif |
---|
3492 | } |
---|
3493 | |
---|
3494 | |
---|
3495 | #ifdef YY_USE_PROTOS |
---|
3496 | void yy_flush_buffer( YY_BUFFER_STATE b ) |
---|
3497 | #else |
---|
3498 | void yy_flush_buffer( b ) |
---|
3499 | YY_BUFFER_STATE b; |
---|
3500 | #endif |
---|
3501 | |
---|
3502 | { |
---|
3503 | if ( ! b ) |
---|
3504 | return; |
---|
3505 | |
---|
3506 | b->yy_n_chars = 0; |
---|
3507 | |
---|
3508 | /* We always need two end-of-buffer characters. The first causes |
---|
3509 | * a transition to the end-of-buffer state. The second causes |
---|
3510 | * a jam in that state. |
---|
3511 | */ |
---|
3512 | b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; |
---|
3513 | b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; |
---|
3514 | |
---|
3515 | b->yy_buf_pos = &b->yy_ch_buf[0]; |
---|
3516 | |
---|
3517 | b->yy_at_bol = 1; |
---|
3518 | b->yy_buffer_status = YY_BUFFER_NEW; |
---|
3519 | |
---|
3520 | if ( b == yy_current_buffer ) |
---|
3521 | yy_load_buffer_state(); |
---|
3522 | } |
---|
3523 | |
---|
3524 | |
---|
3525 | #ifndef YY_NO_SCAN_BUFFER |
---|
3526 | #ifdef YY_USE_PROTOS |
---|
3527 | YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size ) |
---|
3528 | #else |
---|
3529 | YY_BUFFER_STATE yy_scan_buffer( base, size ) |
---|
3530 | char *base; |
---|
3531 | yy_size_t size; |
---|
3532 | #endif |
---|
3533 | { |
---|
3534 | YY_BUFFER_STATE b; |
---|
3535 | |
---|
3536 | if ( size < 2 || |
---|
3537 | base[size-2] != YY_END_OF_BUFFER_CHAR || |
---|
3538 | base[size-1] != YY_END_OF_BUFFER_CHAR ) |
---|
3539 | /* They forgot to leave room for the EOB's. */ |
---|
3540 | return 0; |
---|
3541 | |
---|
3542 | b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) ); |
---|
3543 | if ( ! b ) |
---|
3544 | YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); |
---|
3545 | |
---|
3546 | b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ |
---|
3547 | b->yy_buf_pos = b->yy_ch_buf = base; |
---|
3548 | b->yy_is_our_buffer = 0; |
---|
3549 | b->yy_input_file = 0; |
---|
3550 | b->yy_n_chars = b->yy_buf_size; |
---|
3551 | b->yy_is_interactive = 0; |
---|
3552 | b->yy_at_bol = 1; |
---|
3553 | b->yy_fill_buffer = 0; |
---|
3554 | b->yy_buffer_status = YY_BUFFER_NEW; |
---|
3555 | |
---|
3556 | yy_switch_to_buffer( b ); |
---|
3557 | |
---|
3558 | return b; |
---|
3559 | } |
---|
3560 | #endif |
---|
3561 | |
---|
3562 | |
---|
3563 | #ifndef YY_NO_SCAN_STRING |
---|
3564 | #ifdef YY_USE_PROTOS |
---|
3565 | YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str ) |
---|
3566 | #else |
---|
3567 | YY_BUFFER_STATE yy_scan_string( yy_str ) |
---|
3568 | yyconst char *yy_str; |
---|
3569 | #endif |
---|
3570 | { |
---|
3571 | int len; |
---|
3572 | for ( len = 0; yy_str[len]; ++len ) |
---|
3573 | ; |
---|
3574 | |
---|
3575 | return yy_scan_bytes( yy_str, len ); |
---|
3576 | } |
---|
3577 | #endif |
---|
3578 | |
---|
3579 | |
---|
3580 | #ifndef YY_NO_SCAN_BYTES |
---|
3581 | #ifdef YY_USE_PROTOS |
---|
3582 | YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len ) |
---|
3583 | #else |
---|
3584 | YY_BUFFER_STATE yy_scan_bytes( bytes, len ) |
---|
3585 | yyconst char *bytes; |
---|
3586 | int len; |
---|
3587 | #endif |
---|
3588 | { |
---|
3589 | YY_BUFFER_STATE b; |
---|
3590 | char *buf; |
---|
3591 | yy_size_t n; |
---|
3592 | int i; |
---|
3593 | |
---|
3594 | /* Get memory for full buffer, including space for trailing EOB's. */ |
---|
3595 | n = len + 2; |
---|
3596 | buf = (char *) yy_flex_alloc( n ); |
---|
3597 | if ( ! buf ) |
---|
3598 | YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); |
---|
3599 | |
---|
3600 | for ( i = 0; i < len; ++i ) |
---|
3601 | buf[i] = bytes[i]; |
---|
3602 | |
---|
3603 | buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; |
---|
3604 | |
---|
3605 | b = yy_scan_buffer( buf, n ); |
---|
3606 | if ( ! b ) |
---|
3607 | YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); |
---|
3608 | |
---|
3609 | /* It's okay to grow etc. this buffer, and we should throw it |
---|
3610 | * away when we're done. |
---|
3611 | */ |
---|
3612 | b->yy_is_our_buffer = 1; |
---|
3613 | |
---|
3614 | return b; |
---|
3615 | } |
---|
3616 | #endif |
---|
3617 | |
---|
3618 | |
---|
3619 | #ifndef YY_NO_PUSH_STATE |
---|
3620 | #ifdef YY_USE_PROTOS |
---|
3621 | static void yy_push_state( int new_state ) |
---|
3622 | #else |
---|
3623 | static void yy_push_state( new_state ) |
---|
3624 | int new_state; |
---|
3625 | #endif |
---|
3626 | { |
---|
3627 | if ( yy_start_stack_ptr >= yy_start_stack_depth ) |
---|
3628 | { |
---|
3629 | yy_size_t new_size; |
---|
3630 | |
---|
3631 | yy_start_stack_depth += YY_START_STACK_INCR; |
---|
3632 | new_size = yy_start_stack_depth * sizeof( int ); |
---|
3633 | |
---|
3634 | if ( ! yy_start_stack ) |
---|
3635 | yy_start_stack = (int *) yy_flex_alloc( new_size ); |
---|
3636 | |
---|
3637 | else |
---|
3638 | yy_start_stack = (int *) yy_flex_realloc( |
---|
3639 | (void *) yy_start_stack, new_size ); |
---|
3640 | |
---|
3641 | if ( ! yy_start_stack ) |
---|
3642 | YY_FATAL_ERROR( |
---|
3643 | "out of memory expanding start-condition stack" ); |
---|
3644 | } |
---|
3645 | |
---|
3646 | yy_start_stack[yy_start_stack_ptr++] = YY_START; |
---|
3647 | |
---|
3648 | BEGIN(new_state); |
---|
3649 | } |
---|
3650 | #endif |
---|
3651 | |
---|
3652 | |
---|
3653 | #ifndef YY_NO_POP_STATE |
---|
3654 | static void yy_pop_state() |
---|
3655 | { |
---|
3656 | if ( --yy_start_stack_ptr < 0 ) |
---|
3657 | YY_FATAL_ERROR( "start-condition stack underflow" ); |
---|
3658 | |
---|
3659 | BEGIN(yy_start_stack[yy_start_stack_ptr]); |
---|
3660 | } |
---|
3661 | #endif |
---|
3662 | |
---|
3663 | |
---|
3664 | #ifndef YY_NO_TOP_STATE |
---|
3665 | static int yy_top_state() |
---|
3666 | { |
---|
3667 | return yy_start_stack[yy_start_stack_ptr - 1]; |
---|
3668 | } |
---|
3669 | #endif |
---|
3670 | |
---|
3671 | #ifndef YY_EXIT_FAILURE |
---|
3672 | #define YY_EXIT_FAILURE 2 |
---|
3673 | #endif |
---|
3674 | |
---|
3675 | #ifdef YY_USE_PROTOS |
---|
3676 | static void yy_fatal_error( yyconst char msg[] ) |
---|
3677 | #else |
---|
3678 | static void yy_fatal_error( msg ) |
---|
3679 | char msg[]; |
---|
3680 | #endif |
---|
3681 | { |
---|
3682 | (void) fprintf( stderr, "%s\n", msg ); |
---|
3683 | exit( YY_EXIT_FAILURE ); |
---|
3684 | } |
---|
3685 | |
---|
3686 | |
---|
3687 | |
---|
3688 | /* Redefine yyless() so it works in section 3 code. */ |
---|
3689 | |
---|
3690 | #undef yyless |
---|
3691 | #define yyless(n) \ |
---|
3692 | do \ |
---|
3693 | { \ |
---|
3694 | /* Undo effects of setting up yytext. */ \ |
---|
3695 | yytext[yyleng] = yy_hold_char; \ |
---|
3696 | yy_c_buf_p = yytext + n; \ |
---|
3697 | yy_hold_char = *yy_c_buf_p; \ |
---|
3698 | *yy_c_buf_p = '\0'; \ |
---|
3699 | yyleng = n; \ |
---|
3700 | } \ |
---|
3701 | while ( 0 ) |
---|
3702 | |
---|
3703 | |
---|
3704 | /* Internal utility routines. */ |
---|
3705 | |
---|
3706 | #ifndef yytext_ptr |
---|
3707 | #ifdef YY_USE_PROTOS |
---|
3708 | static void yy_flex_strncpy( char *s1, yyconst char *s2, int n ) |
---|
3709 | #else |
---|
3710 | static void yy_flex_strncpy( s1, s2, n ) |
---|
3711 | char *s1; |
---|
3712 | yyconst char *s2; |
---|
3713 | int n; |
---|
3714 | #endif |
---|
3715 | { |
---|
3716 | register int i; |
---|
3717 | for ( i = 0; i < n; ++i ) |
---|
3718 | s1[i] = s2[i]; |
---|
3719 | } |
---|
3720 | #endif |
---|
3721 | |
---|
3722 | #ifdef YY_NEED_STRLEN |
---|
3723 | #ifdef YY_USE_PROTOS |
---|
3724 | static int yy_flex_strlen( yyconst char *s ) |
---|
3725 | #else |
---|
3726 | static int yy_flex_strlen( s ) |
---|
3727 | yyconst char *s; |
---|
3728 | #endif |
---|
3729 | { |
---|
3730 | register int n; |
---|
3731 | for ( n = 0; s[n]; ++n ) |
---|
3732 | ; |
---|
3733 | |
---|
3734 | return n; |
---|
3735 | } |
---|
3736 | #endif |
---|
3737 | |
---|
3738 | |
---|
3739 | #ifdef YY_USE_PROTOS |
---|
3740 | static void *yy_flex_alloc( yy_size_t size ) |
---|
3741 | #else |
---|
3742 | static void *yy_flex_alloc( size ) |
---|
3743 | yy_size_t size; |
---|
3744 | #endif |
---|
3745 | { |
---|
3746 | return (void *) malloc( size ); |
---|
3747 | } |
---|
3748 | |
---|
3749 | #ifdef YY_USE_PROTOS |
---|
3750 | static void *yy_flex_realloc( void *ptr, yy_size_t size ) |
---|
3751 | #else |
---|
3752 | static void *yy_flex_realloc( ptr, size ) |
---|
3753 | void *ptr; |
---|
3754 | yy_size_t size; |
---|
3755 | #endif |
---|
3756 | { |
---|
3757 | /* The cast to (char *) in the following accommodates both |
---|
3758 | * implementations that use char* generic pointers, and those |
---|
3759 | * that use void* generic pointers. It works with the latter |
---|
3760 | * because both ANSI C and C++ allow castless assignment from |
---|
3761 | * any pointer type to void*, and deal with argument conversions |
---|
3762 | * as though doing an assignment. |
---|
3763 | */ |
---|
3764 | return (void *) realloc( (char *) ptr, size ); |
---|
3765 | } |
---|
3766 | |
---|
3767 | #ifdef YY_USE_PROTOS |
---|
3768 | static void yy_flex_free( void *ptr ) |
---|
3769 | #else |
---|
3770 | static void yy_flex_free( ptr ) |
---|
3771 | void *ptr; |
---|
3772 | #endif |
---|
3773 | { |
---|
3774 | free( ptr ); |
---|
3775 | } |
---|
3776 | |
---|
3777 | #if YY_MAIN |
---|
3778 | int main() |
---|
3779 | { |
---|
3780 | yylex(); |
---|
3781 | return 0; |
---|
3782 | } |
---|
3783 | #endif |
---|
3784 | #line 1695 "vs1.0_tokens.l" |
---|
3785 | |
---|
3786 | |
---|
3787 | |
---|
3788 | //===================================================================== |
---|
3789 | // Function: FindNMacro |
---|
3790 | // Description: Look through macros and see if it had been predefined |
---|
3791 | // Parameters: findName = name to lookup |
---|
3792 | // sLen = # characters valid in source (findName) |
---|
3793 | // Returns: MACROENTRY * = pointer to macro entry if found |
---|
3794 | //===================================================================== |
---|
3795 | MACROENTRY *FindNMacro(char *findName, unsigned int sLen) |
---|
3796 | { |
---|
3797 | MACROENTRY *curEntry; |
---|
3798 | |
---|
3799 | curEntry = gLastMacro; |
---|
3800 | while (curEntry != NULL) |
---|
3801 | { |
---|
3802 | if (strlen(curEntry->macroName) == sLen) |
---|
3803 | { |
---|
3804 | if (!strncmp(curEntry->macroName, findName, sLen)) |
---|
3805 | { |
---|
3806 | break; |
---|
3807 | } |
---|
3808 | } |
---|
3809 | |
---|
3810 | curEntry = curEntry->prev; |
---|
3811 | } |
---|
3812 | |
---|
3813 | return curEntry; |
---|
3814 | |
---|
3815 | } |
---|
3816 | |
---|
3817 | //===================================================================== |
---|
3818 | // Function: FindMacro |
---|
3819 | // Description: Look through macros and see if it had been predefined |
---|
3820 | // Parameters: findName = name to lookup |
---|
3821 | // Returns: MACROENTRY * = pointer to macro entry if found |
---|
3822 | //===================================================================== |
---|
3823 | MACROENTRY *FindMacro(char *findName) |
---|
3824 | { |
---|
3825 | MACROENTRY *curEntry; |
---|
3826 | |
---|
3827 | curEntry = gLastMacro; |
---|
3828 | while (curEntry != NULL) |
---|
3829 | { |
---|
3830 | if (!strcmp(curEntry->macroName, findName)) |
---|
3831 | { |
---|
3832 | break; |
---|
3833 | } |
---|
3834 | |
---|
3835 | curEntry = curEntry->prev; |
---|
3836 | } |
---|
3837 | |
---|
3838 | return curEntry; |
---|
3839 | |
---|
3840 | } |
---|
3841 | |
---|
3842 | //===================================================================== |
---|
3843 | // Function: CleanUp |
---|
3844 | // Description: Clean up the #define strings |
---|
3845 | // Parameters: . |
---|
3846 | // Returns: . |
---|
3847 | //===================================================================== |
---|
3848 | void CleanUp() |
---|
3849 | { |
---|
3850 | void *tPtr; |
---|
3851 | |
---|
3852 | // free up the macros that were alloced |
---|
3853 | while (gLastMacro != NULL) |
---|
3854 | { |
---|
3855 | |
---|
3856 | FreeMacroEntry(gLastMacro); |
---|
3857 | |
---|
3858 | tPtr = gLastMacro; |
---|
3859 | gLastMacro = gLastMacro->prev; |
---|
3860 | SAFEFREE(tPtr); |
---|
3861 | } |
---|
3862 | |
---|
3863 | } |
---|
3864 | |
---|
3865 | //===================================================================== |
---|
3866 | // Function: FreeMacroEntry |
---|
3867 | // Description: Frees up the macro entry data, (parms, lines of text) |
---|
3868 | // Parameters: macEntry = pointer to the MACROENTRY structure |
---|
3869 | // Returns: . |
---|
3870 | //===================================================================== |
---|
3871 | void FreeMacroEntry(MACROENTRY *macEntry) |
---|
3872 | { |
---|
3873 | MACROTEXT *tText; |
---|
3874 | MACROTEXT *tNext; |
---|
3875 | |
---|
3876 | SAFEFREE(macEntry->macroName); |
---|
3877 | SAFEFREE(macEntry->fileName); |
---|
3878 | // free the macro lines that were alloced |
---|
3879 | tText = macEntry->lastMacroLines; |
---|
3880 | while (tText != NULL) |
---|
3881 | { |
---|
3882 | tNext = tText->prev; |
---|
3883 | SAFEFREE(tText); |
---|
3884 | tText = tNext; |
---|
3885 | } |
---|
3886 | |
---|
3887 | // free the text of the macro parms that were alloced |
---|
3888 | tText = macEntry->lastMacroParms; |
---|
3889 | while (tText != NULL) |
---|
3890 | { |
---|
3891 | tNext = tText->prev; |
---|
3892 | SAFEFREE(tText); |
---|
3893 | tText = tNext; |
---|
3894 | } |
---|
3895 | } |
---|
3896 | |
---|
3897 | //===================================================================== |
---|
3898 | // Function: CheckMacroFunctions |
---|
3899 | // Description: Find if this text is a builtin macro function |
---|
3900 | // Parameters: lookString = non-null terminated string of possible |
---|
3901 | // and if found set global macro function call |
---|
3902 | // Returns: . |
---|
3903 | //===================================================================== |
---|
3904 | void CheckMacroFunctions(char *lookString, unsigned int *recognizedLen, char **invString) |
---|
3905 | { |
---|
3906 | |
---|
3907 | unsigned int i; |
---|
3908 | unsigned int sLen; |
---|
3909 | |
---|
3910 | for (i=0; i< NUM_MACRO_FUNCTIONS; i++) |
---|
3911 | { |
---|
3912 | sLen = strlen(gMacroFunctions[i].name); |
---|
3913 | if (!strncmp(gMacroFunctions[i].name, lookString, sLen)) |
---|
3914 | { |
---|
3915 | gMacroCallFunction = gMacroFunctions[i].function; |
---|
3916 | *recognizedLen = sLen; |
---|
3917 | *invString = NULL; |
---|
3918 | return; |
---|
3919 | } |
---|
3920 | } |
---|
3921 | } |
---|
3922 | |
---|
3923 | //===================================================================== |
---|
3924 | // Function: FindAlphaNum |
---|
3925 | // Description: Find a whole alpha numeric string, ie consists of |
---|
3926 | // [A-Za-z0-9_] only |
---|
3927 | // Parameters: srcStr = source string to search through. |
---|
3928 | // sLen = unsinged int pointer to length of string found |
---|
3929 | // Returns: pointer to found start of string. |
---|
3930 | // NULL if none. |
---|
3931 | //===================================================================== |
---|
3932 | char *FindAlphaNum(char *srcStr, unsigned int *sLen) |
---|
3933 | { |
---|
3934 | char curChar; |
---|
3935 | char *foundStr; |
---|
3936 | |
---|
3937 | while (*srcStr != '\0') |
---|
3938 | { |
---|
3939 | curChar = toupper(*srcStr); |
---|
3940 | if ((curChar >= 'A') && (curChar <= 'Z')) |
---|
3941 | break; |
---|
3942 | |
---|
3943 | if ((curChar >= '0') && (curChar <='9')) |
---|
3944 | break; |
---|
3945 | |
---|
3946 | if (curChar == '_') |
---|
3947 | break; |
---|
3948 | |
---|
3949 | srcStr++; |
---|
3950 | } |
---|
3951 | |
---|
3952 | if (*srcStr == '\0') |
---|
3953 | { |
---|
3954 | return NULL; |
---|
3955 | } |
---|
3956 | |
---|
3957 | foundStr = srcStr; |
---|
3958 | |
---|
3959 | *sLen = 0; |
---|
3960 | // now search for end of string of [A-Za-z0-9_] |
---|
3961 | while (*srcStr != '\0') |
---|
3962 | { |
---|
3963 | curChar = toupper(*srcStr); |
---|
3964 | if ((curChar < 'A') || (curChar > 'Z')) |
---|
3965 | { |
---|
3966 | if ((curChar < '0') || (curChar > '9')) |
---|
3967 | { |
---|
3968 | if (curChar != '_') |
---|
3969 | break; |
---|
3970 | } |
---|
3971 | } |
---|
3972 | |
---|
3973 | (*sLen)++; |
---|
3974 | srcStr++; |
---|
3975 | } |
---|
3976 | |
---|
3977 | return foundStr; |
---|
3978 | |
---|
3979 | } |
---|
3980 | |
---|
3981 | //===================================================================== |
---|
3982 | // Function: FindDefineParm |
---|
3983 | // Description: Find if the MACROENTRY->macroText linked list contains |
---|
3984 | // replaceable parameters. |
---|
3985 | // Parameters: srcParms = pointer to MACROENTRY structure for source |
---|
3986 | // parameters |
---|
3987 | // invParms = MACROENTRY pointer to invocation parameters |
---|
3988 | // lookString = non-null terminated string of possible |
---|
3989 | // replaceable string |
---|
3990 | // recognizedLen = replacement string matched length |
---|
3991 | // invString = invocation string to replace with |
---|
3992 | // Returns: pointer to first character found in lookstring |
---|
3993 | //===================================================================== |
---|
3994 | char *FindDefineParm(MACROENTRY *srcParms, MACROENTRY *invParms, |
---|
3995 | char *lookString, unsigned int *recognizedLen, char **invString) |
---|
3996 | { |
---|
3997 | MACROTEXT *srcText; |
---|
3998 | MACROTEXT *invText; |
---|
3999 | char *checkStr; |
---|
4000 | unsigned int checkLen; |
---|
4001 | unsigned int sLen; |
---|
4002 | |
---|
4003 | checkStr = lookString; |
---|
4004 | *invString = NULL; |
---|
4005 | |
---|
4006 | // first search for first [A-Za-z0-9_] only string |
---|
4007 | checkStr = FindAlphaNum(lookString, &checkLen); |
---|
4008 | |
---|
4009 | while (checkStr != NULL) |
---|
4010 | { |
---|
4011 | // check all the #define parameters for match |
---|
4012 | srcText = srcParms->firstMacroParms; |
---|
4013 | invText = invParms->firstMacroParms; |
---|
4014 | while (srcText) |
---|
4015 | { |
---|
4016 | sLen = strlen(srcText->macroText); |
---|
4017 | // lengths should match |
---|
4018 | if (sLen == checkLen) |
---|
4019 | { |
---|
4020 | if (!strncmp(checkStr, srcText->macroText, checkLen)) |
---|
4021 | { |
---|
4022 | // it matched so return replacement text |
---|
4023 | *invString = invText->macroText; |
---|
4024 | // and length that we reconized |
---|
4025 | *recognizedLen = checkLen; |
---|
4026 | return checkStr; |
---|
4027 | } |
---|
4028 | } |
---|
4029 | |
---|
4030 | srcText = srcText->next; |
---|
4031 | invText = invText->next; |
---|
4032 | } |
---|
4033 | |
---|
4034 | // not found yet, so go to next string. |
---|
4035 | checkStr = FindAlphaNum(checkStr+checkLen, &checkLen); |
---|
4036 | } |
---|
4037 | |
---|
4038 | return NULL; |
---|
4039 | } |
---|
4040 | |
---|
4041 | //===================================================================== |
---|
4042 | // Function: FindReplaceParm |
---|
4043 | // Description: Find if the MACROENTRY->macroText linked list contains |
---|
4044 | // a replaceable parameters. |
---|
4045 | // Parameters: srcParms = pointer to MACROENTRY structure for source |
---|
4046 | // parameters |
---|
4047 | // invParms = MACROENTRY pointer to invocation parameters |
---|
4048 | // lookString = non-null terminated string of possible |
---|
4049 | // replaceable string |
---|
4050 | // recognizedLen = replacement string matched length |
---|
4051 | // invString = invocation string to replace with |
---|
4052 | // Returns: . |
---|
4053 | //===================================================================== |
---|
4054 | void FindReplaceParm(MACROENTRY *srcParms, MACROENTRY *invParms, |
---|
4055 | char *lookString, unsigned int *recognizedLen, char **invString) |
---|
4056 | { |
---|
4057 | unsigned int sLen; |
---|
4058 | MACROTEXT *srcText; |
---|
4059 | MACROTEXT *invText; |
---|
4060 | |
---|
4061 | *recognizedLen = 0; |
---|
4062 | *invString = NULL; |
---|
4063 | |
---|
4064 | srcText = srcParms->firstMacroParms; |
---|
4065 | invText = invParms->firstMacroParms; |
---|
4066 | |
---|
4067 | if (srcText != NULL) |
---|
4068 | { |
---|
4069 | // go until srcText # strings ends |
---|
4070 | while (srcText != NULL) |
---|
4071 | { |
---|
4072 | sLen = strlen(srcText->macroText); |
---|
4073 | if (!strncmp(srcText->macroText, lookString, sLen)) |
---|
4074 | { |
---|
4075 | // found it so return src, replacement string |
---|
4076 | *recognizedLen = strlen(srcText->macroText); |
---|
4077 | *invString = invText->macroText; |
---|
4078 | // call function macro if it was invoked prior. |
---|
4079 | if (gMacroCallFunction != NULL) |
---|
4080 | { |
---|
4081 | gMacroCallFunction(lookString, recognizedLen, invString); |
---|
4082 | gMacroCallFunction = NULL; |
---|
4083 | } |
---|
4084 | return; |
---|
4085 | } |
---|
4086 | |
---|
4087 | srcText = srcText->next; |
---|
4088 | invText = invText->next; |
---|
4089 | } |
---|
4090 | } |
---|
4091 | |
---|
4092 | // ok, it wasn't found, look through builtin macro functions |
---|
4093 | CheckMacroFunctions(lookString, recognizedLen, invString); |
---|
4094 | } |
---|
4095 | |
---|
4096 | //===================================================================== |
---|
4097 | // Function: ReplaceMacroParms |
---|
4098 | // Description: Replace macro parameters when macro was defined, with |
---|
4099 | // those specified on the macro invocation line |
---|
4100 | // Parameters: srcLine = source line to replace src macro parms with |
---|
4101 | // destLine = destination line save to. |
---|
4102 | // invocation macro parameters. |
---|
4103 | // parseMacro = currently parsing macro entry |
---|
4104 | // invParms = invocation macro entry |
---|
4105 | // Returns: . |
---|
4106 | //===================================================================== |
---|
4107 | void ReplaceMacroParms(char *srcLine, char *destLine, |
---|
4108 | MACROENTRY *srcParms, MACROENTRY *invParms) |
---|
4109 | { |
---|
4110 | char *findReplace; |
---|
4111 | char *invString; |
---|
4112 | unsigned int sLen; |
---|
4113 | unsigned int dLen; |
---|
4114 | unsigned int copyLen; |
---|
4115 | unsigned int subLen; |
---|
4116 | unsigned int recognizedLen; |
---|
4117 | |
---|
4118 | destLine[0]= '\0'; |
---|
4119 | |
---|
4120 | sLen = strlen(srcLine); |
---|
4121 | dLen = 0; |
---|
4122 | |
---|
4123 | while (sLen > 0) |
---|
4124 | { |
---|
4125 | // strtok might work better except it modifies the string, so |
---|
4126 | // kind of do my own.... |
---|
4127 | if (!srcParms->bIsDefine) |
---|
4128 | { |
---|
4129 | findReplace = strchr(srcLine, '%'); |
---|
4130 | if (findReplace != NULL) |
---|
4131 | { |
---|
4132 | // bypass % sign in findReplacement |
---|
4133 | findReplace++; |
---|
4134 | // figure out length of source before % |
---|
4135 | copyLen = (findReplace - srcLine)-1; |
---|
4136 | // check if there is a replacement string |
---|
4137 | FindReplaceParm(srcParms, invParms, findReplace, &recognizedLen, &invString); |
---|
4138 | } |
---|
4139 | else |
---|
4140 | { |
---|
4141 | strcat(destLine, srcLine); |
---|
4142 | return; |
---|
4143 | } |
---|
4144 | } |
---|
4145 | else |
---|
4146 | { |
---|
4147 | findReplace = FindDefineParm(srcParms, invParms, srcLine, &recognizedLen, &invString); |
---|
4148 | if (findReplace != NULL) |
---|
4149 | { |
---|
4150 | // figure out length of source before % |
---|
4151 | copyLen = findReplace - srcLine; |
---|
4152 | } |
---|
4153 | else |
---|
4154 | { |
---|
4155 | strcat(destLine, srcLine); |
---|
4156 | return; |
---|
4157 | } |
---|
4158 | } |
---|
4159 | |
---|
4160 | |
---|
4161 | if (invString != NULL) |
---|
4162 | { |
---|
4163 | // figure out how much we are going to substitute |
---|
4164 | subLen = strlen(invString); |
---|
4165 | } |
---|
4166 | else |
---|
4167 | { |
---|
4168 | subLen = 0; |
---|
4169 | } |
---|
4170 | |
---|
4171 | if ((dLen + copyLen + subLen) > MAXSAVELINE) |
---|
4172 | { |
---|
4173 | LexError("Macro string overrun.\n"); |
---|
4174 | CleanUp(); |
---|
4175 | exit(ERROR_MACRO_OVERRUN); |
---|
4176 | } |
---|
4177 | |
---|
4178 | if (copyLen > 0) |
---|
4179 | { |
---|
4180 | strncat(destLine, srcLine, copyLen); |
---|
4181 | dLen += copyLen; |
---|
4182 | } |
---|
4183 | |
---|
4184 | srcLine += copyLen; |
---|
4185 | sLen -= copyLen; |
---|
4186 | // in macro so skip % part of variable |
---|
4187 | if (!srcParms->bIsDefine) |
---|
4188 | { |
---|
4189 | // skip %, also |
---|
4190 | srcLine++; |
---|
4191 | sLen--; |
---|
4192 | } |
---|
4193 | |
---|
4194 | if (invString != NULL) |
---|
4195 | { |
---|
4196 | strcat(destLine, invString); |
---|
4197 | dLen += strlen(invString); |
---|
4198 | } |
---|
4199 | |
---|
4200 | srcLine += recognizedLen; |
---|
4201 | sLen -= recognizedLen; |
---|
4202 | } |
---|
4203 | |
---|
4204 | } |
---|
4205 | |
---|
4206 | //===================================================================== |
---|
4207 | // Function: SaveMacroText |
---|
4208 | // Description: Adds a string to a linked list of MACROTEXT structures |
---|
4209 | // Parameters: srcText = pointer to source text to save |
---|
4210 | // lastMacroText = last allocated, or NULL |
---|
4211 | // Returns: newly allocated MACROTEXT structure, or NULL |
---|
4212 | //===================================================================== |
---|
4213 | MACROTEXT *SaveMacroText(char *srcText, MACROTEXT *lastMacroText) |
---|
4214 | { |
---|
4215 | MACROTEXT *curMacroText; |
---|
4216 | |
---|
4217 | curMacroText = (MACROTEXT *)malloc(sizeof(MACROTEXT)); |
---|
4218 | if (curMacroText == NULL) |
---|
4219 | { |
---|
4220 | return NULL; |
---|
4221 | } |
---|
4222 | else |
---|
4223 | { |
---|
4224 | // no next entry but set up previous with previously alloced macro parameter |
---|
4225 | curMacroText->next = NULL; |
---|
4226 | curMacroText->prev = lastMacroText; |
---|
4227 | |
---|
4228 | // if the macroParm pointer is null then we are the first allocated |
---|
4229 | // so if not set the last one allocate next pointer to newly allocated structure |
---|
4230 | if (lastMacroText != NULL) |
---|
4231 | { |
---|
4232 | lastMacroText->next = curMacroText; |
---|
4233 | } |
---|
4234 | |
---|
4235 | /* %%%%% this should be set up in memory pools. */ |
---|
4236 | curMacroText->macroText = strdup(srcText); |
---|
4237 | if (curMacroText->macroText == NULL) |
---|
4238 | { |
---|
4239 | SAFEFREE(curMacroText); |
---|
4240 | return NULL; |
---|
4241 | } |
---|
4242 | } |
---|
4243 | |
---|
4244 | return curMacroText; |
---|
4245 | } |
---|
4246 | |
---|
4247 | //===================================================================== |
---|
4248 | // Function: ParseBuiltInMacroParms |
---|
4249 | // Description: parse parameters of string and fill in MACROENTRY |
---|
4250 | // structure. |
---|
4251 | // Parameters: parsedMacro = pointer to MACROENTRY structure that gets |
---|
4252 | // filled in with parameter pointers and count |
---|
4253 | // parmStr = string to parse parameters from |
---|
4254 | // Returns: false if error |
---|
4255 | //===================================================================== |
---|
4256 | bool ParseBuiltInMacroParms(MACROENTRY *parsedMacro, char *parmStr) |
---|
4257 | { |
---|
4258 | char *endStr; |
---|
4259 | char *foundParm; |
---|
4260 | MACROTEXT *prevMT; |
---|
4261 | MACROTEXT *curMT; |
---|
4262 | |
---|
4263 | parsedMacro->numParms = 0; |
---|
4264 | parsedMacro->firstMacroParms = NULL; |
---|
4265 | |
---|
4266 | foundParm = strdup(parmStr); |
---|
4267 | if (foundParm == NULL) |
---|
4268 | { |
---|
4269 | LexError("Out of memory parsing bultin macro parameters.\n"); |
---|
4270 | return false; |
---|
4271 | } |
---|
4272 | |
---|
4273 | // assume a ')' is on the end. |
---|
4274 | endStr = strrchr(foundParm, ')'); |
---|
4275 | if (endStr == NULL) |
---|
4276 | { |
---|
4277 | LexWarning("Ending parenthesis not found for macro %s.\n", parsedMacro->macroName); |
---|
4278 | endStr = foundParm + strlen(foundParm); |
---|
4279 | } |
---|
4280 | |
---|
4281 | prevMT = NULL; |
---|
4282 | // strip out and seperate parameters |
---|
4283 | while (foundParm < endStr) |
---|
4284 | { |
---|
4285 | // allocate a macro text structure |
---|
4286 | curMT = (MACROTEXT *)malloc(sizeof(MACROTEXT)); |
---|
4287 | if (curMT == NULL) |
---|
4288 | { |
---|
4289 | free(parmStr); |
---|
4290 | LexError("Out of memory parsing bultin macro parameters.\n"); |
---|
4291 | return false; |
---|
4292 | } |
---|
4293 | curMT->next = NULL; |
---|
4294 | curMT->prev = prevMT; |
---|
4295 | parsedMacro->numParms++; |
---|
4296 | |
---|
4297 | if (prevMT != NULL) |
---|
4298 | { |
---|
4299 | prevMT->next = curMT; |
---|
4300 | } |
---|
4301 | else |
---|
4302 | { |
---|
4303 | parsedMacro->firstMacroParms = curMT; |
---|
4304 | } |
---|
4305 | |
---|
4306 | curMT->macroText = foundParm; |
---|
4307 | // search for next parameters, delimited by comma |
---|
4308 | foundParm = strchr(foundParm, ','); |
---|
4309 | if (foundParm == NULL) |
---|
4310 | { |
---|
4311 | foundParm = endStr; |
---|
4312 | *foundParm = '\0'; |
---|
4313 | } |
---|
4314 | else |
---|
4315 | { |
---|
4316 | // skip comma |
---|
4317 | *foundParm = '\0'; |
---|
4318 | foundParm++; |
---|
4319 | } |
---|
4320 | prevMT = curMT; |
---|
4321 | } |
---|
4322 | |
---|
4323 | return true; |
---|
4324 | } |
---|
4325 | |
---|
4326 | //===================================================================== |
---|
4327 | // Function: MacroMathFunction |
---|
4328 | // Description: Comes here after macro replacement is done to perform |
---|
4329 | // some mathematic function on parameter (macro replacement |
---|
4330 | // string (ie, register)) |
---|
4331 | // Parameters: invMacro = macroentry pointer containing macro information |
---|
4332 | // recognizedLen = # characters recoginized so far |
---|
4333 | // invStr = invoked replacement string so far |
---|
4334 | // mathStr = "-", "+", etc for mathematic function |
---|
4335 | // Returns: new recognizedLen, invStr, with incremented # |
---|
4336 | //===================================================================== |
---|
4337 | void MacroMathFunction(MACROENTRY *invMacro, unsigned int *recognizedLen, char **invStr, |
---|
4338 | char *mathStr) |
---|
4339 | { |
---|
4340 | char *numStartStr; |
---|
4341 | unsigned int sLen; |
---|
4342 | char numberStr[256]; |
---|
4343 | unsigned int number; |
---|
4344 | char *operand; |
---|
4345 | |
---|
4346 | |
---|
4347 | // verify enough paramters to complete operation |
---|
4348 | if (invMacro->numParms != 2) |
---|
4349 | { |
---|
4350 | LexError("Two parameters are required for %s macro\n", invMacro->macroName); |
---|
4351 | return; |
---|
4352 | } |
---|
4353 | |
---|
4354 | // get second macro parm, which is add by amount. |
---|
4355 | operand = invMacro->firstMacroParms->next->macroText; |
---|
4356 | |
---|
4357 | // first find inner most bracket if any |
---|
4358 | numStartStr = strrchr(*invStr, ']'); |
---|
4359 | if (numStartStr == NULL) |
---|
4360 | { |
---|
4361 | numStartStr = strrchr(*invStr, ')'); |
---|
4362 | } |
---|
4363 | |
---|
4364 | if (numStartStr != NULL) |
---|
4365 | { |
---|
4366 | if ((strlen(*invStr)+strlen(operand)+1) > MAXREPLACESTRING) |
---|
4367 | { |
---|
4368 | LexError("Out of Temporary string replacement memory inside builtin macro %s\n", |
---|
4369 | invMacro->macroName); |
---|
4370 | } |
---|
4371 | else |
---|
4372 | { |
---|
4373 | sLen = (numStartStr - *invStr); |
---|
4374 | gReplaceText[0] = '\0'; |
---|
4375 | strncat(gReplaceText, *invStr, sLen); |
---|
4376 | strcat(gReplaceText, mathStr); |
---|
4377 | strcat(gReplaceText, operand); |
---|
4378 | strcat(gReplaceText, numStartStr); |
---|
4379 | *invStr = gReplaceText; |
---|
4380 | } |
---|
4381 | } |
---|
4382 | else |
---|
4383 | { |
---|
4384 | numStartStr = strpbrk(*invStr, "0123456789"); |
---|
4385 | if (numStartStr != NULL) |
---|
4386 | { |
---|
4387 | // put up to number we found |
---|
4388 | sLen = numStartStr - *invStr; |
---|
4389 | if (sLen > MAXREPLACESTRING) |
---|
4390 | goto ErrOut; |
---|
4391 | |
---|
4392 | gReplaceText[0] = '\0'; |
---|
4393 | strncat(gReplaceText, *invStr, sLen); |
---|
4394 | |
---|
4395 | switch (mathStr[0]) |
---|
4396 | { |
---|
4397 | case '-': |
---|
4398 | number = atoi(numStartStr)-atoi(operand); |
---|
4399 | break; |
---|
4400 | case '+': |
---|
4401 | number = atoi(numStartStr)+atoi(operand); |
---|
4402 | break; |
---|
4403 | } |
---|
4404 | sprintf(numberStr, "%d", number); |
---|
4405 | |
---|
4406 | if ((strlen(gReplaceText) + strlen(numberStr)) > MAXREPLACESTRING) |
---|
4407 | goto ErrOut; |
---|
4408 | |
---|
4409 | strcat(gReplaceText, numberStr); |
---|
4410 | |
---|
4411 | while ((*numStartStr != '\0') && (*numStartStr >= '0' && *numStartStr <= '9')) |
---|
4412 | numStartStr++; |
---|
4413 | |
---|
4414 | if ((strlen(gReplaceText) + strlen(numStartStr)) > MAXREPLACESTRING) |
---|
4415 | goto ErrOut; |
---|
4416 | |
---|
4417 | strcat(gReplaceText, numStartStr); |
---|
4418 | |
---|
4419 | *invStr = gReplaceText; |
---|
4420 | } |
---|
4421 | else |
---|
4422 | { |
---|
4423 | if ((strlen(*invStr)+strlen(operand)+1) > MAXREPLACESTRING) |
---|
4424 | { |
---|
4425 | LexError("Out of Temporary string replacement memory inside builtin macro %s\n", |
---|
4426 | invMacro->macroName); |
---|
4427 | } |
---|
4428 | else |
---|
4429 | { |
---|
4430 | sprintf(gReplaceText, "%s%s%s", *invStr, mathStr, operand); |
---|
4431 | *invStr = gReplaceText; |
---|
4432 | } |
---|
4433 | } |
---|
4434 | } |
---|
4435 | |
---|
4436 | |
---|
4437 | return; |
---|
4438 | |
---|
4439 | ErrOut: |
---|
4440 | LexError("Out of Temporary string replacement memory inside builtin macro %s\n", |
---|
4441 | invMacro->macroName); |
---|
4442 | // skip ')' |
---|
4443 | (*recognizedLen)++; |
---|
4444 | } |
---|
4445 | |
---|
4446 | //===================================================================== |
---|
4447 | // Function: MacroIncFunction |
---|
4448 | // Description: Comes here after macro replacement is done to increment |
---|
4449 | // macro replacement string (ie, register) |
---|
4450 | // Parameters: lookStr = string after '(', so we can get parameters |
---|
4451 | // recognizedLen = # characters recoginized so far |
---|
4452 | // invStr = invoked replacement string so far |
---|
4453 | // Returns: new recognizedLen, invStr, with incremented # |
---|
4454 | //===================================================================== |
---|
4455 | void MacroIncFunction(char *lookStr, unsigned int *recognizedLen, char **invStr) |
---|
4456 | { |
---|
4457 | MACROENTRY tMEntry; |
---|
4458 | MACROTEXT parm1; |
---|
4459 | MACROTEXT parm2; |
---|
4460 | |
---|
4461 | tMEntry.macroName = "%inc()"; |
---|
4462 | tMEntry.numParms = 2; |
---|
4463 | tMEntry.firstMacroParms = &parm1; |
---|
4464 | parm1.prev = NULL; |
---|
4465 | parm1.next = &parm2; |
---|
4466 | parm1.macroText = *invStr; |
---|
4467 | parm2.prev = &parm1; |
---|
4468 | parm2.next = NULL; |
---|
4469 | parm2.macroText = "1"; |
---|
4470 | |
---|
4471 | MacroMathFunction(&tMEntry, recognizedLen, invStr, "+"); |
---|
4472 | // skip ')' |
---|
4473 | (*recognizedLen)++; |
---|
4474 | } |
---|
4475 | |
---|
4476 | //===================================================================== |
---|
4477 | // Function: MacroDecFunction |
---|
4478 | // Description: Comes here after macro replacement is done to decrement |
---|
4479 | // macro replacement string (ie, register) |
---|
4480 | // Parameters: lookStr = string after '(', so we can get parameters |
---|
4481 | // recognizedLen = # characters recoginized so far |
---|
4482 | // invStr = invoked replacement string so far |
---|
4483 | // Returns: new recognizedLen, invStr, with decremented # |
---|
4484 | //===================================================================== |
---|
4485 | void MacroDecFunction(char *lookStr, unsigned int *recognizedLen, char **invStr) |
---|
4486 | { |
---|
4487 | MACROENTRY tMEntry; |
---|
4488 | MACROTEXT parm1; |
---|
4489 | MACROTEXT parm2; |
---|
4490 | |
---|
4491 | tMEntry.macroName = "%dec()"; |
---|
4492 | tMEntry.numParms = 2; |
---|
4493 | tMEntry.firstMacroParms = &parm1; |
---|
4494 | parm1.prev = NULL; |
---|
4495 | parm1.next = &parm2; |
---|
4496 | parm1.macroText = *invStr; |
---|
4497 | parm2.prev = &parm1; |
---|
4498 | parm2.next = NULL; |
---|
4499 | parm2.macroText = "1"; |
---|
4500 | |
---|
4501 | MacroMathFunction(&tMEntry, recognizedLen, invStr, "-"); |
---|
4502 | // skip ')' |
---|
4503 | (*recognizedLen)++; |
---|
4504 | } |
---|
4505 | |
---|
4506 | //===================================================================== |
---|
4507 | // Function: MacroAddFunction |
---|
4508 | // Description: Comes here after macro replacement is done to add |
---|
4509 | // macro replacement string (ie, register) |
---|
4510 | // Parameters: lookStr = string after '(', so we can get parameters |
---|
4511 | // recognizedLen = # characters recoginized so far |
---|
4512 | // invStr = invoked replacement string so far |
---|
4513 | // Returns: new recognizedLen, invStr, with incremented # |
---|
4514 | //===================================================================== |
---|
4515 | void MacroAddFunction(char *lookStr, unsigned int *recognizedLen, char **invStr) |
---|
4516 | { |
---|
4517 | MACROENTRY tMEntry; |
---|
4518 | MACROTEXT *curMT; |
---|
4519 | MACROTEXT *nextMT; |
---|
4520 | unsigned int i; |
---|
4521 | |
---|
4522 | tMEntry.macroName = "%add()"; |
---|
4523 | if (strlen(lookStr) > MAXREPLACESTRING) |
---|
4524 | { |
---|
4525 | LexError("Out of Temporary string replacement memory inside builtin macro %add()\n"); |
---|
4526 | return; |
---|
4527 | } |
---|
4528 | if (ParseBuiltInMacroParms(&tMEntry, lookStr)) |
---|
4529 | { |
---|
4530 | MacroMathFunction(&tMEntry, recognizedLen, invStr, "+"); |
---|
4531 | // skip ',' strlen(parm2)+ ')' |
---|
4532 | (*recognizedLen) += strlen(tMEntry.firstMacroParms->next->macroText)+2; |
---|
4533 | } |
---|
4534 | |
---|
4535 | curMT = tMEntry.firstMacroParms; |
---|
4536 | // in this case only one string was allocated |
---|
4537 | free(curMT->macroText); |
---|
4538 | for (i=0; i<tMEntry.numParms; i++) |
---|
4539 | { |
---|
4540 | nextMT = curMT->next; |
---|
4541 | free(curMT); |
---|
4542 | curMT = nextMT; |
---|
4543 | } |
---|
4544 | } |
---|
4545 | |
---|
4546 | //===================================================================== |
---|
4547 | // Function: MacroSubFunction |
---|
4548 | // Description: Comes here after macro replacement is done to subtract |
---|
4549 | // macro replacement string (ie, register) |
---|
4550 | // Parameters: invParms, parameters that macro was invoked with |
---|
4551 | // recognizedLen = # characters recoginized so far |
---|
4552 | // invStr = invoked replacement string so far |
---|
4553 | // Returns: new recognizedLen, invStr, with incremented # |
---|
4554 | //===================================================================== |
---|
4555 | void MacroSubFunction(char *lookStr, unsigned int *recognizedLen, char **invStr) |
---|
4556 | { |
---|
4557 | MACROENTRY tMEntry; |
---|
4558 | MACROTEXT *curMT; |
---|
4559 | MACROTEXT *nextMT; |
---|
4560 | unsigned int i; |
---|
4561 | |
---|
4562 | tMEntry.macroName = "%sub()"; |
---|
4563 | if (ParseBuiltInMacroParms(&tMEntry, lookStr)) |
---|
4564 | { |
---|
4565 | MacroMathFunction(&tMEntry, recognizedLen, invStr, "-"); |
---|
4566 | // skip ',' strlen(parm2)+ ')' |
---|
4567 | (*recognizedLen) += strlen(tMEntry.firstMacroParms->next->macroText)+2; |
---|
4568 | } |
---|
4569 | curMT = tMEntry.firstMacroParms; |
---|
4570 | // in this case only one string was allocated |
---|
4571 | free(curMT->macroText); |
---|
4572 | for (i=0; i<tMEntry.numParms; i++) |
---|
4573 | { |
---|
4574 | nextMT = curMT->next; |
---|
4575 | free(curMT); |
---|
4576 | curMT = nextMT; |
---|
4577 | } |
---|
4578 | } |
---|
4579 | |
---|
4580 | //===================================================================== |
---|
4581 | // Function: EndMacroParms |
---|
4582 | // Description: Does update and cleanup one end of macro parameters |
---|
4583 | // is reached |
---|
4584 | // Parameters: . |
---|
4585 | // Returns: . |
---|
4586 | //===================================================================== |
---|
4587 | void EndMacroParms() |
---|
4588 | { |
---|
4589 | char *curFileName; |
---|
4590 | char *macroFileName; |
---|
4591 | char tempStr[1024]; |
---|
4592 | char *macroText; |
---|
4593 | |
---|
4594 | if (gbTempInsideMacro) |
---|
4595 | { |
---|
4596 | if (gTempParseMacro->numParms != gTempMacro->numParms) |
---|
4597 | { |
---|
4598 | LexError("Macro invocation number of parameters do not match macro definition, skipping\n"); |
---|
4599 | BEGIN(INITIAL); |
---|
4600 | SAFEFREE(gTempMacro); |
---|
4601 | } |
---|
4602 | else |
---|
4603 | { |
---|
4604 | // we got all the parameters for the MACRO invocation, so start inside |
---|
4605 | // the macro now, by saving off current state on stack |
---|
4606 | gIncludeStack[gIncludeStackIndex].lineNo = yylineno; |
---|
4607 | gIncludeStack[gIncludeStackIndex].fileName = gCurFileName; |
---|
4608 | // gIncludeStack[gIncludeStackIndex].fileHandle = yyin; |
---|
4609 | //fprintf( stderr, "Chris fix this code with myin stuff\n" ); |
---|
4610 | gIncludeStack[gIncludeStackIndex].prevString = myin; |
---|
4611 | gIncludeStack[gIncludeStackIndex].nextString = NULL; |
---|
4612 | gIncludeStack[gIncludeStackIndex].lastInvokeMacro = gInvokeMacro; |
---|
4613 | gIncludeStack[gIncludeStackIndex].lastParseMacro = gParseMacro; |
---|
4614 | gIncludeStack[gIncludeStackIndex].lastMacroLineParse = gMacroLineParse; |
---|
4615 | gIncludeStack[gIncludeStackIndex].lastbInsideMacro = gbInsideMacro; |
---|
4616 | gIncludeStack[gIncludeStackIndex].lastbInsideInclude = gbInsideInclude; |
---|
4617 | gIncludeStack[gIncludeStackIndex].buffer = YY_CURRENT_BUFFER; |
---|
4618 | gIncludeStack[gIncludeStackIndex].lastbProcessingIFDEF = gbProcessingIFDEF; |
---|
4619 | gIncludeStackIndex++; |
---|
4620 | |
---|
4621 | gParseMacro = gTempParseMacro; |
---|
4622 | gInvokeMacro = gTempMacro; |
---|
4623 | gbInsideMacro = gbTempInsideMacro; |
---|
4624 | |
---|
4625 | gbTempInsideMacro = false; |
---|
4626 | |
---|
4627 | // yyin = NULL; |
---|
4628 | myin = NULL; |
---|
4629 | curFileName = gCurFileName; |
---|
4630 | if (curFileName == NULL) |
---|
4631 | curFileName = ""; |
---|
4632 | |
---|
4633 | macroFileName = gParseMacro->fileName; |
---|
4634 | if (macroFileName == NULL) |
---|
4635 | macroFileName = ""; |
---|
4636 | |
---|
4637 | sprintf(tempStr, "%s(%d) : References ->\n%s", curFileName, yylineno, macroFileName); |
---|
4638 | gCurFileName = strdup(tempStr); |
---|
4639 | gMacroLineParse = gParseMacro->firstMacroLines; |
---|
4640 | |
---|
4641 | macroText = gMacroLine; |
---|
4642 | // if no replacement text, just use source line |
---|
4643 | if (gParseMacro->firstMacroParms == NULL) |
---|
4644 | { |
---|
4645 | macroText = gMacroLineParse->macroText; |
---|
4646 | } |
---|
4647 | else |
---|
4648 | { |
---|
4649 | // replace the macro parameters |
---|
4650 | ReplaceMacroParms(gMacroLineParse->macroText, gMacroLine, gParseMacro, gInvokeMacro); |
---|
4651 | } |
---|
4652 | |
---|
4653 | yylineno = gParseMacro->lineNo; |
---|
4654 | if (gParseMacro->nLines >= 1) |
---|
4655 | { |
---|
4656 | strcpy(gSaveLine, macroText); |
---|
4657 | } |
---|
4658 | |
---|
4659 | // if (gExpandMacros && (gParseMacro->nLines >= 1)) |
---|
4660 | // { |
---|
4661 | // // in case there is anything there dump it out |
---|
4662 | // GenDebugLine(); |
---|
4663 | // GenListString(); |
---|
4664 | // if (gInvokeMacro->nLines >= 1) |
---|
4665 | // GenSwitchFileNames(macroFileName); |
---|
4666 | // } |
---|
4667 | |
---|
4668 | BEGIN(gInvokeState); |
---|
4669 | yy_scan_string(macroText); |
---|
4670 | gInvokeState = INITIAL; |
---|
4671 | } |
---|
4672 | } |
---|
4673 | else |
---|
4674 | { |
---|
4675 | if (gLastMacro != NULL) |
---|
4676 | { |
---|
4677 | gLastMacro->next = gTempMacro; |
---|
4678 | } |
---|
4679 | gLastMacro = gTempMacro; |
---|
4680 | BEGIN(MACROBODY); |
---|
4681 | } |
---|
4682 | } |
---|
4683 | |
---|
4684 | //===================================================================== |
---|
4685 | // Function: FindSwizzleValue |
---|
4686 | // Description: see if valid swizzle value and return the bits |
---|
4687 | // Parameters: swizzleTex = pointer to characters to analyze |
---|
4688 | // Returns: unsigned int = bits for swizzle values, or 0 for error |
---|
4689 | //===================================================================== |
---|
4690 | unsigned int FindSwizzleValue(char *swizzleText) |
---|
4691 | { |
---|
4692 | unsigned int swizzleBits; |
---|
4693 | unsigned int sLen; |
---|
4694 | unsigned int i; |
---|
4695 | unsigned int lastMask; |
---|
4696 | |
---|
4697 | sLen = strlen(swizzleText); |
---|
4698 | swizzleBits = 0; |
---|
4699 | lastMask = 0; |
---|
4700 | |
---|
4701 | for (i=0; i<sLen; i++) |
---|
4702 | { |
---|
4703 | switch (swizzleText[i]) |
---|
4704 | { |
---|
4705 | case 'x': |
---|
4706 | swizzleBits |= (WRITEMASK_X << (4*(3-i))); |
---|
4707 | lastMask = WRITEMASK_X; |
---|
4708 | break; |
---|
4709 | case 'y': |
---|
4710 | swizzleBits |= (WRITEMASK_Y << (4*(3-i))); |
---|
4711 | lastMask = WRITEMASK_Y; |
---|
4712 | break; |
---|
4713 | case 'z': |
---|
4714 | swizzleBits |= (WRITEMASK_Z << (4*(3-i))); |
---|
4715 | lastMask = WRITEMASK_Z; |
---|
4716 | break; |
---|
4717 | case 'w': |
---|
4718 | swizzleBits |= (WRITEMASK_W << (4*(3-i))); |
---|
4719 | lastMask = WRITEMASK_W; |
---|
4720 | break; |
---|
4721 | } |
---|
4722 | } |
---|
4723 | |
---|
4724 | for (; i<4; i++) |
---|
4725 | { |
---|
4726 | swizzleBits |= (lastMask << (4*(3-i))); |
---|
4727 | } |
---|
4728 | |
---|
4729 | return swizzleBits; |
---|
4730 | } |
---|
4731 | |
---|
4732 | #if 0 |
---|
4733 | unsigned int FindSwizzleValue(char *swizzleText) |
---|
4734 | { |
---|
4735 | |
---|
4736 | DWORD swizzleBits; |
---|
4737 | DWORD sLen; |
---|
4738 | DWORD i; |
---|
4739 | DWORD lastIndex; |
---|
4740 | |
---|
4741 | sLen = strlen(swizzleText); |
---|
4742 | swizzleBits = 0; |
---|
4743 | lastIndex = 0; |
---|
4744 | |
---|
4745 | for (i=0; i<sLen; i++) |
---|
4746 | { |
---|
4747 | switch (swizzleText[i]) |
---|
4748 | { |
---|
4749 | case 'x': |
---|
4750 | swizzleBits |= (0 << (D3DVS_SWIZZLE_SHIFT + (i * 2))); |
---|
4751 | lastIndex = 0; |
---|
4752 | break; |
---|
4753 | case 'y': |
---|
4754 | swizzleBits |= (1 << (D3DVS_SWIZZLE_SHIFT + (i * 2))); |
---|
4755 | lastIndex = 1; |
---|
4756 | break; |
---|
4757 | case 'z': |
---|
4758 | swizzleBits |= (2 << (D3DVS_SWIZZLE_SHIFT + (i * 2))); |
---|
4759 | lastIndex = 2; |
---|
4760 | break; |
---|
4761 | case 'w': |
---|
4762 | swizzleBits |= (3 << (D3DVS_SWIZZLE_SHIFT + (i * 2))); |
---|
4763 | lastIndex = 3; |
---|
4764 | break; |
---|
4765 | } |
---|
4766 | } |
---|
4767 | |
---|
4768 | for (; i<4; i++) |
---|
4769 | { |
---|
4770 | swizzleBits |= (lastIndex << (D3DVS_SWIZZLE_SHIFT + (i * 2))); |
---|
4771 | } |
---|
4772 | |
---|
4773 | return swizzleBits; |
---|
4774 | |
---|
4775 | |
---|
4776 | } |
---|
4777 | #endif |
---|
4778 | |
---|
4779 | //===================================================================== |
---|
4780 | // Function: FindRegisterMask |
---|
4781 | // Description: Look through register mask strings |
---|
4782 | // Parameters: findName = name to lookup |
---|
4783 | // Returns: unsigned int with token value |
---|
4784 | //===================================================================== |
---|
4785 | unsigned int MakeRegisterMask(char *findName) |
---|
4786 | { |
---|
4787 | |
---|
4788 | unsigned int regMask; |
---|
4789 | char *findFirst; |
---|
4790 | |
---|
4791 | regMask = 0; |
---|
4792 | |
---|
4793 | findFirst = strchr(findName, 'x'); |
---|
4794 | if (findFirst != NULL) |
---|
4795 | { |
---|
4796 | if (strchr(findFirst+1, 'x') != NULL) |
---|
4797 | { |
---|
4798 | return 0; |
---|
4799 | } |
---|
4800 | |
---|
4801 | regMask |= WRITEMASK_X; |
---|
4802 | } |
---|
4803 | |
---|
4804 | findFirst = strchr(findName, 'y'); |
---|
4805 | if (findFirst != NULL) |
---|
4806 | { |
---|
4807 | regMask |= WRITEMASK_Y; |
---|
4808 | // invalide write mask, must be swizzle |
---|
4809 | if (strchr(findFirst+1, 'x') != NULL) |
---|
4810 | { |
---|
4811 | return 0; |
---|
4812 | } |
---|
4813 | |
---|
4814 | if (strchr(findFirst+1, 'y') != NULL) |
---|
4815 | { |
---|
4816 | return 0; |
---|
4817 | } |
---|
4818 | |
---|
4819 | } |
---|
4820 | |
---|
4821 | findFirst = strchr(findName, 'z'); |
---|
4822 | if (findFirst != NULL) |
---|
4823 | { |
---|
4824 | regMask |= WRITEMASK_Z; |
---|
4825 | if (strchr(findFirst+1, 'x') != NULL) |
---|
4826 | { |
---|
4827 | return 0; |
---|
4828 | } |
---|
4829 | |
---|
4830 | if (strchr(findFirst+1, 'y') != NULL) |
---|
4831 | { |
---|
4832 | return 0; |
---|
4833 | } |
---|
4834 | |
---|
4835 | if (strchr(findFirst+1, 'z') != NULL) |
---|
4836 | { |
---|
4837 | return 0; |
---|
4838 | } |
---|
4839 | } |
---|
4840 | |
---|
4841 | findFirst = strchr(findName, 'w'); |
---|
4842 | if (findFirst != NULL) |
---|
4843 | { |
---|
4844 | |
---|
4845 | regMask |= WRITEMASK_W; |
---|
4846 | if (strchr(findFirst+1, 'x') != NULL) |
---|
4847 | { |
---|
4848 | return 0; |
---|
4849 | } |
---|
4850 | |
---|
4851 | if (strchr(findFirst+1, 'y') != NULL) |
---|
4852 | { |
---|
4853 | return 0; |
---|
4854 | } |
---|
4855 | |
---|
4856 | if (strchr(findFirst+1, 'z') != NULL) |
---|
4857 | { |
---|
4858 | return 0; |
---|
4859 | } |
---|
4860 | |
---|
4861 | if (strchr(findFirst+1, 'w') != NULL) |
---|
4862 | { |
---|
4863 | return 0; |
---|
4864 | } |
---|
4865 | } |
---|
4866 | |
---|
4867 | return regMask; |
---|
4868 | |
---|
4869 | } |
---|
4870 | |
---|
4871 | //===================================================================== |
---|
4872 | // Function: LexError |
---|
4873 | // Description: output an error to the stdout |
---|
4874 | // Parameters: typical printf like format |
---|
4875 | // Returns: . |
---|
4876 | //===================================================================== |
---|
4877 | void LexError(char *format, ...) |
---|
4878 | { |
---|
4879 | char errstring[4096]; |
---|
4880 | va_list marker; |
---|
4881 | |
---|
4882 | // fprintf( stderr,"(%d) : Error : ", yylineno); |
---|
4883 | if ( gbInsideInclude ) |
---|
4884 | { |
---|
4885 | sprintf( errstring, "%s", gCurFileName ); |
---|
4886 | sprintf( errstring+strlen(errstring),"(%d) : Error : ", yylineno); |
---|
4887 | } |
---|
4888 | else |
---|
4889 | { |
---|
4890 | sprintf( errstring,"(%d) : Error : ", yylineno); |
---|
4891 | } |
---|
4892 | |
---|
4893 | va_start(marker, format); |
---|
4894 | // vprintf(format, marker); |
---|
4895 | vsprintf(errstring+strlen(errstring), format, marker); |
---|
4896 | va_end(marker); |
---|
4897 | errors.set( errstring ); |
---|
4898 | } |
---|
4899 | |
---|
4900 | //===================================================================== |
---|
4901 | // Function: LexWarning |
---|
4902 | // Description: output a warning to the stdout |
---|
4903 | // Parameters: typical printf like format |
---|
4904 | // Returns: . |
---|
4905 | //===================================================================== |
---|
4906 | void LexWarning(char *format, ...) |
---|
4907 | { |
---|
4908 | char errstring[4096]; |
---|
4909 | va_list marker; |
---|
4910 | |
---|
4911 | // fprintf( stderr,"(%d) : warning : ", yylineno); |
---|
4912 | if ( gbInsideInclude ) |
---|
4913 | sprintf( errstring, "%s", gCurFileName ); |
---|
4914 | sprintf( errstring+strlen(errstring),"(%d) : Warning : ", yylineno); |
---|
4915 | // sprintf( errstring,"(%d) : Warning : ", yylineno); |
---|
4916 | |
---|
4917 | va_start(marker, format); |
---|
4918 | // vprintf(format, marker); |
---|
4919 | vsprintf(errstring+strlen(errstring), format, marker); |
---|
4920 | va_end(marker); |
---|
4921 | errors.set( errstring ); |
---|
4922 | } |
---|
4923 | |
---|
4924 | //===================================================================== |
---|
4925 | // Function: DebugUnhandledState |
---|
4926 | // Description: Come here in debug mode, when a state isn't handled |
---|
4927 | // for the Lexer |
---|
4928 | // Parameters: . |
---|
4929 | // Returns: . |
---|
4930 | //===================================================================== |
---|
4931 | void DebugUnhandledState() |
---|
4932 | { |
---|
4933 | fprintf( stderr,"Unhandled state reached, with %s text.\n", yytext); |
---|
4934 | } |
---|
4935 | |
---|
4936 | //===================================================================== |
---|
4937 | // Function: FindOpcode |
---|
4938 | // Description: Look through opcodes and see if in the table |
---|
4939 | // Parameters: findName = name to lookup |
---|
4940 | // Returns: OPCODEMAP * = pointer to opcode map entry, if found |
---|
4941 | //===================================================================== |
---|
4942 | OPCODEMAP *FindOpcode(char *findName) |
---|
4943 | { |
---|
4944 | |
---|
4945 | unsigned i; |
---|
4946 | |
---|
4947 | // just do linear search for now |
---|
4948 | for (i=0; i<NUMOPCODES; i++) |
---|
4949 | { |
---|
4950 | if (!stricmp(theOpcodes[i].string, findName)) |
---|
4951 | { |
---|
4952 | return &theOpcodes[i]; |
---|
4953 | } |
---|
4954 | |
---|
4955 | } |
---|
4956 | |
---|
4957 | return NULL; |
---|
4958 | } |
---|
4959 | |
---|
4960 | char *ReadTextFile(const char * filename) |
---|
4961 | { |
---|
4962 | char path[3][32] = { ".\0", |
---|
4963 | "../../data/programs\0", |
---|
4964 | "../../../data/programs\0" }; |
---|
4965 | char name[8192]; |
---|
4966 | int i; |
---|
4967 | |
---|
4968 | if (!filename) return 0; |
---|
4969 | |
---|
4970 | struct _stat status; |
---|
4971 | int found = 0; |
---|
4972 | for ( i = 0; i < 3; i++ ) |
---|
4973 | { |
---|
4974 | sprintf( name, "%s/%s", path[i], filename ); |
---|
4975 | |
---|
4976 | int fh = ::_open(name, _O_RDONLY); |
---|
4977 | |
---|
4978 | if(fh != -1) |
---|
4979 | { |
---|
4980 | int result = _fstat( fh, &status ); |
---|
4981 | if( result != 0 ) |
---|
4982 | { |
---|
4983 | fprintf( stderr, "An fstat error occurred.\n" ); |
---|
4984 | break; |
---|
4985 | } |
---|
4986 | ::_close( fh ); |
---|
4987 | found = i+1; |
---|
4988 | break; |
---|
4989 | } |
---|
4990 | } |
---|
4991 | |
---|
4992 | if ( 0 == found ) |
---|
4993 | { |
---|
4994 | fprintf(stderr,"Cannot open \"%s\" for stat read!\n", filename); |
---|
4995 | return NULL; |
---|
4996 | } |
---|
4997 | long size = status.st_size; |
---|
4998 | |
---|
4999 | char * buf = new char[size+1]; |
---|
5000 | |
---|
5001 | FILE *fp = 0; |
---|
5002 | if (!(fp = fopen(name, "r"))) |
---|
5003 | { |
---|
5004 | fprintf(stderr,"Cannot open \"%s\" for read!\n", name); |
---|
5005 | return NULL; |
---|
5006 | } |
---|
5007 | |
---|
5008 | int bytes; |
---|
5009 | bytes = fread(buf, 1, size, fp); |
---|
5010 | |
---|
5011 | buf[bytes] = 0; |
---|
5012 | |
---|
5013 | fclose(fp); |
---|
5014 | return buf; |
---|
5015 | } |
---|
5016 | |
---|
5017 | bool vs10_init_more(); |
---|
5018 | |
---|
5019 | bool vs10_init(char* inputString) |
---|
5020 | { |
---|
5021 | BEGIN(SAVELINE); |
---|
5022 | myin = inputString; |
---|
5023 | line_incr = 0; |
---|
5024 | return vs10_init_more(); |
---|
5025 | } |
---|
5026 | |
---|
5027 | #ifndef vs10_wrap |
---|
5028 | int vs10_wrap(void) |
---|
5029 | { |
---|
5030 | return(1); |
---|
5031 | } |
---|
5032 | #endif |
---|