2 #define YY_INT_ALIGNED short int
4 /* A lexical scanner generated by flex */
6 #define yy_create_buffer zconf_create_buffer
7 #define yy_delete_buffer zconf_delete_buffer
8 #define yy_flex_debug zconf_flex_debug
9 #define yy_init_buffer zconf_init_buffer
10 #define yy_flush_buffer zconf_flush_buffer
11 #define yy_load_buffer_state zconf_load_buffer_state
12 #define yy_switch_to_buffer zconf_switch_to_buffer
14 #define yyleng zconfleng
15 #define yylex zconflex
16 #define yylineno zconflineno
17 #define yyout zconfout
18 #define yyrestart zconfrestart
19 #define yytext zconftext
20 #define yywrap zconfwrap
21 #define yyalloc zconfalloc
22 #define yyrealloc zconfrealloc
23 #define yyfree zconffree
26 #define YY_FLEX_MAJOR_VERSION 2
27 #define YY_FLEX_MINOR_VERSION 6
28 #define YY_FLEX_SUBMINOR_VERSION 1
29 #if YY_FLEX_SUBMINOR_VERSION > 0
33 /* First, we deal with platform-specific or compiler-specific issues. */
35 /* begin standard C headers. */
41 /* end standard C headers. */
43 /* flex integer type definitions */
48 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
50 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
52 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
53 * if you want the limit (max/min) macros for int types.
55 #ifndef __STDC_LIMIT_MACROS
56 #define __STDC_LIMIT_MACROS 1
60 typedef int8_t flex_int8_t;
61 typedef uint8_t flex_uint8_t;
62 typedef int16_t flex_int16_t;
63 typedef uint16_t flex_uint16_t;
64 typedef int32_t flex_int32_t;
65 typedef uint32_t flex_uint32_t;
67 typedef signed char flex_int8_t;
68 typedef short int flex_int16_t;
69 typedef int flex_int32_t;
70 typedef unsigned char flex_uint8_t;
71 typedef unsigned short int flex_uint16_t;
72 typedef unsigned int flex_uint32_t;
74 /* Limits of integral types. */
76 #define INT8_MIN (-128)
79 #define INT16_MIN (-32767-1)
82 #define INT32_MIN (-2147483647-1)
85 #define INT8_MAX (127)
88 #define INT16_MAX (32767)
91 #define INT32_MAX (2147483647)
94 #define UINT8_MAX (255U)
97 #define UINT16_MAX (65535U)
100 #define UINT32_MAX (4294967295U)
105 #endif /* ! FLEXINT_H */
107 /* TODO: this is always defined, so inline it */
108 #define yyconst const
110 #if defined(__GNUC__) && __GNUC__ >= 3
111 #define yynoreturn __attribute__((__noreturn__))
116 /* Returned upon end-of-file. */
119 /* Promotes a possibly negative, possibly signed char to an unsigned
120 * integer for use as an array index. If the signed char is negative,
121 * we want to instead treat it as an 8-bit unsigned char, hence the
124 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
126 /* Enter a start condition. This macro really ought to take a parameter,
127 * but we do it the disgusting crufty way forced on us by the ()-less
128 * definition of BEGIN.
130 #define BEGIN (yy_start) = 1 + 2 *
132 /* Translate the current start state into a value that can be later handed
133 * to BEGIN to return to the state. The YYSTATE alias is for lex
136 #define YY_START (((yy_start) - 1) / 2)
137 #define YYSTATE YY_START
139 /* Action number for EOF rule of a given start state. */
140 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
142 /* Special action meaning "start processing a new file". */
143 #define YY_NEW_FILE zconfrestart(zconfin )
145 #define YY_END_OF_BUFFER_CHAR 0
147 /* Size of default input buffer. */
150 /* On IA-64, the buffer size is 16k, not 8k.
151 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
152 * Ditto for the __ia64__ case accordingly.
154 #define YY_BUF_SIZE 32768
156 #define YY_BUF_SIZE 16384
157 #endif /* __ia64__ */
160 /* The state buf must be large enough to hold one state per character in the main buffer.
162 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
164 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
165 #define YY_TYPEDEF_YY_BUFFER_STATE
166 typedef struct yy_buffer_state *YY_BUFFER_STATE;
169 #ifndef YY_TYPEDEF_YY_SIZE_T
170 #define YY_TYPEDEF_YY_SIZE_T
171 typedef size_t yy_size_t;
174 extern int zconfleng;
176 extern FILE *zconfin, *zconfout;
178 #define EOB_ACT_CONTINUE_SCAN 0
179 #define EOB_ACT_END_OF_FILE 1
180 #define EOB_ACT_LAST_MATCH 2
182 #define YY_LESS_LINENO(n)
183 #define YY_LINENO_REWIND_TO(ptr)
185 /* Return all but the first "n" matched characters back to the input stream. */
189 /* Undo effects of setting up zconftext. */ \
190 int yyless_macro_arg = (n); \
191 YY_LESS_LINENO(yyless_macro_arg);\
192 *yy_cp = (yy_hold_char); \
193 YY_RESTORE_YY_MORE_OFFSET \
194 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
195 YY_DO_BEFORE_ACTION; /* set up zconftext again */ \
199 #define unput(c) yyunput( c, (yytext_ptr) )
201 #ifndef YY_STRUCT_YY_BUFFER_STATE
202 #define YY_STRUCT_YY_BUFFER_STATE
203 struct yy_buffer_state
207 char *yy_ch_buf; /* input buffer */
208 char *yy_buf_pos; /* current position in input buffer */
210 /* Size of input buffer in bytes, not including room for EOB
215 /* Number of characters read into yy_ch_buf, not including EOB
220 /* Whether we "own" the buffer - i.e., we know we created it,
221 * and can realloc() it to grow it, and should free() it to
224 int yy_is_our_buffer;
226 /* Whether this is an "interactive" input source; if so, and
227 * if we're using stdio for input, then we want to use getc()
228 * instead of fread(), to make sure we stop fetching input after
231 int yy_is_interactive;
233 /* Whether we're considered to be at the beginning of a line.
234 * If so, '^' rules will be active on the next match, otherwise
239 int yy_bs_lineno; /**< The line count. */
240 int yy_bs_column; /**< The column count. */
242 /* Whether to try to fill the input buffer when we reach the
247 int yy_buffer_status;
249 #define YY_BUFFER_NEW 0
250 #define YY_BUFFER_NORMAL 1
251 /* When an EOF's been seen but there's still some text to process
252 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
253 * shouldn't try reading from the input source any more. We might
254 * still have a bunch of tokens to match, though, because of
255 * possible backing-up.
257 * When we actually see the EOF, we change the status to "new"
258 * (via zconfrestart()), so that the user can continue scanning by
259 * just pointing zconfin at a new input file.
261 #define YY_BUFFER_EOF_PENDING 2
264 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
266 /* Stack of input buffers. */
267 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
268 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
269 static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */
271 /* We provide macros for accessing buffer states in case in the
272 * future we want to put the buffer states in a more general
275 * Returns the top of the stack, or NULL.
277 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
278 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
281 /* Same as previous macro, but useful when we know that the buffer stack is not
282 * NULL or when we need an lvalue. For internal use only.
284 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
286 /* yy_hold_char holds the character lost when zconftext is formed. */
287 static char yy_hold_char;
288 static int yy_n_chars; /* number of characters read into yy_ch_buf */
291 /* Points to current character in buffer. */
292 static char *yy_c_buf_p = NULL;
293 static int yy_init = 0; /* whether we need to initialize */
294 static int yy_start = 0; /* start state number */
296 /* Flag which is used to allow zconfwrap()'s to do buffer switches
297 * instead of setting up a fresh zconfin. A bit of a hack ...
299 static int yy_did_buffer_switch_on_eof;
301 void zconfrestart (FILE *input_file );
302 void zconf_switch_to_buffer (YY_BUFFER_STATE new_buffer );
303 YY_BUFFER_STATE zconf_create_buffer (FILE *file,int size );
304 void zconf_delete_buffer (YY_BUFFER_STATE b );
305 void zconf_flush_buffer (YY_BUFFER_STATE b );
306 void zconfpush_buffer_state (YY_BUFFER_STATE new_buffer );
307 void zconfpop_buffer_state (void );
309 static void zconfensure_buffer_stack (void );
310 static void zconf_load_buffer_state (void );
311 static void zconf_init_buffer (YY_BUFFER_STATE b,FILE *file );
313 #define YY_FLUSH_BUFFER zconf_flush_buffer(YY_CURRENT_BUFFER )
315 YY_BUFFER_STATE zconf_scan_buffer (char *base,yy_size_t size );
316 YY_BUFFER_STATE zconf_scan_string (yyconst char *yy_str );
317 YY_BUFFER_STATE zconf_scan_bytes (yyconst char *bytes,int len );
319 void *zconfalloc (yy_size_t );
320 void *zconfrealloc (void *,yy_size_t );
321 void zconffree (void * );
323 #define yy_new_buffer zconf_create_buffer
325 #define yy_set_interactive(is_interactive) \
327 if ( ! YY_CURRENT_BUFFER ){ \
328 zconfensure_buffer_stack (); \
329 YY_CURRENT_BUFFER_LVALUE = \
330 zconf_create_buffer(zconfin,YY_BUF_SIZE ); \
332 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
335 #define yy_set_bol(at_bol) \
337 if ( ! YY_CURRENT_BUFFER ){\
338 zconfensure_buffer_stack (); \
339 YY_CURRENT_BUFFER_LVALUE = \
340 zconf_create_buffer(zconfin,YY_BUF_SIZE ); \
342 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
345 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
347 /* Begin user sect3 */
349 #define zconfwrap() (/*CONSTCOND*/1)
350 #define YY_SKIP_YYWRAP
352 typedef unsigned char YY_CHAR;
354 FILE *zconfin = NULL, *zconfout = NULL;
356 typedef int yy_state_type;
358 extern int zconflineno;
362 extern char *zconftext;
366 #define yytext_ptr zconftext
368 static yyconst flex_int16_t yy_nxt[][18] =
371 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
372 0, 0, 0, 0, 0, 0, 0, 0
376 11, 12, 13, 14, 12, 12, 15, 12, 12, 12,
377 12, 12, 12, 12, 12, 12, 12, 12
381 11, 12, 13, 14, 12, 12, 15, 12, 12, 12,
382 12, 12, 12, 12, 12, 12, 12, 12
386 11, 16, 16, 17, 16, 16, 16, 16, 16, 16,
387 16, 18, 16, 16, 16, 16, 16, 16
391 11, 16, 16, 17, 16, 16, 16, 16, 16, 16,
392 16, 18, 16, 16, 16, 16, 16, 16
397 11, 19, 20, 21, 19, 19, 19, 19, 19, 19,
398 19, 19, 19, 19, 19, 19, 19, 19
402 11, 19, 20, 21, 19, 19, 19, 19, 19, 19,
403 19, 19, 19, 19, 19, 19, 19, 19
407 11, 22, 22, 23, 22, 24, 22, 22, 24, 22,
408 22, 22, 22, 22, 22, 22, 25, 22
412 11, 22, 22, 23, 22, 24, 22, 22, 24, 22,
413 22, 22, 22, 22, 22, 22, 25, 22
417 11, 26, 27, 28, 29, 30, 31, 32, 30, 33,
418 34, 35, 35, 36, 37, 38, 39, 40
423 11, 26, 27, 28, 29, 30, 31, 32, 30, 33,
424 34, 35, 35, 36, 37, 38, 39, 40
428 -11, -11, -11, -11, -11, -11, -11, -11, -11, -11,
429 -11, -11, -11, -11, -11, -11, -11, -11
433 11, -12, -12, -12, -12, -12, -12, -12, -12, -12,
434 -12, -12, -12, -12, -12, -12, -12, -12
438 11, -13, 41, 42, -13, -13, 43, -13, -13, -13,
439 -13, -13, -13, -13, -13, -13, -13, -13
443 11, -14, -14, -14, -14, -14, -14, -14, -14, -14,
444 -14, -14, -14, -14, -14, -14, -14, -14
449 11, 44, 44, 45, 44, 44, 44, 44, 44, 44,
450 44, 44, 44, 44, 44, 44, 44, 44
454 11, -16, -16, -16, -16, -16, -16, -16, -16, -16,
455 -16, -16, -16, -16, -16, -16, -16, -16
459 11, -17, -17, -17, -17, -17, -17, -17, -17, -17,
460 -17, -17, -17, -17, -17, -17, -17, -17
464 11, -18, -18, -18, -18, -18, -18, -18, -18, -18,
465 -18, 46, -18, -18, -18, -18, -18, -18
469 11, 47, 47, -19, 47, 47, 47, 47, 47, 47,
470 47, 47, 47, 47, 47, 47, 47, 47
475 11, -20, 48, 49, -20, -20, -20, -20, -20, -20,
476 -20, -20, -20, -20, -20, -20, -20, -20
480 11, 50, -21, -21, 50, 50, 50, 50, 50, 50,
481 50, 50, 50, 50, 50, 50, 50, 50
485 11, 51, 51, 52, 51, -22, 51, 51, -22, 51,
486 51, 51, 51, 51, 51, 51, -22, 51
490 11, -23, -23, -23, -23, -23, -23, -23, -23, -23,
491 -23, -23, -23, -23, -23, -23, -23, -23
495 11, -24, -24, -24, -24, -24, -24, -24, -24, -24,
496 -24, -24, -24, -24, -24, -24, -24, -24
501 11, 53, 53, 54, 53, 53, 53, 53, 53, 53,
502 53, 53, 53, 53, 53, 53, 53, 53
506 11, -26, -26, -26, -26, -26, -26, -26, -26, -26,
507 -26, -26, -26, -26, -26, -26, -26, -26
511 11, -27, 55, -27, -27, -27, -27, -27, -27, -27,
512 -27, -27, -27, -27, -27, -27, -27, -27
516 11, -28, -28, -28, -28, -28, -28, -28, -28, -28,
517 -28, -28, -28, -28, -28, -28, -28, -28
521 11, -29, -29, -29, -29, -29, -29, -29, -29, -29,
522 -29, -29, -29, -29, 56, -29, -29, -29
527 11, -30, -30, -30, -30, -30, -30, -30, -30, -30,
528 -30, -30, -30, -30, -30, -30, -30, -30
532 11, 57, 57, -31, 57, 57, 57, 57, 57, 57,
533 57, 57, 57, 57, 57, 57, 57, 57
537 11, -32, -32, -32, -32, -32, -32, 58, -32, -32,
538 -32, -32, -32, -32, -32, -32, -32, -32
542 11, -33, -33, -33, -33, -33, -33, -33, -33, -33,
543 -33, -33, -33, -33, -33, -33, -33, -33
547 11, -34, -34, -34, -34, -34, -34, -34, -34, -34,
548 -34, -34, -34, -34, -34, -34, -34, -34
553 11, -35, -35, -35, -35, -35, -35, -35, -35, -35,
554 -35, 59, 59, -35, -35, -35, -35, -35
558 11, -36, -36, -36, -36, -36, -36, -36, -36, -36,
559 -36, -36, -36, -36, 60, -36, -36, -36
563 11, -37, -37, -37, -37, -37, -37, -37, -37, -37,
564 -37, -37, -37, -37, -37, -37, -37, -37
568 11, -38, -38, -38, -38, -38, -38, -38, -38, -38,
569 -38, -38, -38, -38, 61, -38, -38, -38
573 11, -39, -39, 62, -39, -39, -39, -39, -39, -39,
574 -39, -39, -39, -39, -39, -39, -39, -39
579 11, -40, -40, -40, -40, -40, -40, -40, -40, -40,
580 -40, -40, -40, -40, -40, -40, -40, 63
584 11, -41, 41, 42, -41, -41, 43, -41, -41, -41,
585 -41, -41, -41, -41, -41, -41, -41, -41
589 11, -42, -42, -42, -42, -42, -42, -42, -42, -42,
590 -42, -42, -42, -42, -42, -42, -42, -42
594 11, 44, 44, 45, 44, 44, 44, 44, 44, 44,
595 44, 44, 44, 44, 44, 44, 44, 44
599 11, 44, 44, 45, 44, 44, 44, 44, 44, 44,
600 44, 44, 44, 44, 44, 44, 44, 44
605 11, -45, -45, -45, -45, -45, -45, -45, -45, -45,
606 -45, -45, -45, -45, -45, -45, -45, -45
610 11, -46, -46, -46, -46, -46, -46, -46, -46, -46,
611 -46, 46, -46, -46, -46, -46, -46, -46
615 11, 47, 47, -47, 47, 47, 47, 47, 47, 47,
616 47, 47, 47, 47, 47, 47, 47, 47
620 11, -48, 48, 49, -48, -48, -48, -48, -48, -48,
621 -48, -48, -48, -48, -48, -48, -48, -48
625 11, 50, -49, -49, 50, 50, 50, 50, 50, 50,
626 50, 50, 50, 50, 50, 50, 50, 50
631 11, -50, -50, -50, -50, -50, -50, -50, -50, -50,
632 -50, -50, -50, -50, -50, -50, -50, -50
636 11, 51, 51, 52, 51, -51, 51, 51, -51, 51,
637 51, 51, 51, 51, 51, 51, -51, 51
641 11, -52, -52, -52, -52, -52, -52, -52, -52, -52,
642 -52, -52, -52, -52, -52, -52, -52, -52
646 11, -53, -53, 54, -53, -53, -53, -53, -53, -53,
647 -53, -53, -53, -53, -53, -53, -53, -53
651 11, -54, -54, -54, -54, -54, -54, -54, -54, -54,
652 -54, -54, -54, -54, -54, -54, -54, -54
657 11, -55, 55, -55, -55, -55, -55, -55, -55, -55,
658 -55, -55, -55, -55, -55, -55, -55, -55
662 11, -56, -56, -56, -56, -56, -56, -56, -56, -56,
663 -56, -56, -56, -56, -56, -56, -56, -56
667 11, 57, 57, -57, 57, 57, 57, 57, 57, 57,
668 57, 57, 57, 57, 57, 57, 57, 57
672 11, -58, -58, -58, -58, -58, -58, -58, -58, -58,
673 -58, -58, -58, -58, -58, -58, -58, -58
677 11, -59, -59, -59, -59, -59, -59, -59, -59, -59,
678 -59, 59, 59, -59, -59, -59, -59, -59
683 11, -60, -60, -60, -60, -60, -60, -60, -60, -60,
684 -60, -60, -60, -60, -60, -60, -60, -60
688 11, -61, -61, -61, -61, -61, -61, -61, -61, -61,
689 -61, -61, -61, -61, -61, -61, -61, -61
693 11, -62, -62, -62, -62, -62, -62, -62, -62, -62,
694 -62, -62, -62, -62, -62, -62, -62, -62
698 11, -63, -63, -63, -63, -63, -63, -63, -63, -63,
699 -63, -63, -63, -63, -63, -63, -63, -63
704 static yy_state_type yy_get_previous_state (void );
705 static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
706 static int yy_get_next_buffer (void );
707 static void yynoreturn yy_fatal_error (yyconst char* msg );
709 /* Done after the current pattern has been matched and before the
710 * corresponding action - sets up zconftext.
712 #define YY_DO_BEFORE_ACTION \
713 (yytext_ptr) = yy_bp; \
714 zconfleng = (int) (yy_cp - yy_bp); \
715 (yy_hold_char) = *yy_cp; \
717 (yy_c_buf_p) = yy_cp;
719 #define YY_NUM_RULES 37
720 #define YY_END_OF_BUFFER 38
721 /* This struct is not used in this scanner,
722 but its presence is necessary. */
725 flex_int32_t yy_verify;
728 static yyconst flex_int16_t yy_accept[64] =
730 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
731 38, 5, 4, 2, 3, 7, 8, 6, 36, 33,
732 35, 28, 32, 31, 30, 26, 25, 21, 13, 20,
733 23, 26, 11, 12, 22, 18, 14, 19, 26, 26,
734 4, 2, 3, 3, 1, 6, 36, 33, 35, 34,
735 28, 27, 30, 29, 25, 15, 23, 9, 22, 16,
739 static yyconst YY_CHAR yy_ec[256] =
741 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
742 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
743 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
744 1, 2, 4, 5, 6, 1, 1, 7, 8, 9,
745 10, 1, 1, 1, 11, 12, 12, 11, 11, 11,
746 11, 11, 11, 11, 11, 11, 11, 1, 1, 13,
747 14, 15, 1, 1, 11, 11, 11, 11, 11, 11,
748 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
749 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
750 1, 16, 1, 1, 11, 1, 11, 11, 11, 11,
752 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
753 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
754 11, 11, 1, 17, 1, 1, 1, 1, 1, 1,
755 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
756 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
757 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
758 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
759 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
760 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
761 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
763 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
764 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
765 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
766 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
767 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
771 extern int zconf_flex_debug;
772 int zconf_flex_debug = 0;
774 /* The intent behind this definition is that it'll catch
775 * any uses of REJECT which flex missed.
777 #define REJECT reject_used_but_not_detected
778 #define yymore() yymore_used_but_not_detected
779 #define YY_MORE_ADJ 0
780 #define YY_RESTORE_YY_MORE_OFFSET
782 #define YY_NO_INPUT 1
785 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
786 * Released under the terms of the GNU GPL v2.0.
799 #define START_STRSIZE 16
807 static int text_size, text_asize;
810 struct buffer *parent;
811 YY_BUFFER_STATE state;
814 struct buffer *current_buf;
816 static int last_ts, first_ts;
818 static void zconf_endhelp(void);
819 static void zconf_endfile(void);
821 static void new_string(void)
823 text = xmalloc(START_STRSIZE);
824 text_asize = START_STRSIZE;
829 static void append_string(const char *str, int size)
831 int new_size = text_size + size + 1;
832 if (new_size > text_asize) {
833 new_size += START_STRSIZE - 1;
834 new_size &= -START_STRSIZE;
835 text = realloc(text, new_size);
836 text_asize = new_size;
838 memcpy(text + text_size, str, size);
843 static void alloc_string(const char *str, int size)
845 text = xmalloc(size + 1);
846 memcpy(text, str, size);
850 static void warn_ignored_character(char chr)
853 "%s:%d:warning: ignoring unsupported character '%c'\n",
854 zconf_curname(), zconf_lineno(), chr);
863 #ifndef YY_NO_UNISTD_H
864 /* Special case for "unistd.h", since it is non-ANSI. We include it way
865 * down here because we want the user's section 1 to have been scanned first.
866 * The user has a chance to override it with an option.
871 #ifndef YY_EXTRA_TYPE
872 #define YY_EXTRA_TYPE void *
875 static int yy_init_globals (void );
877 /* Accessor methods to globals.
878 These are made visible to non-reentrant scanners for convenience. */
880 int zconflex_destroy (void );
882 int zconfget_debug (void );
884 void zconfset_debug (int debug_flag );
886 YY_EXTRA_TYPE zconfget_extra (void );
888 void zconfset_extra (YY_EXTRA_TYPE user_defined );
890 FILE *zconfget_in (void );
892 void zconfset_in (FILE * _in_str );
894 FILE *zconfget_out (void );
896 void zconfset_out (FILE * _out_str );
898 int zconfget_leng (void );
900 char *zconfget_text (void );
902 int zconfget_lineno (void );
904 void zconfset_lineno (int _line_number );
906 /* Macros after this point can all be overridden by user definitions in
910 #ifndef YY_SKIP_YYWRAP
912 extern "C" int zconfwrap (void );
914 extern int zconfwrap (void );
920 static void yyunput (int c,char *buf_ptr );
925 static void yy_flex_strncpy (char *,yyconst char *,int );
928 #ifdef YY_NEED_STRLEN
929 static int yy_flex_strlen (yyconst char * );
935 static int yyinput (void );
937 static int input (void );
942 /* Amount of stuff to slurp up with each read. */
943 #ifndef YY_READ_BUF_SIZE
945 /* On IA-64, the buffer size is 16k, not 8k */
946 #define YY_READ_BUF_SIZE 16384
948 #define YY_READ_BUF_SIZE 8192
949 #endif /* __ia64__ */
952 /* Copy whatever the last rule matched to the standard output. */
954 /* This used to be an fputs(), but since the string might contain NUL's,
955 * we now use fwrite().
957 #define ECHO do { if (fwrite( zconftext, (size_t) zconfleng, 1, zconfout )) {} } while (0)
960 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
961 * is returned in "result".
964 #define YY_INPUT(buf,result,max_size) \
966 while ( (result = (int) read( fileno(zconfin), buf, max_size )) < 0 ) \
968 if( errno != EINTR) \
970 YY_FATAL_ERROR( "input in flex scanner failed" ); \
980 /* No semi-colon after return; correct usage is to write "yyterminate();" -
981 * we don't want an extra ';' after the "return" because that will cause
982 * some compilers to complain about unreachable statements.
985 #define yyterminate() return YY_NULL
988 /* Number of entries by which start-condition stack grows. */
989 #ifndef YY_START_STACK_INCR
990 #define YY_START_STACK_INCR 25
993 /* Report a fatal error. */
994 #ifndef YY_FATAL_ERROR
995 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
998 /* end tables serialization structures and prototypes */
1000 /* Default declaration of generated scanner - a define so the user can
1001 * easily add parameters.
1004 #define YY_DECL_IS_OURS 1
1006 extern int zconflex (void);
1008 #define YY_DECL int zconflex (void)
1009 #endif /* !YY_DECL */
1011 /* Code executed at the beginning of each rule, after zconftext and zconfleng
1014 #ifndef YY_USER_ACTION
1015 #define YY_USER_ACTION
1018 /* Code executed at the end of each rule. */
1020 #define YY_BREAK /*LINTED*/break;
1023 #define YY_RULE_SETUP \
1026 /** The main scanner function which does all the work.
1030 yy_state_type yy_current_state;
1031 char *yy_cp, *yy_bp;
1043 (yy_start) = 1; /* first start state */
1051 if ( ! YY_CURRENT_BUFFER ) {
1052 zconfensure_buffer_stack ();
1053 YY_CURRENT_BUFFER_LVALUE =
1054 zconf_create_buffer(zconfin,YY_BUF_SIZE );
1057 zconf_load_buffer_state( );
1065 while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
1067 yy_cp = (yy_c_buf_p);
1069 /* Support of zconftext. */
1070 *yy_cp = (yy_hold_char);
1072 /* yy_bp points to the position in yy_ch_buf of the start of
1077 yy_current_state = (yy_start);
1079 while ( (yy_current_state = yy_nxt[yy_current_state][ yy_ec[YY_SC_TO_UI(*yy_cp)] ]) > 0 )
1082 yy_current_state = -yy_current_state;
1085 yy_act = yy_accept[yy_current_state];
1087 YY_DO_BEFORE_ACTION;
1089 do_action: /* This label is used only to access EOF actions. */
1092 { /* beginning of action switch */
1094 /* rule 1 can match eol */
1096 /* rule 2 can match eol */
1099 current_file->lineno++;
1116 unput(zconftext[0]);
1124 const struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng);
1126 current_pos.file = current_file;
1127 current_pos.lineno = current_file->lineno;
1128 if (id && id->flags & TF_COMMAND) {
1132 alloc_string(zconftext, zconfleng);
1133 zconflval.string = text;
1139 warn_ignored_character(*zconftext);
1142 /* rule 8 can match eol */
1146 current_file->lineno++;
1161 return T_OPEN_PAREN;
1165 return T_CLOSE_PAREN;
1181 return T_LESS_EQUAL;
1185 return T_GREATER_EQUAL;
1204 /* rule 21 can match eol */
1206 BEGIN(INITIAL); current_file->lineno++; return T_EOL;
1211 const struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng);
1212 if (id && id->flags & TF_PARAM) {
1216 alloc_string(zconftext, zconfleng);
1217 zconflval.string = text;
1226 /* rule 24 can match eol */
1228 current_file->lineno++;
1236 warn_ignored_character(*zconftext);
1238 case YY_STATE_EOF(PARAM):
1245 /* rule 27 can match eol */
1246 *yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */
1247 YY_LINENO_REWIND_TO(yy_cp - 1);
1248 (yy_c_buf_p) = yy_cp -= 1;
1249 YY_DO_BEFORE_ACTION; /* set up zconftext again */
1252 append_string(zconftext, zconfleng);
1253 zconflval.string = text;
1254 return T_WORD_QUOTE;
1260 append_string(zconftext, zconfleng);
1264 /* rule 29 can match eol */
1265 *yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */
1266 YY_LINENO_REWIND_TO(yy_cp - 1);
1267 (yy_c_buf_p) = yy_cp -= 1;
1268 YY_DO_BEFORE_ACTION; /* set up zconftext again */
1271 append_string(zconftext + 1, zconfleng - 1);
1272 zconflval.string = text;
1273 return T_WORD_QUOTE;
1279 append_string(zconftext + 1, zconfleng - 1);
1285 if (str == zconftext[0]) {
1287 zconflval.string = text;
1288 return T_WORD_QUOTE;
1290 append_string(zconftext, 1);
1294 /* rule 32 can match eol */
1297 printf("%s:%d:warning: multi-line strings not supported\n", zconf_curname(), zconf_lineno());
1298 current_file->lineno++;
1303 case YY_STATE_EOF(STRING):
1313 for (i = 0; i < zconfleng; i++) {
1314 if (zconftext[i] == '\t')
1321 if (ts < first_ts) {
1327 append_string(" ", 8);
1330 append_string(" ", ts);
1335 /* rule 34 can match eol */
1336 *yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */
1337 YY_LINENO_REWIND_TO(yy_cp - 1);
1338 (yy_c_buf_p) = yy_cp -= 1;
1339 YY_DO_BEFORE_ACTION; /* set up zconftext again */
1342 current_file->lineno++;
1348 /* rule 35 can match eol */
1351 current_file->lineno++;
1352 append_string("\n", 1);
1359 if ((zconftext[zconfleng-1] != ' ') && (zconftext[zconfleng-1] != '\t'))
1363 append_string(zconftext, zconfleng);
1368 case YY_STATE_EOF(HELP):
1375 case YY_STATE_EOF(INITIAL):
1376 case YY_STATE_EOF(COMMAND):
1388 YY_FATAL_ERROR( "flex scanner jammed" );
1391 case YY_END_OF_BUFFER:
1393 /* Amount of text matched not including the EOB char. */
1394 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1396 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1397 *yy_cp = (yy_hold_char);
1398 YY_RESTORE_YY_MORE_OFFSET
1400 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1402 /* We're scanning a new file or input source. It's
1403 * possible that this happened because the user
1404 * just pointed zconfin at a new source and called
1405 * zconflex(). If so, then we have to assure
1406 * consistency between YY_CURRENT_BUFFER and our
1407 * globals. Here is the right place to do so, because
1408 * this is the first action (other than possibly a
1409 * back-up) that will match for the new input source.
1411 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1412 YY_CURRENT_BUFFER_LVALUE->yy_input_file = zconfin;
1413 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1416 /* Note that here we test for yy_c_buf_p "<=" to the position
1417 * of the first EOB in the buffer, since yy_c_buf_p will
1418 * already have been incremented past the NUL character
1419 * (since all states make transitions on EOB to the
1420 * end-of-buffer state). Contrast this with the test
1423 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1424 { /* This was really a NUL. */
1425 yy_state_type yy_next_state;
1427 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1429 yy_current_state = yy_get_previous_state( );
1431 /* Okay, we're now positioned to make the NUL
1432 * transition. We couldn't have
1433 * yy_get_previous_state() go ahead and do it
1434 * for us because it doesn't know how to deal
1435 * with the possibility of jamming (and we don't
1436 * want to build jamming into it because then it
1437 * will run more slowly).
1440 yy_next_state = yy_try_NUL_trans( yy_current_state );
1442 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1444 if ( yy_next_state )
1446 /* Consume the NUL. */
1447 yy_cp = ++(yy_c_buf_p);
1448 yy_current_state = yy_next_state;
1454 yy_cp = (yy_c_buf_p);
1455 goto yy_find_action;
1459 else switch ( yy_get_next_buffer( ) )
1461 case EOB_ACT_END_OF_FILE:
1463 (yy_did_buffer_switch_on_eof) = 0;
1467 /* Note: because we've taken care in
1468 * yy_get_next_buffer() to have set up
1469 * zconftext, we can now set up
1470 * yy_c_buf_p so that if some total
1471 * hoser (like flex itself) wants to
1472 * call the scanner after we return the
1473 * YY_NULL, it'll still work - another
1474 * YY_NULL will get returned.
1476 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1478 yy_act = YY_STATE_EOF(YY_START);
1484 if ( ! (yy_did_buffer_switch_on_eof) )
1490 case EOB_ACT_CONTINUE_SCAN:
1492 (yytext_ptr) + yy_amount_of_matched_text;
1494 yy_current_state = yy_get_previous_state( );
1496 yy_cp = (yy_c_buf_p);
1497 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1500 case EOB_ACT_LAST_MATCH:
1502 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1504 yy_current_state = yy_get_previous_state( );
1506 yy_cp = (yy_c_buf_p);
1507 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1508 goto yy_find_action;
1515 "fatal flex scanner internal error--no action found" );
1516 } /* end of action switch */
1517 } /* end of scanning one token */
1518 } /* end of user's declarations */
1519 } /* end of zconflex */
1521 /* yy_get_next_buffer - try to read in a new buffer
1523 * Returns a code representing an action:
1524 * EOB_ACT_LAST_MATCH -
1525 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1526 * EOB_ACT_END_OF_FILE - end of file
1528 static int yy_get_next_buffer (void)
1530 char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1531 char *source = (yytext_ptr);
1532 int number_to_move, i;
1535 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1537 "fatal flex scanner internal error--end of buffer missed" );
1539 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1540 { /* Don't try to fill the buffer, so this is an EOF. */
1541 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1543 /* We matched a single character, the EOB, so
1544 * treat this as a final EOF.
1546 return EOB_ACT_END_OF_FILE;
1551 /* We matched some text prior to the EOB, first
1554 return EOB_ACT_LAST_MATCH;
1558 /* Try to read more data. */
1560 /* First move last chars to start of buffer. */
1561 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1);
1563 for ( i = 0; i < number_to_move; ++i )
1564 *(dest++) = *(source++);
1566 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1567 /* don't do the read, it's not guaranteed to return an EOF,
1570 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1575 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1577 while ( num_to_read <= 0 )
1578 { /* Not enough room in the buffer - grow it. */
1580 /* just a shorter name for the current buffer */
1581 YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
1583 int yy_c_buf_p_offset =
1584 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1586 if ( b->yy_is_our_buffer )
1588 int new_size = b->yy_buf_size * 2;
1590 if ( new_size <= 0 )
1591 b->yy_buf_size += b->yy_buf_size / 8;
1593 b->yy_buf_size *= 2;
1595 b->yy_ch_buf = (char *)
1596 /* Include room in for 2 EOB chars. */
1597 zconfrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1600 /* Can't grow it, we don't own it. */
1601 b->yy_ch_buf = NULL;
1603 if ( ! b->yy_ch_buf )
1605 "fatal error - scanner input buffer overflow" );
1607 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1609 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1614 if ( num_to_read > YY_READ_BUF_SIZE )
1615 num_to_read = YY_READ_BUF_SIZE;
1617 /* Read in more data. */
1618 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1619 (yy_n_chars), num_to_read );
1621 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1624 if ( (yy_n_chars) == 0 )
1626 if ( number_to_move == YY_MORE_ADJ )
1628 ret_val = EOB_ACT_END_OF_FILE;
1629 zconfrestart(zconfin );
1634 ret_val = EOB_ACT_LAST_MATCH;
1635 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1636 YY_BUFFER_EOF_PENDING;
1641 ret_val = EOB_ACT_CONTINUE_SCAN;
1643 if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1644 /* Extend the array by 50%, plus the number we really need. */
1645 int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1646 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) zconfrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
1647 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1648 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1651 (yy_n_chars) += number_to_move;
1652 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1653 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1655 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1660 /* yy_get_previous_state - get the state just before the EOB char was reached */
1662 static yy_state_type yy_get_previous_state (void)
1664 yy_state_type yy_current_state;
1667 yy_current_state = (yy_start);
1669 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1671 yy_current_state = yy_nxt[yy_current_state][(*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1)];
1674 return yy_current_state;
1677 /* yy_try_NUL_trans - try to make a transition on the NUL character
1680 * next_state = yy_try_NUL_trans( current_state );
1682 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1686 yy_current_state = yy_nxt[yy_current_state][1];
1687 yy_is_jam = (yy_current_state <= 0);
1689 return yy_is_jam ? 0 : yy_current_state;
1694 static void yyunput (int c, char * yy_bp )
1698 yy_cp = (yy_c_buf_p);
1700 /* undo effects of setting up zconftext */
1701 *yy_cp = (yy_hold_char);
1703 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1704 { /* need to shift things up to make room */
1705 /* +2 for EOB chars. */
1706 int number_to_move = (yy_n_chars) + 2;
1707 char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1708 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1710 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1712 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1713 *--dest = *--source;
1715 yy_cp += (int) (dest - source);
1716 yy_bp += (int) (dest - source);
1717 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1718 (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1720 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1721 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1724 *--yy_cp = (char) c;
1726 (yytext_ptr) = yy_bp;
1727 (yy_hold_char) = *yy_cp;
1728 (yy_c_buf_p) = yy_cp;
1735 static int yyinput (void)
1737 static int input (void)
1743 *(yy_c_buf_p) = (yy_hold_char);
1745 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1747 /* yy_c_buf_p now points to the character we want to return.
1748 * If this occurs *before* the EOB characters, then it's a
1749 * valid NUL; if not, then we've hit the end of the buffer.
1751 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1752 /* This was really a NUL. */
1753 *(yy_c_buf_p) = '\0';
1756 { /* need more input */
1757 int offset = (yy_c_buf_p) - (yytext_ptr);
1760 switch ( yy_get_next_buffer( ) )
1762 case EOB_ACT_LAST_MATCH:
1763 /* This happens because yy_g_n_b()
1764 * sees that we've accumulated a
1765 * token and flags that we need to
1766 * try matching the token before
1767 * proceeding. But for input(),
1768 * there's no matching to consider.
1769 * So convert the EOB_ACT_LAST_MATCH
1770 * to EOB_ACT_END_OF_FILE.
1773 /* Reset buffer status. */
1774 zconfrestart(zconfin );
1778 case EOB_ACT_END_OF_FILE:
1783 if ( ! (yy_did_buffer_switch_on_eof) )
1792 case EOB_ACT_CONTINUE_SCAN:
1793 (yy_c_buf_p) = (yytext_ptr) + offset;
1799 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1800 *(yy_c_buf_p) = '\0'; /* preserve zconftext */
1801 (yy_hold_char) = *++(yy_c_buf_p);
1805 #endif /* ifndef YY_NO_INPUT */
1807 /** Immediately switch to a different input stream.
1808 * @param input_file A readable stream.
1810 * @note This function does not reset the start condition to @c INITIAL .
1812 void zconfrestart (FILE * input_file )
1815 if ( ! YY_CURRENT_BUFFER ){
1816 zconfensure_buffer_stack ();
1817 YY_CURRENT_BUFFER_LVALUE =
1818 zconf_create_buffer(zconfin,YY_BUF_SIZE );
1821 zconf_init_buffer(YY_CURRENT_BUFFER,input_file );
1822 zconf_load_buffer_state( );
1825 /** Switch to a different input buffer.
1826 * @param new_buffer The new input buffer.
1829 void zconf_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1832 /* TODO. We should be able to replace this entire function body
1834 * zconfpop_buffer_state();
1835 * zconfpush_buffer_state(new_buffer);
1837 zconfensure_buffer_stack ();
1838 if ( YY_CURRENT_BUFFER == new_buffer )
1841 if ( YY_CURRENT_BUFFER )
1843 /* Flush out information for old buffer. */
1844 *(yy_c_buf_p) = (yy_hold_char);
1845 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1846 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1849 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1850 zconf_load_buffer_state( );
1852 /* We don't actually know whether we did this switch during
1853 * EOF (zconfwrap()) processing, but the only time this flag
1854 * is looked at is after zconfwrap() is called, so it's safe
1855 * to go ahead and always set it.
1857 (yy_did_buffer_switch_on_eof) = 1;
1860 static void zconf_load_buffer_state (void)
1862 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1863 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1864 zconfin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1865 (yy_hold_char) = *(yy_c_buf_p);
1868 /** Allocate and initialize an input buffer state.
1869 * @param file A readable stream.
1870 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1872 * @return the allocated buffer state.
1874 YY_BUFFER_STATE zconf_create_buffer (FILE * file, int size )
1878 b = (YY_BUFFER_STATE) zconfalloc(sizeof( struct yy_buffer_state ) );
1880 YY_FATAL_ERROR( "out of dynamic memory in zconf_create_buffer()" );
1882 b->yy_buf_size = (yy_size_t)size;
1884 /* yy_ch_buf has to be 2 characters longer than the size given because
1885 * we need to put in 2 end-of-buffer characters.
1887 b->yy_ch_buf = (char *) zconfalloc(b->yy_buf_size + 2 );
1888 if ( ! b->yy_ch_buf )
1889 YY_FATAL_ERROR( "out of dynamic memory in zconf_create_buffer()" );
1891 b->yy_is_our_buffer = 1;
1893 zconf_init_buffer(b,file );
1898 /** Destroy the buffer.
1899 * @param b a buffer created with zconf_create_buffer()
1902 void zconf_delete_buffer (YY_BUFFER_STATE b )
1908 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1909 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1911 if ( b->yy_is_our_buffer )
1912 zconffree((void *) b->yy_ch_buf );
1914 zconffree((void *) b );
1917 /* Initializes or reinitializes a buffer.
1918 * This function is sometimes called more than once on the same buffer,
1919 * such as during a zconfrestart() or at EOF.
1921 static void zconf_init_buffer (YY_BUFFER_STATE b, FILE * file )
1926 zconf_flush_buffer(b );
1928 b->yy_input_file = file;
1929 b->yy_fill_buffer = 1;
1931 /* If b is the current buffer, then zconf_init_buffer was _probably_
1932 * called from zconfrestart() or through yy_get_next_buffer.
1933 * In that case, we don't want to reset the lineno or column.
1935 if (b != YY_CURRENT_BUFFER){
1936 b->yy_bs_lineno = 1;
1937 b->yy_bs_column = 0;
1940 b->yy_is_interactive = 0;
1945 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1946 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1949 void zconf_flush_buffer (YY_BUFFER_STATE b )
1956 /* We always need two end-of-buffer characters. The first causes
1957 * a transition to the end-of-buffer state. The second causes
1958 * a jam in that state.
1960 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1961 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1963 b->yy_buf_pos = &b->yy_ch_buf[0];
1966 b->yy_buffer_status = YY_BUFFER_NEW;
1968 if ( b == YY_CURRENT_BUFFER )
1969 zconf_load_buffer_state( );
1972 /** Pushes the new state onto the stack. The new state becomes
1973 * the current state. This function will allocate the stack
1975 * @param new_buffer The new state.
1978 void zconfpush_buffer_state (YY_BUFFER_STATE new_buffer )
1980 if (new_buffer == NULL)
1983 zconfensure_buffer_stack();
1985 /* This block is copied from zconf_switch_to_buffer. */
1986 if ( YY_CURRENT_BUFFER )
1988 /* Flush out information for old buffer. */
1989 *(yy_c_buf_p) = (yy_hold_char);
1990 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1991 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1994 /* Only push if top exists. Otherwise, replace top. */
1995 if (YY_CURRENT_BUFFER)
1996 (yy_buffer_stack_top)++;
1997 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1999 /* copied from zconf_switch_to_buffer. */
2000 zconf_load_buffer_state( );
2001 (yy_did_buffer_switch_on_eof) = 1;
2004 /** Removes and deletes the top of the stack, if present.
2005 * The next element becomes the new top.
2008 void zconfpop_buffer_state (void)
2010 if (!YY_CURRENT_BUFFER)
2013 zconf_delete_buffer(YY_CURRENT_BUFFER );
2014 YY_CURRENT_BUFFER_LVALUE = NULL;
2015 if ((yy_buffer_stack_top) > 0)
2016 --(yy_buffer_stack_top);
2018 if (YY_CURRENT_BUFFER) {
2019 zconf_load_buffer_state( );
2020 (yy_did_buffer_switch_on_eof) = 1;
2024 /* Allocates the stack if it does not exist.
2025 * Guarantees space for at least one push.
2027 static void zconfensure_buffer_stack (void)
2031 if (!(yy_buffer_stack)) {
2033 /* First allocation is just for 2 elements, since we don't know if this
2034 * scanner will even need a stack. We use 2 instead of 1 to avoid an
2035 * immediate realloc on the next call.
2037 num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
2038 (yy_buffer_stack) = (struct yy_buffer_state**)zconfalloc
2039 (num_to_alloc * sizeof(struct yy_buffer_state*)
2041 if ( ! (yy_buffer_stack) )
2042 YY_FATAL_ERROR( "out of dynamic memory in zconfensure_buffer_stack()" );
2044 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
2046 (yy_buffer_stack_max) = num_to_alloc;
2047 (yy_buffer_stack_top) = 0;
2051 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
2053 /* Increase the buffer to prepare for a possible push. */
2054 yy_size_t grow_size = 8 /* arbitrary grow size */;
2056 num_to_alloc = (yy_buffer_stack_max) + grow_size;
2057 (yy_buffer_stack) = (struct yy_buffer_state**)zconfrealloc
2059 num_to_alloc * sizeof(struct yy_buffer_state*)
2061 if ( ! (yy_buffer_stack) )
2062 YY_FATAL_ERROR( "out of dynamic memory in zconfensure_buffer_stack()" );
2064 /* zero only the new slots.*/
2065 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
2066 (yy_buffer_stack_max) = num_to_alloc;
2070 /** Setup the input buffer state to scan directly from a user-specified character buffer.
2071 * @param base the character buffer
2072 * @param size the size in bytes of the character buffer
2074 * @return the newly allocated buffer state object.
2076 YY_BUFFER_STATE zconf_scan_buffer (char * base, yy_size_t size )
2081 base[size-2] != YY_END_OF_BUFFER_CHAR ||
2082 base[size-1] != YY_END_OF_BUFFER_CHAR )
2083 /* They forgot to leave room for the EOB's. */
2086 b = (YY_BUFFER_STATE) zconfalloc(sizeof( struct yy_buffer_state ) );
2088 YY_FATAL_ERROR( "out of dynamic memory in zconf_scan_buffer()" );
2090 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
2091 b->yy_buf_pos = b->yy_ch_buf = base;
2092 b->yy_is_our_buffer = 0;
2093 b->yy_input_file = NULL;
2094 b->yy_n_chars = b->yy_buf_size;
2095 b->yy_is_interactive = 0;
2097 b->yy_fill_buffer = 0;
2098 b->yy_buffer_status = YY_BUFFER_NEW;
2100 zconf_switch_to_buffer(b );
2105 /** Setup the input buffer state to scan a string. The next call to zconflex() will
2106 * scan from a @e copy of @a str.
2107 * @param yystr a NUL-terminated string to scan
2109 * @return the newly allocated buffer state object.
2110 * @note If you want to scan bytes that may contain NUL values, then use
2111 * zconf_scan_bytes() instead.
2113 YY_BUFFER_STATE zconf_scan_string (yyconst char * yystr )
2116 return zconf_scan_bytes(yystr,(int) strlen(yystr) );
2119 /** Setup the input buffer state to scan the given bytes. The next call to zconflex() will
2120 * scan from a @e copy of @a bytes.
2121 * @param yybytes the byte buffer to scan
2122 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
2124 * @return the newly allocated buffer state object.
2126 YY_BUFFER_STATE zconf_scan_bytes (yyconst char * yybytes, int _yybytes_len )
2133 /* Get memory for full buffer, including space for trailing EOB's. */
2134 n = (yy_size_t) (_yybytes_len + 2);
2135 buf = (char *) zconfalloc(n );
2137 YY_FATAL_ERROR( "out of dynamic memory in zconf_scan_bytes()" );
2139 for ( i = 0; i < _yybytes_len; ++i )
2140 buf[i] = yybytes[i];
2142 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2144 b = zconf_scan_buffer(buf,n );
2146 YY_FATAL_ERROR( "bad buffer in zconf_scan_bytes()" );
2148 /* It's okay to grow etc. this buffer, and we should throw it
2149 * away when we're done.
2151 b->yy_is_our_buffer = 1;
2156 #ifndef YY_EXIT_FAILURE
2157 #define YY_EXIT_FAILURE 2
2160 static void yynoreturn yy_fatal_error (yyconst char* msg )
2162 (void) fprintf( stderr, "%s\n", msg );
2163 exit( YY_EXIT_FAILURE );
2166 /* Redefine yyless() so it works in section 3 code. */
2172 /* Undo effects of setting up zconftext. */ \
2173 int yyless_macro_arg = (n); \
2174 YY_LESS_LINENO(yyless_macro_arg);\
2175 zconftext[zconfleng] = (yy_hold_char); \
2176 (yy_c_buf_p) = zconftext + yyless_macro_arg; \
2177 (yy_hold_char) = *(yy_c_buf_p); \
2178 *(yy_c_buf_p) = '\0'; \
2179 zconfleng = yyless_macro_arg; \
2183 /* Accessor methods (get/set functions) to struct members. */
2185 /** Get the current line number.
2188 int zconfget_lineno (void)
2194 /** Get the input stream.
2197 FILE *zconfget_in (void)
2202 /** Get the output stream.
2205 FILE *zconfget_out (void)
2210 /** Get the length of the current token.
2213 int zconfget_leng (void)
2218 /** Get the current token.
2222 char *zconfget_text (void)
2227 /** Set the current line number.
2228 * @param _line_number line number
2231 void zconfset_lineno (int _line_number )
2234 zconflineno = _line_number;
2237 /** Set the input stream. This does not discard the current
2239 * @param _in_str A readable stream.
2241 * @see zconf_switch_to_buffer
2243 void zconfset_in (FILE * _in_str )
2248 void zconfset_out (FILE * _out_str )
2250 zconfout = _out_str ;
2253 int zconfget_debug (void)
2255 return zconf_flex_debug;
2258 void zconfset_debug (int _bdebug )
2260 zconf_flex_debug = _bdebug ;
2263 static int yy_init_globals (void)
2265 /* Initialization is the same as for the non-reentrant scanner.
2266 * This function is called from zconflex_destroy(), so don't allocate here.
2269 (yy_buffer_stack) = NULL;
2270 (yy_buffer_stack_top) = 0;
2271 (yy_buffer_stack_max) = 0;
2272 (yy_c_buf_p) = NULL;
2276 /* Defined in main.c */
2285 /* For future reference: Set errno on error, since we are called by
2291 /* zconflex_destroy is for both reentrant and non-reentrant scanners. */
2292 int zconflex_destroy (void)
2295 /* Pop the buffer stack, destroying each element. */
2296 while(YY_CURRENT_BUFFER){
2297 zconf_delete_buffer(YY_CURRENT_BUFFER );
2298 YY_CURRENT_BUFFER_LVALUE = NULL;
2299 zconfpop_buffer_state();
2302 /* Destroy the stack itself. */
2303 zconffree((yy_buffer_stack) );
2304 (yy_buffer_stack) = NULL;
2306 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2307 * zconflex() is called, initialization will occur. */
2314 * Internal utility routines.
2318 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
2322 for ( i = 0; i < n; ++i )
2327 #ifdef YY_NEED_STRLEN
2328 static int yy_flex_strlen (yyconst char * s )
2331 for ( n = 0; s[n]; ++n )
2338 void *zconfalloc (yy_size_t size )
2340 return malloc(size);
2343 void *zconfrealloc (void * ptr, yy_size_t size )
2346 /* The cast to (char *) in the following accommodates both
2347 * implementations that use char* generic pointers, and those
2348 * that use void* generic pointers. It works with the latter
2349 * because both ANSI C and C++ allow castless assignment from
2350 * any pointer type to void*, and deal with argument conversions
2351 * as though doing an assignment.
2353 return realloc(ptr, size);
2356 void zconffree (void * ptr )
2358 free( (char *) ptr ); /* see zconfrealloc() for (char *) cast */
2361 #define YYTABLES_NAME "yytables"
2363 void zconf_starthelp(void)
2366 last_ts = first_ts = 0;
2370 static void zconf_endhelp(void)
2372 zconflval.string = text;
2377 * Try to open specified file with following names:
2380 * The latter is used when srctree is separate from objtree
2381 * when compiling the kernel.
2382 * Return NULL if file is not found.
2384 FILE *zconf_fopen(const char *name)
2386 char *env, fullname[PATH_MAX+1];
2389 f = fopen(name, "r");
2390 if (!f && name != NULL && name[0] != '/') {
2391 env = getenv(SRCTREE);
2393 sprintf(fullname, "%s/%s", env, name);
2394 f = fopen(fullname, "r");
2400 void zconf_initscan(const char *name)
2402 zconfin = zconf_fopen(name);
2404 printf("can't find file %s\n", name);
2408 current_buf = xmalloc(sizeof(*current_buf));
2409 memset(current_buf, 0, sizeof(*current_buf));
2411 current_file = file_lookup(name);
2412 current_file->lineno = 1;
2415 static void __zconf_nextfile(const char *name)
2418 struct file *file = file_lookup(name);
2419 struct buffer *buf = xmalloc(sizeof(*buf));
2420 memset(buf, 0, sizeof(*buf));
2422 current_buf->state = YY_CURRENT_BUFFER;
2423 zconfin = zconf_fopen(file->name);
2425 printf("%s:%d: can't open file \"%s\"\n",
2426 zconf_curname(), zconf_lineno(), file->name);
2429 zconf_switch_to_buffer(zconf_create_buffer(zconfin,YY_BUF_SIZE));
2430 buf->parent = current_buf;
2433 for (iter = current_file->parent; iter; iter = iter->parent ) {
2434 if (!strcmp(current_file->name,iter->name) ) {
2435 printf("%s:%d: recursive inclusion detected. "
2436 "Inclusion path:\n current file : '%s'\n",
2437 zconf_curname(), zconf_lineno(),
2439 iter = current_file->parent;
2441 strcmp(iter->name,current_file->name)) {
2442 printf(" included from: '%s:%d'\n",
2443 iter->name, iter->lineno-1);
2444 iter = iter->parent;
2447 printf(" included from: '%s:%d'\n",
2448 iter->name, iter->lineno+1);
2453 file->parent = current_file;
2454 current_file = file;
2457 void zconf_nextfile(const char *name)
2462 char path[PATH_MAX], *p;
2464 err = glob(name, GLOB_ERR | GLOB_MARK, NULL, &gl);
2466 /* ignore wildcard patterns that return no result */
2467 if (err == GLOB_NOMATCH && strchr(name, '*')) {
2472 if (err == GLOB_NOMATCH) {
2473 p = strdup(current_file->name);
2475 snprintf(path, sizeof(path), "%s/%s", dirname(p), name);
2476 err = glob(path, GLOB_ERR | GLOB_MARK, NULL, &gl);
2482 const char *reason = "unknown error";
2486 reason = "out of memory";
2489 reason = "read error";
2492 reason = "No files found";
2498 printf("%s:%d: glob failed: %s \"%s\"\n", zconf_curname(), zconf_lineno(),
2504 for (i = 0; i < gl.gl_pathc; i++)
2505 __zconf_nextfile(gl.gl_pathv[i]);
2508 static void zconf_endfile(void)
2510 struct buffer *parent;
2512 current_file = current_file->parent;
2514 parent = current_buf->parent;
2517 zconf_delete_buffer(YY_CURRENT_BUFFER);
2518 zconf_switch_to_buffer(parent->state);
2521 current_buf = parent;
2524 int zconf_lineno(void)
2526 return current_pos.lineno;
2529 const char *zconf_curname(void)
2531 return current_pos.file ? current_pos.file->name : "<none>";