Merge in a post-Wine-0_9_5 change to get rid of some warnings. Thanks to
[reactos.git] / reactos / tools / wpp / lex.yy.c
1 #define yy_create_buffer pp_create_buffer
2 #define yy_delete_buffer pp_delete_buffer
3 #define yy_scan_buffer pp_scan_buffer
4 #define yy_scan_string pp_scan_string
5 #define yy_scan_bytes pp_scan_bytes
6 #define yy_flex_debug pp_flex_debug
7 #define yy_init_buffer pp_init_buffer
8 #define yy_flush_buffer pp_flush_buffer
9 #define yy_load_buffer_state pp_load_buffer_state
10 #define yy_switch_to_buffer pp_switch_to_buffer
11 #define yyin ppin
12 #define yyleng ppleng
13 #define yylex pplex
14 #define yyout ppout
15 #define yyrestart pprestart
16 #define yytext pptext
17 #define yywrap ppwrap
18
19 #line 20 "tools/wpp/lex.yy.c"
20 /* A lexical scanner generated by flex */
21
22 /* Scanner skeleton version:
23 * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $
24 */
25
26 #define FLEX_SCANNER
27 #define YY_FLEX_MAJOR_VERSION 2
28 #define YY_FLEX_MINOR_VERSION 5
29
30 #include <stdio.h>
31 #include <unistd.h>
32
33
34 /* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
35 #ifdef c_plusplus
36 #ifndef __cplusplus
37 #define __cplusplus
38 #endif
39 #endif
40
41
42 #ifdef __cplusplus
43
44 #include <stdlib.h>
45
46 /* Use prototypes in function declarations. */
47 #define YY_USE_PROTOS
48
49 /* The "const" storage-class-modifier is valid. */
50 #define YY_USE_CONST
51
52 #else /* ! __cplusplus */
53
54 #if __STDC__
55
56 #define YY_USE_PROTOS
57 #define YY_USE_CONST
58
59 #endif /* __STDC__ */
60 #endif /* ! __cplusplus */
61
62 #ifdef __TURBOC__
63 #pragma warn -rch
64 #pragma warn -use
65 #include <io.h>
66 #include <stdlib.h>
67 #define YY_USE_CONST
68 #define YY_USE_PROTOS
69 #endif
70
71 #ifdef YY_USE_CONST
72 #define yyconst const
73 #else
74 #define yyconst
75 #endif
76
77
78 #ifdef YY_USE_PROTOS
79 #define YY_PROTO(proto) proto
80 #else
81 #define YY_PROTO(proto) ()
82 #endif
83
84 /* Returned upon end-of-file. */
85 #define YY_NULL 0
86
87 /* Promotes a possibly negative, possibly signed char to an unsigned
88 * integer for use as an array index. If the signed char is negative,
89 * we want to instead treat it as an 8-bit unsigned char, hence the
90 * double cast.
91 */
92 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
93
94 /* Enter a start condition. This macro really ought to take a parameter,
95 * but we do it the disgusting crufty way forced on us by the ()-less
96 * definition of BEGIN.
97 */
98 #define BEGIN yy_start = 1 + 2 *
99
100 /* Translate the current start state into a value that can be later handed
101 * to BEGIN to return to the state. The YYSTATE alias is for lex
102 * compatibility.
103 */
104 #define YY_START ((yy_start - 1) / 2)
105 #define YYSTATE YY_START
106
107 /* Action number for EOF rule of a given start state. */
108 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
109
110 /* Special action meaning "start processing a new file". */
111 #define YY_NEW_FILE yyrestart( yyin )
112
113 #define YY_END_OF_BUFFER_CHAR 0
114
115 /* Size of default input buffer. */
116 #define YY_BUF_SIZE 16384
117
118 typedef struct yy_buffer_state *YY_BUFFER_STATE;
119
120 extern int yyleng;
121 extern FILE *yyin, *yyout;
122
123 #define EOB_ACT_CONTINUE_SCAN 0
124 #define EOB_ACT_END_OF_FILE 1
125 #define EOB_ACT_LAST_MATCH 2
126
127 /* The funky do-while in the following #define is used to turn the definition
128 * int a single C statement (which needs a semi-colon terminator). This
129 * avoids problems with code like:
130 *
131 * if ( condition_holds )
132 * yyless( 5 );
133 * else
134 * do_something_else();
135 *
136 * Prior to using the do-while the compiler would get upset at the
137 * "else" because it interpreted the "if" statement as being all
138 * done when it reached the ';' after the yyless() call.
139 */
140
141 /* Return all but the first 'n' matched characters back to the input stream. */
142
143 #define yyless(n) \
144 do \
145 { \
146 /* Undo effects of setting up yytext. */ \
147 *yy_cp = yy_hold_char; \
148 YY_RESTORE_YY_MORE_OFFSET \
149 yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
150 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
151 } \
152 while ( 0 )
153
154 #define unput(c) yyunput( c, yytext_ptr )
155
156 /* The following is because we cannot portably get our hands on size_t
157 * (without autoconf's help, which isn't available because we want
158 * flex-generated scanners to compile on their own).
159 */
160 typedef unsigned int yy_size_t;
161
162
163 struct yy_buffer_state
164 {
165 FILE *yy_input_file;
166
167 char *yy_ch_buf; /* input buffer */
168 char *yy_buf_pos; /* current position in input buffer */
169
170 /* Size of input buffer in bytes, not including room for EOB
171 * characters.
172 */
173 yy_size_t yy_buf_size;
174
175 /* Number of characters read into yy_ch_buf, not including EOB
176 * characters.
177 */
178 int yy_n_chars;
179
180 /* Whether we "own" the buffer - i.e., we know we created it,
181 * and can realloc() it to grow it, and should free() it to
182 * delete it.
183 */
184 int yy_is_our_buffer;
185
186 /* Whether this is an "interactive" input source; if so, and
187 * if we're using stdio for input, then we want to use getc()
188 * instead of fread(), to make sure we stop fetching input after
189 * each newline.
190 */
191 int yy_is_interactive;
192
193 /* Whether we're considered to be at the beginning of a line.
194 * If so, '^' rules will be active on the next match, otherwise
195 * not.
196 */
197 int yy_at_bol;
198
199 /* Whether to try to fill the input buffer when we reach the
200 * end of it.
201 */
202 int yy_fill_buffer;
203
204 int yy_buffer_status;
205 #define YY_BUFFER_NEW 0
206 #define YY_BUFFER_NORMAL 1
207 /* When an EOF's been seen but there's still some text to process
208 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
209 * shouldn't try reading from the input source any more. We might
210 * still have a bunch of tokens to match, though, because of
211 * possible backing-up.
212 *
213 * When we actually see the EOF, we change the status to "new"
214 * (via yyrestart()), so that the user can continue scanning by
215 * just pointing yyin at a new input file.
216 */
217 #define YY_BUFFER_EOF_PENDING 2
218 };
219
220 static YY_BUFFER_STATE yy_current_buffer = 0;
221
222 /* We provide macros for accessing buffer states in case in the
223 * future we want to put the buffer states in a more general
224 * "scanner state".
225 */
226 #define YY_CURRENT_BUFFER yy_current_buffer
227
228
229 /* yy_hold_char holds the character lost when yytext is formed. */
230 static char yy_hold_char;
231
232 static int yy_n_chars; /* number of characters read into yy_ch_buf */
233
234
235 int yyleng;
236
237 /* Points to current character in buffer. */
238 static char *yy_c_buf_p = (char *) 0;
239 static int yy_init = 1; /* whether we need to initialize */
240 static int yy_start = 0; /* start state number */
241
242 /* Flag which is used to allow yywrap()'s to do buffer switches
243 * instead of setting up a fresh yyin. A bit of a hack ...
244 */
245 static int yy_did_buffer_switch_on_eof;
246
247 void yyrestart YY_PROTO(( FILE *input_file ));
248
249 void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
250 void yy_load_buffer_state YY_PROTO(( void ));
251 YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
252 void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
253 void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
254 void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
255 #define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
256
257 YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
258 YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
259 YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
260
261 static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
262 static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
263 static void yy_flex_free YY_PROTO(( void * ));
264
265 #define yy_new_buffer yy_create_buffer
266
267 #define yy_set_interactive(is_interactive) \
268 { \
269 if ( ! yy_current_buffer ) \
270 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
271 yy_current_buffer->yy_is_interactive = is_interactive; \
272 }
273
274 #define yy_set_bol(at_bol) \
275 { \
276 if ( ! yy_current_buffer ) \
277 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
278 yy_current_buffer->yy_at_bol = at_bol; \
279 }
280
281 #define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
282
283 typedef unsigned char YY_CHAR;
284 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
285 typedef int yy_state_type;
286 extern char *yytext;
287 #define yytext_ptr yytext
288
289 static yy_state_type yy_get_previous_state YY_PROTO(( void ));
290 static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
291 static int yy_get_next_buffer YY_PROTO(( void ));
292 static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
293
294 /* Done after the current pattern has been matched and before the
295 * corresponding action - sets up yytext.
296 */
297 #define YY_DO_BEFORE_ACTION \
298 yytext_ptr = yy_bp; \
299 yyleng = (int) (yy_cp - yy_bp); \
300 yy_hold_char = *yy_cp; \
301 *yy_cp = '\0'; \
302 yy_c_buf_p = yy_cp;
303
304 #define YY_NUM_RULES 144
305 #define YY_END_OF_BUFFER 145
306 static yyconst short int yy_accept[421] =
307 { 0,
308 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
309 0, 0, 0, 0, 118, 118, 0, 0, 0, 0,
310 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
311 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
312 0, 0, 0, 0, 145, 134, 135, 136, 122, 143,
313 123, 134, 133, 134, 135, 1, 22, 17, 19, 17,
314 22, 21, 18, 18, 18, 18, 18, 18, 18, 18,
315 69, 72, 70, 71, 29, 26, 27, 25, 29, 24,
316 29, 29, 124, 132, 125, 143, 126, 127, 143, 128,
317 129, 118, 119, 118, 78, 76, 78, 78, 75, 78,
318
319 79, 83, 85, 84, 143, 80, 91, 87, 91, 86,
320 89, 91, 91, 88, 91, 93, 101, 103, 96, 102,
321 98, 97, 94, 98, 93, 107, 107, 105, 104, 107,
322 115, 114, 111, 112, 108, 109, 110, 115, 115, 134,
323 135, 139, 122, 139, 123, 134, 133, 134, 54, 51,
324 48, 54, 53, 54, 52, 54, 34, 36, 54, 54,
325 54, 54, 50, 54, 54, 59, 56, 57, 59, 55,
326 59, 63, 60, 61, 63, 63, 23, 68, 65, 68,
327 66, 68, 64, 68, 30, 31, 33, 33, 33, 30,
328 1, 141, 144, 142, 140, 140, 134, 135, 134, 117,
329
330 121, 133, 137, 138, 135, 1, 17, 18, 18, 18,
331 18, 18, 18, 18, 18, 19, 20, 21, 18, 18,
332 18, 18, 18, 12, 18, 18, 18, 18, 18, 69,
333 70, 71, 73, 71, 26, 28, 29, 124, 131, 130,
334 131, 126, 128, 118, 118, 118, 120, 76, 74, 75,
335 77, 78, 79, 80, 82, 80, 87, 86, 91, 88,
336 92, 91, 93, 95, 98, 97, 94, 100, 98, 93,
337 107, 105, 104, 107, 106, 107, 115, 115, 113, 116,
338 115, 134, 139, 139, 51, 45, 42, 34, 35, 34,
339 34, 38, 36, 36, 36, 40, 46, 44, 47, 41,
340
341 49, 50, 133, 43, 56, 55, 58, 59, 60, 62,
342 0, 23, 65, 64, 68, 67, 68, 30, 32, 33,
343 30, 141, 140, 121, 121, 18, 18, 18, 18, 18,
344 18, 12, 18, 18, 18, 18, 18, 18, 18, 70,
345 81, 90, 99, 35, 35, 34, 34, 34, 37, 36,
346 36, 36, 133, 121, 18, 13, 14, 18, 18, 18,
347 18, 18, 18, 16, 18, 18, 18, 35, 35, 35,
348 34, 37, 37, 36, 133, 18, 13, 14, 15, 5,
349 8, 10, 18, 18, 16, 18, 9, 18, 35, 37,
350 37, 37, 133, 4, 15, 5, 8, 10, 11, 18,
351
352 7, 9, 18, 37, 133, 4, 11, 2, 7, 6,
353 39, 2, 0, 6, 0, 0, 0, 3, 3, 0
354 } ;
355
356 static yyconst int yy_ec[256] =
357 { 0,
358 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
359 2, 2, 4, 1, 1, 1, 1, 1, 1, 1,
360 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
361 1, 2, 5, 6, 7, 1, 1, 8, 9, 10,
362 11, 12, 1, 13, 1, 14, 15, 16, 17, 17,
363 17, 17, 17, 17, 17, 18, 18, 1, 1, 19,
364 20, 21, 1, 1, 22, 22, 22, 22, 22, 22,
365 23, 23, 23, 23, 23, 24, 23, 23, 23, 23,
366 23, 23, 23, 23, 25, 23, 23, 26, 23, 23,
367 1, 27, 1, 1, 28, 1, 29, 30, 31, 32,
368
369 33, 34, 35, 36, 37, 36, 36, 38, 39, 40,
370 41, 42, 36, 43, 44, 45, 46, 36, 47, 48,
371 36, 36, 1, 49, 1, 1, 1, 1, 1, 1,
372 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
373 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
374 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
375 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
376 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
377 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
378 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
379
380 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
381 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
382 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
383 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
384 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
385 1, 1, 1, 1, 1
386 } ;
387
388 static yyconst int yy_meta[50] =
389 { 0,
390 1, 2, 3, 2, 1, 4, 5, 1, 6, 7,
391 8, 9, 8, 10, 11, 12, 12, 12, 1, 1,
392 13, 14, 15, 15, 15, 15, 16, 17, 14, 14,
393 14, 14, 14, 14, 15, 15, 15, 15, 15, 15,
394 15, 15, 15, 15, 15, 15, 15, 15, 1
395 } ;
396
397 static yyconst short int yy_base[464] =
398 { 0,
399 0, 48, 55, 0, 102, 103, 130, 0, 177, 178,
400 179, 182, 186, 187, 104, 107, 214, 0, 261, 262,
401 289, 0, 338, 0, 386, 389, 414, 439, 466, 0,
402 515, 0, 564, 0, 399, 403, 612, 638, 665, 0,
403 428, 618, 714, 763, 1354, 0, 49, 1771, 1771, 1771,
404 1771, 96, 0, 109, 118, 1771, 1771, 811, 1771, 1350,
405 111, 111, 858, 1316, 154, 161, 1307, 1300, 1302, 1312,
406 0, 1771, 184, 124, 1771, 196, 1771, 1771, 254, 1771,
407 0, 199, 0, 1771, 1771, 269, 0, 1771, 1337, 0,
408 1771, 0, 1771, 263, 1771, 208, 1771, 267, 1123, 277,
409
410 0, 1771, 1771, 1771, 271, 281, 1771, 393, 1771, 396,
411 1771, 1118, 396, 0, 406, 0, 1771, 1771, 1124, 1771,
412 400, 0, 0, 418, 905, 1771, 430, 1771, 1771, 433,
413 0, 1771, 1771, 1771, 1771, 1771, 1771, 432, 435, 0,
414 449, 1771, 1771, 1771, 1771, 444, 0, 954, 1771, 456,
415 1771, 1110, 1771, 1121, 1771, 449, 988, 714, 443, 1108,
416 603, 0, 623, 1094, 1077, 1771, 615, 1771, 619, 0,
417 632, 1771, 644, 1771, 635, 634, 635, 1771, 655, 1771,
418 1771, 646, 0, 659, 0, 1771, 1771, 725, 738, 741,
419 1771, 742, 1771, 1771, 0, 735, 0, 747, 741, 1771,
420
421 0, 0, 1771, 1122, 755, 1771, 0, 0, 1091, 747,
422 754, 1086, 1079, 1081, 1091, 1771, 1771, 1116, 1084, 717,
423 1085, 1073, 1082, 777, 1083, 1073, 1083, 1079, 1067, 0,
424 0, 1771, 1771, 1106, 787, 1771, 1105, 0, 1771, 1771,
425 1104, 0, 0, 0, 743, 765, 1771, 791, 1771, 1093,
426 1771, 1099, 0, 1771, 794, 1098, 795, 798, 1086, 0,
427 1771, 1096, 0, 1771, 789, 0, 0, 801, 1081, 0,
428 804, 1771, 1771, 807, 1771, 1080, 0, 804, 1771, 1771,
429 1079, 806, 1771, 0, 818, 1771, 1771, 847, 843, 874,
430 799, 0, 905, 903, 800, 1771, 1771, 1771, 1771, 1771,
431
432 1771, 1078, 1046, 1771, 823, 0, 1771, 1076, 824, 1771,
433 1075, 816, 871, 0, 1771, 1771, 1051, 0, 1771, 1036,
434 872, 876, 0, 1036, 0, 995, 990, 988, 979, 970,
435 942, 880, 917, 915, 906, 881, 873, 870, 862, 0,
436 884, 1771, 890, 907, 845, 618, 863, 873, 910, 911,
437 914, 922, 840, 1085, 830, 935, 938, 832, 796, 791,
438 801, 797, 783, 974, 753, 702, 691, 938, 942, 945,
439 1771, 961, 953, 1771, 620, 616, 977, 985, 986, 990,
440 991, 994, 598, 433, 998, 417, 1006, 388, 1771, 972,
441 977, 985, 386, 1015, 1018, 1023, 1026, 1027, 1031, 371,
442
443 1048, 1049, 359, 1771, 255, 1056, 1057, 1060, 1061, 1064,
444 0, 1065, 234, 1068, 153, 61, 9, 1069, 1072, 1771,
445 1134, 1151, 1168, 1185, 1202, 1219, 1236, 1253, 1270, 1287,
446 1304, 1321, 1338, 1351, 1353, 1370, 1387, 1404, 1421, 1438,
447 1455, 1472, 1489, 1500, 1517, 1534, 1540, 1557, 1574, 1591,
448 1597, 1614, 1631, 1648, 1654, 1660, 1677, 1694, 1702, 1719,
449 1736, 1063, 1753
450 } ;
451
452 static yyconst short int yy_def[464] =
453 { 0,
454 420, 1, 420, 3, 421, 421, 420, 7, 422, 422,
455 423, 423, 424, 424, 425, 425, 420, 17, 426, 426,
456 420, 21, 420, 23, 427, 427, 428, 428, 420, 29,
457 420, 31, 420, 33, 429, 429, 430, 430, 420, 39,
458 431, 431, 432, 432, 420, 433, 420, 420, 420, 420,
459 420, 434, 435, 434, 420, 420, 420, 420, 420, 58,
460 420, 420, 58, 63, 63, 63, 63, 63, 63, 63,
461 436, 420, 437, 420, 420, 420, 420, 420, 420, 420,
462 435, 420, 438, 420, 420, 439, 440, 420, 439, 441,
463 420, 442, 420, 443, 420, 420, 420, 420, 444, 420,
464
465 445, 420, 420, 420, 446, 420, 420, 420, 420, 420,
466 420, 420, 420, 447, 420, 448, 420, 420, 420, 420,
467 449, 450, 451, 420, 451, 420, 420, 420, 420, 420,
468 452, 420, 420, 420, 420, 420, 420, 453, 420, 433,
469 420, 420, 420, 420, 420, 434, 435, 454, 420, 420,
470 420, 420, 420, 420, 420, 420, 420, 420, 420, 420,
471 420, 435, 420, 435, 420, 420, 420, 420, 420, 455,
472 420, 420, 420, 420, 420, 420, 420, 420, 420, 420,
473 420, 420, 456, 457, 458, 420, 420, 420, 420, 458,
474 420, 420, 420, 420, 459, 459, 433, 420, 434, 420,
475
476 460, 435, 420, 420, 420, 420, 58, 63, 63, 63,
477 63, 63, 63, 63, 63, 420, 420, 420, 63, 63,
478 63, 63, 63, 63, 63, 63, 63, 63, 63, 436,
479 461, 420, 420, 420, 420, 420, 420, 438, 420, 420,
480 420, 440, 441, 442, 443, 443, 420, 420, 420, 444,
481 420, 420, 445, 420, 420, 420, 420, 420, 420, 447,
482 420, 420, 448, 420, 449, 450, 451, 420, 420, 125,
483 420, 420, 420, 420, 420, 420, 452, 453, 420, 420,
484 420, 434, 420, 454, 420, 420, 420, 420, 420, 420,
485 420, 462, 420, 420, 420, 420, 420, 420, 420, 420,
486
487 420, 420, 435, 420, 420, 455, 420, 420, 420, 420,
488 420, 420, 420, 456, 420, 420, 420, 458, 420, 420,
489 458, 420, 459, 463, 460, 63, 63, 63, 63, 63,
490 63, 420, 63, 63, 63, 63, 63, 63, 63, 461,
491 420, 420, 420, 420, 420, 420, 420, 420, 462, 420,
492 420, 420, 435, 463, 63, 63, 63, 63, 63, 63,
493 63, 63, 63, 63, 63, 63, 63, 420, 420, 420,
494 420, 420, 420, 420, 435, 63, 420, 420, 63, 63,
495 63, 63, 63, 63, 420, 63, 63, 63, 420, 420,
496 420, 420, 435, 63, 420, 420, 420, 420, 63, 63,
497
498 63, 420, 63, 420, 435, 420, 420, 63, 420, 63,
499 435, 420, 420, 420, 420, 420, 420, 420, 420, 0,
500 420, 420, 420, 420, 420, 420, 420, 420, 420, 420,
501 420, 420, 420, 420, 420, 420, 420, 420, 420, 420,
502 420, 420, 420, 420, 420, 420, 420, 420, 420, 420,
503 420, 420, 420, 420, 420, 420, 420, 420, 420, 420,
504 420, 420, 420
505 } ;
506
507 static yyconst short int yy_nxt[1821] =
508 { 0,
509 46, 47, 48, 47, 46, 49, 50, 46, 51, 46,
510 46, 46, 46, 46, 52, 46, 46, 46, 46, 46,
511 46, 53, 53, 53, 53, 53, 54, 53, 53, 53,
512 53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
513 53, 53, 53, 53, 53, 53, 53, 53, 46, 55,
514 198, 55, 198, 418, 56, 57, 58, 59, 60, 57,
515 57, 57, 57, 57, 57, 57, 57, 57, 57, 61,
516 57, 57, 57, 57, 57, 57, 57, 57, 57, 57,
517 57, 62, 57, 63, 63, 63, 64, 65, 63, 63,
518 63, 66, 67, 63, 63, 63, 68, 63, 63, 63,
519
520 69, 70, 63, 57, 72, 72, 93, 200, 417, 93,
521 201, 203, 204, 217, 218, 94, 73, 73, 94, 205,
522 420, 205, 200, 420, 206, 201, 233, 234, 74, 74,
523 75, 76, 77, 76, 75, 78, 75, 75, 75, 75,
524 75, 75, 75, 75, 79, 75, 75, 75, 80, 75,
525 75, 81, 81, 81, 81, 81, 82, 81, 81, 81,
526 81, 81, 81, 81, 81, 81, 81, 81, 81, 81,
527 81, 81, 81, 81, 81, 81, 81, 81, 75, 84,
528 84, 84, 85, 85, 84, 416, 232, 88, 84, 84,
529 88, 220, 223, 221, 224, 200, 222, 235, 201, 235,
530
531 225, 236, 237, 86, 86, 89, 91, 91, 89, 248,
532 232, 248, 89, 89, 95, 96, 97, 96, 95, 95,
533 95, 95, 95, 95, 95, 95, 95, 95, 98, 95,
534 95, 95, 95, 95, 95, 99, 99, 99, 99, 99,
535 100, 99, 99, 99, 99, 99, 99, 99, 99, 99,
536 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
537 99, 99, 95, 102, 102, 200, 103, 103, 201, 104,
538 104, 240, 241, 415, 246, 105, 105, 247, 200, 251,
539 252, 201, 200, 255, 256, 201, 411, 106, 106, 107,
540 108, 109, 108, 107, 107, 107, 107, 107, 107, 110,
541
542 107, 111, 112, 113, 107, 107, 107, 107, 107, 107,
543 114, 114, 114, 114, 114, 115, 114, 114, 114, 114,
544 114, 114, 114, 114, 114, 114, 114, 114, 114, 114,
545 114, 114, 114, 114, 114, 114, 114, 107, 116, 116,
546 117, 116, 116, 118, 119, 116, 120, 116, 116, 116,
547 116, 116, 121, 122, 122, 122, 116, 116, 116, 123,
548 123, 123, 123, 123, 124, 125, 123, 123, 123, 123,
549 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
550 123, 123, 123, 123, 123, 123, 116, 127, 128, 127,
551 127, 128, 127, 410, 257, 129, 257, 258, 129, 258,
552
553 173, 174, 173, 408, 173, 174, 173, 200, 261, 262,
554 201, 200, 130, 175, 201, 130, 132, 175, 405, 133,
555 268, 269, 134, 135, 136, 176, 137, 403, 138, 176,
556 186, 271, 272, 271, 187, 275, 276, 280, 281, 273,
557 139, 132, 188, 279, 133, 401, 201, 134, 135, 136,
558 198, 137, 198, 138, 189, 420, 274, 285, 420, 285,
559 200, 296, 297, 201, 400, 139, 140, 141, 142, 141,
560 140, 143, 144, 140, 145, 140, 140, 140, 140, 140,
561 146, 140, 140, 140, 140, 140, 140, 147, 147, 147,
562 147, 147, 148, 147, 147, 147, 147, 147, 147, 147,
563
564 147, 147, 147, 147, 147, 147, 147, 147, 147, 147,
565 147, 147, 147, 147, 140, 149, 150, 151, 150, 152,
566 153, 149, 154, 155, 149, 149, 149, 149, 149, 156,
567 157, 158, 158, 159, 160, 161, 162, 162, 162, 162,
568 162, 163, 162, 162, 162, 162, 164, 162, 162, 162,
569 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
570 162, 162, 162, 165, 166, 167, 168, 167, 166, 166,
571 166, 166, 166, 166, 166, 166, 166, 166, 169, 166,
572 166, 166, 166, 166, 166, 170, 170, 170, 170, 170,
573 171, 170, 170, 170, 170, 170, 170, 170, 170, 170,
574
575 170, 170, 170, 170, 170, 170, 170, 170, 170, 170,
576 170, 170, 166, 76, 77, 76, 305, 78, 305, 190,
577 186, 190, 299, 300, 191, 301, 302, 177, 177, 177,
578 200, 399, 188, 201, 307, 308, 310, 311, 82, 76,
579 77, 76, 371, 78, 189, 309, 200, 309, 394, 201,
580 312, 312, 312, 177, 177, 177, 313, 200, 313, 393,
581 201, 316, 317, 371, 82, 178, 179, 180, 179, 178,
582 178, 178, 178, 178, 181, 181, 178, 178, 178, 182,
583 178, 178, 178, 178, 178, 178, 183, 183, 183, 183,
584 183, 184, 183, 183, 183, 183, 183, 183, 183, 183,
585
586 183, 183, 183, 183, 183, 183, 183, 183, 183, 183,
587 183, 183, 183, 178, 50, 192, 193, 192, 50, 194,
588 50, 50, 50, 50, 50, 50, 50, 388, 196, 293,
589 293, 293, 50, 50, 50, 387, 200, 294, 295, 201,
590 319, 320, 321, 322, 321, 322, 200, 206, 198, 324,
591 198, 294, 420, 327, 420, 420, 205, 420, 205, 295,
592 328, 206, 50, 50, 192, 193, 192, 50, 194, 50,
593 50, 50, 50, 50, 50, 50, 246, 196, 332, 247,
594 332, 50, 50, 50, 220, 223, 221, 224, 235, 222,
595 235, 386, 248, 225, 248, 341, 257, 341, 257, 258,
596
597 420, 258, 343, 420, 343, 271, 272, 271, 333, 275,
598 276, 50, 207, 273, 207, 420, 334, 420, 420, 285,
599 420, 285, 348, 352, 305, 309, 305, 309, 384, 383,
600 274, 312, 312, 312, 382, 381, 348, 352, 380, 208,
601 208, 208, 209, 210, 208, 208, 208, 211, 212, 208,
602 208, 208, 213, 208, 208, 208, 214, 215, 208, 420,
603 289, 420, 288, 288, 289, 379, 344, 345, 370, 376,
604 290, 291, 313, 321, 313, 321, 375, 322, 206, 322,
605 344, 332, 370, 332, 290, 341, 371, 341, 345, 208,
606 208, 343, 291, 343, 208, 208, 371, 346, 347, 208,
607
608 371, 367, 366, 208, 208, 263, 263, 365, 263, 263,
609 371, 346, 263, 364, 263, 263, 263, 263, 263, 347,
610 293, 293, 293, 263, 263, 263, 350, 351, 294, 295,
611 368, 369, 270, 372, 373, 374, 377, 374, 377, 378,
612 350, 378, 294, 363, 368, 374, 362, 372, 351, 361,
613 295, 374, 369, 263, 282, 373, 374, 284, 282, 374,
614 282, 282, 389, 282, 282, 389, 282, 282, 389, 282,
615 282, 282, 282, 282, 282, 385, 392, 385, 377, 389,
616 377, 360, 389, 389, 390, 391, 378, 395, 378, 395,
617 392, 396, 397, 396, 397, 398, 404, 398, 390, 385,
618
619 404, 385, 282, 288, 288, 289, 391, 402, 404, 402,
620 359, 290, 291, 292, 404, 358, 406, 404, 406, 395,
621 357, 395, 404, 356, 396, 290, 396, 397, 398, 397,
622 398, 355, 407, 291, 407, 292, 325, 325, 319, 325,
623 325, 325, 325, 325, 325, 325, 325, 325, 325, 409,
624 402, 409, 402, 316, 325, 325, 325, 406, 407, 406,
625 407, 412, 409, 412, 409, 414, 412, 414, 412, 414,
626 419, 414, 419, 419, 349, 419, 349, 310, 307, 353,
627 301, 280, 275, 268, 325, 325, 325, 413, 325, 325,
628 325, 325, 325, 325, 325, 325, 325, 325, 261, 342,
629
630 255, 251, 249, 325, 325, 325, 240, 236, 233, 339,
631 338, 337, 336, 335, 331, 330, 329, 326, 217, 229,
632 228, 227, 226, 219, 203, 304, 303, 298, 287, 286,
633 264, 259, 249, 325, 71, 71, 71, 71, 71, 71,
634 71, 71, 71, 71, 71, 71, 71, 71, 71, 71,
635 71, 83, 83, 83, 83, 83, 83, 83, 83, 83,
636 83, 83, 83, 83, 83, 83, 83, 83, 87, 87,
637 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
638 87, 87, 87, 87, 87, 90, 90, 90, 90, 90,
639 90, 90, 90, 90, 90, 90, 90, 90, 90, 90,
640
641 90, 90, 92, 92, 92, 92, 92, 92, 92, 92,
642 92, 92, 92, 92, 92, 92, 92, 92, 92, 101,
643 101, 101, 101, 101, 101, 101, 101, 101, 101, 101,
644 101, 101, 101, 101, 101, 101, 126, 126, 126, 126,
645 126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
646 126, 126, 126, 131, 131, 131, 131, 131, 131, 131,
647 131, 131, 131, 131, 131, 131, 131, 131, 131, 131,
648 172, 172, 172, 172, 172, 172, 172, 172, 172, 172,
649 172, 172, 172, 172, 172, 172, 172, 75, 75, 75,
650 75, 75, 75, 75, 75, 75, 75, 75, 75, 75,
651
652 75, 75, 75, 75, 185, 185, 185, 185, 185, 185,
653 185, 185, 185, 185, 185, 185, 185, 185, 185, 185,
654 185, 195, 195, 195, 195, 195, 195, 195, 195, 195,
655 195, 195, 195, 195, 195, 195, 195, 195, 197, 420,
656 229, 228, 227, 226, 197, 197, 197, 197, 219, 197,
657 197, 199, 216, 420, 420, 199, 420, 199, 199, 199,
658 199, 199, 199, 199, 202, 420, 202, 202, 420, 202,
659 230, 230, 420, 230, 230, 230, 230, 230, 230, 230,
660 420, 230, 230, 230, 230, 420, 230, 231, 231, 231,
661 231, 231, 231, 231, 231, 231, 231, 231, 231, 231,
662
663 231, 231, 231, 231, 238, 238, 420, 420, 238, 238,
664 238, 238, 238, 238, 238, 238, 238, 238, 238, 420,
665 238, 239, 239, 239, 239, 239, 239, 239, 239, 239,
666 239, 239, 239, 239, 239, 239, 239, 239, 242, 242,
667 420, 242, 242, 420, 242, 242, 242, 242, 242, 242,
668 242, 242, 242, 420, 242, 243, 243, 420, 243, 243,
669 243, 243, 243, 243, 243, 243, 243, 420, 243, 243,
670 420, 243, 244, 244, 420, 244, 244, 244, 244, 244,
671 420, 244, 244, 244, 244, 244, 244, 244, 244, 245,
672 245, 420, 245, 245, 245, 245, 245, 245, 245, 245,
673
674 245, 245, 245, 245, 245, 245, 250, 420, 420, 420,
675 420, 250, 420, 250, 250, 420, 250, 253, 253, 420,
676 420, 253, 420, 253, 253, 253, 253, 420, 253, 253,
677 253, 253, 420, 253, 254, 254, 254, 254, 254, 254,
678 254, 254, 254, 254, 254, 254, 254, 254, 254, 254,
679 254, 260, 420, 260, 260, 420, 260, 263, 263, 420,
680 420, 420, 420, 263, 263, 263, 263, 420, 420, 263,
681 420, 420, 420, 263, 265, 265, 420, 420, 420, 420,
682 265, 265, 265, 265, 265, 265, 265, 265, 265, 420,
683 265, 266, 266, 420, 420, 420, 420, 266, 266, 266,
684
685 266, 420, 266, 266, 266, 266, 420, 266, 267, 420,
686 267, 267, 420, 267, 277, 277, 420, 420, 277, 420,
687 420, 420, 277, 277, 420, 277, 277, 277, 277, 420,
688 277, 278, 278, 420, 420, 278, 420, 420, 420, 278,
689 278, 278, 278, 278, 278, 278, 420, 278, 283, 283,
690 283, 283, 283, 283, 283, 283, 283, 283, 283, 283,
691 283, 283, 283, 283, 283, 306, 420, 306, 306, 420,
692 306, 314, 420, 314, 314, 420, 314, 315, 315, 315,
693 315, 315, 315, 315, 315, 315, 315, 315, 315, 315,
694 315, 315, 315, 315, 318, 318, 420, 318, 420, 318,
695
696 318, 318, 318, 318, 420, 318, 318, 318, 318, 420,
697 318, 323, 323, 323, 420, 323, 323, 323, 323, 325,
698 325, 420, 325, 325, 325, 325, 325, 325, 325, 325,
699 325, 325, 325, 325, 325, 325, 340, 340, 420, 340,
700 340, 340, 340, 340, 420, 340, 420, 340, 340, 340,
701 340, 420, 340, 354, 354, 420, 354, 354, 354, 354,
702 354, 354, 354, 354, 354, 354, 354, 354, 354, 354,
703 45, 420, 420, 420, 420, 420, 420, 420, 420, 420,
704 420, 420, 420, 420, 420, 420, 420, 420, 420, 420,
705 420, 420, 420, 420, 420, 420, 420, 420, 420, 420,
706
707 420, 420, 420, 420, 420, 420, 420, 420, 420, 420,
708 420, 420, 420, 420, 420, 420, 420, 420, 420, 420
709 } ;
710
711 static yyconst short int yy_chk[1821] =
712 { 0,
713 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
714 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
715 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
716 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
717 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
718 47, 2, 47, 417, 2, 3, 3, 3, 3, 3,
719 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
720 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
721 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
722 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
723
724 3, 3, 3, 3, 5, 6, 15, 52, 416, 16,
725 52, 54, 54, 62, 62, 15, 5, 6, 16, 55,
726 54, 55, 61, 54, 55, 61, 74, 74, 5, 6,
727 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
728 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
729 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
730 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
731 7, 7, 7, 7, 7, 7, 7, 7, 7, 9,
732 10, 11, 9, 10, 12, 415, 73, 11, 13, 14,
733 12, 65, 66, 65, 66, 73, 65, 76, 73, 76,
734
735 66, 82, 82, 9, 10, 11, 13, 14, 12, 96,
736 73, 96, 13, 14, 17, 17, 17, 17, 17, 17,
737 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
738 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
739 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
740 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
741 17, 17, 17, 19, 20, 79, 19, 20, 79, 19,
742 20, 86, 86, 413, 94, 19, 20, 94, 98, 100,
743 100, 98, 105, 106, 106, 105, 405, 19, 20, 21,
744 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
745
746 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
747 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
748 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
749 21, 21, 21, 21, 21, 21, 21, 21, 23, 23,
750 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
751 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
752 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
753 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
754 23, 23, 23, 23, 23, 23, 23, 25, 25, 25,
755 26, 26, 26, 403, 108, 25, 108, 110, 26, 110,
756
757 35, 35, 35, 400, 36, 36, 36, 113, 115, 115,
758 113, 121, 25, 35, 121, 26, 27, 36, 393, 27,
759 124, 124, 27, 27, 27, 35, 27, 388, 27, 36,
760 41, 127, 127, 127, 41, 130, 130, 139, 139, 127,
761 27, 28, 41, 138, 28, 386, 138, 28, 28, 28,
762 141, 28, 141, 28, 41, 146, 127, 150, 146, 150,
763 156, 159, 159, 156, 384, 28, 29, 29, 29, 29,
764 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
765 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
766 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
767
768 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
769 29, 29, 29, 29, 29, 31, 31, 31, 31, 31,
770 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
771 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
772 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
773 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
774 31, 31, 31, 31, 33, 33, 33, 33, 33, 33,
775 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
776 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
777 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
778
779 33, 33, 33, 33, 33, 33, 33, 33, 33, 33,
780 33, 33, 33, 37, 37, 37, 167, 37, 167, 42,
781 42, 42, 161, 161, 42, 163, 163, 37, 37, 37,
782 169, 383, 42, 169, 171, 171, 176, 176, 37, 38,
783 38, 38, 346, 38, 42, 173, 175, 173, 376, 175,
784 177, 177, 177, 38, 38, 38, 179, 182, 179, 375,
785 182, 184, 184, 346, 38, 39, 39, 39, 39, 39,
786 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
787 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
788 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
789
790 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
791 39, 39, 39, 39, 43, 43, 43, 43, 43, 43,
792 43, 43, 43, 43, 43, 43, 43, 367, 43, 158,
793 158, 158, 43, 43, 43, 366, 188, 158, 158, 188,
794 189, 189, 190, 192, 190, 192, 196, 190, 198, 196,
795 198, 158, 199, 220, 245, 199, 205, 245, 205, 158,
796 220, 205, 43, 44, 44, 44, 44, 44, 44, 44,
797 44, 44, 44, 44, 44, 44, 246, 44, 224, 246,
798 224, 44, 44, 44, 210, 211, 210, 211, 235, 210,
799 235, 365, 248, 211, 248, 255, 257, 255, 257, 258,
800
801 265, 258, 268, 265, 268, 271, 271, 271, 224, 274,
802 274, 44, 58, 271, 58, 278, 224, 282, 278, 285,
803 282, 285, 291, 295, 305, 309, 305, 309, 363, 362,
804 271, 312, 312, 312, 361, 360, 291, 295, 359, 58,
805 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
806 58, 58, 58, 58, 58, 58, 58, 58, 58, 63,
807 289, 63, 288, 288, 288, 358, 289, 289, 345, 355,
808 288, 288, 313, 321, 313, 321, 353, 322, 321, 322,
809 289, 332, 345, 332, 288, 341, 347, 341, 289, 63,
810 63, 343, 288, 343, 63, 63, 348, 290, 290, 63,
811
812 347, 339, 338, 63, 63, 125, 125, 337, 125, 125,
813 348, 290, 125, 336, 125, 125, 125, 125, 125, 290,
814 293, 293, 293, 125, 125, 125, 294, 294, 293, 293,
815 344, 344, 125, 349, 349, 350, 356, 351, 356, 357,
816 294, 357, 293, 335, 344, 352, 334, 349, 294, 333,
817 293, 351, 344, 125, 148, 349, 350, 148, 148, 352,
818 148, 148, 368, 148, 148, 369, 148, 148, 370, 148,
819 148, 148, 148, 148, 148, 364, 373, 364, 377, 369,
820 377, 331, 370, 368, 372, 372, 378, 379, 378, 379,
821 373, 380, 381, 380, 381, 382, 390, 382, 372, 385,
822
823 391, 385, 148, 157, 157, 157, 372, 387, 392, 387,
824 330, 157, 157, 157, 391, 329, 394, 390, 394, 395,
825 328, 395, 392, 327, 396, 157, 396, 397, 398, 397,
826 398, 326, 399, 157, 399, 157, 324, 324, 320, 324,
827 324, 324, 324, 324, 324, 324, 324, 324, 324, 401,
828 402, 401, 402, 317, 324, 324, 324, 406, 407, 406,
829 407, 408, 409, 408, 409, 410, 412, 410, 412, 414,
830 418, 414, 418, 419, 462, 419, 462, 311, 308, 303,
831 302, 281, 276, 269, 324, 354, 354, 408, 354, 354,
832 354, 354, 354, 354, 354, 354, 354, 354, 262, 259,
833
834 256, 252, 250, 354, 354, 354, 241, 237, 234, 229,
835 228, 227, 226, 225, 223, 222, 221, 219, 218, 215,
836 214, 213, 212, 209, 204, 165, 164, 160, 154, 152,
837 119, 112, 99, 354, 421, 421, 421, 421, 421, 421,
838 421, 421, 421, 421, 421, 421, 421, 421, 421, 421,
839 421, 422, 422, 422, 422, 422, 422, 422, 422, 422,
840 422, 422, 422, 422, 422, 422, 422, 422, 423, 423,
841 423, 423, 423, 423, 423, 423, 423, 423, 423, 423,
842 423, 423, 423, 423, 423, 424, 424, 424, 424, 424,
843 424, 424, 424, 424, 424, 424, 424, 424, 424, 424,
844
845 424, 424, 425, 425, 425, 425, 425, 425, 425, 425,
846 425, 425, 425, 425, 425, 425, 425, 425, 425, 426,
847 426, 426, 426, 426, 426, 426, 426, 426, 426, 426,
848 426, 426, 426, 426, 426, 426, 427, 427, 427, 427,
849 427, 427, 427, 427, 427, 427, 427, 427, 427, 427,
850 427, 427, 427, 428, 428, 428, 428, 428, 428, 428,
851 428, 428, 428, 428, 428, 428, 428, 428, 428, 428,
852 429, 429, 429, 429, 429, 429, 429, 429, 429, 429,
853 429, 429, 429, 429, 429, 429, 429, 430, 430, 430,
854 430, 430, 430, 430, 430, 430, 430, 430, 430, 430,
855
856 430, 430, 430, 430, 431, 431, 431, 431, 431, 431,
857 431, 431, 431, 431, 431, 431, 431, 431, 431, 431,
858 431, 432, 432, 432, 432, 432, 432, 432, 432, 432,
859 432, 432, 432, 432, 432, 432, 432, 432, 433, 89,
860 70, 69, 68, 67, 433, 433, 433, 433, 64, 433,
861 433, 434, 60, 45, 0, 434, 0, 434, 434, 434,
862 434, 434, 434, 434, 435, 0, 435, 435, 0, 435,
863 436, 436, 0, 436, 436, 436, 436, 436, 436, 436,
864 0, 436, 436, 436, 436, 0, 436, 437, 437, 437,
865 437, 437, 437, 437, 437, 437, 437, 437, 437, 437,
866
867 437, 437, 437, 437, 438, 438, 0, 0, 438, 438,
868 438, 438, 438, 438, 438, 438, 438, 438, 438, 0,
869 438, 439, 439, 439, 439, 439, 439, 439, 439, 439,
870 439, 439, 439, 439, 439, 439, 439, 439, 440, 440,
871 0, 440, 440, 0, 440, 440, 440, 440, 440, 440,
872 440, 440, 440, 0, 440, 441, 441, 0, 441, 441,
873 441, 441, 441, 441, 441, 441, 441, 0, 441, 441,
874 0, 441, 442, 442, 0, 442, 442, 442, 442, 442,
875 0, 442, 442, 442, 442, 442, 442, 442, 442, 443,
876 443, 0, 443, 443, 443, 443, 443, 443, 443, 443,
877
878 443, 443, 443, 443, 443, 443, 444, 0, 0, 0,
879 0, 444, 0, 444, 444, 0, 444, 445, 445, 0,
880 0, 445, 0, 445, 445, 445, 445, 0, 445, 445,
881 445, 445, 0, 445, 446, 446, 446, 446, 446, 446,
882 446, 446, 446, 446, 446, 446, 446, 446, 446, 446,
883 446, 447, 0, 447, 447, 0, 447, 448, 448, 0,
884 0, 0, 0, 448, 448, 448, 448, 0, 0, 448,
885 0, 0, 0, 448, 449, 449, 0, 0, 0, 0,
886 449, 449, 449, 449, 449, 449, 449, 449, 449, 0,
887 449, 450, 450, 0, 0, 0, 0, 450, 450, 450,
888
889 450, 0, 450, 450, 450, 450, 0, 450, 451, 0,
890 451, 451, 0, 451, 452, 452, 0, 0, 452, 0,
891 0, 0, 452, 452, 0, 452, 452, 452, 452, 0,
892 452, 453, 453, 0, 0, 453, 0, 0, 0, 453,
893 453, 453, 453, 453, 453, 453, 0, 453, 454, 454,
894 454, 454, 454, 454, 454, 454, 454, 454, 454, 454,
895 454, 454, 454, 454, 454, 455, 0, 455, 455, 0,
896 455, 456, 0, 456, 456, 0, 456, 457, 457, 457,
897 457, 457, 457, 457, 457, 457, 457, 457, 457, 457,
898 457, 457, 457, 457, 458, 458, 0, 458, 0, 458,
899
900 458, 458, 458, 458, 0, 458, 458, 458, 458, 0,
901 458, 459, 459, 459, 0, 459, 459, 459, 459, 460,
902 460, 0, 460, 460, 460, 460, 460, 460, 460, 460,
903 460, 460, 460, 460, 460, 460, 461, 461, 0, 461,
904 461, 461, 461, 461, 0, 461, 0, 461, 461, 461,
905 461, 0, 461, 463, 463, 0, 463, 463, 463, 463,
906 463, 463, 463, 463, 463, 463, 463, 463, 463, 463,
907 420, 420, 420, 420, 420, 420, 420, 420, 420, 420,
908 420, 420, 420, 420, 420, 420, 420, 420, 420, 420,
909 420, 420, 420, 420, 420, 420, 420, 420, 420, 420,
910
911 420, 420, 420, 420, 420, 420, 420, 420, 420, 420,
912 420, 420, 420, 420, 420, 420, 420, 420, 420, 420
913 } ;
914
915 static yy_state_type yy_last_accepting_state;
916 static char *yy_last_accepting_cpos;
917
918 /* The intent behind this definition is that it'll catch
919 * any uses of REJECT which flex missed.
920 */
921 #define REJECT reject_used_but_not_detected
922 #define yymore() yymore_used_but_not_detected
923 #define YY_MORE_ADJ 0
924 #define YY_RESTORE_YY_MORE_OFFSET
925 char *yytext;
926 #line 1 "tools/wpp/ppl.l"
927 #define INITIAL 0
928 /* -*-C-*-
929 * Wrc preprocessor lexical analysis
930 *
931 * Copyright 1999-2000 Bertho A. Stultiens (BS)
932 *
933 * This library is free software; you can redistribute it and/or
934 * modify it under the terms of the GNU Lesser General Public
935 * License as published by the Free Software Foundation; either
936 * version 2.1 of the License, or (at your option) any later version.
937 *
938 * This library is distributed in the hope that it will be useful,
939 * but WITHOUT ANY WARRANTY; without even the implied warranty of
940 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
941 * Lesser General Public License for more details.
942 *
943 * You should have received a copy of the GNU Lesser General Public
944 * License along with this library; if not, write to the Free Software
945 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
946 *
947 * History:
948 * 24-Apr-2000 BS - Started from scratch to restructure everything
949 * and reintegrate the source into the wine-tree.
950 * 04-Jan-2000 BS - Added comments about the lexicographical
951 * grammar to give some insight in the complexity.
952 * 28-Dec-1999 BS - Eliminated backing-up of the flexer by running
953 * `flex -b' on the source. This results in some
954 * weirdo extra rules, but a much faster scanner.
955 * 23-Dec-1999 BS - Started this file
956 *
957 *-------------------------------------------------------------------------
958 * The preprocessor's lexographical grammar (approximately):
959 *
960 * pp := {ws} # {ws} if {ws} {expr} {ws} \n
961 * | {ws} # {ws} ifdef {ws} {id} {ws} \n
962 * | {ws} # {ws} ifndef {ws} {id} {ws} \n
963 * | {ws} # {ws} elif {ws} {expr} {ws} \n
964 * | {ws} # {ws} else {ws} \n
965 * | {ws} # {ws} endif {ws} \n
966 * | {ws} # {ws} include {ws} < {anytext} > \n
967 * | {ws} # {ws} include {ws} " {anytext} " \n
968 * | {ws} # {ws} include_next {ws} < {anytext} > \n
969 * | {ws} # {ws} include_next {ws} " {anytext} " \n
970 * | {ws} # {ws} define {ws} {anytext} \n
971 * | {ws} # {ws} define( {arglist} ) {ws} {expansion} \n
972 * | {ws} # {ws} pragma {ws} {anytext} \n
973 * | {ws} # {ws} ident {ws} {anytext} \n
974 * | {ws} # {ws} error {ws} {anytext} \n
975 * | {ws} # {ws} warning {ws} {anytext} \n
976 * | {ws} # {ws} line {ws} " {anytext} " {number} \n
977 * | {ws} # {ws} {number} " {anytext} " {number} [ {number} [{number}] ] \n
978 * | {ws} # {ws} \n
979 *
980 * ws := [ \t\r\f\v]*
981 *
982 * expr := {expr} [+-*%^/|&] {expr}
983 * | {expr} {logor|logand} {expr}
984 * | [!~+-] {expr}
985 * | {expr} ? {expr} : {expr}
986 *
987 * logor := ||
988 *
989 * logand := &&
990 *
991 * id := [a-zA-Z_][a-zA-Z0-9_]*
992 *
993 * anytext := [^\n]* (see note)
994 *
995 * arglist :=
996 * | {id}
997 * | {arglist} , {id}
998 * | {arglist} , {id} ...
999 *
1000 * expansion := {id}
1001 * | # {id}
1002 * | {anytext}
1003 * | {anytext} ## {anytext}
1004 *
1005 * number := [0-9]+
1006 *
1007 * Note: "anytext" is not always "[^\n]*". This is because the
1008 * trailing context must be considered as well.
1009 *
1010 * The only certain assumption for the preprocessor to make is that
1011 * directives start at the beginning of the line, followed by a '#'
1012 * and end with a newline.
1013 * Any directive may be suffixed with a line-continuation. Also
1014 * classical comment / *...* / (note: no comments within comments,
1015 * therefore spaces) is considered to be a line-continuation
1016 * (according to gcc and egcs AFAIK, ANSI is a bit vague).
1017 * Comments have not been added to the above grammar for simplicity
1018 * reasons. However, it is allowed to enter comment anywhere within
1019 * the directives as long as they do not interfere with the context.
1020 * All comments are considered to be deletable whitespace (both
1021 * classical form "/ *...* /" and C++ form "//...\n").
1022 *
1023 * All recursive scans, except for macro-expansion, are done by the
1024 * parser, whereas the simple state transitions of non-recursive
1025 * directives are done in the scanner. This results in the many
1026 * exclusive start-conditions of the scanner.
1027 *
1028 * Macro expansions are slightly more difficult because they have to
1029 * prescan the arguments. Parameter substitution is literal if the
1030 * substitution is # or ## (either side). This enables new identifiers
1031 * to be created (see 'info cpp' node Macro|Pitfalls|Prescan for more
1032 * information).
1033 *
1034 * FIXME: Variable macro parameters is recognized, but not yet
1035 * expanded. I have to reread the ANSI standard on the subject (yes,
1036 * ANSI defines it).
1037 *
1038 * The following special defines are supported:
1039 * __FILE__ -> "thissource.c"
1040 * __LINE__ -> 123
1041 * __DATE__ -> "May 1 2000"
1042 * __TIME__ -> "23:59:59"
1043 * These macros expand, as expected, into their ANSI defined values.
1044 *
1045 * The same include prevention is implemented as gcc and egcs does.
1046 * This results in faster processing because we do not read the text
1047 * at all. Some wine-sources attempt to include the same file 4 or 5
1048 * times. This strategy also saves a lot blank output-lines, which in
1049 * its turn improves the real resource scanner/parser.
1050 *
1051 */
1052 /*
1053 * Special flex options and exclusive scanner start-conditions
1054 */
1055 #define YY_STACK_USED 1
1056 #define YY_NEVER_INTERACTIVE 1
1057 #define YY_NO_UNPUT 1
1058 #define pp_pp 1
1059
1060 #define pp_eol 2
1061
1062 #define pp_inc 3
1063
1064 #define pp_dqs 4
1065
1066 #define pp_sqs 5
1067
1068 #define pp_iqs 6
1069
1070 #define pp_comment 7
1071
1072 #define pp_def 8
1073
1074 #define pp_define 9
1075
1076 #define pp_macro 10
1077
1078 #define pp_mbody 11
1079
1080 #define pp_macign 12
1081
1082 #define pp_macscan 13
1083
1084 #define pp_macexp 14
1085
1086 #define pp_if 15
1087
1088 #define pp_ifd 16
1089
1090 #define pp_endif 17
1091
1092 #define pp_line 18
1093
1094 #define pp_defined 19
1095
1096 #define pp_ignore 20
1097
1098 #define RCINCL 21
1099
1100 #line 161 "tools/wpp/ppl.l"
1101 #include <stdio.h>
1102 #include <stdlib.h>
1103 #include <string.h>
1104 #include <ctype.h>
1105 #include <assert.h>
1106
1107 #include "wpp_private.h"
1108 #include "ppy.tab.h"
1109
1110 /*
1111 * Make sure that we are running an appropriate version of flex.
1112 */
1113 #if !defined(YY_FLEX_MAJOR_VERSION) || (1000 * YY_FLEX_MAJOR_VERSION + YY_FLEX_MINOR_VERSION < 2005)
1114 #error Must use flex version 2.5.1 or higher (yy_scan_* routines are required).
1115 #endif
1116
1117 #define YY_READ_BUF_SIZE 65536 /* So we read most of a file at once */
1118
1119 #define yy_current_state() YY_START
1120 #define yy_pp_state(x) yy_pop_state(); yy_push_state(x)
1121
1122 /*
1123 * Always update the current character position within a line
1124 */
1125 #define YY_USER_ACTION pp_status.char_number+=ppleng;
1126
1127 /*
1128 * Buffer management for includes and expansions
1129 */
1130 #define MAXBUFFERSTACK 128 /* Nesting more than 128 includes or macro expansion textss is insane */
1131
1132 typedef struct bufferstackentry {
1133 YY_BUFFER_STATE bufferstate; /* Buffer to switch back to */
1134 pp_entry_t *define; /* Points to expanding define or NULL if handling includes */
1135 int line_number; /* Line that we were handling */
1136 int char_number; /* The current position on that line */
1137 const char *filename; /* Filename that we were handling */
1138 int if_depth; /* How many #if:s deep to check matching #endif:s */
1139 int ncontinuations; /* Remember the continuation state */
1140 int should_pop; /* Set if we must pop the start-state on EOF */
1141 /* Include management */
1142 include_state_t incl;
1143 char *include_filename;
1144 int pass_data;
1145 } bufferstackentry_t;
1146
1147 #define ALLOCBLOCKSIZE (1 << 10) /* Allocate these chunks at a time for string-buffers */
1148
1149 /*
1150 * Macro expansion nesting
1151 * We need the stack to handle expansions while scanning
1152 * a macro's arguments. The TOS must always be the macro
1153 * that receives the current expansion from the scanner.
1154 */
1155 #define MAXMACEXPSTACK 128 /* Nesting more than 128 macro expansions is insane */
1156
1157 typedef struct macexpstackentry {
1158 pp_entry_t *ppp; /* This macro we are scanning */
1159 char **args; /* With these arguments */
1160 char **ppargs; /* Resulting in these preprocessed arguments */
1161 int *nnls; /* Number of newlines per argument */
1162 int nargs; /* And this many arguments scanned */
1163 int parentheses; /* Nesting level of () */
1164 int curargsize; /* Current scanning argument's size */
1165 int curargalloc; /* Current scanning argument's block allocated */
1166 char *curarg; /* Current scanning argument's content */
1167 } macexpstackentry_t;
1168
1169 #define MACROPARENTHESES() (top_macro()->parentheses)
1170
1171 /*
1172 * Prototypes
1173 */
1174 static void newline(int);
1175 static int make_number(int radix, YYSTYPE *val, const char *str, int len);
1176 static void put_buffer(const char *s, int len);
1177 static int is_c_h_include(char *fname, int quoted);
1178 /* Buffer management */
1179 static void push_buffer(pp_entry_t *ppp, char *filename, char *incname, int pop);
1180 static bufferstackentry_t *pop_buffer(void);
1181 /* String functions */
1182 static void new_string(void);
1183 static void add_string(const char *str, int len);
1184 static char *get_string(void);
1185 static void put_string(void);
1186 static int string_start(void);
1187 /* Macro functions */
1188 static void push_macro(pp_entry_t *ppp);
1189 static macexpstackentry_t *top_macro(void);
1190 static macexpstackentry_t *pop_macro(void);
1191 static void free_macro(macexpstackentry_t *mep);
1192 static void add_text_to_macro(const char *text, int len);
1193 static void macro_add_arg(int last);
1194 static void macro_add_expansion(void);
1195 /* Expansion */
1196 static void expand_special(pp_entry_t *ppp);
1197 static void expand_define(pp_entry_t *ppp);
1198 static void expand_macro(macexpstackentry_t *mep);
1199
1200 /*
1201 * Local variables
1202 */
1203 static int ncontinuations;
1204
1205 static int strbuf_idx = 0;
1206 static int strbuf_alloc = 0;
1207 static char *strbuffer = NULL;
1208 static int str_startline;
1209
1210 static macexpstackentry_t *macexpstack[MAXMACEXPSTACK];
1211 static int macexpstackidx = 0;
1212
1213 static bufferstackentry_t bufferstack[MAXBUFFERSTACK];
1214 static int bufferstackidx = 0;
1215
1216 static int pass_data=1;
1217
1218 /*
1219 * Global variables
1220 */
1221 include_state_t pp_incl_state =
1222 {
1223 -1, /* state */
1224 NULL, /* ppp */
1225 0, /* ifdepth */
1226 0 /* seen_junk */
1227 };
1228
1229 includelogicentry_t *pp_includelogiclist = NULL;
1230
1231 /*
1232 **************************************************************************
1233 * The scanner starts here
1234 **************************************************************************
1235 */
1236 #line 1237 "tools/wpp/lex.yy.c"
1237
1238 /* Macros after this point can all be overridden by user definitions in
1239 * section 1.
1240 */
1241
1242 #ifndef YY_SKIP_YYWRAP
1243 #ifdef __cplusplus
1244 extern "C" int yywrap YY_PROTO(( void ));
1245 #else
1246 extern int yywrap YY_PROTO(( void ));
1247 #endif
1248 #endif
1249
1250 #ifndef YY_NO_UNPUT
1251 static void yyunput YY_PROTO(( int c, char *buf_ptr ));
1252 #endif
1253
1254 #ifndef yytext_ptr
1255 static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
1256 #endif
1257
1258 #ifdef YY_NEED_STRLEN
1259 static int yy_flex_strlen YY_PROTO(( yyconst char * ));
1260 #endif
1261
1262 #ifndef YY_NO_INPUT
1263 #ifdef __cplusplus
1264 static int yyinput YY_PROTO(( void ));
1265 #else
1266 static int input YY_PROTO(( void ));
1267 #endif
1268 #endif
1269
1270 #if YY_STACK_USED
1271 static int yy_start_stack_ptr = 0;
1272 static int yy_start_stack_depth = 0;
1273 static int *yy_start_stack = 0;
1274 #ifndef YY_NO_PUSH_STATE
1275 static void yy_push_state YY_PROTO(( int new_state ));
1276 #endif
1277 #ifndef YY_NO_POP_STATE
1278 static void yy_pop_state YY_PROTO(( void ));
1279 #endif
1280 #ifndef YY_NO_TOP_STATE
1281 static int yy_top_state YY_PROTO(( void ));
1282 #endif
1283
1284 #else
1285 #define YY_NO_PUSH_STATE 1
1286 #define YY_NO_POP_STATE 1
1287 #define YY_NO_TOP_STATE 1
1288 #endif
1289
1290 #ifdef YY_MALLOC_DECL
1291 YY_MALLOC_DECL
1292 #else
1293 #if __STDC__
1294 #ifndef __cplusplus
1295 #include <stdlib.h>
1296 #endif
1297 #else
1298 /* Just try to get by without declaring the routines. This will fail
1299 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
1300 * or sizeof(void*) != sizeof(int).
1301 */
1302 #endif
1303 #endif
1304
1305 /* Amount of stuff to slurp up with each read. */
1306 #ifndef YY_READ_BUF_SIZE
1307 #define YY_READ_BUF_SIZE 8192
1308 #endif
1309
1310 /* Copy whatever the last rule matched to the standard output. */
1311
1312 #ifndef ECHO
1313 /* This used to be an fputs(), but since the string might contain NUL's,
1314 * we now use fwrite().
1315 */
1316 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
1317 #endif
1318
1319 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
1320 * is returned in "result".
1321 */
1322 #ifndef YY_INPUT
1323 #define YY_INPUT(buf,result,max_size) \
1324 if ( yy_current_buffer->yy_is_interactive ) \
1325 { \
1326 int c = '*', n; \
1327 for ( n = 0; n < max_size && \
1328 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
1329 buf[n] = (char) c; \
1330 if ( c == '\n' ) \
1331 buf[n++] = (char) c; \
1332 if ( c == EOF && ferror( yyin ) ) \
1333 YY_FATAL_ERROR( "input in flex scanner failed" ); \
1334 result = n; \
1335 } \
1336 else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
1337 && ferror( yyin ) ) \
1338 YY_FATAL_ERROR( "input in flex scanner failed" );
1339 #endif
1340
1341 /* No semi-colon after return; correct usage is to write "yyterminate();" -
1342 * we don't want an extra ';' after the "return" because that will cause
1343 * some compilers to complain about unreachable statements.
1344 */
1345 #ifndef yyterminate
1346 #define yyterminate() return YY_NULL
1347 #endif
1348
1349 /* Number of entries by which start-condition stack grows. */
1350 #ifndef YY_START_STACK_INCR
1351 #define YY_START_STACK_INCR 25
1352 #endif
1353
1354 /* Report a fatal error. */
1355 #ifndef YY_FATAL_ERROR
1356 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
1357 #endif
1358
1359 /* Default declaration of generated scanner - a define so the user can
1360 * easily add parameters.
1361 */
1362 #ifndef YY_DECL
1363 #define YY_DECL int yylex YY_PROTO(( void ))
1364 #endif
1365
1366 /* Code executed at the beginning of each rule, after yytext and yyleng
1367 * have been set up.
1368 */
1369 #ifndef YY_USER_ACTION
1370 #define YY_USER_ACTION
1371 #endif
1372
1373 /* Code executed at the end of each rule. */
1374 #ifndef YY_BREAK
1375 #define YY_BREAK break;
1376 #endif
1377
1378 #define YY_RULE_SETUP \
1379 if ( yyleng > 0 ) \
1380 yy_current_buffer->yy_at_bol = \
1381 (yytext[yyleng - 1] == '\n'); \
1382 YY_USER_ACTION
1383
1384 YY_DECL
1385 {
1386 register yy_state_type yy_current_state;
1387 register char *yy_cp = NULL, *yy_bp = NULL;
1388 register int yy_act;
1389
1390 #line 299 "tools/wpp/ppl.l"
1391
1392 /*
1393 * Catch line-continuations.
1394 * Note: Gcc keeps the line-continuations in, for example, strings
1395 * intact. However, I prefer to remove them all so that the next
1396 * scanner will not need to reduce the continuation state.
1397 *
1398 * <*>\\\n newline(0);
1399 */
1400
1401 /*
1402 * Detect the leading # of a preprocessor directive.
1403 */
1404 #line 1405 "tools/wpp/lex.yy.c"
1405
1406 if ( yy_init )
1407 {
1408 yy_init = 0;
1409
1410 #ifdef YY_USER_INIT
1411 YY_USER_INIT;
1412 #endif
1413
1414 if ( ! yy_start )
1415 yy_start = 1; /* first start state */
1416
1417 if ( ! yyin )
1418 yyin = stdin;
1419
1420 if ( ! yyout )
1421 yyout = stdout;
1422
1423 if ( ! yy_current_buffer )
1424 yy_current_buffer =
1425 yy_create_buffer( yyin, YY_BUF_SIZE );
1426
1427 yy_load_buffer_state();
1428 }
1429
1430 while ( 1 ) /* loops until end-of-file is reached */
1431 {
1432 yy_cp = yy_c_buf_p;
1433
1434 /* Support of yytext. */
1435 *yy_cp = yy_hold_char;
1436
1437 /* yy_bp points to the position in yy_ch_buf of the start of
1438 * the current run.
1439 */
1440 yy_bp = yy_cp;
1441
1442 yy_current_state = yy_start;
1443 yy_current_state += YY_AT_BOL();
1444 yy_match:
1445 do
1446 {
1447 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
1448 if ( yy_accept[yy_current_state] )
1449 {
1450 yy_last_accepting_state = yy_current_state;
1451 yy_last_accepting_cpos = yy_cp;
1452 }
1453 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1454 {
1455 yy_current_state = (int) yy_def[yy_current_state];
1456 if ( yy_current_state >= 421 )
1457 yy_c = yy_meta[(unsigned int) yy_c];
1458 }
1459 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1460 ++yy_cp;
1461 }
1462 while ( yy_base[yy_current_state] != 1771 );
1463
1464 yy_find_action:
1465 yy_act = yy_accept[yy_current_state];
1466 if ( yy_act == 0 )
1467 { /* have to back up */
1468 yy_cp = yy_last_accepting_cpos;
1469 yy_current_state = yy_last_accepting_state;
1470 yy_act = yy_accept[yy_current_state];
1471 }
1472
1473 YY_DO_BEFORE_ACTION;
1474
1475
1476 do_action: /* This label is used only to access EOF actions. */
1477
1478
1479 switch ( yy_act )
1480 { /* beginning of action switch */
1481 case 0: /* must back up */
1482 /* undo the effects of YY_DO_BEFORE_ACTION */
1483 *yy_cp = yy_hold_char;
1484 yy_cp = yy_last_accepting_cpos;
1485 yy_current_state = yy_last_accepting_state;
1486 goto yy_find_action;
1487
1488 case 1:
1489 YY_RULE_SETUP
1490 #line 312 "tools/wpp/ppl.l"
1491 pp_incl_state.seen_junk++; yy_push_state(pp_pp);
1492 YY_BREAK
1493 /*
1494 * Scan for the preprocessor directives
1495 */
1496 case 2:
1497 YY_RULE_SETUP
1498 #line 317 "tools/wpp/ppl.l"
1499 if(yy_top_state() != pp_ignore) {yy_pp_state(pp_inc); return tINCLUDE;} else {yy_pp_state(pp_eol);}
1500 YY_BREAK
1501 case 3:
1502 YY_RULE_SETUP
1503 #line 318 "tools/wpp/ppl.l"
1504 if(yy_top_state() != pp_ignore) {yy_pp_state(pp_inc); return tINCLUDE_NEXT;} else {yy_pp_state(pp_eol);}
1505 YY_BREAK
1506 case 4:
1507 YY_RULE_SETUP
1508 #line 319 "tools/wpp/ppl.l"
1509 yy_pp_state(yy_current_state() != pp_ignore ? pp_def : pp_eol);
1510 YY_BREAK
1511 case 5:
1512 YY_RULE_SETUP
1513 #line 320 "tools/wpp/ppl.l"
1514 yy_pp_state(pp_eol); if(yy_top_state() != pp_ignore) return tERROR;
1515 YY_BREAK
1516 case 6:
1517 YY_RULE_SETUP
1518 #line 321 "tools/wpp/ppl.l"
1519 yy_pp_state(pp_eol); if(yy_top_state() != pp_ignore) return tWARNING;
1520 YY_BREAK
1521 case 7:
1522 YY_RULE_SETUP
1523 #line 322 "tools/wpp/ppl.l"
1524 yy_pp_state(pp_eol); if(yy_top_state() != pp_ignore) return tPRAGMA;
1525 YY_BREAK
1526 case 8:
1527 YY_RULE_SETUP
1528 #line 323 "tools/wpp/ppl.l"
1529 yy_pp_state(pp_eol); if(yy_top_state() != pp_ignore) return tPPIDENT;
1530 YY_BREAK
1531 case 9:
1532 YY_RULE_SETUP
1533 #line 324 "tools/wpp/ppl.l"
1534 if(yy_top_state() != pp_ignore) {yy_pp_state(pp_ifd); return tUNDEF;} else {yy_pp_state(pp_eol);}
1535 YY_BREAK
1536 case 10:
1537 YY_RULE_SETUP
1538 #line 325 "tools/wpp/ppl.l"
1539 yy_pp_state(pp_ifd); return tIFDEF;
1540 YY_BREAK
1541 case 11:
1542 YY_RULE_SETUP
1543 #line 326 "tools/wpp/ppl.l"
1544 pp_incl_state.seen_junk--; yy_pp_state(pp_ifd); return tIFNDEF;
1545 YY_BREAK
1546 case 12:
1547 YY_RULE_SETUP
1548 #line 327 "tools/wpp/ppl.l"
1549 yy_pp_state(pp_if); return tIF;
1550 YY_BREAK
1551 case 13:
1552 YY_RULE_SETUP
1553 #line 328 "tools/wpp/ppl.l"
1554 yy_pp_state(pp_if); return tELIF;
1555 YY_BREAK
1556 case 14:
1557 YY_RULE_SETUP
1558 #line 329 "tools/wpp/ppl.l"
1559 yy_pp_state(pp_endif); return tELSE;
1560 YY_BREAK
1561 case 15:
1562 YY_RULE_SETUP
1563 #line 330 "tools/wpp/ppl.l"
1564 yy_pp_state(pp_endif); return tENDIF;
1565 YY_BREAK
1566 case 16:
1567 YY_RULE_SETUP
1568 #line 331 "tools/wpp/ppl.l"
1569 if(yy_top_state() != pp_ignore) {yy_pp_state(pp_line); return tLINE;} else {yy_pp_state(pp_eol);}
1570 YY_BREAK
1571 case 17:
1572 YY_RULE_SETUP
1573 #line 332 "tools/wpp/ppl.l"
1574 if(yy_top_state() != pp_ignore) {yy_pp_state(pp_line); return tGCCLINE;} else {yy_pp_state(pp_eol);}
1575 YY_BREAK
1576 case 18:
1577 YY_RULE_SETUP
1578 #line 333 "tools/wpp/ppl.l"
1579 pperror("Invalid preprocessor token '%s'", pptext);
1580 YY_BREAK
1581 case 19:
1582 YY_RULE_SETUP
1583 #line 334 "tools/wpp/ppl.l"
1584 newline(1); yy_pop_state(); return tNL; /* This could be the null-token */
1585 YY_BREAK
1586 case 20:
1587 YY_RULE_SETUP
1588 #line 335 "tools/wpp/ppl.l"
1589 newline(0);
1590 YY_BREAK
1591 case 21:
1592 YY_RULE_SETUP
1593 #line 336 "tools/wpp/ppl.l"
1594 pperror("Preprocessor junk '%s'", pptext);
1595 YY_BREAK
1596 case 22:
1597 YY_RULE_SETUP
1598 #line 337 "tools/wpp/ppl.l"
1599 return *pptext;
1600 YY_BREAK
1601 /*
1602 * Handle #include and #line
1603 */
1604 case 23:
1605 YY_RULE_SETUP
1606 #line 342 "tools/wpp/ppl.l"
1607 return make_number(10, &pplval, pptext, ppleng);
1608 YY_BREAK
1609 case 24:
1610 YY_RULE_SETUP
1611 #line 343 "tools/wpp/ppl.l"
1612 new_string(); add_string(pptext, ppleng); yy_push_state(pp_iqs);
1613 YY_BREAK
1614 case 25:
1615 YY_RULE_SETUP
1616 #line 344 "tools/wpp/ppl.l"
1617 new_string(); add_string(pptext, ppleng); yy_push_state(pp_dqs);
1618 YY_BREAK
1619 case 26:
1620 YY_RULE_SETUP
1621 #line 345 "tools/wpp/ppl.l"
1622 ;
1623 YY_BREAK
1624 case 27:
1625 YY_RULE_SETUP
1626 #line 346 "tools/wpp/ppl.l"
1627 newline(1); yy_pop_state(); return tNL;
1628 YY_BREAK
1629 case 28:
1630 YY_RULE_SETUP
1631 #line 347 "tools/wpp/ppl.l"
1632 newline(0);
1633 YY_BREAK
1634 case 29:
1635 YY_RULE_SETUP
1636 #line 348 "tools/wpp/ppl.l"
1637 pperror(yy_current_state() == pp_inc ? "Trailing junk in #include" : "Trailing junk in #line");
1638 YY_BREAK
1639 /*
1640 * Ignore all input when a false clause is parsed
1641 */
1642 case 30:
1643 YY_RULE_SETUP
1644 #line 353 "tools/wpp/ppl.l"
1645 ;
1646 YY_BREAK
1647 case 31:
1648 YY_RULE_SETUP
1649 #line 354 "tools/wpp/ppl.l"
1650 newline(1);
1651 YY_BREAK
1652 case 32:
1653 YY_RULE_SETUP
1654 #line 355 "tools/wpp/ppl.l"
1655 newline(0);
1656 YY_BREAK
1657 case 33:
1658 YY_RULE_SETUP
1659 #line 356 "tools/wpp/ppl.l"
1660 ;
1661 YY_BREAK
1662 /*
1663 * Handle #if and #elif.
1664 * These require conditionals to be evaluated, but we do not
1665 * want to jam the scanner normally when we see these tokens.
1666 * Note: tIDENT is handled below.
1667 */
1668 case 34:
1669 YY_RULE_SETUP
1670 #line 365 "tools/wpp/ppl.l"
1671 return make_number(8, &pplval, pptext, ppleng);
1672 YY_BREAK
1673 case 35:
1674 YY_RULE_SETUP
1675 #line 366 "tools/wpp/ppl.l"
1676 pperror("Invalid octal digit");
1677 YY_BREAK
1678 case 36:
1679 YY_RULE_SETUP
1680 #line 367 "tools/wpp/ppl.l"
1681 return make_number(10, &pplval, pptext, ppleng);
1682 YY_BREAK
1683 case 37:
1684 YY_RULE_SETUP
1685 #line 368 "tools/wpp/ppl.l"
1686 return make_number(16, &pplval, pptext, ppleng);
1687 YY_BREAK
1688 case 38:
1689 YY_RULE_SETUP
1690 #line 369 "tools/wpp/ppl.l"
1691 pperror("Invalid hex number");
1692 YY_BREAK
1693 case 39:
1694 YY_RULE_SETUP
1695 #line 370 "tools/wpp/ppl.l"
1696 yy_push_state(pp_defined); return tDEFINED;
1697 YY_BREAK
1698 case 40:
1699 YY_RULE_SETUP
1700 #line 371 "tools/wpp/ppl.l"
1701 return tLSHIFT;
1702 YY_BREAK
1703 case 41:
1704 YY_RULE_SETUP
1705 #line 372 "tools/wpp/ppl.l"
1706 return tRSHIFT;
1707 YY_BREAK
1708 case 42:
1709 YY_RULE_SETUP
1710 #line 373 "tools/wpp/ppl.l"
1711 return tLOGAND;
1712 YY_BREAK
1713 case 43:
1714 YY_RULE_SETUP
1715 #line 374 "tools/wpp/ppl.l"
1716 return tLOGOR;
1717 YY_BREAK
1718 case 44:
1719 YY_RULE_SETUP
1720 #line 375 "tools/wpp/ppl.l"
1721 return tEQ;
1722 YY_BREAK
1723 case 45:
1724 YY_RULE_SETUP
1725 #line 376 "tools/wpp/ppl.l"
1726 return tNE;
1727 YY_BREAK
1728 case 46:
1729 YY_RULE_SETUP
1730 #line 377 "tools/wpp/ppl.l"
1731 return tLTE;
1732 YY_BREAK
1733 case 47:
1734 YY_RULE_SETUP
1735 #line 378 "tools/wpp/ppl.l"
1736 return tGTE;
1737 YY_BREAK
1738 case 48:
1739 YY_RULE_SETUP
1740 #line 379 "tools/wpp/ppl.l"
1741 newline(1); yy_pop_state(); return tNL;
1742 YY_BREAK
1743 case 49:
1744 YY_RULE_SETUP
1745 #line 380 "tools/wpp/ppl.l"
1746 newline(0);
1747 YY_BREAK
1748 case 50:
1749 YY_RULE_SETUP
1750 #line 381 "tools/wpp/ppl.l"
1751 pperror("Junk in conditional expression");
1752 YY_BREAK
1753 case 51:
1754 YY_RULE_SETUP
1755 #line 382 "tools/wpp/ppl.l"
1756 ;
1757 YY_BREAK
1758 case 52:
1759 YY_RULE_SETUP
1760 #line 383 "tools/wpp/ppl.l"
1761 new_string(); add_string(pptext, ppleng); yy_push_state(pp_sqs);
1762 YY_BREAK
1763 case 53:
1764 YY_RULE_SETUP
1765 #line 384 "tools/wpp/ppl.l"
1766 pperror("String constants not allowed in conditionals");
1767 YY_BREAK
1768 case 54:
1769 YY_RULE_SETUP
1770 #line 385 "tools/wpp/ppl.l"
1771 return *pptext;
1772 YY_BREAK
1773 /*
1774 * Handle #ifdef, #ifndef and #undef
1775 * to get only an untranslated/unexpanded identifier
1776 */
1777 case 55:
1778 YY_RULE_SETUP
1779 #line 391 "tools/wpp/ppl.l"
1780 pplval.cptr = pp_xstrdup(pptext); return tIDENT;
1781 YY_BREAK
1782 case 56:
1783 YY_RULE_SETUP
1784 #line 392 "tools/wpp/ppl.l"
1785 ;
1786 YY_BREAK
1787 case 57:
1788 YY_RULE_SETUP
1789 #line 393 "tools/wpp/ppl.l"
1790 newline(1); yy_pop_state(); return tNL;
1791 YY_BREAK
1792 case 58:
1793 YY_RULE_SETUP
1794 #line 394 "tools/wpp/ppl.l"
1795 newline(0);
1796 YY_BREAK
1797 case 59:
1798 YY_RULE_SETUP
1799 #line 395 "tools/wpp/ppl.l"
1800 pperror("Identifier expected");
1801 YY_BREAK
1802 /*
1803 * Handle #else and #endif.
1804 */
1805 case 60:
1806 YY_RULE_SETUP
1807 #line 400 "tools/wpp/ppl.l"
1808 ;
1809 YY_BREAK
1810 case 61:
1811 YY_RULE_SETUP
1812 #line 401 "tools/wpp/ppl.l"
1813 newline(1); yy_pop_state(); return tNL;
1814 YY_BREAK
1815 case 62:
1816 YY_RULE_SETUP
1817 #line 402 "tools/wpp/ppl.l"
1818 newline(0);
1819 YY_BREAK
1820 case 63:
1821 YY_RULE_SETUP
1822 #line 403 "tools/wpp/ppl.l"
1823 pperror("Garbage after #else or #endif.");
1824 YY_BREAK
1825 /*
1826 * Handle the special 'defined' keyword.
1827 * This is necessary to get the identifier prior to any
1828 * substitutions.
1829 */
1830 case 64:
1831 YY_RULE_SETUP
1832 #line 410 "tools/wpp/ppl.l"
1833 yy_pop_state(); pplval.cptr = pp_xstrdup(pptext); return tIDENT;
1834 YY_BREAK
1835 case 65:
1836 YY_RULE_SETUP
1837 #line 411 "tools/wpp/ppl.l"
1838 ;
1839 YY_BREAK
1840 case 66:
1841 YY_RULE_SETUP
1842 #line 412 "tools/wpp/ppl.l"
1843 return *pptext;
1844 YY_BREAK
1845 case 67:
1846 YY_RULE_SETUP
1847 #line 413 "tools/wpp/ppl.l"
1848 newline(0);
1849 YY_BREAK
1850 case 68:
1851 YY_RULE_SETUP
1852 #line 414 "tools/wpp/ppl.l"
1853 pperror("Identifier expected");
1854 YY_BREAK
1855 /*
1856 * Handle #error, #warning, #pragma and #ident.
1857 * Pass everything literally to the parser, which
1858 * will act appropriately.
1859 * Comments are stripped from the literal text.
1860 */
1861 case 69:
1862 YY_RULE_SETUP
1863 #line 422 "tools/wpp/ppl.l"
1864 if(yy_top_state() != pp_ignore) { pplval.cptr = pp_xstrdup(pptext); return tLITERAL; }
1865 YY_BREAK
1866 case 70:
1867 YY_RULE_SETUP
1868 #line 423 "tools/wpp/ppl.l"
1869 if(yy_top_state() != pp_ignore) { pplval.cptr = pp_xstrdup(pptext); return tLITERAL; }
1870 YY_BREAK
1871 case 71:
1872 YY_RULE_SETUP
1873 #line 424 "tools/wpp/ppl.l"
1874 if(yy_top_state() != pp_ignore) { pplval.cptr = pp_xstrdup(pptext); return tLITERAL; }
1875 YY_BREAK
1876 case 72:
1877 YY_RULE_SETUP
1878 #line 425 "tools/wpp/ppl.l"
1879 newline(1); yy_pop_state(); if(yy_current_state() != pp_ignore) { return tNL; }
1880 YY_BREAK
1881 case 73:
1882 YY_RULE_SETUP
1883 #line 426 "tools/wpp/ppl.l"
1884 newline(0);
1885 YY_BREAK
1886 /*
1887 * Handle left side of #define
1888 */
1889 case 74:
1890 YY_RULE_SETUP
1891 #line 431 "tools/wpp/ppl.l"
1892 pplval.cptr = pp_xstrdup(pptext); pplval.cptr[ppleng-1] = '\0'; yy_pp_state(pp_macro); return tMACRO;
1893 YY_BREAK
1894 case 75:
1895 YY_RULE_SETUP
1896 #line 432 "tools/wpp/ppl.l"
1897 pplval.cptr = pp_xstrdup(pptext); yy_pp_state(pp_define); return tDEFINE;
1898 YY_BREAK
1899 case 76:
1900 YY_RULE_SETUP
1901 #line 433 "tools/wpp/ppl.l"
1902 ;
1903 YY_BREAK
1904 case 77:
1905 YY_RULE_SETUP
1906 #line 434 "tools/wpp/ppl.l"
1907 newline(0);
1908 YY_BREAK
1909 case 78:
1910 YY_RULE_SETUP
1911 #line 435 "tools/wpp/ppl.l"
1912 perror("Identifier expected");
1913 YY_BREAK
1914 /*
1915 * Scan the substitution of a define
1916 */
1917 case 79:
1918 YY_RULE_SETUP
1919 #line 440 "tools/wpp/ppl.l"
1920 pplval.cptr = pp_xstrdup(pptext); return tLITERAL;
1921 YY_BREAK
1922 case 80:
1923 YY_RULE_SETUP
1924 #line 441 "tools/wpp/ppl.l"
1925 pplval.cptr = pp_xstrdup(pptext); return tLITERAL;
1926 YY_BREAK
1927 case 81:
1928 YY_RULE_SETUP
1929 #line 442 "tools/wpp/ppl.l"
1930 newline(0); pplval.cptr = pp_xstrdup(" "); return tLITERAL;
1931 YY_BREAK
1932 case 82:
1933 YY_RULE_SETUP
1934 #line 443 "tools/wpp/ppl.l"
1935 newline(0);
1936 YY_BREAK
1937 case 83:
1938 YY_RULE_SETUP
1939 #line 444 "tools/wpp/ppl.l"
1940 newline(1); yy_pop_state(); return tNL;
1941 YY_BREAK
1942 case 84:
1943 YY_RULE_SETUP
1944 #line 445 "tools/wpp/ppl.l"
1945 new_string(); add_string(pptext, ppleng); yy_push_state(pp_sqs);
1946 YY_BREAK
1947 case 85:
1948 YY_RULE_SETUP
1949 #line 446 "tools/wpp/ppl.l"
1950 new_string(); add_string(pptext, ppleng); yy_push_state(pp_dqs);
1951 YY_BREAK
1952 /*
1953 * Scan the definition macro arguments
1954 */
1955 case 86:
1956 YY_RULE_SETUP
1957 #line 451 "tools/wpp/ppl.l"
1958 yy_pp_state(pp_mbody); return tMACROEND;
1959 YY_BREAK
1960 case 87:
1961 YY_RULE_SETUP
1962 #line 452 "tools/wpp/ppl.l"
1963 ;
1964 YY_BREAK
1965 case 88:
1966 YY_RULE_SETUP
1967 #line 453 "tools/wpp/ppl.l"
1968 pplval.cptr = pp_xstrdup(pptext); return tIDENT;
1969 YY_BREAK
1970 case 89:
1971 YY_RULE_SETUP
1972 #line 454 "tools/wpp/ppl.l"
1973 return ',';
1974 YY_BREAK
1975 case 90:
1976 YY_RULE_SETUP
1977 #line 455 "tools/wpp/ppl.l"
1978 return tELIPSIS;
1979 YY_BREAK
1980 case 91:
1981 YY_RULE_SETUP
1982 #line 456 "tools/wpp/ppl.l"
1983 pperror("Argument identifier expected");
1984 YY_BREAK
1985 case 92:
1986 YY_RULE_SETUP
1987 #line 457 "tools/wpp/ppl.l"
1988 newline(0);
1989 YY_BREAK
1990 /*
1991 * Scan the substitution of a macro
1992 */
1993 case 93:
1994 YY_RULE_SETUP
1995 #line 462 "tools/wpp/ppl.l"
1996 pplval.cptr = pp_xstrdup(pptext); return tLITERAL;
1997 YY_BREAK
1998 case 94:
1999 YY_RULE_SETUP
2000 #line 463 "tools/wpp/ppl.l"
2001 pplval.cptr = pp_xstrdup(pptext); return tIDENT;
2002 YY_BREAK
2003 case 95:
2004 YY_RULE_SETUP
2005 #line 464 "tools/wpp/ppl.l"
2006 return tCONCAT;
2007 YY_BREAK
2008 case 96:
2009 YY_RULE_SETUP
2010 #line 465 "tools/wpp/ppl.l"
2011 return tSTRINGIZE;
2012 YY_BREAK
2013 case 97:
2014 YY_RULE_SETUP
2015 #line 466 "tools/wpp/ppl.l"
2016 pplval.cptr = pp_xstrdup(pptext); return tLITERAL;
2017 YY_BREAK
2018 case 98:
2019 YY_RULE_SETUP
2020 #line 467 "tools/wpp/ppl.l"
2021 pplval.cptr = pp_xstrdup(pptext); return tLITERAL;
2022 YY_BREAK
2023 case 99:
2024 YY_RULE_SETUP
2025 #line 468 "tools/wpp/ppl.l"
2026 newline(0); pplval.cptr = pp_xstrdup(" "); return tLITERAL;
2027 YY_BREAK
2028 case 100:
2029 YY_RULE_SETUP
2030 #line 469 "tools/wpp/ppl.l"
2031 newline(0);
2032 YY_BREAK
2033 case 101:
2034 YY_RULE_SETUP
2035 #line 470 "tools/wpp/ppl.l"
2036 newline(1); yy_pop_state(); return tNL;
2037 YY_BREAK
2038 case 102:
2039 YY_RULE_SETUP
2040 #line 471 "tools/wpp/ppl.l"
2041 new_string(); add_string(pptext, ppleng); yy_push_state(pp_sqs);
2042 YY_BREAK
2043 case 103:
2044 YY_RULE_SETUP
2045 #line 472 "tools/wpp/ppl.l"
2046 new_string(); add_string(pptext, ppleng); yy_push_state(pp_dqs);
2047 YY_BREAK
2048 /*
2049 * Macro expansion text scanning.
2050 * This state is active just after the identifier is scanned
2051 * that triggers an expansion. We *must* delete the leading
2052 * whitespace before we can start scanning for arguments.
2053 *
2054 * If we do not see a '(' as next trailing token, then we have
2055 * a false alarm. We just continue with a nose-bleed...
2056 */
2057 case 104:
2058 *yy_cp = yy_hold_char; /* undo effects of setting up yytext */
2059 yy_c_buf_p = yy_cp -= 1;
2060 YY_DO_BEFORE_ACTION; /* set up yytext again */
2061 YY_RULE_SETUP
2062 #line 483 "tools/wpp/ppl.l"
2063 yy_pp_state(pp_macscan);
2064 YY_BREAK
2065 case 105:
2066 YY_RULE_SETUP
2067 #line 484 "tools/wpp/ppl.l"
2068 {
2069 if(yy_top_state() != pp_macscan)
2070 newline(0);
2071 }
2072 YY_BREAK
2073 case 106:
2074 YY_RULE_SETUP
2075 #line 488 "tools/wpp/ppl.l"
2076 newline(0);
2077 YY_BREAK
2078 case 107:
2079 YY_RULE_SETUP
2080 #line 489 "tools/wpp/ppl.l"
2081 {
2082 macexpstackentry_t *mac = pop_macro();
2083 yy_pop_state();
2084 put_buffer(mac->ppp->ident, strlen(mac->ppp->ident));
2085 put_buffer(pptext, ppleng);
2086 free_macro(mac);
2087 }
2088 YY_BREAK
2089 /*
2090 * Macro expansion argument text scanning.
2091 * This state is active when a macro's arguments are being read for expansion.
2092 */
2093 case 108:
2094 YY_RULE_SETUP
2095 #line 501 "tools/wpp/ppl.l"
2096 {
2097 if(++MACROPARENTHESES() > 1)
2098 add_text_to_macro(pptext, ppleng);
2099 }
2100 YY_BREAK
2101 case 109:
2102 YY_RULE_SETUP
2103 #line 505 "tools/wpp/ppl.l"
2104 {
2105 if(--MACROPARENTHESES() == 0)
2106 {
2107 yy_pop_state();
2108 macro_add_arg(1);
2109 }
2110 else
2111 add_text_to_macro(pptext, ppleng);
2112 }
2113 YY_BREAK
2114 case 110:
2115 YY_RULE_SETUP
2116 #line 514 "tools/wpp/ppl.l"
2117 {
2118 if(MACROPARENTHESES() > 1)
2119 add_text_to_macro(pptext, ppleng);
2120 else
2121 macro_add_arg(0);
2122 }
2123 YY_BREAK
2124 case 111:
2125 YY_RULE_SETUP
2126 #line 520 "tools/wpp/ppl.l"
2127 new_string(); add_string(pptext, ppleng); yy_push_state(pp_dqs);
2128 YY_BREAK
2129 case 112:
2130 YY_RULE_SETUP
2131 #line 521 "tools/wpp/ppl.l"
2132 new_string(); add_string(pptext, ppleng); yy_push_state(pp_sqs);
2133 YY_BREAK
2134 case 113:
2135 YY_RULE_SETUP
2136 #line 522 "tools/wpp/ppl.l"
2137 yy_push_state(pp_comment); add_text_to_macro(" ", 1);
2138 YY_BREAK
2139 case 114:
2140 YY_RULE_SETUP
2141 #line 523 "tools/wpp/ppl.l"
2142 pp_status.line_number++; pp_status.char_number = 1; add_text_to_macro(pptext, ppleng);
2143 YY_BREAK
2144 case 115:
2145 YY_RULE_SETUP
2146 #line 524 "tools/wpp/ppl.l"
2147 add_text_to_macro(pptext, ppleng);
2148 YY_BREAK
2149 case 116:
2150 YY_RULE_SETUP
2151 #line 525 "tools/wpp/ppl.l"
2152 newline(0);
2153 YY_BREAK
2154 /*
2155 * Comment handling (almost all start-conditions)
2156 */
2157 case 117:
2158 YY_RULE_SETUP
2159 #line 530 "tools/wpp/ppl.l"
2160 yy_push_state(pp_comment);
2161 YY_BREAK
2162 case 118:
2163 YY_RULE_SETUP
2164 #line 531 "tools/wpp/ppl.l"
2165 ;
2166 YY_BREAK
2167 case 119:
2168 YY_RULE_SETUP
2169 #line 532 "tools/wpp/ppl.l"
2170 newline(0);
2171 YY_BREAK
2172 case 120:
2173 YY_RULE_SETUP
2174 #line 533 "tools/wpp/ppl.l"
2175 yy_pop_state();
2176 YY_BREAK
2177 /*
2178 * Remove C++ style comment (almost all start-conditions)
2179 */
2180 case 121:
2181 YY_RULE_SETUP
2182 #line 538 "tools/wpp/ppl.l"
2183 {
2184 if(pptext[ppleng-1] == '\\')
2185 ppwarning("C++ style comment ends with an escaped newline (escape ignored)");
2186 }
2187 YY_BREAK
2188 /*
2189 * Single, double and <> quoted constants
2190 */
2191 case 122:
2192 YY_RULE_SETUP
2193 #line 546 "tools/wpp/ppl.l"
2194 pp_incl_state.seen_junk++; new_string(); add_string(pptext, ppleng); yy_push_state(pp_dqs);
2195 YY_BREAK
2196 case 123:
2197 YY_RULE_SETUP
2198 #line 547 "tools/wpp/ppl.l"
2199 pp_incl_state.seen_junk++; new_string(); add_string(pptext, ppleng); yy_push_state(pp_sqs);
2200 YY_BREAK
2201 case 124:
2202 YY_RULE_SETUP
2203 #line 548 "tools/wpp/ppl.l"
2204 add_string(pptext, ppleng);
2205 YY_BREAK
2206 case 125:
2207 YY_RULE_SETUP
2208 #line 549 "tools/wpp/ppl.l"
2209 {
2210 add_string(pptext, ppleng);
2211 yy_pop_state();
2212 switch(yy_current_state())
2213 {
2214 case pp_pp:
2215 case pp_define:
2216 case pp_mbody:
2217 case pp_inc:
2218 case RCINCL:
2219 if (yy_current_state()==RCINCL) yy_pop_state();
2220 pplval.cptr = get_string();
2221 return tDQSTRING;
2222 case pp_line:
2223 pplval.cptr = get_string();
2224 if (is_c_h_include(pplval.cptr, 1)) pass_data=0;
2225 else pass_data=1;
2226 return tDQSTRING;
2227 default:
2228 put_string();
2229 }
2230 }
2231 YY_BREAK
2232 case 126:
2233 YY_RULE_SETUP
2234 #line 571 "tools/wpp/ppl.l"
2235 add_string(pptext, ppleng);
2236 YY_BREAK
2237 case 127:
2238 YY_RULE_SETUP
2239 #line 572 "tools/wpp/ppl.l"
2240 {
2241 add_string(pptext, ppleng);
2242 yy_pop_state();
2243 switch(yy_current_state())
2244 {
2245 case pp_if:
2246 case pp_define:
2247 case pp_mbody:
2248 pplval.cptr = get_string();
2249 return tSQSTRING;
2250 default:
2251 put_string();
2252 }
2253 }
2254 YY_BREAK
2255 case 128:
2256 YY_RULE_SETUP
2257 #line 586 "tools/wpp/ppl.l"
2258 add_string(pptext, ppleng);
2259 YY_BREAK
2260 case 129:
2261 YY_RULE_SETUP
2262 #line 587 "tools/wpp/ppl.l"
2263 {
2264 add_string(pptext, ppleng);
2265 yy_pop_state();
2266 pplval.cptr = get_string();
2267 return tIQSTRING;
2268 }
2269 YY_BREAK
2270 case 130:
2271 YY_RULE_SETUP
2272 #line 593 "tools/wpp/ppl.l"
2273 {
2274 /*
2275 * This is tricky; we need to remove the line-continuation
2276 * from preprocessor strings, but OTOH retain them in all
2277 * other strings. This is because the resource grammar is
2278 * even more braindead than initially analysed and line-
2279 * continuations in strings introduce, sigh, newlines in
2280 * the output. There goes the concept of non-breaking, non-
2281 * spacing whitespace.
2282 */
2283 switch(yy_top_state())
2284 {
2285 case pp_pp:
2286 case pp_define:
2287 case pp_mbody:
2288 case pp_inc:
2289 case pp_line:
2290 newline(0);
2291 break;
2292 default:
2293 add_string(pptext, ppleng);
2294 newline(-1);
2295 }
2296 }
2297 YY_BREAK
2298 case 131:
2299 YY_RULE_SETUP
2300 #line 617 "tools/wpp/ppl.l"
2301 add_string(pptext, ppleng);
2302 YY_BREAK
2303 case 132:
2304 YY_RULE_SETUP
2305 #line 618 "tools/wpp/ppl.l"
2306 {
2307 newline(1);
2308 add_string(pptext, ppleng);
2309 ppwarning("Newline in string constant encounterd (started line %d)", string_start());
2310 }
2311 YY_BREAK
2312 /*
2313 * Identifier scanning
2314 */
2315 case 133:
2316 YY_RULE_SETUP
2317 #line 627 "tools/wpp/ppl.l"
2318 {
2319 pp_entry_t *ppp;
2320 pp_incl_state.seen_junk++;
2321 if(!(ppp = pplookup(pptext)))
2322 {
2323 if(yy_current_state() == pp_inc)
2324 pperror("Expected include filename");
2325
2326 if(yy_current_state() == pp_if)
2327 {
2328 pplval.cptr = pp_xstrdup(pptext);
2329 return tIDENT;
2330 }
2331 else {
2332 if((yy_current_state()==INITIAL) && (strcasecmp(pptext,"RCINCLUDE")==0)){
2333 yy_push_state(RCINCL);
2334 return tRCINCLUDE;
2335 }
2336 else put_buffer(pptext, ppleng);
2337 }
2338 }
2339 else if(!ppp->expanding)
2340 {
2341 switch(ppp->type)
2342 {
2343 case def_special:
2344 expand_special(ppp);
2345 break;
2346 case def_define:
2347 expand_define(ppp);
2348 break;
2349 case def_macro:
2350 yy_push_state(pp_macign);
2351 push_macro(ppp);
2352 break;
2353 default:
2354 pp_internal_error(__FILE__, __LINE__, "Invalid define type %d\n", ppp->type);
2355 }
2356 }
2357 }
2358 YY_BREAK
2359 /*
2360 * Everything else that needs to be passed and
2361 * newline and continuation handling
2362 */
2363 case 134:
2364 YY_RULE_SETUP
2365 #line 672 "tools/wpp/ppl.l"
2366 pp_incl_state.seen_junk++; put_buffer(pptext, ppleng);
2367 YY_BREAK
2368 case 135:
2369 YY_RULE_SETUP
2370 #line 673 "tools/wpp/ppl.l"
2371 put_buffer(pptext, ppleng);
2372 YY_BREAK
2373 case 136:
2374 YY_RULE_SETUP
2375 #line 674 "tools/wpp/ppl.l"
2376 newline(1);
2377 YY_BREAK
2378 case 137:
2379 YY_RULE_SETUP
2380 #line 675 "tools/wpp/ppl.l"
2381 newline(0);
2382 YY_BREAK
2383 case 138:
2384 YY_RULE_SETUP
2385 #line 676 "tools/wpp/ppl.l"
2386 pp_incl_state.seen_junk++; put_buffer(pptext, ppleng);
2387 YY_BREAK
2388 /*
2389 * Special catcher for macro argmument expansion to prevent
2390 * newlines to propagate to the output or admin.
2391 */
2392 case 139:
2393 YY_RULE_SETUP
2394 #line 682 "tools/wpp/ppl.l"
2395 put_buffer(pptext, ppleng);
2396 YY_BREAK
2397 case 140:
2398 YY_RULE_SETUP
2399 #line 684 "tools/wpp/ppl.l"
2400 {
2401 pplval.cptr=pp_xstrdup(pptext);
2402 yy_pop_state();
2403 return tRCINCLUDEPATH;
2404 }
2405 YY_BREAK
2406 case 141:
2407 YY_RULE_SETUP
2408 #line 690 "tools/wpp/ppl.l"
2409 ;
2410 YY_BREAK
2411 case 142:
2412 YY_RULE_SETUP
2413 #line 692 "tools/wpp/ppl.l"
2414 {
2415 new_string(); add_string(pptext,ppleng);yy_push_state(pp_dqs);
2416 }
2417 YY_BREAK
2418 /*
2419 * This is a 'catch-all' rule to discover errors in the scanner
2420 * in an orderly manner.
2421 */
2422 case 143:
2423 YY_RULE_SETUP
2424 #line 700 "tools/wpp/ppl.l"
2425 pp_incl_state.seen_junk++; ppwarning("Unmatched text '%c' (0x%02x); please report\n", isprint(*pptext & 0xff) ? *pptext : ' ', *pptext);
2426 YY_BREAK
2427 case YY_STATE_EOF(INITIAL):
2428 case YY_STATE_EOF(pp_pp):
2429 case YY_STATE_EOF(pp_eol):
2430 case YY_STATE_EOF(pp_inc):
2431 case YY_STATE_EOF(pp_dqs):
2432 case YY_STATE_EOF(pp_sqs):
2433 case YY_STATE_EOF(pp_iqs):
2434 case YY_STATE_EOF(pp_comment):
2435 case YY_STATE_EOF(pp_def):
2436 case YY_STATE_EOF(pp_define):
2437 case YY_STATE_EOF(pp_macro):
2438 case YY_STATE_EOF(pp_mbody):
2439 case YY_STATE_EOF(pp_macign):
2440 case YY_STATE_EOF(pp_macscan):
2441 case YY_STATE_EOF(pp_macexp):
2442 case YY_STATE_EOF(pp_if):
2443 case YY_STATE_EOF(pp_ifd):
2444 case YY_STATE_EOF(pp_endif):
2445 case YY_STATE_EOF(pp_line):
2446 case YY_STATE_EOF(pp_defined):
2447 case YY_STATE_EOF(pp_ignore):
2448 case YY_STATE_EOF(RCINCL):
2449 #line 702 "tools/wpp/ppl.l"
2450 {
2451 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
2452 bufferstackentry_t *bep = pop_buffer();
2453
2454 if((!bep && pp_get_if_depth()) || (bep && pp_get_if_depth() != bep->if_depth))
2455 ppwarning("Unmatched #if/#endif at end of file");
2456
2457 if(!bep)
2458 {
2459 if(YY_START != INITIAL)
2460 pperror("Unexpected end of file during preprocessing");
2461 yyterminate();
2462 }
2463 else if(bep->should_pop == 2)
2464 {
2465 macexpstackentry_t *mac;
2466 mac = pop_macro();
2467 expand_macro(mac);
2468 }
2469 pp_delete_buffer(b);
2470 }
2471 YY_BREAK
2472 case 144:
2473 YY_RULE_SETUP
2474 #line 724 "tools/wpp/ppl.l"
2475 ECHO;
2476 YY_BREAK
2477 #line 2478 "tools/wpp/lex.yy.c"
2478
2479 case YY_END_OF_BUFFER:
2480 {
2481 /* Amount of text matched not including the EOB char. */
2482 int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
2483
2484 /* Undo the effects of YY_DO_BEFORE_ACTION. */
2485 *yy_cp = yy_hold_char;
2486 YY_RESTORE_YY_MORE_OFFSET
2487
2488 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
2489 {
2490 /* We're scanning a new file or input source. It's
2491 * possible that this happened because the user
2492 * just pointed yyin at a new source and called
2493 * yylex(). If so, then we have to assure
2494 * consistency between yy_current_buffer and our
2495 * globals. Here is the right place to do so, because
2496 * this is the first action (other than possibly a
2497 * back-up) that will match for the new input source.
2498 */
2499 yy_n_chars = yy_current_buffer->yy_n_chars;
2500 yy_current_buffer->yy_input_file = yyin;
2501 yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
2502 }
2503
2504 /* Note that here we test for yy_c_buf_p "<=" to the position
2505 * of the first EOB in the buffer, since yy_c_buf_p will
2506 * already have been incremented past the NUL character
2507 * (since all states make transitions on EOB to the
2508 * end-of-buffer state). Contrast this with the test
2509 * in input().
2510 */
2511 if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
2512 { /* This was really a NUL. */
2513 yy_state_type yy_next_state;
2514
2515 yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
2516
2517 yy_current_state = yy_get_previous_state();
2518
2519 /* Okay, we're now positioned to make the NUL
2520 * transition. We couldn't have
2521 * yy_get_previous_state() go ahead and do it
2522 * for us because it doesn't know how to deal
2523 * with the possibility of jamming (and we don't
2524 * want to build jamming into it because then it
2525 * will run more slowly).
2526 */
2527
2528 yy_next_state = yy_try_NUL_trans( yy_current_state );
2529
2530 yy_bp = yytext_ptr + YY_MORE_ADJ;
2531
2532 if ( yy_next_state )
2533 {
2534 /* Consume the NUL. */
2535 yy_cp = ++yy_c_buf_p;
2536 yy_current_state = yy_next_state;
2537 goto yy_match;
2538 }
2539
2540 else
2541 {
2542 yy_cp = yy_c_buf_p;
2543 goto yy_find_action;
2544 }
2545 }
2546
2547 else switch ( yy_get_next_buffer() )
2548 {
2549 case EOB_ACT_END_OF_FILE:
2550 {
2551 yy_did_buffer_switch_on_eof = 0;
2552
2553 if ( yywrap() )
2554 {
2555 /* Note: because we've taken care in
2556 * yy_get_next_buffer() to have set up
2557 * yytext, we can now set up
2558 * yy_c_buf_p so that if some total
2559 * hoser (like flex itself) wants to
2560 * call the scanner after we return the
2561 * YY_NULL, it'll still work - another
2562 * YY_NULL will get returned.
2563 */
2564 yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
2565
2566 yy_act = YY_STATE_EOF(YY_START);
2567 goto do_action;
2568 }
2569
2570 else
2571 {
2572 if ( ! yy_did_buffer_switch_on_eof )
2573 YY_NEW_FILE;
2574 }
2575 break;
2576 }
2577
2578 case EOB_ACT_CONTINUE_SCAN:
2579 yy_c_buf_p =
2580 yytext_ptr + yy_amount_of_matched_text;
2581
2582 yy_current_state = yy_get_previous_state();
2583
2584 yy_cp = yy_c_buf_p;
2585 yy_bp = yytext_ptr + YY_MORE_ADJ;
2586 goto yy_match;
2587
2588 case EOB_ACT_LAST_MATCH:
2589 yy_c_buf_p =
2590 &yy_current_buffer->yy_ch_buf[yy_n_chars];
2591
2592 yy_current_state = yy_get_previous_state();
2593
2594 yy_cp = yy_c_buf_p;
2595 yy_bp = yytext_ptr + YY_MORE_ADJ;
2596 goto yy_find_action;
2597 }
2598 break;
2599 }
2600
2601 default:
2602 YY_FATAL_ERROR(
2603 "fatal flex scanner internal error--no action found" );
2604 } /* end of action switch */
2605 } /* end of scanning one token */
2606 } /* end of yylex */
2607
2608
2609 /* yy_get_next_buffer - try to read in a new buffer
2610 *
2611 * Returns a code representing an action:
2612 * EOB_ACT_LAST_MATCH -
2613 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
2614 * EOB_ACT_END_OF_FILE - end of file
2615 */
2616
2617 static int yy_get_next_buffer()
2618 {
2619 register char *dest = yy_current_buffer->yy_ch_buf;
2620 register char *source = yytext_ptr;
2621 register int number_to_move, i;
2622 int ret_val;
2623
2624 if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
2625 YY_FATAL_ERROR(
2626 "fatal flex scanner internal error--end of buffer missed" );
2627
2628 if ( yy_current_buffer->yy_fill_buffer == 0 )
2629 { /* Don't try to fill the buffer, so this is an EOF. */
2630 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
2631 {
2632 /* We matched a single character, the EOB, so
2633 * treat this as a final EOF.
2634 */
2635 return EOB_ACT_END_OF_FILE;
2636 }
2637
2638 else
2639 {
2640 /* We matched some text prior to the EOB, first
2641 * process it.
2642 */
2643 return EOB_ACT_LAST_MATCH;
2644 }
2645 }
2646
2647 /* Try to read more data. */
2648
2649 /* First move last chars to start of buffer. */
2650 number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
2651
2652 for ( i = 0; i < number_to_move; ++i )
2653 *(dest++) = *(source++);
2654
2655 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
2656 /* don't do the read, it's not guaranteed to return an EOF,
2657 * just force an EOF
2658 */
2659 yy_current_buffer->yy_n_chars = yy_n_chars = 0;
2660
2661 else
2662 {
2663 int num_to_read =
2664 yy_current_buffer->yy_buf_size - number_to_move - 1;
2665
2666 while ( num_to_read <= 0 )
2667 { /* Not enough room in the buffer - grow it. */
2668 #ifdef YY_USES_REJECT
2669 YY_FATAL_ERROR(
2670 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
2671 #else
2672
2673 /* just a shorter name for the current buffer */
2674 YY_BUFFER_STATE b = yy_current_buffer;
2675
2676 int yy_c_buf_p_offset =
2677 (int) (yy_c_buf_p - b->yy_ch_buf);
2678
2679 if ( b->yy_is_our_buffer )
2680 {
2681 int new_size = b->yy_buf_size * 2;
2682
2683 if ( new_size <= 0 )
2684 b->yy_buf_size += b->yy_buf_size / 8;
2685 else
2686 b->yy_buf_size *= 2;
2687
2688 b->yy_ch_buf = (char *)
2689 /* Include room in for 2 EOB chars. */
2690 yy_flex_realloc( (void *) b->yy_ch_buf,
2691 b->yy_buf_size + 2 );
2692 }
2693 else
2694 /* Can't grow it, we don't own it. */
2695 b->yy_ch_buf = 0;
2696
2697 if ( ! b->yy_ch_buf )
2698 YY_FATAL_ERROR(
2699 "fatal error - scanner input buffer overflow" );
2700
2701 yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
2702
2703 num_to_read = yy_current_buffer->yy_buf_size -
2704 number_to_move - 1;
2705 #endif
2706 }
2707
2708 if ( num_to_read > YY_READ_BUF_SIZE )
2709 num_to_read = YY_READ_BUF_SIZE;
2710
2711 /* Read in more data. */
2712 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
2713 yy_n_chars, num_to_read );
2714
2715 yy_current_buffer->yy_n_chars = yy_n_chars;
2716 }
2717
2718 if ( yy_n_chars == 0 )
2719 {
2720 if ( number_to_move == YY_MORE_ADJ )
2721 {
2722 ret_val = EOB_ACT_END_OF_FILE;
2723 yyrestart( yyin );
2724 }
2725
2726 else
2727 {
2728 ret_val = EOB_ACT_LAST_MATCH;
2729 yy_current_buffer->yy_buffer_status =
2730 YY_BUFFER_EOF_PENDING;
2731 }
2732 }
2733
2734 else
2735 ret_val = EOB_ACT_CONTINUE_SCAN;
2736
2737 yy_n_chars += number_to_move;
2738 yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
2739 yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
2740
2741 yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
2742
2743 return ret_val;
2744 }
2745
2746
2747 /* yy_get_previous_state - get the state just before the EOB char was reached */
2748
2749 static yy_state_type yy_get_previous_state()
2750 {
2751 register yy_state_type yy_current_state;
2752 register char *yy_cp;
2753
2754 yy_current_state = yy_start;
2755 yy_current_state += YY_AT_BOL();
2756
2757 for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
2758 {
2759 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
2760 if ( yy_accept[yy_current_state] )
2761 {
2762 yy_last_accepting_state = yy_current_state;
2763 yy_last_accepting_cpos = yy_cp;
2764 }
2765 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2766 {
2767 yy_current_state = (int) yy_def[yy_current_state];
2768 if ( yy_current_state >= 421 )
2769 yy_c = yy_meta[(unsigned int) yy_c];
2770 }
2771 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
2772 }
2773
2774 return yy_current_state;
2775 }
2776
2777
2778 /* yy_try_NUL_trans - try to make a transition on the NUL character
2779 *
2780 * synopsis
2781 * next_state = yy_try_NUL_trans( current_state );
2782 */
2783
2784 #ifdef YY_USE_PROTOS
2785 static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
2786 #else
2787 static yy_state_type yy_try_NUL_trans( yy_current_state )
2788 yy_state_type yy_current_state;
2789 #endif
2790 {
2791 register int yy_is_jam;
2792 register char *yy_cp = yy_c_buf_p;
2793
2794 register YY_CHAR yy_c = 1;
2795 if ( yy_accept[yy_current_state] )
2796 {
2797 yy_last_accepting_state = yy_current_state;
2798 yy_last_accepting_cpos = yy_cp;
2799 }
2800 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2801 {
2802 yy_current_state = (int) yy_def[yy_current_state];
2803 if ( yy_current_state >= 421 )
2804 yy_c = yy_meta[(unsigned int) yy_c];
2805 }
2806 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
2807 yy_is_jam = (yy_current_state == 420);
2808
2809 return yy_is_jam ? 0 : yy_current_state;
2810 }
2811
2812
2813 #ifndef YY_NO_UNPUT
2814 #ifdef YY_USE_PROTOS
2815 static void yyunput( int c, register char *yy_bp )
2816 #else
2817 static void yyunput( c, yy_bp )
2818 int c;
2819 register char *yy_bp;
2820 #endif
2821 {
2822 register char *yy_cp = yy_c_buf_p;
2823
2824 /* undo effects of setting up yytext */
2825 *yy_cp = yy_hold_char;
2826
2827 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
2828 { /* need to shift things up to make room */
2829 /* +2 for EOB chars. */
2830 register int number_to_move = yy_n_chars + 2;
2831 register char *dest = &yy_current_buffer->yy_ch_buf[
2832 yy_current_buffer->yy_buf_size + 2];
2833 register char *source =
2834 &yy_current_buffer->yy_ch_buf[number_to_move];
2835
2836 while ( source > yy_current_buffer->yy_ch_buf )
2837 *--dest = *--source;
2838
2839 yy_cp += (int) (dest - source);
2840 yy_bp += (int) (dest - source);
2841 yy_current_buffer->yy_n_chars =
2842 yy_n_chars = yy_current_buffer->yy_buf_size;
2843
2844 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
2845 YY_FATAL_ERROR( "flex scanner push-back overflow" );
2846 }
2847
2848 *--yy_cp = (char) c;
2849
2850
2851 yytext_ptr = yy_bp;
2852 yy_hold_char = *yy_cp;
2853 yy_c_buf_p = yy_cp;
2854 }
2855 #endif /* ifndef YY_NO_UNPUT */
2856
2857
2858 #ifndef YY_NO_INPUT
2859 #ifdef __cplusplus
2860 static int yyinput()
2861 #else
2862 static int input()
2863 #endif
2864 {
2865 int c;
2866
2867 *yy_c_buf_p = yy_hold_char;
2868
2869 if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
2870 {
2871 /* yy_c_buf_p now points to the character we want to return.
2872 * If this occurs *before* the EOB characters, then it's a
2873 * valid NUL; if not, then we've hit the end of the buffer.
2874 */
2875 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
2876 /* This was really a NUL. */
2877 *yy_c_buf_p = '\0';
2878
2879 else
2880 { /* need more input */
2881 int offset = yy_c_buf_p - yytext_ptr;
2882 ++yy_c_buf_p;
2883
2884 switch ( yy_get_next_buffer() )
2885 {
2886 case EOB_ACT_LAST_MATCH:
2887 /* This happens because yy_g_n_b()
2888 * sees that we've accumulated a
2889 * token and flags that we need to
2890 * try matching the token before
2891 * proceeding. But for input(),
2892 * there's no matching to consider.
2893 * So convert the EOB_ACT_LAST_MATCH
2894 * to EOB_ACT_END_OF_FILE.
2895 */
2896
2897 /* Reset buffer status. */
2898 yyrestart( yyin );
2899
2900 /* fall through */
2901
2902 case EOB_ACT_END_OF_FILE:
2903 {
2904 if ( yywrap() )
2905 return EOF;
2906
2907 if ( ! yy_did_buffer_switch_on_eof )
2908 YY_NEW_FILE;
2909 #ifdef __cplusplus
2910 return yyinput();
2911 #else
2912 return input();
2913 #endif
2914 }
2915
2916 case EOB_ACT_CONTINUE_SCAN:
2917 yy_c_buf_p = yytext_ptr + offset;
2918 break;
2919 }
2920 }
2921 }
2922
2923 c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
2924 *yy_c_buf_p = '\0'; /* preserve yytext */
2925 yy_hold_char = *++yy_c_buf_p;
2926
2927 yy_current_buffer->yy_at_bol = (c == '\n');
2928
2929 return c;
2930 }
2931 #endif /* YY_NO_INPUT */
2932
2933 #ifdef YY_USE_PROTOS
2934 void yyrestart( FILE *input_file )
2935 #else
2936 void yyrestart( input_file )
2937 FILE *input_file;
2938 #endif
2939 {
2940 if ( ! yy_current_buffer )
2941 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
2942
2943 yy_init_buffer( yy_current_buffer, input_file );
2944 yy_load_buffer_state();
2945 }
2946
2947
2948 #ifdef YY_USE_PROTOS
2949 void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
2950 #else
2951 void yy_switch_to_buffer( new_buffer )
2952 YY_BUFFER_STATE new_buffer;
2953 #endif
2954 {
2955 if ( yy_current_buffer == new_buffer )
2956 return;
2957
2958 if ( yy_current_buffer )
2959 {
2960 /* Flush out information for old buffer. */
2961 *yy_c_buf_p = yy_hold_char;
2962 yy_current_buffer->yy_buf_pos = yy_c_buf_p;
2963 yy_current_buffer->yy_n_chars = yy_n_chars;
2964 }
2965
2966 yy_current_buffer = new_buffer;
2967 yy_load_buffer_state();
2968
2969 /* We don't actually know whether we did this switch during
2970 * EOF (yywrap()) processing, but the only time this flag
2971 * is looked at is after yywrap() is called, so it's safe
2972 * to go ahead and always set it.
2973 */
2974 yy_did_buffer_switch_on_eof = 1;
2975 }
2976
2977
2978 #ifdef YY_USE_PROTOS
2979 void yy_load_buffer_state( void )
2980 #else
2981 void yy_load_buffer_state()
2982 #endif
2983 {
2984 yy_n_chars = yy_current_buffer->yy_n_chars;
2985 yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
2986 yyin = yy_current_buffer->yy_input_file;
2987 yy_hold_char = *yy_c_buf_p;
2988 }
2989
2990
2991 #ifdef YY_USE_PROTOS
2992 YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
2993 #else
2994 YY_BUFFER_STATE yy_create_buffer( file, size )
2995 FILE *file;
2996 int size;
2997 #endif
2998 {
2999 YY_BUFFER_STATE b;
3000
3001 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
3002 if ( ! b )
3003 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
3004
3005 b->yy_buf_size = size;
3006
3007 /* yy_ch_buf has to be 2 characters longer than the size given because
3008 * we need to put in 2 end-of-buffer characters.
3009 */
3010 b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
3011 if ( ! b->yy_ch_buf )
3012 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
3013
3014 b->yy_is_our_buffer = 1;
3015
3016 yy_init_buffer( b, file );
3017
3018 return b;
3019 }
3020
3021
3022 #ifdef YY_USE_PROTOS
3023 void yy_delete_buffer( YY_BUFFER_STATE b )
3024 #else
3025 void yy_delete_buffer( b )
3026 YY_BUFFER_STATE b;
3027 #endif
3028 {
3029 if ( ! b )
3030 return;
3031
3032 if ( b == yy_current_buffer )
3033 yy_current_buffer = (YY_BUFFER_STATE) 0;
3034
3035 if ( b->yy_is_our_buffer )
3036 yy_flex_free( (void *) b->yy_ch_buf );
3037
3038 yy_flex_free( (void *) b );
3039 }
3040
3041
3042
3043 #ifdef YY_USE_PROTOS
3044 void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
3045 #else
3046 void yy_init_buffer( b, file )
3047 YY_BUFFER_STATE b;
3048 FILE *file;
3049 #endif
3050
3051
3052 {
3053 yy_flush_buffer( b );
3054
3055 b->yy_input_file = file;
3056 b->yy_fill_buffer = 1;
3057
3058 #if YY_ALWAYS_INTERACTIVE
3059 b->yy_is_interactive = 1;
3060 #else
3061 #if YY_NEVER_INTERACTIVE
3062 b->yy_is_interactive = 0;
3063 #else
3064 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
3065 #endif
3066 #endif
3067 }
3068
3069
3070 #ifdef YY_USE_PROTOS
3071 void yy_flush_buffer( YY_BUFFER_STATE b )
3072 #else
3073 void yy_flush_buffer( b )
3074 YY_BUFFER_STATE b;
3075 #endif
3076
3077 {
3078 if ( ! b )
3079 return;
3080
3081 b->yy_n_chars = 0;
3082
3083 /* We always need two end-of-buffer characters. The first causes
3084 * a transition to the end-of-buffer state. The second causes
3085 * a jam in that state.
3086 */
3087 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
3088 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
3089
3090 b->yy_buf_pos = &b->yy_ch_buf[0];
3091
3092 b->yy_at_bol = 1;
3093 b->yy_buffer_status = YY_BUFFER_NEW;
3094
3095 if ( b == yy_current_buffer )
3096 yy_load_buffer_state();
3097 }
3098
3099
3100 #ifndef YY_NO_SCAN_BUFFER
3101 #ifdef YY_USE_PROTOS
3102 YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
3103 #else
3104 YY_BUFFER_STATE yy_scan_buffer( base, size )
3105 char *base;
3106 yy_size_t size;
3107 #endif
3108 {
3109 YY_BUFFER_STATE b;
3110
3111 if ( size < 2 ||
3112 base[size-2] != YY_END_OF_BUFFER_CHAR ||
3113 base[size-1] != YY_END_OF_BUFFER_CHAR )
3114 /* They forgot to leave room for the EOB's. */
3115 return 0;
3116
3117 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
3118 if ( ! b )
3119 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
3120
3121 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
3122 b->yy_buf_pos = b->yy_ch_buf = base;
3123 b->yy_is_our_buffer = 0;
3124 b->yy_input_file = 0;
3125 b->yy_n_chars = b->yy_buf_size;
3126 b->yy_is_interactive = 0;
3127 b->yy_at_bol = 1;
3128 b->yy_fill_buffer = 0;
3129 b->yy_buffer_status = YY_BUFFER_NEW;
3130
3131 yy_switch_to_buffer( b );
3132
3133 return b;
3134 }
3135 #endif
3136
3137
3138 #ifndef YY_NO_SCAN_STRING
3139 #ifdef YY_USE_PROTOS
3140 YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
3141 #else
3142 YY_BUFFER_STATE yy_scan_string( yy_str )
3143 yyconst char *yy_str;
3144 #endif
3145 {
3146 int len;
3147 for ( len = 0; yy_str[len]; ++len )
3148 ;
3149
3150 return yy_scan_bytes( yy_str, len );
3151 }
3152 #endif
3153
3154
3155 #ifndef YY_NO_SCAN_BYTES
3156 #ifdef YY_USE_PROTOS
3157 YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
3158 #else
3159 YY_BUFFER_STATE yy_scan_bytes( bytes, len )
3160 yyconst char *bytes;
3161 int len;
3162 #endif
3163 {
3164 YY_BUFFER_STATE b;
3165 char *buf;
3166 yy_size_t n;
3167 int i;
3168
3169 /* Get memory for full buffer, including space for trailing EOB's. */
3170 n = len + 2;
3171 buf = (char *) yy_flex_alloc( n );
3172 if ( ! buf )
3173 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
3174
3175 for ( i = 0; i < len; ++i )
3176 buf[i] = bytes[i];
3177
3178 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
3179
3180 b = yy_scan_buffer( buf, n );
3181 if ( ! b )
3182 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
3183
3184 /* It's okay to grow etc. this buffer, and we should throw it
3185 * away when we're done.
3186 */
3187 b->yy_is_our_buffer = 1;
3188
3189 return b;
3190 }
3191 #endif
3192
3193
3194 #ifndef YY_NO_PUSH_STATE
3195 #ifdef YY_USE_PROTOS
3196 static void yy_push_state( int new_state )
3197 #else
3198 static void yy_push_state( new_state )
3199 int new_state;
3200 #endif
3201 {
3202 if ( yy_start_stack_ptr >= yy_start_stack_depth )
3203 {
3204 yy_size_t new_size;
3205
3206 yy_start_stack_depth += YY_START_STACK_INCR;
3207 new_size = yy_start_stack_depth * sizeof( int );
3208
3209 if ( ! yy_start_stack )
3210 yy_start_stack = (int *) yy_flex_alloc( new_size );
3211
3212 else
3213 yy_start_stack = (int *) yy_flex_realloc(
3214 (void *) yy_start_stack, new_size );
3215
3216 if ( ! yy_start_stack )
3217 YY_FATAL_ERROR(
3218 "out of memory expanding start-condition stack" );
3219 }
3220
3221 yy_start_stack[yy_start_stack_ptr++] = YY_START;
3222
3223 BEGIN(new_state);
3224 }
3225 #endif
3226
3227
3228 #ifndef YY_NO_POP_STATE
3229 static void yy_pop_state()
3230 {
3231 if ( --yy_start_stack_ptr < 0 )
3232 YY_FATAL_ERROR( "start-condition stack underflow" );
3233
3234 BEGIN(yy_start_stack[yy_start_stack_ptr]);
3235 }
3236 #endif
3237
3238
3239 #ifndef YY_NO_TOP_STATE
3240 static int yy_top_state()
3241 {
3242 return yy_start_stack[yy_start_stack_ptr - 1];
3243 }
3244 #endif
3245
3246 #ifndef YY_EXIT_FAILURE
3247 #define YY_EXIT_FAILURE 2
3248 #endif
3249
3250 #ifdef YY_USE_PROTOS
3251 static void yy_fatal_error( yyconst char msg[] )
3252 #else
3253 static void yy_fatal_error( msg )
3254 char msg[];
3255 #endif
3256 {
3257 (void) fprintf( stderr, "%s\n", msg );
3258 exit( YY_EXIT_FAILURE );
3259 }
3260
3261
3262
3263 /* Redefine yyless() so it works in section 3 code. */
3264
3265 #undef yyless
3266 #define yyless(n) \
3267 do \
3268 { \
3269 /* Undo effects of setting up yytext. */ \
3270 yytext[yyleng] = yy_hold_char; \
3271 yy_c_buf_p = yytext + n; \
3272 yy_hold_char = *yy_c_buf_p; \
3273 *yy_c_buf_p = '\0'; \
3274 yyleng = n; \
3275 } \
3276 while ( 0 )
3277
3278
3279 /* Internal utility routines. */
3280
3281 #ifndef yytext_ptr
3282 #ifdef YY_USE_PROTOS
3283 static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
3284 #else
3285 static void yy_flex_strncpy( s1, s2, n )
3286 char *s1;
3287 yyconst char *s2;
3288 int n;
3289 #endif
3290 {
3291 register int i;
3292 for ( i = 0; i < n; ++i )
3293 s1[i] = s2[i];
3294 }
3295 #endif
3296
3297 #ifdef YY_NEED_STRLEN
3298 #ifdef YY_USE_PROTOS
3299 static int yy_flex_strlen( yyconst char *s )
3300 #else
3301 static int yy_flex_strlen( s )
3302 yyconst char *s;
3303 #endif
3304 {
3305 register int n;
3306 for ( n = 0; s[n]; ++n )
3307 ;
3308
3309 return n;
3310 }
3311 #endif
3312
3313
3314 #ifdef YY_USE_PROTOS
3315 static void *yy_flex_alloc( yy_size_t size )
3316 #else
3317 static void *yy_flex_alloc( size )
3318 yy_size_t size;
3319 #endif
3320 {
3321 return (void *) malloc( size );
3322 }
3323
3324 #ifdef YY_USE_PROTOS
3325 static void *yy_flex_realloc( void *ptr, yy_size_t size )
3326 #else
3327 static void *yy_flex_realloc( ptr, size )
3328 void *ptr;
3329 yy_size_t size;
3330 #endif
3331 {
3332 /* The cast to (char *) in the following accommodates both
3333 * implementations that use char* generic pointers, and those
3334 * that use void* generic pointers. It works with the latter
3335 * because both ANSI C and C++ allow castless assignment from
3336 * any pointer type to void*, and deal with argument conversions
3337 * as though doing an assignment.
3338 */
3339 return (void *) realloc( (char *) ptr, size );
3340 }
3341
3342 #ifdef YY_USE_PROTOS
3343 static void yy_flex_free( void *ptr )
3344 #else
3345 static void yy_flex_free( ptr )
3346 void *ptr;
3347 #endif
3348 {
3349 free( ptr );
3350 }
3351
3352 #if YY_MAIN
3353 int main()
3354 {
3355 yylex();
3356 return 0;
3357 }
3358 #endif
3359 #line 724 "tools/wpp/ppl.l"
3360
3361 /*
3362 **************************************************************************
3363 * Support functions
3364 **************************************************************************
3365 */
3366
3367 #ifndef ppwrap
3368 int ppwrap(void)
3369 {
3370 return 1;
3371 }
3372 #endif
3373
3374
3375 /*
3376 *-------------------------------------------------------------------------
3377 * Output newlines or set them as continuations
3378 *
3379 * Input: -1 - Don't count this one, but update local position (see pp_dqs)
3380 * 0 - Line-continuation seen and cache output
3381 * 1 - Newline seen and flush output
3382 *-------------------------------------------------------------------------
3383 */
3384 static void newline(int dowrite)
3385 {
3386 pp_status.line_number++;
3387 pp_status.char_number = 1;
3388
3389 if(dowrite == -1)
3390 return;
3391
3392 ncontinuations++;
3393 if(dowrite)
3394 {
3395 for(;ncontinuations; ncontinuations--)
3396 put_buffer("\n", 1);
3397 }
3398 }
3399
3400
3401 /*
3402 *-------------------------------------------------------------------------
3403 * Make a number out of an any-base and suffixed string
3404 *
3405 * Possible number extensions:
3406 * - "" int
3407 * - "L" long int
3408 * - "LL" long long int
3409 * - "U" unsigned int
3410 * - "UL" unsigned long int
3411 * - "ULL" unsigned long long int
3412 * - "LU" unsigned long int
3413 * - "LLU" unsigned long long int
3414 * - "LUL" invalid
3415 *
3416 * FIXME:
3417 * The sizes of resulting 'int' and 'long' are compiler specific.
3418 * I depend on sizeof(int) > 2 here (although a relatively safe
3419 * assumption).
3420 * Long longs are not yet implemented because this is very compiler
3421 * specific and I don't want to think too much about the problems.
3422 *
3423 *-------------------------------------------------------------------------
3424 */
3425 static int make_number(int radix, YYSTYPE *val, const char *str, int len)
3426 {
3427 int is_l = 0;
3428 int is_ll = 0;
3429 int is_u = 0;
3430 char ext[4];
3431
3432 ext[3] = '\0';
3433 ext[2] = toupper(str[len-1]);
3434 ext[1] = len > 1 ? toupper(str[len-2]) : ' ';
3435 ext[0] = len > 2 ? toupper(str[len-3]) : ' ';
3436
3437 if(!strcmp(ext, "LUL"))
3438 pperror("Invalid constant suffix");
3439 else if(!strcmp(ext, "LLU") || !strcmp(ext, "ULL"))
3440 {
3441 is_ll++;
3442 is_u++;
3443 }
3444 else if(!strcmp(ext+1, "LU") || !strcmp(ext+1, "UL"))
3445 {
3446 is_l++;
3447 is_u++;
3448 }
3449 else if(!strcmp(ext+1, "LL"))
3450 {
3451 is_ll++;
3452 }
3453 else if(!strcmp(ext+2, "L"))
3454 {
3455 is_l++;
3456 }
3457 else if(!strcmp(ext+2, "U"))
3458 {
3459 is_u++;
3460 }
3461
3462 if(is_ll)
3463 pp_internal_error(__FILE__, __LINE__, "long long constants not implemented yet");
3464
3465 if(is_u && is_l)
3466 {
3467 val->ulong = strtoul(str, NULL, radix);
3468 return tULONG;
3469 }
3470 else if(!is_u && is_l)
3471 {
3472 val->slong = strtol(str, NULL, radix);
3473 return tSLONG;
3474 }
3475 else if(is_u && !is_l)
3476 {
3477 val->uint = (unsigned int)strtoul(str, NULL, radix);
3478 return tUINT;
3479 }
3480
3481 /* Else it must be an int... */
3482 val->sint = (int)strtol(str, NULL, radix);
3483 return tSINT;
3484 }
3485
3486
3487 /*
3488 *-------------------------------------------------------------------------
3489 * Macro and define expansion support
3490 *
3491 * FIXME: Variable macro arguments.
3492 *-------------------------------------------------------------------------
3493 */
3494 static void expand_special(pp_entry_t *ppp)
3495 {
3496 const char *dbgtext = "?";
3497 static char *buf = NULL;
3498
3499 assert(ppp->type == def_special);
3500
3501 if(!strcmp(ppp->ident, "__LINE__"))
3502 {
3503 dbgtext = "def_special(__LINE__)";
3504 buf = pp_xrealloc(buf, 32);
3505 sprintf(buf, "%d", pp_status.line_number);
3506 }
3507 else if(!strcmp(ppp->ident, "__FILE__"))
3508 {
3509 dbgtext = "def_special(__FILE__)";
3510 buf = pp_xrealloc(buf, strlen(pp_status.input) + 3);
3511 sprintf(buf, "\"%s\"", pp_status.input);
3512 }
3513 else
3514 pp_internal_error(__FILE__, __LINE__, "Special macro '%s' not found...\n", ppp->ident);
3515
3516 if(pp_flex_debug)
3517 fprintf(stderr, "expand_special(%d): %s:%d: '%s' -> '%s'\n",
3518 macexpstackidx,
3519 pp_status.input,
3520 pp_status.line_number,
3521 ppp->ident,
3522 buf ? buf : "");
3523
3524 if(buf && buf[0])
3525 {
3526 push_buffer(ppp, NULL, NULL, 0);
3527 yy_scan_string(buf);
3528 }
3529 }
3530
3531 static void expand_define(pp_entry_t *ppp)
3532 {
3533 assert(ppp->type == def_define);
3534
3535 if(pp_flex_debug)
3536 fprintf(stderr, "expand_define(%d): %s:%d: '%s' -> '%s'\n",
3537 macexpstackidx,
3538 pp_status.input,
3539 pp_status.line_number,
3540 ppp->ident,
3541 ppp->subst.text);
3542 if(ppp->subst.text && ppp->subst.text[0])
3543 {
3544 push_buffer(ppp, NULL, NULL, 0);
3545 yy_scan_string(ppp->subst.text);
3546 }
3547 }
3548
3549 static int curdef_idx = 0;
3550 static int curdef_alloc = 0;
3551 static char *curdef_text = NULL;
3552
3553 static void add_text(const char *str, int len)
3554 {
3555 if(len == 0)
3556 return;
3557 if(curdef_idx >= curdef_alloc || curdef_alloc - curdef_idx < len)
3558 {
3559 curdef_alloc += (len + ALLOCBLOCKSIZE-1) & ~(ALLOCBLOCKSIZE-1);
3560 curdef_text = pp_xrealloc(curdef_text, curdef_alloc * sizeof(curdef_text[0]));
3561 if(curdef_alloc > 65536)
3562 ppwarning("Reallocating macro-expansion buffer larger than 64kB");
3563 }
3564 memcpy(&curdef_text[curdef_idx], str, len);
3565 curdef_idx += len;
3566 }
3567
3568 static mtext_t *add_expand_text(mtext_t *mtp, macexpstackentry_t *mep, int *nnl)
3569 {
3570 char *cptr;
3571 char *exp;
3572 int tag;
3573 int n;
3574
3575 if(mtp == NULL)
3576 return NULL;
3577
3578 switch(mtp->type)
3579 {
3580 case exp_text:
3581 if(pp_flex_debug)
3582 fprintf(stderr, "add_expand_text: exp_text: '%s'\n", mtp->subst.text);
3583 add_text(mtp->subst.text, strlen(mtp->subst.text));
3584 break;
3585
3586 case exp_stringize:
3587 if(pp_flex_debug)
3588 fprintf(stderr, "add_expand_text: exp_stringize(%d): '%s'\n",
3589 mtp->subst.argidx,
3590 mep->args[mtp->subst.argidx]);
3591 cptr = mep->args[mtp->subst.argidx];
3592 add_text("\"", 1);
3593 while(*cptr)
3594 {
3595 if(*cptr == '"' || *cptr == '\\')
3596 add_text("\\", 1);
3597 add_text(cptr, 1);
3598 cptr++;
3599 }
3600 add_text("\"", 1);
3601 break;
3602
3603 case exp_concat:
3604 if(pp_flex_debug)
3605 fprintf(stderr, "add_expand_text: exp_concat\n");
3606 /* Remove trailing whitespace from current expansion text */
3607 while(curdef_idx)
3608 {
3609 if(isspace(curdef_text[curdef_idx-1] & 0xff))
3610 curdef_idx--;
3611 else
3612 break;
3613 }
3614 /* tag current position and recursively expand the next part */
3615 tag = curdef_idx;
3616 mtp = add_expand_text(mtp->next, mep, nnl);
3617
3618 /* Now get rid of the leading space of the expansion */
3619 cptr = &curdef_text[tag];
3620 n = curdef_idx - tag;
3621 while(n)
3622 {
3623 if(isspace(*cptr & 0xff))
3624 {
3625 cptr++;
3626 n--;
3627 }
3628 else
3629 break;
3630 }
3631 if(cptr != &curdef_text[tag])
3632 {
3633 memmove(&curdef_text[tag], cptr, n);
3634 curdef_idx -= (curdef_idx - tag) - n;
3635 }
3636 break;
3637
3638 case exp_subst:
3639 if((mtp->next && mtp->next->type == exp_concat) || (mtp->prev && mtp->prev->type == exp_concat))
3640 exp = mep->args[mtp->subst.argidx];
3641 else
3642 exp = mep->ppargs[mtp->subst.argidx];
3643 if(exp)
3644 {
3645 add_text(exp, strlen(exp));
3646 *nnl -= mep->nnls[mtp->subst.argidx];
3647 cptr = strchr(exp, '\n');
3648 while(cptr)
3649 {
3650 *cptr = ' ';
3651 cptr = strchr(cptr+1, '\n');
3652 }
3653 mep->nnls[mtp->subst.argidx] = 0;
3654 }
3655 if(pp_flex_debug)
3656 fprintf(stderr, "add_expand_text: exp_subst(%d): '%s'\n", mtp->subst.argidx, exp);
3657 break;
3658
3659 default:
3660 pp_internal_error(__FILE__, __LINE__, "Invalid expansion type (%d) in macro expansion\n", mtp->type);
3661 }
3662 return mtp;
3663 }
3664
3665 static void expand_macro(macexpstackentry_t *mep)
3666 {
3667 mtext_t *mtp;
3668 int n, k;
3669 char *cptr;
3670 int nnl = 0;
3671 pp_entry_t *ppp = mep->ppp;
3672 int nargs = mep->nargs;
3673
3674 assert(ppp->type == def_macro);
3675 assert(ppp->expanding == 0);
3676
3677 if((ppp->nargs >= 0 && nargs != ppp->nargs) || (ppp->nargs < 0 && nargs < -ppp->nargs))
3678 pperror("Too %s macro arguments (%d)", nargs < abs(ppp->nargs) ? "few" : "many", nargs);
3679
3680 for(n = 0; n < nargs; n++)
3681 nnl += mep->nnls[n];
3682
3683 if(pp_flex_debug)
3684 fprintf(stderr, "expand_macro(%d): %s:%d: '%s'(%d,%d) -> ...\n",
3685 macexpstackidx,
3686 pp_status.input,
3687 pp_status.line_number,
3688 ppp->ident,
3689 mep->nargs,
3690 nnl);
3691
3692 curdef_idx = 0;
3693
3694 for(mtp = ppp->subst.mtext; mtp; mtp = mtp->next)
3695 {
3696 if(!(mtp = add_expand_text(mtp, mep, &nnl)))
3697 break;
3698 }
3699
3700 for(n = 0; n < nnl; n++)
3701 add_text("\n", 1);
3702
3703 /* To make sure there is room and termination (see below) */
3704 add_text(" \0", 2);
3705
3706 /* Strip trailing whitespace from expansion */
3707 for(k = curdef_idx, cptr = &curdef_text[curdef_idx-1]; k > 0; k--, cptr--)
3708 {
3709 if(!isspace(*cptr & 0xff))
3710 break;
3711 }
3712
3713 /*
3714 * We must add *one* whitespace to make sure that there
3715 * is a token-separation after the expansion.
3716 */
3717 *(++cptr) = ' ';
3718 *(++cptr) = '\0';
3719 k++;
3720
3721 /* Strip leading whitespace from expansion */
3722 for(n = 0, cptr = curdef_text; n < k; n++, cptr++)
3723 {
3724 if(!isspace(*cptr & 0xff))
3725 break;
3726 }
3727
3728 if(k - n > 0)
3729 {
3730 if(pp_flex_debug)
3731 fprintf(stderr, "expand_text: '%s'\n", curdef_text + n);
3732 push_buffer(ppp, NULL, NULL, 0);
3733 /*yy_scan_bytes(curdef_text + n, k - n);*/
3734 yy_scan_string(curdef_text + n);
3735 }
3736 }
3737
3738 /*
3739 *-------------------------------------------------------------------------
3740 * String collection routines
3741 *-------------------------------------------------------------------------
3742 */
3743 static void new_string(void)
3744 {
3745 #ifdef DEBUG
3746 if(strbuf_idx)
3747 ppwarning("new_string: strbuf_idx != 0");
3748 #endif
3749 strbuf_idx = 0;
3750 str_startline = pp_status.line_number;
3751 }
3752
3753 static void add_string(const char *str, int len)
3754 {
3755 if(len == 0)
3756 return;
3757 if(strbuf_idx >= strbuf_alloc || strbuf_alloc - strbuf_idx < len)
3758 {
3759 strbuf_alloc += (len + ALLOCBLOCKSIZE-1) & ~(ALLOCBLOCKSIZE-1);
3760 strbuffer = pp_xrealloc(strbuffer, strbuf_alloc * sizeof(strbuffer[0]));
3761 if(strbuf_alloc > 65536)
3762 ppwarning("Reallocating string buffer larger than 64kB");
3763 }
3764 memcpy(&strbuffer[strbuf_idx], str, len);
3765 strbuf_idx += len;
3766 }
3767
3768 static char *get_string(void)
3769 {
3770 char *str = pp_xmalloc(strbuf_idx + 1);
3771 memcpy(str, strbuffer, strbuf_idx);
3772 str[strbuf_idx] = '\0';
3773 #ifdef DEBUG
3774 strbuf_idx = 0;
3775 #endif
3776 return str;
3777 }
3778
3779 static void put_string(void)
3780 {
3781 put_buffer(strbuffer, strbuf_idx);
3782 #ifdef DEBUG
3783 strbuf_idx = 0;
3784 #endif
3785 }
3786
3787 static int string_start(void)
3788 {
3789 return str_startline;
3790 }
3791
3792
3793 /*
3794 *-------------------------------------------------------------------------
3795 * Buffer management
3796 *-------------------------------------------------------------------------
3797 */
3798 static void push_buffer(pp_entry_t *ppp, char *filename, char *incname, int pop)
3799 {
3800 if(ppdebug)
3801 printf("push_buffer(%d): %p %p %p %d\n", bufferstackidx, ppp, filename, incname, pop);
3802 if(bufferstackidx >= MAXBUFFERSTACK)
3803 pp_internal_error(__FILE__, __LINE__, "Buffer stack overflow");
3804
3805 memset(&bufferstack[bufferstackidx], 0, sizeof(bufferstack[0]));
3806 bufferstack[bufferstackidx].bufferstate = YY_CURRENT_BUFFER;
3807 bufferstack[bufferstackidx].define = ppp;
3808 bufferstack[bufferstackidx].line_number = pp_status.line_number;
3809 bufferstack[bufferstackidx].char_number = pp_status.char_number;
3810 bufferstack[bufferstackidx].if_depth = pp_get_if_depth();
3811 bufferstack[bufferstackidx].should_pop = pop;
3812 bufferstack[bufferstackidx].filename = pp_status.input;
3813 bufferstack[bufferstackidx].ncontinuations = ncontinuations;
3814 bufferstack[bufferstackidx].incl = pp_incl_state;
3815 bufferstack[bufferstackidx].include_filename = incname;
3816 bufferstack[bufferstackidx].pass_data = pass_data;
3817
3818 if(ppp)
3819 ppp->expanding = 1;
3820 else if(filename)
3821 {
3822 /* These will track the pperror to the correct file and line */
3823 pp_status.line_number = 1;
3824 pp_status.char_number = 1;
3825 pp_status.input = filename;
3826 ncontinuations = 0;
3827 }
3828 else if(!pop)
3829 pp_internal_error(__FILE__, __LINE__, "Pushing buffer without knowing where to go to");
3830 bufferstackidx++;
3831 }
3832
3833 static bufferstackentry_t *pop_buffer(void)
3834 {
3835 if(bufferstackidx < 0)
3836 pp_internal_error(__FILE__, __LINE__, "Bufferstack underflow?");
3837
3838 if(bufferstackidx == 0)
3839 return NULL;
3840
3841 bufferstackidx--;
3842
3843 if(bufferstack[bufferstackidx].define)
3844 bufferstack[bufferstackidx].define->expanding = 0;
3845 else
3846 {
3847 pp_status.line_number = bufferstack[bufferstackidx].line_number;
3848 pp_status.char_number = bufferstack[bufferstackidx].char_number;
3849 pp_status.input = bufferstack[bufferstackidx].filename;
3850 ncontinuations = bufferstack[bufferstackidx].ncontinuations;
3851 if(!bufferstack[bufferstackidx].should_pop)
3852 {
3853 fclose(ppin);
3854 fprintf(ppout, "# %d \"%s\" 2\n", pp_status.line_number, pp_status.input);
3855
3856 /* We have EOF, check the include logic */
3857 if(pp_incl_state.state == 2 && !pp_incl_state.seen_junk && pp_incl_state.ppp)
3858 {
3859 pp_entry_t *ppp = pplookup(pp_incl_state.ppp);
3860 if(ppp)
3861 {
3862 includelogicentry_t *iep = pp_xmalloc(sizeof(includelogicentry_t));
3863 iep->ppp = ppp;
3864 ppp->iep = iep;
3865 iep->filename = bufferstack[bufferstackidx].include_filename;
3866 iep->prev = NULL;
3867 iep->next = pp_includelogiclist;
3868 if(iep->next)
3869 iep->next->prev = iep;
3870 pp_includelogiclist = iep;
3871 if(pp_status.debug)
3872 fprintf(stderr, "pop_buffer: %s:%d: includelogic added, include_ppp='%s', file='%s'\n", pp_status.input, pp_status.line_number, pp_incl_state.ppp, iep->filename);
3873 }
3874 else if(bufferstack[bufferstackidx].include_filename)
3875 free(bufferstack[bufferstackidx].include_filename);
3876 }
3877 if(pp_incl_state.ppp)
3878 free(pp_incl_state.ppp);
3879 pp_incl_state = bufferstack[bufferstackidx].incl;
3880 pass_data = bufferstack[bufferstackidx].pass_data;
3881
3882 }
3883 }
3884
3885 if(ppdebug)
3886 printf("pop_buffer(%d): %p %p (%d, %d, %d) %p %d\n",
3887 bufferstackidx,
3888 bufferstack[bufferstackidx].bufferstate,
3889 bufferstack[bufferstackidx].define,
3890 bufferstack[bufferstackidx].line_number,
3891 bufferstack[bufferstackidx].char_number,
3892 bufferstack[bufferstackidx].if_depth,
3893 bufferstack[bufferstackidx].filename,
3894 bufferstack[bufferstackidx].should_pop);
3895
3896 pp_switch_to_buffer(bufferstack[bufferstackidx].bufferstate);
3897
3898 if(bufferstack[bufferstackidx].should_pop)
3899 {
3900 if(yy_current_state() == pp_macexp)
3901 macro_add_expansion();
3902 else
3903 pp_internal_error(__FILE__, __LINE__, "Pop buffer and state without macro expansion state");
3904 yy_pop_state();
3905 }
3906
3907 return &bufferstack[bufferstackidx];
3908 }
3909
3910
3911 /*
3912 *-------------------------------------------------------------------------
3913 * Macro nestng support
3914 *-------------------------------------------------------------------------
3915 */
3916 static void push_macro(pp_entry_t *ppp)
3917 {
3918 if(macexpstackidx >= MAXMACEXPSTACK)
3919 pperror("Too many nested macros");
3920
3921 macexpstack[macexpstackidx] = pp_xmalloc(sizeof(macexpstack[0][0]));
3922 memset( macexpstack[macexpstackidx], 0, sizeof(macexpstack[0][0]));
3923 macexpstack[macexpstackidx]->ppp = ppp;
3924 macexpstackidx++;
3925 }
3926
3927 static macexpstackentry_t *top_macro(void)
3928 {
3929 return macexpstackidx > 0 ? macexpstack[macexpstackidx-1] : NULL;
3930 }
3931
3932 static macexpstackentry_t *pop_macro(void)
3933 {
3934 if(macexpstackidx <= 0)
3935 pp_internal_error(__FILE__, __LINE__, "Macro expansion stack underflow\n");
3936 return macexpstack[--macexpstackidx];
3937 }
3938
3939 static void free_macro(macexpstackentry_t *mep)
3940 {
3941 int i;
3942
3943 for(i = 0; i < mep->nargs; i++)
3944 free(mep->args[i]);
3945 if(mep->args)
3946 free(mep->args);
3947 if(mep->nnls)
3948 free(mep->nnls);
3949 if(mep->curarg)
3950 free(mep->curarg);
3951 free(mep);
3952 }
3953
3954 static void add_text_to_macro(const char *text, int len)
3955 {
3956 macexpstackentry_t *mep = top_macro();
3957
3958 assert(mep->ppp->expanding == 0);
3959
3960 if(mep->curargalloc - mep->curargsize <= len+1) /* +1 for '\0' */
3961 {
3962 mep->curargalloc += (ALLOCBLOCKSIZE > len+1) ? ALLOCBLOCKSIZE : len+1;
3963 mep->curarg = pp_xrealloc(mep->curarg, mep->curargalloc * sizeof(mep->curarg[0]));
3964 }
3965 memcpy(mep->curarg + mep->curargsize, text, len);
3966 mep->curargsize += len;
3967 mep->curarg[mep->curargsize] = '\0';
3968 }
3969
3970 static void macro_add_arg(int last)
3971 {
3972 int nnl = 0;
3973 char *cptr;
3974 macexpstackentry_t *mep = top_macro();
3975
3976 assert(mep->ppp->expanding == 0);
3977
3978 mep->args = pp_xrealloc(mep->args, (mep->nargs+1) * sizeof(mep->args[0]));
3979 mep->ppargs = pp_xrealloc(mep->ppargs, (mep->nargs+1) * sizeof(mep->ppargs[0]));
3980 mep->nnls = pp_xrealloc(mep->nnls, (mep->nargs+1) * sizeof(mep->nnls[0]));
3981 mep->args[mep->nargs] = pp_xstrdup(mep->curarg ? mep->curarg : "");
3982 cptr = mep->args[mep->nargs]-1;
3983 while((cptr = strchr(cptr+1, '\n')))
3984 {
3985 nnl++;
3986 }
3987 mep->nnls[mep->nargs] = nnl;
3988 mep->nargs++;
3989 free(mep->curarg);
3990 mep->curargalloc = mep->curargsize = 0;
3991 mep->curarg = NULL;
3992
3993 if(pp_flex_debug)
3994 fprintf(stderr, "macro_add_arg: %s:%d: %d -> '%s'\n",
3995 pp_status.input,
3996 pp_status.line_number,
3997 mep->nargs-1,
3998 mep->args[mep->nargs-1]);
3999
4000 /* Each macro argument must be expanded to cope with stingize */
4001 if(last || mep->args[mep->nargs-1][0])
4002 {
4003 yy_push_state(pp_macexp);
4004 push_buffer(NULL, NULL, NULL, last ? 2 : 1);
4005 yy_scan_string(mep->args[mep->nargs-1]);
4006 /*mep->bufferstackidx = bufferstackidx; But not nested! */
4007 }
4008 }
4009
4010 static void macro_add_expansion(void)
4011 {
4012 macexpstackentry_t *mep = top_macro();
4013
4014 assert(mep->ppp->expanding == 0);
4015
4016 mep->ppargs[mep->nargs-1] = pp_xstrdup(mep->curarg ? mep->curarg : "");
4017 free(mep->curarg);
4018 mep->curargalloc = mep->curargsize = 0;
4019 mep->curarg = NULL;
4020
4021 if(pp_flex_debug)
4022 fprintf(stderr, "macro_add_expansion: %s:%d: %d -> '%s'\n",
4023 pp_status.input,
4024 pp_status.line_number,
4025 mep->nargs-1,
4026 mep->ppargs[mep->nargs-1]);
4027 }
4028
4029
4030 /*
4031 *-------------------------------------------------------------------------
4032 * Output management
4033 *-------------------------------------------------------------------------
4034 */
4035 static void put_buffer(const char *s, int len)
4036 {
4037 if(top_macro())
4038 add_text_to_macro(s, len);
4039 else {
4040 if(pass_data)
4041 fwrite(s, 1, len, ppout);
4042 }
4043 }
4044
4045
4046 /*
4047 *-------------------------------------------------------------------------
4048 * Include management
4049 *-------------------------------------------------------------------------
4050 */
4051 static int is_c_h_include(char *fname, int quoted)
4052 {
4053 int sl=strlen(fname);
4054 if (sl < 2 + 2 * quoted) return 0;
4055 if ((toupper(fname[sl-1-quoted])!='H') && (toupper(fname[sl-1-quoted])!='C')) return 0;
4056 if (fname[sl-2-quoted]!='.') return 0;
4057 return 1;
4058 }
4059
4060 void pp_do_include(char *fname, int type)
4061 {
4062 char *newpath;
4063 int n;
4064 includelogicentry_t *iep;
4065
4066 for(iep = pp_includelogiclist; iep; iep = iep->next)
4067 {
4068 if(!strcmp(iep->filename, fname))
4069 {
4070 /*
4071 * We are done. The file was included before.
4072 * If the define was deleted, then this entry would have
4073 * been deleted too.
4074 */
4075 return;
4076 }
4077 }
4078
4079 n = strlen(fname);
4080
4081 if(n <= 2)
4082 pperror("Empty include filename");
4083
4084 /* Undo the effect of the quotation */
4085 fname[n-1] = '\0';
4086
4087 if((ppin = pp_open_include(fname+1, type ? pp_status.input : NULL, &newpath, type)) == NULL)
4088 pperror("Unable to open include file %s", fname+1);
4089
4090 fname[n-1] = *fname; /* Redo the quotes */
4091 push_buffer(NULL, newpath, fname, 0);
4092 pp_incl_state.seen_junk = 0;
4093 pp_incl_state.state = 0;
4094 pp_incl_state.ppp = NULL;
4095 if (is_c_h_include(newpath, 0)) pass_data=0;
4096 else pass_data=1;
4097
4098 if(pp_status.debug)
4099 fprintf(stderr, "pp_do_include: %s:%d: include_state=%d, include_ppp='%s', include_ifdepth=%d ,pass_data=%d\n",
4100 pp_status.input, pp_status.line_number, pp_incl_state.state, pp_incl_state.ppp, pp_incl_state.ifdepth, pass_data);
4101 pp_switch_to_buffer(pp_create_buffer(ppin, YY_BUF_SIZE));
4102
4103 fprintf(ppout, "# 1 \"%s\" 1%s\n", newpath, type ? "" : " 3");
4104 }
4105
4106 /*
4107 *-------------------------------------------------------------------------
4108 * Push/pop preprocessor ignore state when processing conditionals
4109 * which are false.
4110 *-------------------------------------------------------------------------
4111 */
4112 void pp_push_ignore_state(void)
4113 {
4114 yy_push_state(pp_ignore);
4115 }
4116
4117 void pp_pop_ignore_state(void)
4118 {
4119 yy_pop_state();
4120 }