source: trunk/tools/wrc/lexyy.c@ 3426

Last change on this file since 3426 was 3426, checked in by sandervl, 25 years ago

update with latest wine code

File size: 90.4 KB
Line 
1/* A lexical scanner generated by flex */
2
3/* Scanner skeleton version:
4 * $Header: /home/ktk/tmp/odin/2007/netlabs.cvs/odin32/tools/wrc/lexyy.c,v 1.2 2000-04-19 14:44:58 sandervl Exp $
5 */
6
7#define FLEX_SCANNER
8#define YY_FLEX_MAJOR_VERSION 2
9#define YY_FLEX_MINOR_VERSION 5
10
11#include <stdio.h>
12
13
14/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
15#ifdef c_plusplus
16#ifndef __cplusplus
17#define __cplusplus
18#endif
19#endif
20
21
22#ifdef __cplusplus
23
24#include <stdlib.h>
25#include <unistd.h>
26
27/* Use prototypes in function declarations. */
28#define YY_USE_PROTOS
29
30/* The "const" storage-class-modifier is valid. */
31#define YY_USE_CONST
32
33#else /* ! __cplusplus */
34
35#if __STDC__
36
37#define YY_USE_PROTOS
38#define YY_USE_CONST
39
40#endif /* __STDC__ */
41#endif /* ! __cplusplus */
42
43#ifdef __TURBOC__
44 #pragma warn -rch
45 #pragma warn -use
46#include <io.h>
47#include <stdlib.h>
48#define YY_USE_CONST
49#define YY_USE_PROTOS
50#endif
51
52#ifdef YY_USE_CONST
53#define yyconst const
54#else
55#define yyconst
56#endif
57
58
59#ifdef YY_USE_PROTOS
60#define YY_PROTO(proto) proto
61#else
62#define YY_PROTO(proto) ()
63#endif
64
65/* Returned upon end-of-file. */
66#define YY_NULL 0
67
68/* Promotes a possibly negative, possibly signed char to an unsigned
69 * integer for use as an array index. If the signed char is negative,
70 * we want to instead treat it as an 8-bit unsigned char, hence the
71 * double cast.
72 */
73#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
74
75/* Enter a start condition. This macro really ought to take a parameter,
76 * but we do it the disgusting crufty way forced on us by the ()-less
77 * definition of BEGIN.
78 */
79#define BEGIN yy_start = 1 + 2 *
80
81/* Translate the current start state into a value that can be later handed
82 * to BEGIN to return to the state. The YYSTATE alias is for lex
83 * compatibility.
84 */
85#define YY_START ((yy_start - 1) / 2)
86#define YYSTATE YY_START
87
88/* Action number for EOF rule of a given start state. */
89#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
90
91/* Special action meaning "start processing a new file". */
92#define YY_NEW_FILE yyrestart( yyin )
93
94#define YY_END_OF_BUFFER_CHAR 0
95
96/* Size of default input buffer. */
97#define YY_BUF_SIZE 16384
98
99typedef struct yy_buffer_state *YY_BUFFER_STATE;
100
101extern int yyleng;
102extern FILE *yyin, *yyout;
103
104#define EOB_ACT_CONTINUE_SCAN 0
105#define EOB_ACT_END_OF_FILE 1
106#define EOB_ACT_LAST_MATCH 2
107
108/* The funky do-while in the following #define is used to turn the definition
109 * int a single C statement (which needs a semi-colon terminator). This
110 * avoids problems with code like:
111 *
112 * if ( condition_holds )
113 * yyless( 5 );
114 * else
115 * do_something_else();
116 *
117 * Prior to using the do-while the compiler would get upset at the
118 * "else" because it interpreted the "if" statement as being all
119 * done when it reached the ';' after the yyless() call.
120 */
121
122/* Return all but the first 'n' matched characters back to the input stream. */
123
124#define yyless(n) \
125 do \
126 { \
127 /* Undo effects of setting up yytext. */ \
128 *yy_cp = yy_hold_char; \
129 yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
130 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
131 } \
132 while ( 0 )
133
134#define unput(c) yyunput( c, yytext_ptr )
135
136/* The following is because we cannot portably get our hands on size_t
137 * (without autoconf's help, which isn't available because we want
138 * flex-generated scanners to compile on their own).
139 */
140typedef unsigned int yy_size_t;
141
142
143struct yy_buffer_state
144 {
145 FILE *yy_input_file;
146
147 char *yy_ch_buf; /* input buffer */
148 char *yy_buf_pos; /* current position in input buffer */
149
150 /* Size of input buffer in bytes, not including room for EOB
151 * characters.
152 */
153 yy_size_t yy_buf_size;
154
155 /* Number of characters read into yy_ch_buf, not including EOB
156 * characters.
157 */
158 int yy_n_chars;
159
160 /* Whether we "own" the buffer - i.e., we know we created it,
161 * and can realloc() it to grow it, and should free() it to
162 * delete it.
163 */
164 int yy_is_our_buffer;
165
166 /* Whether this is an "interactive" input source; if so, and
167 * if we're using stdio for input, then we want to use getc()
168 * instead of fread(), to make sure we stop fetching input after
169 * each newline.
170 */
171 int yy_is_interactive;
172
173 /* Whether we're considered to be at the beginning of a line.
174 * If so, '^' rules will be active on the next match, otherwise
175 * not.
176 */
177 int yy_at_bol;
178
179 /* Whether to try to fill the input buffer when we reach the
180 * end of it.
181 */
182 int yy_fill_buffer;
183
184 int yy_buffer_status;
185#define YY_BUFFER_NEW 0
186#define YY_BUFFER_NORMAL 1
187 /* When an EOF's been seen but there's still some text to process
188 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
189 * shouldn't try reading from the input source any more. We might
190 * still have a bunch of tokens to match, though, because of
191 * possible backing-up.
192 *
193 * When we actually see the EOF, we change the status to "new"
194 * (via yyrestart()), so that the user can continue scanning by
195 * just pointing yyin at a new input file.
196 */
197#define YY_BUFFER_EOF_PENDING 2
198 };
199
200static YY_BUFFER_STATE yy_current_buffer = 0;
201
202/* We provide macros for accessing buffer states in case in the
203 * future we want to put the buffer states in a more general
204 * "scanner state".
205 */
206#define YY_CURRENT_BUFFER yy_current_buffer
207
208
209/* yy_hold_char holds the character lost when yytext is formed. */
210static char yy_hold_char;
211
212static int yy_n_chars; /* number of characters read into yy_ch_buf */
213
214
215int yyleng;
216
217/* Points to current character in buffer. */
218static char *yy_c_buf_p = (char *) 0;
219static int yy_init = 1; /* whether we need to initialize */
220static int yy_start = 0; /* start state number */
221
222/* Flag which is used to allow yywrap()'s to do buffer switches
223 * instead of setting up a fresh yyin. A bit of a hack ...
224 */
225static int yy_did_buffer_switch_on_eof;
226
227void yyrestart YY_PROTO(( FILE *input_file ));
228
229void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
230void yy_load_buffer_state YY_PROTO(( void ));
231YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
232void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
233void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
234void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
235#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
236
237YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
238YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *str ));
239YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
240
241static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
242static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
243static void yy_flex_free YY_PROTO(( void * ));
244
245#define yy_new_buffer yy_create_buffer
246
247#define yy_set_interactive(is_interactive) \
248 { \
249 if ( ! yy_current_buffer ) \
250 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
251 yy_current_buffer->yy_is_interactive = is_interactive; \
252 }
253
254#define yy_set_bol(at_bol) \
255 { \
256 if ( ! yy_current_buffer ) \
257 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
258 yy_current_buffer->yy_at_bol = at_bol; \
259 }
260
261#define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
262
263typedef unsigned char YY_CHAR;
264FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
265typedef int yy_state_type;
266extern char *yytext;
267#define yytext_ptr yytext
268
269static yy_state_type yy_get_previous_state YY_PROTO(( void ));
270static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
271static int yy_get_next_buffer YY_PROTO(( void ));
272static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
273
274/* Done after the current pattern has been matched and before the
275 * corresponding action - sets up yytext.
276 */
277#define YY_DO_BEFORE_ACTION \
278 yytext_ptr = yy_bp; \
279 yyleng = (int) (yy_cp - yy_bp); \
280 yy_hold_char = *yy_cp; \
281 *yy_cp = '\0'; \
282 yy_c_buf_p = yy_cp;
283
284#define YY_NUM_RULES 124
285#define YY_END_OF_BUFFER 125
286static yyconst short int yy_accept[369] =
287 { 0,
288 0, 0, 66, 66, 0, 0, 0, 0, 0, 0,
289 0, 0, 114, 114, 0, 0, 0, 0, 0, 0,
290 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
291 0, 0, 22, 22, 9, 9, 9, 9, 46, 46,
292 0, 0, 36, 36, 31, 31, 40, 40, 41, 41,
293 125, 122, 121, 120, 122, 88, 122, 107, 122, 56,
294 56, 118, 122, 122, 122, 59, 59, 54, 122, 55,
295 121, 122, 66, 121, 67, 66, 66, 66, 66, 66,
296 66, 123, 69, 68, 102, 90, 89, 106, 87, 72,
297 71, 123, 112, 110, 111, 108, 112, 114, 116, 115,
298
299 4, 123, 4, 4, 8, 6, 14, 22, 9, 12,
300 123, 123, 46, 45, 45, 45, 36, 123, 34, 32,
301 33, 36, 123, 31, 123, 29, 27, 28, 31, 40,
302 37, 38, 123, 40, 44, 41, 43, 42, 121, 63,
303 61, 113, 119, 56, 59, 56, 59, 59, 118, 64,
304 62, 65, 70, 60, 121, 0, 0, 0, 0, 0,
305 0, 0, 0, 66, 66, 66, 66, 66, 66, 66,
306 66, 0, 68, 102, 0, 103, 101, 101, 91, 93,
307 94, 95, 96, 97, 98, 99, 100, 101, 87, 0,
308 84, 83, 83, 73, 75, 76, 77, 78, 79, 80,
309
310 81, 82, 83, 110, 109, 114, 115, 115, 117, 0,
311 0, 7, 6, 14, 22, 9, 10, 0, 11, 46,
312 0, 0, 0, 0, 0, 36, 35, 36, 0, 0,
313 31, 30, 31, 40, 39, 40, 41, 119, 58, 57,
314 0, 0, 0, 0, 0, 15, 0, 0, 0, 0,
315 66, 66, 66, 66, 66, 66, 66, 105, 104, 91,
316 93, 0, 86, 85, 73, 75, 0, 3, 2, 10,
317 0, 58, 57, 0, 0, 0, 0, 0, 0, 15,
318 0, 0, 0, 0, 0, 0, 66, 66, 66, 66,
319 66, 66, 53, 91, 92, 73, 0, 0, 0, 18,
320
321 19, 0, 0, 0, 0, 0, 0, 26, 0, 0,
322 66, 48, 66, 66, 66, 66, 73, 0, 0, 0,
323 18, 19, 20, 21, 25, 16, 0, 0, 26, 0,
324 13, 66, 49, 66, 66, 66, 73, 74, 23, 5,
325 20, 21, 25, 16, 17, 0, 24, 13, 66, 66,
326 66, 52, 73, 23, 5, 17, 1, 24, 66, 66,
327 50, 1, 66, 66, 66, 51, 47, 0
328 } ;
329
330static yyconst int yy_ec[256] =
331 { 0,
332 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
333 1, 2, 2, 1, 1, 1, 1, 1, 1, 1,
334 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
335 1, 2, 4, 5, 6, 1, 1, 7, 8, 9,
336 10, 11, 1, 1, 1, 1, 12, 13, 14, 14,
337 14, 14, 14, 14, 14, 15, 15, 1, 16, 17,
338 18, 19, 1, 1, 20, 21, 22, 23, 24, 25,
339 26, 26, 27, 26, 26, 28, 29, 30, 31, 32,
340 26, 33, 34, 26, 35, 36, 26, 37, 26, 26,
341 1, 38, 1, 1, 26, 1, 39, 40, 41, 42,
342
343 43, 44, 45, 26, 46, 26, 26, 47, 48, 49,
344 50, 51, 26, 52, 53, 54, 55, 56, 26, 57,
345 26, 26, 58, 59, 60, 1, 1, 1, 1, 1,
346 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
347 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
348 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
349 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
350 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
351 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
352 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
353
354 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
355 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
356 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
357 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
358 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
359 1, 1, 1, 1, 1
360 } ;
361
362static yyconst int yy_meta[61] =
363 { 0,
364 1, 2, 3, 1, 4, 5, 1, 1, 6, 7,
365 8, 9, 10, 10, 10, 5, 1, 1, 11, 10,
366 10, 10, 10, 10, 10, 12, 12, 12, 12, 12,
367 12, 12, 12, 12, 12, 12, 12, 13, 10, 10,
368 10, 10, 10, 10, 12, 12, 12, 12, 12, 12,
369 12, 12, 12, 12, 12, 12, 12, 14, 1, 14
370 } ;
371
372static yyconst short int yy_base[425] =
373 { 0,
374 0, 60, 119, 169, 17, 18, 42, 43, 46, 47,
375 219, 262, 21, 22, 24, 37, 306, 366, 426, 486,
376 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
377 0, 0, 1053, 1048, 79, 87, 89, 90, 1030, 1021,
378 1020, 28, 94, 127, 120, 187, 323, 339, 41, 92,
379 1005, 1334, 994, 1334, 977, 1334, 974, 1334, 24, 241,
380 191, 0, 950, 949, 948, 0, 948, 1334, 619, 1334,
381 81, 113, 0, 675, 1334, 10, 59, 83, 85, 103,
382 174, 671, 1334, 1334, 0, 1334, 102, 542, 0, 1334,
383 109, 595, 1334, 673, 1334, 1334, 0, 0, 1334, 126,
384
385 1334, 1334, 0, 0, 1334, 665, 0, 0, 0, 1334,
386 129, 147, 0, 1334, 107, 206, 0, 662, 1334, 1334,
387 1334, 156, 246, 0, 661, 1334, 1334, 1334, 167, 0,
388 1334, 1334, 660, 173, 1334, 668, 1334, 1334, 667, 1334,
389 1334, 1334, 0, 253, 0, 0, 163, 640, 0, 1334,
390 1334, 1334, 1334, 1334, 180, 344, 350, 625, 176, 139,
391 621, 614, 610, 0, 157, 193, 163, 192, 215, 194,
392 247, 653, 1334, 0, 325, 1334, 1334, 652, 281, 323,
393 1334, 1334, 1334, 1334, 1334, 1334, 1334, 0, 0, 326,
394 1334, 1334, 651, 343, 346, 1334, 1334, 1334, 1334, 1334,
395
396 1334, 1334, 0, 648, 1334, 0, 224, 262, 1334, 643,
397 627, 1334, 636, 0, 0, 0, 0, 351, 1334, 0,
398 341, 360, 406, 363, 11, 0, 1334, 392, 412, 419,
399 0, 1334, 407, 0, 1334, 414, 641, 0, 433, 372,
400 598, 43, 599, 588, 595, 465, 596, 587, 594, 590,
401 428, 430, 367, 433, 436, 478, 484, 1334, 1334, 463,
402 468, 0, 1334, 1334, 496, 502, 0, 626, 1334, 0,
403 578, 0, 0, 583, 584, 584, 580, 575, 575, 621,
404 579, 579, 573, 576, 573, 574, 492, 490, 485, 488,
405 500, 490, 0, 515, 1334, 520, 0, 566, 566, 612,
406
407 611, 568, 559, 553, 561, 561, 546, 0, 549, 548,
408 489, 0, 499, 513, 527, 529, 537, 0, 538, 546,
409 586, 573, 534, 524, 0, 469, 424, 409, 0, 409,
410 421, 530, 0, 532, 530, 536, 550, 1334, 0, 416,
411 415, 387, 0, 386, 361, 307, 0, 338, 540, 541,
412 542, 0, 556, 0, 332, 288, 277, 0, 553, 548,
413 0, 244, 555, 556, 563, 0, 0, 1334, 684, 698,
414 712, 726, 740, 754, 768, 782, 796, 810, 824, 838,
415 852, 866, 880, 894, 908, 922, 936, 190, 950, 964,
416 978, 992, 1006, 1020, 1034, 214, 1048, 1062, 1076, 1090,
417
418 1099, 462, 1111, 1125, 1139, 1153, 1167, 1180, 1194, 1207,
419 1221, 1235, 1249, 174, 147, 1263, 135, 93, 29, 1277,
420 16, 1291, 1305, 1319
421 } ;
422
423static yyconst short int yy_def[425] =
424 { 0,
425 369, 369, 370, 370, 371, 371, 372, 372, 373, 373,
426 374, 374, 375, 375, 376, 376, 377, 377, 378, 378,
427 379, 379, 379, 379, 379, 379, 379, 379, 379, 379,
428 379, 379, 380, 380, 381, 381, 381, 381, 382, 382,
429 383, 383, 384, 384, 385, 385, 386, 386, 387, 387,
430 368, 368, 368, 368, 368, 368, 368, 368, 368, 388,
431 388, 389, 368, 368, 368, 388, 388, 368, 368, 368,
432 368, 368, 390, 368, 368, 390, 390, 390, 390, 390,
433 390, 391, 368, 368, 392, 368, 368, 393, 394, 368,
434 368, 395, 368, 368, 368, 368, 396, 397, 368, 398,
435
436 368, 368, 399, 400, 368, 401, 402, 403, 404, 368,
437 405, 368, 406, 368, 368, 368, 407, 408, 368, 368,
438 368, 407, 368, 409, 410, 368, 368, 368, 409, 411,
439 368, 368, 412, 411, 368, 368, 368, 368, 368, 368,
440 368, 368, 413, 388, 388, 388, 388, 388, 389, 368,
441 368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
442 368, 368, 368, 390, 390, 390, 390, 390, 390, 390,
443 390, 391, 368, 392, 368, 368, 368, 368, 368, 368,
444 368, 368, 368, 368, 368, 368, 368, 414, 394, 368,
445 368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
446
447 368, 368, 415, 368, 368, 397, 398, 398, 368, 399,
448 400, 368, 401, 402, 403, 404, 416, 368, 368, 406,
449 368, 368, 368, 368, 368, 407, 368, 407, 368, 368,
450 409, 368, 409, 411, 368, 411, 368, 413, 388, 148,
451 368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
452 390, 390, 390, 390, 390, 390, 390, 368, 368, 368,
453 368, 417, 368, 368, 368, 368, 418, 399, 368, 416,
454 368, 388, 388, 368, 368, 368, 368, 368, 368, 368,
455 368, 368, 368, 368, 368, 368, 390, 390, 390, 390,
456 390, 390, 390, 368, 368, 368, 419, 368, 368, 368,
457
458 368, 368, 368, 368, 368, 368, 368, 420, 368, 368,
459 390, 390, 390, 390, 390, 390, 368, 421, 368, 368,
460 368, 368, 368, 368, 422, 368, 368, 368, 420, 368,
461 368, 390, 390, 390, 390, 390, 368, 368, 423, 368,
462 368, 368, 422, 368, 368, 368, 424, 368, 390, 390,
463 390, 390, 368, 423, 368, 368, 368, 424, 390, 390,
464 390, 368, 390, 390, 390, 390, 390, 0, 368, 368,
465 368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
466 368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
467 368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
468
469 368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
470 368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
471 368, 368, 368, 368
472 } ;
473
474static yyconst short int yy_nxt[1395] =
475 { 0,
476 52, 53, 54, 55, 56, 52, 57, 58, 52, 52,
477 52, 59, 60, 61, 61, 62, 63, 64, 65, 83,
478 83, 84, 84, 99, 99, 338, 102, 67, 103, 115,
479 54, 100, 100, 116, 142, 143, 165, 52, 318, 102,
480 104, 103, 136, 137, 86, 86, 87, 87, 90, 90,
481 91, 91, 245, 104, 246, 165, 138, 68, 69, 70,
482 52, 71, 54, 55, 56, 72, 57, 58, 52, 52,
483 52, 59, 60, 61, 61, 62, 63, 64, 65, 88,
484 88, 110, 155, 92, 92, 166, 156, 67, 275, 110,
485 111, 110, 110, 136, 137, 276, 54, 52, 111, 102,
486
487 111, 111, 297, 175, 166, 118, 176, 138, 221, 119,
488 190, 167, 222, 191, 157, 168, 112, 68, 69, 70,
489 74, 54, 54, 75, 112, 102, 112, 112, 122, 54,
490 167, 125, 123, 169, 168, 126, 208, 209, 118, 142,
491 143, 76, 119, 77, 295, 78, 79, 80, 218, 219,
492 81, 120, 169, 121, 158, 159, 267, 228, 160, 161,
493 76, 229, 77, 162, 78, 79, 80, 163, 233, 81,
494 74, 54, 229, 75, 236, 239, 239, 127, 229, 128,
495 245, 155, 246, 262, 120, 156, 121, 247, 129, 54,
496 251, 76, 123, 77, 253, 78, 79, 80, 125, 145,
497
498 81, 145, 126, 144, 144, 144, 170, 223, 171, 251,
499 76, 254, 77, 253, 78, 79, 80, 256, 146, 81,
500 94, 95, 242, 205, 243, 170, 96, 244, 171, 252,
501 254, 97, 97, 97, 368, 368, 256, 146, 97, 97,
502 97, 97, 97, 97, 127, 362, 128, 230, 224, 252,
503 255, 225, 161, 144, 144, 144, 162, 97, 97, 97,
504 97, 97, 97, 94, 95, 144, 144, 144, 146, 96,
505 255, 147, 208, 209, 97, 97, 97, 148, 362, 257,
506 146, 97, 97, 97, 97, 97, 97, 146, 159, 356,
507 147, 225, 161, 260, 260, 261, 162, 148, 257, 146,
508
509 97, 97, 97, 97, 97, 97, 105, 105, 102, 105,
510 105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
511 105, 105, 105, 105, 105, 54, 175, 190, 102, 258,
512 263, 131, 132, 355, 133, 261, 261, 261, 102, 348,
513 134, 54, 221, 105, 123, 157, 222, 131, 132, 357,
514 133, 157, 218, 219, 102, 265, 265, 266, 266, 266,
515 266, 223, 356, 105, 105, 105, 105, 105, 102, 105,
516 105, 105, 105, 105, 105, 105, 105, 105, 105, 105,
517 105, 105, 105, 105, 105, 158, 159, 344, 342, 160,
518 161, 158, 159, 228, 162, 160, 161, 229, 163, 273,
519
520 162, 289, 224, 105, 163, 225, 161, 223, 233, 242,
521 162, 243, 229, 230, 271, 236, 341, 355, 273, 229,
522 230, 289, 348, 105, 105, 105, 102, 102, 102, 102,
523 102, 102, 102, 102, 102, 102, 102, 102, 102, 102,
524 102, 102, 102, 102, 102, 239, 239, 347, 224, 287,
525 346, 225, 161, 288, 159, 290, 162, 225, 161, 291,
526 272, 159, 162, 102, 225, 161, 280, 345, 287, 162,
527 344, 214, 288, 214, 290, 294, 294, 261, 291, 272,
528 261, 261, 261, 102, 102, 102, 102, 102, 102, 102,
529 102, 102, 102, 102, 102, 102, 102, 102, 102, 102,
530
531 102, 102, 102, 102, 102, 292, 281, 293, 296, 296,
532 266, 311, 312, 282, 266, 266, 266, 313, 314, 315,
533 316, 332, 333, 102, 292, 342, 293, 261, 261, 261,
534 311, 312, 317, 317, 266, 341, 313, 314, 315, 316,
535 332, 333, 334, 102, 102, 102, 178, 335, 336, 337,
536 337, 266, 349, 350, 179, 179, 180, 351, 352, 359,
537 360, 334, 353, 353, 266, 361, 335, 336, 266, 266,
538 266, 349, 350, 363, 322, 364, 351, 352, 359, 360,
539 181, 182, 365, 366, 361, 183, 367, 321, 340, 339,
540 184, 331, 363, 185, 364, 186, 330, 187, 188, 193,
541
542 328, 365, 366, 327, 326, 367, 325, 194, 194, 195,
543 324, 323, 322, 321, 320, 319, 310, 309, 308, 307,
544 306, 305, 280, 304, 303, 302, 301, 300, 299, 298,
545 268, 286, 285, 196, 197, 284, 283, 279, 198, 278,
546 277, 274, 237, 199, 212, 269, 200, 268, 201, 204,
547 202, 203, 240, 240, 240, 264, 259, 173, 250, 240,
548 240, 240, 240, 240, 240, 249, 248, 241, 139, 237,
549 142, 142, 142, 212, 204, 173, 139, 154, 240, 240,
550 240, 240, 240, 240, 66, 66, 66, 66, 66, 66,
551 66, 66, 66, 66, 66, 66, 66, 66, 73, 73,
552
553 73, 73, 73, 73, 73, 73, 73, 73, 73, 73,
554 73, 73, 82, 82, 82, 82, 82, 82, 82, 82,
555 82, 82, 82, 82, 82, 82, 85, 85, 85, 85,
556 85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
557 89, 89, 89, 89, 89, 89, 89, 89, 89, 89,
558 89, 89, 89, 89, 93, 93, 93, 93, 93, 93,
559 93, 93, 93, 93, 93, 93, 93, 93, 98, 98,
560 98, 98, 98, 98, 98, 98, 98, 98, 98, 98,
561 98, 98, 101, 101, 101, 101, 101, 101, 101, 101,
562 101, 101, 101, 101, 101, 101, 106, 106, 106, 106,
563
564 106, 106, 106, 106, 106, 106, 106, 106, 106, 106,
565 107, 107, 107, 107, 107, 107, 107, 107, 107, 107,
566 107, 107, 107, 107, 102, 102, 102, 102, 102, 102,
567 102, 102, 102, 102, 102, 102, 102, 102, 108, 108,
568 108, 108, 108, 108, 108, 108, 108, 108, 108, 108,
569 108, 108, 109, 109, 109, 109, 109, 109, 109, 109,
570 109, 109, 109, 109, 109, 109, 113, 113, 113, 113,
571 113, 113, 113, 113, 113, 113, 113, 113, 113, 113,
572 114, 114, 114, 114, 114, 114, 114, 114, 114, 114,
573 114, 114, 114, 114, 117, 117, 117, 117, 117, 117,
574
575 117, 117, 117, 117, 117, 117, 117, 117, 124, 124,
576 124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
577 124, 124, 130, 130, 130, 130, 130, 130, 130, 130,
578 130, 130, 130, 130, 130, 130, 135, 135, 135, 135,
579 135, 135, 135, 135, 135, 135, 135, 135, 135, 135,
580 149, 149, 153, 149, 149, 149, 149, 149, 149, 149,
581 149, 149, 149, 149, 164, 152, 151, 150, 164, 164,
582 164, 164, 164, 164, 164, 164, 164, 164, 172, 172,
583 141, 172, 172, 172, 172, 172, 172, 172, 172, 172,
584 172, 172, 174, 174, 140, 139, 174, 174, 174, 174,
585
586 174, 174, 174, 174, 368, 174, 177, 177, 177, 177,
587 177, 177, 177, 177, 177, 177, 177, 177, 177, 177,
588 189, 189, 54, 102, 189, 189, 189, 189, 189, 189,
589 189, 189, 102, 189, 192, 192, 192, 192, 192, 192,
590 192, 192, 192, 192, 192, 192, 192, 192, 206, 206,
591 102, 206, 206, 206, 206, 102, 206, 206, 206, 206,
592 206, 206, 207, 207, 368, 207, 207, 207, 207, 207,
593 207, 207, 207, 207, 207, 207, 210, 210, 368, 210,
594 210, 210, 210, 210, 210, 210, 368, 210, 210, 210,
595 211, 211, 368, 211, 211, 211, 211, 211, 211, 211,
596
597 368, 211, 211, 211, 213, 368, 368, 368, 213, 368,
598 213, 215, 215, 368, 215, 215, 215, 215, 215, 215,
599 215, 215, 215, 215, 215, 216, 216, 368, 216, 216,
600 216, 216, 216, 368, 216, 216, 216, 368, 216, 217,
601 217, 217, 217, 217, 217, 217, 217, 217, 217, 217,
602 217, 217, 217, 220, 220, 368, 220, 220, 220, 220,
603 220, 220, 220, 220, 220, 220, 220, 226, 226, 368,
604 226, 368, 226, 226, 226, 368, 226, 226, 226, 226,
605 227, 227, 368, 227, 227, 227, 227, 227, 227, 227,
606 227, 227, 227, 227, 231, 231, 368, 231, 368, 231,
607
608 231, 231, 368, 231, 231, 231, 231, 232, 232, 368,
609 232, 232, 232, 232, 232, 232, 232, 232, 232, 232,
610 232, 234, 234, 368, 234, 368, 368, 368, 234, 368,
611 234, 234, 234, 234, 234, 235, 235, 368, 235, 235,
612 235, 235, 235, 235, 235, 235, 235, 235, 235, 238,
613 238, 368, 238, 238, 238, 238, 238, 238, 238, 238,
614 238, 238, 238, 270, 270, 368, 270, 270, 270, 270,
615 270, 368, 270, 270, 270, 368, 270, 329, 329, 368,
616 329, 329, 329, 329, 329, 329, 329, 329, 329, 329,
617 329, 343, 343, 368, 343, 343, 343, 343, 343, 343,
618
619 343, 343, 343, 343, 343, 354, 354, 368, 354, 354,
620 354, 354, 354, 354, 354, 354, 354, 354, 354, 358,
621 358, 368, 358, 358, 358, 358, 358, 358, 358, 358,
622 358, 358, 358, 51, 368, 368, 368, 368, 368, 368,
623 368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
624 368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
625 368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
626 368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
627 368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
628 368, 368, 368, 368
629
630 } ;
631
632static yyconst short int yy_chk[1395] =
633 { 0,
634 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
635 1, 1, 1, 1, 1, 1, 1, 1, 1, 5,
636 6, 5, 6, 13, 14, 421, 15, 1, 15, 42,
637 42, 13, 14, 42, 59, 59, 76, 1, 419, 16,
638 15, 16, 49, 49, 7, 8, 7, 8, 9, 10,
639 9, 10, 225, 16, 225, 76, 49, 1, 1, 1,
640 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
641 2, 2, 2, 2, 2, 2, 2, 2, 2, 7,
642 8, 35, 71, 9, 10, 77, 71, 2, 242, 36,
643 35, 37, 38, 50, 50, 242, 43, 2, 36, 43,
644
645 37, 38, 418, 87, 77, 43, 87, 50, 115, 43,
646 91, 78, 115, 91, 72, 79, 35, 2, 2, 2,
647 3, 3, 45, 3, 36, 45, 37, 38, 44, 44,
648 78, 45, 44, 80, 79, 45, 100, 100, 44, 111,
649 111, 3, 44, 3, 417, 3, 3, 3, 112, 112,
650 3, 43, 80, 43, 72, 72, 415, 122, 72, 72,
651 3, 122, 3, 72, 3, 3, 3, 72, 129, 3,
652 4, 4, 129, 4, 134, 147, 147, 45, 134, 45,
653 160, 155, 160, 414, 44, 155, 44, 160, 46, 46,
654 165, 4, 46, 4, 167, 4, 4, 4, 46, 388,
655
656 4, 388, 46, 61, 61, 61, 81, 116, 81, 165,
657 4, 168, 4, 167, 4, 4, 4, 170, 61, 4,
658 11, 11, 159, 396, 159, 81, 11, 159, 81, 166,
659 168, 11, 11, 11, 207, 207, 170, 61, 11, 11,
660 11, 11, 11, 11, 46, 362, 46, 123, 116, 166,
661 169, 116, 116, 60, 60, 60, 116, 11, 11, 11,
662 11, 11, 11, 12, 12, 144, 144, 144, 60, 12,
663 169, 60, 208, 208, 12, 12, 12, 60, 357, 171,
664 144, 12, 12, 12, 12, 12, 12, 60, 123, 356,
665 60, 123, 123, 179, 179, 179, 123, 60, 171, 144,
666
667 12, 12, 12, 12, 12, 12, 17, 17, 17, 17,
668 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
669 17, 17, 17, 17, 17, 47, 175, 190, 47, 175,
670 190, 47, 47, 355, 47, 180, 180, 180, 47, 348,
671 48, 48, 221, 17, 48, 156, 221, 48, 48, 346,
672 48, 157, 218, 218, 48, 194, 194, 194, 195, 195,
673 195, 222, 345, 17, 17, 17, 18, 18, 18, 18,
674 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
675 18, 18, 18, 18, 18, 156, 156, 344, 342, 156,
676 156, 157, 157, 228, 156, 157, 157, 228, 156, 240,
677
678 157, 253, 222, 18, 157, 222, 222, 223, 233, 224,
679 222, 224, 233, 229, 224, 236, 341, 340, 240, 236,
680 230, 253, 331, 18, 18, 18, 19, 19, 19, 19,
681 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
682 19, 19, 19, 19, 19, 239, 239, 330, 223, 251,
683 328, 223, 223, 252, 229, 254, 223, 229, 229, 255,
684 239, 230, 229, 19, 230, 230, 246, 327, 251, 230,
685 326, 402, 252, 402, 254, 260, 260, 260, 255, 239,
686 261, 261, 261, 19, 19, 19, 20, 20, 20, 20,
687 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
688
689 20, 20, 20, 20, 20, 256, 246, 257, 265, 265,
690 265, 287, 288, 246, 266, 266, 266, 289, 290, 291,
691 292, 311, 313, 20, 256, 324, 257, 294, 294, 294,
692 287, 288, 296, 296, 296, 323, 289, 290, 291, 292,
693 311, 313, 314, 20, 20, 20, 88, 315, 316, 317,
694 317, 317, 332, 334, 88, 88, 88, 335, 336, 349,
695 350, 314, 337, 337, 337, 351, 315, 316, 353, 353,
696 353, 332, 334, 359, 322, 360, 335, 336, 349, 350,
697 88, 88, 363, 364, 351, 88, 365, 321, 320, 319,
698 88, 310, 359, 88, 360, 88, 309, 88, 88, 92,
699
700 307, 363, 364, 306, 305, 365, 304, 92, 92, 92,
701 303, 302, 301, 300, 299, 298, 286, 285, 284, 283,
702 282, 281, 280, 279, 278, 277, 276, 275, 274, 271,
703 268, 250, 249, 92, 92, 248, 247, 245, 92, 244,
704 243, 241, 237, 92, 213, 211, 92, 210, 92, 204,
705 92, 92, 148, 148, 148, 193, 178, 172, 163, 148,
706 148, 148, 148, 148, 148, 162, 161, 158, 139, 136,
707 133, 125, 118, 106, 94, 82, 74, 69, 148, 148,
708 148, 148, 148, 148, 369, 369, 369, 369, 369, 369,
709 369, 369, 369, 369, 369, 369, 369, 369, 370, 370,
710
711 370, 370, 370, 370, 370, 370, 370, 370, 370, 370,
712 370, 370, 371, 371, 371, 371, 371, 371, 371, 371,
713 371, 371, 371, 371, 371, 371, 372, 372, 372, 372,
714 372, 372, 372, 372, 372, 372, 372, 372, 372, 372,
715 373, 373, 373, 373, 373, 373, 373, 373, 373, 373,
716 373, 373, 373, 373, 374, 374, 374, 374, 374, 374,
717 374, 374, 374, 374, 374, 374, 374, 374, 375, 375,
718 375, 375, 375, 375, 375, 375, 375, 375, 375, 375,
719 375, 375, 376, 376, 376, 376, 376, 376, 376, 376,
720 376, 376, 376, 376, 376, 376, 377, 377, 377, 377,
721
722 377, 377, 377, 377, 377, 377, 377, 377, 377, 377,
723 378, 378, 378, 378, 378, 378, 378, 378, 378, 378,
724 378, 378, 378, 378, 379, 379, 379, 379, 379, 379,
725 379, 379, 379, 379, 379, 379, 379, 379, 380, 380,
726 380, 380, 380, 380, 380, 380, 380, 380, 380, 380,
727 380, 380, 381, 381, 381, 381, 381, 381, 381, 381,
728 381, 381, 381, 381, 381, 381, 382, 382, 382, 382,
729 382, 382, 382, 382, 382, 382, 382, 382, 382, 382,
730 383, 383, 383, 383, 383, 383, 383, 383, 383, 383,
731 383, 383, 383, 383, 384, 384, 384, 384, 384, 384,
732
733 384, 384, 384, 384, 384, 384, 384, 384, 385, 385,
734 385, 385, 385, 385, 385, 385, 385, 385, 385, 385,
735 385, 385, 386, 386, 386, 386, 386, 386, 386, 386,
736 386, 386, 386, 386, 386, 386, 387, 387, 387, 387,
737 387, 387, 387, 387, 387, 387, 387, 387, 387, 387,
738 389, 389, 67, 389, 389, 389, 389, 389, 389, 389,
739 389, 389, 389, 389, 390, 65, 64, 63, 390, 390,
740 390, 390, 390, 390, 390, 390, 390, 390, 391, 391,
741 57, 391, 391, 391, 391, 391, 391, 391, 391, 391,
742 391, 391, 392, 392, 55, 53, 392, 392, 392, 392,
743
744 392, 392, 392, 392, 51, 392, 393, 393, 393, 393,
745 393, 393, 393, 393, 393, 393, 393, 393, 393, 393,
746 394, 394, 41, 40, 394, 394, 394, 394, 394, 394,
747 394, 394, 39, 394, 395, 395, 395, 395, 395, 395,
748 395, 395, 395, 395, 395, 395, 395, 395, 397, 397,
749 34, 397, 397, 397, 397, 33, 397, 397, 397, 397,
750 397, 397, 398, 398, 0, 398, 398, 398, 398, 398,
751 398, 398, 398, 398, 398, 398, 399, 399, 0, 399,
752 399, 399, 399, 399, 399, 399, 0, 399, 399, 399,
753 400, 400, 0, 400, 400, 400, 400, 400, 400, 400,
754
755 0, 400, 400, 400, 401, 0, 0, 0, 401, 0,
756 401, 403, 403, 0, 403, 403, 403, 403, 403, 403,
757 403, 403, 403, 403, 403, 404, 404, 0, 404, 404,
758 404, 404, 404, 0, 404, 404, 404, 0, 404, 405,
759 405, 405, 405, 405, 405, 405, 405, 405, 405, 405,
760 405, 405, 405, 406, 406, 0, 406, 406, 406, 406,
761 406, 406, 406, 406, 406, 406, 406, 407, 407, 0,
762 407, 0, 407, 407, 407, 0, 407, 407, 407, 407,
763 408, 408, 0, 408, 408, 408, 408, 408, 408, 408,
764 408, 408, 408, 408, 409, 409, 0, 409, 0, 409,
765
766 409, 409, 0, 409, 409, 409, 409, 410, 410, 0,
767 410, 410, 410, 410, 410, 410, 410, 410, 410, 410,
768 410, 411, 411, 0, 411, 0, 0, 0, 411, 0,
769 411, 411, 411, 411, 411, 412, 412, 0, 412, 412,
770 412, 412, 412, 412, 412, 412, 412, 412, 412, 413,
771 413, 0, 413, 413, 413, 413, 413, 413, 413, 413,
772 413, 413, 413, 416, 416, 0, 416, 416, 416, 416,
773 416, 0, 416, 416, 416, 0, 416, 420, 420, 0,
774 420, 420, 420, 420, 420, 420, 420, 420, 420, 420,
775 420, 422, 422, 0, 422, 422, 422, 422, 422, 422,
776
777 422, 422, 422, 422, 422, 423, 423, 0, 423, 423,
778 423, 423, 423, 423, 423, 423, 423, 423, 423, 424,
779 424, 0, 424, 424, 424, 424, 424, 424, 424, 424,
780 424, 424, 424, 368, 368, 368, 368, 368, 368, 368,
781 368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
782 368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
783 368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
784 368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
785 368, 368, 368, 368, 368, 368, 368, 368, 368, 368,
786 368, 368, 368, 368
787
788 } ;
789
790static yy_state_type yy_last_accepting_state;
791static char *yy_last_accepting_cpos;
792
793/* The intent behind this definition is that it'll catch
794 * any uses of REJECT which flex missed.
795 */
796#define REJECT reject_used_but_not_detected
797#define yymore() yymore_used_but_not_detected
798#define YY_MORE_ADJ 0
799char *yytext;
800#line 1 "parser.l"
801#define INITIAL 0
802/* -*-C-*-
803 *
804 * Copyright 1994 Martin von Loewis
805 * Copyright 1998 Bertho A. Stultiens (BS)
806 *
807 * 20-Jun-1998 BS - Changed the filename conversion. Filenames are
808 * case-sensitive inder *nix, but not under dos.
809 * default behaviour is to convert to lower case.
810 * - All backslashes are converted to forward and
811 * both single and double slash is recognized as
812 * MS/Borland does.
813 * - Fixed a bug in 'yywf' case that prevented
814 * double quoted names to be scanned propperly.
815 *
816 * 19-May-1998 BS - Started to build a preprocessor.
817 * - Changed keyword processing completely to
818 * table-lookups.
819 *
820 * 20-Apr-1998 BS - Added ';' comment stripping
821 *
822 * 17-Apr-1998 BS - Made the win32 keywords optional when compiling in
823 * 16bit mode
824 *
825 * 15-Apr-1998 BS - Changed string handling to include escapes
826 * - Added unicode string handling (no codepage
827 * translation though).
828 * - 'Borrowed' the main idea of string scanning from
829 * the flex manual pages.
830 * - Added conditional handling of scanning depending
831 * on the state of the parser. This was mainly required
832 * to distinguish a file to load or raw data that
833 * follows. MS's definition of filenames is rather
834 * complex... It can be unquoted or double quoted. If
835 * double quoted, then the '\\' char is not automatically
836 * escaped according to Borland's rc compiler, but it
837 * accepts both "\\path\\file.rc" and "\path\file.rc".
838 * This makes life very hard! I go for the escaped
839 * version, as this seems to be the documented way...
840 * - Single quoted strings are now parsed and converted
841 * here.
842 * - Added comment stripping. The implementation is
843 * 'borrowed' from the flex manpages.
844 * - Rebuild string processing so that it may contain
845 * escaped '\0'.
846 */
847/* Exclusive rules when looking for a filename */
848#define yywf 1
849
850#define yywf_s 2
851
852/* Exclusive string handling */
853#define yystr 3
854
855/* Exclusive unicode string handling */
856#define yylstr 4
857
858/* Exclusive rcdata single quoted data handling */
859#define yyrcd 5
860
861/* Exclusive comment eating... */
862#define comment 6
863
864/* Preprocessor exclusives */
865#define pp_incl 7
866
867#define pp_def 8
868
869#define pp_undef 9
870
871#define pp_if 10
872
873#define pp_ifdef 11
874
875#define pp_ifndef 12
876
877#define pp_elif 13
878
879#define pp_else 14
880
881#define pp_endif 15
882
883#define pp_error 16
884
885/* Set when accumulating #define's expansion text */
886#define pp_def_s 17
887
888/* Set when processing function type defines */
889#define pp_ignore 18
890
891/* Set when need to strip to eol */
892#define pp_ignore_eol 19
893
894/* Set when handling a false #if case */
895#define pp_false 20
896
897/* Set when stripping c-junk */
898#define pp_stripe 21
899
900#define pp_strips 22
901
902#define pp_stripp 23
903
904#define pp_stripp_final 24
905
906/*%option stack*/
907#define YY_NEVER_INTERACTIVE 1
908/*%option noyywrap */
909/* Some shortcut definitions */
910#line 91 "parser.l"
911
912#if !defined(YY_FLEX_MAJOR_VERSION) || (1000 * YY_FLEX_MAJOR_VERSION + YY_FLEX_MINOR_VERSION < 2005)
913#error Must use flex version 2.5.1 or higher (yy_scan_* routines are required).
914#endif
915
916/*#define LEX_DEBUG*/
917
918#include "config.h"
919
920#include <stdio.h>
921#include <stdlib.h>
922#include <string.h>
923#include <ctype.h>
924
925#include "wrc.h"
926#include "utils.h"
927#include "preproc.h"
928#include "parser.h"
929#include "newstruc.h"
930
931#include "y.tab.h"
932
933#define YY_USE_PROTOS
934#define YY_NO_UNPUT
935
936/* Always update the current character position within a line */
937#define YY_USER_ACTION char_number+=yyleng;
938
939raw_data_t *new_raw_data(void);
940
941void addcchar(char c);
942void addwchar(short s);
943string_t *get_buffered_cstring(void);
944string_t *get_buffered_wstring(void);
945string_t *make_string(char *s);
946string_t *make_filename(char *s, int len);
947
948int line_number = 1; /* The current line */
949int char_number = 1; /* The current char pos within the line */
950static char *cbuffer; /* Buffers for string collection */
951static int cbufidx;
952static int cbufalloc = 0;
953static short *wbuffer;
954static int wbufidx;
955static int wbufalloc = 0;
956static int want_nl = 0; /* Set when newline needs to go to parser */
957static int want_ident = 0; /* Set is #ifdef, #ifndef or defined is seen */
958static int stripslevel = 0; /* Count {} during pp_strips/pp_stripe mode */
959static int stripplevel = 0; /* Count () during pp_strips mode */
960static char *substtext = NULL; /* Holds the substition text while getting a define */
961static int cjunk_tagline; /* Where did we start stripping (helps error tracking) */
962
963#ifdef YY_USE_STACK
964void push_to(int start) { yy_push_state(start); }
965void pop_start(void) { yy_pop_state(start); }
966#else
967#define MAXSTARTSTACK 32
968static int startstack[MAXSTARTSTACK];
969static int startstackidx = 0;
970
971void push_to(int start)
972{
973 if(yydebug)
974 printf("push_to(%d): %d -> %d\n", line_number, YY_START, start);
975 if(startstackidx >= MAXSTARTSTACK-1)
976 internal_error(__FILE__, __LINE__, "Start condition stack overflow");
977 startstack[startstackidx++] = YY_START;
978 BEGIN(start);
979}
980
981void pop_start(void)
982{
983 if(yydebug)
984 printf("pop_start(%d): %d <- %d\n", line_number, startstack[startstackidx-1], YY_START);
985 if(startstackidx <= 0)
986 internal_error(__FILE__, __LINE__, "Start condition stack underflow");
987 --startstackidx;
988 BEGIN(startstack[startstackidx]);
989}
990#endif
991
992
993struct bufferstackentry {
994 YY_BUFFER_STATE bufferstate; /* Buffer to switch back to */
995 struct pp_entry *define; /* Points to expanding define
996 or NULL if handling includes
997 */
998 int line_number; /* Line that we were handling */
999 int char_number; /* The current position */
1000 char *filename; /* Filename that we were handling */
1001};
1002
1003#define MAXBUFFERSTACK 128
1004static struct bufferstackentry bufferstack[MAXBUFFERSTACK];
1005static int bufferstackidx = 0;
1006
1007void push_buffer(YY_BUFFER_STATE buf, struct pp_entry *ppp, char *filename)
1008{
1009 if(yydebug)
1010 printf("push_buffer: %p %p %p\n", buf, ppp, filename);
1011 if(bufferstackidx >= MAXBUFFERSTACK-1)
1012 internal_error(__FILE__, __LINE__, "Buffer stack overflow");
1013 memset(&bufferstack[bufferstackidx], 0, sizeof(bufferstack[0]));
1014 bufferstack[bufferstackidx].bufferstate = buf;
1015 bufferstack[bufferstackidx].define = ppp;
1016 if(ppp)
1017 ppp->expanding = 1;
1018 else if(filename)
1019 {
1020 /* These will track the yyerror to the correct file and line */
1021 bufferstack[bufferstackidx].line_number = line_number;
1022 bufferstack[bufferstackidx].char_number = char_number;
1023 line_number = 1;
1024 char_number = 1;
1025 bufferstack[bufferstackidx].filename = input_name;
1026 input_name = filename;
1027 }
1028 else
1029 internal_error(__FILE__, __LINE__, "Pushing buffer without knowing where to go to");
1030 bufferstackidx++;
1031}
1032
1033YY_BUFFER_STATE pop_buffer(void)
1034{
1035 if(bufferstackidx <= 0)
1036 return (YY_BUFFER_STATE)0;
1037 bufferstackidx--;
1038 if(bufferstack[bufferstackidx].define)
1039 bufferstack[bufferstackidx].define->expanding = 0;
1040 else
1041 {
1042 line_number = bufferstack[bufferstackidx].line_number;
1043 char_number = bufferstack[bufferstackidx].char_number;
1044 input_name = bufferstack[bufferstackidx].filename;
1045 fclose(yyin);
1046 }
1047 if(yydebug)
1048 printf("pop_buffer: %p %p (%d, %d) %p\n",
1049 bufferstack[bufferstackidx].bufferstate,
1050 bufferstack[bufferstackidx].define,
1051 bufferstack[bufferstackidx].line_number,
1052 bufferstack[bufferstackidx].char_number,
1053 bufferstack[bufferstackidx].filename);
1054 yy_switch_to_buffer(bufferstack[bufferstackidx].bufferstate);
1055 return bufferstack[bufferstackidx].bufferstate;
1056}
1057
1058void do_include(char *name, int namelen)
1059{
1060 char *cpy = (char *)xmalloc(namelen);
1061 strcpy(cpy, name+1); /* strip leading " or < */
1062 cpy[namelen-2] = '\0'; /* strip trailing " or > */
1063 if((yyin = open_include(cpy, name[0] == '"')) == NULL)
1064 yyerror("Unable to open include file %s", cpy);
1065 push_buffer(YY_CURRENT_BUFFER, NULL, cpy);
1066 yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE));
1067}
1068
1069
1070struct keyword {
1071 char *keyword;
1072 int token;
1073 int isextension;
1074 int needcase;
1075 int alwayskeyword;
1076};
1077
1078static struct keyword keywords[] = {
1079 { "ACCELERATORS", ACCELERATORS, 0, 0, 0},
1080 { "ALT", ALT, 0, 0, 0},
1081 { "ASCII", ASCII, 0, 0, 0},
1082 { "AUTO3STATE", AUTO3STATE, 1, 0, 0},
1083 { "AUTOCHECKBOX", AUTOCHECKBOX, 1, 0, 0},
1084 { "AUTORADIOBUTTON", AUTORADIOBUTTON, 1, 0, 0},
1085 { "BEGIN", tBEGIN, 0, 0, 1},
1086 { "BITMAP", tBITMAP, 0, 0, 0},
1087 { "BLOCK", BLOCK, 0, 0, 1},
1088 { "BUTTON", BUTTON, 1, 0, 0},
1089 { "CAPTION", CAPTION, 0, 0, 0},
1090 { "CHARACTERISTICS", CHARACTERISTICS, 1, 0, 0},
1091 { "CHECKBOX", CHECKBOX, 0, 0, 0},
1092 { "CHECKED", CHECKED, 0, 0, 0},
1093 { "CLASS", CLASS, 0, 0, 0},
1094 { "COMBOBOX", COMBOBOX, 0, 0, 0},
1095 { "CONTROL", CONTROL, 0, 0, 0},
1096 { "CTEXT", CTEXT, 0, 0, 0},
1097 { "CURSOR", CURSOR, 0, 0, 0},
1098 { "defined", tDEFINED, 0, 1, 1},
1099 { "DEFPUSHBUTTON", DEFPUSHBUTTON, 0, 0, 1},
1100 { "DIALOG", DIALOG, 0, 0, 0},
1101 { "DIALOGEX", DIALOGEX, 1, 0, 0},
1102 { "DISCARDABLE", DISCARDABLE, 0, 0, 0},
1103 { "DLGINIT", DLGINIT, 0, 0, 0},
1104 { "EDITTEXT", EDITTEXT, 0, 0, 0},
1105 { "END", tEND, 0, 0, 1},
1106 { "EXSTYLE", EXSTYLE, 0, 0, 0},
1107 { "extern", tEXTERN, 0, 1, 1},
1108 { "FILEFLAGS", FILEFLAGS, 0, 0, 0},
1109 { "FILEFLAGSMASK", FILEFLAGSMASK, 0, 0, 0},
1110 { "FILEOS", FILEOS, 0, 0, 0},
1111 { "FILESUBTYPE", FILESUBTYPE, 0, 0, 0},
1112 { "FILETYPE", FILETYPE, 0, 0, 0},
1113 { "FILEVERSION", FILEVERSION, 0, 0, 0},
1114 { "FIXED", tFIXED, 0, 0, 0},
1115 { "FONT", FONT, 0, 0, 0},
1116 { "GRAYED", GRAYED, 0, 0, 0},
1117 { "GROUPBOX", GROUPBOX, 0, 0, 0},
1118 { "HELP", HELP, 0, 0, 0},
1119 { "ICON", ICON, 0, 0, 0},
1120 { "IMPURE", IMPURE, 0, 0, 0},
1121 { "INACTIVE", INACTIVE, 0, 0, 0},
1122 { "LANGUAGE", LANGUAGE, 1, 0, 1},
1123 { "LISTBOX", LISTBOX, 0, 0, 0},
1124 { "LOADONCALL", LOADONCALL, 0, 0, 0},
1125 { "LTEXT", LTEXT, 0, 0, 0},
1126 { "MENU", MENU, 0, 0, 0},
1127 { "MENUBARBREAK", MENUBARBREAK, 0, 0, 0},
1128 { "MENUBREAK", MENUBREAK, 0, 0, 0},
1129 { "MENUEX", MENUEX, 1, 0, 0},
1130 { "MENUITEM", MENUITEM, 0, 0, 0},
1131 { "MESSAGETABLE", MESSAGETABLE, 1, 0, 0},
1132 { "MOVEABLE", MOVEABLE, 0, 0, 0},
1133 { "NOINVERT", NOINVERT, 0, 0, 0},
1134 { "NOT", NOT, 0, 0, 0},
1135 { "POPUP", POPUP, 0, 0, 0},
1136 { "PRELOAD", PRELOAD, 0, 0, 0},
1137 { "PRODUCTVERSION", PRODUCTVERSION, 0, 0, 0},
1138 { "PURE", tPURE, 0, 0, 0},
1139 { "PUSHBUTTON", PUSHBUTTON, 0, 0, 0},
1140 { "RADIOBUTTON", RADIOBUTTON, 0, 0, 0},
1141 { "RCDATA", RCDATA, 0, 0, 0},
1142 { "RTEXT", RTEXT, 0, 0, 0},
1143 { "SCROLLBAR", SCROLLBAR, 0, 0, 0},
1144 { "SEPARATOR", SEPARATOR, 0, 0, 0},
1145 { "SHIFT", SHIFT, 0, 0, 0},
1146 { "STATE3", STATE3, 1, 0, 0},
1147 { "STRING", tSTRING, 0, 0, 0},
1148 { "STRINGTABLE", STRINGTABLE, 0, 0, 1},
1149 { "STYLE", STYLE, 0, 0, 0},
1150 { "TOOLBAR", TOOLBAR, 1, 0, 0},
1151 { "typedef", tTYPEDEF, 0, 1, 1},
1152 { "VALUE", VALUE, 0, 0, 0},
1153 { "VERSION", VERSION, 1, 0, 0},
1154 { "VERSIONINFO", VERSIONINFO, 0, 0, 0},
1155 { "VIRTKEY", VIRTKEY, 0, 0, 0}
1156};
1157
1158#define NKEYWORDS (sizeof(keywords)/sizeof(keywords[0]))
1159#define KWP(p) ((struct keyword *)(p))
1160int kw_cmp_func(const void *s1, const void *s2)
1161{
1162 int ret;
1163 ret = strcasecmp(KWP(s1)->keyword, KWP(s2)->keyword);
1164 if(!ret && (KWP(s1)->needcase || KWP(s2)->needcase))
1165 return strcmp(KWP(s1)->keyword, KWP(s2)->keyword);
1166 else
1167 return ret;
1168}
1169
1170#define KW_BSEARCH
1171#define DO_SORT
1172struct keyword *iskeyword(char *kw)
1173{
1174 struct keyword *kwp;
1175 struct keyword key;
1176 key.keyword = kw;
1177 key.needcase = 0;
1178#ifdef DO_SORT
1179 {
1180 /* Make sure that it is sorted for bsearsh */
1181 static int sorted = 0;
1182 if(!sorted)
1183 {
1184 qsort(keywords, NKEYWORDS, sizeof(keywords[0]), kw_cmp_func);
1185 sorted = 1;
1186 }
1187 }
1188#endif
1189#ifdef KW_BSEARCH
1190 kwp = bsearch(&key, keywords, NKEYWORDS, sizeof(keywords[0]), kw_cmp_func);
1191#else
1192 {
1193 int i;
1194 for(i = 0; i < NKEYWORDS; i++)
1195 {
1196 if(!kw_cmp_func(&key, &keywords[i]))
1197 break;
1198 }
1199 if(i < NKEYWORDS)
1200 kwp = &keywords[i];
1201 else
1202 kwp = NULL;
1203 }
1204#endif
1205
1206#ifdef LEX_DEBUG
1207 if(kwp && !strcmp(kwp->keyword, "LANGUAGE"))
1208 printf("Got Language\n");
1209#endif
1210 if(kwp == NULL || (kwp->isextension && !extensions))
1211 return NULL;
1212 else
1213 return kwp;
1214}
1215
1216void add_to_substtext(char *text, int len)
1217{
1218 if(!substtext)
1219 {
1220 substtext = xstrdup(text);
1221 }
1222 else
1223 {
1224 substtext = (char *)xrealloc(substtext, strlen(substtext)+len+1);
1225 strcat(substtext, text);
1226 }
1227}
1228
1229#line 1230 "lexyy.c"
1230
1231/* Macros after this point can all be overridden by user definitions in
1232 * section 1.
1233 */
1234
1235#ifndef YY_SKIP_YYWRAP
1236#ifdef __cplusplus
1237extern "C" int yywrap YY_PROTO(( void ));
1238#else
1239extern int yywrap YY_PROTO(( void ));
1240#endif
1241#endif
1242
1243#ifndef YY_NO_UNPUT
1244static void yyunput YY_PROTO(( int c, char *buf_ptr ));
1245#endif
1246
1247#ifndef yytext_ptr
1248static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
1249#endif
1250
1251#ifndef YY_NO_INPUT
1252#ifdef __cplusplus
1253static int yyinput YY_PROTO(( void ));
1254#else
1255static int input YY_PROTO(( void ));
1256#endif
1257#endif
1258
1259#if YY_STACK_USED
1260static int yy_start_stack_ptr = 0;
1261static int yy_start_stack_depth = 0;
1262static int *yy_start_stack = 0;
1263#ifndef YY_NO_PUSH_STATE
1264static void yy_push_state YY_PROTO(( int new_state ));
1265#endif
1266#ifndef YY_NO_POP_STATE
1267static void yy_pop_state YY_PROTO(( void ));
1268#endif
1269#ifndef YY_NO_TOP_STATE
1270static int yy_top_state YY_PROTO(( void ));
1271#endif
1272
1273#else
1274#define YY_NO_PUSH_STATE 1
1275#define YY_NO_POP_STATE 1
1276#define YY_NO_TOP_STATE 1
1277#endif
1278
1279#ifdef YY_MALLOC_DECL
1280YY_MALLOC_DECL
1281#else
1282#if __STDC__
1283#ifndef __cplusplus
1284#include <stdlib.h>
1285#endif
1286#else
1287/* Just try to get by without declaring the routines. This will fail
1288 * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
1289 * or sizeof(void*) != sizeof(int).
1290 */
1291#endif
1292#endif
1293
1294/* Amount of stuff to slurp up with each read. */
1295#ifndef YY_READ_BUF_SIZE
1296#define YY_READ_BUF_SIZE 8192
1297#endif
1298
1299/* Copy whatever the last rule matched to the standard output. */
1300
1301#ifndef ECHO
1302/* This used to be an fputs(), but since the string might contain NUL's,
1303 * we now use fwrite().
1304 */
1305#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
1306#endif
1307
1308/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
1309 * is returned in "result".
1310 */
1311#ifndef YY_INPUT
1312#define YY_INPUT(buf,result,max_size) \
1313 if ( yy_current_buffer->yy_is_interactive ) \
1314 { \
1315 int c = '*', n; \
1316 for ( n = 0; n < max_size && \
1317 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
1318 buf[n] = (char) c; \
1319 if ( c == '\n' ) \
1320 buf[n++] = (char) c; \
1321 if ( c == EOF && ferror( yyin ) ) \
1322 YY_FATAL_ERROR( "input in flex scanner failed" ); \
1323 result = n; \
1324 } \
1325 else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
1326 && ferror( yyin ) ) \
1327 YY_FATAL_ERROR( "input in flex scanner failed" );
1328#endif
1329
1330/* No semi-colon after return; correct usage is to write "yyterminate();" -
1331 * we don't want an extra ';' after the "return" because that will cause
1332 * some compilers to complain about unreachable statements.
1333 */
1334#ifndef yyterminate
1335#define yyterminate() return YY_NULL
1336#endif
1337
1338/* Number of entries by which start-condition stack grows. */
1339#ifndef YY_START_STACK_INCR
1340#define YY_START_STACK_INCR 25
1341#endif
1342
1343/* Report a fatal error. */
1344#ifndef YY_FATAL_ERROR
1345#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
1346#endif
1347
1348/* Default declaration of generated scanner - a define so the user can
1349 * easily add parameters.
1350 */
1351#ifndef YY_DECL
1352#define YY_DECL int yylex YY_PROTO(( void ))
1353#endif
1354
1355/* Code executed at the beginning of each rule, after yytext and yyleng
1356 * have been set up.
1357 */
1358#ifndef YY_USER_ACTION
1359#define YY_USER_ACTION
1360#endif
1361
1362/* Code executed at the end of each rule. */
1363#ifndef YY_BREAK
1364#define YY_BREAK break;
1365#endif
1366
1367#define YY_RULE_SETUP \
1368 if ( yyleng > 0 ) \
1369 yy_current_buffer->yy_at_bol = \
1370 (yytext[yyleng - 1] == '\n'); \
1371 YY_USER_ACTION
1372
1373YY_DECL
1374 {
1375 register yy_state_type yy_current_state;
1376 register char *yy_cp, *yy_bp;
1377 register int yy_act;
1378
1379#line 411 "parser.l"
1380
1381 /* #include handling */
1382#line 1383 "lexyy.c"
1383
1384 if ( yy_init )
1385 {
1386 yy_init = 0;
1387
1388#ifdef YY_USER_INIT
1389 YY_USER_INIT;
1390#endif
1391
1392 if ( ! yy_start )
1393 yy_start = 1; /* first start state */
1394
1395 if ( ! yyin )
1396 yyin = stdin;
1397
1398 if ( ! yyout )
1399 yyout = stdout;
1400
1401 if ( ! yy_current_buffer )
1402 yy_current_buffer =
1403 yy_create_buffer( yyin, YY_BUF_SIZE );
1404
1405 yy_load_buffer_state();
1406 }
1407
1408 while ( 1 ) /* loops until end-of-file is reached */
1409 {
1410 yy_cp = yy_c_buf_p;
1411
1412 /* Support of yytext. */
1413 *yy_cp = yy_hold_char;
1414
1415 /* yy_bp points to the position in yy_ch_buf of the start of
1416 * the current run.
1417 */
1418 yy_bp = yy_cp;
1419
1420 yy_current_state = yy_start;
1421 yy_current_state += YY_AT_BOL();
1422yy_match:
1423 do
1424 {
1425 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
1426 if ( yy_accept[yy_current_state] )
1427 {
1428 yy_last_accepting_state = yy_current_state;
1429 yy_last_accepting_cpos = yy_cp;
1430 }
1431 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1432 {
1433 yy_current_state = (int) yy_def[yy_current_state];
1434 if ( yy_current_state >= 369 )
1435 yy_c = yy_meta[(unsigned int) yy_c];
1436 }
1437 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1438 ++yy_cp;
1439 }
1440 while ( yy_base[yy_current_state] != 1334 );
1441
1442yy_find_action:
1443 yy_act = yy_accept[yy_current_state];
1444 if ( yy_act == 0 )
1445 { /* have to back up */
1446 yy_cp = yy_last_accepting_cpos;
1447 yy_current_state = yy_last_accepting_state;
1448 yy_act = yy_accept[yy_current_state];
1449 }
1450
1451 YY_DO_BEFORE_ACTION;
1452
1453
1454do_action: /* This label is used only to access EOF actions. */
1455
1456
1457 switch ( yy_act )
1458 { /* beginning of action switch */
1459 case 0: /* must back up */
1460 /* undo the effects of YY_DO_BEFORE_ACTION */
1461 *yy_cp = yy_hold_char;
1462 yy_cp = yy_last_accepting_cpos;
1463 yy_current_state = yy_last_accepting_state;
1464 goto yy_find_action;
1465
1466case 1:
1467YY_RULE_SETUP
1468#line 413 "parser.l"
1469push_to(pp_incl);
1470 YY_BREAK
1471case 2:
1472YY_RULE_SETUP
1473#line 414 "parser.l"
1474do_include(yytext, yyleng); pop_start();
1475 YY_BREAK
1476case 3:
1477YY_RULE_SETUP
1478#line 415 "parser.l"
1479do_include(yytext, yyleng); pop_start();
1480 YY_BREAK
1481case 4:
1482YY_RULE_SETUP
1483#line 416 "parser.l"
1484yyerror("Malformed #include");
1485 YY_BREAK
1486/* #define handling */
1487case 5:
1488YY_RULE_SETUP
1489#line 419 "parser.l"
1490push_to(pp_def);
1491 YY_BREAK
1492case 6:
1493YY_RULE_SETUP
1494#line 420 "parser.l"
1495{
1496 set_define(yytext);
1497 push_to(pp_def_s);
1498 }
1499 YY_BREAK
1500case 7:
1501YY_RULE_SETUP
1502#line 424 "parser.l"
1503push_to(pp_ignore); /* Ignore function-like defines for now*/
1504 YY_BREAK
1505case 8:
1506YY_RULE_SETUP
1507#line 425 "parser.l"
1508yyerror("Malformed #define");
1509 YY_BREAK
1510case 9:
1511YY_RULE_SETUP
1512#line 427 "parser.l"
1513{
1514 if(YY_START == pp_def_s)
1515 add_to_substtext(yytext, yyleng);
1516 }
1517 YY_BREAK
1518case 10:
1519YY_RULE_SETUP
1520#line 431 "parser.l"
1521{ /* Comment is handled in normal handling */
1522 if(YY_START == pp_def_s)
1523 add_to_substtext(yytext, yyleng);
1524 }
1525 YY_BREAK
1526case 11:
1527YY_RULE_SETUP
1528#line 435 "parser.l"
1529line_number++; char_number = 1; /* Line continuation */
1530 YY_BREAK
1531case 12:
1532YY_RULE_SETUP
1533#line 436 "parser.l"
1534{
1535 if(YY_START == pp_def_s)
1536 {
1537 add_define(substtext ? substtext : "");
1538 free(substtext);
1539 substtext = NULL;
1540 }
1541 line_number++;
1542 char_number = 1;
1543 pop_start();
1544 pop_start();
1545 }
1546 YY_BREAK
1547/* #undef handling */
1548case 13:
1549YY_RULE_SETUP
1550#line 450 "parser.l"
1551push_to(pp_undef);
1552 YY_BREAK
1553case 14:
1554YY_RULE_SETUP
1555#line 451 "parser.l"
1556{
1557 del_define(yytext);
1558 pop_start();
1559 /*push_to(pp_ignore);*/
1560 }
1561 YY_BREAK
1562/* Conditional handling */
1563case 15:
1564YY_RULE_SETUP
1565#line 458 "parser.l"
1566{
1567 if(YY_START == pp_false)
1568 {
1569 if(yydebug)
1570 printf("(%d)#if ignored\n", line_number);
1571 push_if(0, 0, 1);
1572 push_to(pp_ignore_eol);
1573 }
1574 else
1575 {
1576 push_to(INITIAL);
1577 want_nl = 1;
1578 return tIF;
1579 }
1580 }
1581 YY_BREAK
1582case 16:
1583YY_RULE_SETUP
1584#line 473 "parser.l"
1585{
1586 if(YY_START == pp_false)
1587 {
1588 if(yydebug)
1589 printf("(%d)#ifdef ignored\n", line_number);
1590 push_if(0, 0, 1);
1591 push_to(pp_ignore_eol);
1592 }
1593 else
1594 {
1595 push_to(INITIAL);
1596 want_nl = 1;
1597 want_ident = 1;
1598 return tIFDEF;
1599 }
1600 }
1601 YY_BREAK
1602case 17:
1603YY_RULE_SETUP
1604#line 489 "parser.l"
1605{
1606 if(YY_START == pp_false)
1607 {
1608 if(yydebug)
1609 printf("(%d)#ifndef ignored\n", line_number);
1610 push_if(0, 0, 1);
1611 push_to(pp_ignore_eol);
1612 }
1613 else
1614 {
1615 push_to(INITIAL);
1616 want_nl = 1;
1617 want_ident = 1;
1618 return tIFNDEF;
1619 }
1620 }
1621 YY_BREAK
1622case 18:
1623YY_RULE_SETUP
1624#line 505 "parser.l"
1625{
1626 if(!isnevertrue_if())
1627 {
1628 push_to(INITIAL);
1629 want_nl = 1;
1630 return tELIF;
1631 }
1632 else if(YY_START == pp_false)
1633 push_to(pp_ignore_eol);
1634 if(yydebug)
1635 printf("(%d)#elif ignored\n", line_number);
1636 }
1637 YY_BREAK
1638case 19:
1639YY_RULE_SETUP
1640#line 517 "parser.l"
1641{
1642 if(!isnevertrue_if())
1643 {
1644 push_to(INITIAL);
1645 want_nl = 1;
1646 return tELSE;
1647 }
1648 if(yydebug)
1649 printf("(%d)#else ignored\n", line_number);
1650 }
1651 YY_BREAK
1652case 20:
1653YY_RULE_SETUP
1654#line 527 "parser.l"
1655{
1656 if(!isnevertrue_if())
1657 {
1658 want_nl = 1;
1659 return tENDIF;
1660 }
1661 else
1662 {
1663 if(yydebug)
1664 printf("(%d)#endif ignored\n", line_number);
1665 pop_if();
1666 }
1667 }
1668 YY_BREAK
1669/* The error directive */
1670case 21:
1671YY_RULE_SETUP
1672#line 542 "parser.l"
1673push_to(pp_error);
1674 YY_BREAK
1675case 22:
1676YY_RULE_SETUP
1677#line 543 "parser.l"
1678yyerror("Error directive: %s", yytext);
1679 YY_BREAK
1680case 23:
1681YY_RULE_SETUP
1682#line 544 "parser.l"
1683{
1684 if(yydebug)
1685 printf("(%d)#error ignored\n", line_number);
1686 }
1687 YY_BREAK
1688/* preprocessor junk */
1689case 24:
1690YY_RULE_SETUP
1691#line 550 "parser.l"
1692; /* Ignore #pragma */
1693 YY_BREAK
1694case 25:
1695YY_RULE_SETUP
1696#line 551 "parser.l"
1697; /* Ignore #ident */
1698 YY_BREAK
1699case 26:
1700YY_RULE_SETUP
1701#line 552 "parser.l"
1702; /* Ignore #line */
1703 YY_BREAK
1704/* We'll get an error on malformed #xxx statements
1705 * by not recognising '#' at all. This helps tracking
1706 * preprocessor errors.
1707 */
1708/*^{ws}*#{ws}* ; Ignore # */
1709case 27:
1710YY_RULE_SETUP
1711#line 559 "parser.l"
1712stripslevel++;
1713 YY_BREAK
1714case 28:
1715YY_RULE_SETUP
1716#line 560 "parser.l"
1717stripslevel--;
1718 YY_BREAK
1719case 29:
1720YY_RULE_SETUP
1721#line 561 "parser.l"
1722if(!stripslevel) pop_start();
1723 YY_BREAK
1724case 30:
1725YY_RULE_SETUP
1726#line 562 "parser.l"
1727; /* To catch comments */
1728 YY_BREAK
1729case 31:
1730YY_RULE_SETUP
1731#line 563 "parser.l"
1732; /* Ignore rest */
1733 YY_BREAK
1734case 32:
1735YY_RULE_SETUP
1736#line 565 "parser.l"
1737stripslevel++;
1738 YY_BREAK
1739case 33:
1740YY_RULE_SETUP
1741#line 566 "parser.l"
1742{
1743 stripslevel--;
1744 if(!stripslevel) pop_start();
1745 }
1746 YY_BREAK
1747case 34:
1748YY_RULE_SETUP
1749#line 570 "parser.l"
1750if(!stripslevel) pop_start();
1751 YY_BREAK
1752case 35:
1753YY_RULE_SETUP
1754#line 571 "parser.l"
1755; /* To catch comments */
1756 YY_BREAK
1757case 36:
1758YY_RULE_SETUP
1759#line 572 "parser.l"
1760; /* Ignore rest */
1761 YY_BREAK
1762case 37:
1763YY_RULE_SETUP
1764#line 574 "parser.l"
1765stripplevel++;
1766 YY_BREAK
1767case 38:
1768YY_RULE_SETUP
1769#line 575 "parser.l"
1770{
1771 stripplevel--;
1772 if(!stripplevel)
1773 {
1774 pop_start();
1775 push_to(pp_stripp_final);
1776 }
1777 }
1778 YY_BREAK
1779case 39:
1780YY_RULE_SETUP
1781#line 583 "parser.l"
1782; /* To catch comments */
1783 YY_BREAK
1784case 40:
1785YY_RULE_SETUP
1786#line 584 "parser.l"
1787; /* Ignore rest */
1788 YY_BREAK
1789case 41:
1790YY_RULE_SETUP
1791#line 586 "parser.l"
1792; /* Ignore */
1793 YY_BREAK
1794case 42:
1795YY_RULE_SETUP
1796#line 587 "parser.l"
1797pop_start(); /* Kill the semicolon */
1798 YY_BREAK
1799case 43:
1800YY_RULE_SETUP
1801#line 588 "parser.l"
1802line_number++; char_number = 1; pop_start();
1803 YY_BREAK
1804case 44:
1805YY_RULE_SETUP
1806#line 589 "parser.l"
1807yyless(0); pop_start();
1808 YY_BREAK
1809case 45:
1810YY_RULE_SETUP
1811#line 591 "parser.l"
1812; /* Ignore everything except #xxx during false #if state */
1813 YY_BREAK
1814case 46:
1815YY_RULE_SETUP
1816#line 593 "parser.l"
1817pop_start();
1818 YY_BREAK
1819/* These are special cases due to filename scanning */
1820case 47:
1821YY_RULE_SETUP
1822#line 596 "parser.l"
1823return DISCARDABLE;
1824 YY_BREAK
1825case 48:
1826YY_RULE_SETUP
1827#line 597 "parser.l"
1828return tFIXED;
1829 YY_BREAK
1830case 49:
1831YY_RULE_SETUP
1832#line 598 "parser.l"
1833return IMPURE;
1834 YY_BREAK
1835case 50:
1836YY_RULE_SETUP
1837#line 599 "parser.l"
1838return MOVEABLE;
1839 YY_BREAK
1840case 51:
1841YY_RULE_SETUP
1842#line 600 "parser.l"
1843return LOADONCALL;
1844 YY_BREAK
1845case 52:
1846YY_RULE_SETUP
1847#line 601 "parser.l"
1848return PRELOAD;
1849 YY_BREAK
1850case 53:
1851YY_RULE_SETUP
1852#line 602 "parser.l"
1853return tPURE;
1854 YY_BREAK
1855case 54:
1856YY_RULE_SETUP
1857#line 604 "parser.l"
1858return tBEGIN;
1859 YY_BREAK
1860case 55:
1861YY_RULE_SETUP
1862#line 605 "parser.l"
1863return tEND;
1864 YY_BREAK
1865case 56:
1866YY_RULE_SETUP
1867#line 607 "parser.l"
1868{ yylval.num = strtoul(yytext, 0, 10); return toupper(yytext[yyleng-1]) == 'L' ? LNUMBER : NUMBER; }
1869 YY_BREAK
1870case 57:
1871YY_RULE_SETUP
1872#line 608 "parser.l"
1873{ yylval.num = strtoul(yytext, 0, 16); return toupper(yytext[yyleng-1]) == 'L' ? LNUMBER : NUMBER; }
1874 YY_BREAK
1875case 58:
1876YY_RULE_SETUP
1877#line 609 "parser.l"
1878{ yylval.num = strtoul(yytext+2, 0, 8); return toupper(yytext[yyleng-1]) == 'L' ? LNUMBER : NUMBER; }
1879 YY_BREAK
1880case 59:
1881YY_RULE_SETUP
1882#line 610 "parser.l"
1883{
1884 struct keyword *token;
1885 struct pp_entry *ppp;
1886
1887 want_rscname = 0;
1888
1889 if(want_ident)
1890 {
1891 /* Prevent preprocessor subst */
1892 want_ident = 0;
1893 yylval.str = make_string(yytext);
1894 #ifdef LEX_DEBUG
1895 printf("want IDENT (%s, %d, %d): <%s>\n", input_name, line_number, char_number, yytext);
1896 #endif
1897 return IDENT;
1898 }
1899 else if((ppp = pp_lookup(yytext)) != NULL)
1900 {
1901 /* Do preprocessor substitution,
1902 * but expand only if macro is not
1903 * already expanding.
1904 */
1905 if(!ppp->expanding)
1906 {
1907 #ifdef LEX_DEBUG
1908 printf("expand IDENT (%s, %d, %d): <%s>\n", input_name, line_number, char_number, yytext);
1909 #endif
1910 push_buffer(YY_CURRENT_BUFFER, ppp, NULL);
1911 yy_scan_string(ppp->subst);
1912 }
1913 }
1914 else if((token = iskeyword(yytext)) != NULL
1915 && !(!token->alwayskeyword && want_rscname))
1916 {
1917 switch(token->token)
1918 {
1919 case tDEFINED:
1920 want_ident = 1;
1921 break;
1922 /*case RCDATA:*/
1923 case CURSOR:
1924 case tBITMAP:
1925 case MESSAGETABLE:
1926 case DLGINIT:
1927 push_to(yywf);
1928 break;
1929 case FONT:
1930 case ICON:
1931 if(!indialog)
1932 push_to(yywf);
1933 break;
1934 case DIALOG:
1935 case DIALOGEX:
1936 indialog = 1;
1937 break;
1938 }
1939 return token->token;
1940 }
1941 else
1942 {
1943 yylval.str = make_string(yytext);
1944 #ifdef LEX_DEBUG
1945 printf("%s IDENT (%s, %d, %d): <%s>\n",
1946 want_rscname ? "rscname" : "just",
1947 input_name,
1948 line_number,
1949 char_number,
1950 yytext);
1951 #endif
1952 return IDENT;
1953 }
1954 }
1955 YY_BREAK
1956case 60:
1957YY_RULE_SETUP
1958#line 682 "parser.l"
1959return LOGOR;
1960 YY_BREAK
1961case 61:
1962YY_RULE_SETUP
1963#line 683 "parser.l"
1964return LOGAND;
1965 YY_BREAK
1966case 62:
1967YY_RULE_SETUP
1968#line 684 "parser.l"
1969return EQ;
1970 YY_BREAK
1971case 63:
1972YY_RULE_SETUP
1973#line 685 "parser.l"
1974return NE;
1975 YY_BREAK
1976case 64:
1977YY_RULE_SETUP
1978#line 686 "parser.l"
1979return LTE;
1980 YY_BREAK
1981case 65:
1982YY_RULE_SETUP
1983#line 687 "parser.l"
1984return GTE;
1985 YY_BREAK
1986case 66:
1987YY_RULE_SETUP
1988#line 689 "parser.l"
1989{ pop_start(); yylval.str = make_filename(yytext, yyleng); return FILENAME; }
1990 YY_BREAK
1991case 67:
1992YY_RULE_SETUP
1993#line 690 "parser.l"
1994push_to(yywf_s);
1995 YY_BREAK
1996case 68:
1997YY_RULE_SETUP
1998#line 691 "parser.l"
1999{ pop_start(); pop_start(); yylval.str = make_filename(yytext, yyleng-1); return FILENAME; }
2000 YY_BREAK
2001case 69:
2002YY_RULE_SETUP
2003#line 692 "parser.l"
2004yyerror("Newline in filename");
2005 YY_BREAK
2006case 70:
2007YY_RULE_SETUP
2008#line 694 "parser.l"
2009{
2010 push_to(yylstr);
2011 wbufidx = 0;
2012 if(!win32)
2013 yywarning("16bit resource contains unicode strings\n");
2014 }
2015 YY_BREAK
2016case 71:
2017YY_RULE_SETUP
2018#line 700 "parser.l"
2019{
2020 pop_start();
2021 yylval.str = get_buffered_wstring();
2022 return tSTRING;
2023 }
2024 YY_BREAK
2025case 72:
2026YY_RULE_SETUP
2027#line 705 "parser.l"
2028yyerror("Unterminated string");
2029 YY_BREAK
2030case 73:
2031YY_RULE_SETUP
2032#line 706 "parser.l"
2033{ /* octal escape sequence */
2034 int result;
2035 result = strtol(yytext+1, 0, 8);
2036 if ( result > 0xffff )
2037 yyerror("Character constant out of range");
2038 addwchar((short)result);
2039 }
2040 YY_BREAK
2041case 74:
2042YY_RULE_SETUP
2043#line 713 "parser.l"
2044{ /* hex escape sequence */
2045 int result;
2046 result = strtol(yytext+2, 0, 16);
2047 addwchar((short)result);
2048 }
2049 YY_BREAK
2050case 75:
2051YY_RULE_SETUP
2052#line 718 "parser.l"
2053yyerror("Bad escape secuence");
2054 YY_BREAK
2055case 76:
2056YY_RULE_SETUP
2057#line 719 "parser.l"
2058addwchar('\a');
2059 YY_BREAK
2060case 77:
2061YY_RULE_SETUP
2062#line 720 "parser.l"
2063addwchar('\b');
2064 YY_BREAK
2065case 78:
2066YY_RULE_SETUP
2067#line 721 "parser.l"
2068addwchar('\f');
2069 YY_BREAK
2070case 79:
2071YY_RULE_SETUP
2072#line 722 "parser.l"
2073addwchar('\n');
2074 YY_BREAK
2075case 80:
2076YY_RULE_SETUP
2077#line 723 "parser.l"
2078addwchar('\r');
2079 YY_BREAK
2080case 81:
2081YY_RULE_SETUP
2082#line 724 "parser.l"
2083addwchar('\t');
2084 YY_BREAK
2085case 82:
2086YY_RULE_SETUP
2087#line 725 "parser.l"
2088addwchar('\v');
2089 YY_BREAK
2090case 83:
2091YY_RULE_SETUP
2092#line 726 "parser.l"
2093addwchar(yytext[1]);
2094 YY_BREAK
2095case 84:
2096YY_RULE_SETUP
2097#line 727 "parser.l"
2098addcchar('\"'); /* "bla""bla" -> "bla\"bla" */
2099 YY_BREAK
2100case 85:
2101YY_RULE_SETUP
2102#line 728 "parser.l"
2103addcchar('\"'); /* "bla\""bla" -> "bla\"bla" */
2104 YY_BREAK
2105case 86:
2106YY_RULE_SETUP
2107#line 729 "parser.l"
2108; /* "bla" "bla" -> "blabla" */
2109 YY_BREAK
2110case 87:
2111YY_RULE_SETUP
2112#line 730 "parser.l"
2113{
2114 char *yptr = yytext;
2115 while(*yptr) /* FIXME: codepage translation */
2116 addwchar(*yptr++ & 0xff);
2117 }
2118 YY_BREAK
2119case 88:
2120YY_RULE_SETUP
2121#line 736 "parser.l"
2122{
2123 push_to(yystr);
2124 cbufidx = 0;
2125 }
2126 YY_BREAK
2127case 89:
2128YY_RULE_SETUP
2129#line 740 "parser.l"
2130{
2131 pop_start();
2132 yylval.str = get_buffered_cstring();
2133 return tSTRING;
2134 }
2135 YY_BREAK
2136case 90:
2137YY_RULE_SETUP
2138#line 745 "parser.l"
2139yyerror("Unterminated string");
2140 YY_BREAK
2141case 91:
2142YY_RULE_SETUP
2143#line 746 "parser.l"
2144{ /* octal escape sequence */
2145 int result;
2146 result = strtol(yytext+1, 0, 8);
2147 if ( result > 0xff )
2148 yyerror("Character constant out of range");
2149 addcchar((char)result);
2150 }
2151 YY_BREAK
2152case 92:
2153YY_RULE_SETUP
2154#line 753 "parser.l"
2155{ /* hex escape sequence */
2156 int result;
2157 result = strtol(yytext+2, 0, 16);
2158 addcchar((char)result);
2159 }
2160 YY_BREAK
2161case 93:
2162YY_RULE_SETUP
2163#line 758 "parser.l"
2164yyerror("Bad escape secuence");
2165 YY_BREAK
2166case 94:
2167YY_RULE_SETUP
2168#line 759 "parser.l"
2169addcchar('\a');
2170 YY_BREAK
2171case 95:
2172YY_RULE_SETUP
2173#line 760 "parser.l"
2174addcchar('\b');
2175 YY_BREAK
2176case 96:
2177YY_RULE_SETUP
2178#line 761 "parser.l"
2179addcchar('\f');
2180 YY_BREAK
2181case 97:
2182YY_RULE_SETUP
2183#line 762 "parser.l"
2184addcchar('\n');
2185 YY_BREAK
2186case 98:
2187YY_RULE_SETUP
2188#line 763 "parser.l"
2189addcchar('\r');
2190 YY_BREAK
2191case 99:
2192YY_RULE_SETUP
2193#line 764 "parser.l"
2194addcchar('\t');
2195 YY_BREAK
2196case 100:
2197YY_RULE_SETUP
2198#line 765 "parser.l"
2199addcchar('\v');
2200 YY_BREAK
2201case 101:
2202YY_RULE_SETUP
2203#line 766 "parser.l"
2204addcchar(yytext[1]);
2205 YY_BREAK
2206case 102:
2207YY_RULE_SETUP
2208#line 767 "parser.l"
2209{
2210 char *yptr = yytext;
2211 while(*yptr)
2212 addcchar(*yptr++);
2213 }
2214 YY_BREAK
2215case 103:
2216YY_RULE_SETUP
2217#line 772 "parser.l"
2218addcchar('\"'); /* "bla""bla" -> "bla\"bla" */
2219 YY_BREAK
2220case 104:
2221YY_RULE_SETUP
2222#line 773 "parser.l"
2223addcchar('\"'); /* "bla\""bla" -> "bla\"bla" */
2224 YY_BREAK
2225case 105:
2226YY_RULE_SETUP
2227#line 774 "parser.l"
2228; /* "bla" "bla" -> "blabla" */
2229 YY_BREAK
2230case 106:
2231YY_RULE_SETUP
2232#line 775 "parser.l"
2233yywarning("Matched %c", *yytext);
2234 YY_BREAK
2235case 107:
2236YY_RULE_SETUP
2237#line 778 "parser.l"
2238{
2239 push_to(yyrcd);
2240 cbufidx = 0;
2241 }
2242 YY_BREAK
2243case 108:
2244YY_RULE_SETUP
2245#line 782 "parser.l"
2246{
2247 pop_start();
2248 yylval.raw = new_raw_data();
2249 yylval.raw->size = cbufidx;
2250 yylval.raw->data = xmalloc(yylval.raw->size);
2251 memcpy(yylval.raw->data, cbuffer, yylval.raw->size);
2252 return RAWDATA;
2253 }
2254 YY_BREAK
2255case 109:
2256YY_RULE_SETUP
2257#line 790 "parser.l"
2258{
2259 int result;
2260 result = strtol(yytext, 0, 16);
2261 addcchar((char)result);
2262 }
2263 YY_BREAK
2264case 110:
2265YY_RULE_SETUP
2266#line 795 "parser.l"
2267; /* Ignore space */
2268 YY_BREAK
2269case 111:
2270YY_RULE_SETUP
2271#line 796 "parser.l"
2272line_number++; char_number = 1;
2273 YY_BREAK
2274case 112:
2275YY_RULE_SETUP
2276#line 797 "parser.l"
2277yyerror("Malformed data-line");
2278 YY_BREAK
2279case 113:
2280YY_RULE_SETUP
2281#line 799 "parser.l"
2282push_to(comment); /* Eat comment */
2283 YY_BREAK
2284case 114:
2285YY_RULE_SETUP
2286#line 800 "parser.l"
2287;
2288 YY_BREAK
2289case 115:
2290YY_RULE_SETUP
2291#line 801 "parser.l"
2292;
2293 YY_BREAK
2294case 116:
2295YY_RULE_SETUP
2296#line 802 "parser.l"
2297line_number++; char_number = 1;
2298 YY_BREAK
2299case 117:
2300YY_RULE_SETUP
2301#line 803 "parser.l"
2302pop_start();
2303 YY_BREAK
2304case 118:
2305YY_RULE_SETUP
2306#line 805 "parser.l"
2307; /* Eat comment */
2308 YY_BREAK
2309case 119:
2310YY_RULE_SETUP
2311#line 806 "parser.l"
2312; /* Eat comment */
2313 YY_BREAK
2314case 120:
2315YY_RULE_SETUP
2316#line 808 "parser.l"
2317{
2318 if(YY_START == yywf)
2319 pop_start();
2320 line_number++;
2321 char_number = 1;
2322 if(want_nl)
2323 {
2324 want_nl = 0;
2325 return tNL;
2326 }
2327 }
2328 YY_BREAK
2329case 121:
2330YY_RULE_SETUP
2331#line 819 "parser.l"
2332; /* Eat whitespace */
2333 YY_BREAK
2334case 122:
2335YY_RULE_SETUP
2336#line 821 "parser.l"
2337return yytext[0];
2338 YY_BREAK
2339case YY_STATE_EOF(INITIAL):
2340case YY_STATE_EOF(yywf):
2341case YY_STATE_EOF(yywf_s):
2342case YY_STATE_EOF(yystr):
2343case YY_STATE_EOF(yylstr):
2344case YY_STATE_EOF(yyrcd):
2345case YY_STATE_EOF(comment):
2346case YY_STATE_EOF(pp_incl):
2347case YY_STATE_EOF(pp_def):
2348case YY_STATE_EOF(pp_undef):
2349case YY_STATE_EOF(pp_if):
2350case YY_STATE_EOF(pp_ifdef):
2351case YY_STATE_EOF(pp_ifndef):
2352case YY_STATE_EOF(pp_elif):
2353case YY_STATE_EOF(pp_else):
2354case YY_STATE_EOF(pp_endif):
2355case YY_STATE_EOF(pp_error):
2356case YY_STATE_EOF(pp_def_s):
2357case YY_STATE_EOF(pp_ignore):
2358case YY_STATE_EOF(pp_ignore_eol):
2359case YY_STATE_EOF(pp_false):
2360case YY_STATE_EOF(pp_stripe):
2361case YY_STATE_EOF(pp_strips):
2362case YY_STATE_EOF(pp_stripp):
2363case YY_STATE_EOF(pp_stripp_final):
2364#line 822 "parser.l"
2365{
2366 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
2367 if(!pop_buffer())
2368 {
2369 if(YY_START == pp_strips || YY_START == pp_stripe || YY_START == pp_stripp || YY_START == pp_stripp_final)
2370 yyerror("Unexpected end of file during c-junk scanning (started at %d)", cjunk_tagline);
2371 else
2372 yyterminate();
2373 }
2374 yy_delete_buffer(b);
2375 }
2376 YY_BREAK
2377case 123:
2378YY_RULE_SETUP
2379#line 834 "parser.l"
2380{
2381 /* Catch all rule to find any unmatched text */
2382 if(*yytext == '\n')
2383 {
2384 line_number++;
2385 char_number = 1;
2386 }
2387 yywarning("Unmatched text '%c' (0x%02x) YY_START=%d stripslevel=%d",
2388 isprint(*yytext) ? *yytext : '.', *yytext, YY_START,stripslevel);
2389 }
2390 YY_BREAK
2391case 124:
2392YY_RULE_SETUP
2393#line 845 "parser.l"
2394ECHO;
2395 YY_BREAK
2396#line 2397 "lexyy.c"
2397
2398 case YY_END_OF_BUFFER:
2399 {
2400 /* Amount of text matched not including the EOB char. */
2401 int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
2402
2403 /* Undo the effects of YY_DO_BEFORE_ACTION. */
2404 *yy_cp = yy_hold_char;
2405
2406 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
2407 {
2408 /* We're scanning a new file or input source. It's
2409 * possible that this happened because the user
2410 * just pointed yyin at a new source and called
2411 * yylex(). If so, then we have to assure
2412 * consistency between yy_current_buffer and our
2413 * globals. Here is the right place to do so, because
2414 * this is the first action (other than possibly a
2415 * back-up) that will match for the new input source.
2416 */
2417 yy_n_chars = yy_current_buffer->yy_n_chars;
2418 yy_current_buffer->yy_input_file = yyin;
2419 yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
2420 }
2421
2422 /* Note that here we test for yy_c_buf_p "<=" to the position
2423 * of the first EOB in the buffer, since yy_c_buf_p will
2424 * already have been incremented past the NUL character
2425 * (since all states make transitions on EOB to the
2426 * end-of-buffer state). Contrast this with the test
2427 * in input().
2428 */
2429 if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
2430 { /* This was really a NUL. */
2431 yy_state_type yy_next_state;
2432
2433 yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
2434
2435 yy_current_state = yy_get_previous_state();
2436
2437 /* Okay, we're now positioned to make the NUL
2438 * transition. We couldn't have
2439 * yy_get_previous_state() go ahead and do it
2440 * for us because it doesn't know how to deal
2441 * with the possibility of jamming (and we don't
2442 * want to build jamming into it because then it
2443 * will run more slowly).
2444 */
2445
2446 yy_next_state = yy_try_NUL_trans( yy_current_state );
2447
2448 yy_bp = yytext_ptr + YY_MORE_ADJ;
2449
2450 if ( yy_next_state )
2451 {
2452 /* Consume the NUL. */
2453 yy_cp = ++yy_c_buf_p;
2454 yy_current_state = yy_next_state;
2455 goto yy_match;
2456 }
2457
2458 else
2459 {
2460 yy_cp = yy_c_buf_p;
2461 goto yy_find_action;
2462 }
2463 }
2464
2465 else switch ( yy_get_next_buffer() )
2466 {
2467 case EOB_ACT_END_OF_FILE:
2468 {
2469 yy_did_buffer_switch_on_eof = 0;
2470
2471 if ( yywrap() )
2472 {
2473 /* Note: because we've taken care in
2474 * yy_get_next_buffer() to have set up
2475 * yytext, we can now set up
2476 * yy_c_buf_p so that if some total
2477 * hoser (like flex itself) wants to
2478 * call the scanner after we return the
2479 * YY_NULL, it'll still work - another
2480 * YY_NULL will get returned.
2481 */
2482 yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
2483
2484 yy_act = YY_STATE_EOF(YY_START);
2485 goto do_action;
2486 }
2487
2488 else
2489 {
2490 if ( ! yy_did_buffer_switch_on_eof )
2491 YY_NEW_FILE;
2492 }
2493 break;
2494 }
2495
2496 case EOB_ACT_CONTINUE_SCAN:
2497 yy_c_buf_p =
2498 yytext_ptr + yy_amount_of_matched_text;
2499
2500 yy_current_state = yy_get_previous_state();
2501
2502 yy_cp = yy_c_buf_p;
2503 yy_bp = yytext_ptr + YY_MORE_ADJ;
2504 goto yy_match;
2505
2506 case EOB_ACT_LAST_MATCH:
2507 yy_c_buf_p =
2508 &yy_current_buffer->yy_ch_buf[yy_n_chars];
2509
2510 yy_current_state = yy_get_previous_state();
2511
2512 yy_cp = yy_c_buf_p;
2513 yy_bp = yytext_ptr + YY_MORE_ADJ;
2514 goto yy_find_action;
2515 }
2516 break;
2517 }
2518
2519 default:
2520 YY_FATAL_ERROR(
2521 "fatal flex scanner internal error--no action found" );
2522 } /* end of action switch */
2523 } /* end of scanning one token */
2524 } /* end of yylex */
2525
2526
2527/* yy_get_next_buffer - try to read in a new buffer
2528 *
2529 * Returns a code representing an action:
2530 * EOB_ACT_LAST_MATCH -
2531 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
2532 * EOB_ACT_END_OF_FILE - end of file
2533 */
2534
2535static int yy_get_next_buffer()
2536 {
2537 register char *dest = yy_current_buffer->yy_ch_buf;
2538 register char *source = yytext_ptr;
2539 register int number_to_move, i;
2540 int ret_val;
2541
2542 if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
2543 YY_FATAL_ERROR(
2544 "fatal flex scanner internal error--end of buffer missed" );
2545
2546 if ( yy_current_buffer->yy_fill_buffer == 0 )
2547 { /* Don't try to fill the buffer, so this is an EOF. */
2548 if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
2549 {
2550 /* We matched a singled characater, the EOB, so
2551 * treat this as a final EOF.
2552 */
2553 return EOB_ACT_END_OF_FILE;
2554 }
2555
2556 else
2557 {
2558 /* We matched some text prior to the EOB, first
2559 * process it.
2560 */
2561 return EOB_ACT_LAST_MATCH;
2562 }
2563 }
2564
2565 /* Try to read more data. */
2566
2567 /* First move last chars to start of buffer. */
2568 number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
2569
2570 for ( i = 0; i < number_to_move; ++i )
2571 *(dest++) = *(source++);
2572
2573 if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
2574 /* don't do the read, it's not guaranteed to return an EOF,
2575 * just force an EOF
2576 */
2577 yy_n_chars = 0;
2578
2579 else
2580 {
2581 int num_to_read =
2582 yy_current_buffer->yy_buf_size - number_to_move - 1;
2583
2584 while ( num_to_read <= 0 )
2585 { /* Not enough room in the buffer - grow it. */
2586#ifdef YY_USES_REJECT
2587 YY_FATAL_ERROR(
2588"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
2589#else
2590
2591 /* just a shorter name for the current buffer */
2592 YY_BUFFER_STATE b = yy_current_buffer;
2593
2594 int yy_c_buf_p_offset =
2595 (int) (yy_c_buf_p - b->yy_ch_buf);
2596
2597 if ( b->yy_is_our_buffer )
2598 {
2599 int new_size = b->yy_buf_size * 2;
2600
2601 if ( new_size <= 0 )
2602 b->yy_buf_size += b->yy_buf_size / 8;
2603 else
2604 b->yy_buf_size *= 2;
2605
2606 b->yy_ch_buf = (char *)
2607 /* Include room in for 2 EOB chars. */
2608 yy_flex_realloc( (void *) b->yy_ch_buf,
2609 b->yy_buf_size + 2 );
2610 }
2611 else
2612 /* Can't grow it, we don't own it. */
2613 b->yy_ch_buf = 0;
2614
2615 if ( ! b->yy_ch_buf )
2616 YY_FATAL_ERROR(
2617 "fatal error - scanner input buffer overflow" );
2618
2619 yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
2620
2621 num_to_read = yy_current_buffer->yy_buf_size -
2622 number_to_move - 1;
2623#endif
2624 }
2625
2626 if ( num_to_read > YY_READ_BUF_SIZE )
2627 num_to_read = YY_READ_BUF_SIZE;
2628
2629 /* Read in more data. */
2630 YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
2631 yy_n_chars, num_to_read );
2632 }
2633
2634 if ( yy_n_chars == 0 )
2635 {
2636 if ( number_to_move == YY_MORE_ADJ )
2637 {
2638 ret_val = EOB_ACT_END_OF_FILE;
2639 yyrestart( yyin );
2640 }
2641
2642 else
2643 {
2644 ret_val = EOB_ACT_LAST_MATCH;
2645 yy_current_buffer->yy_buffer_status =
2646 YY_BUFFER_EOF_PENDING;
2647 }
2648 }
2649
2650 else
2651 ret_val = EOB_ACT_CONTINUE_SCAN;
2652
2653 yy_n_chars += number_to_move;
2654 yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
2655 yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
2656
2657 yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
2658
2659 return ret_val;
2660 }
2661
2662
2663/* yy_get_previous_state - get the state just before the EOB char was reached */
2664
2665static yy_state_type yy_get_previous_state()
2666 {
2667 register yy_state_type yy_current_state;
2668 register char *yy_cp;
2669
2670 yy_current_state = yy_start;
2671 yy_current_state += YY_AT_BOL();
2672
2673 for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
2674 {
2675 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
2676 if ( yy_accept[yy_current_state] )
2677 {
2678 yy_last_accepting_state = yy_current_state;
2679 yy_last_accepting_cpos = yy_cp;
2680 }
2681 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2682 {
2683 yy_current_state = (int) yy_def[yy_current_state];
2684 if ( yy_current_state >= 369 )
2685 yy_c = yy_meta[(unsigned int) yy_c];
2686 }
2687 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
2688 }
2689
2690 return yy_current_state;
2691 }
2692
2693
2694/* yy_try_NUL_trans - try to make a transition on the NUL character
2695 *
2696 * synopsis
2697 * next_state = yy_try_NUL_trans( current_state );
2698 */
2699
2700#ifdef YY_USE_PROTOS
2701static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
2702#else
2703static yy_state_type yy_try_NUL_trans( yy_current_state )
2704yy_state_type yy_current_state;
2705#endif
2706 {
2707 register int yy_is_jam;
2708 register char *yy_cp = yy_c_buf_p;
2709
2710 register YY_CHAR yy_c = 1;
2711 if ( yy_accept[yy_current_state] )
2712 {
2713 yy_last_accepting_state = yy_current_state;
2714 yy_last_accepting_cpos = yy_cp;
2715 }
2716 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
2717 {
2718 yy_current_state = (int) yy_def[yy_current_state];
2719 if ( yy_current_state >= 369 )
2720 yy_c = yy_meta[(unsigned int) yy_c];
2721 }
2722 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
2723 yy_is_jam = (yy_current_state == 368);
2724
2725 return yy_is_jam ? 0 : yy_current_state;
2726 }
2727
2728
2729#ifndef YY_NO_UNPUT
2730#ifdef YY_USE_PROTOS
2731static void yyunput( int c, register char *yy_bp )
2732#else
2733static void yyunput( c, yy_bp )
2734int c;
2735register char *yy_bp;
2736#endif
2737 {
2738 register char *yy_cp = yy_c_buf_p;
2739
2740 /* undo effects of setting up yytext */
2741 *yy_cp = yy_hold_char;
2742
2743 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
2744 { /* need to shift things up to make room */
2745 /* +2 for EOB chars. */
2746 register int number_to_move = yy_n_chars + 2;
2747 register char *dest = &yy_current_buffer->yy_ch_buf[
2748 yy_current_buffer->yy_buf_size + 2];
2749 register char *source =
2750 &yy_current_buffer->yy_ch_buf[number_to_move];
2751
2752 while ( source > yy_current_buffer->yy_ch_buf )
2753 *--dest = *--source;
2754
2755 yy_cp += (int) (dest - source);
2756 yy_bp += (int) (dest - source);
2757 yy_n_chars = yy_current_buffer->yy_buf_size;
2758
2759 if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
2760 YY_FATAL_ERROR( "flex scanner push-back overflow" );
2761 }
2762
2763 *--yy_cp = (char) c;
2764
2765
2766 yytext_ptr = yy_bp;
2767 yy_hold_char = *yy_cp;
2768 yy_c_buf_p = yy_cp;
2769 }
2770#endif /* ifndef YY_NO_UNPUT */
2771
2772
2773#ifdef __cplusplus
2774static int yyinput()
2775#else
2776static int input()
2777#endif
2778 {
2779 int c;
2780
2781 *yy_c_buf_p = yy_hold_char;
2782
2783 if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
2784 {
2785 /* yy_c_buf_p now points to the character we want to return.
2786 * If this occurs *before* the EOB characters, then it's a
2787 * valid NUL; if not, then we've hit the end of the buffer.
2788 */
2789 if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
2790 /* This was really a NUL. */
2791 *yy_c_buf_p = '\0';
2792
2793 else
2794 { /* need more input */
2795 yytext_ptr = yy_c_buf_p;
2796 ++yy_c_buf_p;
2797
2798 switch ( yy_get_next_buffer() )
2799 {
2800 case EOB_ACT_END_OF_FILE:
2801 {
2802 if ( yywrap() )
2803 {
2804 yy_c_buf_p =
2805 yytext_ptr + YY_MORE_ADJ;
2806 return EOF;
2807 }
2808
2809 if ( ! yy_did_buffer_switch_on_eof )
2810 YY_NEW_FILE;
2811#ifdef __cplusplus
2812 return yyinput();
2813#else
2814 return input();
2815#endif
2816 }
2817
2818 case EOB_ACT_CONTINUE_SCAN:
2819 yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
2820 break;
2821
2822 case EOB_ACT_LAST_MATCH:
2823#ifdef __cplusplus
2824 YY_FATAL_ERROR(
2825 "unexpected last match in yyinput()" );
2826#else
2827 YY_FATAL_ERROR(
2828 "unexpected last match in input()" );
2829#endif
2830 }
2831 }
2832 }
2833
2834 c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
2835 *yy_c_buf_p = '\0'; /* preserve yytext */
2836 yy_hold_char = *++yy_c_buf_p;
2837
2838 yy_current_buffer->yy_at_bol = (c == '\n');
2839
2840 return c;
2841 }
2842
2843
2844#ifdef YY_USE_PROTOS
2845void yyrestart( FILE *input_file )
2846#else
2847void yyrestart( input_file )
2848FILE *input_file;
2849#endif
2850 {
2851 if ( ! yy_current_buffer )
2852 yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
2853
2854 yy_init_buffer( yy_current_buffer, input_file );
2855 yy_load_buffer_state();
2856 }
2857
2858
2859#ifdef YY_USE_PROTOS
2860void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
2861#else
2862void yy_switch_to_buffer( new_buffer )
2863YY_BUFFER_STATE new_buffer;
2864#endif
2865 {
2866 if ( yy_current_buffer == new_buffer )
2867 return;
2868
2869 if ( yy_current_buffer )
2870 {
2871 /* Flush out information for old buffer. */
2872 *yy_c_buf_p = yy_hold_char;
2873 yy_current_buffer->yy_buf_pos = yy_c_buf_p;
2874 yy_current_buffer->yy_n_chars = yy_n_chars;
2875 }
2876
2877 yy_current_buffer = new_buffer;
2878 yy_load_buffer_state();
2879
2880 /* We don't actually know whether we did this switch during
2881 * EOF (yywrap()) processing, but the only time this flag
2882 * is looked at is after yywrap() is called, so it's safe
2883 * to go ahead and always set it.
2884 */
2885 yy_did_buffer_switch_on_eof = 1;
2886 }
2887
2888
2889#ifdef YY_USE_PROTOS
2890void yy_load_buffer_state( void )
2891#else
2892void yy_load_buffer_state()
2893#endif
2894 {
2895 yy_n_chars = yy_current_buffer->yy_n_chars;
2896 yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
2897 yyin = yy_current_buffer->yy_input_file;
2898 yy_hold_char = *yy_c_buf_p;
2899 }
2900
2901
2902#ifdef YY_USE_PROTOS
2903YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
2904#else
2905YY_BUFFER_STATE yy_create_buffer( file, size )
2906FILE *file;
2907int size;
2908#endif
2909 {
2910 YY_BUFFER_STATE b;
2911
2912 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
2913 if ( ! b )
2914 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2915
2916 b->yy_buf_size = size;
2917
2918 /* yy_ch_buf has to be 2 characters longer than the size given because
2919 * we need to put in 2 end-of-buffer characters.
2920 */
2921 b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
2922 if ( ! b->yy_ch_buf )
2923 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
2924
2925 b->yy_is_our_buffer = 1;
2926
2927 yy_init_buffer( b, file );
2928
2929 return b;
2930 }
2931
2932
2933#ifdef YY_USE_PROTOS
2934void yy_delete_buffer( YY_BUFFER_STATE b )
2935#else
2936void yy_delete_buffer( b )
2937YY_BUFFER_STATE b;
2938#endif
2939 {
2940 if ( ! b )
2941 return;
2942
2943 if ( b == yy_current_buffer )
2944 yy_current_buffer = (YY_BUFFER_STATE) 0;
2945
2946 if ( b->yy_is_our_buffer )
2947 yy_flex_free( (void *) b->yy_ch_buf );
2948
2949 yy_flex_free( (void *) b );
2950 }
2951
2952
2953#ifndef YY_ALWAYS_INTERACTIVE
2954#ifndef YY_NEVER_INTERACTIVE
2955extern int isatty YY_PROTO(( int ));
2956#endif
2957#endif
2958
2959#ifdef YY_USE_PROTOS
2960void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
2961#else
2962void yy_init_buffer( b, file )
2963YY_BUFFER_STATE b;
2964FILE *file;
2965#endif
2966
2967
2968 {
2969 yy_flush_buffer( b );
2970
2971 b->yy_input_file = file;
2972 b->yy_fill_buffer = 1;
2973
2974#if YY_ALWAYS_INTERACTIVE
2975 b->yy_is_interactive = 1;
2976#else
2977#if YY_NEVER_INTERACTIVE
2978 b->yy_is_interactive = 0;
2979#else
2980 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
2981#endif
2982#endif
2983 }
2984
2985
2986#ifdef YY_USE_PROTOS
2987void yy_flush_buffer( YY_BUFFER_STATE b )
2988#else
2989void yy_flush_buffer( b )
2990YY_BUFFER_STATE b;
2991#endif
2992
2993 {
2994 b->yy_n_chars = 0;
2995
2996 /* We always need two end-of-buffer characters. The first causes
2997 * a transition to the end-of-buffer state. The second causes
2998 * a jam in that state.
2999 */
3000 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
3001 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
3002
3003 b->yy_buf_pos = &b->yy_ch_buf[0];
3004
3005 b->yy_at_bol = 1;
3006 b->yy_buffer_status = YY_BUFFER_NEW;
3007
3008 if ( b == yy_current_buffer )
3009 yy_load_buffer_state();
3010 }
3011
3012
3013#ifndef YY_NO_SCAN_BUFFER
3014#ifdef YY_USE_PROTOS
3015YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
3016#else
3017YY_BUFFER_STATE yy_scan_buffer( base, size )
3018char *base;
3019yy_size_t size;
3020#endif
3021 {
3022 YY_BUFFER_STATE b;
3023
3024 if ( size < 2 ||
3025 base[size-2] != YY_END_OF_BUFFER_CHAR ||
3026 base[size-1] != YY_END_OF_BUFFER_CHAR )
3027 /* They forgot to leave room for the EOB's. */
3028 return 0;
3029
3030 b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
3031 if ( ! b )
3032 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
3033
3034 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
3035 b->yy_buf_pos = b->yy_ch_buf = base;
3036 b->yy_is_our_buffer = 0;
3037 b->yy_input_file = 0;
3038 b->yy_n_chars = b->yy_buf_size;
3039 b->yy_is_interactive = 0;
3040 b->yy_at_bol = 1;
3041 b->yy_fill_buffer = 0;
3042 b->yy_buffer_status = YY_BUFFER_NEW;
3043
3044 yy_switch_to_buffer( b );
3045
3046 return b;
3047 }
3048#endif
3049
3050
3051#ifndef YY_NO_SCAN_STRING
3052#ifdef YY_USE_PROTOS
3053YY_BUFFER_STATE yy_scan_string( yyconst char *str )
3054#else
3055YY_BUFFER_STATE yy_scan_string( str )
3056yyconst char *str;
3057#endif
3058 {
3059 int len;
3060 for ( len = 0; str[len]; ++len )
3061 ;
3062
3063 return yy_scan_bytes( str, len );
3064 }
3065#endif
3066
3067
3068#ifndef YY_NO_SCAN_BYTES
3069#ifdef YY_USE_PROTOS
3070YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
3071#else
3072YY_BUFFER_STATE yy_scan_bytes( bytes, len )
3073yyconst char *bytes;
3074int len;
3075#endif
3076 {
3077 YY_BUFFER_STATE b;
3078 char *buf;
3079 yy_size_t n;
3080 int i;
3081
3082 /* Get memory for full buffer, including space for trailing EOB's. */
3083 n = len + 2;
3084 buf = (char *) yy_flex_alloc( n );
3085 if ( ! buf )
3086 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
3087
3088 for ( i = 0; i < len; ++i )
3089 buf[i] = bytes[i];
3090
3091 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
3092
3093 b = yy_scan_buffer( buf, n );
3094 if ( ! b )
3095 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
3096
3097 /* It's okay to grow etc. this buffer, and we should throw it
3098 * away when we're done.
3099 */
3100 b->yy_is_our_buffer = 1;
3101
3102 return b;
3103 }
3104#endif
3105
3106
3107#ifndef YY_NO_PUSH_STATE
3108#ifdef YY_USE_PROTOS
3109static void yy_push_state( int new_state )
3110#else
3111static void yy_push_state( new_state )
3112int new_state;
3113#endif
3114 {
3115 if ( yy_start_stack_ptr >= yy_start_stack_depth )
3116 {
3117 yy_size_t new_size;
3118
3119 yy_start_stack_depth += YY_START_STACK_INCR;
3120 new_size = yy_start_stack_depth * sizeof( int );
3121
3122 if ( ! yy_start_stack )
3123 yy_start_stack = (int *) yy_flex_alloc( new_size );
3124
3125 else
3126 yy_start_stack = (int *) yy_flex_realloc(
3127 (void *) yy_start_stack, new_size );
3128
3129 if ( ! yy_start_stack )
3130 YY_FATAL_ERROR(
3131 "out of memory expanding start-condition stack" );
3132 }
3133
3134 yy_start_stack[yy_start_stack_ptr++] = YY_START;
3135
3136 BEGIN(new_state);
3137 }
3138#endif
3139
3140
3141#ifndef YY_NO_POP_STATE
3142static void yy_pop_state()
3143 {
3144 if ( --yy_start_stack_ptr < 0 )
3145 YY_FATAL_ERROR( "start-condition stack underflow" );
3146
3147 BEGIN(yy_start_stack[yy_start_stack_ptr]);
3148 }
3149#endif
3150
3151
3152#ifndef YY_NO_TOP_STATE
3153static int yy_top_state()
3154 {
3155 return yy_start_stack[yy_start_stack_ptr - 1];
3156 }
3157#endif
3158
3159#ifndef YY_EXIT_FAILURE
3160#define YY_EXIT_FAILURE 2
3161#endif
3162
3163#ifdef YY_USE_PROTOS
3164static void yy_fatal_error( yyconst char msg[] )
3165#else
3166static void yy_fatal_error( msg )
3167char msg[];
3168#endif
3169 {
3170 (void) fprintf( stderr, "%s\n", msg );
3171 exit( YY_EXIT_FAILURE );
3172 }
3173
3174
3175
3176/* Redefine yyless() so it works in section 3 code. */
3177
3178#undef yyless
3179#define yyless(n) \
3180 do \
3181 { \
3182 /* Undo effects of setting up yytext. */ \
3183 yytext[yyleng] = yy_hold_char; \
3184 yy_c_buf_p = yytext + n - YY_MORE_ADJ; \
3185 yy_hold_char = *yy_c_buf_p; \
3186 *yy_c_buf_p = '\0'; \
3187 yyleng = n; \
3188 } \
3189 while ( 0 )
3190
3191
3192/* Internal utility routines. */
3193
3194#ifndef yytext_ptr
3195#ifdef YY_USE_PROTOS
3196static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
3197#else
3198static void yy_flex_strncpy( s1, s2, n )
3199char *s1;
3200yyconst char *s2;
3201int n;
3202#endif
3203 {
3204 register int i;
3205 for ( i = 0; i < n; ++i )
3206 s1[i] = s2[i];
3207 }
3208#endif
3209
3210
3211#ifdef YY_USE_PROTOS
3212static void *yy_flex_alloc( yy_size_t size )
3213#else
3214static void *yy_flex_alloc( size )
3215yy_size_t size;
3216#endif
3217 {
3218 return (void *) malloc( size );
3219 }
3220
3221#ifdef YY_USE_PROTOS
3222static void *yy_flex_realloc( void *ptr, yy_size_t size )
3223#else
3224static void *yy_flex_realloc( ptr, size )
3225void *ptr;
3226yy_size_t size;
3227#endif
3228 {
3229 /* The cast to (char *) in the following accommodates both
3230 * implementations that use char* generic pointers, and those
3231 * that use void* generic pointers. It works with the latter
3232 * because both ANSI C and C++ allow castless assignment from
3233 * any pointer type to void*, and deal with argument conversions
3234 * as though doing an assignment.
3235 */
3236 return (void *) realloc( (char *) ptr, size );
3237 }
3238
3239#ifdef YY_USE_PROTOS
3240static void yy_flex_free( void *ptr )
3241#else
3242static void yy_flex_free( ptr )
3243void *ptr;
3244#endif
3245 {
3246 free( ptr );
3247 }
3248
3249#if YY_MAIN
3250int main()
3251 {
3252 yylex();
3253 return 0;
3254 }
3255#endif
3256#line 845 "parser.l"
3257
3258
3259#ifndef yywrap
3260int yywrap(void)
3261{
3262#if 0
3263 if(bufferstackidx > 0)
3264 {
3265 return 0;
3266 }
3267#endif
3268 return 1;
3269}
3270#endif
3271
3272/* These dup functions copy the enclosed '\0' from
3273 * the resource string.
3274 */
3275void addcchar(char c)
3276{
3277 if(cbufidx >= cbufalloc)
3278 {
3279 cbufalloc += 1024;
3280 cbuffer = xrealloc(cbuffer, cbufalloc * sizeof(cbuffer[0]));
3281 if(cbufalloc > 65536)
3282 yywarning("Reallocating string buffer larger than 64kB");
3283 }
3284 cbuffer[cbufidx++] = c;
3285}
3286
3287void addwchar(short s)
3288{
3289 if(wbufidx >= wbufalloc)
3290 {
3291 wbufalloc += 1024;
3292 wbuffer = xrealloc(wbuffer, wbufalloc * sizeof(wbuffer[0]));
3293 if(wbufalloc > 65536)
3294 yywarning("Reallocating wide string buffer larger than 64kB");
3295 }
3296
3297 /*
3298 * BS 08-Aug-1999 FIXME: The '& 0xff' is probably a bug, but I have
3299 * not experienced it yet and I seem to remember that this was for
3300 * a reason. But, as so many things you tend to forget why.
3301 * I guess that there were problems due to the sign extension of
3302 * shorts WRT chars (e.g. 0x80 becomes 0xff80 instead of 0x0080).
3303 * This should then be fixed in the lexer calling the function.
3304 */
3305 wbuffer[wbufidx++] = (short)(s & 0xff);
3306}
3307
3308string_t *get_buffered_cstring(void)
3309{
3310 string_t *str = new_string();
3311 str->size = cbufidx;
3312 str->type = str_char;
3313 str->str.cstr = (char *)xmalloc(cbufidx+1);
3314 memcpy(str->str.cstr, cbuffer, cbufidx);
3315 str->str.cstr[cbufidx] = '\0';
3316/* printf("got cstring \"%s\"\n", str->str.cstr); */
3317 return str;
3318}
3319
3320string_t *get_buffered_wstring(void)
3321{
3322 string_t *str = new_string();
3323 str->size = wbufidx;
3324 str->type = str_unicode;
3325 str->str.wstr = (short *)xmalloc(2*(wbufidx+1));
3326 memcpy(str->str.wstr, wbuffer, wbufidx);
3327 str->str.wstr[wbufidx] = 0;
3328 return str;
3329}
3330
3331string_t *make_string(char *s)
3332{
3333 string_t *str = new_string();
3334 str->size = strlen(s);
3335 str->type = str_char;
3336 str->str.cstr = (char *)xmalloc(str->size+1);
3337 memcpy(str->str.cstr, s, str->size+1);
3338 return str;
3339}
3340
3341string_t *make_filename(char *s, int len)
3342{
3343 char *cptr;
3344 string_t *str = new_string();
3345
3346 str->size = len;
3347 str->type = str_char;
3348 str->str.cstr = (char *)xmalloc(str->size+1);
3349 memcpy(str->str.cstr, s, str->size);
3350 str->str.cstr[str->size] = '\0';
3351
3352 /* Remove escaped backslash and convert to forward */
3353 cptr = str->str.cstr;
3354 for(cptr = str->str.cstr; (cptr = strchr(cptr, '\\')) != NULL; cptr++)
3355 {
3356 if(cptr[1] == '\\')
3357 {
3358 memmove(cptr, cptr+1, strlen(cptr));
3359 str->size--;
3360 }
3361 *cptr = '/';
3362 }
3363
3364 /* Convert to lower case. Seems to be reasonable to do */
3365 for(cptr = str->str.cstr; !leave_case && *cptr; cptr++)
3366 {
3367 *cptr = tolower(*cptr);
3368 }
3369 return str;
3370}
3371
3372/* Called from the parser to signal filename request */
3373void set_yywf(void)
3374{
3375 push_to(yywf);
3376}
3377
3378/* Called from the parser to signal preprocessor if case */
3379void set_pp_ignore(int state)
3380{
3381 if(state)
3382 push_to(pp_false);
3383 else
3384 pop_start();
3385}
3386
3387/* Called from the parser to kill c-junk */
3388void strip_extern(void)
3389{
3390 cjunk_tagline = line_number;
3391 push_to(pp_stripe);
3392}
3393
3394void strip_til_semicolon(void)
3395{
3396 cjunk_tagline = line_number;
3397 push_to(pp_strips);
3398}
3399
3400void strip_til_parenthesis(void)
3401{
3402 cjunk_tagline = line_number;
3403 stripplevel = 1; /* One scanned already */
3404 push_to(pp_stripp);
3405}
3406
Note: See TracBrowser for help on using the repository browser.