Imported Upstream version 1.15.1
[deb_xorg-server.git] / hw / dmx / config / scanner.c
CommitLineData
a09e091a
JB
1
2#line 3 "scanner.c"
3
4#define YY_INT_ALIGNED short int
5
6/* A lexical scanner generated by flex */
7
8#define FLEX_SCANNER
9#define YY_FLEX_MAJOR_VERSION 2
10#define YY_FLEX_MINOR_VERSION 5
11#define YY_FLEX_SUBMINOR_VERSION 35
12#if YY_FLEX_SUBMINOR_VERSION > 0
13#define FLEX_BETA
14#endif
15
16/* First, we deal with platform-specific or compiler-specific issues. */
17
18/* begin standard C headers. */
19#include <stdio.h>
20#include <string.h>
21#include <errno.h>
22#include <stdlib.h>
23
24/* end standard C headers. */
25
26/* flex integer type definitions */
27
28#ifndef FLEXINT_H
29#define FLEXINT_H
30
31/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
32
33#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
34
35/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
36 * if you want the limit (max/min) macros for int types.
37 */
38#ifndef __STDC_LIMIT_MACROS
39#define __STDC_LIMIT_MACROS 1
40#endif
41
42#include <inttypes.h>
43typedef int8_t flex_int8_t;
44typedef uint8_t flex_uint8_t;
45typedef int16_t flex_int16_t;
46typedef uint16_t flex_uint16_t;
47typedef int32_t flex_int32_t;
48typedef uint32_t flex_uint32_t;
49#else
50typedef signed char flex_int8_t;
51typedef short int flex_int16_t;
52typedef int flex_int32_t;
53typedef unsigned char flex_uint8_t;
54typedef unsigned short int flex_uint16_t;
55typedef unsigned int flex_uint32_t;
56#endif /* ! C99 */
57
58/* Limits of integral types. */
59#ifndef INT8_MIN
60#define INT8_MIN (-128)
61#endif
62#ifndef INT16_MIN
63#define INT16_MIN (-32767-1)
64#endif
65#ifndef INT32_MIN
66#define INT32_MIN (-2147483647-1)
67#endif
68#ifndef INT8_MAX
69#define INT8_MAX (127)
70#endif
71#ifndef INT16_MAX
72#define INT16_MAX (32767)
73#endif
74#ifndef INT32_MAX
75#define INT32_MAX (2147483647)
76#endif
77#ifndef UINT8_MAX
78#define UINT8_MAX (255U)
79#endif
80#ifndef UINT16_MAX
81#define UINT16_MAX (65535U)
82#endif
83#ifndef UINT32_MAX
84#define UINT32_MAX (4294967295U)
85#endif
86
87#endif /* ! FLEXINT_H */
88
89#ifdef __cplusplus
90
91/* The "const" storage-class-modifier is valid. */
92#define YY_USE_CONST
93
94#else /* ! __cplusplus */
95
96/* C99 requires __STDC__ to be defined as 1. */
97#if defined (__STDC__)
98
99#define YY_USE_CONST
100
101#endif /* defined (__STDC__) */
102#endif /* ! __cplusplus */
103
104#ifdef YY_USE_CONST
105#define yyconst const
106#else
107#define yyconst
108#endif
109
110/* Returned upon end-of-file. */
111#define YY_NULL 0
112
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
116 * double cast.
117 */
118#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
119
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.
123 */
124#define BEGIN (yy_start) = 1 + 2 *
125
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
128 * compatibility.
129 */
130#define YY_START (((yy_start) - 1) / 2)
131#define YYSTATE YY_START
132
133/* Action number for EOF rule of a given start state. */
134#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
135
136/* Special action meaning "start processing a new file". */
137#define YY_NEW_FILE yyrestart(yyin )
138
139#define YY_END_OF_BUFFER_CHAR 0
140
141/* Size of default input buffer. */
142#ifndef YY_BUF_SIZE
143#define YY_BUF_SIZE 16384
144#endif
145
146/* The state buf must be large enough to hold one state per character in the main buffer.
147 */
148#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
149
150#ifndef YY_TYPEDEF_YY_BUFFER_STATE
151#define YY_TYPEDEF_YY_BUFFER_STATE
152typedef struct yy_buffer_state *YY_BUFFER_STATE;
153#endif
154
155extern int yyleng;
156
157extern FILE *yyin, *yyout;
158
159#define EOB_ACT_CONTINUE_SCAN 0
160#define EOB_ACT_END_OF_FILE 1
161#define EOB_ACT_LAST_MATCH 2
162
163 #define YY_LESS_LINENO(n)
164
165/* Return all but the first "n" matched characters back to the input stream. */
166#define yyless(n) \
167 do \
168 { \
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 */ \
176 } \
177 while ( 0 )
178
179#define unput(c) yyunput( c, (yytext_ptr) )
180
181#ifndef YY_TYPEDEF_YY_SIZE_T
182#define YY_TYPEDEF_YY_SIZE_T
183typedef size_t yy_size_t;
184#endif
185
186#ifndef YY_STRUCT_YY_BUFFER_STATE
187#define YY_STRUCT_YY_BUFFER_STATE
188struct yy_buffer_state
189 {
190 FILE *yy_input_file;
191
192 char *yy_ch_buf; /* input buffer */
193 char *yy_buf_pos; /* current position in input buffer */
194
195 /* Size of input buffer in bytes, not including room for EOB
196 * characters.
197 */
198 yy_size_t yy_buf_size;
199
200 /* Number of characters read into yy_ch_buf, not including EOB
201 * characters.
202 */
203 int yy_n_chars;
204
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
207 * delete it.
208 */
209 int yy_is_our_buffer;
210
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
214 * each newline.
215 */
216 int yy_is_interactive;
217
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
220 * not.
221 */
222 int yy_at_bol;
223
224 int yy_bs_lineno; /**< The line count. */
225 int yy_bs_column; /**< The column count. */
226
227 /* Whether to try to fill the input buffer when we reach the
228 * end of it.
229 */
230 int yy_fill_buffer;
231
232 int yy_buffer_status;
233
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.
241 *
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.
245 */
246#define YY_BUFFER_EOF_PENDING 2
247
248 };
249#endif /* !YY_STRUCT_YY_BUFFER_STATE */
250
251/* Stack of input buffers. */
252static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
253static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
254static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
255
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
258 * "scanner state".
259 *
260 * Returns the top of the stack, or NULL.
261 */
262#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
263 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
264 : NULL)
265
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.
268 */
269#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
270
271/* yy_hold_char holds the character lost when yytext is formed. */
272static char yy_hold_char;
273static int yy_n_chars; /* number of characters read into yy_ch_buf */
274int yyleng;
275
276/* Points to current character in buffer. */
277static char *yy_c_buf_p = (char *) 0;
278static int yy_init = 0; /* whether we need to initialize */
279static int yy_start = 0; /* start state number */
280
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 ...
283 */
284static int yy_did_buffer_switch_on_eof;
285
286void yyrestart (FILE *input_file );
287void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer );
288YY_BUFFER_STATE yy_create_buffer (FILE *file,int size );
289void yy_delete_buffer (YY_BUFFER_STATE b );
290void yy_flush_buffer (YY_BUFFER_STATE b );
291void yypush_buffer_state (YY_BUFFER_STATE new_buffer );
292void yypop_buffer_state (void );
293
294static void yyensure_buffer_stack (void );
295static void yy_load_buffer_state (void );
296static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file );
297
298#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
299
300YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size );
301YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str );
302YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len );
303
304void *yyalloc (yy_size_t );
305void *yyrealloc (void *,yy_size_t );
306void yyfree (void * );
307
308#define yy_new_buffer yy_create_buffer
309
310#define yy_set_interactive(is_interactive) \
311 { \
312 if ( ! YY_CURRENT_BUFFER ){ \
313 yyensure_buffer_stack (); \
314 YY_CURRENT_BUFFER_LVALUE = \
315 yy_create_buffer(yyin,YY_BUF_SIZE ); \
316 } \
317 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
318 }
319
320#define yy_set_bol(at_bol) \
321 { \
322 if ( ! YY_CURRENT_BUFFER ){\
323 yyensure_buffer_stack (); \
324 YY_CURRENT_BUFFER_LVALUE = \
325 yy_create_buffer(yyin,YY_BUF_SIZE ); \
326 } \
327 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
328 }
329
330#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
331
332/* Begin user sect3 */
333
334typedef unsigned char YY_CHAR;
335
336FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
337
338typedef int yy_state_type;
339
340extern int yylineno;
341
342int yylineno = 1;
343
344extern char *yytext;
345#define yytext_ptr yytext
346
347static yy_state_type yy_get_previous_state (void );
348static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
349static int yy_get_next_buffer (void );
350static void yy_fatal_error (yyconst char msg[] );
351
352/* Done after the current pattern has been matched and before the
353 * corresponding action - sets up yytext.
354 */
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; \
359 *yy_cp = '\0'; \
360 (yy_c_buf_p) = yy_cp;
361
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. */
366struct yy_trans_info
367 {
368 flex_int32_t yy_verify;
369 flex_int32_t yy_nxt;
370 };
371static yyconst flex_int16_t yy_accept[73] =
372 { 0,
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,
380 1, 0
381 } ;
382
383static yyconst flex_int32_t yy_ec[256] =
384 { 0,
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,
395
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,
406
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,
412 1, 1, 1, 1, 1
413 } ;
414
415static yyconst flex_int32_t yy_meta[30] =
416 { 0,
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
420 } ;
421
422static yyconst flex_int16_t yy_base[77] =
423 { 0,
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
432 } ;
433
434static yyconst flex_int16_t yy_def[77] =
435 { 0,
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
444 } ;
445
446static yyconst flex_int16_t yy_nxt[137] =
447 { 0,
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,
458
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
463 } ;
464
465static yyconst flex_int16_t yy_chk[137] =
466 { 0,
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,
477
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
482 } ;
483
484static yy_state_type yy_last_accepting_state;
485static char *yy_last_accepting_cpos;
486
487extern int yy_flex_debug;
488int yy_flex_debug = 0;
489
490/* The intent behind this definition is that it'll catch
491 * any uses of REJECT which flex missed.
492 */
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
497char *yytext;
498#line 1 "scanner.l"
499/* $XFree86$ */
500/*
501 * Copyright 2002 Red Hat Inc., Durham, North Carolina.
502 *
503 * All Rights Reserved.
504 *
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:
512 *
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.
516 *
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
524 * SOFTWARE.
525 */
526/*
527 * Authors:
528 * Rickard E. (Rik) Faith <faith@redhat.com>
529 *
530 */
531#line 36 "scanner.l"
532#ifdef HAVE_DMX_CONFIG_H
533#include <dmx-config.h>
534#endif
535
536#include "dmxparse.h"
537#include "parser.h"
538#include "os.h"
539#include <string.h>
540#include <stdlib.h>
541#include <ctype.h>
542static int getdimension(int token, const char *text, int leng);
543static int getstring(int token, const char *text, int leng);
544static int gettoken(int token, const char *text, int leng);
545static int getcomment(int token, const char *text, int leng);
546static int lineno = 1;
547
548#line 549 "scanner.c"
549
550#define INITIAL 0
551#define OTHER 1
552
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.
557 */
558#include <unistd.h>
559#endif
560
561#ifndef YY_EXTRA_TYPE
562#define YY_EXTRA_TYPE void *
563#endif
564
565static int yy_init_globals (void );
566
567/* Accessor methods to globals.
568 These are made visible to non-reentrant scanners for convenience. */
569
570int yylex_destroy (void );
571
572int yyget_debug (void );
573
574void yyset_debug (int debug_flag );
575
576YY_EXTRA_TYPE yyget_extra (void );
577
578void yyset_extra (YY_EXTRA_TYPE user_defined );
579
580FILE *yyget_in (void );
581
582void yyset_in (FILE * in_str );
583
584FILE *yyget_out (void );
585
586void yyset_out (FILE * out_str );
587
588int yyget_leng (void );
589
590char *yyget_text (void );
591
592int yyget_lineno (void );
593
594void yyset_lineno (int line_number );
595
596/* Macros after this point can all be overridden by user definitions in
597 * section 1.
598 */
599
600#ifndef YY_SKIP_YYWRAP
601#ifdef __cplusplus
602extern "C" int yywrap (void );
603#else
604extern int yywrap (void );
605#endif
606#endif
607
608 static void yyunput (int c,char *buf_ptr );
609
610#ifndef yytext_ptr
611static void yy_flex_strncpy (char *,yyconst char *,int );
612#endif
613
614#ifdef YY_NEED_STRLEN
615static int yy_flex_strlen (yyconst char * );
616#endif
617
618#ifndef YY_NO_INPUT
619
620#ifdef __cplusplus
621static int yyinput (void );
622#else
623static int input (void );
624#endif
625
626#endif
627
628/* Amount of stuff to slurp up with each read. */
629#ifndef YY_READ_BUF_SIZE
630#define YY_READ_BUF_SIZE 8192
631#endif
632
633/* Copy whatever the last rule matched to the standard output. */
634#ifndef ECHO
635/* This used to be an fputs(), but since the string might contain NUL's,
636 * we now use fwrite().
637 */
638#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
639#endif
640
641/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
642 * is returned in "result".
643 */
644#ifndef YY_INPUT
645#define YY_INPUT(buf,result,max_size) \
646 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
647 { \
648 int c = '*'; \
649 unsigned n; \
650 for ( n = 0; n < max_size && \
651 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
652 buf[n] = (char) c; \
653 if ( c == '\n' ) \
654 buf[n++] = (char) c; \
655 if ( c == EOF && ferror( yyin ) ) \
656 YY_FATAL_ERROR( "input in flex scanner failed" ); \
657 result = n; \
658 } \
659 else \
660 { \
661 errno=0; \
662 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
663 { \
664 if( errno != EINTR) \
665 { \
666 YY_FATAL_ERROR( "input in flex scanner failed" ); \
667 break; \
668 } \
669 errno=0; \
670 clearerr(yyin); \
671 } \
672 }\
673\
674
675#endif
676
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.
680 */
681#ifndef yyterminate
682#define yyterminate() return YY_NULL
683#endif
684
685/* Number of entries by which start-condition stack grows. */
686#ifndef YY_START_STACK_INCR
687#define YY_START_STACK_INCR 25
688#endif
689
690/* Report a fatal error. */
691#ifndef YY_FATAL_ERROR
692#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
693#endif
694
695/* end tables serialization structures and prototypes */
696
697/* Default declaration of generated scanner - a define so the user can
698 * easily add parameters.
699 */
700#ifndef YY_DECL
701#define YY_DECL_IS_OURS 1
702
703extern int yylex (void);
704
705#define YY_DECL int yylex (void)
706#endif /* !YY_DECL */
707
708/* Code executed at the beginning of each rule, after yytext and yyleng
709 * have been set up.
710 */
711#ifndef YY_USER_ACTION
712#define YY_USER_ACTION
713#endif
714
715/* Code executed at the end of each rule. */
716#ifndef YY_BREAK
717#define YY_BREAK break;
718#endif
719
720#define YY_RULE_SETUP \
721 if ( yyleng > 0 ) \
722 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
723 (yytext[yyleng - 1] == '\n'); \
724 YY_USER_ACTION
725
726/** The main scanner function which does all the work.
727 */
728YY_DECL
729{
730 register yy_state_type yy_current_state;
731 register char *yy_cp, *yy_bp;
732 register int yy_act;
733
734#line 63 "scanner.l"
735
736#line 737 "scanner.c"
737
738 if ( !(yy_init) )
739 {
740 (yy_init) = 1;
741
742#ifdef YY_USER_INIT
743 YY_USER_INIT;
744#endif
745
746 if ( ! (yy_start) )
747 (yy_start) = 1; /* first start state */
748
749 if ( ! yyin )
750 yyin = stdin;
751
752 if ( ! yyout )
753 yyout = stdout;
754
755 if ( ! YY_CURRENT_BUFFER ) {
756 yyensure_buffer_stack ();
757 YY_CURRENT_BUFFER_LVALUE =
758 yy_create_buffer(yyin,YY_BUF_SIZE );
759 }
760
761 yy_load_buffer_state( );
762 }
763
764 while ( 1 ) /* loops until end-of-file is reached */
765 {
766 yy_cp = (yy_c_buf_p);
767
768 /* Support of yytext. */
769 *yy_cp = (yy_hold_char);
770
771 /* yy_bp points to the position in yy_ch_buf of the start of
772 * the current run.
773 */
774 yy_bp = yy_cp;
775
776 yy_current_state = (yy_start);
777 yy_current_state += YY_AT_BOL();
778yy_match:
779 do
780 {
781 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
782 if ( yy_accept[yy_current_state] )
783 {
784 (yy_last_accepting_state) = yy_current_state;
785 (yy_last_accepting_cpos) = yy_cp;
786 }
787 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
788 {
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];
792 }
793 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
794 ++yy_cp;
795 }
796 while ( yy_base[yy_current_state] != 107 );
797
798yy_find_action:
799 yy_act = yy_accept[yy_current_state];
800 if ( yy_act == 0 )
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];
805 }
806
807 YY_DO_BEFORE_ACTION;
808
809do_action: /* This label is used only to access EOF actions. */
810
811 switch ( yy_act )
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);
818 goto yy_find_action;
819
820case 1:
821YY_RULE_SETUP
822#line 64 "scanner.l"
823return gettoken(T_VIRTUAL, yytext, yyleng);
824 YY_BREAK
825case 2:
826YY_RULE_SETUP
827#line 65 "scanner.l"
828return gettoken(T_DISPLAY, yytext, yyleng);
829 YY_BREAK
830case 3:
831YY_RULE_SETUP
832#line 66 "scanner.l"
833return gettoken(T_WALL, yytext, yyleng);
834 YY_BREAK
835case 4:
836YY_RULE_SETUP
837#line 67 "scanner.l"
838return gettoken(T_OPTION, yytext, yyleng);
839 YY_BREAK
840case 5:
841YY_RULE_SETUP
842#line 68 "scanner.l"
843return gettoken(T_PARAM, yytext, yyleng);
844 YY_BREAK
845case 6:
846YY_RULE_SETUP
847#line 69 "scanner.l"
848return getdimension(T_DIMENSION, yytext, yyleng);
849 YY_BREAK
850case 7:
851YY_RULE_SETUP
852#line 70 "scanner.l"
853return getdimension(T_OFFSET, yytext+1, yyleng-1);
854 YY_BREAK
855case 8:
856YY_RULE_SETUP
857#line 71 "scanner.l"
858return getdimension(T_ORIGIN, yytext+1, yyleng-1);
859 YY_BREAK
860case 9:
861YY_RULE_SETUP
862#line 72 "scanner.l"
863return getstring(T_STRING, yytext, yyleng);
864 YY_BREAK
865case 10:
866YY_RULE_SETUP
867#line 73 "scanner.l"
868return getstring(T_STRING, yytext+1, yyleng-2);
869 YY_BREAK
870case 11:
871/* rule 11 can match eol */
872YY_RULE_SETUP
873#line 74 "scanner.l"
874++lineno;
875 YY_BREAK
876case 12:
877YY_RULE_SETUP
878#line 75 "scanner.l"
879
880 YY_BREAK
881case 13:
882YY_RULE_SETUP
883#line 76 "scanner.l"
884return gettoken(yytext[0], yytext, yyleng);
885 YY_BREAK
886case 14:
887YY_RULE_SETUP
888#line 77 "scanner.l"
889return gettoken(yytext[0], yytext, yyleng);
890 YY_BREAK
891case 15:
892YY_RULE_SETUP
893#line 78 "scanner.l"
894return gettoken(yytext[0], yytext, yyleng);
895 YY_BREAK
896case 16:
897YY_RULE_SETUP
898#line 79 "scanner.l"
899return gettoken(yytext[0], yytext, yyleng);
900 YY_BREAK
901case 17:
902YY_RULE_SETUP
903#line 80 "scanner.l"
904return getcomment(T_LINE_COMMENT, yytext, yyleng);
905 YY_BREAK
906case 18:
907YY_RULE_SETUP
908#line 81 "scanner.l"
909return getcomment(T_COMMENT, yytext, yyleng);
910 YY_BREAK
911case 19:
912YY_RULE_SETUP
913#line 82 "scanner.l"
914return getstring(T_STRING, yytext, yyleng);
915 YY_BREAK
916case YY_STATE_EOF(INITIAL):
917case YY_STATE_EOF(OTHER):
918#line 83 "scanner.l"
919return 0;
920 YY_BREAK
921case 20:
922YY_RULE_SETUP
923#line 84 "scanner.l"
924ECHO;
925 YY_BREAK
926#line 927 "scanner.c"
927
928 case YY_END_OF_BUFFER:
929 {
930 /* Amount of text matched not including the EOB char. */
931 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
932
933 /* Undo the effects of YY_DO_BEFORE_ACTION. */
934 *yy_cp = (yy_hold_char);
935 YY_RESTORE_YY_MORE_OFFSET
936
937 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
938 {
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.
947 */
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;
951 }
952
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
958 * in input().
959 */
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;
963
964 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
965
966 yy_current_state = yy_get_previous_state( );
967
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).
975 */
976
977 yy_next_state = yy_try_NUL_trans( yy_current_state );
978
979 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
980
981 if ( yy_next_state )
982 {
983 /* Consume the NUL. */
984 yy_cp = ++(yy_c_buf_p);
985 yy_current_state = yy_next_state;
986 goto yy_match;
987 }
988
989 else
990 {
991 yy_cp = (yy_c_buf_p);
992 goto yy_find_action;
993 }
994 }
995
996 else switch ( yy_get_next_buffer( ) )
997 {
998 case EOB_ACT_END_OF_FILE:
999 {
1000 (yy_did_buffer_switch_on_eof) = 0;
1001
1002 if ( yywrap( ) )
1003 {
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.
1012 */
1013 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1014
1015 yy_act = YY_STATE_EOF(YY_START);
1016 goto do_action;
1017 }
1018
1019 else
1020 {
1021 if ( ! (yy_did_buffer_switch_on_eof) )
1022 YY_NEW_FILE;
1023 }
1024 break;
1025 }
1026
1027 case EOB_ACT_CONTINUE_SCAN:
1028 (yy_c_buf_p) =
1029 (yytext_ptr) + yy_amount_of_matched_text;
1030
1031 yy_current_state = yy_get_previous_state( );
1032
1033 yy_cp = (yy_c_buf_p);
1034 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1035 goto yy_match;
1036
1037 case EOB_ACT_LAST_MATCH:
1038 (yy_c_buf_p) =
1039 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1040
1041 yy_current_state = yy_get_previous_state( );
1042
1043 yy_cp = (yy_c_buf_p);
1044 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1045 goto yy_find_action;
1046 }
1047 break;
1048 }
1049
1050 default:
1051 YY_FATAL_ERROR(
1052 "fatal flex scanner internal error--no action found" );
1053 } /* end of action switch */
1054 } /* end of scanning one token */
1055} /* end of yylex */
1056
1057/* yy_get_next_buffer - try to read in a new buffer
1058 *
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
1063 */
1064static int yy_get_next_buffer (void)
1065{
1066 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1067 register char *source = (yytext_ptr);
1068 register int number_to_move, i;
1069 int ret_val;
1070
1071 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1072 YY_FATAL_ERROR(
1073 "fatal flex scanner internal error--end of buffer missed" );
1074
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 )
1078 {
1079 /* We matched a single character, the EOB, so
1080 * treat this as a final EOF.
1081 */
1082 return EOB_ACT_END_OF_FILE;
1083 }
1084
1085 else
1086 {
1087 /* We matched some text prior to the EOB, first
1088 * process it.
1089 */
1090 return EOB_ACT_LAST_MATCH;
1091 }
1092 }
1093
1094 /* Try to read more data. */
1095
1096 /* First move last chars to start of buffer. */
1097 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1098
1099 for ( i = 0; i < number_to_move; ++i )
1100 *(dest++) = *(source++);
1101
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,
1104 * just force an EOF
1105 */
1106 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1107
1108 else
1109 {
1110 int num_to_read =
1111 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1112
1113 while ( num_to_read <= 0 )
1114 { /* Not enough room in the buffer - grow it. */
1115
1116 /* just a shorter name for the current buffer */
1117 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1118
1119 int yy_c_buf_p_offset =
1120 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1121
1122 if ( b->yy_is_our_buffer )
1123 {
1124 int new_size = b->yy_buf_size * 2;
1125
1126 if ( new_size <= 0 )
1127 b->yy_buf_size += b->yy_buf_size / 8;
1128 else
1129 b->yy_buf_size *= 2;
1130
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 );
1134 }
1135 else
1136 /* Can't grow it, we don't own it. */
1137 b->yy_ch_buf = 0;
1138
1139 if ( ! b->yy_ch_buf )
1140 YY_FATAL_ERROR(
1141 "fatal error - scanner input buffer overflow" );
1142
1143 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1144
1145 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1146 number_to_move - 1;
1147
1148 }
1149
1150 if ( num_to_read > YY_READ_BUF_SIZE )
1151 num_to_read = YY_READ_BUF_SIZE;
1152
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 );
1156
1157 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1158 }
1159
1160 if ( (yy_n_chars) == 0 )
1161 {
1162 if ( number_to_move == YY_MORE_ADJ )
1163 {
1164 ret_val = EOB_ACT_END_OF_FILE;
1165 yyrestart(yyin );
1166 }
1167
1168 else
1169 {
1170 ret_val = EOB_ACT_LAST_MATCH;
1171 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1172 YY_BUFFER_EOF_PENDING;
1173 }
1174 }
1175
1176 else
1177 ret_val = EOB_ACT_CONTINUE_SCAN;
1178
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()" );
1185 }
1186
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;
1190
1191 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1192
1193 return ret_val;
1194}
1195
1196/* yy_get_previous_state - get the state just before the EOB char was reached */
1197
1198 static yy_state_type yy_get_previous_state (void)
1199{
1200 register yy_state_type yy_current_state;
1201 register char *yy_cp;
1202
1203 yy_current_state = (yy_start);
1204 yy_current_state += YY_AT_BOL();
1205
1206 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1207 {
1208 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1209 if ( yy_accept[yy_current_state] )
1210 {
1211 (yy_last_accepting_state) = yy_current_state;
1212 (yy_last_accepting_cpos) = yy_cp;
1213 }
1214 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1215 {
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];
1219 }
1220 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1221 }
1222
1223 return yy_current_state;
1224}
1225
1226/* yy_try_NUL_trans - try to make a transition on the NUL character
1227 *
1228 * synopsis
1229 * next_state = yy_try_NUL_trans( current_state );
1230 */
1231 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1232{
1233 register int yy_is_jam;
1234 register char *yy_cp = (yy_c_buf_p);
1235
1236 register YY_CHAR yy_c = 1;
1237 if ( yy_accept[yy_current_state] )
1238 {
1239 (yy_last_accepting_state) = yy_current_state;
1240 (yy_last_accepting_cpos) = yy_cp;
1241 }
1242 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1243 {
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];
1247 }
1248 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1249 yy_is_jam = (yy_current_state == 72);
1250
1251 return yy_is_jam ? 0 : yy_current_state;
1252}
1253
1254 static void yyunput (int c, register char * yy_bp )
1255{
1256 register char *yy_cp;
1257
1258 yy_cp = (yy_c_buf_p);
1259
1260 /* undo effects of setting up yytext */
1261 *yy_cp = (yy_hold_char);
1262
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];
1271
1272 while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1273 *--dest = *--source;
1274
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;
1279
1280 if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1281 YY_FATAL_ERROR( "flex scanner push-back overflow" );
1282 }
1283
1284 *--yy_cp = (char) c;
1285
1286 (yytext_ptr) = yy_bp;
1287 (yy_hold_char) = *yy_cp;
1288 (yy_c_buf_p) = yy_cp;
1289}
1290
1291#ifndef YY_NO_INPUT
1292#ifdef __cplusplus
1293 static int yyinput (void)
1294#else
1295 static int input (void)
1296#endif
1297
1298{
1299 int c;
1300
1301 *(yy_c_buf_p) = (yy_hold_char);
1302
1303 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1304 {
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.
1308 */
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';
1312
1313 else
1314 { /* need more input */
1315 int offset = (yy_c_buf_p) - (yytext_ptr);
1316 ++(yy_c_buf_p);
1317
1318 switch ( yy_get_next_buffer( ) )
1319 {
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.
1329 */
1330
1331 /* Reset buffer status. */
1332 yyrestart(yyin );
1333
1334 /*FALLTHROUGH*/
1335
1336 case EOB_ACT_END_OF_FILE:
1337 {
1338 if ( yywrap( ) )
1339 return EOF;
1340
1341 if ( ! (yy_did_buffer_switch_on_eof) )
1342 YY_NEW_FILE;
1343#ifdef __cplusplus
1344 return yyinput();
1345#else
1346 return input();
1347#endif
1348 }
1349
1350 case EOB_ACT_CONTINUE_SCAN:
1351 (yy_c_buf_p) = (yytext_ptr) + offset;
1352 break;
1353 }
1354 }
1355 }
1356
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);
1360
1361 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
1362
1363 return c;
1364}
1365#endif /* ifndef YY_NO_INPUT */
1366
1367/** Immediately switch to a different input stream.
1368 * @param input_file A readable stream.
1369 *
1370 * @note This function does not reset the start condition to @c INITIAL .
1371 */
1372 void yyrestart (FILE * input_file )
1373{
1374
1375 if ( ! YY_CURRENT_BUFFER ){
1376 yyensure_buffer_stack ();
1377 YY_CURRENT_BUFFER_LVALUE =
1378 yy_create_buffer(yyin,YY_BUF_SIZE );
1379 }
1380
1381 yy_init_buffer(YY_CURRENT_BUFFER,input_file );
1382 yy_load_buffer_state( );
1383}
1384
1385/** Switch to a different input buffer.
1386 * @param new_buffer The new input buffer.
1387 *
1388 */
1389 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1390{
1391
1392 /* TODO. We should be able to replace this entire function body
1393 * with
1394 * yypop_buffer_state();
1395 * yypush_buffer_state(new_buffer);
1396 */
1397 yyensure_buffer_stack ();
1398 if ( YY_CURRENT_BUFFER == new_buffer )
1399 return;
1400
1401 if ( YY_CURRENT_BUFFER )
1402 {
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);
1407 }
1408
1409 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1410 yy_load_buffer_state( );
1411
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.
1416 */
1417 (yy_did_buffer_switch_on_eof) = 1;
1418}
1419
1420static void yy_load_buffer_state (void)
1421{
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);
1426}
1427
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.
1431 *
1432 * @return the allocated buffer state.
1433 */
1434 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
1435{
1436 YY_BUFFER_STATE b;
1437
1438 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1439 if ( ! b )
1440 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1441
1442 b->yy_buf_size = size;
1443
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.
1446 */
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()" );
1450
1451 b->yy_is_our_buffer = 1;
1452
1453 yy_init_buffer(b,file );
1454
1455 return b;
1456}
1457
1458/** Destroy the buffer.
1459 * @param b a buffer created with yy_create_buffer()
1460 *
1461 */
1462 void yy_delete_buffer (YY_BUFFER_STATE b )
1463{
1464
1465 if ( ! b )
1466 return;
1467
1468 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1469 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1470
1471 if ( b->yy_is_our_buffer )
1472 yyfree((void *) b->yy_ch_buf );
1473
1474 yyfree((void *) b );
1475}
1476
1477#ifndef __cplusplus
1478extern int isatty (int );
1479#endif /* __cplusplus */
1480
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.
1484 */
1485 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
1486
1487{
1488 int oerrno = errno;
1489
1490 yy_flush_buffer(b );
1491
1492 b->yy_input_file = file;
1493 b->yy_fill_buffer = 1;
1494
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.
1498 */
1499 if (b != YY_CURRENT_BUFFER){
1500 b->yy_bs_lineno = 1;
1501 b->yy_bs_column = 0;
1502 }
1503
1504 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1505
1506 errno = oerrno;
1507}
1508
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.
1511 *
1512 */
1513 void yy_flush_buffer (YY_BUFFER_STATE b )
1514{
1515 if ( ! b )
1516 return;
1517
1518 b->yy_n_chars = 0;
1519
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.
1523 */
1524 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1525 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1526
1527 b->yy_buf_pos = &b->yy_ch_buf[0];
1528
1529 b->yy_at_bol = 1;
1530 b->yy_buffer_status = YY_BUFFER_NEW;
1531
1532 if ( b == YY_CURRENT_BUFFER )
1533 yy_load_buffer_state( );
1534}
1535
1536/** Pushes the new state onto the stack. The new state becomes
1537 * the current state. This function will allocate the stack
1538 * if necessary.
1539 * @param new_buffer The new state.
1540 *
1541 */
1542void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
1543{
1544 if (new_buffer == NULL)
1545 return;
1546
1547 yyensure_buffer_stack();
1548
1549 /* This block is copied from yy_switch_to_buffer. */
1550 if ( YY_CURRENT_BUFFER )
1551 {
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);
1556 }
1557
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;
1562
1563 /* copied from yy_switch_to_buffer. */
1564 yy_load_buffer_state( );
1565 (yy_did_buffer_switch_on_eof) = 1;
1566}
1567
1568/** Removes and deletes the top of the stack, if present.
1569 * The next element becomes the new top.
1570 *
1571 */
1572void yypop_buffer_state (void)
1573{
1574 if (!YY_CURRENT_BUFFER)
1575 return;
1576
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);
1581
1582 if (YY_CURRENT_BUFFER) {
1583 yy_load_buffer_state( );
1584 (yy_did_buffer_switch_on_eof) = 1;
1585 }
1586}
1587
1588/* Allocates the stack if it does not exist.
1589 * Guarantees space for at least one push.
1590 */
1591static void yyensure_buffer_stack (void)
1592{
1593 int num_to_alloc;
1594
1595 if (!(yy_buffer_stack)) {
1596
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.
1600 */
1601 num_to_alloc = 1;
1602 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
1603 (num_to_alloc * sizeof(struct yy_buffer_state*)
1604 );
1605 if ( ! (yy_buffer_stack) )
1606 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1607
1608 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1609
1610 (yy_buffer_stack_max) = num_to_alloc;
1611 (yy_buffer_stack_top) = 0;
1612 return;
1613 }
1614
1615 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1616
1617 /* Increase the buffer to prepare for a possible push. */
1618 int grow_size = 8 /* arbitrary grow size */;
1619
1620 num_to_alloc = (yy_buffer_stack_max) + grow_size;
1621 (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
1622 ((yy_buffer_stack),
1623 num_to_alloc * sizeof(struct yy_buffer_state*)
1624 );
1625 if ( ! (yy_buffer_stack) )
1626 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1627
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;
1631 }
1632}
1633
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
1637 *
1638 * @return the newly allocated buffer state object.
1639 */
1640YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
1641{
1642 YY_BUFFER_STATE b;
1643
1644 if ( size < 2 ||
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. */
1648 return 0;
1649
1650 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1651 if ( ! b )
1652 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1653
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;
1660 b->yy_at_bol = 1;
1661 b->yy_fill_buffer = 0;
1662 b->yy_buffer_status = YY_BUFFER_NEW;
1663
1664 yy_switch_to_buffer(b );
1665
1666 return b;
1667}
1668
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
1672 *
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.
1676 */
1677YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
1678{
1679
1680 return yy_scan_bytes(yystr,strlen(yystr) );
1681}
1682
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.
1687 *
1688 * @return the newly allocated buffer state object.
1689 */
1690YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len )
1691{
1692 YY_BUFFER_STATE b;
1693 char *buf;
1694 yy_size_t n;
1695 int i;
1696
1697 /* Get memory for full buffer, including space for trailing EOB's. */
1698 n = _yybytes_len + 2;
1699 buf = (char *) yyalloc(n );
1700 if ( ! buf )
1701 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1702
1703 for ( i = 0; i < _yybytes_len; ++i )
1704 buf[i] = yybytes[i];
1705
1706 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1707
1708 b = yy_scan_buffer(buf,n );
1709 if ( ! b )
1710 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1711
1712 /* It's okay to grow etc. this buffer, and we should throw it
1713 * away when we're done.
1714 */
1715 b->yy_is_our_buffer = 1;
1716
1717 return b;
1718}
1719
1720#ifndef YY_EXIT_FAILURE
1721#define YY_EXIT_FAILURE 2
1722#endif
1723
1724static void yy_fatal_error (yyconst char* msg )
1725{
1726 (void) fprintf( stderr, "%s\n", msg );
1727 exit( YY_EXIT_FAILURE );
1728}
1729
1730/* Redefine yyless() so it works in section 3 code. */
1731
1732#undef yyless
1733#define yyless(n) \
1734 do \
1735 { \
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; \
1744 } \
1745 while ( 0 )
1746
1747/* Accessor methods (get/set functions) to struct members. */
1748
1749/** Get the current line number.
1750 *
1751 */
1752int yyget_lineno (void)
1753{
1754
1755 return yylineno;
1756}
1757
1758/** Get the input stream.
1759 *
1760 */
1761FILE *yyget_in (void)
1762{
1763 return yyin;
1764}
1765
1766/** Get the output stream.
1767 *
1768 */
1769FILE *yyget_out (void)
1770{
1771 return yyout;
1772}
1773
1774/** Get the length of the current token.
1775 *
1776 */
1777int yyget_leng (void)
1778{
1779 return yyleng;
1780}
1781
1782/** Get the current token.
1783 *
1784 */
1785
1786char *yyget_text (void)
1787{
1788 return yytext;
1789}
1790
1791/** Set the current line number.
1792 * @param line_number
1793 *
1794 */
1795void yyset_lineno (int line_number )
1796{
1797
1798 yylineno = line_number;
1799}
1800
1801/** Set the input stream. This does not discard the current
1802 * input buffer.
1803 * @param in_str A readable stream.
1804 *
1805 * @see yy_switch_to_buffer
1806 */
1807void yyset_in (FILE * in_str )
1808{
1809 yyin = in_str ;
1810}
1811
1812void yyset_out (FILE * out_str )
1813{
1814 yyout = out_str ;
1815}
1816
1817int yyget_debug (void)
1818{
1819 return yy_flex_debug;
1820}
1821
1822void yyset_debug (int bdebug )
1823{
1824 yy_flex_debug = bdebug ;
1825}
1826
1827static int yy_init_globals (void)
1828{
1829 /* Initialization is the same as for the non-reentrant scanner.
1830 * This function is called from yylex_destroy(), so don't allocate here.
1831 */
1832
1833 (yy_buffer_stack) = 0;
1834 (yy_buffer_stack_top) = 0;
1835 (yy_buffer_stack_max) = 0;
1836 (yy_c_buf_p) = (char *) 0;
1837 (yy_init) = 0;
1838 (yy_start) = 0;
1839
1840/* Defined in main.c */
1841#ifdef YY_STDINIT
1842 yyin = stdin;
1843 yyout = stdout;
1844#else
1845 yyin = (FILE *) 0;
1846 yyout = (FILE *) 0;
1847#endif
1848
1849 /* For future reference: Set errno on error, since we are called by
1850 * yylex_init()
1851 */
1852 return 0;
1853}
1854
1855/* yylex_destroy is for both reentrant and non-reentrant scanners. */
1856int yylex_destroy (void)
1857{
1858
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();
1864 }
1865
1866 /* Destroy the stack itself. */
1867 yyfree((yy_buffer_stack) );
1868 (yy_buffer_stack) = NULL;
1869
1870 /* Reset the globals. This is important in a non-reentrant scanner so the next time
1871 * yylex() is called, initialization will occur. */
1872 yy_init_globals( );
1873
1874 return 0;
1875}
1876
1877/*
1878 * Internal utility routines.
1879 */
1880
1881#ifndef yytext_ptr
1882static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
1883{
1884 register int i;
1885 for ( i = 0; i < n; ++i )
1886 s1[i] = s2[i];
1887}
1888#endif
1889
1890#ifdef YY_NEED_STRLEN
1891static int yy_flex_strlen (yyconst char * s )
1892{
1893 register int n;
1894 for ( n = 0; s[n]; ++n )
1895 ;
1896
1897 return n;
1898}
1899#endif
1900
1901void *yyalloc (yy_size_t size )
1902{
1903 return (void *) malloc( size );
1904}
1905
1906void *yyrealloc (void * ptr, yy_size_t size )
1907{
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.
1914 */
1915 return (void *) realloc( (char *) ptr, size );
1916}
1917
1918void yyfree (void * ptr )
1919{
1920 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
1921}
1922
1923#define YYTABLES_NAME "yytables"
1924
1925#line 84 "scanner.l"
1926
1927
1928int yywrap(void)
1929{
1930 return 1;
1931}
1932
1933void yyerror(const char *message)
1934{
1935 const char *pt, *end;
1936 struct _entry {
1937 const char *from;
1938 const char *to;
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., #...)" },
1951 { NULL, NULL }
1952 };
1953
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;
1962 --next;
1963 if (next-pt == 1 && next[1]
1964 && next[2] == '\'' && next[3] == '\'') {
1965 fprintf(stderr, "\"%c\"", next[1]);
1966 pt += 4;
1967 goto cnt;
1968 }
1969 for (entry = list; entry->from; ++entry) {
1970 if (!strncmp(entry->from, pt, strlen(entry->from))) {
1971 fprintf(stderr, "%s", entry->to);
1972 pt = next;
1973 goto cnt;
1974 }
1975 }
1976 } else if (end-pt >= 5 && pt[0] == '\'' && pt[1] == '\'' && pt[3]
1977 && pt[4] == '\'' && pt[5] == '\'') {
1978 fprintf(stderr, "\"%c\"", pt[3]);
1979 pt += 5;
1980 } else if (end-pt >= 3 && pt[0] == '\'' && pt[1] && pt[2] == '\'') {
1981 fprintf(stderr, "\"%c\"", pt[1]);
1982 pt += 3;
1983 }
1984 bail:
1985 putc(*pt, stderr);
1986 cnt:
1987 ;
1988 }
1989 fprintf(stderr, "\n");
1990 exit( 1 );
1991}
1992
1993static int getdimension(int token, const char *text, int leng)
1994{
1995 char *endptr;
1996 char *tmp = dmxConfigAlloc(leng+1);
1997 int x, y;
1998
1999 strlcpy(tmp, text, leng+1);
2000 x = strtol(tmp, &endptr, 10);
2001 while (*endptr && !isdigit(*endptr)) ++endptr;
2002 y = strtol(endptr, NULL, 10);
2003 dmxConfigFree(tmp);
2004 yylval.pair = dmxConfigCreatePair(token, lineno, NULL, x, y, 1, 1);
2005 return token;
2006}
2007
2008static int getstring(int token, const char *text, int leng)
2009{
2010 yylval.string = dmxConfigCreateString(token, lineno, NULL,
2011 dmxConfigCopyString(leng ? text : "",
2012 leng));
2013 return token;
2014}
2015
2016static int gettoken(int token, const char *text, int leng)
2017{
2018 yylval.token = dmxConfigCreateToken(token, lineno, NULL);
2019 return token;
2020}
2021
2022static int getcomment(int token, const char *text, int leng)
2023{
2024 yylval.comment = dmxConfigCreateComment(token, lineno,
2025 dmxConfigCopyString(text + 1,
2026 leng - 1));
2027 return token;
2028}
2029