4 #define YY_INT_ALIGNED short int
6 /* A lexical scanner generated by flex */
9 #define YY_FLEX_MAJOR_VERSION 2
10 #define YY_FLEX_MINOR_VERSION 5
11 #define YY_FLEX_SUBMINOR_VERSION 35
12 #if YY_FLEX_SUBMINOR_VERSION > 0
16 /* First, we deal with platform-specific or compiler-specific issues. */
18 /* begin standard C headers. */
24 /* end standard C headers. */
26 /* flex integer type definitions */
31 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
33 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
35 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
36 * if you want the limit (max/min) macros for int types.
38 #ifndef __STDC_LIMIT_MACROS
39 #define __STDC_LIMIT_MACROS 1
43 typedef int8_t flex_int8_t;
44 typedef uint8_t flex_uint8_t;
45 typedef int16_t flex_int16_t;
46 typedef uint16_t flex_uint16_t;
47 typedef int32_t flex_int32_t;
48 typedef uint32_t flex_uint32_t;
50 typedef signed char flex_int8_t;
51 typedef short int flex_int16_t;
52 typedef int flex_int32_t;
53 typedef unsigned char flex_uint8_t;
54 typedef unsigned short int flex_uint16_t;
55 typedef unsigned int flex_uint32_t;
58 /* Limits of integral types. */
60 #define INT8_MIN (-128)
63 #define INT16_MIN (-32767-1)
66 #define INT32_MIN (-2147483647-1)
69 #define INT8_MAX (127)
72 #define INT16_MAX (32767)
75 #define INT32_MAX (2147483647)
78 #define UINT8_MAX (255U)
81 #define UINT16_MAX (65535U)
84 #define UINT32_MAX (4294967295U)
87 #endif /* ! FLEXINT_H */
91 /* The "const" storage-class-modifier is valid. */
94 #else /* ! __cplusplus */
96 /* C99 requires __STDC__ to be defined as 1. */
97 #if defined (__STDC__)
101 #endif /* defined (__STDC__) */
102 #endif /* ! __cplusplus */
105 #define yyconst const
110 /* Returned upon end-of-file. */
113 /* Promotes a possibly negative, possibly signed char to an unsigned
114 * integer for use as an array index. If the signed char is negative,
115 * we want to instead treat it as an 8-bit unsigned char, hence the
118 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
120 /* Enter a start condition. This macro really ought to take a parameter,
121 * but we do it the disgusting crufty way forced on us by the ()-less
122 * definition of BEGIN.
124 #define BEGIN (yy_start) = 1 + 2 *
126 /* Translate the current start state into a value that can be later handed
127 * to BEGIN to return to the state. The YYSTATE alias is for lex
130 #define YY_START (((yy_start) - 1) / 2)
131 #define YYSTATE YY_START
133 /* Action number for EOF rule of a given start state. */
134 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
136 /* Special action meaning "start processing a new file". */
137 #define YY_NEW_FILE yyrestart(yyin )
139 #define YY_END_OF_BUFFER_CHAR 0
141 /* Size of default input buffer. */
143 #define YY_BUF_SIZE 16384
146 /* The state buf must be large enough to hold one state per character in the main buffer.
148 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
150 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
151 #define YY_TYPEDEF_YY_BUFFER_STATE
152 typedef struct yy_buffer_state *YY_BUFFER_STATE;
157 extern FILE *yyin, *yyout;
159 #define EOB_ACT_CONTINUE_SCAN 0
160 #define EOB_ACT_END_OF_FILE 1
161 #define EOB_ACT_LAST_MATCH 2
163 #define YY_LESS_LINENO(n)
165 /* Return all but the first "n" matched characters back to the input stream. */
169 /* Undo effects of setting up yytext. */ \
170 int yyless_macro_arg = (n); \
171 YY_LESS_LINENO(yyless_macro_arg);\
172 *yy_cp = (yy_hold_char); \
173 YY_RESTORE_YY_MORE_OFFSET \
174 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
175 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
179 #define unput(c) yyunput( c, (yytext_ptr) )
181 #ifndef YY_TYPEDEF_YY_SIZE_T
182 #define YY_TYPEDEF_YY_SIZE_T
183 typedef size_t yy_size_t;
186 #ifndef YY_STRUCT_YY_BUFFER_STATE
187 #define YY_STRUCT_YY_BUFFER_STATE
188 struct yy_buffer_state
192 char *yy_ch_buf; /* input buffer */
193 char *yy_buf_pos; /* current position in input buffer */
195 /* Size of input buffer in bytes, not including room for EOB
198 yy_size_t yy_buf_size;
200 /* Number of characters read into yy_ch_buf, not including EOB
205 /* Whether we "own" the buffer - i.e., we know we created it,
206 * and can realloc() it to grow it, and should free() it to
209 int yy_is_our_buffer;
211 /* Whether this is an "interactive" input source; if so, and
212 * if we're using stdio for input, then we want to use getc()
213 * instead of fread(), to make sure we stop fetching input after
216 int yy_is_interactive;
218 /* Whether we're considered to be at the beginning of a line.
219 * If so, '^' rules will be active on the next match, otherwise
224 int yy_bs_lineno; /**< The line count. */
225 int yy_bs_column; /**< The column count. */
227 /* Whether to try to fill the input buffer when we reach the
232 int yy_buffer_status;
234 #define YY_BUFFER_NEW 0
235 #define YY_BUFFER_NORMAL 1
236 /* When an EOF's been seen but there's still some text to process
237 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
238 * shouldn't try reading from the input source any more. We might
239 * still have a bunch of tokens to match, though, because of
240 * possible backing-up.
242 * When we actually see the EOF, we change the status to "new"
243 * (via yyrestart()), so that the user can continue scanning by
244 * just pointing yyin at a new input file.
246 #define YY_BUFFER_EOF_PENDING 2
249 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
251 /* Stack of input buffers. */
252 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
253 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
254 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
256 /* We provide macros for accessing buffer states in case in the
257 * future we want to put the buffer states in a more general
260 * Returns the top of the stack, or NULL.
262 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
263 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
266 /* Same as previous macro, but useful when we know that the buffer stack is not
267 * NULL or when we need an lvalue. For internal use only.
269 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
271 /* yy_hold_char holds the character lost when yytext is formed. */
272 static char yy_hold_char;
273 static int yy_n_chars; /* number of characters read into yy_ch_buf */
276 /* Points to current character in buffer. */
277 static char *yy_c_buf_p = (char *) 0;
278 static int yy_init = 0; /* whether we need to initialize */
279 static int yy_start = 0; /* start state number */
281 /* Flag which is used to allow yywrap()'s to do buffer switches
282 * instead of setting up a fresh yyin. A bit of a hack ...
284 static int yy_did_buffer_switch_on_eof;
286 void yyrestart (FILE *input_file );
287 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer );
288 YY_BUFFER_STATE yy_create_buffer (FILE *file,int size );
289 void yy_delete_buffer (YY_BUFFER_STATE b );
290 void yy_flush_buffer (YY_BUFFER_STATE b );
291 void yypush_buffer_state (YY_BUFFER_STATE new_buffer );
292 void yypop_buffer_state (void );
294 static void yyensure_buffer_stack (void );
295 static void yy_load_buffer_state (void );
296 static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file );
298 #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
300 YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size );
301 YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str );
302 YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len );
304 void *yyalloc (yy_size_t );
305 void *yyrealloc (void *,yy_size_t );
306 void yyfree (void * );
308 #define yy_new_buffer yy_create_buffer
310 #define yy_set_interactive(is_interactive) \
312 if ( ! YY_CURRENT_BUFFER ){ \
313 yyensure_buffer_stack (); \
314 YY_CURRENT_BUFFER_LVALUE = \
315 yy_create_buffer(yyin,YY_BUF_SIZE ); \
317 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
320 #define yy_set_bol(at_bol) \
322 if ( ! YY_CURRENT_BUFFER ){\
323 yyensure_buffer_stack (); \
324 YY_CURRENT_BUFFER_LVALUE = \
325 yy_create_buffer(yyin,YY_BUF_SIZE ); \
327 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
330 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
332 /* Begin user sect3 */
334 typedef unsigned char YY_CHAR;
336 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
338 typedef int yy_state_type;
345 #define yytext_ptr yytext
347 static yy_state_type yy_get_previous_state (void );
348 static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
349 static int yy_get_next_buffer (void );
350 static void yy_fatal_error (yyconst char msg[] );
352 /* Done after the current pattern has been matched and before the
353 * corresponding action - sets up yytext.
355 #define YY_DO_BEFORE_ACTION \
356 (yytext_ptr) = yy_bp; \
357 yyleng = (size_t) (yy_cp - yy_bp); \
358 (yy_hold_char) = *yy_cp; \
360 (yy_c_buf_p) = yy_cp;
362 #define YY_NUM_RULES 24
363 #define YY_END_OF_BUFFER 25
364 /* This struct is not used in this scanner,
365 but its presence is necessary. */
368 flex_int32_t yy_verify;
371 static yyconst flex_int16_t yy_acclist[127] =
373 25, 13, 23, 24, 20, 23, 24, 22, 24, 23,
374 24, 3, 13, 23, 24, 23, 24, 12, 13, 23,
375 24, 20, 23, 24, 3, 13, 23, 24, 9, 13,
376 23, 24, 10, 12, 13, 23, 24, 24, 24, 17,
377 24, 24, 21, 24, 8, 13, 23, 24, 8, 13,
378 23, 24, 11, 13, 23, 24, 11, 13, 23, 24,
379 11, 13, 23, 24, 13, 20, 14, 3, 13, 3,
380 2, 12, 13, 20, 9, 10, 3, 3, 13, 10,
381 12, 13, 17, 19, 18, 7, 13, 13, 8, 13,
382 11, 13, 11, 13, 11, 13, 16, 15, 10, 3,
384 3, 13, 7, 13, 6, 13, 4, 11, 13, 5,
385 11, 13, 3, 3, 13, 6, 13, 3, 3, 13,
389 static yyconst flex_int16_t yy_accept[86] =
391 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
392 5, 8, 10, 12, 16, 18, 22, 25, 29, 33,
393 38, 39, 40, 42, 43, 45, 49, 53, 57, 61,
394 65, 66, 67, 67, 68, 68, 70, 71, 72, 74,
395 75, 75, 76, 77, 78, 80, 83, 83, 84, 84,
396 85, 86, 88, 89, 91, 93, 95, 97, 98, 99,
397 99, 99, 100, 101, 103, 105, 107, 110, 113, 113,
398 114, 116, 118, 118, 119, 121, 121, 122, 123, 123,
399 124, 126, 126, 127, 127
402 static yyconst flex_int32_t yy_ec[256] =
404 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
405 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
406 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
407 1, 2, 1, 4, 5, 1, 1, 1, 1, 1,
408 1, 1, 1, 6, 7, 1, 1, 8, 9, 9,
409 9, 9, 9, 9, 9, 10, 10, 1, 1, 1,
410 6, 1, 11, 1, 12, 12, 12, 12, 12, 12,
411 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
412 13, 13, 13, 13, 13, 13, 13, 14, 13, 13,
413 6, 15, 6, 1, 13, 1, 16, 12, 12, 17,
415 18, 19, 13, 13, 20, 13, 13, 21, 13, 22,
416 23, 24, 13, 13, 13, 13, 13, 13, 13, 14,
417 13, 13, 6, 1, 6, 1, 1, 1, 1, 1,
418 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
419 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
420 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
421 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
422 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
423 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
424 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
426 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
427 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
428 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
429 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
430 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
434 static yyconst flex_int32_t yy_meta[25] =
436 1, 2, 3, 4, 5, 4, 6, 6, 6, 6,
437 5, 7, 7, 7, 1, 7, 7, 7, 7, 7,
441 static yyconst flex_int16_t yy_base[100] =
443 0, 24, 46, 48, 50, 52, 67, 0, 186, 0,
444 183, 346, 88, 102, 346, 108, 55, 122, 0, 143,
445 92, 346, 346, 180, 346, 50, 85, 158, 173, 81,
446 0, 180, 95, 346, 178, 96, 177, 346, 192, 109,
447 100, 346, 0, 113, 110, 207, 114, 346, 176, 346,
448 346, 124, 215, 127, 158, 157, 121, 346, 346, 120,
449 155, 0, 136, 125, 141, 227, 153, 149, 144, 139,
450 149, 0, 144, 142, 150, 155, 162, 152, 150, 98,
451 346, 59, 346, 346, 246, 253, 260, 267, 274, 280,
452 287, 294, 301, 308, 315, 322, 324, 331, 338
456 static yyconst flex_int16_t yy_def[100] =
458 84, 84, 85, 85, 85, 85, 84, 7, 84, 86,
459 84, 84, 87, 88, 84, 89, 90, 88, 86, 91,
460 92, 84, 84, 93, 84, 86, 86, 94, 94, 29,
461 86, 84, 87, 84, 95, 18, 96, 84, 89, 90,
462 84, 84, 97, 96, 18, 91, 92, 84, 93, 84,
463 84, 86, 86, 86, 29, 29, 29, 84, 84, 84,
464 84, 97, 96, 18, 86, 86, 29, 29, 84, 96,
465 18, 66, 84, 96, 18, 84, 96, 98, 99, 98,
466 84, 99, 84, 0, 84, 84, 84, 84, 84, 84,
467 84, 84, 84, 84, 84, 84, 84, 84, 84
471 static yyconst flex_int16_t yy_nxt[371] =
473 10, 11, 12, 13, 14, 15, 10, 10, 10, 10,
474 10, 16, 16, 16, 10, 16, 16, 16, 16, 16,
475 16, 16, 16, 16, 10, 17, 12, 13, 18, 15,
476 10, 10, 10, 10, 19, 20, 20, 20, 10, 20,
477 20, 20, 20, 20, 20, 20, 20, 20, 22, 23,
478 22, 23, 22, 23, 22, 23, 40, 52, 52, 41,
479 24, 83, 24, 53, 24, 42, 24, 10, 11, 25,
480 15, 10, 15, 10, 26, 27, 27, 10, 28, 28,
481 28, 10, 28, 28, 28, 28, 28, 28, 28, 29,
482 30, 34, 54, 54, 54, 48, 57, 37, 34, 55,
484 81, 60, 35, 37, 38, 37, 49, 37, 31, 35,
485 40, 37, 31, 41, 44, 38, 36, 48, 31, 42,
486 61, 60, 31, 44, 38, 37, 37, 37, 49, 64,
487 36, 65, 65, 63, 54, 54, 54, 68, 38, 55,
488 61, 38, 45, 31, 38, 36, 71, 31, 65, 65,
489 37, 78, 83, 31, 81, 70, 79, 31, 31, 77,
490 74, 76, 31, 78, 38, 73, 75, 55, 31, 36,
491 36, 55, 31, 31, 69, 67, 55, 31, 51, 38,
492 59, 32, 51, 31, 32, 84, 84, 31, 84, 84,
493 84, 56, 31, 84, 84, 84, 31, 84, 84, 84,
495 84, 84, 31, 84, 84, 84, 31, 31, 84, 84,
496 84, 31, 84, 84, 84, 84, 84, 31, 84, 84,
497 84, 31, 66, 66, 66, 84, 66, 84, 84, 84,
498 66, 66, 66, 66, 72, 72, 72, 84, 72, 84,
499 84, 84, 72, 72, 72, 72, 21, 21, 21, 21,
500 21, 21, 21, 31, 84, 84, 84, 31, 31, 31,
501 33, 33, 84, 33, 33, 33, 33, 36, 36, 36,
502 36, 36, 36, 36, 39, 84, 84, 84, 39, 39,
503 39, 43, 84, 84, 43, 84, 43, 46, 84, 84,
504 84, 46, 46, 46, 47, 47, 84, 47, 47, 47,
506 47, 50, 50, 50, 50, 50, 50, 50, 55, 84,
507 84, 84, 55, 55, 55, 58, 58, 58, 58, 58,
508 58, 58, 37, 37, 37, 37, 37, 37, 37, 62,
509 62, 80, 80, 80, 80, 80, 80, 80, 82, 82,
510 82, 82, 82, 82, 82, 9, 84, 84, 84, 84,
511 84, 84, 84, 84, 84, 84, 84, 84, 84, 84,
512 84, 84, 84, 84, 84, 84, 84, 84, 84, 84
515 static yyconst flex_int16_t yy_chk[371] =
517 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
518 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
519 1, 1, 1, 1, 2, 2, 2, 2, 2, 2,
520 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
521 2, 2, 2, 2, 2, 2, 2, 2, 3, 3,
522 4, 4, 5, 5, 6, 6, 17, 26, 26, 17,
523 3, 82, 4, 26, 5, 17, 6, 7, 7, 7,
524 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
525 7, 7, 7, 7, 7, 7, 7, 7, 7, 7,
526 7, 13, 27, 27, 27, 21, 30, 36, 33, 30,
528 80, 41, 13, 14, 14, 14, 21, 14, 16, 33,
529 40, 45, 16, 40, 44, 44, 36, 47, 16, 40,
530 41, 60, 16, 18, 18, 18, 64, 18, 47, 45,
531 45, 52, 52, 44, 54, 54, 54, 57, 63, 57,
532 60, 70, 18, 20, 74, 64, 64, 20, 65, 65,
533 71, 75, 79, 20, 78, 63, 76, 20, 28, 74,
534 70, 73, 28, 77, 77, 69, 71, 68, 28, 71,
535 75, 67, 28, 29, 61, 56, 55, 29, 49, 37,
536 35, 32, 24, 29, 11, 9, 0, 29, 0, 0,
537 0, 29, 39, 0, 0, 0, 39, 0, 0, 0,
539 0, 0, 39, 0, 0, 0, 39, 46, 0, 0,
540 0, 46, 0, 0, 0, 0, 0, 46, 0, 0,
541 0, 46, 53, 53, 53, 0, 53, 0, 0, 0,
542 53, 53, 53, 53, 66, 66, 66, 0, 66, 0,
543 0, 0, 66, 66, 66, 66, 85, 85, 85, 85,
544 85, 85, 85, 86, 0, 0, 0, 86, 86, 86,
545 87, 87, 0, 87, 87, 87, 87, 88, 88, 88,
546 88, 88, 88, 88, 89, 0, 0, 0, 89, 89,
547 89, 90, 0, 0, 90, 0, 90, 91, 0, 0,
548 0, 91, 91, 91, 92, 92, 0, 92, 92, 92,
550 92, 93, 93, 93, 93, 93, 93, 93, 94, 0,
551 0, 0, 94, 94, 94, 95, 95, 95, 95, 95,
552 95, 95, 96, 96, 96, 96, 96, 96, 96, 97,
553 97, 98, 98, 98, 98, 98, 98, 98, 99, 99,
554 99, 99, 99, 99, 99, 84, 84, 84, 84, 84,
555 84, 84, 84, 84, 84, 84, 84, 84, 84, 84,
556 84, 84, 84, 84, 84, 84, 84, 84, 84, 84
559 extern int yy_flex_debug;
560 int yy_flex_debug = 0;
562 static yy_state_type *yy_state_buf=0, *yy_state_ptr=0;
563 static char *yy_full_match;
567 *yy_cp = (yy_hold_char); /* undo effects of setting up yytext */ \
568 yy_cp = (yy_full_match); /* restore poss. backed-over text */ \
573 #define yymore() yymore_used_but_not_detected
574 #define YY_MORE_ADJ 0
575 #define YY_RESTORE_YY_MORE_OFFSET
579 /* This file is part of GDBM, the GNU data base manager.
580 Copyright (C) 1990, 1991, 1993, 2007, 2011, 2013 Free Software Foundation,
583 GDBM is free software; you can redistribute it and/or modify
584 it under the terms of the GNU General Public License as published by
585 the Free Software Foundation; either version 3, or (at your option)
588 GDBM is distributed in the hope that it will be useful,
589 but WITHOUT ANY WARRANTY; without even the implied warranty of
590 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
591 GNU General Public License for more details.
593 You should have received a copy of the GNU General Public License
594 along with GDBM. If not, see <http://www.gnu.org/licenses/>. */
596 #include "gdbmtool.h"
601 /* Advance locus to the next line */
609 #define YY_USER_ACTION \
614 yylloc.beg = point; \
617 point.col += yyleng; \
618 yylloc.end = point; \
623 #define YY_INPUT(buf,result,max_size) \
626 result = read_input (buf, max_size); \
630 void string_begin (void);
631 void string_add (const char *s, int l);
632 void string_addc (int c);
633 char *string_end (void);
634 int unescape (int c);
636 static ssize_t read_input (char *buf, size_t size);
638 struct context /* Input context */
640 struct context *parent; /* Pointer to the parent context */
641 struct locus locus; /* Locus */
644 ino_t ino; /* Inode number */
645 dev_t dev; /* Device number */
646 FILE *file; /* Input file */
647 YY_BUFFER_STATE buf; /* Buffer */
650 static struct context *context_tos;
653 int interactive; /* Are we running in interactive mode? */
654 static int initialized;
659 struct context *cp = ecalloc (1, sizeof (*cp));
663 cp->interactive = interactive;
667 cp->buf = YY_CURRENT_BUFFER;
668 cp->parent = context_tos;
675 struct context *cp = context_tos;
681 memset (&yylloc, 0, sizeof (yylloc));
686 context_tos = cp->parent;
690 interactive = cp->interactive;
694 yy_delete_buffer (YY_CURRENT_BUFFER);
695 yy_switch_to_buffer (cp->buf);
700 static struct context *
701 findctx (struct stat *st)
705 for (cp = context_tos; cp; cp = cp->parent)
706 if (cp->dev == st->st_dev && cp->ino == st->st_ino)
712 setsource (const char *name, int intr)
718 if (strcmp (name, "-") == 0)
725 if (stat (name, &st))
727 terror (_("cannot open `%s': %s"), name, strerror (errno));
730 else if (!S_ISREG (st.st_mode))
732 terror (_("%s is not a regular file"), name);
739 terror (_("recursive sourcing"));
741 lerror (&cp->locus, _("%s already sourced here"), name);
745 fp = fopen (name, "r");
748 terror (_("cannot open %s for reading: %s"), name,
758 yy_switch_to_buffer (yy_create_buffer (yyin, YY_BUF_SIZE));
764 point.file = estrdup (name);
780 #ifndef YY_NO_UNISTD_H
781 /* Special case for "unistd.h", since it is non-ANSI. We include it way
782 * down here because we want the user's section 1 to have been scanned first.
783 * The user has a chance to override it with an option.
788 #ifndef YY_EXTRA_TYPE
789 #define YY_EXTRA_TYPE void *
792 static int yy_init_globals (void );
794 /* Accessor methods to globals.
795 These are made visible to non-reentrant scanners for convenience. */
797 int yylex_destroy (void );
799 int yyget_debug (void );
801 void yyset_debug (int debug_flag );
803 YY_EXTRA_TYPE yyget_extra (void );
805 void yyset_extra (YY_EXTRA_TYPE user_defined );
807 FILE *yyget_in (void );
809 void yyset_in (FILE * in_str );
811 FILE *yyget_out (void );
813 void yyset_out (FILE * out_str );
815 int yyget_leng (void );
817 char *yyget_text (void );
819 int yyget_lineno (void );
821 void yyset_lineno (int line_number );
823 /* Macros after this point can all be overridden by user definitions in
827 #ifndef YY_SKIP_YYWRAP
829 extern "C" int yywrap (void );
831 extern int yywrap (void );
836 static void yy_flex_strncpy (char *,yyconst char *,int );
839 #ifdef YY_NEED_STRLEN
840 static int yy_flex_strlen (yyconst char * );
846 static int yyinput (void );
848 static int input (void );
853 /* Amount of stuff to slurp up with each read. */
854 #ifndef YY_READ_BUF_SIZE
855 #define YY_READ_BUF_SIZE 8192
858 /* Copy whatever the last rule matched to the standard output. */
860 /* This used to be an fputs(), but since the string might contain NUL's,
861 * we now use fwrite().
863 #define ECHO fwrite( yytext, yyleng, 1, yyout )
866 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
867 * is returned in "result".
870 #define YY_INPUT(buf,result,max_size) \
871 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
875 for ( n = 0; n < max_size && \
876 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
879 buf[n++] = (char) c; \
880 if ( c == EOF && ferror( yyin ) ) \
881 YY_FATAL_ERROR( "input in flex scanner failed" ); \
887 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
889 if( errno != EINTR) \
891 YY_FATAL_ERROR( "input in flex scanner failed" ); \
902 /* No semi-colon after return; correct usage is to write "yyterminate();" -
903 * we don't want an extra ';' after the "return" because that will cause
904 * some compilers to complain about unreachable statements.
907 #define yyterminate() return YY_NULL
910 /* Number of entries by which start-condition stack grows. */
911 #ifndef YY_START_STACK_INCR
912 #define YY_START_STACK_INCR 25
915 /* Report a fatal error. */
916 #ifndef YY_FATAL_ERROR
917 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
920 /* end tables serialization structures and prototypes */
922 /* Default declaration of generated scanner - a define so the user can
923 * easily add parameters.
926 #define YY_DECL_IS_OURS 1
928 extern int yylex (void);
930 #define YY_DECL int yylex (void)
931 #endif /* !YY_DECL */
933 /* Code executed at the beginning of each rule, after yytext and yyleng
936 #ifndef YY_USER_ACTION
937 #define YY_USER_ACTION
940 /* Code executed at the end of each rule. */
942 #define YY_BREAK break;
945 #define YY_RULE_SETUP \
947 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
948 (yytext[yyleng - 1] == '\n'); \
951 /** The main scanner function which does all the work.
955 register yy_state_type yy_current_state;
956 register char *yy_cp, *yy_bp;
971 /* Create the reject buffer large enough to save one state per allowed character. */
972 if ( ! (yy_state_buf) )
973 (yy_state_buf) = (yy_state_type *)yyalloc(YY_STATE_BUF_SIZE );
974 if ( ! (yy_state_buf) )
975 YY_FATAL_ERROR( "out of dynamic memory in yylex()" );
978 (yy_start) = 1; /* first start state */
986 if ( ! YY_CURRENT_BUFFER ) {
987 yyensure_buffer_stack ();
988 YY_CURRENT_BUFFER_LVALUE =
989 yy_create_buffer(yyin,YY_BUF_SIZE );
992 yy_load_buffer_state( );
995 while ( 1 ) /* loops until end-of-file is reached */
997 yy_cp = (yy_c_buf_p);
999 /* Support of yytext. */
1000 *yy_cp = (yy_hold_char);
1002 /* yy_bp points to the position in yy_ch_buf of the start of
1007 yy_current_state = (yy_start);
1008 yy_current_state += YY_AT_BOL();
1010 (yy_state_ptr) = (yy_state_buf);
1011 *(yy_state_ptr)++ = yy_current_state;
1016 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
1017 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1019 yy_current_state = (int) yy_def[yy_current_state];
1020 if ( yy_current_state >= 85 )
1021 yy_c = yy_meta[(unsigned int) yy_c];
1023 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1024 *(yy_state_ptr)++ = yy_current_state;
1027 while ( yy_base[yy_current_state] != 346 );
1030 yy_current_state = *--(yy_state_ptr);
1031 (yy_lp) = yy_accept[yy_current_state];
1032 find_rule: /* we branch to this label when backing up */
1033 for ( ; ; ) /* until we find what rule we matched */
1035 if ( (yy_lp) && (yy_lp) < yy_accept[yy_current_state + 1] )
1037 yy_act = yy_acclist[(yy_lp)];
1039 (yy_full_match) = yy_cp;
1044 yy_current_state = *--(yy_state_ptr);
1045 (yy_lp) = yy_accept[yy_current_state];
1048 YY_DO_BEFORE_ACTION;
1050 do_action: /* This label is used only to access EOF actions. */
1053 { /* beginning of action switch */
1055 /* rule 1 can match eol */
1063 for (p = strchr (yytext, '#') + 1; *p == ' ' || *p == '\t'; p++);
1065 for (; *p == ' ' || *p == '\t'; p++);
1067 line = strtol (p, &p, 10);
1068 for (; *p == ' ' || *p == '\t'; p++);
1073 len = strcspn (p, "\"");
1076 yyerror (_("invalid #line statement"));
1079 file = emalloc (len + 1);
1080 memcpy (file, p, len);
1082 for (p += len + 1; *p == ' ' || *p == '\t'; p++);
1086 yyerror (_("invalid #line statement"));
1097 /* rule 2 can match eol */
1105 /* end-of-file comment */;
1120 { yylval.num = strtoul (yytext, NULL, 16);
1126 { yylval.num = strtoul (yytext, NULL, 8);
1132 { yylval.num = strtoul (yytext, NULL, 10);
1138 { return command_lookup ("help", &yylloc, &yylval.cmd); }
1143 { char *p = yytext + strspn (yytext, " \t");
1144 return command_lookup (p, &yylloc, &yylval.cmd);
1150 { if ((yylval.type = datadef_lookup (yytext)))
1154 yylval.string = estrdup (yytext);
1162 { yylval.string = estrdup (yytext);
1169 { yylval.string = estrdup (yytext);
1175 { yylval.string = emalloc (yyleng - 1);
1176 memcpy (yylval.string, yytext+1, yyleng-2);
1177 yylval.string[yyleng-2] = 0;
1181 *yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
1182 (yy_c_buf_p) = yy_cp -= 1;
1183 YY_DO_BEFORE_ACTION; /* set up yytext again */
1187 string_add (yytext + 1, yyleng - 2);
1194 string_add (yytext + 1, yyleng - 3);
1195 string_addc (unescape (yytext[yyleng-1]));
1202 string_add (yytext, yyleng - 1);
1203 yylval.string = string_end ();
1208 *yy_cp = (yy_hold_char); /* undo effects of setting up yytext */
1209 (yy_c_buf_p) = yy_cp -= 1;
1210 YY_DO_BEFORE_ACTION; /* set up yytext again */
1213 { string_add (yytext, yyleng - 1); }
1218 { string_add (yytext, yyleng - 2);
1219 string_addc (unescape (yytext[yyleng-1])); }
1227 /* rule 21 can match eol */
1230 { advance_line (); }
1233 /* rule 22 can match eol */
1236 { advance_line (); return '\n'; }
1249 case YY_STATE_EOF(INITIAL):
1250 case YY_STATE_EOF(STR):
1251 case YY_STATE_EOF(MLSTR):
1252 case YY_STATE_EOF(DEF):
1255 case YY_END_OF_BUFFER:
1257 /* Amount of text matched not including the EOB char. */
1258 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1260 /* Undo the effects of YY_DO_BEFORE_ACTION. */
1261 *yy_cp = (yy_hold_char);
1262 YY_RESTORE_YY_MORE_OFFSET
1264 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1266 /* We're scanning a new file or input source. It's
1267 * possible that this happened because the user
1268 * just pointed yyin at a new source and called
1269 * yylex(). If so, then we have to assure
1270 * consistency between YY_CURRENT_BUFFER and our
1271 * globals. Here is the right place to do so, because
1272 * this is the first action (other than possibly a
1273 * back-up) that will match for the new input source.
1275 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1276 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1277 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1280 /* Note that here we test for yy_c_buf_p "<=" to the position
1281 * of the first EOB in the buffer, since yy_c_buf_p will
1282 * already have been incremented past the NUL character
1283 * (since all states make transitions on EOB to the
1284 * end-of-buffer state). Contrast this with the test
1287 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1288 { /* This was really a NUL. */
1289 yy_state_type yy_next_state;
1291 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1293 yy_current_state = yy_get_previous_state( );
1295 /* Okay, we're now positioned to make the NUL
1296 * transition. We couldn't have
1297 * yy_get_previous_state() go ahead and do it
1298 * for us because it doesn't know how to deal
1299 * with the possibility of jamming (and we don't
1300 * want to build jamming into it because then it
1301 * will run more slowly).
1304 yy_next_state = yy_try_NUL_trans( yy_current_state );
1306 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1308 if ( yy_next_state )
1310 /* Consume the NUL. */
1311 yy_cp = ++(yy_c_buf_p);
1312 yy_current_state = yy_next_state;
1318 yy_cp = (yy_c_buf_p);
1319 goto yy_find_action;
1323 else switch ( yy_get_next_buffer( ) )
1325 case EOB_ACT_END_OF_FILE:
1327 (yy_did_buffer_switch_on_eof) = 0;
1331 /* Note: because we've taken care in
1332 * yy_get_next_buffer() to have set up
1333 * yytext, we can now set up
1334 * yy_c_buf_p so that if some total
1335 * hoser (like flex itself) wants to
1336 * call the scanner after we return the
1337 * YY_NULL, it'll still work - another
1338 * YY_NULL will get returned.
1340 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1342 yy_act = YY_STATE_EOF(YY_START);
1348 if ( ! (yy_did_buffer_switch_on_eof) )
1354 case EOB_ACT_CONTINUE_SCAN:
1356 (yytext_ptr) + yy_amount_of_matched_text;
1358 yy_current_state = yy_get_previous_state( );
1360 yy_cp = (yy_c_buf_p);
1361 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1364 case EOB_ACT_LAST_MATCH:
1366 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1368 yy_current_state = yy_get_previous_state( );
1370 yy_cp = (yy_c_buf_p);
1371 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1372 goto yy_find_action;
1379 "fatal flex scanner internal error--no action found" );
1380 } /* end of action switch */
1381 } /* end of scanning one token */
1382 } /* end of yylex */
1384 /* yy_get_next_buffer - try to read in a new buffer
1386 * Returns a code representing an action:
1387 * EOB_ACT_LAST_MATCH -
1388 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1389 * EOB_ACT_END_OF_FILE - end of file
1391 static int yy_get_next_buffer (void)
1393 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1394 register char *source = (yytext_ptr);
1395 register int number_to_move, i;
1398 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1400 "fatal flex scanner internal error--end of buffer missed" );
1402 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1403 { /* Don't try to fill the buffer, so this is an EOF. */
1404 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1406 /* We matched a single character, the EOB, so
1407 * treat this as a final EOF.
1409 return EOB_ACT_END_OF_FILE;
1414 /* We matched some text prior to the EOB, first
1417 return EOB_ACT_LAST_MATCH;
1421 /* Try to read more data. */
1423 /* First move last chars to start of buffer. */
1424 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1426 for ( i = 0; i < number_to_move; ++i )
1427 *(dest++) = *(source++);
1429 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1430 /* don't do the read, it's not guaranteed to return an EOF,
1433 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1438 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1440 while ( num_to_read <= 0 )
1441 { /* Not enough room in the buffer - grow it. */
1444 "input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
1448 if ( num_to_read > YY_READ_BUF_SIZE )
1449 num_to_read = YY_READ_BUF_SIZE;
1451 /* Read in more data. */
1452 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1453 (yy_n_chars), (size_t) num_to_read );
1455 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1458 if ( (yy_n_chars) == 0 )
1460 if ( number_to_move == YY_MORE_ADJ )
1462 ret_val = EOB_ACT_END_OF_FILE;
1468 ret_val = EOB_ACT_LAST_MATCH;
1469 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1470 YY_BUFFER_EOF_PENDING;
1475 ret_val = EOB_ACT_CONTINUE_SCAN;
1477 if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1478 /* Extend the array by 50%, plus the number we really need. */
1479 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1480 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
1481 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1482 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1485 (yy_n_chars) += number_to_move;
1486 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1487 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1489 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1494 /* yy_get_previous_state - get the state just before the EOB char was reached */
1496 static yy_state_type yy_get_previous_state (void)
1498 register yy_state_type yy_current_state;
1499 register char *yy_cp;
1501 yy_current_state = (yy_start);
1502 yy_current_state += YY_AT_BOL();
1504 (yy_state_ptr) = (yy_state_buf);
1505 *(yy_state_ptr)++ = yy_current_state;
1507 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1509 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1510 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1512 yy_current_state = (int) yy_def[yy_current_state];
1513 if ( yy_current_state >= 85 )
1514 yy_c = yy_meta[(unsigned int) yy_c];
1516 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1517 *(yy_state_ptr)++ = yy_current_state;
1520 return yy_current_state;
1523 /* yy_try_NUL_trans - try to make a transition on the NUL character
1526 * next_state = yy_try_NUL_trans( current_state );
1528 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1530 register int yy_is_jam;
1532 register YY_CHAR yy_c = 1;
1533 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1535 yy_current_state = (int) yy_def[yy_current_state];
1536 if ( yy_current_state >= 85 )
1537 yy_c = yy_meta[(unsigned int) yy_c];
1539 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1540 yy_is_jam = (yy_current_state == 84);
1542 *(yy_state_ptr)++ = yy_current_state;
1544 return yy_is_jam ? 0 : yy_current_state;
1549 static int yyinput (void)
1551 static int input (void)
1557 *(yy_c_buf_p) = (yy_hold_char);
1559 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1561 /* yy_c_buf_p now points to the character we want to return.
1562 * If this occurs *before* the EOB characters, then it's a
1563 * valid NUL; if not, then we've hit the end of the buffer.
1565 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1566 /* This was really a NUL. */
1567 *(yy_c_buf_p) = '\0';
1570 { /* need more input */
1571 int offset = (yy_c_buf_p) - (yytext_ptr);
1574 switch ( yy_get_next_buffer( ) )
1576 case EOB_ACT_LAST_MATCH:
1577 /* This happens because yy_g_n_b()
1578 * sees that we've accumulated a
1579 * token and flags that we need to
1580 * try matching the token before
1581 * proceeding. But for input(),
1582 * there's no matching to consider.
1583 * So convert the EOB_ACT_LAST_MATCH
1584 * to EOB_ACT_END_OF_FILE.
1587 /* Reset buffer status. */
1592 case EOB_ACT_END_OF_FILE:
1597 if ( ! (yy_did_buffer_switch_on_eof) )
1606 case EOB_ACT_CONTINUE_SCAN:
1607 (yy_c_buf_p) = (yytext_ptr) + offset;
1613 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1614 *(yy_c_buf_p) = '\0'; /* preserve yytext */
1615 (yy_hold_char) = *++(yy_c_buf_p);
1617 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
1621 #endif /* ifndef YY_NO_INPUT */
1623 /** Immediately switch to a different input stream.
1624 * @param input_file A readable stream.
1626 * @note This function does not reset the start condition to @c INITIAL .
1628 void yyrestart (FILE * input_file )
1631 if ( ! YY_CURRENT_BUFFER ){
1632 yyensure_buffer_stack ();
1633 YY_CURRENT_BUFFER_LVALUE =
1634 yy_create_buffer(yyin,YY_BUF_SIZE );
1637 yy_init_buffer(YY_CURRENT_BUFFER,input_file );
1638 yy_load_buffer_state( );
1641 /** Switch to a different input buffer.
1642 * @param new_buffer The new input buffer.
1645 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1648 /* TODO. We should be able to replace this entire function body
1650 * yypop_buffer_state();
1651 * yypush_buffer_state(new_buffer);
1653 yyensure_buffer_stack ();
1654 if ( YY_CURRENT_BUFFER == new_buffer )
1657 if ( YY_CURRENT_BUFFER )
1659 /* Flush out information for old buffer. */
1660 *(yy_c_buf_p) = (yy_hold_char);
1661 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1662 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1665 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1666 yy_load_buffer_state( );
1668 /* We don't actually know whether we did this switch during
1669 * EOF (yywrap()) processing, but the only time this flag
1670 * is looked at is after yywrap() is called, so it's safe
1671 * to go ahead and always set it.
1673 (yy_did_buffer_switch_on_eof) = 1;
1676 static void yy_load_buffer_state (void)
1678 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1679 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1680 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1681 (yy_hold_char) = *(yy_c_buf_p);
1684 /** Allocate and initialize an input buffer state.
1685 * @param file A readable stream.
1686 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1688 * @return the allocated buffer state.
1690 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
1694 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1696 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1698 b->yy_buf_size = size;
1700 /* yy_ch_buf has to be 2 characters longer than the size given because
1701 * we need to put in 2 end-of-buffer characters.
1703 b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 );
1704 if ( ! b->yy_ch_buf )
1705 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1707 b->yy_is_our_buffer = 1;
1709 yy_init_buffer(b,file );
1714 /** Destroy the buffer.
1715 * @param b a buffer created with yy_create_buffer()
1718 void yy_delete_buffer (YY_BUFFER_STATE b )
1724 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1725 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1727 if ( b->yy_is_our_buffer )
1728 yyfree((void *) b->yy_ch_buf );
1730 yyfree((void *) b );
1734 extern int isatty (int );
1735 #endif /* __cplusplus */
1737 /* Initializes or reinitializes a buffer.
1738 * This function is sometimes called more than once on the same buffer,
1739 * such as during a yyrestart() or at EOF.
1741 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
1746 yy_flush_buffer(b );
1748 b->yy_input_file = file;
1749 b->yy_fill_buffer = 1;
1751 /* If b is the current buffer, then yy_init_buffer was _probably_
1752 * called from yyrestart() or through yy_get_next_buffer.
1753 * In that case, we don't want to reset the lineno or column.
1755 if (b != YY_CURRENT_BUFFER){
1756 b->yy_bs_lineno = 1;
1757 b->yy_bs_column = 0;
1760 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1765 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1766 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1769 void yy_flush_buffer (YY_BUFFER_STATE b )
1776 /* We always need two end-of-buffer characters. The first causes
1777 * a transition to the end-of-buffer state. The second causes
1778 * a jam in that state.
1780 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1781 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1783 b->yy_buf_pos = &b->yy_ch_buf[0];
1786 b->yy_buffer_status = YY_BUFFER_NEW;
1788 if ( b == YY_CURRENT_BUFFER )
1789 yy_load_buffer_state( );
1792 /** Pushes the new state onto the stack. The new state becomes
1793 * the current state. This function will allocate the stack
1795 * @param new_buffer The new state.
1798 void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
1800 if (new_buffer == NULL)
1803 yyensure_buffer_stack();
1805 /* This block is copied from yy_switch_to_buffer. */
1806 if ( YY_CURRENT_BUFFER )
1808 /* Flush out information for old buffer. */
1809 *(yy_c_buf_p) = (yy_hold_char);
1810 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1811 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1814 /* Only push if top exists. Otherwise, replace top. */
1815 if (YY_CURRENT_BUFFER)
1816 (yy_buffer_stack_top)++;
1817 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1819 /* copied from yy_switch_to_buffer. */
1820 yy_load_buffer_state( );
1821 (yy_did_buffer_switch_on_eof) = 1;
1824 /** Removes and deletes the top of the stack, if present.
1825 * The next element becomes the new top.
1828 void yypop_buffer_state (void)
1830 if (!YY_CURRENT_BUFFER)
1833 yy_delete_buffer(YY_CURRENT_BUFFER );
1834 YY_CURRENT_BUFFER_LVALUE = NULL;
1835 if ((yy_buffer_stack_top) > 0)
1836 --(yy_buffer_stack_top);
1838 if (YY_CURRENT_BUFFER) {
1839 yy_load_buffer_state( );
1840 (yy_did_buffer_switch_on_eof) = 1;
1844 /* Allocates the stack if it does not exist.
1845 * Guarantees space for at least one push.
1847 static void yyensure_buffer_stack (void)
1851 if (!(yy_buffer_stack)) {
1853 /* First allocation is just for 2 elements, since we don't know if this
1854 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1855 * immediate realloc on the next call.
1858 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
1859 (num_to_alloc * sizeof(struct yy_buffer_state*)
1861 if ( ! (yy_buffer_stack) )
1862 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1864 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1866 (yy_buffer_stack_max) = num_to_alloc;
1867 (yy_buffer_stack_top) = 0;
1871 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1873 /* Increase the buffer to prepare for a possible push. */
1874 int grow_size = 8 /* arbitrary grow size */;
1876 num_to_alloc = (yy_buffer_stack_max) + grow_size;
1877 (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
1879 num_to_alloc * sizeof(struct yy_buffer_state*)
1881 if ( ! (yy_buffer_stack) )
1882 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1884 /* zero only the new slots.*/
1885 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1886 (yy_buffer_stack_max) = num_to_alloc;
1890 /** Setup the input buffer state to scan directly from a user-specified character buffer.
1891 * @param base the character buffer
1892 * @param size the size in bytes of the character buffer
1894 * @return the newly allocated buffer state object.
1896 YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
1901 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1902 base[size-1] != YY_END_OF_BUFFER_CHAR )
1903 /* They forgot to leave room for the EOB's. */
1906 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1908 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1910 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1911 b->yy_buf_pos = b->yy_ch_buf = base;
1912 b->yy_is_our_buffer = 0;
1913 b->yy_input_file = 0;
1914 b->yy_n_chars = b->yy_buf_size;
1915 b->yy_is_interactive = 0;
1917 b->yy_fill_buffer = 0;
1918 b->yy_buffer_status = YY_BUFFER_NEW;
1920 yy_switch_to_buffer(b );
1925 /** Setup the input buffer state to scan a string. The next call to yylex() will
1926 * scan from a @e copy of @a str.
1927 * @param yystr a NUL-terminated string to scan
1929 * @return the newly allocated buffer state object.
1930 * @note If you want to scan bytes that may contain NUL values, then use
1931 * yy_scan_bytes() instead.
1933 YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
1936 return yy_scan_bytes(yystr,strlen(yystr) );
1939 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
1940 * scan from a @e copy of @a bytes.
1941 * @param bytes the byte buffer to scan
1942 * @param len the number of bytes in the buffer pointed to by @a bytes.
1944 * @return the newly allocated buffer state object.
1946 YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len )
1953 /* Get memory for full buffer, including space for trailing EOB's. */
1954 n = _yybytes_len + 2;
1955 buf = (char *) yyalloc(n );
1957 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1959 for ( i = 0; i < _yybytes_len; ++i )
1960 buf[i] = yybytes[i];
1962 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1964 b = yy_scan_buffer(buf,n );
1966 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1968 /* It's okay to grow etc. this buffer, and we should throw it
1969 * away when we're done.
1971 b->yy_is_our_buffer = 1;
1976 #ifndef YY_EXIT_FAILURE
1977 #define YY_EXIT_FAILURE 2
1980 static void yy_fatal_error (yyconst char* msg )
1982 (void) fprintf( stderr, "%s\n", msg );
1983 exit( YY_EXIT_FAILURE );
1986 /* Redefine yyless() so it works in section 3 code. */
1992 /* Undo effects of setting up yytext. */ \
1993 int yyless_macro_arg = (n); \
1994 YY_LESS_LINENO(yyless_macro_arg);\
1995 yytext[yyleng] = (yy_hold_char); \
1996 (yy_c_buf_p) = yytext + yyless_macro_arg; \
1997 (yy_hold_char) = *(yy_c_buf_p); \
1998 *(yy_c_buf_p) = '\0'; \
1999 yyleng = yyless_macro_arg; \
2003 /* Accessor methods (get/set functions) to struct members. */
2005 /** Get the current line number.
2008 int yyget_lineno (void)
2014 /** Get the input stream.
2017 FILE *yyget_in (void)
2022 /** Get the output stream.
2025 FILE *yyget_out (void)
2030 /** Get the length of the current token.
2033 int yyget_leng (void)
2038 /** Get the current token.
2042 char *yyget_text (void)
2047 /** Set the current line number.
2048 * @param line_number
2051 void yyset_lineno (int line_number )
2054 yylineno = line_number;
2057 /** Set the input stream. This does not discard the current
2059 * @param in_str A readable stream.
2061 * @see yy_switch_to_buffer
2063 void yyset_in (FILE * in_str )
2068 void yyset_out (FILE * out_str )
2073 int yyget_debug (void)
2075 return yy_flex_debug;
2078 void yyset_debug (int bdebug )
2080 yy_flex_debug = bdebug ;
2083 static int yy_init_globals (void)
2085 /* Initialization is the same as for the non-reentrant scanner.
2086 * This function is called from yylex_destroy(), so don't allocate here.
2089 (yy_buffer_stack) = 0;
2090 (yy_buffer_stack_top) = 0;
2091 (yy_buffer_stack_max) = 0;
2092 (yy_c_buf_p) = (char *) 0;
2098 (yy_full_match) = 0;
2101 /* Defined in main.c */
2110 /* For future reference: Set errno on error, since we are called by
2116 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
2117 int yylex_destroy (void)
2120 /* Pop the buffer stack, destroying each element. */
2121 while(YY_CURRENT_BUFFER){
2122 yy_delete_buffer(YY_CURRENT_BUFFER );
2123 YY_CURRENT_BUFFER_LVALUE = NULL;
2124 yypop_buffer_state();
2127 /* Destroy the stack itself. */
2128 yyfree((yy_buffer_stack) );
2129 (yy_buffer_stack) = NULL;
2131 yyfree ( (yy_state_buf) );
2132 (yy_state_buf) = NULL;
2134 /* Reset the globals. This is important in a non-reentrant scanner so the next time
2135 * yylex() is called, initialization will occur. */
2142 * Internal utility routines.
2146 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
2149 for ( i = 0; i < n; ++i )
2154 #ifdef YY_NEED_STRLEN
2155 static int yy_flex_strlen (yyconst char * s )
2158 for ( n = 0; s[n]; ++n )
2165 void *yyalloc (yy_size_t size )
2167 return (void *) malloc( size );
2170 void *yyrealloc (void * ptr, yy_size_t size )
2172 /* The cast to (char *) in the following accommodates both
2173 * implementations that use char* generic pointers, and those
2174 * that use void* generic pointers. It works with the latter
2175 * because both ANSI C and C++ allow castless assignment from
2176 * any pointer type to void*, and deal with argument conversions
2177 * as though doing an assignment.
2179 return (void *) realloc( (char *) ptr, size );
2182 void yyfree (void * ptr )
2184 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
2187 #define YYTABLES_NAME "yytables"
2196 return context_pop ();
2212 read_input (char *buf, size_t size)
2218 if (fgets (buf, size, yyin) == NULL)
2220 return strlen (buf);
2222 return fread (buf, 1, size, yyin);
2228 struct strseg *next;
2233 static struct strseg *strseg_head, *strseg_tail;
2238 strseg_head = strseg_tail = NULL;
2242 strseg_attach (struct strseg *seg)
2246 strseg_tail->next = seg;
2253 string_add (const char *s, int l)
2255 struct strseg *seg = emalloc (sizeof (*seg) + l);
2256 memcpy (seg->ptr, s, l);
2258 strseg_attach (seg);
2264 struct strseg *seg = emalloc (sizeof (*seg));
2267 strseg_attach (seg);
2277 for (seg = strseg_head; seg; seg = seg->next)
2280 ret = emalloc (len);
2282 for (seg = strseg_head; seg; )
2284 struct strseg *next = seg->next;
2285 memcpy (p, seg->ptr, seg->len);
2292 strseg_head = strseg_tail = NULL;
2297 static char transtab[] = "\\\\\"\"a\ab\bf\fn\nr\rt\tv\v";
2304 for (p = transtab; *p; p += 2)
2316 for (p = transtab + sizeof (transtab) - 2; p > transtab; p -= 2)
2325 vlerror (struct locus *loc, const char *fmt, va_list ap)
2328 fprintf (stderr, "%s: ", progname);
2329 if (initialized && loc && loc->beg.file)
2331 YY_LOCATION_PRINT (stderr, *loc);
2332 fprintf (stderr, ": ");
2334 vfprintf (stderr, fmt, ap);
2335 fputc ('\n', stderr);
2339 lerror (struct locus *loc, const char *fmt, ...)
2344 vlerror (loc, fmt, ap);
2352 pe_file_name (struct prompt_exp *p)
2355 fwrite (file_name, strlen (file_name), 1, stdout);
2359 pe_program_name (struct prompt_exp *p)
2361 fwrite (progname, strlen (progname), 1, stdout);
2365 pe_package_name (struct prompt_exp *p)
2367 fwrite (PACKAGE_NAME, sizeof (PACKAGE_NAME) - 1, 1, stdout);
2371 pe_program_version (struct prompt_exp *p)
2373 fwrite (PACKAGE_VERSION, sizeof (PACKAGE_VERSION) - 1, 1, stdout);
2377 pe_space (struct prompt_exp *p)
2379 fwrite (" ", 1, 1, stdout);
2385 void (*fun) (struct prompt_exp *);
2389 struct prompt_exp prompt_exp[] = {
2390 { 'f', pe_file_name },
2391 { 'p', pe_program_name },
2392 { 'P', pe_package_name },
2393 { 'v', pe_program_version },
2401 struct prompt_exp *p;
2405 for (p = prompt_exp; p->ch; p++)
2422 if (YYSTATE == DEF || YYSTATE == MLSTR)
2433 switch (variable_get (psname (), VART_STRING, (void *) &prompt))
2438 case VAR_ERR_NOTSET:
2445 for (s = prompt; *s; s++)