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