[package] libpcap: explicitely disable libnl support to prevent different build resul...
[openwrt.git] / scripts / config / lex.zconf.c_shipped
1
2 #line 3 "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>
35 typedef int8_t flex_int8_t;
36 typedef uint8_t flex_uint8_t;
37 typedef int16_t flex_int16_t;
38 typedef uint16_t flex_uint16_t;
39 typedef int32_t flex_int32_t;
40 typedef uint32_t flex_uint32_t;
41 #else
42 typedef signed char flex_int8_t;
43 typedef short int flex_int16_t;
44 typedef int flex_int32_t;
45 typedef unsigned char flex_uint8_t;
46 typedef unsigned short int flex_uint16_t;
47 typedef 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
139 typedef struct yy_buffer_state *YY_BUFFER_STATE;
140 #endif
141
142 extern int zconfleng;
143
144 extern 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)
151
152 /* 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
175 typedef unsigned int yy_size_t;
176 #endif
177
178 #ifndef YY_STRUCT_YY_BUFFER_STATE
179 #define YY_STRUCT_YY_BUFFER_STATE
180 struct 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. */
218
219 /* 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. */
244 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
245 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
246 static 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. */
264 static char yy_hold_char;
265 static int yy_n_chars; /* number of characters read into yy_ch_buf */
266 int zconfleng;
267
268 /* Points to current character in buffer. */
269 static char *yy_c_buf_p = (char *) 0;
270 static int yy_init = 1; /* whether we need to initialize */
271 static 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 */
276 static int yy_did_buffer_switch_on_eof;
277
278 void zconfrestart (FILE *input_file );
279 void zconf_switch_to_buffer (YY_BUFFER_STATE new_buffer );
280 YY_BUFFER_STATE zconf_create_buffer (FILE *file,int size );
281 void zconf_delete_buffer (YY_BUFFER_STATE b );
282 void zconf_flush_buffer (YY_BUFFER_STATE b );
283 void zconfpush_buffer_state (YY_BUFFER_STATE new_buffer );
284 void zconfpop_buffer_state (void );
285
286 static void zconfensure_buffer_stack (void );
287 static void zconf_load_buffer_state (void );
288 static void zconf_init_buffer (YY_BUFFER_STATE b,FILE *file );
289
290 #define YY_FLUSH_BUFFER zconf_flush_buffer(YY_CURRENT_BUFFER )
291
292 YY_BUFFER_STATE zconf_scan_buffer (char *base,yy_size_t size );
293 YY_BUFFER_STATE zconf_scan_string (yyconst char *yy_str );
294 YY_BUFFER_STATE zconf_scan_bytes (yyconst char *bytes,int len );
295
296 void *zconfalloc (yy_size_t );
297 void *zconfrealloc (void *,yy_size_t );
298 void 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(n) 1
327 #define YY_SKIP_YYWRAP
328
329 typedef unsigned char YY_CHAR;
330
331 FILE *zconfin = (FILE *) 0, *zconfout = (FILE *) 0;
332
333 typedef int yy_state_type;
334
335 extern int zconflineno;
336
337 int zconflineno = 1;
338
339 extern char *zconftext;
340 #define yytext_ptr zconftext
341 static 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
662 static yy_state_type yy_get_previous_state (void );
663 static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
664 static int yy_get_next_buffer (void );
665 static 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. */
681 struct yy_trans_info
682 {
683 flex_int32_t yy_verify;
684 flex_int32_t yy_nxt;
685 };
686 static 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
696 static 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
728 extern int zconf_flex_debug;
729 int 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
738 char *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 #include <glob.h>
751
752 #define LKC_DIRECT_LINK
753 #include "lkc.h"
754
755 #define START_STRSIZE 16
756
757 static struct {
758 struct file *file;
759 int lineno;
760 } current_pos;
761
762 static char *text;
763 static int text_size, text_asize;
764
765 struct buffer {
766 struct buffer *parent;
767 YY_BUFFER_STATE state;
768 };
769
770 struct buffer *current_buf;
771
772 static int last_ts, first_ts;
773
774 static void zconf_endhelp(void);
775 static void zconf_endfile(void);
776
777 void new_string(void)
778 {
779 text = malloc(START_STRSIZE);
780 text_asize = START_STRSIZE;
781 text_size = 0;
782 *text = 0;
783 }
784
785 void append_string(const char *str, int size)
786 {
787 int new_size = text_size + size + 1;
788 if (new_size > text_asize) {
789 new_size += START_STRSIZE - 1;
790 new_size &= -START_STRSIZE;
791 text = realloc(text, new_size);
792 text_asize = new_size;
793 }
794 memcpy(text + text_size, str, size);
795 text_size += size;
796 text[text_size] = 0;
797 }
798
799 void alloc_string(const char *str, int size)
800 {
801 text = malloc(size + 1);
802 memcpy(text, str, size);
803 text[size] = 0;
804 }
805
806 #define INITIAL 0
807 #define COMMAND 1
808 #define HELP 2
809 #define STRING 3
810 #define PARAM 4
811
812 #ifndef YY_NO_UNISTD_H
813 /* Special case for "unistd.h", since it is non-ANSI. We include it way
814 * down here because we want the user's section 1 to have been scanned first.
815 * The user has a chance to override it with an option.
816 */
817 #include <unistd.h>
818 #endif
819
820 #ifndef YY_EXTRA_TYPE
821 #define YY_EXTRA_TYPE void *
822 #endif
823
824 /* Macros after this point can all be overridden by user definitions in
825 * section 1.
826 */
827
828 #ifndef YY_SKIP_YYWRAP
829 #ifdef __cplusplus
830 extern "C" int zconfwrap (void );
831 #else
832 extern int zconfwrap (void );
833 #endif
834 #endif
835
836 static void yyunput (int c,char *buf_ptr );
837
838 #ifndef yytext_ptr
839 static void yy_flex_strncpy (char *,yyconst char *,int );
840 #endif
841
842 #ifdef YY_NEED_STRLEN
843 static int yy_flex_strlen (yyconst char * );
844 #endif
845
846 #ifndef YY_NO_INPUT
847
848 #ifdef __cplusplus
849 static int yyinput (void );
850 #else
851 static int input (void );
852 #endif
853
854 #endif
855
856 /* Amount of stuff to slurp up with each read. */
857 #ifndef YY_READ_BUF_SIZE
858 #define YY_READ_BUF_SIZE 8192
859 #endif
860
861 /* Copy whatever the last rule matched to the standard output. */
862 #ifndef ECHO
863 /* This used to be an fputs(), but since the string might contain NUL's,
864 * we now use fwrite().
865 */
866 #define ECHO (void) fwrite( zconftext, zconfleng, 1, zconfout )
867 #endif
868
869 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
870 * is returned in "result".
871 */
872 #ifndef YY_INPUT
873 #define YY_INPUT(buf,result,max_size) \
874 errno=0; \
875 while ( (result = read( fileno(zconfin), (char *) buf, max_size )) < 0 ) \
876 { \
877 if( errno != EINTR) \
878 { \
879 YY_FATAL_ERROR( "input in flex scanner failed" ); \
880 break; \
881 } \
882 errno=0; \
883 clearerr(zconfin); \
884 }\
885 \
886
887 #endif
888
889 /* No semi-colon after return; correct usage is to write "yyterminate();" -
890 * we don't want an extra ';' after the "return" because that will cause
891 * some compilers to complain about unreachable statements.
892 */
893 #ifndef yyterminate
894 #define yyterminate() return YY_NULL
895 #endif
896
897 /* Number of entries by which start-condition stack grows. */
898 #ifndef YY_START_STACK_INCR
899 #define YY_START_STACK_INCR 25
900 #endif
901
902 /* Report a fatal error. */
903 #ifndef YY_FATAL_ERROR
904 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
905 #endif
906
907 /* end tables serialization structures and prototypes */
908
909 /* Default declaration of generated scanner - a define so the user can
910 * easily add parameters.
911 */
912 #ifndef YY_DECL
913 #define YY_DECL_IS_OURS 1
914
915 extern int zconflex (void);
916
917 #define YY_DECL int zconflex (void)
918 #endif /* !YY_DECL */
919
920 /* Code executed at the beginning of each rule, after zconftext and zconfleng
921 * have been set up.
922 */
923 #ifndef YY_USER_ACTION
924 #define YY_USER_ACTION
925 #endif
926
927 /* Code executed at the end of each rule. */
928 #ifndef YY_BREAK
929 #define YY_BREAK break;
930 #endif
931
932 #define YY_RULE_SETUP \
933 YY_USER_ACTION
934
935 /** The main scanner function which does all the work.
936 */
937 YY_DECL
938 {
939 register yy_state_type yy_current_state;
940 register char *yy_cp, *yy_bp;
941 register int yy_act;
942
943 int str = 0;
944 int ts, i;
945
946 if ( (yy_init) )
947 {
948 (yy_init) = 0;
949
950 #ifdef YY_USER_INIT
951 YY_USER_INIT;
952 #endif
953
954 if ( ! (yy_start) )
955 (yy_start) = 1; /* first start state */
956
957 if ( ! zconfin )
958 zconfin = stdin;
959
960 if ( ! zconfout )
961 zconfout = stdout;
962
963 if ( ! YY_CURRENT_BUFFER ) {
964 zconfensure_buffer_stack ();
965 YY_CURRENT_BUFFER_LVALUE =
966 zconf_create_buffer(zconfin,YY_BUF_SIZE );
967 }
968
969 zconf_load_buffer_state( );
970 }
971
972 while ( 1 ) /* loops until end-of-file is reached */
973 {
974 yy_cp = (yy_c_buf_p);
975
976 /* Support of zconftext. */
977 *yy_cp = (yy_hold_char);
978
979 /* yy_bp points to the position in yy_ch_buf of the start of
980 * the current run.
981 */
982 yy_bp = yy_cp;
983
984 yy_current_state = (yy_start);
985 yy_match:
986 while ( (yy_current_state = yy_nxt[yy_current_state][ yy_ec[YY_SC_TO_UI(*yy_cp)] ]) > 0 )
987 ++yy_cp;
988
989 yy_current_state = -yy_current_state;
990
991 yy_find_action:
992 yy_act = yy_accept[yy_current_state];
993
994 YY_DO_BEFORE_ACTION;
995
996 do_action: /* This label is used only to access EOF actions. */
997
998 switch ( yy_act )
999 { /* beginning of action switch */
1000 case 1:
1001 /* rule 1 can match eol */
1002 case 2:
1003 /* rule 2 can match eol */
1004 YY_RULE_SETUP
1005 {
1006 current_file->lineno++;
1007 return T_EOL;
1008 }
1009 YY_BREAK
1010 case 3:
1011 YY_RULE_SETUP
1012
1013 YY_BREAK
1014 case 4:
1015 YY_RULE_SETUP
1016 {
1017 BEGIN(COMMAND);
1018 }
1019 YY_BREAK
1020 case 5:
1021 YY_RULE_SETUP
1022 {
1023 unput(zconftext[0]);
1024 BEGIN(COMMAND);
1025 }
1026 YY_BREAK
1027
1028 case 6:
1029 YY_RULE_SETUP
1030 {
1031 struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng);
1032 BEGIN(PARAM);
1033 current_pos.file = current_file;
1034 current_pos.lineno = current_file->lineno;
1035 if (id && id->flags & TF_COMMAND) {
1036 zconflval.id = id;
1037 return id->token;
1038 }
1039 alloc_string(zconftext, zconfleng);
1040 zconflval.string = text;
1041 return T_WORD;
1042 }
1043 YY_BREAK
1044 case 7:
1045 YY_RULE_SETUP
1046
1047 YY_BREAK
1048 case 8:
1049 /* rule 8 can match eol */
1050 YY_RULE_SETUP
1051 {
1052 BEGIN(INITIAL);
1053 current_file->lineno++;
1054 return T_EOL;
1055 }
1056 YY_BREAK
1057
1058 case 9:
1059 YY_RULE_SETUP
1060 return T_AND;
1061 YY_BREAK
1062 case 10:
1063 YY_RULE_SETUP
1064 return T_OR;
1065 YY_BREAK
1066 case 11:
1067 YY_RULE_SETUP
1068 return T_OPEN_PAREN;
1069 YY_BREAK
1070 case 12:
1071 YY_RULE_SETUP
1072 return T_CLOSE_PAREN;
1073 YY_BREAK
1074 case 13:
1075 YY_RULE_SETUP
1076 return T_NOT;
1077 YY_BREAK
1078 case 14:
1079 YY_RULE_SETUP
1080 return T_EQUAL;
1081 YY_BREAK
1082 case 15:
1083 YY_RULE_SETUP
1084 return T_UNEQUAL;
1085 YY_BREAK
1086 case 16:
1087 YY_RULE_SETUP
1088 {
1089 str = zconftext[0];
1090 new_string();
1091 BEGIN(STRING);
1092 }
1093 YY_BREAK
1094 case 17:
1095 /* rule 17 can match eol */
1096 YY_RULE_SETUP
1097 BEGIN(INITIAL); current_file->lineno++; return T_EOL;
1098 YY_BREAK
1099 case 18:
1100 YY_RULE_SETUP
1101 /* ignore */
1102 YY_BREAK
1103 case 19:
1104 YY_RULE_SETUP
1105 {
1106 struct kconf_id *id = kconf_id_lookup(zconftext, zconfleng);
1107 if (id && id->flags & TF_PARAM) {
1108 zconflval.id = id;
1109 return id->token;
1110 }
1111 alloc_string(zconftext, zconfleng);
1112 zconflval.string = text;
1113 return T_WORD;
1114 }
1115 YY_BREAK
1116 case 20:
1117 YY_RULE_SETUP
1118 /* comment */
1119 YY_BREAK
1120 case 21:
1121 /* rule 21 can match eol */
1122 YY_RULE_SETUP
1123 current_file->lineno++;
1124 YY_BREAK
1125 case 22:
1126 YY_RULE_SETUP
1127
1128 YY_BREAK
1129 case YY_STATE_EOF(PARAM):
1130 {
1131 BEGIN(INITIAL);
1132 }
1133 YY_BREAK
1134
1135 case 23:
1136 /* rule 23 can match eol */
1137 *yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */
1138 (yy_c_buf_p) = yy_cp -= 1;
1139 YY_DO_BEFORE_ACTION; /* set up zconftext again */
1140 YY_RULE_SETUP
1141 {
1142 append_string(zconftext, zconfleng);
1143 zconflval.string = text;
1144 return T_WORD_QUOTE;
1145 }
1146 YY_BREAK
1147 case 24:
1148 YY_RULE_SETUP
1149 {
1150 append_string(zconftext, zconfleng);
1151 }
1152 YY_BREAK
1153 case 25:
1154 /* rule 25 can match eol */
1155 *yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */
1156 (yy_c_buf_p) = yy_cp -= 1;
1157 YY_DO_BEFORE_ACTION; /* set up zconftext again */
1158 YY_RULE_SETUP
1159 {
1160 append_string(zconftext + 1, zconfleng - 1);
1161 zconflval.string = text;
1162 return T_WORD_QUOTE;
1163 }
1164 YY_BREAK
1165 case 26:
1166 YY_RULE_SETUP
1167 {
1168 append_string(zconftext + 1, zconfleng - 1);
1169 }
1170 YY_BREAK
1171 case 27:
1172 YY_RULE_SETUP
1173 {
1174 if (str == zconftext[0]) {
1175 BEGIN(PARAM);
1176 zconflval.string = text;
1177 return T_WORD_QUOTE;
1178 } else
1179 append_string(zconftext, 1);
1180 }
1181 YY_BREAK
1182 case 28:
1183 /* rule 28 can match eol */
1184 YY_RULE_SETUP
1185 {
1186 printf("%s:%d:warning: multi-line strings not supported\n", zconf_curname(), zconf_lineno());
1187 current_file->lineno++;
1188 BEGIN(INITIAL);
1189 return T_EOL;
1190 }
1191 YY_BREAK
1192 case YY_STATE_EOF(STRING):
1193 {
1194 BEGIN(INITIAL);
1195 }
1196 YY_BREAK
1197
1198 case 29:
1199 YY_RULE_SETUP
1200 {
1201 ts = 0;
1202 for (i = 0; i < zconfleng; i++) {
1203 if (zconftext[i] == '\t')
1204 ts = (ts & ~7) + 8;
1205 else
1206 ts++;
1207 }
1208 last_ts = ts;
1209 if (first_ts) {
1210 if (ts < first_ts) {
1211 zconf_endhelp();
1212 return T_HELPTEXT;
1213 }
1214 ts -= first_ts;
1215 while (ts > 8) {
1216 append_string(" ", 8);
1217 ts -= 8;
1218 }
1219 append_string(" ", ts);
1220 }
1221 }
1222 YY_BREAK
1223 case 30:
1224 /* rule 30 can match eol */
1225 *yy_cp = (yy_hold_char); /* undo effects of setting up zconftext */
1226 (yy_c_buf_p) = yy_cp -= 1;
1227 YY_DO_BEFORE_ACTION; /* set up zconftext again */
1228 YY_RULE_SETUP
1229 {
1230 current_file->lineno++;
1231 zconf_endhelp();
1232 return T_HELPTEXT;
1233 }
1234 YY_BREAK
1235 case 31:
1236 /* rule 31 can match eol */
1237 YY_RULE_SETUP
1238 {
1239 current_file->lineno++;
1240 append_string("\n", 1);
1241 }
1242 YY_BREAK
1243 case 32:
1244 YY_RULE_SETUP
1245 {
1246 append_string(zconftext, zconfleng);
1247 if (!first_ts)
1248 first_ts = last_ts;
1249 }
1250 YY_BREAK
1251 case YY_STATE_EOF(HELP):
1252 {
1253 zconf_endhelp();
1254 return T_HELPTEXT;
1255 }
1256 YY_BREAK
1257
1258 case YY_STATE_EOF(INITIAL):
1259 case YY_STATE_EOF(COMMAND):
1260 {
1261 if (current_file) {
1262 zconf_endfile();
1263 return T_EOL;
1264 }
1265 fclose(zconfin);
1266 yyterminate();
1267 }
1268 YY_BREAK
1269 case 33:
1270 YY_RULE_SETUP
1271 YY_FATAL_ERROR( "flex scanner jammed" );
1272 YY_BREAK
1273
1274 case YY_END_OF_BUFFER:
1275 {
1276 /* Amount of text matched not including the EOB char. */
1277 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1278
1279 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1280 *yy_cp = (yy_hold_char);
1281 YY_RESTORE_YY_MORE_OFFSET
1282
1283 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1284 {
1285 /* We're scanning a new file or input source. It's
1286 * possible that this happened because the user
1287 * just pointed zconfin at a new source and called
1288 * zconflex(). If so, then we have to assure
1289 * consistency between YY_CURRENT_BUFFER and our
1290 * globals. Here is the right place to do so, because
1291 * this is the first action (other than possibly a
1292 * back-up) that will match for the new input source.
1293 */
1294 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1295 YY_CURRENT_BUFFER_LVALUE->yy_input_file = zconfin;
1296 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1297 }
1298
1299 /* Note that here we test for yy_c_buf_p "<=" to the position
1300 * of the first EOB in the buffer, since yy_c_buf_p will
1301 * already have been incremented past the NUL character
1302 * (since all states make transitions on EOB to the
1303 * end-of-buffer state). Contrast this with the test
1304 * in input().
1305 */
1306 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1307 { /* This was really a NUL. */
1308 yy_state_type yy_next_state;
1309
1310 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1311
1312 yy_current_state = yy_get_previous_state( );
1313
1314 /* Okay, we're now positioned to make the NUL
1315 * transition. We couldn't have
1316 * yy_get_previous_state() go ahead and do it
1317 * for us because it doesn't know how to deal
1318 * with the possibility of jamming (and we don't
1319 * want to build jamming into it because then it
1320 * will run more slowly).
1321 */
1322
1323 yy_next_state = yy_try_NUL_trans( yy_current_state );
1324
1325 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1326
1327 if ( yy_next_state )
1328 {
1329 /* Consume the NUL. */
1330 yy_cp = ++(yy_c_buf_p);
1331 yy_current_state = yy_next_state;
1332 goto yy_match;
1333 }
1334
1335 else
1336 {
1337 yy_cp = (yy_c_buf_p);
1338 goto yy_find_action;
1339 }
1340 }
1341
1342 else switch ( yy_get_next_buffer( ) )
1343 {
1344 case EOB_ACT_END_OF_FILE:
1345 {
1346 (yy_did_buffer_switch_on_eof) = 0;
1347
1348 if ( zconfwrap( ) )
1349 {
1350 /* Note: because we've taken care in
1351 * yy_get_next_buffer() to have set up
1352 * zconftext, we can now set up
1353 * yy_c_buf_p so that if some total
1354 * hoser (like flex itself) wants to
1355 * call the scanner after we return the
1356 * YY_NULL, it'll still work - another
1357 * YY_NULL will get returned.
1358 */
1359 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1360
1361 yy_act = YY_STATE_EOF(YY_START);
1362 goto do_action;
1363 }
1364
1365 else
1366 {
1367 if ( ! (yy_did_buffer_switch_on_eof) )
1368 YY_NEW_FILE;
1369 }
1370 break;
1371 }
1372
1373 case EOB_ACT_CONTINUE_SCAN:
1374 (yy_c_buf_p) =
1375 (yytext_ptr) + yy_amount_of_matched_text;
1376
1377 yy_current_state = yy_get_previous_state( );
1378
1379 yy_cp = (yy_c_buf_p);
1380 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1381 goto yy_match;
1382
1383 case EOB_ACT_LAST_MATCH:
1384 (yy_c_buf_p) =
1385 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1386
1387 yy_current_state = yy_get_previous_state( );
1388
1389 yy_cp = (yy_c_buf_p);
1390 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1391 goto yy_find_action;
1392 }
1393 break;
1394 }
1395
1396 default:
1397 YY_FATAL_ERROR(
1398 "fatal flex scanner internal error--no action found" );
1399 } /* end of action switch */
1400 } /* end of scanning one token */
1401 } /* end of zconflex */
1402
1403 /* yy_get_next_buffer - try to read in a new buffer
1404 *
1405 * Returns a code representing an action:
1406 * EOB_ACT_LAST_MATCH -
1407 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1408 * EOB_ACT_END_OF_FILE - end of file
1409 */
1410 static int yy_get_next_buffer (void)
1411 {
1412 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1413 register char *source = (yytext_ptr);
1414 register int number_to_move, i;
1415 int ret_val;
1416
1417 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1418 YY_FATAL_ERROR(
1419 "fatal flex scanner internal error--end of buffer missed" );
1420
1421 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1422 { /* Don't try to fill the buffer, so this is an EOF. */
1423 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1424 {
1425 /* We matched a single character, the EOB, so
1426 * treat this as a final EOF.
1427 */
1428 return EOB_ACT_END_OF_FILE;
1429 }
1430
1431 else
1432 {
1433 /* We matched some text prior to the EOB, first
1434 * process it.
1435 */
1436 return EOB_ACT_LAST_MATCH;
1437 }
1438 }
1439
1440 /* Try to read more data. */
1441
1442 /* First move last chars to start of buffer. */
1443 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1444
1445 for ( i = 0; i < number_to_move; ++i )
1446 *(dest++) = *(source++);
1447
1448 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1449 /* don't do the read, it's not guaranteed to return an EOF,
1450 * just force an EOF
1451 */
1452 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1453
1454 else
1455 {
1456 size_t num_to_read =
1457 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1458
1459 while ( num_to_read <= 0 )
1460 { /* Not enough room in the buffer - grow it. */
1461
1462 /* just a shorter name for the current buffer */
1463 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1464
1465 int yy_c_buf_p_offset =
1466 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1467
1468 if ( b->yy_is_our_buffer )
1469 {
1470 int new_size = b->yy_buf_size * 2;
1471
1472 if ( new_size <= 0 )
1473 b->yy_buf_size += b->yy_buf_size / 8;
1474 else
1475 b->yy_buf_size *= 2;
1476
1477 b->yy_ch_buf = (char *)
1478 /* Include room in for 2 EOB chars. */
1479 zconfrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1480 }
1481 else
1482 /* Can't grow it, we don't own it. */
1483 b->yy_ch_buf = 0;
1484
1485 if ( ! b->yy_ch_buf )
1486 YY_FATAL_ERROR(
1487 "fatal error - scanner input buffer overflow" );
1488
1489 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1490
1491 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1492 number_to_move - 1;
1493
1494 }
1495
1496 if ( num_to_read > YY_READ_BUF_SIZE )
1497 num_to_read = YY_READ_BUF_SIZE;
1498
1499 /* Read in more data. */
1500 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1501 (yy_n_chars), num_to_read );
1502
1503 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1504 }
1505
1506 if ( (yy_n_chars) == 0 )
1507 {
1508 if ( number_to_move == YY_MORE_ADJ )
1509 {
1510 ret_val = EOB_ACT_END_OF_FILE;
1511 zconfrestart(zconfin );
1512 }
1513
1514 else
1515 {
1516 ret_val = EOB_ACT_LAST_MATCH;
1517 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1518 YY_BUFFER_EOF_PENDING;
1519 }
1520 }
1521
1522 else
1523 ret_val = EOB_ACT_CONTINUE_SCAN;
1524
1525 (yy_n_chars) += number_to_move;
1526 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1527 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1528
1529 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1530
1531 return ret_val;
1532 }
1533
1534 /* yy_get_previous_state - get the state just before the EOB char was reached */
1535
1536 static yy_state_type yy_get_previous_state (void)
1537 {
1538 register yy_state_type yy_current_state;
1539 register char *yy_cp;
1540
1541 yy_current_state = (yy_start);
1542
1543 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1544 {
1545 yy_current_state = yy_nxt[yy_current_state][(*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1)];
1546 }
1547
1548 return yy_current_state;
1549 }
1550
1551 /* yy_try_NUL_trans - try to make a transition on the NUL character
1552 *
1553 * synopsis
1554 * next_state = yy_try_NUL_trans( current_state );
1555 */
1556 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1557 {
1558 register int yy_is_jam;
1559
1560 yy_current_state = yy_nxt[yy_current_state][1];
1561 yy_is_jam = (yy_current_state <= 0);
1562
1563 return yy_is_jam ? 0 : yy_current_state;
1564 }
1565
1566 static void yyunput (int c, register char * yy_bp )
1567 {
1568 register char *yy_cp;
1569
1570 yy_cp = (yy_c_buf_p);
1571
1572 /* undo effects of setting up zconftext */
1573 *yy_cp = (yy_hold_char);
1574
1575 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1576 { /* need to shift things up to make room */
1577 /* +2 for EOB chars. */
1578 register int number_to_move = (yy_n_chars) + 2;
1579 register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1580 YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1581 register char *source =
1582 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1583
1584 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1585 *--dest = *--source;
1586
1587 yy_cp += (int) (dest - source);
1588 yy_bp += (int) (dest - source);
1589 YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1590 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1591
1592 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1593 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1594 }
1595
1596 *--yy_cp = (char) c;
1597
1598 (yytext_ptr) = yy_bp;
1599 (yy_hold_char) = *yy_cp;
1600 (yy_c_buf_p) = yy_cp;
1601 }
1602
1603 #ifndef YY_NO_INPUT
1604 #ifdef __cplusplus
1605 static int yyinput (void)
1606 #else
1607 static int input (void)
1608 #endif
1609
1610 {
1611 int c;
1612
1613 *(yy_c_buf_p) = (yy_hold_char);
1614
1615 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1616 {
1617 /* yy_c_buf_p now points to the character we want to return.
1618 * If this occurs *before* the EOB characters, then it's a
1619 * valid NUL; if not, then we've hit the end of the buffer.
1620 */
1621 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1622 /* This was really a NUL. */
1623 *(yy_c_buf_p) = '\0';
1624
1625 else
1626 { /* need more input */
1627 int offset = (yy_c_buf_p) - (yytext_ptr);
1628 ++(yy_c_buf_p);
1629
1630 switch ( yy_get_next_buffer( ) )
1631 {
1632 case EOB_ACT_LAST_MATCH:
1633 /* This happens because yy_g_n_b()
1634 * sees that we've accumulated a
1635 * token and flags that we need to
1636 * try matching the token before
1637 * proceeding. But for input(),
1638 * there's no matching to consider.
1639 * So convert the EOB_ACT_LAST_MATCH
1640 * to EOB_ACT_END_OF_FILE.
1641 */
1642
1643 /* Reset buffer status. */
1644 zconfrestart(zconfin );
1645
1646 /*FALLTHROUGH*/
1647
1648 case EOB_ACT_END_OF_FILE:
1649 {
1650 if ( zconfwrap( ) )
1651 return EOF;
1652
1653 if ( ! (yy_did_buffer_switch_on_eof) )
1654 YY_NEW_FILE;
1655 #ifdef __cplusplus
1656 return yyinput();
1657 #else
1658 return input();
1659 #endif
1660 }
1661
1662 case EOB_ACT_CONTINUE_SCAN:
1663 (yy_c_buf_p) = (yytext_ptr) + offset;
1664 break;
1665 }
1666 }
1667 }
1668
1669 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1670 *(yy_c_buf_p) = '\0'; /* preserve zconftext */
1671 (yy_hold_char) = *++(yy_c_buf_p);
1672
1673 return c;
1674 }
1675 #endif /* ifndef YY_NO_INPUT */
1676
1677 /** Immediately switch to a different input stream.
1678 * @param input_file A readable stream.
1679 *
1680 * @note This function does not reset the start condition to @c INITIAL .
1681 */
1682 void zconfrestart (FILE * input_file )
1683 {
1684
1685 if ( ! YY_CURRENT_BUFFER ){
1686 zconfensure_buffer_stack ();
1687 YY_CURRENT_BUFFER_LVALUE =
1688 zconf_create_buffer(zconfin,YY_BUF_SIZE );
1689 }
1690
1691 zconf_init_buffer(YY_CURRENT_BUFFER,input_file );
1692 zconf_load_buffer_state( );
1693 }
1694
1695 /** Switch to a different input buffer.
1696 * @param new_buffer The new input buffer.
1697 *
1698 */
1699 void zconf_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1700 {
1701
1702 /* TODO. We should be able to replace this entire function body
1703 * with
1704 * zconfpop_buffer_state();
1705 * zconfpush_buffer_state(new_buffer);
1706 */
1707 zconfensure_buffer_stack ();
1708 if ( YY_CURRENT_BUFFER == new_buffer )
1709 return;
1710
1711 if ( YY_CURRENT_BUFFER )
1712 {
1713 /* Flush out information for old buffer. */
1714 *(yy_c_buf_p) = (yy_hold_char);
1715 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1716 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1717 }
1718
1719 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1720 zconf_load_buffer_state( );
1721
1722 /* We don't actually know whether we did this switch during
1723 * EOF (zconfwrap()) processing, but the only time this flag
1724 * is looked at is after zconfwrap() is called, so it's safe
1725 * to go ahead and always set it.
1726 */
1727 (yy_did_buffer_switch_on_eof) = 1;
1728 }
1729
1730 static void zconf_load_buffer_state (void)
1731 {
1732 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1733 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1734 zconfin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1735 (yy_hold_char) = *(yy_c_buf_p);
1736 }
1737
1738 /** Allocate and initialize an input buffer state.
1739 * @param file A readable stream.
1740 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1741 *
1742 * @return the allocated buffer state.
1743 */
1744 YY_BUFFER_STATE zconf_create_buffer (FILE * file, int size )
1745 {
1746 YY_BUFFER_STATE b;
1747
1748 b = (YY_BUFFER_STATE) zconfalloc(sizeof( struct yy_buffer_state ) );
1749 if ( ! b )
1750 YY_FATAL_ERROR( "out of dynamic memory in zconf_create_buffer()" );
1751
1752 b->yy_buf_size = size;
1753
1754 /* yy_ch_buf has to be 2 characters longer than the size given because
1755 * we need to put in 2 end-of-buffer characters.
1756 */
1757 b->yy_ch_buf = (char *) zconfalloc(b->yy_buf_size + 2 );
1758 if ( ! b->yy_ch_buf )
1759 YY_FATAL_ERROR( "out of dynamic memory in zconf_create_buffer()" );
1760
1761 b->yy_is_our_buffer = 1;
1762
1763 zconf_init_buffer(b,file );
1764
1765 return b;
1766 }
1767
1768 /** Destroy the buffer.
1769 * @param b a buffer created with zconf_create_buffer()
1770 *
1771 */
1772 void zconf_delete_buffer (YY_BUFFER_STATE b )
1773 {
1774
1775 if ( ! b )
1776 return;
1777
1778 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1779 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1780
1781 if ( b->yy_is_our_buffer )
1782 zconffree((void *) b->yy_ch_buf );
1783
1784 zconffree((void *) b );
1785 }
1786
1787 /* Initializes or reinitializes a buffer.
1788 * This function is sometimes called more than once on the same buffer,
1789 * such as during a zconfrestart() or at EOF.
1790 */
1791 static void zconf_init_buffer (YY_BUFFER_STATE b, FILE * file )
1792
1793 {
1794 int oerrno = errno;
1795
1796 zconf_flush_buffer(b );
1797
1798 b->yy_input_file = file;
1799 b->yy_fill_buffer = 1;
1800
1801 /* If b is the current buffer, then zconf_init_buffer was _probably_
1802 * called from zconfrestart() or through yy_get_next_buffer.
1803 * In that case, we don't want to reset the lineno or column.
1804 */
1805 if (b != YY_CURRENT_BUFFER){
1806 b->yy_bs_lineno = 1;
1807 b->yy_bs_column = 0;
1808 }
1809
1810 b->yy_is_interactive = 0;
1811
1812 errno = oerrno;
1813 }
1814
1815 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1816 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1817 *
1818 */
1819 void zconf_flush_buffer (YY_BUFFER_STATE b )
1820 {
1821 if ( ! b )
1822 return;
1823
1824 b->yy_n_chars = 0;
1825
1826 /* We always need two end-of-buffer characters. The first causes
1827 * a transition to the end-of-buffer state. The second causes
1828 * a jam in that state.
1829 */
1830 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1831 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1832
1833 b->yy_buf_pos = &b->yy_ch_buf[0];
1834
1835 b->yy_at_bol = 1;
1836 b->yy_buffer_status = YY_BUFFER_NEW;
1837
1838 if ( b == YY_CURRENT_BUFFER )
1839 zconf_load_buffer_state( );
1840 }
1841
1842 /** Pushes the new state onto the stack. The new state becomes
1843 * the current state. This function will allocate the stack
1844 * if necessary.
1845 * @param new_buffer The new state.
1846 *
1847 */
1848 void zconfpush_buffer_state (YY_BUFFER_STATE new_buffer )
1849 {
1850 if (new_buffer == NULL)
1851 return;
1852
1853 zconfensure_buffer_stack();
1854
1855 /* This block is copied from zconf_switch_to_buffer. */
1856 if ( YY_CURRENT_BUFFER )
1857 {
1858 /* Flush out information for old buffer. */
1859 *(yy_c_buf_p) = (yy_hold_char);
1860 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1861 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1862 }
1863
1864 /* Only push if top exists. Otherwise, replace top. */
1865 if (YY_CURRENT_BUFFER)
1866 (yy_buffer_stack_top)++;
1867 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1868
1869 /* copied from zconf_switch_to_buffer. */
1870 zconf_load_buffer_state( );
1871 (yy_did_buffer_switch_on_eof) = 1;
1872 }
1873
1874 /** Removes and deletes the top of the stack, if present.
1875 * The next element becomes the new top.
1876 *
1877 */
1878 void zconfpop_buffer_state (void)
1879 {
1880 if (!YY_CURRENT_BUFFER)
1881 return;
1882
1883 zconf_delete_buffer(YY_CURRENT_BUFFER );
1884 YY_CURRENT_BUFFER_LVALUE = NULL;
1885 if ((yy_buffer_stack_top) > 0)
1886 --(yy_buffer_stack_top);
1887
1888 if (YY_CURRENT_BUFFER) {
1889 zconf_load_buffer_state( );
1890 (yy_did_buffer_switch_on_eof) = 1;
1891 }
1892 }
1893
1894 /* Allocates the stack if it does not exist.
1895 * Guarantees space for at least one push.
1896 */
1897 static void zconfensure_buffer_stack (void)
1898 {
1899 int num_to_alloc;
1900
1901 if (!(yy_buffer_stack)) {
1902
1903 /* First allocation is just for 2 elements, since we don't know if this
1904 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1905 * immediate realloc on the next call.
1906 */
1907 num_to_alloc = 1;
1908 (yy_buffer_stack) = (struct yy_buffer_state**)zconfalloc
1909 (num_to_alloc * sizeof(struct yy_buffer_state*)
1910 );
1911
1912 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1913
1914 (yy_buffer_stack_max) = num_to_alloc;
1915 (yy_buffer_stack_top) = 0;
1916 return;
1917 }
1918
1919 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1920
1921 /* Increase the buffer to prepare for a possible push. */
1922 int grow_size = 8 /* arbitrary grow size */;
1923
1924 num_to_alloc = (yy_buffer_stack_max) + grow_size;
1925 (yy_buffer_stack) = (struct yy_buffer_state**)zconfrealloc
1926 ((yy_buffer_stack),
1927 num_to_alloc * sizeof(struct yy_buffer_state*)
1928 );
1929
1930 /* zero only the new slots.*/
1931 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1932 (yy_buffer_stack_max) = num_to_alloc;
1933 }
1934 }
1935
1936 /** Setup the input buffer state to scan directly from a user-specified character buffer.
1937 * @param base the character buffer
1938 * @param size the size in bytes of the character buffer
1939 *
1940 * @return the newly allocated buffer state object.
1941 */
1942 YY_BUFFER_STATE zconf_scan_buffer (char * base, yy_size_t size )
1943 {
1944 YY_BUFFER_STATE b;
1945
1946 if ( size < 2 ||
1947 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1948 base[size-1] != YY_END_OF_BUFFER_CHAR )
1949 /* They forgot to leave room for the EOB's. */
1950 return 0;
1951
1952 b = (YY_BUFFER_STATE) zconfalloc(sizeof( struct yy_buffer_state ) );
1953 if ( ! b )
1954 YY_FATAL_ERROR( "out of dynamic memory in zconf_scan_buffer()" );
1955
1956 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1957 b->yy_buf_pos = b->yy_ch_buf = base;
1958 b->yy_is_our_buffer = 0;
1959 b->yy_input_file = 0;
1960 b->yy_n_chars = b->yy_buf_size;
1961 b->yy_is_interactive = 0;
1962 b->yy_at_bol = 1;
1963 b->yy_fill_buffer = 0;
1964 b->yy_buffer_status = YY_BUFFER_NEW;
1965
1966 zconf_switch_to_buffer(b );
1967
1968 return b;
1969 }
1970
1971 /** Setup the input buffer state to scan a string. The next call to zconflex() will
1972 * scan from a @e copy of @a str.
1973 * @param str a NUL-terminated string to scan
1974 *
1975 * @return the newly allocated buffer state object.
1976 * @note If you want to scan bytes that may contain NUL values, then use
1977 * zconf_scan_bytes() instead.
1978 */
1979 YY_BUFFER_STATE zconf_scan_string (yyconst char * yy_str )
1980 {
1981
1982 return zconf_scan_bytes(yy_str,strlen(yy_str) );
1983 }
1984
1985 /** Setup the input buffer state to scan the given bytes. The next call to zconflex() will
1986 * scan from a @e copy of @a bytes.
1987 * @param bytes the byte buffer to scan
1988 * @param len the number of bytes in the buffer pointed to by @a bytes.
1989 *
1990 * @return the newly allocated buffer state object.
1991 */
1992 YY_BUFFER_STATE zconf_scan_bytes (yyconst char * bytes, int len )
1993 {
1994 YY_BUFFER_STATE b;
1995 char *buf;
1996 yy_size_t n;
1997 int i;
1998
1999 /* Get memory for full buffer, including space for trailing EOB's. */
2000 n = len + 2;
2001 buf = (char *) zconfalloc(n );
2002 if ( ! buf )
2003 YY_FATAL_ERROR( "out of dynamic memory in zconf_scan_bytes()" );
2004
2005 for ( i = 0; i < len; ++i )
2006 buf[i] = bytes[i];
2007
2008 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
2009
2010 b = zconf_scan_buffer(buf,n );
2011 if ( ! b )
2012 YY_FATAL_ERROR( "bad buffer in zconf_scan_bytes()" );
2013
2014 /* It's okay to grow etc. this buffer, and we should throw it
2015 * away when we're done.
2016 */
2017 b->yy_is_our_buffer = 1;
2018
2019 return b;
2020 }
2021
2022 #ifndef YY_EXIT_FAILURE
2023 #define YY_EXIT_FAILURE 2
2024 #endif
2025
2026 static void yy_fatal_error (yyconst char* msg )
2027 {
2028 (void) fprintf( stderr, "%s\n", msg );
2029 exit( YY_EXIT_FAILURE );
2030 }
2031
2032 /* Redefine yyless() so it works in section 3 code. */
2033
2034 #undef yyless
2035 #define yyless(n) \
2036 do \
2037 { \
2038 /* Undo effects of setting up zconftext. */ \
2039 int yyless_macro_arg = (n); \
2040 YY_LESS_LINENO(yyless_macro_arg);\
2041 zconftext[zconfleng] = (yy_hold_char); \
2042 (yy_c_buf_p) = zconftext + yyless_macro_arg; \
2043 (yy_hold_char) = *(yy_c_buf_p); \
2044 *(yy_c_buf_p) = '\0'; \
2045 zconfleng = yyless_macro_arg; \
2046 } \
2047 while ( 0 )
2048
2049 /* Accessor methods (get/set functions) to struct members. */
2050
2051 /** Get the current line number.
2052 *
2053 */
2054 int zconfget_lineno (void)
2055 {
2056
2057 return zconflineno;
2058 }
2059
2060 /** Get the input stream.
2061 *
2062 */
2063 FILE *zconfget_in (void)
2064 {
2065 return zconfin;
2066 }
2067
2068 /** Get the output stream.
2069 *
2070 */
2071 FILE *zconfget_out (void)
2072 {
2073 return zconfout;
2074 }
2075
2076 /** Get the length of the current token.
2077 *
2078 */
2079 int zconfget_leng (void)
2080 {
2081 return zconfleng;
2082 }
2083
2084 /** Get the current token.
2085 *
2086 */
2087
2088 char *zconfget_text (void)
2089 {
2090 return zconftext;
2091 }
2092
2093 /** Set the current line number.
2094 * @param line_number
2095 *
2096 */
2097 void zconfset_lineno (int line_number )
2098 {
2099
2100 zconflineno = line_number;
2101 }
2102
2103 /** Set the input stream. This does not discard the current
2104 * input buffer.
2105 * @param in_str A readable stream.
2106 *
2107 * @see zconf_switch_to_buffer
2108 */
2109 void zconfset_in (FILE * in_str )
2110 {
2111 zconfin = in_str ;
2112 }
2113
2114 void zconfset_out (FILE * out_str )
2115 {
2116 zconfout = out_str ;
2117 }
2118
2119 int zconfget_debug (void)
2120 {
2121 return zconf_flex_debug;
2122 }
2123
2124 void zconfset_debug (int bdebug )
2125 {
2126 zconf_flex_debug = bdebug ;
2127 }
2128
2129 /* zconflex_destroy is for both reentrant and non-reentrant scanners. */
2130 int zconflex_destroy (void)
2131 {
2132
2133 /* Pop the buffer stack, destroying each element. */
2134 while(YY_CURRENT_BUFFER){
2135 zconf_delete_buffer(YY_CURRENT_BUFFER );
2136 YY_CURRENT_BUFFER_LVALUE = NULL;
2137 zconfpop_buffer_state();
2138 }
2139
2140 /* Destroy the stack itself. */
2141 zconffree((yy_buffer_stack) );
2142 (yy_buffer_stack) = NULL;
2143
2144 return 0;
2145 }
2146
2147 /*
2148 * Internal utility routines.
2149 */
2150
2151 #ifndef yytext_ptr
2152 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
2153 {
2154 register int i;
2155 for ( i = 0; i < n; ++i )
2156 s1[i] = s2[i];
2157 }
2158 #endif
2159
2160 #ifdef YY_NEED_STRLEN
2161 static int yy_flex_strlen (yyconst char * s )
2162 {
2163 register int n;
2164 for ( n = 0; s[n]; ++n )
2165 ;
2166
2167 return n;
2168 }
2169 #endif
2170
2171 void *zconfalloc (yy_size_t size )
2172 {
2173 return (void *) malloc( size );
2174 }
2175
2176 void *zconfrealloc (void * ptr, yy_size_t size )
2177 {
2178 /* The cast to (char *) in the following accommodates both
2179 * implementations that use char* generic pointers, and those
2180 * that use void* generic pointers. It works with the latter
2181 * because both ANSI C and C++ allow castless assignment from
2182 * any pointer type to void*, and deal with argument conversions
2183 * as though doing an assignment.
2184 */
2185 return (void *) realloc( (char *) ptr, size );
2186 }
2187
2188 void zconffree (void * ptr )
2189 {
2190 free( (char *) ptr ); /* see zconfrealloc() for (char *) cast */
2191 }
2192
2193 #define YYTABLES_NAME "yytables"
2194
2195 #undef YY_NEW_FILE
2196 #undef YY_FLUSH_BUFFER
2197 #undef yy_set_bol
2198 #undef yy_new_buffer
2199 #undef yy_set_interactive
2200 #undef yytext_ptr
2201 #undef YY_DO_BEFORE_ACTION
2202
2203 #ifdef YY_DECL_IS_OURS
2204 #undef YY_DECL_IS_OURS
2205 #undef YY_DECL
2206 #endif
2207
2208 void zconf_starthelp(void)
2209 {
2210 new_string();
2211 last_ts = first_ts = 0;
2212 BEGIN(HELP);
2213 }
2214
2215 static void zconf_endhelp(void)
2216 {
2217 zconflval.string = text;
2218 BEGIN(INITIAL);
2219 }
2220
2221 /*
2222 * Try to open specified file with following names:
2223 * ./name
2224 * $(srctree)/name
2225 * The latter is used when srctree is separate from objtree
2226 * when compiling the kernel.
2227 * Return NULL if file is not found.
2228 */
2229 FILE *zconf_fopen(const char *name)
2230 {
2231 char *env, fullname[PATH_MAX+1];
2232 FILE *f;
2233
2234 f = fopen(name, "r");
2235 if (!f && name[0] != '/') {
2236 env = getenv(SRCTREE);
2237 if (env) {
2238 sprintf(fullname, "%s/%s", env, name);
2239 f = fopen(fullname, "r");
2240 }
2241 }
2242 return f;
2243 }
2244
2245 void zconf_initscan(const char *name)
2246 {
2247 zconfin = zconf_fopen(name);
2248 if (!zconfin) {
2249 printf("can't find file %s\n", name);
2250 exit(1);
2251 }
2252
2253 current_buf = malloc(sizeof(*current_buf));
2254 memset(current_buf, 0, sizeof(*current_buf));
2255
2256 current_file = file_lookup(name);
2257 current_file->lineno = 1;
2258 current_file->flags = FILE_BUSY;
2259 }
2260
2261 void zconf_nextfile(const char *name)
2262 {
2263 size_t i;
2264 int retval;
2265 glob_t files;
2266 char *filename;
2267 struct file *file;
2268 struct buffer *buf;
2269
2270 retval = glob(name, GLOB_ERR | GLOB_MARK, NULL, &files);
2271 if (retval == GLOB_NOMATCH)
2272 return;
2273
2274 if (retval == GLOB_NOSPACE || retval == GLOB_ABORTED) {
2275 printf("%s:%d: glob failed: %s \"%s\"\n", zconf_curname(), zconf_lineno(),
2276 retval == GLOB_NOSPACE ? "failed to allocate memory" :
2277 retval == GLOB_ABORTED ? "read error" : "no match",
2278 name);
2279 exit(1);
2280 }
2281
2282 for (i = files.gl_pathc-1; i != (size_t)-1; --i) {
2283 filename = files.gl_pathv[i];
2284
2285 file = file_lookup(filename);
2286 buf = malloc(sizeof(*buf));
2287 memset(buf, 0, sizeof(*buf));
2288 current_buf->state = YY_CURRENT_BUFFER;
2289 zconfin = zconf_fopen(filename);
2290 if (!zconfin) {
2291 printf("%s:%d: can't open file \"%s\"\n",
2292 zconf_curname(), zconf_lineno(), filename);
2293 exit(1);
2294 }
2295 zconf_switch_to_buffer(zconf_create_buffer(zconfin,YY_BUF_SIZE));
2296 buf->parent = current_buf;
2297 current_buf = buf;
2298
2299 if (file->flags & FILE_BUSY) {
2300 printf("recursive scan (%s)?\n", filename);
2301 exit(1);
2302 }
2303 if (file->flags & FILE_SCANNED) {
2304 printf("file %s already scanned?\n", filename);
2305 exit(1);
2306 }
2307 file->flags |= FILE_BUSY;
2308 file->lineno = 1;
2309 file->parent = current_file;
2310 current_file = file;
2311 }
2312 }
2313
2314 static void zconf_endfile(void)
2315 {
2316 struct buffer *parent;
2317
2318 current_file->flags |= FILE_SCANNED;
2319 current_file->flags &= ~FILE_BUSY;
2320 current_file = current_file->parent;
2321
2322 parent = current_buf->parent;
2323 if (parent) {
2324 fclose(zconfin);
2325 zconf_delete_buffer(YY_CURRENT_BUFFER);
2326 zconf_switch_to_buffer(parent->state);
2327 }
2328 free(current_buf);
2329 current_buf = parent;
2330 }
2331
2332 int zconf_lineno(void)
2333 {
2334 return current_pos.lineno;
2335 }
2336
2337 char *zconf_curname(void)
2338 {
2339 return current_pos.file ? current_pos.file->name : "<none>";
2340 }
2341
This page took 0.14759 seconds and 5 git commands to generate.