blob: 5fc323de302cebe187a57225484fd1883170dcd0 [file] [log] [blame]
Denis Vlasenko7d219aa2006-10-05 10:17:08 +00001
2#line 3 "scripts/kconfig/lex.zconf.c"
3
4#define YY_INT_ALIGNED short int
5
6/* A lexical scanner generated by flex */
7
8#define FLEX_SCANNER
9#define YY_FLEX_MAJOR_VERSION 2
10#define YY_FLEX_MINOR_VERSION 5
11#define YY_FLEX_SUBMINOR_VERSION 31
12#if YY_FLEX_SUBMINOR_VERSION > 0
13#define FLEX_BETA
14#endif
15
16/* First, we deal with platform-specific or compiler-specific issues. */
17
18/* begin standard C headers. */
19#include <stdio.h>
20#include <string.h>
21#include <errno.h>
22#include <stdlib.h>
23
24/* end standard C headers. */
25
26/* flex integer type definitions */
27
28#ifndef FLEXINT_H
29#define FLEXINT_H
30
31/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
32
33#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
34#include <inttypes.h>
35typedef int8_t flex_int8_t;
36typedef uint8_t flex_uint8_t;
37typedef int16_t flex_int16_t;
38typedef uint16_t flex_uint16_t;
39typedef int32_t flex_int32_t;
40typedef uint32_t flex_uint32_t;
41#else
42typedef signed char flex_int8_t;
43typedef short int flex_int16_t;
44typedef int flex_int32_t;
Denis Vlasenkof7996f32007-01-11 17:20:00 +000045typedef unsigned char flex_uint8_t;
Denis Vlasenko7d219aa2006-10-05 10:17:08 +000046typedef unsigned short int flex_uint16_t;
47typedef unsigned int flex_uint32_t;
48#endif /* ! C99 */
49
50/* Limits of integral types. */
51#ifndef INT8_MIN
52#define INT8_MIN (-128)
53#endif
54#ifndef INT16_MIN
55#define INT16_MIN (-32767-1)
56#endif
57#ifndef INT32_MIN
58#define INT32_MIN (-2147483647-1)
59#endif
60#ifndef INT8_MAX
61#define INT8_MAX (127)
62#endif
63#ifndef INT16_MAX
64#define INT16_MAX (32767)
65#endif
66#ifndef INT32_MAX
67#define INT32_MAX (2147483647)
68#endif
69#ifndef UINT8_MAX
70#define UINT8_MAX (255U)
71#endif
72#ifndef UINT16_MAX
73#define UINT16_MAX (65535U)
74#endif
75#ifndef UINT32_MAX
76#define UINT32_MAX (4294967295U)
77#endif
78
79#endif /* ! FLEXINT_H */
80
81#ifdef __cplusplus
82
83/* The "const" storage-class-modifier is valid. */
84#define YY_USE_CONST
85
86#else /* ! __cplusplus */
87
88#if __STDC__
89
90#define YY_USE_CONST
91
92#endif /* __STDC__ */
93#endif /* ! __cplusplus */
94
95#ifdef YY_USE_CONST
96#define yyconst const
97#else
98#define yyconst
99#endif
100
101/* Returned upon end-of-file. */
102#define YY_NULL 0
103
104/* Promotes a possibly negative, possibly signed char to an unsigned
105 * integer for use as an array index. If the signed char is negative,
106 * we want to instead treat it as an 8-bit unsigned char, hence the
107 * double cast.
108 */
109#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
110
111/* Enter a start condition. This macro really ought to take a parameter,
112 * but we do it the disgusting crufty way forced on us by the ()-less
113 * definition of BEGIN.
114 */
115#define BEGIN (yy_start) = 1 + 2 *
116
117/* Translate the current start state into a value that can be later handed
118 * to BEGIN to return to the state. The YYSTATE alias is for lex
119 * compatibility.
120 */
121#define YY_START (((yy_start) - 1) / 2)
122#define YYSTATE YY_START
123
124/* Action number for EOF rule of a given start state. */
125#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
126
127/* Special action meaning "start processing a new file". */
128#define YY_NEW_FILE zconfrestart(zconfin )
129
130#define YY_END_OF_BUFFER_CHAR 0
131
132/* Size of default input buffer. */
133#ifndef YY_BUF_SIZE
134#define YY_BUF_SIZE 16384
135#endif
136
137#ifndef YY_TYPEDEF_YY_BUFFER_STATE
138#define YY_TYPEDEF_YY_BUFFER_STATE
139typedef struct yy_buffer_state *YY_BUFFER_STATE;
140#endif
141
142extern int zconfleng;
143
144extern FILE *zconfin, *zconfout;
145
146#define EOB_ACT_CONTINUE_SCAN 0
147#define EOB_ACT_END_OF_FILE 1
148#define EOB_ACT_LAST_MATCH 2
149
150 #define YY_LESS_LINENO(n)
Denis Vlasenkof7996f32007-01-11 17:20:00 +0000151
Denis Vlasenko7d219aa2006-10-05 10:17:08 +0000152/* Return all but the first "n" matched characters back to the input stream. */
153#define yyless(n) \
154 do \
155 { \
156 /* Undo effects of setting up zconftext. */ \
157 int yyless_macro_arg = (n); \
158 YY_LESS_LINENO(yyless_macro_arg);\
159 *yy_cp = (yy_hold_char); \
160 YY_RESTORE_YY_MORE_OFFSET \
161 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
162 YY_DO_BEFORE_ACTION; /* set up zconftext again */ \
163 } \
164 while ( 0 )
165
166#define unput(c) yyunput( c, (yytext_ptr) )
167
168/* The following is because we cannot portably get our hands on size_t
169 * (without autoconf's help, which isn't available because we want
170 * flex-generated scanners to compile on their own).
171 */
172
173#ifndef YY_TYPEDEF_YY_SIZE_T
174#define YY_TYPEDEF_YY_SIZE_T
175typedef unsigned int yy_size_t;
176#endif
177
178#ifndef YY_STRUCT_YY_BUFFER_STATE
179#define YY_STRUCT_YY_BUFFER_STATE
180struct yy_buffer_state
181 {
182 FILE *yy_input_file;
183
184 char *yy_ch_buf; /* input buffer */
185 char *yy_buf_pos; /* current position in input buffer */
186
187 /* Size of input buffer in bytes, not including room for EOB
188 * characters.
189 */
190 yy_size_t yy_buf_size;
191
192 /* Number of characters read into yy_ch_buf, not including EOB
193 * characters.
194 */
195 int yy_n_chars;
196
197 /* Whether we "own" the buffer - i.e., we know we created it,
198 * and can realloc() it to grow it, and should free() it to
199 * delete it.
200 */
201 int yy_is_our_buffer;
202
203 /* Whether this is an "interactive" input source; if so, and
204 * if we're using stdio for input, then we want to use getc()
205 * instead of fread(), to make sure we stop fetching input after
206 * each newline.
207 */
208 int yy_is_interactive;
209
210 /* Whether we're considered to be at the beginning of a line.
211 * If so, '^' rules will be active on the next match, otherwise
212 * not.
213 */
214 int yy_at_bol;
215
216 int yy_bs_lineno; /**< The line count. */
217 int yy_bs_column; /**< The column count. */
Denis Vlasenkof7996f32007-01-11 17:20:00 +0000218
Denis Vlasenko7d219aa2006-10-05 10:17:08 +0000219 /* Whether to try to fill the input buffer when we reach the
220 * end of it.
221 */
222 int yy_fill_buffer;
223
224 int yy_buffer_status;
225
226#define YY_BUFFER_NEW 0
227#define YY_BUFFER_NORMAL 1
228 /* When an EOF's been seen but there's still some text to process
229 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
230 * shouldn't try reading from the input source any more. We might
231 * still have a bunch of tokens to match, though, because of
232 * possible backing-up.
233 *
234 * When we actually see the EOF, we change the status to "new"
235 * (via zconfrestart()), so that the user can continue scanning by
236 * just pointing zconfin at a new input file.
237 */
238#define YY_BUFFER_EOF_PENDING 2
239
240 };
241#endif /* !YY_STRUCT_YY_BUFFER_STATE */
242
243/* Stack of input buffers. */
244static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
245static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
246static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
247
248/* We provide macros for accessing buffer states in case in the
249 * future we want to put the buffer states in a more general
250 * "scanner state".
251 *
252 * Returns the top of the stack, or NULL.
253 */
254#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
255 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
256 : NULL)
257
258/* Same as previous macro, but useful when we know that the buffer stack is not
259 * NULL or when we need an lvalue. For internal use only.
260 */
261#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
262
263/* yy_hold_char holds the character lost when zconftext is formed. */
264static char yy_hold_char;
265static int yy_n_chars; /* number of characters read into yy_ch_buf */
266int zconfleng;
267
268/* Points to current character in buffer. */
269static char *yy_c_buf_p = (char *) 0;
270static int yy_init = 1; /* whether we need to initialize */
271static int yy_start = 0; /* start state number */
272
273/* Flag which is used to allow zconfwrap()'s to do buffer switches
274 * instead of setting up a fresh zconfin. A bit of a hack ...
275 */
276static int yy_did_buffer_switch_on_eof;
277
278void zconfrestart (FILE *input_file );
279void zconf_switch_to_buffer (YY_BUFFER_STATE new_buffer );
280YY_BUFFER_STATE zconf_create_buffer (FILE *file,int size );
281void zconf_delete_buffer (YY_BUFFER_STATE b );
282void zconf_flush_buffer (YY_BUFFER_STATE b );
283void zconfpush_buffer_state (YY_BUFFER_STATE new_buffer );
284void zconfpop_buffer_state (void );
285
286static void zconfensure_buffer_stack (void );
287static void zconf_load_buffer_state (void );
288static void zconf_init_buffer (YY_BUFFER_STATE b,FILE *file );
289
290#define YY_FLUSH_BUFFER zconf_flush_buffer(YY_CURRENT_BUFFER )
291
292YY_BUFFER_STATE zconf_scan_buffer (char *base,yy_size_t size );
293YY_BUFFER_STATE zconf_scan_string (yyconst char *yy_str );
294YY_BUFFER_STATE zconf_scan_bytes (yyconst char *bytes,int len );
295
296void *zconfalloc (yy_size_t );
297void *zconfrealloc (void *,yy_size_t );
298void zconffree (void * );
299
300#define yy_new_buffer zconf_create_buffer
301
302#define yy_set_interactive(is_interactive) \
303 { \
304 if ( ! YY_CURRENT_BUFFER ){ \
305 zconfensure_buffer_stack (); \
306 YY_CURRENT_BUFFER_LVALUE = \
307 zconf_create_buffer(zconfin,YY_BUF_SIZE ); \
308 } \
309 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
310 }
311
312#define yy_set_bol(at_bol) \
313 { \
314 if ( ! YY_CURRENT_BUFFER ){\
315 zconfensure_buffer_stack (); \
316 YY_CURRENT_BUFFER_LVALUE = \
317 zconf_create_buffer(zconfin,YY_BUF_SIZE ); \
318 } \
319 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
320 }
321
322#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
323
324/* Begin user sect3 */
325
326#define zconfwrap() 1
327#define YY_SKIP_YYWRAP
328
329typedef unsigned char YY_CHAR;
330
331FILE *zconfin = (FILE *) 0, *zconfout = (FILE *) 0;
332
333typedef int yy_state_type;
334
335extern int zconflineno;
336
337int zconflineno = 1;
338
339extern char *zconftext;
340#define yytext_ptr zconftext
341static yyconst flex_int16_t yy_nxt[][17] =
342 {
343 {
344 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
345 0, 0, 0, 0, 0, 0, 0
346 },
347
348 {
349 11, 12, 13, 14, 12, 12, 15, 12, 12, 12,
350 12, 12, 12, 12, 12, 12, 12
351 },
352
353 {
354 11, 12, 13, 14, 12, 12, 15, 12, 12, 12,
355 12, 12, 12, 12, 12, 12, 12
356 },
357
358 {
359 11, 16, 16, 17, 16, 16, 16, 16, 16, 16,
360 16, 16, 16, 18, 16, 16, 16
361 },
362
363 {
364 11, 16, 16, 17, 16, 16, 16, 16, 16, 16,
365 16, 16, 16, 18, 16, 16, 16
366
367 },
368
369 {
370 11, 19, 20, 21, 19, 19, 19, 19, 19, 19,
371 19, 19, 19, 19, 19, 19, 19
372 },
373
374 {
375 11, 19, 20, 21, 19, 19, 19, 19, 19, 19,
376 19, 19, 19, 19, 19, 19, 19
377 },
378
379 {
380 11, 22, 22, 23, 22, 24, 22, 22, 24, 22,
381 22, 22, 22, 22, 22, 25, 22
382 },
383
384 {
385 11, 22, 22, 23, 22, 24, 22, 22, 24, 22,
386 22, 22, 22, 22, 22, 25, 22
387 },
388
389 {
390 11, 26, 26, 27, 28, 29, 30, 31, 29, 32,
391 33, 34, 35, 35, 36, 37, 38
392
393 },
394
395 {
396 11, 26, 26, 27, 28, 29, 30, 31, 29, 32,
397 33, 34, 35, 35, 36, 37, 38
398 },
399
400 {
401 -11, -11, -11, -11, -11, -11, -11, -11, -11, -11,
402 -11, -11, -11, -11, -11, -11, -11
403 },
404
405 {
406 11, -12, -12, -12, -12, -12, -12, -12, -12, -12,
407 -12, -12, -12, -12, -12, -12, -12
408 },
409
410 {
411 11, -13, 39, 40, -13, -13, 41, -13, -13, -13,
412 -13, -13, -13, -13, -13, -13, -13
413 },
414
415 {
416 11, -14, -14, -14, -14, -14, -14, -14, -14, -14,
417 -14, -14, -14, -14, -14, -14, -14
418
419 },
420
421 {
422 11, 42, 42, 43, 42, 42, 42, 42, 42, 42,
423 42, 42, 42, 42, 42, 42, 42
424 },
425
426 {
427 11, -16, -16, -16, -16, -16, -16, -16, -16, -16,
428 -16, -16, -16, -16, -16, -16, -16
429 },
430
431 {
432 11, -17, -17, -17, -17, -17, -17, -17, -17, -17,
433 -17, -17, -17, -17, -17, -17, -17
434 },
435
436 {
437 11, -18, -18, -18, -18, -18, -18, -18, -18, -18,
438 -18, -18, -18, 44, -18, -18, -18
439 },
440
441 {
442 11, 45, 45, -19, 45, 45, 45, 45, 45, 45,
443 45, 45, 45, 45, 45, 45, 45
444
445 },
446
447 {
448 11, -20, 46, 47, -20, -20, -20, -20, -20, -20,
449 -20, -20, -20, -20, -20, -20, -20
450 },
451
452 {
453 11, 48, -21, -21, 48, 48, 48, 48, 48, 48,
454 48, 48, 48, 48, 48, 48, 48
455 },
456
457 {
458 11, 49, 49, 50, 49, -22, 49, 49, -22, 49,
459 49, 49, 49, 49, 49, -22, 49
460 },
461
462 {
463 11, -23, -23, -23, -23, -23, -23, -23, -23, -23,
464 -23, -23, -23, -23, -23, -23, -23
465 },
466
467 {
468 11, -24, -24, -24, -24, -24, -24, -24, -24, -24,
469 -24, -24, -24, -24, -24, -24, -24
470
471 },
472
473 {
474 11, 51, 51, 52, 51, 51, 51, 51, 51, 51,
475 51, 51, 51, 51, 51, 51, 51
476 },
477
478 {
479 11, -26, -26, -26, -26, -26, -26, -26, -26, -26,
480 -26, -26, -26, -26, -26, -26, -26
481 },
482
483 {
484 11, -27, -27, -27, -27, -27, -27, -27, -27, -27,
485 -27, -27, -27, -27, -27, -27, -27
486 },
487
488 {
489 11, -28, -28, -28, -28, -28, -28, -28, -28, -28,
490 -28, -28, -28, -28, 53, -28, -28
491 },
492
493 {
494 11, -29, -29, -29, -29, -29, -29, -29, -29, -29,
495 -29, -29, -29, -29, -29, -29, -29
496
497 },
498
499 {
500 11, 54, 54, -30, 54, 54, 54, 54, 54, 54,
501 54, 54, 54, 54, 54, 54, 54
502 },
503
504 {
505 11, -31, -31, -31, -31, -31, -31, 55, -31, -31,
506 -31, -31, -31, -31, -31, -31, -31
507 },
508
509 {
510 11, -32, -32, -32, -32, -32, -32, -32, -32, -32,
511 -32, -32, -32, -32, -32, -32, -32
512 },
513
514 {
515 11, -33, -33, -33, -33, -33, -33, -33, -33, -33,
516 -33, -33, -33, -33, -33, -33, -33
517 },
518
519 {
520 11, -34, -34, -34, -34, -34, -34, -34, -34, -34,
521 -34, 56, 57, 57, -34, -34, -34
522
523 },
524
525 {
526 11, -35, -35, -35, -35, -35, -35, -35, -35, -35,
527 -35, 57, 57, 57, -35, -35, -35
528 },
529
530 {
531 11, -36, -36, -36, -36, -36, -36, -36, -36, -36,
532 -36, -36, -36, -36, -36, -36, -36
533 },
534
535 {
536 11, -37, -37, 58, -37, -37, -37, -37, -37, -37,
537 -37, -37, -37, -37, -37, -37, -37
538 },
539
540 {
541 11, -38, -38, -38, -38, -38, -38, -38, -38, -38,
542 -38, -38, -38, -38, -38, -38, 59
543 },
544
545 {
546 11, -39, 39, 40, -39, -39, 41, -39, -39, -39,
547 -39, -39, -39, -39, -39, -39, -39
548
549 },
550
551 {
552 11, -40, -40, -40, -40, -40, -40, -40, -40, -40,
553 -40, -40, -40, -40, -40, -40, -40
554 },
555
556 {
557 11, 42, 42, 43, 42, 42, 42, 42, 42, 42,
558 42, 42, 42, 42, 42, 42, 42
559 },
560
561 {
562 11, 42, 42, 43, 42, 42, 42, 42, 42, 42,
563 42, 42, 42, 42, 42, 42, 42
564 },
565
566 {
567 11, -43, -43, -43, -43, -43, -43, -43, -43, -43,
568 -43, -43, -43, -43, -43, -43, -43
569 },
570
571 {
572 11, -44, -44, -44, -44, -44, -44, -44, -44, -44,
573 -44, -44, -44, 44, -44, -44, -44
574
575 },
576
577 {
578 11, 45, 45, -45, 45, 45, 45, 45, 45, 45,
579 45, 45, 45, 45, 45, 45, 45
580 },
581
582 {
583 11, -46, 46, 47, -46, -46, -46, -46, -46, -46,
584 -46, -46, -46, -46, -46, -46, -46
585 },
586
587 {
588 11, 48, -47, -47, 48, 48, 48, 48, 48, 48,
589 48, 48, 48, 48, 48, 48, 48
590 },
591
592 {
593 11, -48, -48, -48, -48, -48, -48, -48, -48, -48,
594 -48, -48, -48, -48, -48, -48, -48
595 },
596
597 {
598 11, 49, 49, 50, 49, -49, 49, 49, -49, 49,
599 49, 49, 49, 49, 49, -49, 49
600
601 },
602
603 {
604 11, -50, -50, -50, -50, -50, -50, -50, -50, -50,
605 -50, -50, -50, -50, -50, -50, -50
606 },
607
608 {
609 11, -51, -51, 52, -51, -51, -51, -51, -51, -51,
610 -51, -51, -51, -51, -51, -51, -51
611 },
612
613 {
614 11, -52, -52, -52, -52, -52, -52, -52, -52, -52,
615 -52, -52, -52, -52, -52, -52, -52
616 },
617
618 {
619 11, -53, -53, -53, -53, -53, -53, -53, -53, -53,
620 -53, -53, -53, -53, -53, -53, -53
621 },
622
623 {
624 11, 54, 54, -54, 54, 54, 54, 54, 54, 54,
625 54, 54, 54, 54, 54, 54, 54
626
627 },
628
629 {
630 11, -55, -55, -55, -55, -55, -55, -55, -55, -55,
631 -55, -55, -55, -55, -55, -55, -55
632 },
633
634 {
635 11, -56, -56, -56, -56, -56, -56, -56, -56, -56,
636 -56, 60, 57, 57, -56, -56, -56
637 },
638
639 {
640 11, -57, -57, -57, -57, -57, -57, -57, -57, -57,
641 -57, 57, 57, 57, -57, -57, -57
642 },
643
644 {
645 11, -58, -58, -58, -58, -58, -58, -58, -58, -58,
646 -58, -58, -58, -58, -58, -58, -58
647 },
648
649 {
650 11, -59, -59, -59, -59, -59, -59, -59, -59, -59,
651 -59, -59, -59, -59, -59, -59, -59
652
653 },
654
655 {
656 11, -60, -60, -60, -60, -60, -60, -60, -60, -60,
657 -60, 57, 57, 57, -60, -60, -60
658 },
659
660 } ;
661
662static yy_state_type yy_get_previous_state (void );
663static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
664static int yy_get_next_buffer (void );
665static void yy_fatal_error (yyconst char msg[] );
666
667/* Done after the current pattern has been matched and before the
668 * corresponding action - sets up zconftext.
669 */
670#define YY_DO_BEFORE_ACTION \
671 (yytext_ptr) = yy_bp; \
672 zconfleng = (size_t) (yy_cp - yy_bp); \
673 (yy_hold_char) = *yy_cp; \
674 *yy_cp = '\0'; \
675 (yy_c_buf_p) = yy_cp;
676
677#define YY_NUM_RULES 33
678#define YY_END_OF_BUFFER 34
679/* This struct is not used in this scanner,
680 but its presence is necessary. */
681struct yy_trans_info
682 {
683 flex_int32_t yy_verify;
684 flex_int32_t yy_nxt;
685 };
686static yyconst flex_int16_t yy_accept[61] =
687 { 0,
688 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
689 34, 5, 4, 2, 3, 7, 8, 6, 32, 29,
690 31, 24, 28, 27, 26, 22, 17, 13, 16, 20,
691 22, 11, 12, 19, 19, 14, 22, 22, 4, 2,
692 3, 3, 1, 6, 32, 29, 31, 30, 24, 23,
693 26, 25, 15, 20, 9, 19, 19, 21, 10, 18
694 } ;
695
696static yyconst flex_int32_t yy_ec[256] =
697 { 0,
698 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
699 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
700 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
701 1, 2, 4, 5, 6, 1, 1, 7, 8, 9,
702 10, 1, 1, 1, 11, 12, 12, 13, 13, 13,
703 13, 13, 13, 13, 13, 13, 13, 1, 1, 1,
704 14, 1, 1, 1, 13, 13, 13, 13, 13, 13,
705 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
706 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
707 1, 15, 1, 1, 13, 1, 13, 13, 13, 13,
708
709 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
710 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
711 13, 13, 1, 16, 1, 1, 1, 1, 1, 1,
712 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
713 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
714 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
715 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
716 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
717 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
718 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
719
720 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
721 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
722 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
723 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
724 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
725 1, 1, 1, 1, 1
726 } ;
727
728extern int zconf_flex_debug;
729int zconf_flex_debug = 0;
730
731/* The intent behind this definition is that it'll catch
732 * any uses of REJECT which flex missed.
733 */
734#define REJECT reject_used_but_not_detected
735#define yymore() yymore_used_but_not_detected
736#define YY_MORE_ADJ 0
737#define YY_RESTORE_YY_MORE_OFFSET
738char *zconftext;
739
740/*
741 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
742 * Released under the terms of the GNU GPL v2.0.
743 */
744
745#include <limits.h>
746#include <stdio.h>
747#include <stdlib.h>
748#include <string.h>
749#include <unistd.h>
750
751#define LKC_DIRECT_LINK
752#include "lkc.h"
753
754#define START_STRSIZE 16
755
756static struct {
757 struct file *file;
758 int lineno;
759} current_pos;
760
761static char *text;
762static int text_size, text_asize;
763
764struct buffer {
765 struct buffer *parent;
766 YY_BUFFER_STATE state;
767};
768
769struct buffer *current_buf;
770
771static int last_ts, first_ts;
772
773static void zconf_endhelp(void);
774static void zconf_endfile(void);
775
776void new_string(void)
777{
778 text = malloc(START_STRSIZE);
779 text_asize = START_STRSIZE;
780 text_size = 0;
781 *text = 0;
782}
783
784void append_string(const char *str, int size)
785{
786 int new_size = text_size + size + 1;
Bernhard Reutner-Fischer627052e2008-07-17 08:02:28 +0000787 if (size > 70) {
788 fprintf (stderr, "%s:%d error: Overlong line\n",
789 current_file->name, current_file->lineno);
790 }
791
Denis Vlasenko7d219aa2006-10-05 10:17:08 +0000792 if (new_size > text_asize) {
793 new_size += START_STRSIZE - 1;
794 new_size &= -START_STRSIZE;
795 text = realloc(text, new_size);
796 text_asize = new_size;
797 }
798 memcpy(text + text_size, str, size);
799 text_size += size;
800 text[text_size] = 0;
801}
802
803void alloc_string(const char *str, int size)
804{
805 text = malloc(size + 1);
806 memcpy(text, str, size);
807 text[size] = 0;
808}
809
810#define INITIAL 0
811#define COMMAND 1
812#define HELP 2
813#define STRING 3
814#define PARAM 4
815
816#ifndef YY_NO_UNISTD_H
817/* Special case for "unistd.h", since it is non-ANSI. We include it way
818 * down here because we want the user's section 1 to have been scanned first.
819 * The user has a chance to override it with an option.
820 */
821#include <unistd.h>
822#endif
823
824#ifndef YY_EXTRA_TYPE
825#define YY_EXTRA_TYPE void *
826#endif
827
828/* Macros after this point can all be overridden by user definitions in
829 * section 1.
830 */
831
832#ifndef YY_SKIP_YYWRAP
833#ifdef __cplusplus
834extern "C" int zconfwrap (void );
835#else
836extern int zconfwrap (void );
837#endif
838#endif
839
840 static void yyunput (int c,char *buf_ptr );
Denis Vlasenkof7996f32007-01-11 17:20:00 +0000841
Denis Vlasenko7d219aa2006-10-05 10:17:08 +0000842#ifndef yytext_ptr
843static void yy_flex_strncpy (char *,yyconst char *,int );
844#endif
845
846#ifdef YY_NEED_STRLEN
847static int yy_flex_strlen (yyconst char * );
848#endif
849
Denis Vlasenko7c053262008-07-09 20:07:59 +0000850//bbox: suppressing "defined but not used" warning
851#define YY_NO_INPUT 1
852
Denis Vlasenko7d219aa2006-10-05 10:17:08 +0000853#ifndef YY_NO_INPUT
854
855#ifdef __cplusplus
856static int yyinput (void );
857#else
858static int input (void );
859#endif
860
861#endif
862
863/* Amount of stuff to slurp up with each read. */
864#ifndef YY_READ_BUF_SIZE
865#define YY_READ_BUF_SIZE 8192
866#endif
867
868/* Copy whatever the last rule matched to the standard output. */
869#ifndef ECHO
870/* This used to be an fputs(), but since the string might contain NUL's,
871 * we now use fwrite().
872 */
873#define ECHO (void) fwrite( zconftext, zconfleng, 1, zconfout )
874#endif
875
876/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
877 * is returned in "result".
878 */
879#ifndef YY_INPUT
880#define YY_INPUT(buf,result,max_size) \
881 errno=0; \
882 while ( (result = read( fileno(zconfin), (char *) buf, max_size )) < 0 ) \
883 { \
884 if( errno != EINTR) \
885 { \
886 YY_FATAL_ERROR( "input in flex scanner failed" ); \
887 break; \
888 } \
889 errno=0; \
890 clearerr(zconfin); \
891 }\
892\
893
894#endif
895
896/* No semi-colon after return; correct usage is to write "yyterminate();" -
897 * we don't want an extra ';' after the "return" because that will cause
898 * some compilers to complain about unreachable statements.
899 */
900#ifndef yyterminate
901#define yyterminate() return YY_NULL
902#endif
903
904/* Number of entries by which start-condition stack grows. */
905#ifndef YY_START_STACK_INCR
906#define YY_START_STACK_INCR 25
907#endif
908
909/* Report a fatal error. */
910#ifndef YY_FATAL_ERROR
911#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
912#endif
913
914/* end tables serialization structures and prototypes */
915
916/* Default declaration of generated scanner - a define so the user can
917 * easily add parameters.
918 */
919#ifndef YY_DECL
920#define YY_DECL_IS_OURS 1
921
922extern int zconflex (void);
923
924#define YY_DECL int zconflex (void)
925#endif /* !YY_DECL */
926
927/* Code executed at the beginning of each rule, after zconftext and zconfleng
928 * have been set up.
929 */
930#ifndef YY_USER_ACTION
931#define YY_USER_ACTION
932#endif
933
934/* Code executed at the end of each rule. */
935#ifndef YY_BREAK
936#define YY_BREAK break;
937#endif
938
939#define YY_RULE_SETUP \
940 YY_USER_ACTION
941
942/** The main scanner function which does all the work.
943 */
944YY_DECL
945{
946 register yy_state_type yy_current_state;
947 register char *yy_cp, *yy_bp;
948 register int yy_act;
Denis Vlasenkof7996f32007-01-11 17:20:00 +0000949
Denis Vlasenko7d219aa2006-10-05 10:17:08 +0000950 int str = 0;
951 int ts, i;
952
953 if ( (yy_init) )
954 {
955 (yy_init) = 0;
956
957#ifdef YY_USER_INIT
958 YY_USER_INIT;
959#endif
960
961 if ( ! (yy_start) )
962 (yy_start) = 1; /* first start state */
963
964 if ( ! zconfin )
965 zconfin = stdin;
966
967 if ( ! zconfout )
968 zconfout = stdout;
969
970 if ( ! YY_CURRENT_BUFFER ) {
971 zconfensure_buffer_stack ();
972 YY_CURRENT_BUFFER_LVALUE =
973 zconf_create_buffer(zconfin,YY_BUF_SIZE );
974 }
975
976 zconf_load_buffer_state( );
977 }
978
979 while ( 1 ) /* loops until end-of-file is reached */
980 {
981 yy_cp = (yy_c_buf_p);
982
983 /* Support of zconftext. */
984 *yy_cp = (yy_hold_char);
985
986 /* yy_bp points to the position in yy_ch_buf of the start of
987 * the current run.
988 */
989 yy_bp = yy_cp;
990
991 yy_current_state = (yy_start);
992yy_match:
993 while ( (yy_current_state = yy_nxt[yy_current_state][ yy_ec[YY_SC_TO_UI(*yy_cp)] ]) > 0 )
994 ++yy_cp;
995
996 yy_current_state = -yy_current_state;
997
998yy_find_action:
999 yy_act = yy_accept[yy_current_state];
1000
1001 YY_DO_BEFORE_ACTION;
1002
1003do_action: /* This label is used only to access EOF actions. */
1004
1005 switch ( yy_act )
1006 { /* beginning of action switch */
1007case 1:
1008/* rule 1 can match eol */
1009case 2:
1010/* rule 2 can match eol */
1011YY_RULE_SETUP
1012{
1013 current_file->lineno++;
1014 return T_EOL;
1015}
1016 YY_BREAK
1017case 3:
1018YY_RULE_SETUP
1019
1020 YY_BREAK
1021case 4:
1022YY_RULE_SETUP
1023{
1024 BEGIN(COMMAND);
1025}
1026 YY_BREAK
1027case 5:
1028YY_RULE_SETUP
1029{
1030 unput(zconftext[0]);
1031 BEGIN(COMMAND);
1032}
1033 YY_BREAK
1034
1035case 6:
1036YY_RULE_SETUP
1037{
1038 struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng);
1039 BEGIN(PARAM);
1040 current_pos.file = current_file;
1041 current_pos.lineno = current_file->lineno;
1042 if (id && id->flags & TF_COMMAND) {
1043 zconflval.id = id;
1044 return id->token;
1045 }
1046 alloc_string(zconftext, zconfleng);
1047 zconflval.string = text;
1048 return T_WORD;
1049 }
1050 YY_BREAK
1051case 7:
1052YY_RULE_SETUP
1053
1054 YY_BREAK
1055case 8:
1056/* rule 8 can match eol */
1057YY_RULE_SETUP
1058{
1059 BEGIN(INITIAL);
1060 current_file->lineno++;
1061 return T_EOL;
1062 }
1063 YY_BREAK
1064
1065case 9:
1066YY_RULE_SETUP
1067return T_AND;
1068 YY_BREAK
1069case 10:
1070YY_RULE_SETUP
1071return T_OR;
1072 YY_BREAK
1073case 11:
1074YY_RULE_SETUP
1075return T_OPEN_PAREN;
1076 YY_BREAK
1077case 12:
1078YY_RULE_SETUP
1079return T_CLOSE_PAREN;
1080 YY_BREAK
1081case 13:
1082YY_RULE_SETUP
1083return T_NOT;
1084 YY_BREAK
1085case 14:
1086YY_RULE_SETUP
1087return T_EQUAL;
1088 YY_BREAK
1089case 15:
1090YY_RULE_SETUP
1091return T_UNEQUAL;
1092 YY_BREAK
1093case 16:
1094YY_RULE_SETUP
1095{
1096 str = zconftext[0];
1097 new_string();
1098 BEGIN(STRING);
1099 }
1100 YY_BREAK
1101case 17:
1102/* rule 17 can match eol */
1103YY_RULE_SETUP
1104BEGIN(INITIAL); current_file->lineno++; return T_EOL;
1105 YY_BREAK
1106case 18:
1107YY_RULE_SETUP
1108/* ignore */
1109 YY_BREAK
1110case 19:
1111YY_RULE_SETUP
1112{
1113 struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng);
1114 if (id && id->flags & TF_PARAM) {
1115 zconflval.id = id;
1116 return id->token;
1117 }
1118 alloc_string(zconftext, zconfleng);
1119 zconflval.string = text;
1120 return T_WORD;
1121 }
1122 YY_BREAK
1123case 20:
1124YY_RULE_SETUP
1125/* comment */
1126 YY_BREAK
1127case 21:
1128/* rule 21 can match eol */
1129YY_RULE_SETUP
1130current_file->lineno++;
1131 YY_BREAK
1132case 22:
1133YY_RULE_SETUP
1134
1135 YY_BREAK
1136case YY_STATE_EOF(PARAM):
1137{
1138 BEGIN(INITIAL);
1139 }
1140 YY_BREAK
1141
1142case 23:
1143/* rule 23 can match eol */
1144*yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */
1145(yy_c_buf_p) = yy_cp -= 1;
1146YY_DO_BEFORE_ACTION; /* set up zconftext again */
1147YY_RULE_SETUP
1148{
1149 append_string(zconftext, zconfleng);
1150 zconflval.string = text;
1151 return T_WORD_QUOTE;
1152 }
1153 YY_BREAK
1154case 24:
1155YY_RULE_SETUP
1156{
1157 append_string(zconftext, zconfleng);
1158 }
1159 YY_BREAK
1160case 25:
1161/* rule 25 can match eol */
1162*yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */
1163(yy_c_buf_p) = yy_cp -= 1;
1164YY_DO_BEFORE_ACTION; /* set up zconftext again */
1165YY_RULE_SETUP
1166{
1167 append_string(zconftext + 1, zconfleng - 1);
1168 zconflval.string = text;
1169 return T_WORD_QUOTE;
1170 }
1171 YY_BREAK
1172case 26:
1173YY_RULE_SETUP
1174{
1175 append_string(zconftext + 1, zconfleng - 1);
1176 }
1177 YY_BREAK
1178case 27:
1179YY_RULE_SETUP
1180{
1181 if (str == zconftext[0]) {
1182 BEGIN(PARAM);
1183 zconflval.string = text;
1184 return T_WORD_QUOTE;
1185 } else
1186 append_string(zconftext, 1);
1187 }
1188 YY_BREAK
1189case 28:
1190/* rule 28 can match eol */
1191YY_RULE_SETUP
1192{
1193 printf("%s:%d:warning: multi-line strings not supported\n", zconf_curname(), zconf_lineno());
1194 current_file->lineno++;
1195 BEGIN(INITIAL);
1196 return T_EOL;
1197 }
1198 YY_BREAK
1199case YY_STATE_EOF(STRING):
1200{
1201 BEGIN(INITIAL);
1202 }
1203 YY_BREAK
1204
1205case 29:
1206YY_RULE_SETUP
1207{
1208 ts = 0;
1209 for (i = 0; i < zconfleng; i++) {
1210 if (zconftext[i] == '\t')
1211 ts = (ts & ~7) + 8;
1212 else
1213 ts++;
1214 }
1215 last_ts = ts;
1216 if (first_ts) {
1217 if (ts < first_ts) {
1218 zconf_endhelp();
1219 return T_HELPTEXT;
1220 }
1221 ts -= first_ts;
1222 while (ts > 8) {
1223 append_string(" ", 8);
1224 ts -= 8;
1225 }
1226 append_string(" ", ts);
1227 }
1228 }
1229 YY_BREAK
1230case 30:
1231/* rule 30 can match eol */
1232*yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */
1233(yy_c_buf_p) = yy_cp -= 1;
1234YY_DO_BEFORE_ACTION; /* set up zconftext again */
1235YY_RULE_SETUP
1236{
1237 current_file->lineno++;
1238 zconf_endhelp();
1239 return T_HELPTEXT;
1240 }
1241 YY_BREAK
1242case 31:
1243/* rule 31 can match eol */
1244YY_RULE_SETUP
1245{
1246 current_file->lineno++;
1247 append_string("\n", 1);
1248 }
1249 YY_BREAK
1250case 32:
1251YY_RULE_SETUP
1252{
1253 append_string(zconftext, zconfleng);
1254 if (!first_ts)
1255 first_ts = last_ts;
1256 }
1257 YY_BREAK
1258case YY_STATE_EOF(HELP):
1259{
1260 zconf_endhelp();
1261 return T_HELPTEXT;
1262 }
1263 YY_BREAK
1264
1265case YY_STATE_EOF(INITIAL):
1266case YY_STATE_EOF(COMMAND):
1267{
1268 if (current_file) {
1269 zconf_endfile();
1270 return T_EOL;
1271 }
1272 fclose(zconfin);
1273 yyterminate();
1274}
1275 YY_BREAK
1276case 33:
1277YY_RULE_SETUP
1278YY_FATAL_ERROR( "flex scanner jammed" );
1279 YY_BREAK
1280
1281 case YY_END_OF_BUFFER:
1282 {
1283 /* Amount of text matched not including the EOB char. */
1284 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1285
1286 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1287 *yy_cp = (yy_hold_char);
1288 YY_RESTORE_YY_MORE_OFFSET
1289
1290 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1291 {
1292 /* We're scanning a new file or input source. It's
1293 * possible that this happened because the user
1294 * just pointed zconfin at a new source and called
1295 * zconflex(). If so, then we have to assure
1296 * consistency between YY_CURRENT_BUFFER and our
1297 * globals. Here is the right place to do so, because
1298 * this is the first action (other than possibly a
1299 * back-up) that will match for the new input source.
1300 */
1301 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1302 YY_CURRENT_BUFFER_LVALUE->yy_input_file = zconfin;
1303 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1304 }
1305
1306 /* Note that here we test for yy_c_buf_p "<=" to the position
1307 * of the first EOB in the buffer, since yy_c_buf_p will
1308 * already have been incremented past the NUL character
1309 * (since all states make transitions on EOB to the
1310 * end-of-buffer state). Contrast this with the test
1311 * in input().
1312 */
1313 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1314 { /* This was really a NUL. */
1315 yy_state_type yy_next_state;
1316
1317 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1318
1319 yy_current_state = yy_get_previous_state( );
1320
1321 /* Okay, we're now positioned to make the NUL
1322 * transition. We couldn't have
1323 * yy_get_previous_state() go ahead and do it
1324 * for us because it doesn't know how to deal
1325 * with the possibility of jamming (and we don't
1326 * want to build jamming into it because then it
1327 * will run more slowly).
1328 */
1329
1330 yy_next_state = yy_try_NUL_trans( yy_current_state );
1331
1332 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1333
1334 if ( yy_next_state )
1335 {
1336 /* Consume the NUL. */
1337 yy_cp = ++(yy_c_buf_p);
1338 yy_current_state = yy_next_state;
1339 goto yy_match;
1340 }
1341
1342 else
1343 {
1344 yy_cp = (yy_c_buf_p);
1345 goto yy_find_action;
1346 }
1347 }
1348
1349 else switch ( yy_get_next_buffer( ) )
1350 {
1351 case EOB_ACT_END_OF_FILE:
1352 {
1353 (yy_did_buffer_switch_on_eof) = 0;
1354
1355 if ( zconfwrap( ) )
1356 {
1357 /* Note: because we've taken care in
1358 * yy_get_next_buffer() to have set up
1359 * zconftext, we can now set up
1360 * yy_c_buf_p so that if some total
1361 * hoser (like flex itself) wants to
1362 * call the scanner after we return the
1363 * YY_NULL, it'll still work - another
1364 * YY_NULL will get returned.
1365 */
1366 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1367
1368 yy_act = YY_STATE_EOF(YY_START);
1369 goto do_action;
1370 }
1371
1372 else
1373 {
1374 if ( ! (yy_did_buffer_switch_on_eof) )
1375 YY_NEW_FILE;
1376 }
1377 break;
1378 }
1379
1380 case EOB_ACT_CONTINUE_SCAN:
1381 (yy_c_buf_p) =
1382 (yytext_ptr) + yy_amount_of_matched_text;
1383
1384 yy_current_state = yy_get_previous_state( );
1385
1386 yy_cp = (yy_c_buf_p);
1387 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1388 goto yy_match;
1389
1390 case EOB_ACT_LAST_MATCH:
1391 (yy_c_buf_p) =
1392 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1393
1394 yy_current_state = yy_get_previous_state( );
1395
1396 yy_cp = (yy_c_buf_p);
1397 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1398 goto yy_find_action;
1399 }
1400 break;
1401 }
1402
1403 default:
1404 YY_FATAL_ERROR(
1405 "fatal flex scanner internal error--no action found" );
1406 } /* end of action switch */
1407 } /* end of scanning one token */
1408} /* end of zconflex */
1409
1410/* yy_get_next_buffer - try to read in a new buffer
1411 *
1412 * Returns a code representing an action:
1413 * EOB_ACT_LAST_MATCH -
1414 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1415 * EOB_ACT_END_OF_FILE - end of file
1416 */
1417static int yy_get_next_buffer (void)
1418{
1419 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1420 register char *source = (yytext_ptr);
1421 register int number_to_move, i;
1422 int ret_val;
1423
1424 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1425 YY_FATAL_ERROR(
1426 "fatal flex scanner internal error--end of buffer missed" );
1427
1428 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1429 { /* Don't try to fill the buffer, so this is an EOF. */
1430 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1431 {
1432 /* We matched a single character, the EOB, so
1433 * treat this as a final EOF.
1434 */
1435 return EOB_ACT_END_OF_FILE;
1436 }
1437
1438 else
1439 {
1440 /* We matched some text prior to the EOB, first
1441 * process it.
1442 */
1443 return EOB_ACT_LAST_MATCH;
1444 }
1445 }
1446
1447 /* Try to read more data. */
1448
1449 /* First move last chars to start of buffer. */
1450 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1451
1452 for ( i = 0; i < number_to_move; ++i )
1453 *(dest++) = *(source++);
1454
1455 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1456 /* don't do the read, it's not guaranteed to return an EOF,
1457 * just force an EOF
1458 */
1459 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1460
1461 else
1462 {
1463 size_t num_to_read =
1464 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1465
1466 while ( num_to_read <= 0 )
1467 { /* Not enough room in the buffer - grow it. */
1468
1469 /* just a shorter name for the current buffer */
1470 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1471
1472 int yy_c_buf_p_offset =
1473 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1474
1475 if ( b->yy_is_our_buffer )
1476 {
1477 int new_size = b->yy_buf_size * 2;
1478
1479 if ( new_size <= 0 )
1480 b->yy_buf_size += b->yy_buf_size / 8;
1481 else
1482 b->yy_buf_size *= 2;
1483
1484 b->yy_ch_buf = (char *)
1485 /* Include room in for 2 EOB chars. */
1486 zconfrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1487 }
1488 else
1489 /* Can't grow it, we don't own it. */
1490 b->yy_ch_buf = 0;
1491
1492 if ( ! b->yy_ch_buf )
1493 YY_FATAL_ERROR(
1494 "fatal error - scanner input buffer overflow" );
1495
1496 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1497
1498 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1499 number_to_move - 1;
1500
1501 }
1502
1503 if ( num_to_read > YY_READ_BUF_SIZE )
1504 num_to_read = YY_READ_BUF_SIZE;
1505
1506 /* Read in more data. */
1507 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1508 (yy_n_chars), num_to_read );
1509
1510 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1511 }
1512
1513 if ( (yy_n_chars) == 0 )
1514 {
1515 if ( number_to_move == YY_MORE_ADJ )
1516 {
1517 ret_val = EOB_ACT_END_OF_FILE;
1518 zconfrestart(zconfin );
1519 }
1520
1521 else
1522 {
1523 ret_val = EOB_ACT_LAST_MATCH;
1524 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1525 YY_BUFFER_EOF_PENDING;
1526 }
1527 }
1528
1529 else
1530 ret_val = EOB_ACT_CONTINUE_SCAN;
1531
1532 (yy_n_chars) += number_to_move;
1533 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1534 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1535
1536 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1537
1538 return ret_val;
1539}
1540
1541/* yy_get_previous_state - get the state just before the EOB char was reached */
1542
1543 static yy_state_type yy_get_previous_state (void)
1544{
1545 register yy_state_type yy_current_state;
1546 register char *yy_cp;
Denis Vlasenkof7996f32007-01-11 17:20:00 +00001547
Denis Vlasenko7d219aa2006-10-05 10:17:08 +00001548 yy_current_state = (yy_start);
1549
1550 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1551 {
1552 yy_current_state = yy_nxt[yy_current_state][(*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1)];
1553 }
1554
1555 return yy_current_state;
1556}
1557
1558/* yy_try_NUL_trans - try to make a transition on the NUL character
1559 *
1560 * synopsis
1561 * next_state = yy_try_NUL_trans( current_state );
1562 */
1563 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1564{
1565 register int yy_is_jam;
Denis Vlasenkof7996f32007-01-11 17:20:00 +00001566
Denis Vlasenko7d219aa2006-10-05 10:17:08 +00001567 yy_current_state = yy_nxt[yy_current_state][1];
1568 yy_is_jam = (yy_current_state <= 0);
1569
1570 return yy_is_jam ? 0 : yy_current_state;
1571}
1572
1573 static void yyunput (int c, register char * yy_bp )
1574{
1575 register char *yy_cp;
Denis Vlasenkof7996f32007-01-11 17:20:00 +00001576
Denis Vlasenko7d219aa2006-10-05 10:17:08 +00001577 yy_cp = (yy_c_buf_p);
1578
1579 /* undo effects of setting up zconftext */
1580 *yy_cp = (yy_hold_char);
1581
1582 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1583 { /* need to shift things up to make room */
1584 /* +2 for EOB chars. */
1585 register int number_to_move = (yy_n_chars) + 2;
1586 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1587 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1588 register char *source =
1589 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1590
1591 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1592 *--dest = *--source;
1593
1594 yy_cp += (int) (dest - source);
1595 yy_bp += (int) (dest - source);
1596 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1597 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1598
1599 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1600 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1601 }
1602
1603 *--yy_cp = (char) c;
1604
1605 (yytext_ptr) = yy_bp;
1606 (yy_hold_char) = *yy_cp;
1607 (yy_c_buf_p) = yy_cp;
1608}
1609
1610#ifndef YY_NO_INPUT
1611#ifdef __cplusplus
1612 static int yyinput (void)
1613#else
1614 static int input (void)
1615#endif
1616
1617{
1618 int c;
Denis Vlasenkof7996f32007-01-11 17:20:00 +00001619
Denis Vlasenko7d219aa2006-10-05 10:17:08 +00001620 *(yy_c_buf_p) = (yy_hold_char);
1621
1622 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1623 {
1624 /* yy_c_buf_p now points to the character we want to return.
1625 * If this occurs *before* the EOB characters, then it's a
1626 * valid NUL; if not, then we've hit the end of the buffer.
1627 */
1628 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1629 /* This was really a NUL. */
1630 *(yy_c_buf_p) = '\0';
1631
1632 else
1633 { /* need more input */
1634 int offset = (yy_c_buf_p) - (yytext_ptr);
1635 ++(yy_c_buf_p);
1636
1637 switch ( yy_get_next_buffer( ) )
1638 {
1639 case EOB_ACT_LAST_MATCH:
1640 /* This happens because yy_g_n_b()
1641 * sees that we've accumulated a
1642 * token and flags that we need to
1643 * try matching the token before
1644 * proceeding. But for input(),
1645 * there's no matching to consider.
1646 * So convert the EOB_ACT_LAST_MATCH
1647 * to EOB_ACT_END_OF_FILE.
1648 */
1649
1650 /* Reset buffer status. */
1651 zconfrestart(zconfin );
1652
1653 /*FALLTHROUGH*/
1654
1655 case EOB_ACT_END_OF_FILE:
1656 {
1657 if ( zconfwrap( ) )
1658 return EOF;
1659
1660 if ( ! (yy_did_buffer_switch_on_eof) )
1661 YY_NEW_FILE;
1662#ifdef __cplusplus
1663 return yyinput();
1664#else
1665 return input();
1666#endif
1667 }
1668
1669 case EOB_ACT_CONTINUE_SCAN:
1670 (yy_c_buf_p) = (yytext_ptr) + offset;
1671 break;
1672 }
1673 }
1674 }
1675
1676 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1677 *(yy_c_buf_p) = '\0'; /* preserve zconftext */
1678 (yy_hold_char) = *++(yy_c_buf_p);
1679
1680 return c;
1681}
1682#endif /* ifndef YY_NO_INPUT */
1683
1684/** Immediately switch to a different input stream.
1685 * @param input_file A readable stream.
Denis Vlasenkof7996f32007-01-11 17:20:00 +00001686 *
Denis Vlasenko7d219aa2006-10-05 10:17:08 +00001687 * @note This function does not reset the start condition to @c INITIAL .
1688 */
1689 void zconfrestart (FILE * input_file )
1690{
Denis Vlasenkof7996f32007-01-11 17:20:00 +00001691
Denis Vlasenko7d219aa2006-10-05 10:17:08 +00001692 if ( ! YY_CURRENT_BUFFER ){
1693 zconfensure_buffer_stack ();
1694 YY_CURRENT_BUFFER_LVALUE =
1695 zconf_create_buffer(zconfin,YY_BUF_SIZE );
1696 }
1697
1698 zconf_init_buffer(YY_CURRENT_BUFFER,input_file );
1699 zconf_load_buffer_state( );
1700}
1701
1702/** Switch to a different input buffer.
1703 * @param new_buffer The new input buffer.
Denis Vlasenkof7996f32007-01-11 17:20:00 +00001704 *
Denis Vlasenko7d219aa2006-10-05 10:17:08 +00001705 */
1706 void zconf_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1707{
Denis Vlasenkof7996f32007-01-11 17:20:00 +00001708
Denis Vlasenko7d219aa2006-10-05 10:17:08 +00001709 /* TODO. We should be able to replace this entire function body
1710 * with
1711 * zconfpop_buffer_state();
1712 * zconfpush_buffer_state(new_buffer);
1713 */
1714 zconfensure_buffer_stack ();
1715 if ( YY_CURRENT_BUFFER == new_buffer )
1716 return;
1717
1718 if ( YY_CURRENT_BUFFER )
1719 {
1720 /* Flush out information for old buffer. */
1721 *(yy_c_buf_p) = (yy_hold_char);
1722 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1723 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1724 }
1725
1726 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1727 zconf_load_buffer_state( );
1728
1729 /* We don't actually know whether we did this switch during
1730 * EOF (zconfwrap()) processing, but the only time this flag
1731 * is looked at is after zconfwrap() is called, so it's safe
1732 * to go ahead and always set it.
1733 */
1734 (yy_did_buffer_switch_on_eof) = 1;
1735}
1736
1737static void zconf_load_buffer_state (void)
1738{
1739 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1740 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1741 zconfin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1742 (yy_hold_char) = *(yy_c_buf_p);
1743}
1744
1745/** Allocate and initialize an input buffer state.
1746 * @param file A readable stream.
1747 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
Denis Vlasenkof7996f32007-01-11 17:20:00 +00001748 *
Denis Vlasenko7d219aa2006-10-05 10:17:08 +00001749 * @return the allocated buffer state.
1750 */
1751 YY_BUFFER_STATE zconf_create_buffer (FILE * file, int size )
1752{
1753 YY_BUFFER_STATE b;
Denis Vlasenkof7996f32007-01-11 17:20:00 +00001754
Denis Vlasenko7d219aa2006-10-05 10:17:08 +00001755 b = (YY_BUFFER_STATE) zconfalloc(sizeof( struct yy_buffer_state ) );
1756 if ( ! b )
1757 YY_FATAL_ERROR( "out of dynamic memory in zconf_create_buffer()" );
1758
1759 b->yy_buf_size = size;
1760
1761 /* yy_ch_buf has to be 2 characters longer than the size given because
1762 * we need to put in 2 end-of-buffer characters.
1763 */
1764 b->yy_ch_buf = (char *) zconfalloc(b->yy_buf_size + 2 );
1765 if ( ! b->yy_ch_buf )
1766 YY_FATAL_ERROR( "out of dynamic memory in zconf_create_buffer()" );
1767
1768 b->yy_is_our_buffer = 1;
1769
1770 zconf_init_buffer(b,file );
1771
1772 return b;
1773}
1774
1775/** Destroy the buffer.
1776 * @param b a buffer created with zconf_create_buffer()
Denis Vlasenkof7996f32007-01-11 17:20:00 +00001777 *
Denis Vlasenko7d219aa2006-10-05 10:17:08 +00001778 */
1779 void zconf_delete_buffer (YY_BUFFER_STATE b )
1780{
Denis Vlasenkof7996f32007-01-11 17:20:00 +00001781
Denis Vlasenko7d219aa2006-10-05 10:17:08 +00001782 if ( ! b )
1783 return;
1784
1785 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1786 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1787
1788 if ( b->yy_is_our_buffer )
1789 zconffree((void *) b->yy_ch_buf );
1790
1791 zconffree((void *) b );
1792}
1793
1794/* Initializes or reinitializes a buffer.
1795 * This function is sometimes called more than once on the same buffer,
1796 * such as during a zconfrestart() or at EOF.
1797 */
1798 static void zconf_init_buffer (YY_BUFFER_STATE b, FILE * file )
1799
1800{
1801 int oerrno = errno;
Denis Vlasenkof7996f32007-01-11 17:20:00 +00001802
Denis Vlasenko7d219aa2006-10-05 10:17:08 +00001803 zconf_flush_buffer(b );
1804
1805 b->yy_input_file = file;
1806 b->yy_fill_buffer = 1;
1807
1808 /* If b is the current buffer, then zconf_init_buffer was _probably_
1809 * called from zconfrestart() or through yy_get_next_buffer.
1810 * In that case, we don't want to reset the lineno or column.
1811 */
1812 if (b != YY_CURRENT_BUFFER){
1813 b->yy_bs_lineno = 1;
1814 b->yy_bs_column = 0;
1815 }
1816
1817 b->yy_is_interactive = 0;
Denis Vlasenkof7996f32007-01-11 17:20:00 +00001818
Denis Vlasenko7d219aa2006-10-05 10:17:08 +00001819 errno = oerrno;
1820}
1821
1822/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1823 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
Denis Vlasenkof7996f32007-01-11 17:20:00 +00001824 *
Denis Vlasenko7d219aa2006-10-05 10:17:08 +00001825 */
1826 void zconf_flush_buffer (YY_BUFFER_STATE b )
1827{
1828 if ( ! b )
1829 return;
1830
1831 b->yy_n_chars = 0;
1832
1833 /* We always need two end-of-buffer characters. The first causes
1834 * a transition to the end-of-buffer state. The second causes
1835 * a jam in that state.
1836 */
1837 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1838 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1839
1840 b->yy_buf_pos = &b->yy_ch_buf[0];
1841
1842 b->yy_at_bol = 1;
1843 b->yy_buffer_status = YY_BUFFER_NEW;
1844
1845 if ( b == YY_CURRENT_BUFFER )
1846 zconf_load_buffer_state( );
1847}
1848
1849/** Pushes the new state onto the stack. The new state becomes
1850 * the current state. This function will allocate the stack
1851 * if necessary.
1852 * @param new_buffer The new state.
Denis Vlasenkof7996f32007-01-11 17:20:00 +00001853 *
Denis Vlasenko7d219aa2006-10-05 10:17:08 +00001854 */
1855void zconfpush_buffer_state (YY_BUFFER_STATE new_buffer )
1856{
1857 if (new_buffer == NULL)
1858 return;
1859
1860 zconfensure_buffer_stack();
1861
1862 /* This block is copied from zconf_switch_to_buffer. */
1863 if ( YY_CURRENT_BUFFER )
1864 {
1865 /* Flush out information for old buffer. */
1866 *(yy_c_buf_p) = (yy_hold_char);
1867 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1868 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1869 }
1870
1871 /* Only push if top exists. Otherwise, replace top. */
1872 if (YY_CURRENT_BUFFER)
1873 (yy_buffer_stack_top)++;
1874 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1875
1876 /* copied from zconf_switch_to_buffer. */
1877 zconf_load_buffer_state( );
1878 (yy_did_buffer_switch_on_eof) = 1;
1879}
1880
1881/** Removes and deletes the top of the stack, if present.
1882 * The next element becomes the new top.
Denis Vlasenkof7996f32007-01-11 17:20:00 +00001883 *
Denis Vlasenko7d219aa2006-10-05 10:17:08 +00001884 */
1885void zconfpop_buffer_state (void)
1886{
1887 if (!YY_CURRENT_BUFFER)
1888 return;
1889
1890 zconf_delete_buffer(YY_CURRENT_BUFFER );
1891 YY_CURRENT_BUFFER_LVALUE = NULL;
1892 if ((yy_buffer_stack_top) > 0)
1893 --(yy_buffer_stack_top);
1894
1895 if (YY_CURRENT_BUFFER) {
1896 zconf_load_buffer_state( );
1897 (yy_did_buffer_switch_on_eof) = 1;
1898 }
1899}
1900
1901/* Allocates the stack if it does not exist.
1902 * Guarantees space for at least one push.
1903 */
1904static void zconfensure_buffer_stack (void)
1905{
1906 int num_to_alloc;
Denis Vlasenkof7996f32007-01-11 17:20:00 +00001907
Denis Vlasenko7d219aa2006-10-05 10:17:08 +00001908 if (!(yy_buffer_stack)) {
1909
1910 /* First allocation is just for 2 elements, since we don't know if this
1911 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1912 * immediate realloc on the next call.
1913 */
1914 num_to_alloc = 1;
1915 (yy_buffer_stack) = (struct yy_buffer_state**)zconfalloc
1916 (num_to_alloc * sizeof(struct yy_buffer_state*)
1917 );
Denis Vlasenkof7996f32007-01-11 17:20:00 +00001918
Denis Vlasenko7d219aa2006-10-05 10:17:08 +00001919 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
Denis Vlasenkof7996f32007-01-11 17:20:00 +00001920
Denis Vlasenko7d219aa2006-10-05 10:17:08 +00001921 (yy_buffer_stack_max) = num_to_alloc;
1922 (yy_buffer_stack_top) = 0;
1923 return;
1924 }
1925
1926 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1927
1928 /* Increase the buffer to prepare for a possible push. */
1929 int grow_size = 8 /* arbitrary grow size */;
1930
1931 num_to_alloc = (yy_buffer_stack_max) + grow_size;
1932 (yy_buffer_stack) = (struct yy_buffer_state**)zconfrealloc
1933 ((yy_buffer_stack),
1934 num_to_alloc * sizeof(struct yy_buffer_state*)
1935 );
1936
1937 /* zero only the new slots.*/
1938 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1939 (yy_buffer_stack_max) = num_to_alloc;
1940 }
1941}
1942
1943/** Setup the input buffer state to scan directly from a user-specified character buffer.
1944 * @param base the character buffer
1945 * @param size the size in bytes of the character buffer
Denis Vlasenkof7996f32007-01-11 17:20:00 +00001946 *
1947 * @return the newly allocated buffer state object.
Denis Vlasenko7d219aa2006-10-05 10:17:08 +00001948 */
1949YY_BUFFER_STATE zconf_scan_buffer (char * base, yy_size_t size )
1950{
1951 YY_BUFFER_STATE b;
Denis Vlasenkof7996f32007-01-11 17:20:00 +00001952
Denis Vlasenko7d219aa2006-10-05 10:17:08 +00001953 if ( size < 2 ||
1954 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1955 base[size-1] != YY_END_OF_BUFFER_CHAR )
1956 /* They forgot to leave room for the EOB's. */
1957 return 0;
1958
1959 b = (YY_BUFFER_STATE) zconfalloc(sizeof( struct yy_buffer_state ) );
1960 if ( ! b )
1961 YY_FATAL_ERROR( "out of dynamic memory in zconf_scan_buffer()" );
1962
1963 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1964 b->yy_buf_pos = b->yy_ch_buf = base;
1965 b->yy_is_our_buffer = 0;
1966 b->yy_input_file = 0;
1967 b->yy_n_chars = b->yy_buf_size;
1968 b->yy_is_interactive = 0;
1969 b->yy_at_bol = 1;
1970 b->yy_fill_buffer = 0;
1971 b->yy_buffer_status = YY_BUFFER_NEW;
1972
1973 zconf_switch_to_buffer(b );
1974
1975 return b;
1976}
1977
1978/** Setup the input buffer state to scan a string. The next call to zconflex() will
1979 * scan from a @e copy of @a str.
1980 * @param yy_str a NUL-terminated string to scan
Denis Vlasenkof7996f32007-01-11 17:20:00 +00001981 *
Denis Vlasenko7d219aa2006-10-05 10:17:08 +00001982 * @return the newly allocated buffer state object.
1983 * @note If you want to scan bytes that may contain NUL values, then use
1984 * zconf_scan_bytes() instead.
1985 */
1986YY_BUFFER_STATE zconf_scan_string (yyconst char * yy_str )
1987{
Denis Vlasenkof7996f32007-01-11 17:20:00 +00001988
Denis Vlasenko7d219aa2006-10-05 10:17:08 +00001989 return zconf_scan_bytes(yy_str,strlen(yy_str) );
1990}
1991
1992/** Setup the input buffer state to scan the given bytes. The next call to zconflex() will
1993 * scan from a @e copy of @a bytes.
1994 * @param bytes the byte buffer to scan
1995 * @param len the number of bytes in the buffer pointed to by @a bytes.
Denis Vlasenkof7996f32007-01-11 17:20:00 +00001996 *
Denis Vlasenko7d219aa2006-10-05 10:17:08 +00001997 * @return the newly allocated buffer state object.
1998 */
1999YY_BUFFER_STATE zconf_scan_bytes (yyconst char * bytes, int len )
2000{
2001 YY_BUFFER_STATE b;
2002 char *buf;
2003 yy_size_t n;
2004 int i;
Denis Vlasenkof7996f32007-01-11 17:20:00 +00002005
Denis Vlasenko7d219aa2006-10-05 10:17:08 +00002006 /* Get memory for full buffer, including space for trailing EOB's. */
2007 n = len + 2;
2008 buf = (char *) zconfalloc(n );
2009 if ( ! buf )
2010 YY_FATAL_ERROR( "out of dynamic memory in zconf_scan_bytes()" );
2011
2012 for ( i = 0; i < len; ++i )
2013 buf[i] = bytes[i];
2014
2015 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
2016
2017 b = zconf_scan_buffer(buf,n );
2018 if ( ! b )
2019 YY_FATAL_ERROR( "bad buffer in zconf_scan_bytes()" );
2020
2021 /* It's okay to grow etc. this buffer, and we should throw it
2022 * away when we're done.
2023 */
2024 b->yy_is_our_buffer = 1;
2025
2026 return b;
2027}
2028
2029#ifndef YY_EXIT_FAILURE
2030#define YY_EXIT_FAILURE 2
2031#endif
2032
2033static void yy_fatal_error (yyconst char* msg )
2034{
2035 (void) fprintf( stderr, "%s\n", msg );
2036 exit( YY_EXIT_FAILURE );
2037}
2038
2039/* Redefine yyless() so it works in section 3 code. */
2040
2041#undef yyless
2042#define yyless(n) \
2043 do \
2044 { \
2045 /* Undo effects of setting up zconftext. */ \
2046 int yyless_macro_arg = (n); \
2047 YY_LESS_LINENO(yyless_macro_arg);\
2048 zconftext[zconfleng] = (yy_hold_char); \
2049 (yy_c_buf_p) = zconftext + yyless_macro_arg; \
2050 (yy_hold_char) = *(yy_c_buf_p); \
2051 *(yy_c_buf_p) = '\0'; \
2052 zconfleng = yyless_macro_arg; \
2053 } \
2054 while ( 0 )
2055
2056/* Accessor methods (get/set functions) to struct members. */
2057
2058/** Get the current line number.
Denis Vlasenkof7996f32007-01-11 17:20:00 +00002059 *
Denis Vlasenko7d219aa2006-10-05 10:17:08 +00002060 */
2061int zconfget_lineno (void)
2062{
Denis Vlasenkof7996f32007-01-11 17:20:00 +00002063
Denis Vlasenko7d219aa2006-10-05 10:17:08 +00002064 return zconflineno;
2065}
2066
2067/** Get the input stream.
Denis Vlasenkof7996f32007-01-11 17:20:00 +00002068 *
Denis Vlasenko7d219aa2006-10-05 10:17:08 +00002069 */
2070FILE *zconfget_in (void)
2071{
2072 return zconfin;
2073}
2074
2075/** Get the output stream.
Denis Vlasenkof7996f32007-01-11 17:20:00 +00002076 *
Denis Vlasenko7d219aa2006-10-05 10:17:08 +00002077 */
2078FILE *zconfget_out (void)
2079{
2080 return zconfout;
2081}
2082
2083/** Get the length of the current token.
Denis Vlasenkof7996f32007-01-11 17:20:00 +00002084 *
Denis Vlasenko7d219aa2006-10-05 10:17:08 +00002085 */
2086int zconfget_leng (void)
2087{
2088 return zconfleng;
2089}
2090
2091/** Get the current token.
Denis Vlasenkof7996f32007-01-11 17:20:00 +00002092 *
Denis Vlasenko7d219aa2006-10-05 10:17:08 +00002093 */
2094
2095char *zconfget_text (void)
2096{
2097 return zconftext;
2098}
2099
2100/** Set the current line number.
2101 * @param line_number
Denis Vlasenkof7996f32007-01-11 17:20:00 +00002102 *
Denis Vlasenko7d219aa2006-10-05 10:17:08 +00002103 */
2104void zconfset_lineno (int line_number )
2105{
Denis Vlasenkof7996f32007-01-11 17:20:00 +00002106
Denis Vlasenko7d219aa2006-10-05 10:17:08 +00002107 zconflineno = line_number;
2108}
2109
2110/** Set the input stream. This does not discard the current
2111 * input buffer.
2112 * @param in_str A readable stream.
Denis Vlasenkof7996f32007-01-11 17:20:00 +00002113 *
Denis Vlasenko7d219aa2006-10-05 10:17:08 +00002114 * @see zconf_switch_to_buffer
2115 */
2116void zconfset_in (FILE * in_str )
2117{
2118 zconfin = in_str ;
2119}
2120
2121void zconfset_out (FILE * out_str )
2122{
2123 zconfout = out_str ;
2124}
2125
2126int zconfget_debug (void)
2127{
2128 return zconf_flex_debug;
2129}
2130
2131void zconfset_debug (int bdebug )
2132{
2133 zconf_flex_debug = bdebug ;
2134}
2135
2136/* zconflex_destroy is for both reentrant and non-reentrant scanners. */
2137int zconflex_destroy (void)
2138{
Denis Vlasenkof7996f32007-01-11 17:20:00 +00002139
Denis Vlasenko7d219aa2006-10-05 10:17:08 +00002140 /* Pop the buffer stack, destroying each element. */
2141 while(YY_CURRENT_BUFFER){
2142 zconf_delete_buffer(YY_CURRENT_BUFFER );
2143 YY_CURRENT_BUFFER_LVALUE = NULL;
2144 zconfpop_buffer_state();
2145 }
2146
2147 /* Destroy the stack itself. */
2148 zconffree((yy_buffer_stack) );
2149 (yy_buffer_stack) = NULL;
2150
2151 return 0;
2152}
2153
2154/*
2155 * Internal utility routines.
2156 */
2157
2158#ifndef yytext_ptr
2159static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
2160{
2161 register int i;
2162 for ( i = 0; i < n; ++i )
2163 s1[i] = s2[i];
2164}
2165#endif
2166
2167#ifdef YY_NEED_STRLEN
2168static int yy_flex_strlen (yyconst char * s )
2169{
2170 register int n;
2171 for ( n = 0; s[n]; ++n )
2172 ;
2173
2174 return n;
2175}
2176#endif
2177
2178void *zconfalloc (yy_size_t size )
2179{
2180 return (void *) malloc( size );
2181}
2182
2183void *zconfrealloc (void * ptr, yy_size_t size )
2184{
2185 /* The cast to (char *) in the following accommodates both
2186 * implementations that use char* generic pointers, and those
2187 * that use void* generic pointers. It works with the latter
2188 * because both ANSI C and C++ allow castless assignment from
2189 * any pointer type to void*, and deal with argument conversions
2190 * as though doing an assignment.
2191 */
2192 return (void *) realloc( (char *) ptr, size );
2193}
2194
2195void zconffree (void * ptr )
2196{
2197 free( (char *) ptr ); /* see zconfrealloc() for (char *) cast */
2198}
2199
2200#define YYTABLES_NAME "yytables"
2201
2202#undef YY_NEW_FILE
2203#undef YY_FLUSH_BUFFER
2204#undef yy_set_bol
2205#undef yy_new_buffer
2206#undef yy_set_interactive
2207#undef yytext_ptr
2208#undef YY_DO_BEFORE_ACTION
2209
2210#ifdef YY_DECL_IS_OURS
2211#undef YY_DECL_IS_OURS
2212#undef YY_DECL
2213#endif
2214
2215void zconf_starthelp(void)
2216{
2217 new_string();
2218 last_ts = first_ts = 0;
2219 BEGIN(HELP);
2220}
2221
2222static void zconf_endhelp(void)
2223{
2224 zconflval.string = text;
2225 BEGIN(INITIAL);
2226}
2227
2228/*
2229 * Try to open specified file with following names:
2230 * ./name
2231 * $(srctree)/name
2232 * The latter is used when srctree is separate from objtree
2233 * when compiling the kernel.
2234 * Return NULL if file is not found.
2235 */
2236FILE *zconf_fopen(const char *name)
2237{
2238 char *env, fullname[PATH_MAX+1];
2239 FILE *f;
2240
2241 f = fopen(name, "r");
2242 if (!f && name[0] != '/') {
2243 env = getenv(SRCTREE);
2244 if (env) {
2245 sprintf(fullname, "%s/%s", env, name);
2246 f = fopen(fullname, "r");
2247 }
2248 }
2249 return f;
2250}
2251
2252void zconf_initscan(const char *name)
2253{
2254 zconfin = zconf_fopen(name);
2255 if (!zconfin) {
2256 printf("can't find file %s\n", name);
2257 exit(1);
2258 }
2259
2260 current_buf = malloc(sizeof(*current_buf));
2261 memset(current_buf, 0, sizeof(*current_buf));
2262
2263 current_file = file_lookup(name);
2264 current_file->lineno = 1;
2265 current_file->flags = FILE_BUSY;
2266}
2267
2268void zconf_nextfile(const char *name)
2269{
2270 struct file *file = file_lookup(name);
2271 struct buffer *buf = malloc(sizeof(*buf));
2272 memset(buf, 0, sizeof(*buf));
2273
2274 current_buf->state = YY_CURRENT_BUFFER;
2275 zconfin = zconf_fopen(name);
2276 if (!zconfin) {
2277 printf("%s:%d: can't open file \"%s\"\n", zconf_curname(), zconf_lineno(), name);
2278 exit(1);
2279 }
2280 zconf_switch_to_buffer(zconf_create_buffer(zconfin,YY_BUF_SIZE));
2281 buf->parent = current_buf;
2282 current_buf = buf;
2283
2284 if (file->flags & FILE_BUSY) {
2285 printf("recursive scan (%s)?\n", name);
2286 exit(1);
2287 }
2288 if (file->flags & FILE_SCANNED) {
2289 printf("file %s already scanned?\n", name);
2290 exit(1);
2291 }
2292 file->flags |= FILE_BUSY;
2293 file->lineno = 1;
2294 file->parent = current_file;
2295 current_file = file;
2296}
2297
2298static void zconf_endfile(void)
2299{
2300 struct buffer *parent;
2301
2302 current_file->flags |= FILE_SCANNED;
2303 current_file->flags &= ~FILE_BUSY;
2304 current_file = current_file->parent;
2305
2306 parent = current_buf->parent;
2307 if (parent) {
2308 fclose(zconfin);
2309 zconf_delete_buffer(YY_CURRENT_BUFFER);
2310 zconf_switch_to_buffer(parent->state);
2311 }
2312 free(current_buf);
2313 current_buf = parent;
2314}
2315
2316int zconf_lineno(void)
2317{
2318 return current_pos.lineno;
2319}
2320
2321char *zconf_curname(void)
2322{
2323 return current_pos.file ? current_pos.file->name : "<none>";
2324}
2325