source: trunk/tools/wrc/lex.ppl.c@ 10367

Last change on this file since 10367 was 5523, checked in by sandervl, 24 years ago

updates

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