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