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