xref: /OK3568_Linux_fs/external/xserver/hw/dmx/config/scanner.c (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1 
2 #line 2 "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 6
11 #define YY_FLEX_SUBMINOR_VERSION 4
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>
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;
49 #else
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;
56 
57 /* Limits of integral types. */
58 #ifndef INT8_MIN
59 #define INT8_MIN               (-128)
60 #endif
61 #ifndef INT16_MIN
62 #define INT16_MIN              (-32767-1)
63 #endif
64 #ifndef INT32_MIN
65 #define INT32_MIN              (-2147483647-1)
66 #endif
67 #ifndef INT8_MAX
68 #define INT8_MAX               (127)
69 #endif
70 #ifndef INT16_MAX
71 #define INT16_MAX              (32767)
72 #endif
73 #ifndef INT32_MAX
74 #define INT32_MAX              (2147483647)
75 #endif
76 #ifndef UINT8_MAX
77 #define UINT8_MAX              (255U)
78 #endif
79 #ifndef UINT16_MAX
80 #define UINT16_MAX             (65535U)
81 #endif
82 #ifndef UINT32_MAX
83 #define UINT32_MAX             (4294967295U)
84 #endif
85 
86 #ifndef SIZE_MAX
87 #define SIZE_MAX               (~(size_t)0)
88 #endif
89 
90 #endif /* ! C99 */
91 
92 #endif /* ! FLEXINT_H */
93 
94 /* begin standard C++ headers. */
95 
96 /* TODO: this is always defined, so inline it */
97 #define yyconst const
98 
99 #if defined(__GNUC__) && __GNUC__ >= 3
100 #define yynoreturn __attribute__((__noreturn__))
101 #else
102 #define yynoreturn
103 #endif
104 
105 /* Returned upon end-of-file. */
106 #define YY_NULL 0
107 
108 /* Promotes a possibly negative, possibly signed char to an
109  *   integer in range [0..255] for use as an array index.
110  */
111 #define YY_SC_TO_UI(c) ((YY_CHAR) (c))
112 
113 /* Enter a start condition.  This macro really ought to take a parameter,
114  * but we do it the disgusting crufty way forced on us by the ()-less
115  * definition of BEGIN.
116  */
117 #define BEGIN (yy_start) = 1 + 2 *
118 /* Translate the current start state into a value that can be later handed
119  * to BEGIN to return to the state.  The YYSTATE alias is for lex
120  * compatibility.
121  */
122 #define YY_START (((yy_start) - 1) / 2)
123 #define YYSTATE YY_START
124 /* Action number for EOF rule of a given start state. */
125 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
126 /* Special action meaning "start processing a new file". */
127 #define YY_NEW_FILE yyrestart( yyin  )
128 #define YY_END_OF_BUFFER_CHAR 0
129 
130 /* Size of default input buffer. */
131 #ifndef YY_BUF_SIZE
132 #ifdef __ia64__
133 /* On IA-64, the buffer size is 16k, not 8k.
134  * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
135  * Ditto for the __ia64__ case accordingly.
136  */
137 #define YY_BUF_SIZE 32768
138 #else
139 #define YY_BUF_SIZE 16384
140 #endif /* __ia64__ */
141 #endif
142 
143 /* The state buf must be large enough to hold one state per character in the main buffer.
144  */
145 #define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
146 
147 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
148 #define YY_TYPEDEF_YY_BUFFER_STATE
149 typedef struct yy_buffer_state *YY_BUFFER_STATE;
150 #endif
151 
152 #ifndef YY_TYPEDEF_YY_SIZE_T
153 #define YY_TYPEDEF_YY_SIZE_T
154 typedef size_t yy_size_t;
155 #endif
156 
157 extern int yyleng;
158 
159 extern FILE *yyin, *yyout;
160 
161 #define EOB_ACT_CONTINUE_SCAN 0
162 #define EOB_ACT_END_OF_FILE 1
163 #define EOB_ACT_LAST_MATCH 2
164 
165     #define YY_LESS_LINENO(n)
166     #define YY_LINENO_REWIND_TO(ptr)
167 
168 /* Return all but the first "n" matched characters back to the input stream. */
169 #define yyless(n) \
170 	do \
171 		{ \
172 		/* Undo effects of setting up yytext. */ \
173         int yyless_macro_arg = (n); \
174         YY_LESS_LINENO(yyless_macro_arg);\
175 		*yy_cp = (yy_hold_char); \
176 		YY_RESTORE_YY_MORE_OFFSET \
177 		(yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
178 		YY_DO_BEFORE_ACTION; /* set up yytext again */ \
179 		} \
180 	while ( 0 )
181 #define unput(c) yyunput( c, (yytext_ptr)  )
182 
183 #ifndef YY_STRUCT_YY_BUFFER_STATE
184 #define YY_STRUCT_YY_BUFFER_STATE
185 struct yy_buffer_state
186 	{
187 	FILE *yy_input_file;
188 
189 	char *yy_ch_buf;		/* input buffer */
190 	char *yy_buf_pos;		/* current position in input buffer */
191 
192 	/* Size of input buffer in bytes, not including room for EOB
193 	 * characters.
194 	 */
195 	int yy_buf_size;
196 
197 	/* Number of characters read into yy_ch_buf, not including EOB
198 	 * characters.
199 	 */
200 	int yy_n_chars;
201 
202 	/* Whether we "own" the buffer - i.e., we know we created it,
203 	 * and can realloc() it to grow it, and should free() it to
204 	 * delete it.
205 	 */
206 	int yy_is_our_buffer;
207 
208 	/* Whether this is an "interactive" input source; if so, and
209 	 * if we're using stdio for input, then we want to use getc()
210 	 * instead of fread(), to make sure we stop fetching input after
211 	 * each newline.
212 	 */
213 	int yy_is_interactive;
214 
215 	/* Whether we're considered to be at the beginning of a line.
216 	 * If so, '^' rules will be active on the next match, otherwise
217 	 * not.
218 	 */
219 	int yy_at_bol;
220 
221     int yy_bs_lineno; /**< The line count. */
222     int yy_bs_column; /**< The column count. */
223 
224 	/* Whether to try to fill the input buffer when we reach the
225 	 * end of it.
226 	 */
227 	int yy_fill_buffer;
228 
229 	int yy_buffer_status;
230 
231 #define YY_BUFFER_NEW 0
232 #define YY_BUFFER_NORMAL 1
233 	/* When an EOF's been seen but there's still some text to process
234 	 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
235 	 * shouldn't try reading from the input source any more.  We might
236 	 * still have a bunch of tokens to match, though, because of
237 	 * possible backing-up.
238 	 *
239 	 * When we actually see the EOF, we change the status to "new"
240 	 * (via yyrestart()), so that the user can continue scanning by
241 	 * just pointing yyin at a new input file.
242 	 */
243 #define YY_BUFFER_EOF_PENDING 2
244 
245 	};
246 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
247 
248 /* Stack of input buffers. */
249 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
250 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
251 static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */
252 
253 /* We provide macros for accessing buffer states in case in the
254  * future we want to put the buffer states in a more general
255  * "scanner state".
256  *
257  * Returns the top of the stack, or NULL.
258  */
259 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
260                           ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
261                           : NULL)
262 /* Same as previous macro, but useful when we know that the buffer stack is not
263  * NULL or when we need an lvalue. For internal use only.
264  */
265 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
266 
267 /* yy_hold_char holds the character lost when yytext is formed. */
268 static char yy_hold_char;
269 static int yy_n_chars;		/* number of characters read into yy_ch_buf */
270 int yyleng;
271 
272 /* Points to current character in buffer. */
273 static char *yy_c_buf_p = NULL;
274 static int yy_init = 0;		/* whether we need to initialize */
275 static int yy_start = 0;	/* start state number */
276 
277 /* Flag which is used to allow yywrap()'s to do buffer switches
278  * instead of setting up a fresh yyin.  A bit of a hack ...
279  */
280 static int yy_did_buffer_switch_on_eof;
281 
282 void yyrestart ( FILE *input_file  );
283 void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer  );
284 YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size  );
285 void yy_delete_buffer ( YY_BUFFER_STATE b  );
286 void yy_flush_buffer ( YY_BUFFER_STATE b  );
287 void yypush_buffer_state ( YY_BUFFER_STATE new_buffer  );
288 void yypop_buffer_state ( void );
289 
290 static void yyensure_buffer_stack ( void );
291 static void yy_load_buffer_state ( void );
292 static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file  );
293 #define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER )
294 
295 YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size  );
296 YY_BUFFER_STATE yy_scan_string ( const char *yy_str  );
297 YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len  );
298 
299 void *yyalloc ( yy_size_t  );
300 void *yyrealloc ( void *, yy_size_t  );
301 void yyfree ( void *  );
302 
303 #define yy_new_buffer yy_create_buffer
304 #define yy_set_interactive(is_interactive) \
305 	{ \
306 	if ( ! YY_CURRENT_BUFFER ){ \
307         yyensure_buffer_stack (); \
308 		YY_CURRENT_BUFFER_LVALUE =    \
309             yy_create_buffer( yyin, YY_BUF_SIZE ); \
310 	} \
311 	YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
312 	}
313 #define yy_set_bol(at_bol) \
314 	{ \
315 	if ( ! YY_CURRENT_BUFFER ){\
316         yyensure_buffer_stack (); \
317 		YY_CURRENT_BUFFER_LVALUE =    \
318             yy_create_buffer( yyin, YY_BUF_SIZE ); \
319 	} \
320 	YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
321 	}
322 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
323 
324 /* Begin user sect3 */
325 typedef flex_uint8_t YY_CHAR;
326 
327 FILE *yyin = NULL, *yyout = NULL;
328 
329 typedef int yy_state_type;
330 
331 extern int yylineno;
332 int yylineno = 1;
333 
334 extern char *yytext;
335 #ifdef yytext_ptr
336 #undef yytext_ptr
337 #endif
338 #define yytext_ptr yytext
339 
340 static yy_state_type yy_get_previous_state ( void );
341 static yy_state_type yy_try_NUL_trans ( yy_state_type current_state  );
342 static int yy_get_next_buffer ( void );
343 static void yynoreturn yy_fatal_error ( const char* msg  );
344 
345 /* Done after the current pattern has been matched and before the
346  * corresponding action - sets up yytext.
347  */
348 #define YY_DO_BEFORE_ACTION \
349 	(yytext_ptr) = yy_bp; \
350 	yyleng = (int) (yy_cp - yy_bp); \
351 	(yy_hold_char) = *yy_cp; \
352 	*yy_cp = '\0'; \
353 	(yy_c_buf_p) = yy_cp;
354 #define YY_NUM_RULES 20
355 #define YY_END_OF_BUFFER 21
356 /* This struct is not used in this scanner,
357    but its presence is necessary. */
358 struct yy_trans_info
359 	{
360 	flex_int32_t yy_verify;
361 	flex_int32_t yy_nxt;
362 	};
363 static const flex_int16_t yy_accept[73] =
364     {   0,
365         0,    0,    0,    0,   21,   19,   12,   11,   19,   18,
366        19,   19,   16,   19,   15,   19,   19,   19,   19,   19,
367        19,   13,   14,   17,   12,    0,   10,   18,    9,    9,
368         0,    0,    0,    0,    0,    9,    9,    9,    9,    9,
369        17,    0,    9,    0,    6,    0,    0,    9,    9,    9,
370         9,    9,    0,    0,    7,    8,    9,    9,    9,    9,
371         3,    7,    9,    9,    5,    9,    9,    4,    9,    2,
372         1,    0
373     } ;
374 
375 static const YY_CHAR yy_ec[256] =
376     {   0,
377         1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
378         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
379         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
380         1,    2,    1,    4,    5,    1,    1,    1,    1,    1,
381         1,    6,    7,    1,    7,    6,    8,    9,    9,    9,
382         9,    9,    9,    9,    9,    9,    9,    6,   10,    1,
383         1,    1,    1,   11,    6,    6,    6,    6,    6,    6,
384         6,    6,    6,    6,    6,    6,    6,    6,    6,    6,
385         6,    6,    6,    6,    6,    6,    6,    6,    6,    6,
386         1,    1,    1,    1,    6,    1,   12,    6,    6,   13,
387 
388         6,    6,    6,    6,   14,    6,    6,   15,   16,   17,
389        18,   19,    6,   20,   21,   22,   23,   24,   25,   26,
390        27,    6,   28,    1,   29,    1,    1,    1,    1,    1,
391         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
392         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
393         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
394         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
395         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
396         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
397         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
398 
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
405     } ;
406 
407 static const YY_CHAR yy_meta[30] =
408     {   0,
409         1,    1,    2,    1,    1,    3,    3,    3,    3,    1,
410         1,    3,    3,    3,    3,    3,    3,    3,    3,    3,
411         3,    3,    3,    3,    3,    3,    3,    1,    1
412     } ;
413 
414 static const flex_int16_t yy_base[77] =
415     {   0,
416         0,  101,    0,  100,  104,  107,  101,  107,   98,    0,
417         0,   92,    0,   28,  107,   29,   86,   80,   86,   83,
418        84,  107,  107,    0,   93,   90,   89,    0,    0,   32,
419        30,   31,   33,   34,   42,   71,   69,   70,   69,   73,
420         0,   43,   44,   46,   78,   45,   77,   66,   70,   71,
421        60,   66,   50,   56,   70,   67,   58,   52,   53,   44,
422         0,   57,   52,   46,    0,   50,   34,    0,   45,    0,
423         0,  107,   71,   74,   46,   77
424     } ;
425 
426 static const flex_int16_t yy_def[77] =
427     {   0,
428        72,    1,    1,    1,   72,   72,   72,   72,   73,   74,
429        75,   75,   75,   72,   72,   72,   75,   75,   75,   75,
430        75,   72,   72,   76,   72,   73,   72,   74,   75,   75,
431        72,   72,   72,   72,   72,   75,   75,   75,   75,   75,
432        76,   72,   75,   72,   72,   72,   72,   75,   75,   75,
433        75,   75,   72,   72,   75,   72,   75,   75,   75,   75,
434        75,   72,   75,   75,   75,   75,   75,   75,   75,   75,
435        75,    0,   72,   72,   72,   72
436     } ;
437 
438 static const flex_int16_t yy_nxt[137] =
439     {   0,
440         6,    7,    8,    9,   10,   11,   12,   13,   14,   15,
441        16,   11,   17,   11,   11,   11,   11,   18,   19,   11,
442        11,   11,   11,   20,   21,   11,   11,   22,   23,   31,
443        34,   31,   31,   42,   44,   34,   32,   35,   43,   32,
444        30,   45,   35,   46,   42,   54,   46,   44,   29,   53,
445        35,   54,   55,   33,   45,   33,   33,   54,   62,   71,
446        70,   69,   68,   67,   62,   62,   66,   47,   65,   64,
447        47,   26,   63,   26,   28,   56,   28,   41,   55,   41,
448        61,   60,   59,   58,   57,   56,   45,   52,   51,   50,
449        49,   48,   26,   27,   25,   40,   39,   38,   37,   36,
450 
451        30,   27,   25,   72,   24,   24,    5,   72,   72,   72,
452        72,   72,   72,   72,   72,   72,   72,   72,   72,   72,
453        72,   72,   72,   72,   72,   72,   72,   72,   72,   72,
454        72,   72,   72,   72,   72,   72
455     } ;
456 
457 static const flex_int16_t yy_chk[137] =
458     {   0,
459         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
460         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
461         1,    1,    1,    1,    1,    1,    1,    1,    1,   14,
462        16,   31,   32,   30,   33,   34,   14,   16,   30,   32,
463        30,   33,   34,   35,   42,   43,   46,   44,   75,   42,
464        35,   53,   43,   14,   44,   31,   32,   54,   53,   69,
465        67,   66,   64,   63,   54,   62,   60,   35,   59,   58,
466        46,   73,   57,   73,   74,   56,   74,   76,   55,   76,
467        52,   51,   50,   49,   48,   47,   45,   40,   39,   38,
468        37,   36,   27,   26,   25,   21,   20,   19,   18,   17,
469 
470        12,    9,    7,    5,    4,    2,   72,   72,   72,   72,
471        72,   72,   72,   72,   72,   72,   72,   72,   72,   72,
472        72,   72,   72,   72,   72,   72,   72,   72,   72,   72,
473        72,   72,   72,   72,   72,   72
474     } ;
475 
476 static yy_state_type yy_last_accepting_state;
477 static char *yy_last_accepting_cpos;
478 
479 extern int yy_flex_debug;
480 int yy_flex_debug = 0;
481 
482 /* The intent behind this definition is that it'll catch
483  * any uses of REJECT which flex missed.
484  */
485 #define REJECT reject_used_but_not_detected
486 #define yymore() yymore_used_but_not_detected
487 #define YY_MORE_ADJ 0
488 #define YY_RESTORE_YY_MORE_OFFSET
489 char *yytext;
490 #line 1 "scanner.l"
491 /* $XFree86$ */
492 /*
493  * Copyright 2002 Red Hat Inc., Durham, North Carolina.
494  *
495  * All Rights Reserved.
496  *
497  * Permission is hereby granted, free of charge, to any person obtaining
498  * a copy of this software and associated documentation files (the
499  * "Software"), to deal in the Software without restriction, including
500  * without limitation on the rights to use, copy, modify, merge,
501  * publish, distribute, sublicense, and/or sell copies of the Software,
502  * and to permit persons to whom the Software is furnished to do so,
503  * subject to the following conditions:
504  *
505  * The above copyright notice and this permission notice (including the
506  * next paragraph) shall be included in all copies or substantial
507  * portions of the Software.
508  *
509  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
510  * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
511  * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
512  * NON-INFRINGEMENT.  IN NO EVENT SHALL RED HAT AND/OR THEIR SUPPLIERS
513  * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
514  * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
515  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
516  * SOFTWARE.
517  */
518 /*
519  * Authors:
520  *   Rickard E. (Rik) Faith <faith@redhat.com>
521  *
522  */
523 #line 36 "scanner.l"
524 #ifdef HAVE_DMX_CONFIG_H
525 #include <dmx-config.h>
526 #endif
527 
528 #include "dmxparse.h"
529 #include "parser.h"
530 #include "os.h"
531 #include <string.h>
532 #include <stdlib.h>
533 #include <ctype.h>
534 static int getdimension(int token, const char *text, int leng);
535 static int getstring(int token, const char *text, int leng);
536 static int gettoken(int token, const char *text, int leng);
537 static int getcomment(int token, const char *text, int leng);
538 static int lineno = 1;
539 #line 539 "scanner.c"
540 
541 #line 541 "scanner.c"
542 
543 #define INITIAL 0
544 #define OTHER 1
545 
546 #ifndef YY_NO_UNISTD_H
547 /* Special case for "unistd.h", since it is non-ANSI. We include it way
548  * down here because we want the user's section 1 to have been scanned first.
549  * The user has a chance to override it with an option.
550  */
551 #include <unistd.h>
552 #endif
553 
554 #ifndef YY_EXTRA_TYPE
555 #define YY_EXTRA_TYPE void *
556 #endif
557 
558 static int yy_init_globals ( void );
559 
560 /* Accessor methods to globals.
561    These are made visible to non-reentrant scanners for convenience. */
562 
563 int yylex_destroy ( void );
564 
565 int yyget_debug ( void );
566 
567 void yyset_debug ( int debug_flag  );
568 
569 YY_EXTRA_TYPE yyget_extra ( void );
570 
571 void yyset_extra ( YY_EXTRA_TYPE user_defined  );
572 
573 FILE *yyget_in ( void );
574 
575 void yyset_in  ( FILE * _in_str  );
576 
577 FILE *yyget_out ( void );
578 
579 void yyset_out  ( FILE * _out_str  );
580 
581 			int yyget_leng ( void );
582 
583 char *yyget_text ( void );
584 
585 int yyget_lineno ( void );
586 
587 void yyset_lineno ( int _line_number  );
588 
589 /* Macros after this point can all be overridden by user definitions in
590  * section 1.
591  */
592 
593 #ifndef YY_SKIP_YYWRAP
594 #ifdef __cplusplus
595 extern "C" int yywrap ( void );
596 #else
597 extern int yywrap ( void );
598 #endif
599 #endif
600 
601 #ifndef YY_NO_UNPUT
602 
603     static void yyunput ( int c, char *buf_ptr  );
604 
605 #endif
606 
607 #ifndef yytext_ptr
608 static void yy_flex_strncpy ( char *, const char *, int );
609 #endif
610 
611 #ifdef YY_NEED_STRLEN
612 static int yy_flex_strlen ( const char * );
613 #endif
614 
615 #ifndef YY_NO_INPUT
616 #ifdef __cplusplus
617 static int yyinput ( void );
618 #else
619 static int input ( void );
620 #endif
621 
622 #endif
623 
624 /* Amount of stuff to slurp up with each read. */
625 #ifndef YY_READ_BUF_SIZE
626 #ifdef __ia64__
627 /* On IA-64, the buffer size is 16k, not 8k */
628 #define YY_READ_BUF_SIZE 16384
629 #else
630 #define YY_READ_BUF_SIZE 8192
631 #endif /* __ia64__ */
632 #endif
633 
634 /* Copy whatever the last rule matched to the standard output. */
635 #ifndef ECHO
636 /* This used to be an fputs(), but since the string might contain NUL's,
637  * we now use fwrite().
638  */
639 #define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
640 #endif
641 
642 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
643  * is returned in "result".
644  */
645 #ifndef YY_INPUT
646 #define YY_INPUT(buf,result,max_size) \
647 	if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
648 		{ \
649 		int c = '*'; \
650 		int n; \
651 		for ( n = 0; n < max_size && \
652 			     (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
653 			buf[n] = (char) c; \
654 		if ( c == '\n' ) \
655 			buf[n++] = (char) c; \
656 		if ( c == EOF && ferror( yyin ) ) \
657 			YY_FATAL_ERROR( "input in flex scanner failed" ); \
658 		result = n; \
659 		} \
660 	else \
661 		{ \
662 		errno=0; \
663 		while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \
664 			{ \
665 			if( errno != EINTR) \
666 				{ \
667 				YY_FATAL_ERROR( "input in flex scanner failed" ); \
668 				break; \
669 				} \
670 			errno=0; \
671 			clearerr(yyin); \
672 			} \
673 		}\
674 \
675 
676 #endif
677 
678 /* No semi-colon after return; correct usage is to write "yyterminate();" -
679  * we don't want an extra ';' after the "return" because that will cause
680  * some compilers to complain about unreachable statements.
681  */
682 #ifndef yyterminate
683 #define yyterminate() return YY_NULL
684 #endif
685 
686 /* Number of entries by which start-condition stack grows. */
687 #ifndef YY_START_STACK_INCR
688 #define YY_START_STACK_INCR 25
689 #endif
690 
691 /* Report a fatal error. */
692 #ifndef YY_FATAL_ERROR
693 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
694 #endif
695 
696 /* end tables serialization structures and prototypes */
697 
698 /* Default declaration of generated scanner - a define so the user can
699  * easily add parameters.
700  */
701 #ifndef YY_DECL
702 #define YY_DECL_IS_OURS 1
703 
704 extern int yylex (void);
705 
706 #define YY_DECL int yylex (void)
707 #endif /* !YY_DECL */
708 
709 /* Code executed at the beginning of each rule, after yytext and yyleng
710  * have been set up.
711  */
712 #ifndef YY_USER_ACTION
713 #define YY_USER_ACTION
714 #endif
715 
716 /* Code executed at the end of each rule. */
717 #ifndef YY_BREAK
718 #define YY_BREAK /*LINTED*/break;
719 #endif
720 
721 #define YY_RULE_SETUP \
722 	if ( yyleng > 0 ) \
723 		YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
724 				(yytext[yyleng - 1] == '\n'); \
725 	YY_USER_ACTION
726 
727 /** The main scanner function which does all the work.
728  */
729 YY_DECL
730 {
731 	yy_state_type yy_current_state;
732 	char *yy_cp, *yy_bp;
733 	int yy_act;
734 
735 	if ( !(yy_init) )
736 		{
737 		(yy_init) = 1;
738 
739 #ifdef YY_USER_INIT
740 		YY_USER_INIT;
741 #endif
742 
743 		if ( ! (yy_start) )
744 			(yy_start) = 1;	/* first start state */
745 
746 		if ( ! yyin )
747 			yyin = stdin;
748 
749 		if ( ! yyout )
750 			yyout = stdout;
751 
752 		if ( ! YY_CURRENT_BUFFER ) {
753 			yyensure_buffer_stack ();
754 			YY_CURRENT_BUFFER_LVALUE =
755 				yy_create_buffer( yyin, YY_BUF_SIZE );
756 		}
757 
758 		yy_load_buffer_state(  );
759 		}
760 
761 	{
762 #line 63 "scanner.l"
763 
764 #line 764 "scanner.c"
765 
766 	while ( /*CONSTCOND*/1 )		/* loops until end-of-file is reached */
767 		{
768 		yy_cp = (yy_c_buf_p);
769 
770 		/* Support of yytext. */
771 		*yy_cp = (yy_hold_char);
772 
773 		/* yy_bp points to the position in yy_ch_buf of the start of
774 		 * the current run.
775 		 */
776 		yy_bp = yy_cp;
777 
778 		yy_current_state = (yy_start);
779 		yy_current_state += YY_AT_BOL();
780 yy_match:
781 		do
782 			{
783 			YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
784 			if ( yy_accept[yy_current_state] )
785 				{
786 				(yy_last_accepting_state) = yy_current_state;
787 				(yy_last_accepting_cpos) = yy_cp;
788 				}
789 			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
790 				{
791 				yy_current_state = (int) yy_def[yy_current_state];
792 				if ( yy_current_state >= 73 )
793 					yy_c = yy_meta[yy_c];
794 				}
795 			yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
796 			++yy_cp;
797 			}
798 		while ( yy_base[yy_current_state] != 107 );
799 
800 yy_find_action:
801 		yy_act = yy_accept[yy_current_state];
802 		if ( yy_act == 0 )
803 			{ /* have to back up */
804 			yy_cp = (yy_last_accepting_cpos);
805 			yy_current_state = (yy_last_accepting_state);
806 			yy_act = yy_accept[yy_current_state];
807 			}
808 
809 		YY_DO_BEFORE_ACTION;
810 
811 do_action:	/* This label is used only to access EOF actions. */
812 
813 		switch ( yy_act )
814 	{ /* beginning of action switch */
815 			case 0: /* must back up */
816 			/* undo the effects of YY_DO_BEFORE_ACTION */
817 			*yy_cp = (yy_hold_char);
818 			yy_cp = (yy_last_accepting_cpos);
819 			yy_current_state = (yy_last_accepting_state);
820 			goto yy_find_action;
821 
822 case 1:
823 YY_RULE_SETUP
824 #line 64 "scanner.l"
825 return gettoken(T_VIRTUAL, yytext, yyleng);
826 	YY_BREAK
827 case 2:
828 YY_RULE_SETUP
829 #line 65 "scanner.l"
830 return gettoken(T_DISPLAY, yytext, yyleng);
831 	YY_BREAK
832 case 3:
833 YY_RULE_SETUP
834 #line 66 "scanner.l"
835 return gettoken(T_WALL, yytext, yyleng);
836 	YY_BREAK
837 case 4:
838 YY_RULE_SETUP
839 #line 67 "scanner.l"
840 return gettoken(T_OPTION, yytext, yyleng);
841 	YY_BREAK
842 case 5:
843 YY_RULE_SETUP
844 #line 68 "scanner.l"
845 return gettoken(T_PARAM, yytext, yyleng);
846 	YY_BREAK
847 case 6:
848 YY_RULE_SETUP
849 #line 69 "scanner.l"
850 return getdimension(T_DIMENSION, yytext, yyleng);
851 	YY_BREAK
852 case 7:
853 YY_RULE_SETUP
854 #line 70 "scanner.l"
855 return getdimension(T_OFFSET, yytext+1, yyleng-1);
856 	YY_BREAK
857 case 8:
858 YY_RULE_SETUP
859 #line 71 "scanner.l"
860 return getdimension(T_ORIGIN, yytext+1, yyleng-1);
861 	YY_BREAK
862 case 9:
863 YY_RULE_SETUP
864 #line 72 "scanner.l"
865 return getstring(T_STRING, yytext, yyleng);
866 	YY_BREAK
867 case 10:
868 YY_RULE_SETUP
869 #line 73 "scanner.l"
870 return getstring(T_STRING, yytext+1, yyleng-2);
871 	YY_BREAK
872 case 11:
873 /* rule 11 can match eol */
874 YY_RULE_SETUP
875 #line 74 "scanner.l"
876 ++lineno;
877 	YY_BREAK
878 case 12:
879 YY_RULE_SETUP
880 #line 75 "scanner.l"
881 
882 	YY_BREAK
883 case 13:
884 YY_RULE_SETUP
885 #line 76 "scanner.l"
886 return gettoken(yytext[0], yytext, yyleng);
887 	YY_BREAK
888 case 14:
889 YY_RULE_SETUP
890 #line 77 "scanner.l"
891 return gettoken(yytext[0], yytext, yyleng);
892 	YY_BREAK
893 case 15:
894 YY_RULE_SETUP
895 #line 78 "scanner.l"
896 return gettoken(yytext[0], yytext, yyleng);
897 	YY_BREAK
898 case 16:
899 YY_RULE_SETUP
900 #line 79 "scanner.l"
901 return gettoken(yytext[0], yytext, yyleng);
902 	YY_BREAK
903 case 17:
904 YY_RULE_SETUP
905 #line 80 "scanner.l"
906 return getcomment(T_LINE_COMMENT, yytext, yyleng);
907 	YY_BREAK
908 case 18:
909 YY_RULE_SETUP
910 #line 81 "scanner.l"
911 return getcomment(T_COMMENT, yytext, yyleng);
912 	YY_BREAK
913 case 19:
914 YY_RULE_SETUP
915 #line 82 "scanner.l"
916 return getstring(T_STRING, yytext, yyleng);
917 	YY_BREAK
918 case YY_STATE_EOF(INITIAL):
919 case YY_STATE_EOF(OTHER):
920 #line 83 "scanner.l"
921 return 0;
922 	YY_BREAK
923 case 20:
924 YY_RULE_SETUP
925 #line 84 "scanner.l"
926 ECHO;
927 	YY_BREAK
928 #line 928 "scanner.c"
929 
930 	case YY_END_OF_BUFFER:
931 		{
932 		/* Amount of text matched not including the EOB char. */
933 		int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
934 
935 		/* Undo the effects of YY_DO_BEFORE_ACTION. */
936 		*yy_cp = (yy_hold_char);
937 		YY_RESTORE_YY_MORE_OFFSET
938 
939 		if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
940 			{
941 			/* We're scanning a new file or input source.  It's
942 			 * possible that this happened because the user
943 			 * just pointed yyin at a new source and called
944 			 * yylex().  If so, then we have to assure
945 			 * consistency between YY_CURRENT_BUFFER and our
946 			 * globals.  Here is the right place to do so, because
947 			 * this is the first action (other than possibly a
948 			 * back-up) that will match for the new input source.
949 			 */
950 			(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
951 			YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
952 			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
953 			}
954 
955 		/* Note that here we test for yy_c_buf_p "<=" to the position
956 		 * of the first EOB in the buffer, since yy_c_buf_p will
957 		 * already have been incremented past the NUL character
958 		 * (since all states make transitions on EOB to the
959 		 * end-of-buffer state).  Contrast this with the test
960 		 * in input().
961 		 */
962 		if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
963 			{ /* This was really a NUL. */
964 			yy_state_type yy_next_state;
965 
966 			(yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
967 
968 			yy_current_state = yy_get_previous_state(  );
969 
970 			/* Okay, we're now positioned to make the NUL
971 			 * transition.  We couldn't have
972 			 * yy_get_previous_state() go ahead and do it
973 			 * for us because it doesn't know how to deal
974 			 * with the possibility of jamming (and we don't
975 			 * want to build jamming into it because then it
976 			 * will run more slowly).
977 			 */
978 
979 			yy_next_state = yy_try_NUL_trans( yy_current_state );
980 
981 			yy_bp = (yytext_ptr) + YY_MORE_ADJ;
982 
983 			if ( yy_next_state )
984 				{
985 				/* Consume the NUL. */
986 				yy_cp = ++(yy_c_buf_p);
987 				yy_current_state = yy_next_state;
988 				goto yy_match;
989 				}
990 
991 			else
992 				{
993 				yy_cp = (yy_c_buf_p);
994 				goto yy_find_action;
995 				}
996 			}
997 
998 		else switch ( yy_get_next_buffer(  ) )
999 			{
1000 			case EOB_ACT_END_OF_FILE:
1001 				{
1002 				(yy_did_buffer_switch_on_eof) = 0;
1003 
1004 				if ( yywrap(  ) )
1005 					{
1006 					/* Note: because we've taken care in
1007 					 * yy_get_next_buffer() to have set up
1008 					 * yytext, we can now set up
1009 					 * yy_c_buf_p so that if some total
1010 					 * hoser (like flex itself) wants to
1011 					 * call the scanner after we return the
1012 					 * YY_NULL, it'll still work - another
1013 					 * YY_NULL will get returned.
1014 					 */
1015 					(yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1016 
1017 					yy_act = YY_STATE_EOF(YY_START);
1018 					goto do_action;
1019 					}
1020 
1021 				else
1022 					{
1023 					if ( ! (yy_did_buffer_switch_on_eof) )
1024 						YY_NEW_FILE;
1025 					}
1026 				break;
1027 				}
1028 
1029 			case EOB_ACT_CONTINUE_SCAN:
1030 				(yy_c_buf_p) =
1031 					(yytext_ptr) + yy_amount_of_matched_text;
1032 
1033 				yy_current_state = yy_get_previous_state(  );
1034 
1035 				yy_cp = (yy_c_buf_p);
1036 				yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1037 				goto yy_match;
1038 
1039 			case EOB_ACT_LAST_MATCH:
1040 				(yy_c_buf_p) =
1041 				&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1042 
1043 				yy_current_state = yy_get_previous_state(  );
1044 
1045 				yy_cp = (yy_c_buf_p);
1046 				yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1047 				goto yy_find_action;
1048 			}
1049 		break;
1050 		}
1051 
1052 	default:
1053 		YY_FATAL_ERROR(
1054 			"fatal flex scanner internal error--no action found" );
1055 	} /* end of action switch */
1056 		} /* end of scanning one token */
1057 	} /* end of user's declarations */
1058 } /* end of yylex */
1059 
1060 /* yy_get_next_buffer - try to read in a new buffer
1061  *
1062  * Returns a code representing an action:
1063  *	EOB_ACT_LAST_MATCH -
1064  *	EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1065  *	EOB_ACT_END_OF_FILE - end of file
1066  */
yy_get_next_buffer(void)1067 static int yy_get_next_buffer (void)
1068 {
1069     	char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1070 	char *source = (yytext_ptr);
1071 	int number_to_move, i;
1072 	int ret_val;
1073 
1074 	if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1075 		YY_FATAL_ERROR(
1076 		"fatal flex scanner internal error--end of buffer missed" );
1077 
1078 	if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1079 		{ /* Don't try to fill the buffer, so this is an EOF. */
1080 		if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1081 			{
1082 			/* We matched a single character, the EOB, so
1083 			 * treat this as a final EOF.
1084 			 */
1085 			return EOB_ACT_END_OF_FILE;
1086 			}
1087 
1088 		else
1089 			{
1090 			/* We matched some text prior to the EOB, first
1091 			 * process it.
1092 			 */
1093 			return EOB_ACT_LAST_MATCH;
1094 			}
1095 		}
1096 
1097 	/* Try to read more data. */
1098 
1099 	/* First move last chars to start of buffer. */
1100 	number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1);
1101 
1102 	for ( i = 0; i < number_to_move; ++i )
1103 		*(dest++) = *(source++);
1104 
1105 	if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1106 		/* don't do the read, it's not guaranteed to return an EOF,
1107 		 * just force an EOF
1108 		 */
1109 		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1110 
1111 	else
1112 		{
1113 			int num_to_read =
1114 			YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1115 
1116 		while ( num_to_read <= 0 )
1117 			{ /* Not enough room in the buffer - grow it. */
1118 
1119 			/* just a shorter name for the current buffer */
1120 			YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
1121 
1122 			int yy_c_buf_p_offset =
1123 				(int) ((yy_c_buf_p) - b->yy_ch_buf);
1124 
1125 			if ( b->yy_is_our_buffer )
1126 				{
1127 				int new_size = b->yy_buf_size * 2;
1128 
1129 				if ( new_size <= 0 )
1130 					b->yy_buf_size += b->yy_buf_size / 8;
1131 				else
1132 					b->yy_buf_size *= 2;
1133 
1134 				b->yy_ch_buf = (char *)
1135 					/* Include room in for 2 EOB chars. */
1136 					yyrealloc( (void *) b->yy_ch_buf,
1137 							 (yy_size_t) (b->yy_buf_size + 2)  );
1138 				}
1139 			else
1140 				/* Can't grow it, we don't own it. */
1141 				b->yy_ch_buf = NULL;
1142 
1143 			if ( ! b->yy_ch_buf )
1144 				YY_FATAL_ERROR(
1145 				"fatal error - scanner input buffer overflow" );
1146 
1147 			(yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1148 
1149 			num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1150 						number_to_move - 1;
1151 
1152 			}
1153 
1154 		if ( num_to_read > YY_READ_BUF_SIZE )
1155 			num_to_read = YY_READ_BUF_SIZE;
1156 
1157 		/* Read in more data. */
1158 		YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1159 			(yy_n_chars), num_to_read );
1160 
1161 		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1162 		}
1163 
1164 	if ( (yy_n_chars) == 0 )
1165 		{
1166 		if ( number_to_move == YY_MORE_ADJ )
1167 			{
1168 			ret_val = EOB_ACT_END_OF_FILE;
1169 			yyrestart( yyin  );
1170 			}
1171 
1172 		else
1173 			{
1174 			ret_val = EOB_ACT_LAST_MATCH;
1175 			YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1176 				YY_BUFFER_EOF_PENDING;
1177 			}
1178 		}
1179 
1180 	else
1181 		ret_val = EOB_ACT_CONTINUE_SCAN;
1182 
1183 	if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1184 		/* Extend the array by 50%, plus the number we really need. */
1185 		int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1186 		YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
1187 			(void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size  );
1188 		if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1189 			YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1190 		/* "- 2" to take care of EOB's */
1191 		YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
1192 	}
1193 
1194 	(yy_n_chars) += number_to_move;
1195 	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1196 	YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1197 
1198 	(yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1199 
1200 	return ret_val;
1201 }
1202 
1203 /* yy_get_previous_state - get the state just before the EOB char was reached */
1204 
yy_get_previous_state(void)1205     static yy_state_type yy_get_previous_state (void)
1206 {
1207 	yy_state_type yy_current_state;
1208 	char *yy_cp;
1209 
1210 	yy_current_state = (yy_start);
1211 	yy_current_state += YY_AT_BOL();
1212 
1213 	for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1214 		{
1215 		YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1216 		if ( yy_accept[yy_current_state] )
1217 			{
1218 			(yy_last_accepting_state) = yy_current_state;
1219 			(yy_last_accepting_cpos) = yy_cp;
1220 			}
1221 		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1222 			{
1223 			yy_current_state = (int) yy_def[yy_current_state];
1224 			if ( yy_current_state >= 73 )
1225 				yy_c = yy_meta[yy_c];
1226 			}
1227 		yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
1228 		}
1229 
1230 	return yy_current_state;
1231 }
1232 
1233 /* yy_try_NUL_trans - try to make a transition on the NUL character
1234  *
1235  * synopsis
1236  *	next_state = yy_try_NUL_trans( current_state );
1237  */
yy_try_NUL_trans(yy_state_type yy_current_state)1238     static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
1239 {
1240 	int yy_is_jam;
1241     	char *yy_cp = (yy_c_buf_p);
1242 
1243 	YY_CHAR yy_c = 1;
1244 	if ( yy_accept[yy_current_state] )
1245 		{
1246 		(yy_last_accepting_state) = yy_current_state;
1247 		(yy_last_accepting_cpos) = yy_cp;
1248 		}
1249 	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1250 		{
1251 		yy_current_state = (int) yy_def[yy_current_state];
1252 		if ( yy_current_state >= 73 )
1253 			yy_c = yy_meta[yy_c];
1254 		}
1255 	yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
1256 	yy_is_jam = (yy_current_state == 72);
1257 
1258 		return yy_is_jam ? 0 : yy_current_state;
1259 }
1260 
1261 #ifndef YY_NO_UNPUT
1262 
yyunput(int c,char * yy_bp)1263     static void yyunput (int c, char * yy_bp )
1264 {
1265 	char *yy_cp;
1266 
1267     yy_cp = (yy_c_buf_p);
1268 
1269 	/* undo effects of setting up yytext */
1270 	*yy_cp = (yy_hold_char);
1271 
1272 	if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1273 		{ /* need to shift things up to make room */
1274 		/* +2 for EOB chars. */
1275 		int number_to_move = (yy_n_chars) + 2;
1276 		char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
1277 					YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
1278 		char *source =
1279 				&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
1280 
1281 		while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1282 			*--dest = *--source;
1283 
1284 		yy_cp += (int) (dest - source);
1285 		yy_bp += (int) (dest - source);
1286 		YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
1287 			(yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
1288 
1289 		if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
1290 			YY_FATAL_ERROR( "flex scanner push-back overflow" );
1291 		}
1292 
1293 	*--yy_cp = (char) c;
1294 
1295 	(yytext_ptr) = yy_bp;
1296 	(yy_hold_char) = *yy_cp;
1297 	(yy_c_buf_p) = yy_cp;
1298 }
1299 
1300 #endif
1301 
1302 #ifndef YY_NO_INPUT
1303 #ifdef __cplusplus
yyinput(void)1304     static int yyinput (void)
1305 #else
1306     static int input  (void)
1307 #endif
1308 
1309 {
1310 	int c;
1311 
1312 	*(yy_c_buf_p) = (yy_hold_char);
1313 
1314 	if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1315 		{
1316 		/* yy_c_buf_p now points to the character we want to return.
1317 		 * If this occurs *before* the EOB characters, then it's a
1318 		 * valid NUL; if not, then we've hit the end of the buffer.
1319 		 */
1320 		if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1321 			/* This was really a NUL. */
1322 			*(yy_c_buf_p) = '\0';
1323 
1324 		else
1325 			{ /* need more input */
1326 			int offset = (int) ((yy_c_buf_p) - (yytext_ptr));
1327 			++(yy_c_buf_p);
1328 
1329 			switch ( yy_get_next_buffer(  ) )
1330 				{
1331 				case EOB_ACT_LAST_MATCH:
1332 					/* This happens because yy_g_n_b()
1333 					 * sees that we've accumulated a
1334 					 * token and flags that we need to
1335 					 * try matching the token before
1336 					 * proceeding.  But for input(),
1337 					 * there's no matching to consider.
1338 					 * So convert the EOB_ACT_LAST_MATCH
1339 					 * to EOB_ACT_END_OF_FILE.
1340 					 */
1341 
1342 					/* Reset buffer status. */
1343 					yyrestart( yyin );
1344 
1345 					/*FALLTHROUGH*/
1346 
1347 				case EOB_ACT_END_OF_FILE:
1348 					{
1349 					if ( yywrap(  ) )
1350 						return 0;
1351 
1352 					if ( ! (yy_did_buffer_switch_on_eof) )
1353 						YY_NEW_FILE;
1354 #ifdef __cplusplus
1355 					return yyinput();
1356 #else
1357 					return input();
1358 #endif
1359 					}
1360 
1361 				case EOB_ACT_CONTINUE_SCAN:
1362 					(yy_c_buf_p) = (yytext_ptr) + offset;
1363 					break;
1364 				}
1365 			}
1366 		}
1367 
1368 	c = *(unsigned char *) (yy_c_buf_p);	/* cast for 8-bit char's */
1369 	*(yy_c_buf_p) = '\0';	/* preserve yytext */
1370 	(yy_hold_char) = *++(yy_c_buf_p);
1371 
1372 	YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
1373 
1374 	return c;
1375 }
1376 #endif	/* ifndef YY_NO_INPUT */
1377 
1378 /** Immediately switch to a different input stream.
1379  * @param input_file A readable stream.
1380  *
1381  * @note This function does not reset the start condition to @c INITIAL .
1382  */
yyrestart(FILE * input_file)1383     void yyrestart  (FILE * input_file )
1384 {
1385 
1386 	if ( ! YY_CURRENT_BUFFER ){
1387         yyensure_buffer_stack ();
1388 		YY_CURRENT_BUFFER_LVALUE =
1389             yy_create_buffer( yyin, YY_BUF_SIZE );
1390 	}
1391 
1392 	yy_init_buffer( YY_CURRENT_BUFFER, input_file );
1393 	yy_load_buffer_state(  );
1394 }
1395 
1396 /** Switch to a different input buffer.
1397  * @param new_buffer The new input buffer.
1398  *
1399  */
yy_switch_to_buffer(YY_BUFFER_STATE new_buffer)1400     void yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer )
1401 {
1402 
1403 	/* TODO. We should be able to replace this entire function body
1404 	 * with
1405 	 *		yypop_buffer_state();
1406 	 *		yypush_buffer_state(new_buffer);
1407      */
1408 	yyensure_buffer_stack ();
1409 	if ( YY_CURRENT_BUFFER == new_buffer )
1410 		return;
1411 
1412 	if ( YY_CURRENT_BUFFER )
1413 		{
1414 		/* Flush out information for old buffer. */
1415 		*(yy_c_buf_p) = (yy_hold_char);
1416 		YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1417 		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1418 		}
1419 
1420 	YY_CURRENT_BUFFER_LVALUE = new_buffer;
1421 	yy_load_buffer_state(  );
1422 
1423 	/* We don't actually know whether we did this switch during
1424 	 * EOF (yywrap()) processing, but the only time this flag
1425 	 * is looked at is after yywrap() is called, so it's safe
1426 	 * to go ahead and always set it.
1427 	 */
1428 	(yy_did_buffer_switch_on_eof) = 1;
1429 }
1430 
yy_load_buffer_state(void)1431 static void yy_load_buffer_state  (void)
1432 {
1433     	(yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1434 	(yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1435 	yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1436 	(yy_hold_char) = *(yy_c_buf_p);
1437 }
1438 
1439 /** Allocate and initialize an input buffer state.
1440  * @param file A readable stream.
1441  * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1442  *
1443  * @return the allocated buffer state.
1444  */
yy_create_buffer(FILE * file,int size)1445     YY_BUFFER_STATE yy_create_buffer  (FILE * file, int  size )
1446 {
1447 	YY_BUFFER_STATE b;
1448 
1449 	b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state )  );
1450 	if ( ! b )
1451 		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1452 
1453 	b->yy_buf_size = size;
1454 
1455 	/* yy_ch_buf has to be 2 characters longer than the size given because
1456 	 * we need to put in 2 end-of-buffer characters.
1457 	 */
1458 	b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2)  );
1459 	if ( ! b->yy_ch_buf )
1460 		YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1461 
1462 	b->yy_is_our_buffer = 1;
1463 
1464 	yy_init_buffer( b, file );
1465 
1466 	return b;
1467 }
1468 
1469 /** Destroy the buffer.
1470  * @param b a buffer created with yy_create_buffer()
1471  *
1472  */
yy_delete_buffer(YY_BUFFER_STATE b)1473     void yy_delete_buffer (YY_BUFFER_STATE  b )
1474 {
1475 
1476 	if ( ! b )
1477 		return;
1478 
1479 	if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1480 		YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1481 
1482 	if ( b->yy_is_our_buffer )
1483 		yyfree( (void *) b->yy_ch_buf  );
1484 
1485 	yyfree( (void *) b  );
1486 }
1487 
1488 /* Initializes or reinitializes a buffer.
1489  * This function is sometimes called more than once on the same buffer,
1490  * such as during a yyrestart() or at EOF.
1491  */
yy_init_buffer(YY_BUFFER_STATE b,FILE * file)1492     static void yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file )
1493 
1494 {
1495 	int oerrno = errno;
1496 
1497 	yy_flush_buffer( b );
1498 
1499 	b->yy_input_file = file;
1500 	b->yy_fill_buffer = 1;
1501 
1502     /* If b is the current buffer, then yy_init_buffer was _probably_
1503      * called from yyrestart() or through yy_get_next_buffer.
1504      * In that case, we don't want to reset the lineno or column.
1505      */
1506     if (b != YY_CURRENT_BUFFER){
1507         b->yy_bs_lineno = 1;
1508         b->yy_bs_column = 0;
1509     }
1510 
1511         b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1512 
1513 	errno = oerrno;
1514 }
1515 
1516 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1517  * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1518  *
1519  */
yy_flush_buffer(YY_BUFFER_STATE b)1520     void yy_flush_buffer (YY_BUFFER_STATE  b )
1521 {
1522     	if ( ! b )
1523 		return;
1524 
1525 	b->yy_n_chars = 0;
1526 
1527 	/* We always need two end-of-buffer characters.  The first causes
1528 	 * a transition to the end-of-buffer state.  The second causes
1529 	 * a jam in that state.
1530 	 */
1531 	b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1532 	b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1533 
1534 	b->yy_buf_pos = &b->yy_ch_buf[0];
1535 
1536 	b->yy_at_bol = 1;
1537 	b->yy_buffer_status = YY_BUFFER_NEW;
1538 
1539 	if ( b == YY_CURRENT_BUFFER )
1540 		yy_load_buffer_state(  );
1541 }
1542 
1543 /** Pushes the new state onto the stack. The new state becomes
1544  *  the current state. This function will allocate the stack
1545  *  if necessary.
1546  *  @param new_buffer The new state.
1547  *
1548  */
yypush_buffer_state(YY_BUFFER_STATE new_buffer)1549 void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
1550 {
1551     	if (new_buffer == NULL)
1552 		return;
1553 
1554 	yyensure_buffer_stack();
1555 
1556 	/* This block is copied from yy_switch_to_buffer. */
1557 	if ( YY_CURRENT_BUFFER )
1558 		{
1559 		/* Flush out information for old buffer. */
1560 		*(yy_c_buf_p) = (yy_hold_char);
1561 		YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1562 		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1563 		}
1564 
1565 	/* Only push if top exists. Otherwise, replace top. */
1566 	if (YY_CURRENT_BUFFER)
1567 		(yy_buffer_stack_top)++;
1568 	YY_CURRENT_BUFFER_LVALUE = new_buffer;
1569 
1570 	/* copied from yy_switch_to_buffer. */
1571 	yy_load_buffer_state(  );
1572 	(yy_did_buffer_switch_on_eof) = 1;
1573 }
1574 
1575 /** Removes and deletes the top of the stack, if present.
1576  *  The next element becomes the new top.
1577  *
1578  */
yypop_buffer_state(void)1579 void yypop_buffer_state (void)
1580 {
1581     	if (!YY_CURRENT_BUFFER)
1582 		return;
1583 
1584 	yy_delete_buffer(YY_CURRENT_BUFFER );
1585 	YY_CURRENT_BUFFER_LVALUE = NULL;
1586 	if ((yy_buffer_stack_top) > 0)
1587 		--(yy_buffer_stack_top);
1588 
1589 	if (YY_CURRENT_BUFFER) {
1590 		yy_load_buffer_state(  );
1591 		(yy_did_buffer_switch_on_eof) = 1;
1592 	}
1593 }
1594 
1595 /* Allocates the stack if it does not exist.
1596  *  Guarantees space for at least one push.
1597  */
yyensure_buffer_stack(void)1598 static void yyensure_buffer_stack (void)
1599 {
1600 	yy_size_t num_to_alloc;
1601 
1602 	if (!(yy_buffer_stack)) {
1603 
1604 		/* First allocation is just for 2 elements, since we don't know if this
1605 		 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1606 		 * immediate realloc on the next call.
1607          */
1608       num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
1609 		(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
1610 								(num_to_alloc * sizeof(struct yy_buffer_state*)
1611 								);
1612 		if ( ! (yy_buffer_stack) )
1613 			YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1614 
1615 		memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1616 
1617 		(yy_buffer_stack_max) = num_to_alloc;
1618 		(yy_buffer_stack_top) = 0;
1619 		return;
1620 	}
1621 
1622 	if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1623 
1624 		/* Increase the buffer to prepare for a possible push. */
1625 		yy_size_t grow_size = 8 /* arbitrary grow size */;
1626 
1627 		num_to_alloc = (yy_buffer_stack_max) + grow_size;
1628 		(yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
1629 								((yy_buffer_stack),
1630 								num_to_alloc * sizeof(struct yy_buffer_state*)
1631 								);
1632 		if ( ! (yy_buffer_stack) )
1633 			YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1634 
1635 		/* zero only the new slots.*/
1636 		memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1637 		(yy_buffer_stack_max) = num_to_alloc;
1638 	}
1639 }
1640 
1641 /** Setup the input buffer state to scan directly from a user-specified character buffer.
1642  * @param base the character buffer
1643  * @param size the size in bytes of the character buffer
1644  *
1645  * @return the newly allocated buffer state object.
1646  */
yy_scan_buffer(char * base,yy_size_t size)1647 YY_BUFFER_STATE yy_scan_buffer  (char * base, yy_size_t  size )
1648 {
1649 	YY_BUFFER_STATE b;
1650 
1651 	if ( size < 2 ||
1652 	     base[size-2] != YY_END_OF_BUFFER_CHAR ||
1653 	     base[size-1] != YY_END_OF_BUFFER_CHAR )
1654 		/* They forgot to leave room for the EOB's. */
1655 		return NULL;
1656 
1657 	b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state )  );
1658 	if ( ! b )
1659 		YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1660 
1661 	b->yy_buf_size = (int) (size - 2);	/* "- 2" to take care of EOB's */
1662 	b->yy_buf_pos = b->yy_ch_buf = base;
1663 	b->yy_is_our_buffer = 0;
1664 	b->yy_input_file = NULL;
1665 	b->yy_n_chars = b->yy_buf_size;
1666 	b->yy_is_interactive = 0;
1667 	b->yy_at_bol = 1;
1668 	b->yy_fill_buffer = 0;
1669 	b->yy_buffer_status = YY_BUFFER_NEW;
1670 
1671 	yy_switch_to_buffer( b  );
1672 
1673 	return b;
1674 }
1675 
1676 /** Setup the input buffer state to scan a string. The next call to yylex() will
1677  * scan from a @e copy of @a str.
1678  * @param yystr a NUL-terminated string to scan
1679  *
1680  * @return the newly allocated buffer state object.
1681  * @note If you want to scan bytes that may contain NUL values, then use
1682  *       yy_scan_bytes() instead.
1683  */
yy_scan_string(const char * yystr)1684 YY_BUFFER_STATE yy_scan_string (const char * yystr )
1685 {
1686 
1687 	return yy_scan_bytes( yystr, (int) strlen(yystr) );
1688 }
1689 
1690 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
1691  * scan from a @e copy of @a bytes.
1692  * @param yybytes the byte buffer to scan
1693  * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
1694  *
1695  * @return the newly allocated buffer state object.
1696  */
yy_scan_bytes(const char * yybytes,int _yybytes_len)1697 YY_BUFFER_STATE yy_scan_bytes  (const char * yybytes, int  _yybytes_len )
1698 {
1699 	YY_BUFFER_STATE b;
1700 	char *buf;
1701 	yy_size_t n;
1702 	int i;
1703 
1704 	/* Get memory for full buffer, including space for trailing EOB's. */
1705 	n = (yy_size_t) (_yybytes_len + 2);
1706 	buf = (char *) yyalloc( n  );
1707 	if ( ! buf )
1708 		YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1709 
1710 	for ( i = 0; i < _yybytes_len; ++i )
1711 		buf[i] = yybytes[i];
1712 
1713 	buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1714 
1715 	b = yy_scan_buffer( buf, n );
1716 	if ( ! b )
1717 		YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1718 
1719 	/* It's okay to grow etc. this buffer, and we should throw it
1720 	 * away when we're done.
1721 	 */
1722 	b->yy_is_our_buffer = 1;
1723 
1724 	return b;
1725 }
1726 
1727 #ifndef YY_EXIT_FAILURE
1728 #define YY_EXIT_FAILURE 2
1729 #endif
1730 
yy_fatal_error(const char * msg)1731 static void yynoreturn yy_fatal_error (const char* msg )
1732 {
1733 			fprintf( stderr, "%s\n", msg );
1734 	exit( YY_EXIT_FAILURE );
1735 }
1736 
1737 /* Redefine yyless() so it works in section 3 code. */
1738 
1739 #undef yyless
1740 #define yyless(n) \
1741 	do \
1742 		{ \
1743 		/* Undo effects of setting up yytext. */ \
1744         int yyless_macro_arg = (n); \
1745         YY_LESS_LINENO(yyless_macro_arg);\
1746 		yytext[yyleng] = (yy_hold_char); \
1747 		(yy_c_buf_p) = yytext + yyless_macro_arg; \
1748 		(yy_hold_char) = *(yy_c_buf_p); \
1749 		*(yy_c_buf_p) = '\0'; \
1750 		yyleng = yyless_macro_arg; \
1751 		} \
1752 	while ( 0 )
1753 
1754 /* Accessor  methods (get/set functions) to struct members. */
1755 
1756 /** Get the current line number.
1757  *
1758  */
yyget_lineno(void)1759 int yyget_lineno  (void)
1760 {
1761 
1762     return yylineno;
1763 }
1764 
1765 /** Get the input stream.
1766  *
1767  */
yyget_in(void)1768 FILE *yyget_in  (void)
1769 {
1770         return yyin;
1771 }
1772 
1773 /** Get the output stream.
1774  *
1775  */
yyget_out(void)1776 FILE *yyget_out  (void)
1777 {
1778         return yyout;
1779 }
1780 
1781 /** Get the length of the current token.
1782  *
1783  */
yyget_leng(void)1784 int yyget_leng  (void)
1785 {
1786         return yyleng;
1787 }
1788 
1789 /** Get the current token.
1790  *
1791  */
1792 
yyget_text(void)1793 char *yyget_text  (void)
1794 {
1795         return yytext;
1796 }
1797 
1798 /** Set the current line number.
1799  * @param _line_number line number
1800  *
1801  */
yyset_lineno(int _line_number)1802 void yyset_lineno (int  _line_number )
1803 {
1804 
1805     yylineno = _line_number;
1806 }
1807 
1808 /** Set the input stream. This does not discard the current
1809  * input buffer.
1810  * @param _in_str A readable stream.
1811  *
1812  * @see yy_switch_to_buffer
1813  */
yyset_in(FILE * _in_str)1814 void yyset_in (FILE *  _in_str )
1815 {
1816         yyin = _in_str ;
1817 }
1818 
yyset_out(FILE * _out_str)1819 void yyset_out (FILE *  _out_str )
1820 {
1821         yyout = _out_str ;
1822 }
1823 
yyget_debug(void)1824 int yyget_debug  (void)
1825 {
1826         return yy_flex_debug;
1827 }
1828 
yyset_debug(int _bdebug)1829 void yyset_debug (int  _bdebug )
1830 {
1831         yy_flex_debug = _bdebug ;
1832 }
1833 
yy_init_globals(void)1834 static int yy_init_globals (void)
1835 {
1836         /* Initialization is the same as for the non-reentrant scanner.
1837      * This function is called from yylex_destroy(), so don't allocate here.
1838      */
1839 
1840     (yy_buffer_stack) = NULL;
1841     (yy_buffer_stack_top) = 0;
1842     (yy_buffer_stack_max) = 0;
1843     (yy_c_buf_p) = NULL;
1844     (yy_init) = 0;
1845     (yy_start) = 0;
1846 
1847 /* Defined in main.c */
1848 #ifdef YY_STDINIT
1849     yyin = stdin;
1850     yyout = stdout;
1851 #else
1852     yyin = NULL;
1853     yyout = NULL;
1854 #endif
1855 
1856     /* For future reference: Set errno on error, since we are called by
1857      * yylex_init()
1858      */
1859     return 0;
1860 }
1861 
1862 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
yylex_destroy(void)1863 int yylex_destroy  (void)
1864 {
1865 
1866     /* Pop the buffer stack, destroying each element. */
1867 	while(YY_CURRENT_BUFFER){
1868 		yy_delete_buffer( YY_CURRENT_BUFFER  );
1869 		YY_CURRENT_BUFFER_LVALUE = NULL;
1870 		yypop_buffer_state();
1871 	}
1872 
1873 	/* Destroy the stack itself. */
1874 	yyfree((yy_buffer_stack) );
1875 	(yy_buffer_stack) = NULL;
1876 
1877     /* Reset the globals. This is important in a non-reentrant scanner so the next time
1878      * yylex() is called, initialization will occur. */
1879     yy_init_globals( );
1880 
1881     return 0;
1882 }
1883 
1884 /*
1885  * Internal utility routines.
1886  */
1887 
1888 #ifndef yytext_ptr
yy_flex_strncpy(char * s1,const char * s2,int n)1889 static void yy_flex_strncpy (char* s1, const char * s2, int n )
1890 {
1891 
1892 	int i;
1893 	for ( i = 0; i < n; ++i )
1894 		s1[i] = s2[i];
1895 }
1896 #endif
1897 
1898 #ifdef YY_NEED_STRLEN
yy_flex_strlen(const char * s)1899 static int yy_flex_strlen (const char * s )
1900 {
1901 	int n;
1902 	for ( n = 0; s[n]; ++n )
1903 		;
1904 
1905 	return n;
1906 }
1907 #endif
1908 
yyalloc(yy_size_t size)1909 void *yyalloc (yy_size_t  size )
1910 {
1911 			return malloc(size);
1912 }
1913 
yyrealloc(void * ptr,yy_size_t size)1914 void *yyrealloc  (void * ptr, yy_size_t  size )
1915 {
1916 
1917 	/* The cast to (char *) in the following accommodates both
1918 	 * implementations that use char* generic pointers, and those
1919 	 * that use void* generic pointers.  It works with the latter
1920 	 * because both ANSI C and C++ allow castless assignment from
1921 	 * any pointer type to void*, and deal with argument conversions
1922 	 * as though doing an assignment.
1923 	 */
1924 	return realloc(ptr, size);
1925 }
1926 
yyfree(void * ptr)1927 void yyfree (void * ptr )
1928 {
1929 			free( (char *) ptr );	/* see yyrealloc() for (char *) cast */
1930 }
1931 
1932 #define YYTABLES_NAME "yytables"
1933 
1934 #line 84 "scanner.l"
1935 
yywrap(void)1936 int yywrap(void)
1937 {
1938     (void) &yyunput;
1939     (void) &input;
1940     return 1;
1941 }
1942 
yyerror(const char * message)1943 _X_NORETURN void yyerror(const char *message)
1944 {
1945     const char *pt, *end;
1946     struct _entry {
1947         const char *from;
1948         const char *to;
1949     } *entry, list[] = {
1950         { "T_VIRTUAL",      "\"virtual\"" },
1951         { "T_DISPLAY",      "\"display\"" },
1952         { "T_WALL",         "\"wall\"" },
1953         { "T_OPTION",       "\"option\"" },
1954         { "T_PARAM",        "\"param\"" },
1955         { "T_DIMENSION",    "dimension (e.g., 2x2 or 1024x768)" },
1956         { "T_OFFSET",       "display offset (e.g., +10-10)" },
1957         { "T_ORIGIN",       "tile origin (e.g., @1280x1024)" },
1958         { "T_STRING",       "string" },
1959         { "T_COMMENT",      "comment (e.g., #...)" },
1960         { "T_LINE_COMMENT", "comment (e.g., #...)" },
1961         { NULL, NULL }
1962     };
1963 
1964     fprintf(stderr, "parse error on line %d at token \"%*.*s\"\n",
1965             lineno, (int)yyleng, (int)yyleng, yytext);
1966     end = message + strlen(message);
1967     for (pt = message; *pt; pt++) {
1968         if (pt[0] == 'T' && pt[1] == '_') {
1969             const char *next = strchr(pt, ' ');
1970             if (!next || !*next) next = strchr(pt, '\0');
1971             if (!next) goto bail;
1972             --next;
1973             if (next-pt == 1 && next[1]
1974                 && next[2] == '\'' && next[3] == '\'') {
1975                 fprintf(stderr, "\"%c\"", next[1]);
1976                 pt += 4;
1977                 goto cnt;
1978             }
1979             for (entry = list; entry->from; ++entry) {
1980                 if (!strncmp(entry->from, pt, strlen(entry->from))) {
1981                     fprintf(stderr, "%s", entry->to);
1982                     pt = next;
1983                     goto cnt;
1984                 }
1985             }
1986         } else if (end-pt >= 5 && pt[0] == '\'' && pt[1] == '\'' && pt[3]
1987                    && pt[4] == '\'' && pt[5] == '\'') {
1988             fprintf(stderr, "\"%c\"", pt[3]);
1989             pt += 5;
1990         } else if (end-pt >= 3 && pt[0] == '\'' && pt[1] && pt[2] == '\'') {
1991             fprintf(stderr, "\"%c\"", pt[1]);
1992             pt += 3;
1993         }
1994       bail:
1995         putc(*pt, stderr);
1996       cnt:
1997         ;
1998     }
1999     fprintf(stderr, "\n");
2000     exit( 1 );
2001 }
2002 
getdimension(int token,const char * text,int leng)2003 static int getdimension(int token, const char *text, int leng)
2004 {
2005     char *endptr;
2006     char *tmp = dmxConfigAlloc(leng+1);
2007     int  x, y;
2008 
2009     strlcpy(tmp, text, leng+1);
2010     x = strtol(tmp, &endptr, 10);
2011     while (*endptr && !isdigit(*endptr)) ++endptr;
2012     y = strtol(endptr, NULL, 10);
2013     dmxConfigFree(tmp);
2014     yylval.pair = dmxConfigCreatePair(token, lineno, NULL, x, y, 1, 1);
2015     return token;
2016 }
2017 
getstring(int token,const char * text,int leng)2018 static int getstring(int token, const char *text, int leng)
2019 {
2020     yylval.string = dmxConfigCreateString(token, lineno, NULL,
2021                                           dmxConfigCopyString(leng ? text : "",
2022                                                               leng));
2023     return token;
2024 }
2025 
gettoken(int token,const char * text,int leng)2026 static int gettoken(int token, const char *text, int leng)
2027 {
2028     yylval.token = dmxConfigCreateToken(token, lineno, NULL);
2029     return token;
2030 }
2031 
getcomment(int token,const char * text,int leng)2032 static int getcomment(int token, const char *text, int leng)
2033 {
2034     yylval.comment = dmxConfigCreateComment(token, lineno,
2035                                             dmxConfigCopyString(text + 1,
2036                                                                 leng - 1));
2037     return token;
2038 }
2039 
2040