2 #define YY_INT_ALIGNED short int
4 /* A lexical scanner generated by flex */
7 #define YY_FLEX_MAJOR_VERSION 2
8 #define YY_FLEX_MINOR_VERSION 6
9 #define YY_FLEX_SUBMINOR_VERSION 4
10 #if YY_FLEX_SUBMINOR_VERSION > 0
14 /* First, we deal with platform-specific or compiler-specific issues. */
16 /* begin standard C headers. */
22 /* end standard C headers. */
24 /* flex integer type definitions */
29 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
31 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
33 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
34 * if you want the limit (max/min) macros for int types.
36 #ifndef __STDC_LIMIT_MACROS
37 #define __STDC_LIMIT_MACROS 1
41 typedef int8_t flex_int8_t;
42 typedef uint8_t flex_uint8_t;
43 typedef int16_t flex_int16_t;
44 typedef uint16_t flex_uint16_t;
45 typedef int32_t flex_int32_t;
46 typedef uint32_t flex_uint32_t;
48 typedef signed char flex_int8_t;
49 typedef short int flex_int16_t;
50 typedef int flex_int32_t;
51 typedef unsigned char flex_uint8_t;
52 typedef unsigned short int flex_uint16_t;
53 typedef unsigned int flex_uint32_t;
55 /* Limits of integral types. */
57 #define INT8_MIN (-128)
60 #define INT16_MIN (-32767-1)
63 #define INT32_MIN (-2147483647-1)
66 #define INT8_MAX (127)
69 #define INT16_MAX (32767)
72 #define INT32_MAX (2147483647)
75 #define UINT8_MAX (255U)
78 #define UINT16_MAX (65535U)
81 #define UINT32_MAX (4294967295U)
85 #define SIZE_MAX (~(size_t)0)
90 #endif /* ! FLEXINT_H */
92 /* begin standard C++ headers. */
94 /* TODO: this is always defined, so inline it */
97 #if defined(__GNUC__) && __GNUC__ >= 3
98 #define yynoreturn __attribute__((__noreturn__))
103 /* Returned upon end-of-file. */
106 /* Promotes a possibly negative, possibly signed char to an
107 * integer in range [0..255] for use as an array index.
109 #define YY_SC_TO_UI(c) ((YY_CHAR) (c))
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.
115 #define BEGIN (yy_start) = 1 + 2 *
116 /* Translate the current start state into a value that can be later handed
117 * to BEGIN to return to the state. The YYSTATE alias is for lex
120 #define YY_START (((yy_start) - 1) / 2)
121 #define YYSTATE YY_START
122 /* Action number for EOF rule of a given start state. */
123 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
124 /* Special action meaning "start processing a new file". */
125 #define YY_NEW_FILE yyrestart( yyin )
126 #define YY_END_OF_BUFFER_CHAR 0
128 /* Size of default input buffer. */
131 /* On IA-64, the buffer size is 16k, not 8k.
132 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
133 * Ditto for the __ia64__ case accordingly.
135 #define YY_BUF_SIZE 32768
137 #define YY_BUF_SIZE 16384
138 #endif /* __ia64__ */
141 /* The state buf must be large enough to hold one state per character in the main buffer.
143 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
145 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
146 #define YY_TYPEDEF_YY_BUFFER_STATE
147 typedef struct yy_buffer_state *YY_BUFFER_STATE;
150 #ifndef YY_TYPEDEF_YY_SIZE_T
151 #define YY_TYPEDEF_YY_SIZE_T
152 typedef size_t yy_size_t;
157 extern FILE *yyin, *yyout;
159 #define EOB_ACT_CONTINUE_SCAN 0
160 #define EOB_ACT_END_OF_FILE 1
161 #define EOB_ACT_LAST_MATCH 2
163 /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
164 * access to the local variable yy_act. Since yyless() is a macro, it would break
165 * existing scanners that call yyless() from OUTSIDE yylex.
166 * One obvious solution it to make yy_act a global. I tried that, and saw
167 * a 5% performance hit in a non-yylineno scanner, because yy_act is
168 * normally declared as a register variable-- so it is not worth it.
170 #define YY_LESS_LINENO(n) \
173 for ( yyl = n; yyl < yyleng; ++yyl )\
174 if ( yytext[yyl] == '\n' )\
177 #define YY_LINENO_REWIND_TO(dst) \
180 for ( p = yy_cp-1; p >= (dst); --p)\
185 /* Return all but the first "n" matched characters back to the input stream. */
189 /* Undo effects of setting up yytext. */ \
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 yytext again */ \
198 #define unput(c) yyunput( c, (yytext_ptr) )
200 #ifndef YY_STRUCT_YY_BUFFER_STATE
201 #define YY_STRUCT_YY_BUFFER_STATE
202 struct yy_buffer_state
206 char *yy_ch_buf; /* input buffer */
207 char *yy_buf_pos; /* current position in input buffer */
209 /* Size of input buffer in bytes, not including room for EOB
214 /* Number of characters read into yy_ch_buf, not including EOB
219 /* Whether we "own" the buffer - i.e., we know we created it,
220 * and can realloc() it to grow it, and should free() it to
223 int yy_is_our_buffer;
225 /* Whether this is an "interactive" input source; if so, and
226 * if we're using stdio for input, then we want to use getc()
227 * instead of fread(), to make sure we stop fetching input after
230 int yy_is_interactive;
232 /* Whether we're considered to be at the beginning of a line.
233 * If so, '^' rules will be active on the next match, otherwise
238 int yy_bs_lineno; /**< The line count. */
239 int yy_bs_column; /**< The column count. */
241 /* Whether to try to fill the input buffer when we reach the
246 int yy_buffer_status;
248 #define YY_BUFFER_NEW 0
249 #define YY_BUFFER_NORMAL 1
250 /* When an EOF's been seen but there's still some text to process
251 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
252 * shouldn't try reading from the input source any more. We might
253 * still have a bunch of tokens to match, though, because of
254 * possible backing-up.
256 * When we actually see the EOF, we change the status to "new"
257 * (via yyrestart()), so that the user can continue scanning by
258 * just pointing yyin at a new input file.
260 #define YY_BUFFER_EOF_PENDING 2
263 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
265 /* Stack of input buffers. */
266 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
267 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
268 static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */
270 /* We provide macros for accessing buffer states in case in the
271 * future we want to put the buffer states in a more general
274 * Returns the top of the stack, or NULL.
276 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
277 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
279 /* Same as previous macro, but useful when we know that the buffer stack is not
280 * NULL or when we need an lvalue. For internal use only.
282 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
284 /* yy_hold_char holds the character lost when yytext is formed. */
285 static char yy_hold_char;
286 static int yy_n_chars; /* number of characters read into yy_ch_buf */
289 /* Points to current character in buffer. */
290 static char *yy_c_buf_p = NULL;
291 static int yy_init = 0; /* whether we need to initialize */
292 static int yy_start = 0; /* start state number */
294 /* Flag which is used to allow yywrap()'s to do buffer switches
295 * instead of setting up a fresh yyin. A bit of a hack ...
297 static int yy_did_buffer_switch_on_eof;
299 void yyrestart ( FILE *input_file );
300 void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer );
301 YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size );
302 void yy_delete_buffer ( YY_BUFFER_STATE b );
303 void yy_flush_buffer ( YY_BUFFER_STATE b );
304 void yypush_buffer_state ( YY_BUFFER_STATE new_buffer );
305 void yypop_buffer_state ( void );
307 static void yyensure_buffer_stack ( void );
308 static void yy_load_buffer_state ( void );
309 static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file );
310 #define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER )
312 YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size );
313 YY_BUFFER_STATE yy_scan_string ( const char *yy_str );
314 YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len );
316 void *yyalloc ( yy_size_t );
317 void *yyrealloc ( void *, yy_size_t );
318 void yyfree ( void * );
320 #define yy_new_buffer yy_create_buffer
321 #define yy_set_interactive(is_interactive) \
323 if ( ! YY_CURRENT_BUFFER ){ \
324 yyensure_buffer_stack (); \
325 YY_CURRENT_BUFFER_LVALUE = \
326 yy_create_buffer( yyin, YY_BUF_SIZE ); \
328 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
330 #define yy_set_bol(at_bol) \
332 if ( ! YY_CURRENT_BUFFER ){\
333 yyensure_buffer_stack (); \
334 YY_CURRENT_BUFFER_LVALUE = \
335 yy_create_buffer( yyin, YY_BUF_SIZE ); \
337 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
339 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
341 /* Begin user sect3 */
343 #define yywrap() (/*CONSTCOND*/1)
344 #define YY_SKIP_YYWRAP
345 typedef flex_uint8_t YY_CHAR;
347 FILE *yyin = NULL, *yyout = NULL;
349 typedef int yy_state_type;
358 #define yytext_ptr yytext
360 static const flex_int16_t yy_nxt[][18] =
363 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
364 0, 0, 0, 0, 0, 0, 0, 0
368 11, 12, 13, 14, 12, 12, 15, 12, 12, 12,
369 12, 12, 12, 12, 12, 12, 12, 12
373 11, 12, 13, 14, 12, 12, 15, 12, 12, 12,
374 12, 12, 12, 12, 12, 12, 12, 12
378 11, 16, 16, 17, 16, 16, 16, 16, 16, 16,
379 16, 18, 16, 16, 16, 16, 16, 16
383 11, 16, 16, 17, 16, 16, 16, 16, 16, 16,
384 16, 18, 16, 16, 16, 16, 16, 16
389 11, 19, 20, 21, 19, 19, 19, 19, 19, 19,
390 19, 19, 19, 19, 19, 19, 19, 19
394 11, 19, 20, 21, 19, 19, 19, 19, 19, 19,
395 19, 19, 19, 19, 19, 19, 19, 19
399 11, 22, 22, 23, 22, 24, 22, 22, 24, 22,
400 22, 22, 22, 22, 22, 22, 25, 22
404 11, 22, 22, 23, 22, 24, 22, 22, 24, 22,
405 22, 22, 22, 22, 22, 22, 25, 22
409 11, 26, 27, 28, 29, 30, 31, 32, 30, 33,
410 34, 35, 35, 36, 37, 38, 39, 40
415 11, 26, 27, 28, 29, 30, 31, 32, 30, 33,
416 34, 35, 35, 36, 37, 38, 39, 40
420 -11, -11, -11, -11, -11, -11, -11, -11, -11, -11,
421 -11, -11, -11, -11, -11, -11, -11, -11
425 11, -12, -12, -12, -12, -12, -12, -12, -12, -12,
426 -12, -12, -12, -12, -12, -12, -12, -12
430 11, -13, 41, 42, -13, -13, 43, -13, -13, -13,
431 -13, -13, -13, -13, -13, -13, -13, -13
435 11, -14, -14, -14, -14, -14, -14, -14, -14, -14,
436 -14, -14, -14, -14, -14, -14, -14, -14
441 11, 44, 44, 45, 44, 44, 44, 44, 44, 44,
442 44, 44, 44, 44, 44, 44, 44, 44
446 11, -16, -16, -16, -16, -16, -16, -16, -16, -16,
447 -16, -16, -16, -16, -16, -16, -16, -16
451 11, -17, -17, -17, -17, -17, -17, -17, -17, -17,
452 -17, -17, -17, -17, -17, -17, -17, -17
456 11, -18, -18, -18, -18, -18, -18, -18, -18, -18,
457 -18, 46, -18, -18, -18, -18, -18, -18
461 11, 47, 47, -19, 47, 47, 47, 47, 47, 47,
462 47, 47, 47, 47, 47, 47, 47, 47
467 11, -20, 48, 49, -20, -20, -20, -20, -20, -20,
468 -20, -20, -20, -20, -20, -20, -20, -20
472 11, 50, -21, -21, 50, 50, 50, 50, 50, 50,
473 50, 50, 50, 50, 50, 50, 50, 50
477 11, 51, 51, 52, 51, -22, 51, 51, -22, 51,
478 51, 51, 51, 51, 51, 51, -22, 51
482 11, -23, -23, -23, -23, -23, -23, -23, -23, -23,
483 -23, -23, -23, -23, -23, -23, -23, -23
487 11, -24, -24, -24, -24, -24, -24, -24, -24, -24,
488 -24, -24, -24, -24, -24, -24, -24, -24
493 11, 53, 53, 54, 53, 53, 53, 53, 53, 53,
494 53, 53, 53, 53, 53, 53, 53, 53
498 11, -26, -26, -26, -26, -26, -26, -26, -26, -26,
499 -26, -26, -26, -26, -26, -26, -26, -26
503 11, -27, 55, -27, -27, -27, -27, -27, -27, -27,
504 -27, -27, -27, -27, -27, -27, -27, -27
508 11, -28, -28, -28, -28, -28, -28, -28, -28, -28,
509 -28, -28, -28, -28, -28, -28, -28, -28
513 11, -29, -29, -29, -29, -29, -29, -29, -29, -29,
514 -29, -29, -29, -29, 56, -29, -29, -29
519 11, -30, -30, -30, -30, -30, -30, -30, -30, -30,
520 -30, -30, -30, -30, -30, -30, -30, -30
524 11, 57, 57, -31, 57, 57, 57, 57, 57, 57,
525 57, 57, 57, 57, 57, 57, 57, 57
529 11, -32, -32, -32, -32, -32, -32, 58, -32, -32,
530 -32, -32, -32, -32, -32, -32, -32, -32
534 11, -33, -33, -33, -33, -33, -33, -33, -33, -33,
535 -33, -33, -33, -33, -33, -33, -33, -33
539 11, -34, -34, -34, -34, -34, -34, -34, -34, -34,
540 -34, -34, -34, -34, -34, -34, -34, -34
545 11, -35, -35, -35, -35, -35, -35, -35, -35, -35,
546 -35, 59, 59, -35, -35, -35, -35, -35
550 11, -36, -36, -36, -36, -36, -36, -36, -36, -36,
551 -36, -36, -36, -36, 60, -36, -36, -36
555 11, -37, -37, -37, -37, -37, -37, -37, -37, -37,
556 -37, -37, -37, -37, -37, -37, -37, -37
560 11, -38, -38, -38, -38, -38, -38, -38, -38, -38,
561 -38, -38, -38, -38, 61, -38, -38, -38
565 11, -39, -39, 62, -39, -39, -39, -39, -39, -39,
566 -39, -39, -39, -39, -39, -39, -39, -39
571 11, -40, -40, -40, -40, -40, -40, -40, -40, -40,
572 -40, -40, -40, -40, -40, -40, -40, 63
576 11, -41, 41, 42, -41, -41, 43, -41, -41, -41,
577 -41, -41, -41, -41, -41, -41, -41, -41
581 11, -42, -42, -42, -42, -42, -42, -42, -42, -42,
582 -42, -42, -42, -42, -42, -42, -42, -42
586 11, 44, 44, 45, 44, 44, 44, 44, 44, 44,
587 44, 44, 44, 44, 44, 44, 44, 44
591 11, 44, 44, 45, 44, 44, 44, 44, 44, 44,
592 44, 44, 44, 44, 44, 44, 44, 44
597 11, -45, -45, -45, -45, -45, -45, -45, -45, -45,
598 -45, -45, -45, -45, -45, -45, -45, -45
602 11, -46, -46, -46, -46, -46, -46, -46, -46, -46,
603 -46, 46, -46, -46, -46, -46, -46, -46
607 11, 47, 47, -47, 47, 47, 47, 47, 47, 47,
608 47, 47, 47, 47, 47, 47, 47, 47
612 11, -48, 48, 49, -48, -48, -48, -48, -48, -48,
613 -48, -48, -48, -48, -48, -48, -48, -48
617 11, 50, -49, -49, 50, 50, 50, 50, 50, 50,
618 50, 50, 50, 50, 50, 50, 50, 50
623 11, -50, -50, -50, -50, -50, -50, -50, -50, -50,
624 -50, -50, -50, -50, -50, -50, -50, -50
628 11, 51, 51, 52, 51, -51, 51, 51, -51, 51,
629 51, 51, 51, 51, 51, 51, -51, 51
633 11, -52, -52, -52, -52, -52, -52, -52, -52, -52,
634 -52, -52, -52, -52, -52, -52, -52, -52
638 11, -53, -53, 54, -53, -53, -53, -53, -53, -53,
639 -53, -53, -53, -53, -53, -53, -53, -53
643 11, -54, -54, -54, -54, -54, -54, -54, -54, -54,
644 -54, -54, -54, -54, -54, -54, -54, -54
649 11, -55, 55, -55, -55, -55, -55, -55, -55, -55,
650 -55, -55, -55, -55, -55, -55, -55, -55
654 11, -56, -56, -56, -56, -56, -56, -56, -56, -56,
655 -56, -56, -56, -56, -56, -56, -56, -56
659 11, 57, 57, -57, 57, 57, 57, 57, 57, 57,
660 57, 57, 57, 57, 57, 57, 57, 57
664 11, -58, -58, -58, -58, -58, -58, -58, -58, -58,
665 -58, -58, -58, -58, -58, -58, -58, -58
669 11, -59, -59, -59, -59, -59, -59, -59, -59, -59,
670 -59, 59, 59, -59, -59, -59, -59, -59
675 11, -60, -60, -60, -60, -60, -60, -60, -60, -60,
676 -60, -60, -60, -60, -60, -60, -60, -60
680 11, -61, -61, -61, -61, -61, -61, -61, -61, -61,
681 -61, -61, -61, -61, -61, -61, -61, -61
685 11, -62, -62, -62, -62, -62, -62, -62, -62, -62,
686 -62, -62, -62, -62, -62, -62, -62, -62
690 11, -63, -63, -63, -63, -63, -63, -63, -63, -63,
691 -63, -63, -63, -63, -63, -63, -63, -63
696 static yy_state_type yy_get_previous_state ( void );
697 static yy_state_type yy_try_NUL_trans ( yy_state_type current_state );
698 static int yy_get_next_buffer ( void );
699 static void yynoreturn yy_fatal_error ( const char* msg );
701 /* Done after the current pattern has been matched and before the
702 * corresponding action - sets up yytext.
704 #define YY_DO_BEFORE_ACTION \
705 (yytext_ptr) = yy_bp; \
706 yyleng = (int) (yy_cp - yy_bp); \
707 (yy_hold_char) = *yy_cp; \
709 (yy_c_buf_p) = yy_cp;
710 #define YY_NUM_RULES 37
711 #define YY_END_OF_BUFFER 38
712 /* This struct is not used in this scanner,
713 but its presence is necessary. */
716 flex_int32_t yy_verify;
719 static const flex_int16_t yy_accept[64] =
721 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
722 38, 5, 4, 2, 3, 7, 8, 6, 36, 33,
723 35, 28, 32, 31, 30, 26, 25, 21, 13, 20,
724 23, 26, 11, 12, 22, 18, 14, 19, 26, 26,
725 4, 2, 3, 3, 1, 6, 36, 33, 35, 34,
726 28, 27, 30, 29, 25, 15, 23, 9, 22, 16,
730 static const YY_CHAR yy_ec[256] =
732 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
733 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
734 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
735 1, 2, 4, 5, 6, 1, 1, 7, 8, 9,
736 10, 1, 1, 1, 11, 12, 12, 11, 11, 11,
737 11, 11, 11, 11, 11, 11, 11, 1, 1, 13,
738 14, 15, 1, 1, 11, 11, 11, 11, 11, 11,
739 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
740 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
741 1, 16, 1, 1, 11, 1, 11, 11, 11, 11,
743 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
744 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
745 11, 11, 1, 17, 1, 1, 1, 1, 1, 1,
746 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
747 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
748 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
749 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
750 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
751 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
752 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
754 1, 1, 1, 1, 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,
762 /* Table of booleans, true if rule could match eol. */
763 static const flex_int32_t yy_rule_can_match_eol[38] =
765 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
766 0, 1, 0, 0, 1, 0, 0, 1, 0, 1, 0, 0, 1, 0, 1, 1, 0, 0, };
768 extern int yy_flex_debug;
769 int yy_flex_debug = 0;
771 /* The intent behind this definition is that it'll catch
772 * any uses of REJECT which flex missed.
774 #define REJECT reject_used_but_not_detected
775 #define yymore() yymore_used_but_not_detected
776 #define YY_MORE_ADJ 0
777 #define YY_RESTORE_YY_MORE_OFFSET
779 #define YY_NO_INPUT 1
782 * Copyright (C) 2002 Roman Zippel <zippel@linux-m68k.org>
783 * Released under the terms of the GNU GPL v2.0.
794 #define START_STRSIZE 16
802 static int text_size, text_asize;
805 struct buffer *parent;
806 YY_BUFFER_STATE state;
809 struct buffer *current_buf;
811 static int last_ts, first_ts;
813 static void zconf_endhelp(void);
814 static void zconf_endfile(void);
816 static void new_string(void)
818 text = xmalloc(START_STRSIZE);
819 text_asize = START_STRSIZE;
824 static void append_string(const char *str, int size)
826 int new_size = text_size + size + 1;
827 if (new_size > text_asize) {
828 new_size += START_STRSIZE - 1;
829 new_size &= -START_STRSIZE;
830 text = xrealloc(text, new_size);
831 text_asize = new_size;
833 memcpy(text + text_size, str, size);
838 static void alloc_string(const char *str, int size)
840 text = xmalloc(size + 1);
841 memcpy(text, str, size);
845 static void warn_ignored_character(char chr)
848 "%s:%d:warning: ignoring unsupported character '%c'\n",
849 zconf_curname(), zconf_lineno(), chr);
858 #ifndef YY_NO_UNISTD_H
859 /* Special case for "unistd.h", since it is non-ANSI. We include it way
860 * down here because we want the user's section 1 to have been scanned first.
861 * The user has a chance to override it with an option.
866 #ifndef YY_EXTRA_TYPE
867 #define YY_EXTRA_TYPE void *
870 static int yy_init_globals ( void );
872 /* Accessor methods to globals.
873 These are made visible to non-reentrant scanners for convenience. */
875 int yylex_destroy ( void );
877 int yyget_debug ( void );
879 void yyset_debug ( int debug_flag );
881 YY_EXTRA_TYPE yyget_extra ( void );
883 void yyset_extra ( YY_EXTRA_TYPE user_defined );
885 FILE *yyget_in ( void );
887 void yyset_in ( FILE * _in_str );
889 FILE *yyget_out ( void );
891 void yyset_out ( FILE * _out_str );
893 int yyget_leng ( void );
895 char *yyget_text ( void );
897 int yyget_lineno ( void );
899 void yyset_lineno ( int _line_number );
901 /* Macros after this point can all be overridden by user definitions in
905 #ifndef YY_SKIP_YYWRAP
907 extern "C" int yywrap ( void );
909 extern int yywrap ( void );
915 static void yyunput ( int c, char *buf_ptr );
920 static void yy_flex_strncpy ( char *, const char *, int );
923 #ifdef YY_NEED_STRLEN
924 static int yy_flex_strlen ( const char * );
929 static int yyinput ( void );
931 static int input ( void );
936 /* Amount of stuff to slurp up with each read. */
937 #ifndef YY_READ_BUF_SIZE
939 /* On IA-64, the buffer size is 16k, not 8k */
940 #define YY_READ_BUF_SIZE 16384
942 #define YY_READ_BUF_SIZE 8192
943 #endif /* __ia64__ */
946 /* Copy whatever the last rule matched to the standard output. */
948 /* This used to be an fputs(), but since the string might contain NUL's,
949 * we now use fwrite().
951 #define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
954 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
955 * is returned in "result".
958 #define YY_INPUT(buf,result,max_size) \
960 while ( (result = (int) read( fileno(yyin), buf, (yy_size_t) max_size )) < 0 ) \
962 if( errno != EINTR) \
964 YY_FATAL_ERROR( "input in flex scanner failed" ); \
974 /* No semi-colon after return; correct usage is to write "yyterminate();" -
975 * we don't want an extra ';' after the "return" because that will cause
976 * some compilers to complain about unreachable statements.
979 #define yyterminate() return YY_NULL
982 /* Number of entries by which start-condition stack grows. */
983 #ifndef YY_START_STACK_INCR
984 #define YY_START_STACK_INCR 25
987 /* Report a fatal error. */
988 #ifndef YY_FATAL_ERROR
989 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
992 /* end tables serialization structures and prototypes */
994 /* Default declaration of generated scanner - a define so the user can
995 * easily add parameters.
998 #define YY_DECL_IS_OURS 1
1000 extern int yylex (void);
1002 #define YY_DECL int yylex (void)
1003 #endif /* !YY_DECL */
1005 /* Code executed at the beginning of each rule, after yytext and yyleng
1008 #ifndef YY_USER_ACTION
1009 #define YY_USER_ACTION
1012 /* Code executed at the end of each rule. */
1014 #define YY_BREAK /*LINTED*/break;
1017 #define YY_RULE_SETUP \
1020 /** The main scanner function which does all the work.
1024 yy_state_type yy_current_state;
1025 char *yy_cp, *yy_bp;
1037 (yy_start) = 1; /* first start state */
1045 if ( ! YY_CURRENT_BUFFER ) {
1046 yyensure_buffer_stack ();
1047 YY_CURRENT_BUFFER_LVALUE =
1048 yy_create_buffer( yyin, YY_BUF_SIZE );
1051 yy_load_buffer_state( );
1059 while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
1061 yy_cp = (yy_c_buf_p);
1063 /* Support of yytext. */
1064 *yy_cp = (yy_hold_char);
1066 /* yy_bp points to the position in yy_ch_buf of the start of
1071 yy_current_state = (yy_start);
1073 while ( (yy_current_state = yy_nxt[yy_current_state][ yy_ec[YY_SC_TO_UI(*yy_cp)] ]) > 0 )
1076 yy_current_state = -yy_current_state;
1079 yy_act = yy_accept[yy_current_state];
1081 YY_DO_BEFORE_ACTION;
1083 if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
1086 for ( yyl = 0; yyl < yyleng; ++yyl )
1087 if ( yytext[yyl] == '\n' )
1093 do_action: /* This label is used only to access EOF actions. */
1096 { /* beginning of action switch */
1098 /* rule 1 can match eol */
1100 /* rule 2 can match eol */
1127 const struct kconf_id *id = kconf_id_lookup(yytext, yyleng);
1129 current_pos.file = current_file;
1130 current_pos.lineno = yylineno;
1131 if (id && id->flags & TF_COMMAND) {
1135 alloc_string(yytext, yyleng);
1136 yylval.string = text;
1142 warn_ignored_character(*yytext);
1145 /* rule 8 can match eol */
1163 return T_OPEN_PAREN;
1167 return T_CLOSE_PAREN;
1183 return T_LESS_EQUAL;
1187 return T_GREATER_EQUAL;
1206 /* rule 21 can match eol */
1208 BEGIN(INITIAL); return T_EOL;
1213 const struct kconf_id *id = kconf_id_lookup(yytext, yyleng);
1214 if (id && id->flags & TF_PARAM) {
1218 alloc_string(yytext, yyleng);
1219 yylval.string = text;
1228 /* rule 24 can match eol */
1238 warn_ignored_character(*yytext);
1240 case YY_STATE_EOF(PARAM):
1247 /* rule 27 can match eol */
1248 *yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
1249 YY_LINENO_REWIND_TO(yy_cp - 1);
1250 (yy_c_buf_p) = yy_cp -= 1;
1251 YY_DO_BEFORE_ACTION; /* set up yytext again */
1254 append_string(yytext, yyleng);
1255 yylval.string = text;
1256 return T_WORD_QUOTE;
1262 append_string(yytext, yyleng);
1266 /* rule 29 can match eol */
1267 *yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
1268 YY_LINENO_REWIND_TO(yy_cp - 1);
1269 (yy_c_buf_p) = yy_cp -= 1;
1270 YY_DO_BEFORE_ACTION; /* set up yytext again */
1273 append_string(yytext + 1, yyleng - 1);
1274 yylval.string = text;
1275 return T_WORD_QUOTE;
1281 append_string(yytext + 1, yyleng - 1);
1287 if (str == yytext[0]) {
1289 yylval.string = text;
1290 return T_WORD_QUOTE;
1292 append_string(yytext, 1);
1296 /* rule 32 can match eol */
1300 "%s:%d:warning: multi-line strings not supported\n",
1301 zconf_curname(), zconf_lineno());
1306 case YY_STATE_EOF(STRING):
1316 for (i = 0; i < yyleng; i++) {
1317 if (yytext[i] == '\t')
1324 if (ts < first_ts) {
1330 append_string(" ", 8);
1333 append_string(" ", ts);
1338 /* rule 34 can match eol */
1339 *yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
1340 YY_LINENO_REWIND_TO(yy_cp - 1);
1341 (yy_c_buf_p) = yy_cp -= 1;
1342 YY_DO_BEFORE_ACTION; /* set up yytext again */
1350 /* rule 35 can match eol */
1353 append_string("\n", 1);
1360 if ((yytext[yyleng-1] != ' ') && (yytext[yyleng-1] != '\t'))
1364 append_string(yytext, yyleng);
1369 case YY_STATE_EOF(HELP):
1376 case YY_STATE_EOF(INITIAL):
1377 case YY_STATE_EOF(COMMAND):
1389 YY_FATAL_ERROR( "flex scanner jammed" );
1392 case YY_END_OF_BUFFER:
1394 /* Amount of text matched not including the EOB char. */
1395 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1397 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1398 *yy_cp = (yy_hold_char);
1399 YY_RESTORE_YY_MORE_OFFSET
1401 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1403 /* We're scanning a new file or input source. It's
1404 * possible that this happened because the user
1405 * just pointed yyin at a new source and called
1406 * yylex(). If so, then we have to assure
1407 * consistency between YY_CURRENT_BUFFER and our
1408 * globals. Here is the right place to do so, because
1409 * this is the first action (other than possibly a
1410 * back-up) that will match for the new input source.
1412 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1413 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1414 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1417 /* Note that here we test for yy_c_buf_p "<=" to the position
1418 * of the first EOB in the buffer, since yy_c_buf_p will
1419 * already have been incremented past the NUL character
1420 * (since all states make transitions on EOB to the
1421 * end-of-buffer state). Contrast this with the test
1424 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1425 { /* This was really a NUL. */
1426 yy_state_type yy_next_state;
1428 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1430 yy_current_state = yy_get_previous_state( );
1432 /* Okay, we're now positioned to make the NUL
1433 * transition. We couldn't have
1434 * yy_get_previous_state() go ahead and do it
1435 * for us because it doesn't know how to deal
1436 * with the possibility of jamming (and we don't
1437 * want to build jamming into it because then it
1438 * will run more slowly).
1441 yy_next_state = yy_try_NUL_trans( yy_current_state );
1443 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1445 if ( yy_next_state )
1447 /* Consume the NUL. */
1448 yy_cp = ++(yy_c_buf_p);
1449 yy_current_state = yy_next_state;
1455 yy_cp = (yy_c_buf_p);
1456 goto yy_find_action;
1460 else switch ( yy_get_next_buffer( ) )
1462 case EOB_ACT_END_OF_FILE:
1464 (yy_did_buffer_switch_on_eof) = 0;
1468 /* Note: because we've taken care in
1469 * yy_get_next_buffer() to have set up
1470 * yytext, we can now set up
1471 * yy_c_buf_p so that if some total
1472 * hoser (like flex itself) wants to
1473 * call the scanner after we return the
1474 * YY_NULL, it'll still work - another
1475 * YY_NULL will get returned.
1477 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1479 yy_act = YY_STATE_EOF(YY_START);
1485 if ( ! (yy_did_buffer_switch_on_eof) )
1491 case EOB_ACT_CONTINUE_SCAN:
1493 (yytext_ptr) + yy_amount_of_matched_text;
1495 yy_current_state = yy_get_previous_state( );
1497 yy_cp = (yy_c_buf_p);
1498 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1501 case EOB_ACT_LAST_MATCH:
1503 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1505 yy_current_state = yy_get_previous_state( );
1507 yy_cp = (yy_c_buf_p);
1508 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1509 goto yy_find_action;
1516 "fatal flex scanner internal error--no action found" );
1517 } /* end of action switch */
1518 } /* end of scanning one token */
1519 } /* end of user's declarations */
1520 } /* end of yylex */
1522 /* yy_get_next_buffer - try to read in a new buffer
1524 * Returns a code representing an action:
1525 * EOB_ACT_LAST_MATCH -
1526 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1527 * EOB_ACT_END_OF_FILE - end of file
1529 static int yy_get_next_buffer (void)
1531 char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1532 char *source = (yytext_ptr);
1533 int number_to_move, i;
1536 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1538 "fatal flex scanner internal error--end of buffer missed" );
1540 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1541 { /* Don't try to fill the buffer, so this is an EOF. */
1542 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1544 /* We matched a single character, the EOB, so
1545 * treat this as a final EOF.
1547 return EOB_ACT_END_OF_FILE;
1552 /* We matched some text prior to the EOB, first
1555 return EOB_ACT_LAST_MATCH;
1559 /* Try to read more data. */
1561 /* First move last chars to start of buffer. */
1562 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1);
1564 for ( i = 0; i < number_to_move; ++i )
1565 *(dest++) = *(source++);
1567 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1568 /* don't do the read, it's not guaranteed to return an EOF,
1571 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1576 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1578 while ( num_to_read <= 0 )
1579 { /* Not enough room in the buffer - grow it. */
1581 /* just a shorter name for the current buffer */
1582 YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
1584 int yy_c_buf_p_offset =
1585 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1587 if ( b->yy_is_our_buffer )
1589 int new_size = b->yy_buf_size * 2;
1591 if ( new_size <= 0 )
1592 b->yy_buf_size += b->yy_buf_size / 8;
1594 b->yy_buf_size *= 2;
1596 b->yy_ch_buf = (char *)
1597 /* Include room in for 2 EOB chars. */
1598 yyrealloc( (void *) b->yy_ch_buf,
1599 (yy_size_t) (b->yy_buf_size + 2) );
1602 /* Can't grow it, we don't own it. */
1603 b->yy_ch_buf = NULL;
1605 if ( ! b->yy_ch_buf )
1607 "fatal error - scanner input buffer overflow" );
1609 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1611 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1616 if ( num_to_read > YY_READ_BUF_SIZE )
1617 num_to_read = YY_READ_BUF_SIZE;
1619 /* Read in more data. */
1620 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1621 (yy_n_chars), num_to_read );
1623 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1626 if ( (yy_n_chars) == 0 )
1628 if ( number_to_move == YY_MORE_ADJ )
1630 ret_val = EOB_ACT_END_OF_FILE;
1636 ret_val = EOB_ACT_LAST_MATCH;
1637 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1638 YY_BUFFER_EOF_PENDING;
1643 ret_val = EOB_ACT_CONTINUE_SCAN;
1645 if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1646 /* Extend the array by 50%, plus the number we really need. */
1647 int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1648 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
1649 (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size );
1650 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1651 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1652 /* "- 2" to take care of EOB's */
1653 YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
1656 (yy_n_chars) += number_to_move;
1657 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1658 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1660 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1665 /* yy_get_previous_state - get the state just before the EOB char was reached */
1667 static yy_state_type yy_get_previous_state (void)
1669 yy_state_type yy_current_state;
1672 yy_current_state = (yy_start);
1674 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1676 yy_current_state = yy_nxt[yy_current_state][(*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1)];
1679 return yy_current_state;
1682 /* yy_try_NUL_trans - try to make a transition on the NUL character
1685 * next_state = yy_try_NUL_trans( current_state );
1687 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1691 yy_current_state = yy_nxt[yy_current_state][1];
1692 yy_is_jam = (yy_current_state <= 0);
1694 return yy_is_jam ? 0 : yy_current_state;
1699 static void yyunput (int c, char * yy_bp )
1703 yy_cp = (yy_c_buf_p);
1705 /* undo effects of setting up yytext */
1706 *yy_cp = (yy_hold_char);
1708 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1709 { /* need to shift things up to make room */
1710 /* +2 for EOB chars. */
1711 int number_to_move = (yy_n_chars) + 2;
1712 char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1713 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1715 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1717 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1718 *--dest = *--source;
1720 yy_cp += (int) (dest - source);
1721 yy_bp += (int) (dest - source);
1722 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1723 (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1725 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1726 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1729 *--yy_cp = (char) c;
1735 (yytext_ptr) = yy_bp;
1736 (yy_hold_char) = *yy_cp;
1737 (yy_c_buf_p) = yy_cp;
1744 static int yyinput (void)
1746 static int input (void)
1752 *(yy_c_buf_p) = (yy_hold_char);
1754 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1756 /* yy_c_buf_p now points to the character we want to return.
1757 * If this occurs *before* the EOB characters, then it's a
1758 * valid NUL; if not, then we've hit the end of the buffer.
1760 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1761 /* This was really a NUL. */
1762 *(yy_c_buf_p) = '\0';
1765 { /* need more input */
1766 int offset = (int) ((yy_c_buf_p) - (yytext_ptr));
1769 switch ( yy_get_next_buffer( ) )
1771 case EOB_ACT_LAST_MATCH:
1772 /* This happens because yy_g_n_b()
1773 * sees that we've accumulated a
1774 * token and flags that we need to
1775 * try matching the token before
1776 * proceeding. But for input(),
1777 * there's no matching to consider.
1778 * So convert the EOB_ACT_LAST_MATCH
1779 * to EOB_ACT_END_OF_FILE.
1782 /* Reset buffer status. */
1787 case EOB_ACT_END_OF_FILE:
1792 if ( ! (yy_did_buffer_switch_on_eof) )
1801 case EOB_ACT_CONTINUE_SCAN:
1802 (yy_c_buf_p) = (yytext_ptr) + offset;
1808 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1809 *(yy_c_buf_p) = '\0'; /* preserve yytext */
1810 (yy_hold_char) = *++(yy_c_buf_p);
1819 #endif /* ifndef YY_NO_INPUT */
1821 /** Immediately switch to a different input stream.
1822 * @param input_file A readable stream.
1824 * @note This function does not reset the start condition to @c INITIAL .
1826 void yyrestart (FILE * input_file )
1829 if ( ! YY_CURRENT_BUFFER ){
1830 yyensure_buffer_stack ();
1831 YY_CURRENT_BUFFER_LVALUE =
1832 yy_create_buffer( yyin, YY_BUF_SIZE );
1835 yy_init_buffer( YY_CURRENT_BUFFER, input_file );
1836 yy_load_buffer_state( );
1839 /** Switch to a different input buffer.
1840 * @param new_buffer The new input buffer.
1843 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1846 /* TODO. We should be able to replace this entire function body
1848 * yypop_buffer_state();
1849 * yypush_buffer_state(new_buffer);
1851 yyensure_buffer_stack ();
1852 if ( YY_CURRENT_BUFFER == new_buffer )
1855 if ( YY_CURRENT_BUFFER )
1857 /* Flush out information for old buffer. */
1858 *(yy_c_buf_p) = (yy_hold_char);
1859 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1860 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1863 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1864 yy_load_buffer_state( );
1866 /* We don't actually know whether we did this switch during
1867 * EOF (yywrap()) processing, but the only time this flag
1868 * is looked at is after yywrap() is called, so it's safe
1869 * to go ahead and always set it.
1871 (yy_did_buffer_switch_on_eof) = 1;
1874 static void yy_load_buffer_state (void)
1876 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1877 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1878 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1879 (yy_hold_char) = *(yy_c_buf_p);
1882 /** Allocate and initialize an input buffer state.
1883 * @param file A readable stream.
1884 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1886 * @return the allocated buffer state.
1888 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
1892 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) );
1894 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1896 b->yy_buf_size = size;
1898 /* yy_ch_buf has to be 2 characters longer than the size given because
1899 * we need to put in 2 end-of-buffer characters.
1901 b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) );
1902 if ( ! b->yy_ch_buf )
1903 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1905 b->yy_is_our_buffer = 1;
1907 yy_init_buffer( b, file );
1912 /** Destroy the buffer.
1913 * @param b a buffer created with yy_create_buffer()
1916 void yy_delete_buffer (YY_BUFFER_STATE b )
1922 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1923 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1925 if ( b->yy_is_our_buffer )
1926 yyfree( (void *) b->yy_ch_buf );
1928 yyfree( (void *) b );
1931 /* Initializes or reinitializes a buffer.
1932 * This function is sometimes called more than once on the same buffer,
1933 * such as during a yyrestart() or at EOF.
1935 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
1940 yy_flush_buffer( b );
1942 b->yy_input_file = file;
1943 b->yy_fill_buffer = 1;
1945 /* If b is the current buffer, then yy_init_buffer was _probably_
1946 * called from yyrestart() or through yy_get_next_buffer.
1947 * In that case, we don't want to reset the lineno or column.
1949 if (b != YY_CURRENT_BUFFER){
1950 b->yy_bs_lineno = 1;
1951 b->yy_bs_column = 0;
1954 b->yy_is_interactive = 0;
1959 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1960 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1963 void yy_flush_buffer (YY_BUFFER_STATE b )
1970 /* We always need two end-of-buffer characters. The first causes
1971 * a transition to the end-of-buffer state. The second causes
1972 * a jam in that state.
1974 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1975 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1977 b->yy_buf_pos = &b->yy_ch_buf[0];
1980 b->yy_buffer_status = YY_BUFFER_NEW;
1982 if ( b == YY_CURRENT_BUFFER )
1983 yy_load_buffer_state( );
1986 /** Pushes the new state onto the stack. The new state becomes
1987 * the current state. This function will allocate the stack
1989 * @param new_buffer The new state.
1992 void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
1994 if (new_buffer == NULL)
1997 yyensure_buffer_stack();
1999 /* This block is copied from yy_switch_to_buffer. */
2000 if ( YY_CURRENT_BUFFER )
2002 /* Flush out information for old buffer. */
2003 *(yy_c_buf_p) = (yy_hold_char);
2004 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
2005 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
2008 /* Only push if top exists. Otherwise, replace top. */
2009 if (YY_CURRENT_BUFFER)
2010 (yy_buffer_stack_top)++;
2011 YY_CURRENT_BUFFER_LVALUE = new_buffer;
2013 /* copied from yy_switch_to_buffer. */
2014 yy_load_buffer_state( );
2015 (yy_did_buffer_switch_on_eof) = 1;
2018 /** Removes and deletes the top of the stack, if present.
2019 * The next element becomes the new top.
2022 void yypop_buffer_state (void)
2024 if (!YY_CURRENT_BUFFER)
2027 yy_delete_buffer(YY_CURRENT_BUFFER );
2028 YY_CURRENT_BUFFER_LVALUE = NULL;
2029 if ((yy_buffer_stack_top) > 0)
2030 --(yy_buffer_stack_top);
2032 if (YY_CURRENT_BUFFER) {
2033 yy_load_buffer_state( );
2034 (yy_did_buffer_switch_on_eof) = 1;
2038 /* Allocates the stack if it does not exist.
2039 * Guarantees space for at least one push.
2041 static void yyensure_buffer_stack (void)
2043 yy_size_t num_to_alloc;
2045 if (!(yy_buffer_stack)) {
2047 /* First allocation is just for 2 elements, since we don't know if this
2048 * scanner will even need a stack. We use 2 instead of 1 to avoid an
2049 * immediate realloc on the next call.
2051 num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
2052 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
2053 (num_to_alloc * sizeof(struct yy_buffer_state*)
2055 if ( ! (yy_buffer_stack) )
2056 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
2058 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
2060 (yy_buffer_stack_max) = num_to_alloc;
2061 (yy_buffer_stack_top) = 0;
2065 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
2067 /* Increase the buffer to prepare for a possible push. */
2068 yy_size_t grow_size = 8 /* arbitrary grow size */;
2070 num_to_alloc = (yy_buffer_stack_max) + grow_size;
2071 (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
2073 num_to_alloc * sizeof(struct yy_buffer_state*)
2075 if ( ! (yy_buffer_stack) )
2076 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
2078 /* zero only the new slots.*/
2079 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
2080 (yy_buffer_stack_max) = num_to_alloc;
2084 /** Setup the input buffer state to scan directly from a user-specified character buffer.
2085 * @param base the character buffer
2086 * @param size the size in bytes of the character buffer
2088 * @return the newly allocated buffer state object.
2090 YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
2095 base[size-2] != YY_END_OF_BUFFER_CHAR ||
2096 base[size-1] != YY_END_OF_BUFFER_CHAR )
2097 /* They forgot to leave room for the EOB's. */
2100 b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) );
2102 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
2104 b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */
2105 b->yy_buf_pos = b->yy_ch_buf = base;
2106 b->yy_is_our_buffer = 0;
2107 b->yy_input_file = NULL;
2108 b->yy_n_chars = b->yy_buf_size;
2109 b->yy_is_interactive = 0;
2111 b->yy_fill_buffer = 0;
2112 b->yy_buffer_status = YY_BUFFER_NEW;
2114 yy_switch_to_buffer( b );
2119 /** Setup the input buffer state to scan a string. The next call to yylex() will
2120 * scan from a @e copy of @a str.
2121 * @param yystr a NUL-terminated string to scan
2123 * @return the newly allocated buffer state object.
2124 * @note If you want to scan bytes that may contain NUL values, then use
2125 * yy_scan_bytes() instead.
2127 YY_BUFFER_STATE yy_scan_string (const char * yystr )
2130 return yy_scan_bytes( yystr, (int) strlen(yystr) );
2133 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
2134 * scan from a @e copy of @a bytes.
2135 * @param yybytes the byte buffer to scan
2136 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
2138 * @return the newly allocated buffer state object.
2140 YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len )
2147 /* Get memory for full buffer, including space for trailing EOB's. */
2148 n = (yy_size_t) (_yybytes_len + 2);
2149 buf = (char *) yyalloc( n );
2151 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
2153 for ( i = 0; i < _yybytes_len; ++i )
2154 buf[i] = yybytes[i];
2156 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
2158 b = yy_scan_buffer( buf, n );
2160 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
2162 /* It's okay to grow etc. this buffer, and we should throw it
2163 * away when we're done.
2165 b->yy_is_our_buffer = 1;
2170 #ifndef YY_EXIT_FAILURE
2171 #define YY_EXIT_FAILURE 2
2174 static void yynoreturn yy_fatal_error (const char* msg )
2176 fprintf( stderr, "%s\n", msg );
2177 exit( YY_EXIT_FAILURE );
2180 /* Redefine yyless() so it works in section 3 code. */
2186 /* Undo effects of setting up yytext. */ \
2187 int yyless_macro_arg = (n); \
2188 YY_LESS_LINENO(yyless_macro_arg);\
2189 yytext[yyleng] = (yy_hold_char); \
2190 (yy_c_buf_p) = yytext + yyless_macro_arg; \
2191 (yy_hold_char) = *(yy_c_buf_p); \
2192 *(yy_c_buf_p) = '\0'; \
2193 yyleng = yyless_macro_arg; \
2197 /* Accessor methods (get/set functions) to struct members. */
2199 /** Get the current line number.
2202 int yyget_lineno (void)
2208 /** Get the input stream.
2211 FILE *yyget_in (void)
2216 /** Get the output stream.
2219 FILE *yyget_out (void)
2224 /** Get the length of the current token.
2227 int yyget_leng (void)
2232 /** Get the current token.
2236 char *yyget_text (void)
2241 /** Set the current line number.
2242 * @param _line_number line number
2245 void yyset_lineno (int _line_number )
2248 yylineno = _line_number;
2251 /** Set the input stream. This does not discard the current
2253 * @param _in_str A readable stream.
2255 * @see yy_switch_to_buffer
2257 void yyset_in (FILE * _in_str )
2262 void yyset_out (FILE * _out_str )
2267 int yyget_debug (void)
2269 return yy_flex_debug;
2272 void yyset_debug (int _bdebug )
2274 yy_flex_debug = _bdebug ;
2277 static int yy_init_globals (void)
2279 /* Initialization is the same as for the non-reentrant scanner.
2280 * This function is called from yylex_destroy(), so don't allocate here.
2283 /* We do not touch yylineno unless the option is enabled. */
2286 (yy_buffer_stack) = NULL;
2287 (yy_buffer_stack_top) = 0;
2288 (yy_buffer_stack_max) = 0;
2289 (yy_c_buf_p) = NULL;
2293 /* Defined in main.c */
2302 /* For future reference: Set errno on error, since we are called by
2308 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
2309 int yylex_destroy (void)
2312 /* Pop the buffer stack, destroying each element. */
2313 while(YY_CURRENT_BUFFER){
2314 yy_delete_buffer( YY_CURRENT_BUFFER );
2315 YY_CURRENT_BUFFER_LVALUE = NULL;
2316 yypop_buffer_state();
2319 /* Destroy the stack itself. */
2320 yyfree((yy_buffer_stack) );
2321 (yy_buffer_stack) = NULL;
2323 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2324 * yylex() is called, initialization will occur. */
2331 * Internal utility routines.
2335 static void yy_flex_strncpy (char* s1, const char * s2, int n )
2339 for ( i = 0; i < n; ++i )
2344 #ifdef YY_NEED_STRLEN
2345 static int yy_flex_strlen (const char * s )
2348 for ( n = 0; s[n]; ++n )
2355 void *yyalloc (yy_size_t size )
2357 return malloc(size);
2360 void *yyrealloc (void * ptr, yy_size_t size )
2363 /* The cast to (char *) in the following accommodates both
2364 * implementations that use char* generic pointers, and those
2365 * that use void* generic pointers. It works with the latter
2366 * because both ANSI C and C++ allow castless assignment from
2367 * any pointer type to void*, and deal with argument conversions
2368 * as though doing an assignment.
2370 return realloc(ptr, size);
2373 void yyfree (void * ptr )
2375 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
2378 #define YYTABLES_NAME "yytables"
2380 void zconf_starthelp(void)
2383 last_ts = first_ts = 0;
2387 static void zconf_endhelp(void)
2389 yylval.string = text;
2394 * Try to open specified file with following names:
2397 * The latter is used when srctree is separate from objtree
2398 * when compiling the kernel.
2399 * Return NULL if file is not found.
2401 FILE *zconf_fopen(const char *name)
2403 char *env, fullname[PATH_MAX+1];
2406 f = fopen(name, "r");
2407 if (!f && name != NULL && name[0] != '/') {
2408 env = getenv(SRCTREE);
2410 sprintf(fullname, "%s/%s", env, name);
2411 f = fopen(fullname, "r");
2417 void zconf_initscan(const char *name)
2419 yyin = zconf_fopen(name);
2421 fprintf(stderr, "can't find file %s\n", name);
2425 current_buf = xmalloc(sizeof(*current_buf));
2426 memset(current_buf, 0, sizeof(*current_buf));
2428 current_file = file_lookup(name);
2432 void zconf_nextfile(const char *name)
2435 struct file *file = file_lookup(name);
2436 struct buffer *buf = xmalloc(sizeof(*buf));
2437 memset(buf, 0, sizeof(*buf));
2439 current_buf->state = YY_CURRENT_BUFFER;
2440 yyin = zconf_fopen(file->name);
2442 fprintf(stderr, "%s:%d: can't open file \"%s\"\n",
2443 zconf_curname(), zconf_lineno(), file->name);
2446 yy_switch_to_buffer(yy_create_buffer(yyin, YY_BUF_SIZE));
2447 buf->parent = current_buf;
2450 current_file->lineno = yylineno;
2451 file->parent = current_file;
2453 for (iter = current_file; iter; iter = iter->parent) {
2454 if (!strcmp(iter->name, file->name)) {
2456 "Recursive inclusion detected.\n"
2458 " current file : %s\n", file->name);
2461 iter = iter->parent;
2462 fprintf(stderr, " included from: %s:%d\n",
2463 iter->name, iter->lineno - 1);
2464 } while (strcmp(iter->name, file->name));
2470 current_file = file;
2473 static void zconf_endfile(void)
2475 struct buffer *parent;
2477 current_file = current_file->parent;
2479 yylineno = current_file->lineno;
2481 parent = current_buf->parent;
2484 yy_delete_buffer(YY_CURRENT_BUFFER);
2485 yy_switch_to_buffer(parent->state);
2488 current_buf = parent;
2491 int zconf_lineno(void)
2493 return current_pos.lineno;
2496 const char *zconf_curname(void)
2498 return current_pos.file ? current_pos.file->name : "<none>";