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