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 20
363 #define YY_END_OF_BUFFER 21
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_accept
[73] =
373 0, 0, 0, 0, 21, 19, 12, 11, 19, 18,
374 19, 19, 16, 19, 15, 19, 19, 19, 19, 19,
375 19, 13, 14, 17, 12, 0, 10, 18, 9, 9,
376 0, 0, 0, 0, 0, 9, 9, 9, 9, 9,
377 17, 0, 9, 0, 6, 0, 0, 9, 9, 9,
378 9, 9, 0, 0, 7, 8, 9, 9, 9, 9,
379 3, 7, 9, 9, 5, 9, 9, 4, 9, 2,
383 static yyconst flex_int32_t yy_ec
[256] =
385 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
386 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
387 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
388 1, 2, 1, 4, 5, 1, 1, 1, 1, 1,
389 1, 6, 7, 1, 7, 6, 8, 9, 9, 9,
390 9, 9, 9, 9, 9, 9, 9, 6, 10, 1,
391 1, 1, 1, 11, 6, 6, 6, 6, 6, 6,
392 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
393 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
394 1, 1, 1, 1, 6, 1, 12, 6, 6, 13,
396 6, 6, 6, 6, 14, 6, 6, 15, 16, 17,
397 18, 19, 6, 20, 21, 22, 23, 24, 25, 26,
398 27, 6, 28, 1, 29, 1, 1, 1, 1, 1,
399 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
400 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
401 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
402 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
403 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
404 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
405 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
407 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
408 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
409 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
410 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
411 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
415 static yyconst flex_int32_t yy_meta
[30] =
417 1, 1, 2, 1, 1, 3, 3, 3, 3, 1,
418 1, 3, 3, 3, 3, 3, 3, 3, 3, 3,
419 3, 3, 3, 3, 3, 3, 3, 1, 1
422 static yyconst flex_int16_t yy_base
[77] =
424 0, 101, 0, 100, 104, 107, 101, 107, 98, 0,
425 0, 92, 0, 28, 107, 29, 86, 80, 86, 83,
426 84, 107, 107, 0, 93, 90, 89, 0, 0, 32,
427 30, 31, 33, 34, 42, 71, 69, 70, 69, 73,
428 0, 43, 44, 46, 78, 45, 77, 66, 70, 71,
429 60, 66, 50, 56, 70, 67, 58, 52, 53, 44,
430 0, 57, 52, 46, 0, 50, 34, 0, 45, 0,
431 0, 107, 71, 74, 46, 77
434 static yyconst flex_int16_t yy_def
[77] =
436 72, 1, 1, 1, 72, 72, 72, 72, 73, 74,
437 75, 75, 75, 72, 72, 72, 75, 75, 75, 75,
438 75, 72, 72, 76, 72, 73, 72, 74, 75, 75,
439 72, 72, 72, 72, 72, 75, 75, 75, 75, 75,
440 76, 72, 75, 72, 72, 72, 72, 75, 75, 75,
441 75, 75, 72, 72, 75, 72, 75, 75, 75, 75,
442 75, 72, 75, 75, 75, 75, 75, 75, 75, 75,
443 75, 0, 72, 72, 72, 72
446 static yyconst flex_int16_t yy_nxt
[137] =
448 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
449 16, 11, 17, 11, 11, 11, 11, 18, 19, 11,
450 11, 11, 11, 20, 21, 11, 11, 22, 23, 31,
451 34, 31, 31, 42, 44, 34, 32, 35, 43, 32,
452 30, 45, 35, 46, 42, 54, 46, 44, 29, 53,
453 35, 54, 55, 33, 45, 33, 33, 54, 62, 71,
454 70, 69, 68, 67, 62, 62, 66, 47, 65, 64,
455 47, 26, 63, 26, 28, 56, 28, 41, 55, 41,
456 61, 60, 59, 58, 57, 56, 45, 52, 51, 50,
457 49, 48, 26, 27, 25, 40, 39, 38, 37, 36,
459 30, 27, 25, 72, 24, 24, 5, 72, 72, 72,
460 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
461 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
462 72, 72, 72, 72, 72, 72
465 static yyconst flex_int16_t yy_chk
[137] =
467 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
468 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
469 1, 1, 1, 1, 1, 1, 1, 1, 1, 14,
470 16, 31, 32, 30, 33, 34, 14, 16, 30, 32,
471 30, 33, 34, 35, 42, 43, 46, 44, 75, 42,
472 35, 53, 43, 14, 44, 31, 32, 54, 53, 69,
473 67, 66, 64, 63, 54, 62, 60, 35, 59, 58,
474 46, 73, 57, 73, 74, 56, 74, 76, 55, 76,
475 52, 51, 50, 49, 48, 47, 45, 40, 39, 38,
476 37, 36, 27, 26, 25, 21, 20, 19, 18, 17,
478 12, 9, 7, 5, 4, 2, 72, 72, 72, 72,
479 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
480 72, 72, 72, 72, 72, 72, 72, 72, 72, 72,
481 72, 72, 72, 72, 72, 72
484 static yy_state_type yy_last_accepting_state
;
485 static char *yy_last_accepting_cpos
;
487 extern int yy_flex_debug
;
488 int yy_flex_debug
= 0;
490 /* The intent behind this definition is that it'll catch
491 * any uses of REJECT which flex missed.
493 #define REJECT reject_used_but_not_detected
494 #define yymore() yymore_used_but_not_detected
495 #define YY_MORE_ADJ 0
496 #define YY_RESTORE_YY_MORE_OFFSET
501 * Copyright 2002 Red Hat Inc., Durham, North Carolina.
503 * All Rights Reserved.
505 * Permission is hereby granted, free of charge, to any person obtaining
506 * a copy of this software and associated documentation files (the
507 * "Software"), to deal in the Software without restriction, including
508 * without limitation on the rights to use, copy, modify, merge,
509 * publish, distribute, sublicense, and/or sell copies of the Software,
510 * and to permit persons to whom the Software is furnished to do so,
511 * subject to the following conditions:
513 * The above copyright notice and this permission notice (including the
514 * next paragraph) shall be included in all copies or substantial
515 * portions of the Software.
517 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
518 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
519 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
520 * NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
521 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
522 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
523 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
528 * Rickard E. (Rik) Faith <faith@redhat.com>
532 #ifdef HAVE_DMX_CONFIG_H
533 #include <dmx-config.h>
536 #include "dmxparse.h"
542 static int getdimension(int token
, const char *text
, int leng
);
543 static int getstring(int token
, const char *text
, int leng
);
544 static int gettoken(int token
, const char *text
, int leng
);
545 static int getcomment(int token
, const char *text
, int leng
);
546 static int lineno
= 1;
548 #line 549 "scanner.c"
553 #ifndef YY_NO_UNISTD_H
554 /* Special case for "unistd.h", since it is non-ANSI. We include it way
555 * down here because we want the user's section 1 to have been scanned first.
556 * The user has a chance to override it with an option.
561 #ifndef YY_EXTRA_TYPE
562 #define YY_EXTRA_TYPE void *
565 static int yy_init_globals (void );
567 /* Accessor methods to globals.
568 These are made visible to non-reentrant scanners for convenience. */
570 int yylex_destroy (void );
572 int yyget_debug (void );
574 void yyset_debug (int debug_flag
);
576 YY_EXTRA_TYPE
yyget_extra (void );
578 void yyset_extra (YY_EXTRA_TYPE user_defined
);
580 FILE *yyget_in (void );
582 void yyset_in (FILE * in_str
);
584 FILE *yyget_out (void );
586 void yyset_out (FILE * out_str
);
588 int yyget_leng (void );
590 char *yyget_text (void );
592 int yyget_lineno (void );
594 void yyset_lineno (int line_number
);
596 /* Macros after this point can all be overridden by user definitions in
600 #ifndef YY_SKIP_YYWRAP
602 extern "C" int yywrap (void );
604 extern int yywrap (void );
608 static void yyunput (int c
,char *buf_ptr
);
611 static void yy_flex_strncpy (char *,yyconst
char *,int );
614 #ifdef YY_NEED_STRLEN
615 static int yy_flex_strlen (yyconst
char * );
621 static int yyinput (void );
623 static int input (void );
628 /* Amount of stuff to slurp up with each read. */
629 #ifndef YY_READ_BUF_SIZE
630 #define YY_READ_BUF_SIZE 8192
633 /* Copy whatever the last rule matched to the standard output. */
635 /* This used to be an fputs(), but since the string might contain NUL's,
636 * we now use fwrite().
638 #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
641 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
642 * is returned in "result".
645 #define YY_INPUT(buf,result,max_size) \
646 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
650 for ( n = 0; n < max_size && \
651 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
654 buf[n++] = (char) c; \
655 if ( c == EOF && ferror( yyin ) ) \
656 YY_FATAL_ERROR( "input in flex scanner failed" ); \
662 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
664 if( errno != EINTR) \
666 YY_FATAL_ERROR( "input in flex scanner failed" ); \
677 /* No semi-colon after return; correct usage is to write "yyterminate();" -
678 * we don't want an extra ';' after the "return" because that will cause
679 * some compilers to complain about unreachable statements.
682 #define yyterminate() return YY_NULL
685 /* Number of entries by which start-condition stack grows. */
686 #ifndef YY_START_STACK_INCR
687 #define YY_START_STACK_INCR 25
690 /* Report a fatal error. */
691 #ifndef YY_FATAL_ERROR
692 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
695 /* end tables serialization structures and prototypes */
697 /* Default declaration of generated scanner - a define so the user can
698 * easily add parameters.
701 #define YY_DECL_IS_OURS 1
703 extern int yylex (void);
705 #define YY_DECL int yylex (void)
706 #endif /* !YY_DECL */
708 /* Code executed at the beginning of each rule, after yytext and yyleng
711 #ifndef YY_USER_ACTION
712 #define YY_USER_ACTION
715 /* Code executed at the end of each rule. */
717 #define YY_BREAK break;
720 #define YY_RULE_SETUP \
722 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
723 (yytext[yyleng - 1] == '\n'); \
726 /** The main scanner function which does all the work.
730 register yy_state_type yy_current_state
;
731 register char *yy_cp
, *yy_bp
;
736 #line 737 "scanner.c"
747 (yy_start
) = 1; /* first start state */
755 if ( ! YY_CURRENT_BUFFER
) {
756 yyensure_buffer_stack ();
757 YY_CURRENT_BUFFER_LVALUE
=
758 yy_create_buffer(yyin
,YY_BUF_SIZE
);
761 yy_load_buffer_state( );
764 while ( 1 ) /* loops until end-of-file is reached */
766 yy_cp
= (yy_c_buf_p
);
768 /* Support of yytext. */
769 *yy_cp
= (yy_hold_char
);
771 /* yy_bp points to the position in yy_ch_buf of the start of
776 yy_current_state
= (yy_start
);
777 yy_current_state
+= YY_AT_BOL();
781 register YY_CHAR yy_c
= yy_ec
[YY_SC_TO_UI(*yy_cp
)];
782 if ( yy_accept
[yy_current_state
] )
784 (yy_last_accepting_state
) = yy_current_state
;
785 (yy_last_accepting_cpos
) = yy_cp
;
787 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
789 yy_current_state
= (int) yy_def
[yy_current_state
];
790 if ( yy_current_state
>= 73 )
791 yy_c
= yy_meta
[(unsigned int) yy_c
];
793 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
796 while ( yy_base
[yy_current_state
] != 107 );
799 yy_act
= yy_accept
[yy_current_state
];
801 { /* have to back up */
802 yy_cp
= (yy_last_accepting_cpos
);
803 yy_current_state
= (yy_last_accepting_state
);
804 yy_act
= yy_accept
[yy_current_state
];
809 do_action
: /* This label is used only to access EOF actions. */
812 { /* beginning of action switch */
813 case 0: /* must back up */
814 /* undo the effects of YY_DO_BEFORE_ACTION */
815 *yy_cp
= (yy_hold_char
);
816 yy_cp
= (yy_last_accepting_cpos
);
817 yy_current_state
= (yy_last_accepting_state
);
823 return gettoken(T_VIRTUAL
, yytext
, yyleng
);
828 return gettoken(T_DISPLAY
, yytext
, yyleng
);
833 return gettoken(T_WALL
, yytext
, yyleng
);
838 return gettoken(T_OPTION
, yytext
, yyleng
);
843 return gettoken(T_PARAM
, yytext
, yyleng
);
848 return getdimension(T_DIMENSION
, yytext
, yyleng
);
853 return getdimension(T_OFFSET
, yytext
+1, yyleng
-1);
858 return getdimension(T_ORIGIN
, yytext
+1, yyleng
-1);
863 return getstring(T_STRING
, yytext
, yyleng
);
868 return getstring(T_STRING
, yytext
+1, yyleng
-2);
871 /* rule 11 can match eol */
884 return gettoken(yytext
[0], yytext
, yyleng
);
889 return gettoken(yytext
[0], yytext
, yyleng
);
894 return gettoken(yytext
[0], yytext
, yyleng
);
899 return gettoken(yytext
[0], yytext
, yyleng
);
904 return getcomment(T_LINE_COMMENT
, yytext
, yyleng
);
909 return getcomment(T_COMMENT
, yytext
, yyleng
);
914 return getstring(T_STRING
, yytext
, yyleng
);
916 case YY_STATE_EOF(INITIAL
):
917 case YY_STATE_EOF(OTHER
):
926 #line 927 "scanner.c"
928 case YY_END_OF_BUFFER
:
930 /* Amount of text matched not including the EOB char. */
931 int yy_amount_of_matched_text
= (int) (yy_cp
- (yytext_ptr
)) - 1;
933 /* Undo the effects of YY_DO_BEFORE_ACTION. */
934 *yy_cp
= (yy_hold_char
);
935 YY_RESTORE_YY_MORE_OFFSET
937 if ( YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
== YY_BUFFER_NEW
)
939 /* We're scanning a new file or input source. It's
940 * possible that this happened because the user
941 * just pointed yyin at a new source and called
942 * yylex(). If so, then we have to assure
943 * consistency between YY_CURRENT_BUFFER and our
944 * globals. Here is the right place to do so, because
945 * this is the first action (other than possibly a
946 * back-up) that will match for the new input source.
948 (yy_n_chars
) = YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
;
949 YY_CURRENT_BUFFER_LVALUE
->yy_input_file
= yyin
;
950 YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
= YY_BUFFER_NORMAL
;
953 /* Note that here we test for yy_c_buf_p "<=" to the position
954 * of the first EOB in the buffer, since yy_c_buf_p will
955 * already have been incremented past the NUL character
956 * (since all states make transitions on EOB to the
957 * end-of-buffer state). Contrast this with the test
960 if ( (yy_c_buf_p
) <= &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[(yy_n_chars
)] )
961 { /* This was really a NUL. */
962 yy_state_type yy_next_state
;
964 (yy_c_buf_p
) = (yytext_ptr
) + yy_amount_of_matched_text
;
966 yy_current_state
= yy_get_previous_state( );
968 /* Okay, we're now positioned to make the NUL
969 * transition. We couldn't have
970 * yy_get_previous_state() go ahead and do it
971 * for us because it doesn't know how to deal
972 * with the possibility of jamming (and we don't
973 * want to build jamming into it because then it
974 * will run more slowly).
977 yy_next_state
= yy_try_NUL_trans( yy_current_state
);
979 yy_bp
= (yytext_ptr
) + YY_MORE_ADJ
;
983 /* Consume the NUL. */
984 yy_cp
= ++(yy_c_buf_p
);
985 yy_current_state
= yy_next_state
;
991 yy_cp
= (yy_c_buf_p
);
996 else switch ( yy_get_next_buffer( ) )
998 case EOB_ACT_END_OF_FILE
:
1000 (yy_did_buffer_switch_on_eof
) = 0;
1004 /* Note: because we've taken care in
1005 * yy_get_next_buffer() to have set up
1006 * yytext, we can now set up
1007 * yy_c_buf_p so that if some total
1008 * hoser (like flex itself) wants to
1009 * call the scanner after we return the
1010 * YY_NULL, it'll still work - another
1011 * YY_NULL will get returned.
1013 (yy_c_buf_p
) = (yytext_ptr
) + YY_MORE_ADJ
;
1015 yy_act
= YY_STATE_EOF(YY_START
);
1021 if ( ! (yy_did_buffer_switch_on_eof
) )
1027 case EOB_ACT_CONTINUE_SCAN
:
1029 (yytext_ptr
) + yy_amount_of_matched_text
;
1031 yy_current_state
= yy_get_previous_state( );
1033 yy_cp
= (yy_c_buf_p
);
1034 yy_bp
= (yytext_ptr
) + YY_MORE_ADJ
;
1037 case EOB_ACT_LAST_MATCH
:
1039 &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[(yy_n_chars
)];
1041 yy_current_state
= yy_get_previous_state( );
1043 yy_cp
= (yy_c_buf_p
);
1044 yy_bp
= (yytext_ptr
) + YY_MORE_ADJ
;
1045 goto yy_find_action
;
1052 "fatal flex scanner internal error--no action found" );
1053 } /* end of action switch */
1054 } /* end of scanning one token */
1055 } /* end of yylex */
1057 /* yy_get_next_buffer - try to read in a new buffer
1059 * Returns a code representing an action:
1060 * EOB_ACT_LAST_MATCH -
1061 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1062 * EOB_ACT_END_OF_FILE - end of file
1064 static int yy_get_next_buffer (void)
1066 register char *dest
= YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
;
1067 register char *source
= (yytext_ptr
);
1068 register int number_to_move
, i
;
1071 if ( (yy_c_buf_p
) > &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[(yy_n_chars
) + 1] )
1073 "fatal flex scanner internal error--end of buffer missed" );
1075 if ( YY_CURRENT_BUFFER_LVALUE
->yy_fill_buffer
== 0 )
1076 { /* Don't try to fill the buffer, so this is an EOF. */
1077 if ( (yy_c_buf_p
) - (yytext_ptr
) - YY_MORE_ADJ
== 1 )
1079 /* We matched a single character, the EOB, so
1080 * treat this as a final EOF.
1082 return EOB_ACT_END_OF_FILE
;
1087 /* We matched some text prior to the EOB, first
1090 return EOB_ACT_LAST_MATCH
;
1094 /* Try to read more data. */
1096 /* First move last chars to start of buffer. */
1097 number_to_move
= (int) ((yy_c_buf_p
) - (yytext_ptr
)) - 1;
1099 for ( i
= 0; i
< number_to_move
; ++i
)
1100 *(dest
++) = *(source
++);
1102 if ( YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
== YY_BUFFER_EOF_PENDING
)
1103 /* don't do the read, it's not guaranteed to return an EOF,
1106 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= (yy_n_chars
) = 0;
1111 YY_CURRENT_BUFFER_LVALUE
->yy_buf_size
- number_to_move
- 1;
1113 while ( num_to_read
<= 0 )
1114 { /* Not enough room in the buffer - grow it. */
1116 /* just a shorter name for the current buffer */
1117 YY_BUFFER_STATE b
= YY_CURRENT_BUFFER
;
1119 int yy_c_buf_p_offset
=
1120 (int) ((yy_c_buf_p
) - b
->yy_ch_buf
);
1122 if ( b
->yy_is_our_buffer
)
1124 int new_size
= b
->yy_buf_size
* 2;
1126 if ( new_size
<= 0 )
1127 b
->yy_buf_size
+= b
->yy_buf_size
/ 8;
1129 b
->yy_buf_size
*= 2;
1131 b
->yy_ch_buf
= (char *)
1132 /* Include room in for 2 EOB chars. */
1133 yyrealloc((void *) b
->yy_ch_buf
,b
->yy_buf_size
+ 2 );
1136 /* Can't grow it, we don't own it. */
1139 if ( ! b
->yy_ch_buf
)
1141 "fatal error - scanner input buffer overflow" );
1143 (yy_c_buf_p
) = &b
->yy_ch_buf
[yy_c_buf_p_offset
];
1145 num_to_read
= YY_CURRENT_BUFFER_LVALUE
->yy_buf_size
-
1150 if ( num_to_read
> YY_READ_BUF_SIZE
)
1151 num_to_read
= YY_READ_BUF_SIZE
;
1153 /* Read in more data. */
1154 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[number_to_move
]),
1155 (yy_n_chars
), (size_t) num_to_read
);
1157 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= (yy_n_chars
);
1160 if ( (yy_n_chars
) == 0 )
1162 if ( number_to_move
== YY_MORE_ADJ
)
1164 ret_val
= EOB_ACT_END_OF_FILE
;
1170 ret_val
= EOB_ACT_LAST_MATCH
;
1171 YY_CURRENT_BUFFER_LVALUE
->yy_buffer_status
=
1172 YY_BUFFER_EOF_PENDING
;
1177 ret_val
= EOB_ACT_CONTINUE_SCAN
;
1179 if ((yy_size_t
) ((yy_n_chars
) + number_to_move
) > YY_CURRENT_BUFFER_LVALUE
->yy_buf_size
) {
1180 /* Extend the array by 50%, plus the number we really need. */
1181 yy_size_t new_size
= (yy_n_chars
) + number_to_move
+ ((yy_n_chars
) >> 1);
1182 YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
= (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
,new_size
);
1183 if ( ! YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
)
1184 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1187 (yy_n_chars
) += number_to_move
;
1188 YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[(yy_n_chars
)] = YY_END_OF_BUFFER_CHAR
;
1189 YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[(yy_n_chars
) + 1] = YY_END_OF_BUFFER_CHAR
;
1191 (yytext_ptr
) = &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[0];
1196 /* yy_get_previous_state - get the state just before the EOB char was reached */
1198 static yy_state_type
yy_get_previous_state (void)
1200 register yy_state_type yy_current_state
;
1201 register char *yy_cp
;
1203 yy_current_state
= (yy_start
);
1204 yy_current_state
+= YY_AT_BOL();
1206 for ( yy_cp
= (yytext_ptr
) + YY_MORE_ADJ
; yy_cp
< (yy_c_buf_p
); ++yy_cp
)
1208 register YY_CHAR yy_c
= (*yy_cp
? yy_ec
[YY_SC_TO_UI(*yy_cp
)] : 1);
1209 if ( yy_accept
[yy_current_state
] )
1211 (yy_last_accepting_state
) = yy_current_state
;
1212 (yy_last_accepting_cpos
) = yy_cp
;
1214 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
1216 yy_current_state
= (int) yy_def
[yy_current_state
];
1217 if ( yy_current_state
>= 73 )
1218 yy_c
= yy_meta
[(unsigned int) yy_c
];
1220 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
1223 return yy_current_state
;
1226 /* yy_try_NUL_trans - try to make a transition on the NUL character
1229 * next_state = yy_try_NUL_trans( current_state );
1231 static yy_state_type
yy_try_NUL_trans (yy_state_type yy_current_state
)
1233 register int yy_is_jam
;
1234 register char *yy_cp
= (yy_c_buf_p
);
1236 register YY_CHAR yy_c
= 1;
1237 if ( yy_accept
[yy_current_state
] )
1239 (yy_last_accepting_state
) = yy_current_state
;
1240 (yy_last_accepting_cpos
) = yy_cp
;
1242 while ( yy_chk
[yy_base
[yy_current_state
] + yy_c
] != yy_current_state
)
1244 yy_current_state
= (int) yy_def
[yy_current_state
];
1245 if ( yy_current_state
>= 73 )
1246 yy_c
= yy_meta
[(unsigned int) yy_c
];
1248 yy_current_state
= yy_nxt
[yy_base
[yy_current_state
] + (unsigned int) yy_c
];
1249 yy_is_jam
= (yy_current_state
== 72);
1251 return yy_is_jam
? 0 : yy_current_state
;
1254 static void yyunput (int c
, register char * yy_bp
)
1256 register char *yy_cp
;
1258 yy_cp
= (yy_c_buf_p
);
1260 /* undo effects of setting up yytext */
1261 *yy_cp
= (yy_hold_char
);
1263 if ( yy_cp
< YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
+ 2 )
1264 { /* need to shift things up to make room */
1265 /* +2 for EOB chars. */
1266 register int number_to_move
= (yy_n_chars
) + 2;
1267 register char *dest
= &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[
1268 YY_CURRENT_BUFFER_LVALUE
->yy_buf_size
+ 2];
1269 register char *source
=
1270 &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[number_to_move
];
1272 while ( source
> YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
)
1273 *--dest
= *--source
;
1275 yy_cp
+= (int) (dest
- source
);
1276 yy_bp
+= (int) (dest
- source
);
1277 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
=
1278 (yy_n_chars
) = YY_CURRENT_BUFFER_LVALUE
->yy_buf_size
;
1280 if ( yy_cp
< YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
+ 2 )
1281 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1284 *--yy_cp
= (char) c
;
1286 (yytext_ptr
) = yy_bp
;
1287 (yy_hold_char
) = *yy_cp
;
1288 (yy_c_buf_p
) = yy_cp
;
1293 static int yyinput (void)
1295 static int input (void)
1301 *(yy_c_buf_p
) = (yy_hold_char
);
1303 if ( *(yy_c_buf_p
) == YY_END_OF_BUFFER_CHAR
)
1305 /* yy_c_buf_p now points to the character we want to return.
1306 * If this occurs *before* the EOB characters, then it's a
1307 * valid NUL; if not, then we've hit the end of the buffer.
1309 if ( (yy_c_buf_p
) < &YY_CURRENT_BUFFER_LVALUE
->yy_ch_buf
[(yy_n_chars
)] )
1310 /* This was really a NUL. */
1311 *(yy_c_buf_p
) = '\0';
1314 { /* need more input */
1315 int offset
= (yy_c_buf_p
) - (yytext_ptr
);
1318 switch ( yy_get_next_buffer( ) )
1320 case EOB_ACT_LAST_MATCH
:
1321 /* This happens because yy_g_n_b()
1322 * sees that we've accumulated a
1323 * token and flags that we need to
1324 * try matching the token before
1325 * proceeding. But for input(),
1326 * there's no matching to consider.
1327 * So convert the EOB_ACT_LAST_MATCH
1328 * to EOB_ACT_END_OF_FILE.
1331 /* Reset buffer status. */
1336 case EOB_ACT_END_OF_FILE
:
1341 if ( ! (yy_did_buffer_switch_on_eof
) )
1350 case EOB_ACT_CONTINUE_SCAN
:
1351 (yy_c_buf_p
) = (yytext_ptr
) + offset
;
1357 c
= *(unsigned char *) (yy_c_buf_p
); /* cast for 8-bit char's */
1358 *(yy_c_buf_p
) = '\0'; /* preserve yytext */
1359 (yy_hold_char
) = *++(yy_c_buf_p
);
1361 YY_CURRENT_BUFFER_LVALUE
->yy_at_bol
= (c
== '\n');
1365 #endif /* ifndef YY_NO_INPUT */
1367 /** Immediately switch to a different input stream.
1368 * @param input_file A readable stream.
1370 * @note This function does not reset the start condition to @c INITIAL .
1372 void yyrestart (FILE * input_file
)
1375 if ( ! YY_CURRENT_BUFFER
){
1376 yyensure_buffer_stack ();
1377 YY_CURRENT_BUFFER_LVALUE
=
1378 yy_create_buffer(yyin
,YY_BUF_SIZE
);
1381 yy_init_buffer(YY_CURRENT_BUFFER
,input_file
);
1382 yy_load_buffer_state( );
1385 /** Switch to a different input buffer.
1386 * @param new_buffer The new input buffer.
1389 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer
)
1392 /* TODO. We should be able to replace this entire function body
1394 * yypop_buffer_state();
1395 * yypush_buffer_state(new_buffer);
1397 yyensure_buffer_stack ();
1398 if ( YY_CURRENT_BUFFER
== new_buffer
)
1401 if ( YY_CURRENT_BUFFER
)
1403 /* Flush out information for old buffer. */
1404 *(yy_c_buf_p
) = (yy_hold_char
);
1405 YY_CURRENT_BUFFER_LVALUE
->yy_buf_pos
= (yy_c_buf_p
);
1406 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= (yy_n_chars
);
1409 YY_CURRENT_BUFFER_LVALUE
= new_buffer
;
1410 yy_load_buffer_state( );
1412 /* We don't actually know whether we did this switch during
1413 * EOF (yywrap()) processing, but the only time this flag
1414 * is looked at is after yywrap() is called, so it's safe
1415 * to go ahead and always set it.
1417 (yy_did_buffer_switch_on_eof
) = 1;
1420 static void yy_load_buffer_state (void)
1422 (yy_n_chars
) = YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
;
1423 (yytext_ptr
) = (yy_c_buf_p
) = YY_CURRENT_BUFFER_LVALUE
->yy_buf_pos
;
1424 yyin
= YY_CURRENT_BUFFER_LVALUE
->yy_input_file
;
1425 (yy_hold_char
) = *(yy_c_buf_p
);
1428 /** Allocate and initialize an input buffer state.
1429 * @param file A readable stream.
1430 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1432 * @return the allocated buffer state.
1434 YY_BUFFER_STATE
yy_create_buffer (FILE * file
, int size
)
1438 b
= (YY_BUFFER_STATE
) yyalloc(sizeof( struct yy_buffer_state
) );
1440 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1442 b
->yy_buf_size
= size
;
1444 /* yy_ch_buf has to be 2 characters longer than the size given because
1445 * we need to put in 2 end-of-buffer characters.
1447 b
->yy_ch_buf
= (char *) yyalloc(b
->yy_buf_size
+ 2 );
1448 if ( ! b
->yy_ch_buf
)
1449 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1451 b
->yy_is_our_buffer
= 1;
1453 yy_init_buffer(b
,file
);
1458 /** Destroy the buffer.
1459 * @param b a buffer created with yy_create_buffer()
1462 void yy_delete_buffer (YY_BUFFER_STATE b
)
1468 if ( b
== YY_CURRENT_BUFFER
) /* Not sure if we should pop here. */
1469 YY_CURRENT_BUFFER_LVALUE
= (YY_BUFFER_STATE
) 0;
1471 if ( b
->yy_is_our_buffer
)
1472 yyfree((void *) b
->yy_ch_buf
);
1474 yyfree((void *) b
);
1478 extern int isatty (int );
1479 #endif /* __cplusplus */
1481 /* Initializes or reinitializes a buffer.
1482 * This function is sometimes called more than once on the same buffer,
1483 * such as during a yyrestart() or at EOF.
1485 static void yy_init_buffer (YY_BUFFER_STATE b
, FILE * file
)
1490 yy_flush_buffer(b
);
1492 b
->yy_input_file
= file
;
1493 b
->yy_fill_buffer
= 1;
1495 /* If b is the current buffer, then yy_init_buffer was _probably_
1496 * called from yyrestart() or through yy_get_next_buffer.
1497 * In that case, we don't want to reset the lineno or column.
1499 if (b
!= YY_CURRENT_BUFFER
){
1500 b
->yy_bs_lineno
= 1;
1501 b
->yy_bs_column
= 0;
1504 b
->yy_is_interactive
= file
? (isatty( fileno(file
) ) > 0) : 0;
1509 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1510 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1513 void yy_flush_buffer (YY_BUFFER_STATE b
)
1520 /* We always need two end-of-buffer characters. The first causes
1521 * a transition to the end-of-buffer state. The second causes
1522 * a jam in that state.
1524 b
->yy_ch_buf
[0] = YY_END_OF_BUFFER_CHAR
;
1525 b
->yy_ch_buf
[1] = YY_END_OF_BUFFER_CHAR
;
1527 b
->yy_buf_pos
= &b
->yy_ch_buf
[0];
1530 b
->yy_buffer_status
= YY_BUFFER_NEW
;
1532 if ( b
== YY_CURRENT_BUFFER
)
1533 yy_load_buffer_state( );
1536 /** Pushes the new state onto the stack. The new state becomes
1537 * the current state. This function will allocate the stack
1539 * @param new_buffer The new state.
1542 void yypush_buffer_state (YY_BUFFER_STATE new_buffer
)
1544 if (new_buffer
== NULL
)
1547 yyensure_buffer_stack();
1549 /* This block is copied from yy_switch_to_buffer. */
1550 if ( YY_CURRENT_BUFFER
)
1552 /* Flush out information for old buffer. */
1553 *(yy_c_buf_p
) = (yy_hold_char
);
1554 YY_CURRENT_BUFFER_LVALUE
->yy_buf_pos
= (yy_c_buf_p
);
1555 YY_CURRENT_BUFFER_LVALUE
->yy_n_chars
= (yy_n_chars
);
1558 /* Only push if top exists. Otherwise, replace top. */
1559 if (YY_CURRENT_BUFFER
)
1560 (yy_buffer_stack_top
)++;
1561 YY_CURRENT_BUFFER_LVALUE
= new_buffer
;
1563 /* copied from yy_switch_to_buffer. */
1564 yy_load_buffer_state( );
1565 (yy_did_buffer_switch_on_eof
) = 1;
1568 /** Removes and deletes the top of the stack, if present.
1569 * The next element becomes the new top.
1572 void yypop_buffer_state (void)
1574 if (!YY_CURRENT_BUFFER
)
1577 yy_delete_buffer(YY_CURRENT_BUFFER
);
1578 YY_CURRENT_BUFFER_LVALUE
= NULL
;
1579 if ((yy_buffer_stack_top
) > 0)
1580 --(yy_buffer_stack_top
);
1582 if (YY_CURRENT_BUFFER
) {
1583 yy_load_buffer_state( );
1584 (yy_did_buffer_switch_on_eof
) = 1;
1588 /* Allocates the stack if it does not exist.
1589 * Guarantees space for at least one push.
1591 static void yyensure_buffer_stack (void)
1595 if (!(yy_buffer_stack
)) {
1597 /* First allocation is just for 2 elements, since we don't know if this
1598 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1599 * immediate realloc on the next call.
1602 (yy_buffer_stack
) = (struct yy_buffer_state
**)yyalloc
1603 (num_to_alloc
* sizeof(struct yy_buffer_state
*)
1605 if ( ! (yy_buffer_stack
) )
1606 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1608 memset((yy_buffer_stack
), 0, num_to_alloc
* sizeof(struct yy_buffer_state
*));
1610 (yy_buffer_stack_max
) = num_to_alloc
;
1611 (yy_buffer_stack_top
) = 0;
1615 if ((yy_buffer_stack_top
) >= ((yy_buffer_stack_max
)) - 1){
1617 /* Increase the buffer to prepare for a possible push. */
1618 int grow_size
= 8 /* arbitrary grow size */;
1620 num_to_alloc
= (yy_buffer_stack_max
) + grow_size
;
1621 (yy_buffer_stack
) = (struct yy_buffer_state
**)yyrealloc
1623 num_to_alloc
* sizeof(struct yy_buffer_state
*)
1625 if ( ! (yy_buffer_stack
) )
1626 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1628 /* zero only the new slots.*/
1629 memset((yy_buffer_stack
) + (yy_buffer_stack_max
), 0, grow_size
* sizeof(struct yy_buffer_state
*));
1630 (yy_buffer_stack_max
) = num_to_alloc
;
1634 /** Setup the input buffer state to scan directly from a user-specified character buffer.
1635 * @param base the character buffer
1636 * @param size the size in bytes of the character buffer
1638 * @return the newly allocated buffer state object.
1640 YY_BUFFER_STATE
yy_scan_buffer (char * base
, yy_size_t size
)
1645 base
[size
-2] != YY_END_OF_BUFFER_CHAR
||
1646 base
[size
-1] != YY_END_OF_BUFFER_CHAR
)
1647 /* They forgot to leave room for the EOB's. */
1650 b
= (YY_BUFFER_STATE
) yyalloc(sizeof( struct yy_buffer_state
) );
1652 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1654 b
->yy_buf_size
= size
- 2; /* "- 2" to take care of EOB's */
1655 b
->yy_buf_pos
= b
->yy_ch_buf
= base
;
1656 b
->yy_is_our_buffer
= 0;
1657 b
->yy_input_file
= 0;
1658 b
->yy_n_chars
= b
->yy_buf_size
;
1659 b
->yy_is_interactive
= 0;
1661 b
->yy_fill_buffer
= 0;
1662 b
->yy_buffer_status
= YY_BUFFER_NEW
;
1664 yy_switch_to_buffer(b
);
1669 /** Setup the input buffer state to scan a string. The next call to yylex() will
1670 * scan from a @e copy of @a str.
1671 * @param yystr a NUL-terminated string to scan
1673 * @return the newly allocated buffer state object.
1674 * @note If you want to scan bytes that may contain NUL values, then use
1675 * yy_scan_bytes() instead.
1677 YY_BUFFER_STATE
yy_scan_string (yyconst
char * yystr
)
1680 return yy_scan_bytes(yystr
,strlen(yystr
) );
1683 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
1684 * scan from a @e copy of @a bytes.
1685 * @param bytes the byte buffer to scan
1686 * @param len the number of bytes in the buffer pointed to by @a bytes.
1688 * @return the newly allocated buffer state object.
1690 YY_BUFFER_STATE
yy_scan_bytes (yyconst
char * yybytes
, int _yybytes_len
)
1697 /* Get memory for full buffer, including space for trailing EOB's. */
1698 n
= _yybytes_len
+ 2;
1699 buf
= (char *) yyalloc(n
);
1701 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1703 for ( i
= 0; i
< _yybytes_len
; ++i
)
1704 buf
[i
] = yybytes
[i
];
1706 buf
[_yybytes_len
] = buf
[_yybytes_len
+1] = YY_END_OF_BUFFER_CHAR
;
1708 b
= yy_scan_buffer(buf
,n
);
1710 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1712 /* It's okay to grow etc. this buffer, and we should throw it
1713 * away when we're done.
1715 b
->yy_is_our_buffer
= 1;
1720 #ifndef YY_EXIT_FAILURE
1721 #define YY_EXIT_FAILURE 2
1724 static void yy_fatal_error (yyconst
char* msg
)
1726 (void) fprintf( stderr
, "%s\n", msg
);
1727 exit( YY_EXIT_FAILURE
);
1730 /* Redefine yyless() so it works in section 3 code. */
1736 /* Undo effects of setting up yytext. */ \
1737 int yyless_macro_arg = (n); \
1738 YY_LESS_LINENO(yyless_macro_arg);\
1739 yytext[yyleng] = (yy_hold_char); \
1740 (yy_c_buf_p) = yytext + yyless_macro_arg; \
1741 (yy_hold_char) = *(yy_c_buf_p); \
1742 *(yy_c_buf_p) = '\0'; \
1743 yyleng = yyless_macro_arg; \
1747 /* Accessor methods (get/set functions) to struct members. */
1749 /** Get the current line number.
1752 int yyget_lineno (void)
1758 /** Get the input stream.
1761 FILE *yyget_in (void)
1766 /** Get the output stream.
1769 FILE *yyget_out (void)
1774 /** Get the length of the current token.
1777 int yyget_leng (void)
1782 /** Get the current token.
1786 char *yyget_text (void)
1791 /** Set the current line number.
1792 * @param line_number
1795 void yyset_lineno (int line_number
)
1798 yylineno
= line_number
;
1801 /** Set the input stream. This does not discard the current
1803 * @param in_str A readable stream.
1805 * @see yy_switch_to_buffer
1807 void yyset_in (FILE * in_str
)
1812 void yyset_out (FILE * out_str
)
1817 int yyget_debug (void)
1819 return yy_flex_debug
;
1822 void yyset_debug (int bdebug
)
1824 yy_flex_debug
= bdebug
;
1827 static int yy_init_globals (void)
1829 /* Initialization is the same as for the non-reentrant scanner.
1830 * This function is called from yylex_destroy(), so don't allocate here.
1833 (yy_buffer_stack
) = 0;
1834 (yy_buffer_stack_top
) = 0;
1835 (yy_buffer_stack_max
) = 0;
1836 (yy_c_buf_p
) = (char *) 0;
1840 /* Defined in main.c */
1849 /* For future reference: Set errno on error, since we are called by
1855 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
1856 int yylex_destroy (void)
1859 /* Pop the buffer stack, destroying each element. */
1860 while(YY_CURRENT_BUFFER
){
1861 yy_delete_buffer(YY_CURRENT_BUFFER
);
1862 YY_CURRENT_BUFFER_LVALUE
= NULL
;
1863 yypop_buffer_state();
1866 /* Destroy the stack itself. */
1867 yyfree((yy_buffer_stack
) );
1868 (yy_buffer_stack
) = NULL
;
1870 /* Reset the globals. This is important in a non-reentrant scanner so the next time
1871 * yylex() is called, initialization will occur. */
1878 * Internal utility routines.
1882 static void yy_flex_strncpy (char* s1
, yyconst
char * s2
, int n
)
1885 for ( i
= 0; i
< n
; ++i
)
1890 #ifdef YY_NEED_STRLEN
1891 static int yy_flex_strlen (yyconst
char * s
)
1894 for ( n
= 0; s
[n
]; ++n
)
1901 void *yyalloc (yy_size_t size
)
1903 return (void *) malloc( size
);
1906 void *yyrealloc (void * ptr
, yy_size_t size
)
1908 /* The cast to (char *) in the following accommodates both
1909 * implementations that use char* generic pointers, and those
1910 * that use void* generic pointers. It works with the latter
1911 * because both ANSI C and C++ allow castless assignment from
1912 * any pointer type to void*, and deal with argument conversions
1913 * as though doing an assignment.
1915 return (void *) realloc( (char *) ptr
, size
);
1918 void yyfree (void * ptr
)
1920 free( (char *) ptr
); /* see yyrealloc() for (char *) cast */
1923 #define YYTABLES_NAME "yytables"
1925 #line 84 "scanner.l"
1933 void yyerror(const char *message
)
1935 const char *pt
, *end
;
1939 } *entry
, list
[] = {
1940 { "T_VIRTUAL", "\"virtual\"" },
1941 { "T_DISPLAY", "\"display\"" },
1942 { "T_WALL", "\"wall\"" },
1943 { "T_OPTION", "\"option\"" },
1944 { "T_PARAM", "\"param\"" },
1945 { "T_DIMENSION", "dimension (e.g., 2x2 or 1024x768)" },
1946 { "T_OFFSET", "display offset (e.g., +10-10)" },
1947 { "T_ORIGIN", "tile origin (e.g., @1280x1024)" },
1948 { "T_STRING", "string" },
1949 { "T_COMMENT", "comment (e.g., #...)" },
1950 { "T_LINE_COMMENT", "comment (e.g., #...)" },
1954 fprintf(stderr
, "parse error on line %d at token \"%*.*s\"\n",
1955 lineno
, yyleng
, yyleng
, yytext
);
1956 end
= message
+ strlen(message
);
1957 for (pt
= message
; *pt
; pt
++) {
1958 if (pt
[0] == 'T' && pt
[1] == '_') {
1959 const char *next
= strchr(pt
, ' ');
1960 if (!next
|| !*next
) next
= strchr(pt
, '\0');
1961 if (!next
) goto bail
;
1963 if (next
-pt
== 1 && next
[1]
1964 && next
[2] == '\'' && next
[3] == '\'') {
1965 fprintf(stderr
, "\"%c\"", next
[1]);
1969 for (entry
= list
; entry
->from
; ++entry
) {
1970 if (!strncmp(entry
->from
, pt
, strlen(entry
->from
))) {
1971 fprintf(stderr
, "%s", entry
->to
);
1976 } else if (end
-pt
>= 5 && pt
[0] == '\'' && pt
[1] == '\'' && pt
[3]
1977 && pt
[4] == '\'' && pt
[5] == '\'') {
1978 fprintf(stderr
, "\"%c\"", pt
[3]);
1980 } else if (end
-pt
>= 3 && pt
[0] == '\'' && pt
[1] && pt
[2] == '\'') {
1981 fprintf(stderr
, "\"%c\"", pt
[1]);
1989 fprintf(stderr
, "\n");
1993 static int getdimension(int token
, const char *text
, int leng
)
1996 char *tmp
= dmxConfigAlloc(leng
+1);
1999 strlcpy(tmp
, text
, leng
+1);
2000 x
= strtol(tmp
, &endptr
, 10);
2001 while (*endptr
&& !isdigit(*endptr
)) ++endptr
;
2002 y
= strtol(endptr
, NULL
, 10);
2004 yylval
.pair
= dmxConfigCreatePair(token
, lineno
, NULL
, x
, y
, 1, 1);
2008 static int getstring(int token
, const char *text
, int leng
)
2010 yylval
.string
= dmxConfigCreateString(token
, lineno
, NULL
,
2011 dmxConfigCopyString(leng
? text
: "",
2016 static int gettoken(int token
, const char *text
, int leng
)
2018 yylval
.token
= dmxConfigCreateToken(token
, lineno
, NULL
);
2022 static int getcomment(int token
, const char *text
, int leng
)
2024 yylval
.comment
= dmxConfigCreateComment(token
, lineno
,
2025 dmxConfigCopyString(text
+ 1,