~ubuntu-branches/ubuntu/precise/mesa/precise-updates

« back to all changes in this revision

Viewing changes to src/glsl/glcpp/glcpp-lex.c

  • Committer: Bazaar Package Importer
  • Author(s): Christopher James Halse Rogers
  • Date: 2011-08-04 16:25:08 UTC
  • mfrom: (1.2.37 upstream)
  • Revision ID: james.westby@ubuntu.com-20110804162508-kujg82moxerjg1kk
Tags: 7.11-0ubuntu1
* Fake merge from Debian experimental, updating previous changelog entries.
  New upstream release fixes infrequent X crash (LP: #800778).
  Remaining Ubuntu changes:
 - debian/control
    + Drop lesstif-dev from Build-Depends; it's in Universe.
    + Comment out GLw libs since it depends on lesstif-dev.
    + Drop i686 swx11 libgl package.
    + Add libdrm-dev to mesa-common-dev Depends.
    + Drop libwayland-dev from Build-Depends; it's in Universe.
    + Update Breaks for Ubuntu versions
    + Enable llvm on armel as well as i386 and amd64
  - debian/rules
    + Use --disable-glw for swx11 targets too.
    + Don't enable motif for swx11 targets.
    + Use lzma compression for binary debs to save CD space.
    + Drop unloved mach64 driver.
    + Use --enable-shared-dricore to claw back CD space.
    + Enable llvmpipe software rasteriser.
    + Enable llvm on armel as well as i386 and amd64
  - debian/patches
    + 100_no_abi_tag.patch
    + 101_ubuntu_hidden_glname.patch
    + 103_savage-expose_fbmodes_with_nonzero_alpha.patch
  - rules, libgl1-mesa-{glx,dev,swx11,swx11-dev}.install.in,
    libgl1-mesa-{glx,swx11}.{postinst,prerm}.in, libgl1-mesa-dev.links.in:
    Install libGL.so* in /usr/lib/mesa to allow things to work with
    alternatives.
  - debian/not-installed:
    + Drop i686 files; we don't build 686-optimised packages in the first
      place.
  - debian/gbp.conf
    + Point at Ubuntu branch to make git-buildpackage less narky.
  - 113_fix_tls.diff: Fix crashes in unrelated code due to TLS usage.
  - debian/patches/111_export_searchdirs_in_dripc.diff:
    + Add drisearchdirs variable to dri.pc so the Xserver can pick up the
      alternate DRI driver dirs.
  - debian/patches/115_llvm_dynamic_linking.diff
    + Dynamically link DRI drivers to libllvm.  Saves ~6MiB per DRI driver.
  - debian/patches/116_use_shared_galliumcore.diff:
  - debian/libgl1-mesa-dri.install.in:
    + Link gallium DRI drivers against shared gallium routines to save CD
      space.
* debian/rules:
* debian/libgl1-mesa-dri-experimental.install.{i386,amd64}.in
  - Explicitly install i915g only when it has been built, matching what is
    done with r300g.
* debian/rules:
* debian/control:
* debian/libegl1-mesa{,-dev}.install.in:
* debian/libegl1-mesa.symbols:
  - Enable the Wayland EGL backend.
* debian/rules:
* debian/libegl1-mesa.{postinst,prerm,install}.in:
* debian/libegl1-mesa-dev.{install,links}.in:
* debian/libgles{1,2}-mesa.install.in:
* debian/libgles{1,2}-mesa-dev.links.in:
* debian/libopenvg1-mesa{,-dev}.install.in:
* debian/libopenvg1-mesa-dev.links.in:
  - Use alternatives for libEGL to match the handling of libGL.
    libEGL (and associated GL|ES and OpenVG libraries) now live in
    /usr/lib/$MULTIARCH/mesa-egl.  (LP: #812639)
* debian/patches/118_fix_24bpp_software_rendering.diff:
  - Cherry pick upstream patch from master fixing graphical corruption when
    using a 24bpp framebuffer and software rendering. (LP: #810339)
* debian/rules:
* debian/clean:
  - Generate xmlpool pot file and clean up other po files for
    pkgbinarymangler's benefit (LP: #410264).
* debian/patches/119_r600g_gnome_shell_rendering_fix.diff:
  - Cherry pick upstream commit fixing rendering corruption in gnome-shell
    (and therefore likely Unity as well).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#line 2 "glcpp/glcpp-lex.c"
 
2
 
 
3
#line 4 "glcpp/glcpp-lex.c"
 
4
 
 
5
#define  YY_INT_ALIGNED short int
 
6
 
 
7
/* A lexical scanner generated by flex */
 
8
 
 
9
#define FLEX_SCANNER
 
10
#define YY_FLEX_MAJOR_VERSION 2
 
11
#define YY_FLEX_MINOR_VERSION 5
 
12
#define YY_FLEX_SUBMINOR_VERSION 35
 
13
#if YY_FLEX_SUBMINOR_VERSION > 0
 
14
#define FLEX_BETA
 
15
#endif
 
16
 
 
17
/* First, we deal with  platform-specific or compiler-specific issues. */
 
18
 
 
19
/* begin standard C headers. */
 
20
#include <stdio.h>
 
21
#include <string.h>
 
22
#include <errno.h>
 
23
#include <stdlib.h>
 
24
 
 
25
/* end standard C headers. */
 
26
 
 
27
/* flex integer type definitions */
 
28
 
 
29
#ifndef FLEXINT_H
 
30
#define FLEXINT_H
 
31
 
 
32
/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
 
33
 
 
34
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
 
35
 
 
36
/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
 
37
 * if you want the limit (max/min) macros for int types. 
 
38
 */
 
39
#ifndef __STDC_LIMIT_MACROS
 
40
#define __STDC_LIMIT_MACROS 1
 
41
#endif
 
42
 
 
43
#include <inttypes.h>
 
44
typedef int8_t flex_int8_t;
 
45
typedef uint8_t flex_uint8_t;
 
46
typedef int16_t flex_int16_t;
 
47
typedef uint16_t flex_uint16_t;
 
48
typedef int32_t flex_int32_t;
 
49
typedef uint32_t flex_uint32_t;
 
50
#else
 
51
typedef signed char flex_int8_t;
 
52
typedef short int flex_int16_t;
 
53
typedef int flex_int32_t;
 
54
typedef unsigned char flex_uint8_t; 
 
55
typedef unsigned short int flex_uint16_t;
 
56
typedef unsigned int flex_uint32_t;
 
57
#endif /* ! C99 */
 
58
 
 
59
/* Limits of integral types. */
 
60
#ifndef INT8_MIN
 
61
#define INT8_MIN               (-128)
 
62
#endif
 
63
#ifndef INT16_MIN
 
64
#define INT16_MIN              (-32767-1)
 
65
#endif
 
66
#ifndef INT32_MIN
 
67
#define INT32_MIN              (-2147483647-1)
 
68
#endif
 
69
#ifndef INT8_MAX
 
70
#define INT8_MAX               (127)
 
71
#endif
 
72
#ifndef INT16_MAX
 
73
#define INT16_MAX              (32767)
 
74
#endif
 
75
#ifndef INT32_MAX
 
76
#define INT32_MAX              (2147483647)
 
77
#endif
 
78
#ifndef UINT8_MAX
 
79
#define UINT8_MAX              (255U)
 
80
#endif
 
81
#ifndef UINT16_MAX
 
82
#define UINT16_MAX             (65535U)
 
83
#endif
 
84
#ifndef UINT32_MAX
 
85
#define UINT32_MAX             (4294967295U)
 
86
#endif
 
87
 
 
88
#endif /* ! FLEXINT_H */
 
89
 
 
90
#ifdef __cplusplus
 
91
 
 
92
/* The "const" storage-class-modifier is valid. */
 
93
#define YY_USE_CONST
 
94
 
 
95
#else   /* ! __cplusplus */
 
96
 
 
97
/* C99 requires __STDC__ to be defined as 1. */
 
98
#if defined (__STDC__)
 
99
 
 
100
#define YY_USE_CONST
 
101
 
 
102
#endif  /* defined (__STDC__) */
 
103
#endif  /* ! __cplusplus */
 
104
 
 
105
#ifdef YY_USE_CONST
 
106
#define yyconst const
 
107
#else
 
108
#define yyconst
 
109
#endif
 
110
 
 
111
/* Returned upon end-of-file. */
 
112
#define YY_NULL 0
 
113
 
 
114
/* Promotes a possibly negative, possibly signed char to an unsigned
 
115
 * integer for use as an array index.  If the signed char is negative,
 
116
 * we want to instead treat it as an 8-bit unsigned char, hence the
 
117
 * double cast.
 
118
 */
 
119
#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
 
120
 
 
121
/* An opaque pointer. */
 
122
#ifndef YY_TYPEDEF_YY_SCANNER_T
 
123
#define YY_TYPEDEF_YY_SCANNER_T
 
124
typedef void* yyscan_t;
 
125
#endif
 
126
 
 
127
/* For convenience, these vars (plus the bison vars far below)
 
128
   are macros in the reentrant scanner. */
 
129
#define yyin yyg->yyin_r
 
130
#define yyout yyg->yyout_r
 
131
#define yyextra yyg->yyextra_r
 
132
#define yyleng yyg->yyleng_r
 
133
#define yytext yyg->yytext_r
 
134
#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
 
135
#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
 
136
#define yy_flex_debug yyg->yy_flex_debug_r
 
137
 
 
138
/* Enter a start condition.  This macro really ought to take a parameter,
 
139
 * but we do it the disgusting crufty way forced on us by the ()-less
 
140
 * definition of BEGIN.
 
141
 */
 
142
#define BEGIN yyg->yy_start = 1 + 2 *
 
143
 
 
144
/* Translate the current start state into a value that can be later handed
 
145
 * to BEGIN to return to the state.  The YYSTATE alias is for lex
 
146
 * compatibility.
 
147
 */
 
148
#define YY_START ((yyg->yy_start - 1) / 2)
 
149
#define YYSTATE YY_START
 
150
 
 
151
/* Action number for EOF rule of a given start state. */
 
152
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
 
153
 
 
154
/* Special action meaning "start processing a new file". */
 
155
#define YY_NEW_FILE glcpp_restart(yyin ,yyscanner )
 
156
 
 
157
#define YY_END_OF_BUFFER_CHAR 0
 
158
 
 
159
/* Size of default input buffer. */
 
160
#ifndef YY_BUF_SIZE
 
161
#define YY_BUF_SIZE 16384
 
162
#endif
 
163
 
 
164
/* The state buf must be large enough to hold one state per character in the main buffer.
 
165
 */
 
166
#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
 
167
 
 
168
#ifndef YY_TYPEDEF_YY_BUFFER_STATE
 
169
#define YY_TYPEDEF_YY_BUFFER_STATE
 
170
typedef struct yy_buffer_state *YY_BUFFER_STATE;
 
171
#endif
 
172
 
 
173
#define EOB_ACT_CONTINUE_SCAN 0
 
174
#define EOB_ACT_END_OF_FILE 1
 
175
#define EOB_ACT_LAST_MATCH 2
 
176
 
 
177
    #define YY_LESS_LINENO(n)
 
178
    
 
179
/* Return all but the first "n" matched characters back to the input stream. */
 
180
#define yyless(n) \
 
181
        do \
 
182
                { \
 
183
                /* Undo effects of setting up yytext. */ \
 
184
        int yyless_macro_arg = (n); \
 
185
        YY_LESS_LINENO(yyless_macro_arg);\
 
186
                *yy_cp = yyg->yy_hold_char; \
 
187
                YY_RESTORE_YY_MORE_OFFSET \
 
188
                yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
 
189
                YY_DO_BEFORE_ACTION; /* set up yytext again */ \
 
190
                } \
 
191
        while ( 0 )
 
192
 
 
193
#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
 
194
 
 
195
#ifndef YY_TYPEDEF_YY_SIZE_T
 
196
#define YY_TYPEDEF_YY_SIZE_T
 
197
typedef size_t yy_size_t;
 
198
#endif
 
199
 
 
200
#ifndef YY_STRUCT_YY_BUFFER_STATE
 
201
#define YY_STRUCT_YY_BUFFER_STATE
 
202
struct yy_buffer_state
 
203
        {
 
204
        FILE *yy_input_file;
 
205
 
 
206
        char *yy_ch_buf;                /* input buffer */
 
207
        char *yy_buf_pos;               /* current position in input buffer */
 
208
 
 
209
        /* Size of input buffer in bytes, not including room for EOB
 
210
         * characters.
 
211
         */
 
212
        yy_size_t yy_buf_size;
 
213
 
 
214
        /* Number of characters read into yy_ch_buf, not including EOB
 
215
         * characters.
 
216
         */
 
217
        int yy_n_chars;
 
218
 
 
219
        /* Whether we "own" the buffer - i.e., we know we created it,
 
220
         * and can realloc() it to grow it, and should free() it to
 
221
         * delete it.
 
222
         */
 
223
        int yy_is_our_buffer;
 
224
 
 
225
        /* Whether this is an "interactive" input source; if so, and
 
226
         * if we're using stdio for input, then we want to use getc()
 
227
         * instead of fread(), to make sure we stop fetching input after
 
228
         * each newline.
 
229
         */
 
230
        int yy_is_interactive;
 
231
 
 
232
        /* Whether we're considered to be at the beginning of a line.
 
233
         * If so, '^' rules will be active on the next match, otherwise
 
234
         * not.
 
235
         */
 
236
        int yy_at_bol;
 
237
 
 
238
    int yy_bs_lineno; /**< The line count. */
 
239
    int yy_bs_column; /**< The column count. */
 
240
    
 
241
        /* Whether to try to fill the input buffer when we reach the
 
242
         * end of it.
 
243
         */
 
244
        int yy_fill_buffer;
 
245
 
 
246
        int yy_buffer_status;
 
247
 
 
248
#define YY_BUFFER_NEW 0
 
249
#define YY_BUFFER_NORMAL 1
 
250
        /* When an EOF's been seen but there's still some text to process
 
251
         * then we mark the buffer as YY_EOF_PENDING, to indicate that we
 
252
         * shouldn't try reading from the input source any more.  We might
 
253
         * still have a bunch of tokens to match, though, because of
 
254
         * possible backing-up.
 
255
         *
 
256
         * When we actually see the EOF, we change the status to "new"
 
257
         * (via glcpp_restart()), so that the user can continue scanning by
 
258
         * just pointing yyin at a new input file.
 
259
         */
 
260
#define YY_BUFFER_EOF_PENDING 2
 
261
 
 
262
        };
 
263
#endif /* !YY_STRUCT_YY_BUFFER_STATE */
 
264
 
 
265
/* We provide macros for accessing buffer states in case in the
 
266
 * future we want to put the buffer states in a more general
 
267
 * "scanner state".
 
268
 *
 
269
 * Returns the top of the stack, or NULL.
 
270
 */
 
271
#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
 
272
                          ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
 
273
                          : NULL)
 
274
 
 
275
/* Same as previous macro, but useful when we know that the buffer stack is not
 
276
 * NULL or when we need an lvalue. For internal use only.
 
277
 */
 
278
#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
 
279
 
 
280
void glcpp_restart (FILE *input_file ,yyscan_t yyscanner );
 
281
void glcpp__switch_to_buffer (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
 
282
YY_BUFFER_STATE glcpp__create_buffer (FILE *file,int size ,yyscan_t yyscanner );
 
283
void glcpp__delete_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
 
284
void glcpp__flush_buffer (YY_BUFFER_STATE b ,yyscan_t yyscanner );
 
285
void glcpp_push_buffer_state (YY_BUFFER_STATE new_buffer ,yyscan_t yyscanner );
 
286
void glcpp_pop_buffer_state (yyscan_t yyscanner );
 
287
 
 
288
static void glcpp_ensure_buffer_stack (yyscan_t yyscanner );
 
289
static void glcpp__load_buffer_state (yyscan_t yyscanner );
 
290
static void glcpp__init_buffer (YY_BUFFER_STATE b,FILE *file ,yyscan_t yyscanner );
 
291
 
 
292
#define YY_FLUSH_BUFFER glcpp__flush_buffer(YY_CURRENT_BUFFER ,yyscanner)
 
293
 
 
294
YY_BUFFER_STATE glcpp__scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner );
 
295
YY_BUFFER_STATE glcpp__scan_string (yyconst char *yy_str ,yyscan_t yyscanner );
 
296
YY_BUFFER_STATE glcpp__scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner );
 
297
 
 
298
void *glcpp_alloc (yy_size_t ,yyscan_t yyscanner );
 
299
void *glcpp_realloc (void *,yy_size_t ,yyscan_t yyscanner );
 
300
void glcpp_free (void * ,yyscan_t yyscanner );
 
301
 
 
302
#define yy_new_buffer glcpp__create_buffer
 
303
 
 
304
#define yy_set_interactive(is_interactive) \
 
305
        { \
 
306
        if ( ! YY_CURRENT_BUFFER ){ \
 
307
        glcpp_ensure_buffer_stack (yyscanner); \
 
308
                YY_CURRENT_BUFFER_LVALUE =    \
 
309
            glcpp__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
 
310
        } \
 
311
        YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
 
312
        }
 
313
 
 
314
#define yy_set_bol(at_bol) \
 
315
        { \
 
316
        if ( ! YY_CURRENT_BUFFER ){\
 
317
        glcpp_ensure_buffer_stack (yyscanner); \
 
318
                YY_CURRENT_BUFFER_LVALUE =    \
 
319
            glcpp__create_buffer(yyin,YY_BUF_SIZE ,yyscanner); \
 
320
        } \
 
321
        YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
 
322
        }
 
323
 
 
324
#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
 
325
 
 
326
/* Begin user sect3 */
 
327
 
 
328
#define glcpp_wrap(n) 1
 
329
#define YY_SKIP_YYWRAP
 
330
 
 
331
typedef unsigned char YY_CHAR;
 
332
 
 
333
typedef int yy_state_type;
 
334
 
 
335
#define yytext_ptr yytext_r
 
336
 
 
337
static yy_state_type yy_get_previous_state (yyscan_t yyscanner );
 
338
static yy_state_type yy_try_NUL_trans (yy_state_type current_state  ,yyscan_t yyscanner);
 
339
static int yy_get_next_buffer (yyscan_t yyscanner );
 
340
static void yy_fatal_error (yyconst char msg[] ,yyscan_t yyscanner );
 
341
 
 
342
/* Done after the current pattern has been matched and before the
 
343
 * corresponding action - sets up yytext.
 
344
 */
 
345
#define YY_DO_BEFORE_ACTION \
 
346
        yyg->yytext_ptr = yy_bp; \
 
347
        yyleng = (size_t) (yy_cp - yy_bp); \
 
348
        yyg->yy_hold_char = *yy_cp; \
 
349
        *yy_cp = '\0'; \
 
350
        yyg->yy_c_buf_p = yy_cp;
 
351
 
 
352
#define YY_NUM_RULES 43
 
353
#define YY_END_OF_BUFFER 44
 
354
/* This struct is not used in this scanner,
 
355
   but its presence is necessary. */
 
356
struct yy_trans_info
 
357
        {
 
358
        flex_int32_t yy_verify;
 
359
        flex_int32_t yy_nxt;
 
360
        };
 
361
static yyconst flex_int16_t yy_acclist[125] =
 
362
    {   0,
 
363
        3,    3,   44,   39,   43,   40,   43,   41,   43,   43,
 
364
       38,   43,   43,   38,   43,   38,   43,   38,   43,   25,
 
365
       39,   43,   24,   39,   43,   38,   43,   38,   43,   38,
 
366
       43,   37,   39,   43,   37,   39,   43,   38,   43,   40,
 
367
       43,   23,   43,    3,   43,    4,   43,    5,   43,   42,
 
368
       43,   18,   43,   18,   43,   18,   43,   39,   40,   32,
 
369
       35,   33,    2,    1,   25,   39,   25,   39,   39,   24,
 
370
       39,   24,   39,   27,   29,   31,   30,   28,   37,   39,
 
371
       37,   39,   34,   40,   23,   23,    3,    4,    5,    6,
 
372
        5,    7,    1,   26,   39,   37,   39,   26,   39,   37,
 
373
 
 
374
       39,   14,   37,   39,   15,   16,   37,   39,   17,   19,
 
375
       12,   22,   36,   37,   39,   21,   19,   13,16404,   11,
 
376
        9,    8, 8212,   10
 
377
    } ;
 
378
 
 
379
static yyconst flex_int16_t yy_accept[155] =
 
380
    {   0,
 
381
        1,    1,    1,    1,    1,    2,    3,    3,    3,    3,
 
382
        3,    4,    6,    8,   10,   11,   13,   14,   16,   18,
 
383
       20,   23,   26,   28,   30,   32,   35,   38,   40,   42,
 
384
       44,   46,   48,   50,   52,   54,   56,   58,   59,   60,
 
385
       61,   62,   63,   64,   65,   67,   69,   70,   72,   74,
 
386
       75,   76,   77,   78,   79,   81,   83,   84,   85,   86,
 
387
       87,   87,   87,   87,   87,   87,   87,   87,   88,   89,
 
388
       90,   91,   92,   93,   93,   93,   93,   93,   94,   96,
 
389
       98,   98,   98,   98,   98,   98,   98,   98,   98,   98,
 
390
       98,  100,  102,  102,  102,  102,  102,  102,  102,  103,
 
391
 
 
392
      103,  103,  103,  103,  103,  103,  105,  105,  106,  107,
 
393
      107,  107,  107,  107,  107,  107,  107,  107,  107,  109,
 
394
      109,  110,  111,  111,  112,  112,  112,  112,  113,  113,
 
395
      116,  117,  118,  118,  119,  119,  119,  119,  120,  120,
 
396
      120,  121,  121,  122,  123,  123,  123,  123,  124,  124,
 
397
      124,  125,  125,  125
 
398
    } ;
 
399
 
 
400
static yyconst flex_int32_t yy_ec[256] =
 
401
    {   0,
 
402
        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
 
403
        4,    4,    4,    1,    1,    1,    1,    1,    1,    1,
 
404
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
405
        1,    2,    5,    1,    6,    1,    7,    8,    1,    9,
 
406
        7,   10,    7,    7,    7,    7,   11,   12,   13,   13,
 
407
       13,   13,   13,   13,   13,   14,   14,    1,    7,   15,
 
408
       16,   17,    1,    1,   18,   18,   18,   18,   18,   18,
 
409
       19,   19,   19,   19,   19,   19,   19,   19,   19,   19,
 
410
       19,   19,   19,   19,   20,   19,   19,   21,   19,   19,
 
411
        7,    1,    7,    7,   19,    1,   22,   18,   18,   23,
 
412
 
 
413
       24,   25,   26,   19,   27,   19,   19,   28,   29,   30,
 
414
       31,   32,   19,   33,   34,   35,   36,   37,   19,   38,
 
415
       19,   19,    7,   39,    7,    7,    1,    1,    1,    1,
 
416
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
417
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
418
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
419
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
420
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
421
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
422
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
423
 
 
424
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
425
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
426
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
427
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
428
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
429
        1,    1,    1,    1,    1
 
430
    } ;
 
431
 
 
432
static yyconst flex_int32_t yy_meta[40] =
 
433
    {   0,
 
434
        1,    2,    3,    4,    4,    4,    4,    4,    5,    6,
 
435
        4,    7,    7,    7,    4,    4,    4,    8,    8,    8,
 
436
        8,    8,    9,    8,    8,    8,    8,    8,    8,    9,
 
437
        8,    8,    8,    8,    8,    8,    8,    8,    4
 
438
    } ;
 
439
 
 
440
static yyconst flex_int16_t yy_base[168] =
 
441
    {   0,
 
442
        0,   38,    0,    0,   38,   39,  328,  327,  326,   44,
 
443
      328,    0,  325,  332,  332,  310,  319,  332,  316,   41,
 
444
       41,   44,   44,  307,   49,  321,   44,  282,   61,   79,
 
445
      317,  332,   72,  332,  332,   67,   68,    0,  317,  332,
 
446
      332,  332,  332,    0,   34,    0,  105,    0,    0,  332,
 
447
      332,  332,  332,  332,  317,   73,  332,   82,  311,  310,
 
448
      291,   61,  289,  286,  279,  281,  286,  306,  332,   90,
 
449
      332,   94,  332,   84,   85,  108,   48,    0,   88,   95,
 
450
      283,   86,  284,  273,  270,   91,  274,  281,  279,  268,
 
451
        0,  124,  273,  274,  274,  270,  265,  271,  332,  267,
 
452
 
 
453
      264,  262,  259,  260,  249,  125,  245,  332,  332,  241,
 
454
      229,  231,  223,  209,  222,  194,  197,  194,  130,  196,
 
455
      332,    0,  181,  332,  189,  131,  191,  332,  181,  210,
 
456
      162,    0,  136,  332,  134,    0,  130,  155,  111,  138,
 
457
      332,  153,    0,  332,  125,   41,  156,  332,   34,  136,
 
458
      332,  159,  332,  173,  182,  191,  200,  209,  218,  227,
 
459
      236,  245,  254,  263,  272,  280,  285
 
460
    } ;
 
461
 
 
462
static yyconst flex_int16_t yy_def[168] =
 
463
    {   0,
 
464
      153,    1,  154,  154,  155,  155,  156,  156,  157,  157,
 
465
      153,  158,  153,  153,  153,  153,  153,  153,  153,  153,
 
466
      158,  158,  153,  153,  153,  159,  159,  153,  153,  153,
 
467
      160,  153,  161,  153,  153,  153,  153,  158,  153,  153,
 
468
      153,  153,  153,  162,   21,  158,  158,   22,  158,  153,
 
469
      153,  153,  153,  153,  159,  159,  153,  153,   30,   30,
 
470
      153,  153,  153,  153,  153,  153,  153,  160,  153,  161,
 
471
      153,  161,  153,  153,  153,  153,  153,  162,   47,  159,
 
472
      153,  153,  153,  153,  153,  163,  153,  153,  153,  153,
 
473
      158,  159,  153,  153,  153,  153,  153,  153,  153,  153,
 
474
 
 
475
      153,  153,  153,  153,  153,  159,  153,  153,  153,  153,
 
476
      153,  153,  153,  153,  153,  153,  153,  153,  159,  153,
 
477
      153,  164,  153,  153,  153,  153,  153,  153,  153,  159,
 
478
      153,  164,  153,  153,  153,  165,  153,  166,  153,  153,
 
479
      153,  153,  165,  153,  167,  153,  153,  153,  167,  153,
 
480
      153,  153,    0,  153,  153,  153,  153,  153,  153,  153,
 
481
      153,  153,  153,  153,  153,  153,  153
 
482
    } ;
 
483
 
 
484
static yyconst flex_int16_t yy_nxt[372] =
 
485
    {   0,
 
486
       12,   13,   14,   15,   16,   17,   18,   19,   18,   18,
 
487
       20,   21,   22,   22,   23,   24,   25,   26,   26,   26,
 
488
       26,   26,   27,   26,   26,   26,   26,   26,   26,   26,
 
489
       26,   26,   26,   26,   26,   26,   26,   26,   28,   29,
 
490
       32,   32,  148,   30,   38,   36,   14,   33,   33,   37,
 
491
       43,   44,   45,   45,   38,   48,   48,   48,   50,   51,
 
492
       46,   47,   58,   49,   53,   54,   59,   56,   74,   76,
 
493
      136,   38,   75,   38,   71,   82,   46,   83,   47,   49,
 
494
       60,   72,   73,   58,   41,   74,   76,   59,   82,   75,
 
495
       83,   77,   71,   84,   63,   38,   71,   80,   85,  153,
 
496
 
 
497
      153,   61,   62,   72,   73,   63,   64,   91,   77,   76,
 
498
       65,   63,   94,  100,   66,   67,   79,   79,   79,   95,
 
499
      101,   92,   79,   91,   38,   38,   79,   79,   79,   79,
 
500
       38,   77,  126,  148,   63,  140,  141,  150,  151,  140,
 
501
      141,  146,  135,  135,  135,  142,  142,  142,  119,  147,
 
502
      147,  147,  130,  106,  140,  141,  138,  150,  151,  144,
 
503
      150,  151,  139,  138,  142,  142,  142,  152,  152,  152,
 
504
      152,  152,  152,   15,   15,   15,   15,   15,   15,   15,
 
505
       15,   15,   31,   31,   31,   31,   31,   31,   31,   31,
 
506
       31,   34,   34,   34,   34,   34,   34,   34,   34,   34,
 
507
 
 
508
       35,   35,   35,   35,   35,   35,   35,   35,   35,   38,
 
509
       38,  137,  136,  134,  133,   38,   38,   38,   55,  131,
 
510
      129,  128,  127,  126,   55,   55,   55,   68,   68,   68,
 
511
       68,   68,  125,   68,   68,   68,   70,   70,   70,   70,
 
512
       70,   70,   70,   70,   70,   78,   78,  124,   78,   78,
 
513
       78,   78,   78,   78,   99,   99,   99,   99,   99,   99,
 
514
      123,  122,   99,  132,  132,  121,  132,  132,  132,  132,
 
515
      132,  132,  143,  143,  120,  143,  143,  143,  143,  143,
 
516
      143,  145,  118,  117,  116,  115,  114,  145,  145,  149,
 
517
      113,  149,  149,  149,  112,  111,  110,  109,  108,  107,
 
518
 
 
519
      105,  104,  103,  102,   98,   97,   96,   93,   69,   90,
 
520
       89,   88,   87,   86,   81,  153,  153,   38,   39,   69,
 
521
       57,   38,   52,   42,   41,   40,   39,  153,   14,   15,
 
522
       15,   11,  153,  153,  153,  153,  153,  153,  153,  153,
 
523
      153,  153,  153,  153,  153,  153,  153,  153,  153,  153,
 
524
      153,  153,  153,  153,  153,  153,  153,  153,  153,  153,
 
525
      153,  153,  153,  153,  153,  153,  153,  153,  153,  153,
 
526
      153
 
527
    } ;
 
528
 
 
529
static yyconst flex_int16_t yy_chk[372] =
 
530
    {   0,
 
531
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
532
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
533
        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
 
534
        1,    1,    1,    1,    1,    1,    1,    1,    1,    2,
 
535
        5,    6,  149,    2,   27,   10,   10,    5,    6,   10,
 
536
       20,   20,   21,   21,   45,   22,   22,   22,   23,   23,
 
537
       21,   21,   29,   22,   25,   25,   29,   27,   36,   37,
 
538
      146,   45,   36,   56,   33,   77,   21,   77,   21,   22,
 
539
       30,   33,   33,   58,   30,   74,   75,   58,   62,   74,
 
540
       62,   37,   70,   62,   37,   80,   72,   56,   62,   70,
 
541
 
 
542
       70,   30,   30,   72,   72,   30,   30,   79,   75,   76,
 
543
       30,   75,   82,   86,   30,   30,   47,   47,   47,   82,
 
544
       86,   80,   47,   79,   92,  106,   47,   47,   47,   47,
 
545
      119,   76,  126,  145,   76,  135,  135,  150,  150,  140,
 
546
      140,  139,  126,  126,  126,  135,  135,  135,  106,  140,
 
547
      140,  140,  119,   92,  142,  142,  138,  147,  147,  137,
 
548
      152,  152,  133,  131,  142,  142,  142,  147,  147,  147,
 
549
      152,  152,  152,  154,  154,  154,  154,  154,  154,  154,
 
550
      154,  154,  155,  155,  155,  155,  155,  155,  155,  155,
 
551
      155,  156,  156,  156,  156,  156,  156,  156,  156,  156,
 
552
 
 
553
      157,  157,  157,  157,  157,  157,  157,  157,  157,  158,
 
554
      130,  129,  127,  125,  123,  158,  158,  158,  159,  120,
 
555
      118,  117,  116,  115,  159,  159,  159,  160,  160,  160,
 
556
      160,  160,  114,  160,  160,  160,  161,  161,  161,  161,
 
557
      161,  161,  161,  161,  161,  162,  162,  113,  162,  162,
 
558
      162,  162,  162,  162,  163,  163,  163,  163,  163,  163,
 
559
      112,  111,  163,  164,  164,  110,  164,  164,  164,  164,
 
560
      164,  164,  165,  165,  107,  165,  165,  165,  165,  165,
 
561
      165,  166,  105,  104,  103,  102,  101,  166,  166,  167,
 
562
      100,  167,  167,  167,   98,   97,   96,   95,   94,   93,
 
563
 
 
564
       90,   89,   88,   87,   85,   84,   83,   81,   68,   67,
 
565
       66,   65,   64,   63,   61,   60,   59,   55,   39,   31,
 
566
       28,   26,   24,   19,   17,   16,   13,   11,    9,    8,
 
567
        7,  153,  153,  153,  153,  153,  153,  153,  153,  153,
 
568
      153,  153,  153,  153,  153,  153,  153,  153,  153,  153,
 
569
      153,  153,  153,  153,  153,  153,  153,  153,  153,  153,
 
570
      153,  153,  153,  153,  153,  153,  153,  153,  153,  153,
 
571
      153
 
572
    } ;
 
573
 
 
574
#define YY_TRAILING_MASK 0x2000
 
575
#define YY_TRAILING_HEAD_MASK 0x4000
 
576
#define REJECT \
 
577
{ \
 
578
*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */ \
 
579
yy_cp = yyg->yy_full_match; /* restore poss. backed-over text */ \
 
580
yyg->yy_lp = yyg->yy_full_lp; /* restore orig. accepting pos. */ \
 
581
yyg->yy_state_ptr = yyg->yy_full_state; /* restore orig. state */ \
 
582
yy_current_state = *yyg->yy_state_ptr; /* restore curr. state */ \
 
583
++yyg->yy_lp; \
 
584
goto find_rule; \
 
585
}
 
586
 
 
587
#define yymore() yymore_used_but_not_detected
 
588
#define YY_MORE_ADJ 0
 
589
#define YY_RESTORE_YY_MORE_OFFSET
 
590
#line 1 "glcpp/glcpp-lex.l"
 
591
#line 2 "glcpp/glcpp-lex.l"
 
592
/*
 
593
 * Copyright © 2010 Intel Corporation
 
594
 *
 
595
 * Permission is hereby granted, free of charge, to any person obtaining a
 
596
 * copy of this software and associated documentation files (the "Software"),
 
597
 * to deal in the Software without restriction, including without limitation
 
598
 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
 
599
 * and/or sell copies of the Software, and to permit persons to whom the
 
600
 * Software is furnished to do so, subject to the following conditions:
 
601
 *
 
602
 * The above copyright notice and this permission notice (including the next
 
603
 * paragraph) shall be included in all copies or substantial portions of the
 
604
 * Software.
 
605
 *
 
606
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 
607
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 
608
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
 
609
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 
610
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 
611
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
 
612
 * DEALINGS IN THE SOFTWARE.
 
613
 */
 
614
 
 
615
#include <stdio.h>
 
616
#include <string.h>
 
617
#include <ctype.h>
 
618
 
 
619
#include "glcpp.h"
 
620
#include "glcpp-parse.h"
 
621
 
 
622
/* Flex annoyingly generates some functions without making them
 
623
 * static. Let's declare them here. */
 
624
int glcpp_get_column  (yyscan_t yyscanner);
 
625
void glcpp_set_column (int  column_no , yyscan_t yyscanner);
 
626
 
 
627
#ifdef _MSC_VER
 
628
#define YY_NO_UNISTD_H
 
629
#endif
 
630
 
 
631
#define YY_NO_INPUT
 
632
 
 
633
#define YY_USER_ACTION                                          \
 
634
   do {                                                         \
 
635
      yylloc->first_column = yycolumn + 1;                      \
 
636
      yylloc->first_line = yylineno;                            \
 
637
      yycolumn += yyleng;                                       \
 
638
   } while(0);
 
639
 
 
640
#define YY_USER_INIT                    \
 
641
        do {                            \
 
642
                yylineno = 1;           \
 
643
                yycolumn = 1;           \
 
644
                yylloc->source = 0;     \
 
645
        } while(0)
 
646
 
 
647
#line 648 "glcpp/glcpp-lex.c"
 
648
 
 
649
#define INITIAL 0
 
650
#define DONE 1
 
651
#define COMMENT 2
 
652
#define UNREACHABLE 3
 
653
#define SKIP 4
 
654
 
 
655
#define YY_EXTRA_TYPE glcpp_parser_t *
 
656
 
 
657
/* Holds the entire state of the reentrant scanner. */
 
658
struct yyguts_t
 
659
    {
 
660
 
 
661
    /* User-defined. Not touched by flex. */
 
662
    YY_EXTRA_TYPE yyextra_r;
 
663
 
 
664
    /* The rest are the same as the globals declared in the non-reentrant scanner. */
 
665
    FILE *yyin_r, *yyout_r;
 
666
    size_t yy_buffer_stack_top; /**< index of top of stack. */
 
667
    size_t yy_buffer_stack_max; /**< capacity of stack. */
 
668
    YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
 
669
    char yy_hold_char;
 
670
    int yy_n_chars;
 
671
    int yyleng_r;
 
672
    char *yy_c_buf_p;
 
673
    int yy_init;
 
674
    int yy_start;
 
675
    int yy_did_buffer_switch_on_eof;
 
676
    int yy_start_stack_ptr;
 
677
    int yy_start_stack_depth;
 
678
    int *yy_start_stack;
 
679
    yy_state_type yy_last_accepting_state;
 
680
    char* yy_last_accepting_cpos;
 
681
 
 
682
    int yylineno_r;
 
683
    int yy_flex_debug_r;
 
684
 
 
685
    yy_state_type *yy_state_buf;
 
686
    yy_state_type *yy_state_ptr;
 
687
    char *yy_full_match;
 
688
    int yy_lp;
 
689
 
 
690
    /* These are only needed for trailing context rules,
 
691
     * but there's no conditional variable for that yet. */
 
692
    int yy_looking_for_trail_begin;
 
693
    int yy_full_lp;
 
694
    int *yy_full_state;
 
695
 
 
696
    char *yytext_r;
 
697
    int yy_more_flag;
 
698
    int yy_more_len;
 
699
 
 
700
    YYSTYPE * yylval_r;
 
701
 
 
702
    YYLTYPE * yylloc_r;
 
703
 
 
704
    }; /* end struct yyguts_t */
 
705
 
 
706
static int yy_init_globals (yyscan_t yyscanner );
 
707
 
 
708
    /* This must go here because YYSTYPE and YYLTYPE are included
 
709
     * from bison output in section 1.*/
 
710
    #    define yylval yyg->yylval_r
 
711
    
 
712
    #    define yylloc yyg->yylloc_r
 
713
    
 
714
int glcpp_lex_init (yyscan_t* scanner);
 
715
 
 
716
int glcpp_lex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
 
717
 
 
718
/* Accessor methods to globals.
 
719
   These are made visible to non-reentrant scanners for convenience. */
 
720
 
 
721
int glcpp_lex_destroy (yyscan_t yyscanner );
 
722
 
 
723
int glcpp_get_debug (yyscan_t yyscanner );
 
724
 
 
725
void glcpp_set_debug (int debug_flag ,yyscan_t yyscanner );
 
726
 
 
727
YY_EXTRA_TYPE glcpp_get_extra (yyscan_t yyscanner );
 
728
 
 
729
void glcpp_set_extra (YY_EXTRA_TYPE user_defined ,yyscan_t yyscanner );
 
730
 
 
731
FILE *glcpp_get_in (yyscan_t yyscanner );
 
732
 
 
733
void glcpp_set_in  (FILE * in_str ,yyscan_t yyscanner );
 
734
 
 
735
FILE *glcpp_get_out (yyscan_t yyscanner );
 
736
 
 
737
void glcpp_set_out  (FILE * out_str ,yyscan_t yyscanner );
 
738
 
 
739
int glcpp_get_leng (yyscan_t yyscanner );
 
740
 
 
741
char *glcpp_get_text (yyscan_t yyscanner );
 
742
 
 
743
int glcpp_get_lineno (yyscan_t yyscanner );
 
744
 
 
745
void glcpp_set_lineno (int line_number ,yyscan_t yyscanner );
 
746
 
 
747
int glcpp_get_column  (yyscan_t yyscanner );
 
748
 
 
749
void glcpp_set_column (int column_no ,yyscan_t yyscanner );
 
750
 
 
751
YYSTYPE * glcpp_get_lval (yyscan_t yyscanner );
 
752
 
 
753
void glcpp_set_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
 
754
 
 
755
       YYLTYPE *glcpp_get_lloc (yyscan_t yyscanner );
 
756
    
 
757
        void glcpp_set_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner );
 
758
    
 
759
/* Macros after this point can all be overridden by user definitions in
 
760
 * section 1.
 
761
 */
 
762
 
 
763
#ifndef YY_SKIP_YYWRAP
 
764
#ifdef __cplusplus
 
765
extern "C" int glcpp_wrap (yyscan_t yyscanner );
 
766
#else
 
767
extern int glcpp_wrap (yyscan_t yyscanner );
 
768
#endif
 
769
#endif
 
770
 
 
771
    static void yyunput (int c,char *buf_ptr  ,yyscan_t yyscanner);
 
772
    
 
773
#ifndef yytext_ptr
 
774
static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
 
775
#endif
 
776
 
 
777
#ifdef YY_NEED_STRLEN
 
778
static int yy_flex_strlen (yyconst char * ,yyscan_t yyscanner);
 
779
#endif
 
780
 
 
781
#ifndef YY_NO_INPUT
 
782
 
 
783
#ifdef __cplusplus
 
784
static int yyinput (yyscan_t yyscanner );
 
785
#else
 
786
static int input (yyscan_t yyscanner );
 
787
#endif
 
788
 
 
789
#endif
 
790
 
 
791
    static void yy_push_state (int new_state ,yyscan_t yyscanner);
 
792
    
 
793
    static void yy_pop_state (yyscan_t yyscanner );
 
794
    
 
795
    static int yy_top_state (yyscan_t yyscanner );
 
796
    
 
797
/* Amount of stuff to slurp up with each read. */
 
798
#ifndef YY_READ_BUF_SIZE
 
799
#define YY_READ_BUF_SIZE 8192
 
800
#endif
 
801
 
 
802
/* Copy whatever the last rule matched to the standard output. */
 
803
#ifndef ECHO
 
804
/* This used to be an fputs(), but since the string might contain NUL's,
 
805
 * we now use fwrite().
 
806
 */
 
807
#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
 
808
#endif
 
809
 
 
810
/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
 
811
 * is returned in "result".
 
812
 */
 
813
#ifndef YY_INPUT
 
814
#define YY_INPUT(buf,result,max_size) \
 
815
        if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
 
816
                { \
 
817
                int c = '*'; \
 
818
                unsigned n; \
 
819
                for ( n = 0; n < max_size && \
 
820
                             (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
 
821
                        buf[n] = (char) c; \
 
822
                if ( c == '\n' ) \
 
823
                        buf[n++] = (char) c; \
 
824
                if ( c == EOF && ferror( yyin ) ) \
 
825
                        YY_FATAL_ERROR( "input in flex scanner failed" ); \
 
826
                result = n; \
 
827
                } \
 
828
        else \
 
829
                { \
 
830
                errno=0; \
 
831
                while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
 
832
                        { \
 
833
                        if( errno != EINTR) \
 
834
                                { \
 
835
                                YY_FATAL_ERROR( "input in flex scanner failed" ); \
 
836
                                break; \
 
837
                                } \
 
838
                        errno=0; \
 
839
                        clearerr(yyin); \
 
840
                        } \
 
841
                }\
 
842
\
 
843
 
 
844
#endif
 
845
 
 
846
/* No semi-colon after return; correct usage is to write "yyterminate();" -
 
847
 * we don't want an extra ';' after the "return" because that will cause
 
848
 * some compilers to complain about unreachable statements.
 
849
 */
 
850
#ifndef yyterminate
 
851
#define yyterminate() return YY_NULL
 
852
#endif
 
853
 
 
854
/* Number of entries by which start-condition stack grows. */
 
855
#ifndef YY_START_STACK_INCR
 
856
#define YY_START_STACK_INCR 25
 
857
#endif
 
858
 
 
859
/* Report a fatal error. */
 
860
#ifndef YY_FATAL_ERROR
 
861
#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
 
862
#endif
 
863
 
 
864
/* end tables serialization structures and prototypes */
 
865
 
 
866
/* Default declaration of generated scanner - a define so the user can
 
867
 * easily add parameters.
 
868
 */
 
869
#ifndef YY_DECL
 
870
#define YY_DECL_IS_OURS 1
 
871
 
 
872
extern int glcpp_lex \
 
873
               (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner);
 
874
 
 
875
#define YY_DECL int glcpp_lex \
 
876
               (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner)
 
877
#endif /* !YY_DECL */
 
878
 
 
879
/* Code executed at the beginning of each rule, after yytext and yyleng
 
880
 * have been set up.
 
881
 */
 
882
#ifndef YY_USER_ACTION
 
883
#define YY_USER_ACTION
 
884
#endif
 
885
 
 
886
/* Code executed at the end of each rule. */
 
887
#ifndef YY_BREAK
 
888
#define YY_BREAK break;
 
889
#endif
 
890
 
 
891
#define YY_RULE_SETUP \
 
892
        if ( yyleng > 0 ) \
 
893
                YY_CURRENT_BUFFER_LVALUE->yy_at_bol = \
 
894
                                (yytext[yyleng - 1] == '\n'); \
 
895
        YY_USER_ACTION
 
896
 
 
897
/** The main scanner function which does all the work.
 
898
 */
 
899
YY_DECL
 
900
{
 
901
        register yy_state_type yy_current_state;
 
902
        register char *yy_cp, *yy_bp;
 
903
        register int yy_act;
 
904
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
905
 
 
906
#line 80 "glcpp/glcpp-lex.l"
 
907
 
 
908
        /* Implicitly switch between SKIP and INITIAL (non-skipping);
 
909
         * don't switch if some other state was explicitly set.
 
910
         */
 
911
        glcpp_parser_t *parser = yyextra;
 
912
        if (YY_START == 0 || YY_START == SKIP) {
 
913
                if (parser->lexing_if || parser->skip_stack == NULL || parser->skip_stack->type == SKIP_NO_SKIP) {
 
914
                        BEGIN 0;
 
915
                } else {
 
916
                        BEGIN SKIP;
 
917
                }
 
918
        }
 
919
 
 
920
        /* Single-line comments */
 
921
#line 922 "glcpp/glcpp-lex.c"
 
922
 
 
923
    yylval = yylval_param;
 
924
 
 
925
    yylloc = yylloc_param;
 
926
 
 
927
        if ( !yyg->yy_init )
 
928
                {
 
929
                yyg->yy_init = 1;
 
930
 
 
931
#ifdef YY_USER_INIT
 
932
                YY_USER_INIT;
 
933
#endif
 
934
 
 
935
        /* Create the reject buffer large enough to save one state per allowed character. */
 
936
        if ( ! yyg->yy_state_buf )
 
937
            yyg->yy_state_buf = (yy_state_type *)glcpp_alloc(YY_STATE_BUF_SIZE  ,yyscanner);
 
938
            if ( ! yyg->yy_state_buf )
 
939
                YY_FATAL_ERROR( "out of dynamic memory in glcpp_lex()" );
 
940
 
 
941
                if ( ! yyg->yy_start )
 
942
                        yyg->yy_start = 1;      /* first start state */
 
943
 
 
944
                if ( ! yyin )
 
945
                        yyin = stdin;
 
946
 
 
947
                if ( ! yyout )
 
948
                        yyout = stdout;
 
949
 
 
950
                if ( ! YY_CURRENT_BUFFER ) {
 
951
                        glcpp_ensure_buffer_stack (yyscanner);
 
952
                        YY_CURRENT_BUFFER_LVALUE =
 
953
                                glcpp__create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
 
954
                }
 
955
 
 
956
                glcpp__load_buffer_state(yyscanner );
 
957
                }
 
958
 
 
959
        while ( 1 )             /* loops until end-of-file is reached */
 
960
                {
 
961
                yy_cp = yyg->yy_c_buf_p;
 
962
 
 
963
                /* Support of yytext. */
 
964
                *yy_cp = yyg->yy_hold_char;
 
965
 
 
966
                /* yy_bp points to the position in yy_ch_buf of the start of
 
967
                 * the current run.
 
968
                 */
 
969
                yy_bp = yy_cp;
 
970
 
 
971
                yy_current_state = yyg->yy_start;
 
972
                yy_current_state += YY_AT_BOL();
 
973
 
 
974
                yyg->yy_state_ptr = yyg->yy_state_buf;
 
975
                *yyg->yy_state_ptr++ = yy_current_state;
 
976
 
 
977
yy_match:
 
978
                do
 
979
                        {
 
980
                        register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
 
981
                        while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 
982
                                {
 
983
                                yy_current_state = (int) yy_def[yy_current_state];
 
984
                                if ( yy_current_state >= 154 )
 
985
                                        yy_c = yy_meta[(unsigned int) yy_c];
 
986
                                }
 
987
                        yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
 
988
                        *yyg->yy_state_ptr++ = yy_current_state;
 
989
                        ++yy_cp;
 
990
                        }
 
991
                while ( yy_current_state != 153 );
 
992
 
 
993
yy_find_action:
 
994
                yy_current_state = *--yyg->yy_state_ptr;
 
995
                yyg->yy_lp = yy_accept[yy_current_state];
 
996
find_rule: /* we branch to this label when backing up */
 
997
                for ( ; ; ) /* until we find what rule we matched */
 
998
                        {
 
999
                        if ( yyg->yy_lp && yyg->yy_lp < yy_accept[yy_current_state + 1] )
 
1000
                                {
 
1001
                                yy_act = yy_acclist[yyg->yy_lp];
 
1002
                                if ( yy_act & YY_TRAILING_HEAD_MASK ||
 
1003
                                     yyg->yy_looking_for_trail_begin )
 
1004
                                        {
 
1005
                                        if ( yy_act == yyg->yy_looking_for_trail_begin )
 
1006
                                                {
 
1007
                                                yyg->yy_looking_for_trail_begin = 0;
 
1008
                                                yy_act &= ~YY_TRAILING_HEAD_MASK;
 
1009
                                                break;
 
1010
                                                }
 
1011
                                        }
 
1012
                                else if ( yy_act & YY_TRAILING_MASK )
 
1013
                                        {
 
1014
                                        yyg->yy_looking_for_trail_begin = yy_act & ~YY_TRAILING_MASK;
 
1015
                                        yyg->yy_looking_for_trail_begin |= YY_TRAILING_HEAD_MASK;
 
1016
                                        }
 
1017
                                else
 
1018
                                        {
 
1019
                                        yyg->yy_full_match = yy_cp;
 
1020
                                        yyg->yy_full_state = yyg->yy_state_ptr;
 
1021
                                        yyg->yy_full_lp = yyg->yy_lp;
 
1022
                                        break;
 
1023
                                        }
 
1024
                                ++yyg->yy_lp;
 
1025
                                goto find_rule;
 
1026
                                }
 
1027
                        --yy_cp;
 
1028
                        yy_current_state = *--yyg->yy_state_ptr;
 
1029
                        yyg->yy_lp = yy_accept[yy_current_state];
 
1030
                        }
 
1031
 
 
1032
                YY_DO_BEFORE_ACTION;
 
1033
 
 
1034
do_action:      /* This label is used only to access EOF actions. */
 
1035
 
 
1036
                switch ( yy_act )
 
1037
        { /* beginning of action switch */
 
1038
case 1:
 
1039
YY_RULE_SETUP
 
1040
#line 94 "glcpp/glcpp-lex.l"
 
1041
{
 
1042
}
 
1043
        YY_BREAK
 
1044
/* Multi-line comments */
 
1045
case 2:
 
1046
YY_RULE_SETUP
 
1047
#line 98 "glcpp/glcpp-lex.l"
 
1048
{ yy_push_state(COMMENT, yyscanner); }
 
1049
        YY_BREAK
 
1050
case 3:
 
1051
YY_RULE_SETUP
 
1052
#line 99 "glcpp/glcpp-lex.l"
 
1053
 
 
1054
        YY_BREAK
 
1055
case 4:
 
1056
/* rule 4 can match eol */
 
1057
YY_RULE_SETUP
 
1058
#line 100 "glcpp/glcpp-lex.l"
 
1059
{ yylineno++; yycolumn = 0; return NEWLINE; }
 
1060
        YY_BREAK
 
1061
case 5:
 
1062
YY_RULE_SETUP
 
1063
#line 101 "glcpp/glcpp-lex.l"
 
1064
 
 
1065
        YY_BREAK
 
1066
case 6:
 
1067
/* rule 6 can match eol */
 
1068
YY_RULE_SETUP
 
1069
#line 102 "glcpp/glcpp-lex.l"
 
1070
{ yylineno++; yycolumn = 0; return NEWLINE; }
 
1071
        YY_BREAK
 
1072
case 7:
 
1073
YY_RULE_SETUP
 
1074
#line 103 "glcpp/glcpp-lex.l"
 
1075
{
 
1076
        yy_pop_state(yyscanner);
 
1077
        if (yyextra->space_tokens)
 
1078
                return SPACE;
 
1079
}
 
1080
        YY_BREAK
 
1081
case 8:
 
1082
YY_RULE_SETUP
 
1083
#line 109 "glcpp/glcpp-lex.l"
 
1084
{
 
1085
        yylval->str = ralloc_strdup (yyextra, yytext);
 
1086
        yyextra->space_tokens = 0;
 
1087
        return HASH_VERSION;
 
1088
}
 
1089
        YY_BREAK
 
1090
/* glcpp doesn't handle #extension, #version, or #pragma directives.
 
1091
         * Simply pass them through to the main compiler's lexer/parser. */
 
1092
case 9:
 
1093
YY_RULE_SETUP
 
1094
#line 117 "glcpp/glcpp-lex.l"
 
1095
{
 
1096
        yylval->str = ralloc_strdup (yyextra, yytext);
 
1097
        yylineno++;
 
1098
        yycolumn = 0;
 
1099
        return OTHER;
 
1100
}
 
1101
        YY_BREAK
 
1102
case 10:
 
1103
*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
 
1104
yyg->yy_c_buf_p = yy_cp -= 1;
 
1105
YY_DO_BEFORE_ACTION; /* set up yytext again */
 
1106
YY_RULE_SETUP
 
1107
#line 124 "glcpp/glcpp-lex.l"
 
1108
{
 
1109
        /* Eat characters until the first digit is
 
1110
         * encountered
 
1111
         */
 
1112
        char *ptr = yytext;
 
1113
        while (!isdigit(*ptr))
 
1114
                ptr++;
 
1115
 
 
1116
        /* Subtract one from the line number because
 
1117
         * yylineno is zero-based instead of
 
1118
         * one-based.
 
1119
         */
 
1120
        yylineno = strtol(ptr, &ptr, 0) - 1;
 
1121
        yylloc->source = strtol(ptr, NULL, 0);
 
1122
}
 
1123
        YY_BREAK
 
1124
case 11:
 
1125
*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
 
1126
yyg->yy_c_buf_p = yy_cp -= 1;
 
1127
YY_DO_BEFORE_ACTION; /* set up yytext again */
 
1128
YY_RULE_SETUP
 
1129
#line 140 "glcpp/glcpp-lex.l"
 
1130
{
 
1131
        /* Eat characters until the first digit is
 
1132
         * encountered
 
1133
         */
 
1134
        char *ptr = yytext;
 
1135
        while (!isdigit(*ptr))
 
1136
                ptr++;
 
1137
 
 
1138
        /* Subtract one from the line number because
 
1139
         * yylineno is zero-based instead of
 
1140
         * one-based.
 
1141
         */
 
1142
        yylineno = strtol(ptr, &ptr, 0) - 1;
 
1143
}
 
1144
        YY_BREAK
 
1145
 
 
1146
case 12:
 
1147
YY_RULE_SETUP
 
1148
#line 156 "glcpp/glcpp-lex.l"
 
1149
{
 
1150
        yyextra->lexing_if = 1;
 
1151
        yyextra->space_tokens = 0;
 
1152
        return HASH_IFDEF;
 
1153
}
 
1154
        YY_BREAK
 
1155
case 13:
 
1156
YY_RULE_SETUP
 
1157
#line 162 "glcpp/glcpp-lex.l"
 
1158
{
 
1159
        yyextra->lexing_if = 1;
 
1160
        yyextra->space_tokens = 0;
 
1161
        return HASH_IFNDEF;
 
1162
}
 
1163
        YY_BREAK
 
1164
case 14:
 
1165
/* rule 14 can match eol */
 
1166
*yy_cp = yyg->yy_hold_char; /* undo effects of setting up yytext */
 
1167
yyg->yy_c_buf_p = yy_cp -= 1;
 
1168
YY_DO_BEFORE_ACTION; /* set up yytext again */
 
1169
YY_RULE_SETUP
 
1170
#line 168 "glcpp/glcpp-lex.l"
 
1171
{
 
1172
        yyextra->lexing_if = 1;
 
1173
        yyextra->space_tokens = 0;
 
1174
        return HASH_IF;
 
1175
}
 
1176
        YY_BREAK
 
1177
case 15:
 
1178
YY_RULE_SETUP
 
1179
#line 174 "glcpp/glcpp-lex.l"
 
1180
{
 
1181
        yyextra->lexing_if = 1;
 
1182
        yyextra->space_tokens = 0;
 
1183
        return HASH_ELIF;
 
1184
}
 
1185
        YY_BREAK
 
1186
case 16:
 
1187
YY_RULE_SETUP
 
1188
#line 180 "glcpp/glcpp-lex.l"
 
1189
{
 
1190
        yyextra->space_tokens = 0;
 
1191
        return HASH_ELSE;
 
1192
}
 
1193
        YY_BREAK
 
1194
case 17:
 
1195
YY_RULE_SETUP
 
1196
#line 185 "glcpp/glcpp-lex.l"
 
1197
{
 
1198
        yyextra->space_tokens = 0;
 
1199
        return HASH_ENDIF;
 
1200
}
 
1201
        YY_BREAK
 
1202
 
 
1203
case 18:
 
1204
YY_RULE_SETUP
 
1205
#line 191 "glcpp/glcpp-lex.l"
 
1206
;
 
1207
        YY_BREAK
 
1208
case 19:
 
1209
YY_RULE_SETUP
 
1210
#line 193 "glcpp/glcpp-lex.l"
 
1211
{
 
1212
        char *p;
 
1213
        for (p = yytext; !isalpha(p[0]); p++); /* skip "  #   " */
 
1214
        p += 5; /* skip "error" */
 
1215
        glcpp_error(yylloc, yyextra, "#error%s", p);
 
1216
}
 
1217
        YY_BREAK
 
1218
case 20:
 
1219
YY_RULE_SETUP
 
1220
#line 200 "glcpp/glcpp-lex.l"
 
1221
{
 
1222
        yyextra->space_tokens = 0;
 
1223
        return HASH_DEFINE_FUNC;
 
1224
}
 
1225
        YY_BREAK
 
1226
case 21:
 
1227
YY_RULE_SETUP
 
1228
#line 205 "glcpp/glcpp-lex.l"
 
1229
{
 
1230
        yyextra->space_tokens = 0;
 
1231
        return HASH_DEFINE_OBJ;
 
1232
}
 
1233
        YY_BREAK
 
1234
case 22:
 
1235
YY_RULE_SETUP
 
1236
#line 210 "glcpp/glcpp-lex.l"
 
1237
{
 
1238
        yyextra->space_tokens = 0;
 
1239
        return HASH_UNDEF;
 
1240
}
 
1241
        YY_BREAK
 
1242
case 23:
 
1243
YY_RULE_SETUP
 
1244
#line 215 "glcpp/glcpp-lex.l"
 
1245
{
 
1246
        yyextra->space_tokens = 0;
 
1247
        return HASH;
 
1248
}
 
1249
        YY_BREAK
 
1250
case 24:
 
1251
YY_RULE_SETUP
 
1252
#line 220 "glcpp/glcpp-lex.l"
 
1253
{
 
1254
        yylval->str = ralloc_strdup (yyextra, yytext);
 
1255
        return INTEGER_STRING;
 
1256
}
 
1257
        YY_BREAK
 
1258
case 25:
 
1259
YY_RULE_SETUP
 
1260
#line 225 "glcpp/glcpp-lex.l"
 
1261
{
 
1262
        yylval->str = ralloc_strdup (yyextra, yytext);
 
1263
        return INTEGER_STRING;
 
1264
}
 
1265
        YY_BREAK
 
1266
case 26:
 
1267
YY_RULE_SETUP
 
1268
#line 230 "glcpp/glcpp-lex.l"
 
1269
{
 
1270
        yylval->str = ralloc_strdup (yyextra, yytext);
 
1271
        return INTEGER_STRING;
 
1272
}
 
1273
        YY_BREAK
 
1274
case 27:
 
1275
YY_RULE_SETUP
 
1276
#line 235 "glcpp/glcpp-lex.l"
 
1277
{
 
1278
        return LEFT_SHIFT;
 
1279
}
 
1280
        YY_BREAK
 
1281
case 28:
 
1282
YY_RULE_SETUP
 
1283
#line 239 "glcpp/glcpp-lex.l"
 
1284
{
 
1285
        return RIGHT_SHIFT;
 
1286
}
 
1287
        YY_BREAK
 
1288
case 29:
 
1289
YY_RULE_SETUP
 
1290
#line 243 "glcpp/glcpp-lex.l"
 
1291
{
 
1292
        return LESS_OR_EQUAL;
 
1293
}
 
1294
        YY_BREAK
 
1295
case 30:
 
1296
YY_RULE_SETUP
 
1297
#line 247 "glcpp/glcpp-lex.l"
 
1298
{
 
1299
        return GREATER_OR_EQUAL;
 
1300
}
 
1301
        YY_BREAK
 
1302
case 31:
 
1303
YY_RULE_SETUP
 
1304
#line 251 "glcpp/glcpp-lex.l"
 
1305
{
 
1306
        return EQUAL;
 
1307
}
 
1308
        YY_BREAK
 
1309
case 32:
 
1310
YY_RULE_SETUP
 
1311
#line 255 "glcpp/glcpp-lex.l"
 
1312
{
 
1313
        return NOT_EQUAL;
 
1314
}
 
1315
        YY_BREAK
 
1316
case 33:
 
1317
YY_RULE_SETUP
 
1318
#line 259 "glcpp/glcpp-lex.l"
 
1319
{
 
1320
        return AND;
 
1321
}
 
1322
        YY_BREAK
 
1323
case 34:
 
1324
YY_RULE_SETUP
 
1325
#line 263 "glcpp/glcpp-lex.l"
 
1326
{
 
1327
        return OR;
 
1328
}
 
1329
        YY_BREAK
 
1330
case 35:
 
1331
YY_RULE_SETUP
 
1332
#line 267 "glcpp/glcpp-lex.l"
 
1333
{
 
1334
        return PASTE;
 
1335
}
 
1336
        YY_BREAK
 
1337
case 36:
 
1338
YY_RULE_SETUP
 
1339
#line 271 "glcpp/glcpp-lex.l"
 
1340
{
 
1341
        return DEFINED;
 
1342
}
 
1343
        YY_BREAK
 
1344
case 37:
 
1345
YY_RULE_SETUP
 
1346
#line 275 "glcpp/glcpp-lex.l"
 
1347
{
 
1348
        yylval->str = ralloc_strdup (yyextra, yytext);
 
1349
        return IDENTIFIER;
 
1350
}
 
1351
        YY_BREAK
 
1352
case 38:
 
1353
YY_RULE_SETUP
 
1354
#line 280 "glcpp/glcpp-lex.l"
 
1355
{
 
1356
        return yytext[0];
 
1357
}
 
1358
        YY_BREAK
 
1359
case 39:
 
1360
YY_RULE_SETUP
 
1361
#line 284 "glcpp/glcpp-lex.l"
 
1362
{
 
1363
        yylval->str = ralloc_strdup (yyextra, yytext);
 
1364
        return OTHER;
 
1365
}
 
1366
        YY_BREAK
 
1367
case 40:
 
1368
YY_RULE_SETUP
 
1369
#line 289 "glcpp/glcpp-lex.l"
 
1370
{
 
1371
        if (yyextra->space_tokens) {
 
1372
                return SPACE;
 
1373
        }
 
1374
}
 
1375
        YY_BREAK
 
1376
case 41:
 
1377
/* rule 41 can match eol */
 
1378
YY_RULE_SETUP
 
1379
#line 295 "glcpp/glcpp-lex.l"
 
1380
{
 
1381
        yyextra->lexing_if = 0;
 
1382
        yylineno++;
 
1383
        yycolumn = 0;
 
1384
        return NEWLINE;
 
1385
}
 
1386
        YY_BREAK
 
1387
/* Handle missing newline at EOF. */
 
1388
case YY_STATE_EOF(INITIAL):
 
1389
#line 303 "glcpp/glcpp-lex.l"
 
1390
{
 
1391
        BEGIN DONE; /* Don't keep matching this rule forever. */
 
1392
        yyextra->lexing_if = 0;
 
1393
        return NEWLINE;
 
1394
}
 
1395
        YY_BREAK
 
1396
/* We don't actually use the UNREACHABLE start condition. We
 
1397
        only have this action here so that we can pretend to call some
 
1398
        generated functions, (to avoid "defined but not used"
 
1399
        warnings. */
 
1400
case 42:
 
1401
YY_RULE_SETUP
 
1402
#line 313 "glcpp/glcpp-lex.l"
 
1403
{
 
1404
        unput('.');
 
1405
        yy_top_state(yyextra);
 
1406
}
 
1407
        YY_BREAK
 
1408
case 43:
 
1409
YY_RULE_SETUP
 
1410
#line 318 "glcpp/glcpp-lex.l"
 
1411
ECHO;
 
1412
        YY_BREAK
 
1413
#line 1414 "glcpp/glcpp-lex.c"
 
1414
                        case YY_STATE_EOF(DONE):
 
1415
                        case YY_STATE_EOF(COMMENT):
 
1416
                        case YY_STATE_EOF(UNREACHABLE):
 
1417
                        case YY_STATE_EOF(SKIP):
 
1418
                                yyterminate();
 
1419
 
 
1420
        case YY_END_OF_BUFFER:
 
1421
                {
 
1422
                /* Amount of text matched not including the EOB char. */
 
1423
                int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
 
1424
 
 
1425
                /* Undo the effects of YY_DO_BEFORE_ACTION. */
 
1426
                *yy_cp = yyg->yy_hold_char;
 
1427
                YY_RESTORE_YY_MORE_OFFSET
 
1428
 
 
1429
                if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
 
1430
                        {
 
1431
                        /* We're scanning a new file or input source.  It's
 
1432
                         * possible that this happened because the user
 
1433
                         * just pointed yyin at a new source and called
 
1434
                         * glcpp_lex().  If so, then we have to assure
 
1435
                         * consistency between YY_CURRENT_BUFFER and our
 
1436
                         * globals.  Here is the right place to do so, because
 
1437
                         * this is the first action (other than possibly a
 
1438
                         * back-up) that will match for the new input source.
 
1439
                         */
 
1440
                        yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
 
1441
                        YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
 
1442
                        YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
 
1443
                        }
 
1444
 
 
1445
                /* Note that here we test for yy_c_buf_p "<=" to the position
 
1446
                 * of the first EOB in the buffer, since yy_c_buf_p will
 
1447
                 * already have been incremented past the NUL character
 
1448
                 * (since all states make transitions on EOB to the
 
1449
                 * end-of-buffer state).  Contrast this with the test
 
1450
                 * in input().
 
1451
                 */
 
1452
                if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
 
1453
                        { /* This was really a NUL. */
 
1454
                        yy_state_type yy_next_state;
 
1455
 
 
1456
                        yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
 
1457
 
 
1458
                        yy_current_state = yy_get_previous_state( yyscanner );
 
1459
 
 
1460
                        /* Okay, we're now positioned to make the NUL
 
1461
                         * transition.  We couldn't have
 
1462
                         * yy_get_previous_state() go ahead and do it
 
1463
                         * for us because it doesn't know how to deal
 
1464
                         * with the possibility of jamming (and we don't
 
1465
                         * want to build jamming into it because then it
 
1466
                         * will run more slowly).
 
1467
                         */
 
1468
 
 
1469
                        yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
 
1470
 
 
1471
                        yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
 
1472
 
 
1473
                        if ( yy_next_state )
 
1474
                                {
 
1475
                                /* Consume the NUL. */
 
1476
                                yy_cp = ++yyg->yy_c_buf_p;
 
1477
                                yy_current_state = yy_next_state;
 
1478
                                goto yy_match;
 
1479
                                }
 
1480
 
 
1481
                        else
 
1482
                                {
 
1483
                                yy_cp = yyg->yy_c_buf_p;
 
1484
                                goto yy_find_action;
 
1485
                                }
 
1486
                        }
 
1487
 
 
1488
                else switch ( yy_get_next_buffer( yyscanner ) )
 
1489
                        {
 
1490
                        case EOB_ACT_END_OF_FILE:
 
1491
                                {
 
1492
                                yyg->yy_did_buffer_switch_on_eof = 0;
 
1493
 
 
1494
                                if ( glcpp_wrap(yyscanner ) )
 
1495
                                        {
 
1496
                                        /* Note: because we've taken care in
 
1497
                                         * yy_get_next_buffer() to have set up
 
1498
                                         * yytext, we can now set up
 
1499
                                         * yy_c_buf_p so that if some total
 
1500
                                         * hoser (like flex itself) wants to
 
1501
                                         * call the scanner after we return the
 
1502
                                         * YY_NULL, it'll still work - another
 
1503
                                         * YY_NULL will get returned.
 
1504
                                         */
 
1505
                                        yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
 
1506
 
 
1507
                                        yy_act = YY_STATE_EOF(YY_START);
 
1508
                                        goto do_action;
 
1509
                                        }
 
1510
 
 
1511
                                else
 
1512
                                        {
 
1513
                                        if ( ! yyg->yy_did_buffer_switch_on_eof )
 
1514
                                                YY_NEW_FILE;
 
1515
                                        }
 
1516
                                break;
 
1517
                                }
 
1518
 
 
1519
                        case EOB_ACT_CONTINUE_SCAN:
 
1520
                                yyg->yy_c_buf_p =
 
1521
                                        yyg->yytext_ptr + yy_amount_of_matched_text;
 
1522
 
 
1523
                                yy_current_state = yy_get_previous_state( yyscanner );
 
1524
 
 
1525
                                yy_cp = yyg->yy_c_buf_p;
 
1526
                                yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
 
1527
                                goto yy_match;
 
1528
 
 
1529
                        case EOB_ACT_LAST_MATCH:
 
1530
                                yyg->yy_c_buf_p =
 
1531
                                &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
 
1532
 
 
1533
                                yy_current_state = yy_get_previous_state( yyscanner );
 
1534
 
 
1535
                                yy_cp = yyg->yy_c_buf_p;
 
1536
                                yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
 
1537
                                goto yy_find_action;
 
1538
                        }
 
1539
                break;
 
1540
                }
 
1541
 
 
1542
        default:
 
1543
                YY_FATAL_ERROR(
 
1544
                        "fatal flex scanner internal error--no action found" );
 
1545
        } /* end of action switch */
 
1546
                } /* end of scanning one token */
 
1547
} /* end of glcpp_lex */
 
1548
 
 
1549
/* yy_get_next_buffer - try to read in a new buffer
 
1550
 *
 
1551
 * Returns a code representing an action:
 
1552
 *      EOB_ACT_LAST_MATCH -
 
1553
 *      EOB_ACT_CONTINUE_SCAN - continue scanning from current position
 
1554
 *      EOB_ACT_END_OF_FILE - end of file
 
1555
 */
 
1556
static int yy_get_next_buffer (yyscan_t yyscanner)
 
1557
{
 
1558
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
1559
        register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
 
1560
        register char *source = yyg->yytext_ptr;
 
1561
        register int number_to_move, i;
 
1562
        int ret_val;
 
1563
 
 
1564
        if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
 
1565
                YY_FATAL_ERROR(
 
1566
                "fatal flex scanner internal error--end of buffer missed" );
 
1567
 
 
1568
        if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
 
1569
                { /* Don't try to fill the buffer, so this is an EOF. */
 
1570
                if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
 
1571
                        {
 
1572
                        /* We matched a single character, the EOB, so
 
1573
                         * treat this as a final EOF.
 
1574
                         */
 
1575
                        return EOB_ACT_END_OF_FILE;
 
1576
                        }
 
1577
 
 
1578
                else
 
1579
                        {
 
1580
                        /* We matched some text prior to the EOB, first
 
1581
                         * process it.
 
1582
                         */
 
1583
                        return EOB_ACT_LAST_MATCH;
 
1584
                        }
 
1585
                }
 
1586
 
 
1587
        /* Try to read more data. */
 
1588
 
 
1589
        /* First move last chars to start of buffer. */
 
1590
        number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1;
 
1591
 
 
1592
        for ( i = 0; i < number_to_move; ++i )
 
1593
                *(dest++) = *(source++);
 
1594
 
 
1595
        if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
 
1596
                /* don't do the read, it's not guaranteed to return an EOF,
 
1597
                 * just force an EOF
 
1598
                 */
 
1599
                YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
 
1600
 
 
1601
        else
 
1602
                {
 
1603
                        int num_to_read =
 
1604
                        YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
 
1605
 
 
1606
                while ( num_to_read <= 0 )
 
1607
                        { /* Not enough room in the buffer - grow it. */
 
1608
 
 
1609
                        YY_FATAL_ERROR(
 
1610
"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
 
1611
 
 
1612
                        }
 
1613
 
 
1614
                if ( num_to_read > YY_READ_BUF_SIZE )
 
1615
                        num_to_read = YY_READ_BUF_SIZE;
 
1616
 
 
1617
                /* Read in more data. */
 
1618
                YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
 
1619
                        yyg->yy_n_chars, (size_t) num_to_read );
 
1620
 
 
1621
                YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
 
1622
                }
 
1623
 
 
1624
        if ( yyg->yy_n_chars == 0 )
 
1625
                {
 
1626
                if ( number_to_move == YY_MORE_ADJ )
 
1627
                        {
 
1628
                        ret_val = EOB_ACT_END_OF_FILE;
 
1629
                        glcpp_restart(yyin  ,yyscanner);
 
1630
                        }
 
1631
 
 
1632
                else
 
1633
                        {
 
1634
                        ret_val = EOB_ACT_LAST_MATCH;
 
1635
                        YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
 
1636
                                YY_BUFFER_EOF_PENDING;
 
1637
                        }
 
1638
                }
 
1639
 
 
1640
        else
 
1641
                ret_val = EOB_ACT_CONTINUE_SCAN;
 
1642
 
 
1643
        if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
 
1644
                /* Extend the array by 50%, plus the number we really need. */
 
1645
                yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
 
1646
                YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) glcpp_realloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner );
 
1647
                if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
 
1648
                        YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
 
1649
        }
 
1650
 
 
1651
        yyg->yy_n_chars += number_to_move;
 
1652
        YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
 
1653
        YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
 
1654
 
 
1655
        yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
 
1656
 
 
1657
        return ret_val;
 
1658
}
 
1659
 
 
1660
/* yy_get_previous_state - get the state just before the EOB char was reached */
 
1661
 
 
1662
    static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
 
1663
{
 
1664
        register yy_state_type yy_current_state;
 
1665
        register char *yy_cp;
 
1666
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
1667
 
 
1668
        yy_current_state = yyg->yy_start;
 
1669
        yy_current_state += YY_AT_BOL();
 
1670
 
 
1671
        yyg->yy_state_ptr = yyg->yy_state_buf;
 
1672
        *yyg->yy_state_ptr++ = yy_current_state;
 
1673
 
 
1674
        for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
 
1675
                {
 
1676
                register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
 
1677
                while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 
1678
                        {
 
1679
                        yy_current_state = (int) yy_def[yy_current_state];
 
1680
                        if ( yy_current_state >= 154 )
 
1681
                                yy_c = yy_meta[(unsigned int) yy_c];
 
1682
                        }
 
1683
                yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
 
1684
                *yyg->yy_state_ptr++ = yy_current_state;
 
1685
                }
 
1686
 
 
1687
        return yy_current_state;
 
1688
}
 
1689
 
 
1690
/* yy_try_NUL_trans - try to make a transition on the NUL character
 
1691
 *
 
1692
 * synopsis
 
1693
 *      next_state = yy_try_NUL_trans( current_state );
 
1694
 */
 
1695
    static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state , yyscan_t yyscanner)
 
1696
{
 
1697
        register int yy_is_jam;
 
1698
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
 
1699
 
 
1700
        register YY_CHAR yy_c = 1;
 
1701
        while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 
1702
                {
 
1703
                yy_current_state = (int) yy_def[yy_current_state];
 
1704
                if ( yy_current_state >= 154 )
 
1705
                        yy_c = yy_meta[(unsigned int) yy_c];
 
1706
                }
 
1707
        yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
 
1708
        yy_is_jam = (yy_current_state == 153);
 
1709
        if ( ! yy_is_jam )
 
1710
                *yyg->yy_state_ptr++ = yy_current_state;
 
1711
 
 
1712
        return yy_is_jam ? 0 : yy_current_state;
 
1713
}
 
1714
 
 
1715
    static void yyunput (int c, register char * yy_bp , yyscan_t yyscanner)
 
1716
{
 
1717
        register char *yy_cp;
 
1718
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
1719
 
 
1720
    yy_cp = yyg->yy_c_buf_p;
 
1721
 
 
1722
        /* undo effects of setting up yytext */
 
1723
        *yy_cp = yyg->yy_hold_char;
 
1724
 
 
1725
        if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
 
1726
                { /* need to shift things up to make room */
 
1727
                /* +2 for EOB chars. */
 
1728
                register int number_to_move = yyg->yy_n_chars + 2;
 
1729
                register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
 
1730
                                        YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
 
1731
                register char *source =
 
1732
                                &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
 
1733
 
 
1734
                while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
 
1735
                        *--dest = *--source;
 
1736
 
 
1737
                yy_cp += (int) (dest - source);
 
1738
                yy_bp += (int) (dest - source);
 
1739
                YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
 
1740
                        yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
 
1741
 
 
1742
                if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
 
1743
                        YY_FATAL_ERROR( "flex scanner push-back overflow" );
 
1744
                }
 
1745
 
 
1746
        *--yy_cp = (char) c;
 
1747
 
 
1748
        yyg->yytext_ptr = yy_bp;
 
1749
        yyg->yy_hold_char = *yy_cp;
 
1750
        yyg->yy_c_buf_p = yy_cp;
 
1751
}
 
1752
 
 
1753
#ifndef YY_NO_INPUT
 
1754
#ifdef __cplusplus
 
1755
    static int yyinput (yyscan_t yyscanner)
 
1756
#else
 
1757
    static int input  (yyscan_t yyscanner)
 
1758
#endif
 
1759
 
 
1760
{
 
1761
        int c;
 
1762
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
1763
 
 
1764
        *yyg->yy_c_buf_p = yyg->yy_hold_char;
 
1765
 
 
1766
        if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
 
1767
                {
 
1768
                /* yy_c_buf_p now points to the character we want to return.
 
1769
                 * If this occurs *before* the EOB characters, then it's a
 
1770
                 * valid NUL; if not, then we've hit the end of the buffer.
 
1771
                 */
 
1772
                if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
 
1773
                        /* This was really a NUL. */
 
1774
                        *yyg->yy_c_buf_p = '\0';
 
1775
 
 
1776
                else
 
1777
                        { /* need more input */
 
1778
                        int offset = yyg->yy_c_buf_p - yyg->yytext_ptr;
 
1779
                        ++yyg->yy_c_buf_p;
 
1780
 
 
1781
                        switch ( yy_get_next_buffer( yyscanner ) )
 
1782
                                {
 
1783
                                case EOB_ACT_LAST_MATCH:
 
1784
                                        /* This happens because yy_g_n_b()
 
1785
                                         * sees that we've accumulated a
 
1786
                                         * token and flags that we need to
 
1787
                                         * try matching the token before
 
1788
                                         * proceeding.  But for input(),
 
1789
                                         * there's no matching to consider.
 
1790
                                         * So convert the EOB_ACT_LAST_MATCH
 
1791
                                         * to EOB_ACT_END_OF_FILE.
 
1792
                                         */
 
1793
 
 
1794
                                        /* Reset buffer status. */
 
1795
                                        glcpp_restart(yyin ,yyscanner);
 
1796
 
 
1797
                                        /*FALLTHROUGH*/
 
1798
 
 
1799
                                case EOB_ACT_END_OF_FILE:
 
1800
                                        {
 
1801
                                        if ( glcpp_wrap(yyscanner ) )
 
1802
                                                return EOF;
 
1803
 
 
1804
                                        if ( ! yyg->yy_did_buffer_switch_on_eof )
 
1805
                                                YY_NEW_FILE;
 
1806
#ifdef __cplusplus
 
1807
                                        return yyinput(yyscanner);
 
1808
#else
 
1809
                                        return input(yyscanner);
 
1810
#endif
 
1811
                                        }
 
1812
 
 
1813
                                case EOB_ACT_CONTINUE_SCAN:
 
1814
                                        yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
 
1815
                                        break;
 
1816
                                }
 
1817
                        }
 
1818
                }
 
1819
 
 
1820
        c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */
 
1821
        *yyg->yy_c_buf_p = '\0';        /* preserve yytext */
 
1822
        yyg->yy_hold_char = *++yyg->yy_c_buf_p;
 
1823
 
 
1824
        YY_CURRENT_BUFFER_LVALUE->yy_at_bol = (c == '\n');
 
1825
 
 
1826
        return c;
 
1827
}
 
1828
#endif  /* ifndef YY_NO_INPUT */
 
1829
 
 
1830
/** Immediately switch to a different input stream.
 
1831
 * @param input_file A readable stream.
 
1832
 * @param yyscanner The scanner object.
 
1833
 * @note This function does not reset the start condition to @c INITIAL .
 
1834
 */
 
1835
    void glcpp_restart  (FILE * input_file , yyscan_t yyscanner)
 
1836
{
 
1837
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
1838
 
 
1839
        if ( ! YY_CURRENT_BUFFER ){
 
1840
        glcpp_ensure_buffer_stack (yyscanner);
 
1841
                YY_CURRENT_BUFFER_LVALUE =
 
1842
            glcpp__create_buffer(yyin,YY_BUF_SIZE ,yyscanner);
 
1843
        }
 
1844
 
 
1845
        glcpp__init_buffer(YY_CURRENT_BUFFER,input_file ,yyscanner);
 
1846
        glcpp__load_buffer_state(yyscanner );
 
1847
}
 
1848
 
 
1849
/** Switch to a different input buffer.
 
1850
 * @param new_buffer The new input buffer.
 
1851
 * @param yyscanner The scanner object.
 
1852
 */
 
1853
    void glcpp__switch_to_buffer  (YY_BUFFER_STATE  new_buffer , yyscan_t yyscanner)
 
1854
{
 
1855
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
1856
 
 
1857
        /* TODO. We should be able to replace this entire function body
 
1858
         * with
 
1859
         *              glcpp_pop_buffer_state();
 
1860
         *              glcpp_push_buffer_state(new_buffer);
 
1861
     */
 
1862
        glcpp_ensure_buffer_stack (yyscanner);
 
1863
        if ( YY_CURRENT_BUFFER == new_buffer )
 
1864
                return;
 
1865
 
 
1866
        if ( YY_CURRENT_BUFFER )
 
1867
                {
 
1868
                /* Flush out information for old buffer. */
 
1869
                *yyg->yy_c_buf_p = yyg->yy_hold_char;
 
1870
                YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
 
1871
                YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
 
1872
                }
 
1873
 
 
1874
        YY_CURRENT_BUFFER_LVALUE = new_buffer;
 
1875
        glcpp__load_buffer_state(yyscanner );
 
1876
 
 
1877
        /* We don't actually know whether we did this switch during
 
1878
         * EOF (glcpp_wrap()) processing, but the only time this flag
 
1879
         * is looked at is after glcpp_wrap() is called, so it's safe
 
1880
         * to go ahead and always set it.
 
1881
         */
 
1882
        yyg->yy_did_buffer_switch_on_eof = 1;
 
1883
}
 
1884
 
 
1885
static void glcpp__load_buffer_state  (yyscan_t yyscanner)
 
1886
{
 
1887
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
1888
        yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
 
1889
        yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
 
1890
        yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
 
1891
        yyg->yy_hold_char = *yyg->yy_c_buf_p;
 
1892
}
 
1893
 
 
1894
/** Allocate and initialize an input buffer state.
 
1895
 * @param file A readable stream.
 
1896
 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
 
1897
 * @param yyscanner The scanner object.
 
1898
 * @return the allocated buffer state.
 
1899
 */
 
1900
    YY_BUFFER_STATE glcpp__create_buffer  (FILE * file, int  size , yyscan_t yyscanner)
 
1901
{
 
1902
        YY_BUFFER_STATE b;
 
1903
    
 
1904
        b = (YY_BUFFER_STATE) glcpp_alloc(sizeof( struct yy_buffer_state ) ,yyscanner );
 
1905
        if ( ! b )
 
1906
                YY_FATAL_ERROR( "out of dynamic memory in glcpp__create_buffer()" );
 
1907
 
 
1908
        b->yy_buf_size = size;
 
1909
 
 
1910
        /* yy_ch_buf has to be 2 characters longer than the size given because
 
1911
         * we need to put in 2 end-of-buffer characters.
 
1912
         */
 
1913
        b->yy_ch_buf = (char *) glcpp_alloc(b->yy_buf_size + 2 ,yyscanner );
 
1914
        if ( ! b->yy_ch_buf )
 
1915
                YY_FATAL_ERROR( "out of dynamic memory in glcpp__create_buffer()" );
 
1916
 
 
1917
        b->yy_is_our_buffer = 1;
 
1918
 
 
1919
        glcpp__init_buffer(b,file ,yyscanner);
 
1920
 
 
1921
        return b;
 
1922
}
 
1923
 
 
1924
/** Destroy the buffer.
 
1925
 * @param b a buffer created with glcpp__create_buffer()
 
1926
 * @param yyscanner The scanner object.
 
1927
 */
 
1928
    void glcpp__delete_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)
 
1929
{
 
1930
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
1931
 
 
1932
        if ( ! b )
 
1933
                return;
 
1934
 
 
1935
        if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
 
1936
                YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
 
1937
 
 
1938
        if ( b->yy_is_our_buffer )
 
1939
                glcpp_free((void *) b->yy_ch_buf ,yyscanner );
 
1940
 
 
1941
        glcpp_free((void *) b ,yyscanner );
 
1942
}
 
1943
 
 
1944
/* Initializes or reinitializes a buffer.
 
1945
 * This function is sometimes called more than once on the same buffer,
 
1946
 * such as during a glcpp_restart() or at EOF.
 
1947
 */
 
1948
    static void glcpp__init_buffer  (YY_BUFFER_STATE  b, FILE * file , yyscan_t yyscanner)
 
1949
 
 
1950
{
 
1951
        int oerrno = errno;
 
1952
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
1953
 
 
1954
        glcpp__flush_buffer(b ,yyscanner);
 
1955
 
 
1956
        b->yy_input_file = file;
 
1957
        b->yy_fill_buffer = 1;
 
1958
 
 
1959
    /* If b is the current buffer, then glcpp__init_buffer was _probably_
 
1960
     * called from glcpp_restart() or through yy_get_next_buffer.
 
1961
     * In that case, we don't want to reset the lineno or column.
 
1962
     */
 
1963
    if (b != YY_CURRENT_BUFFER){
 
1964
        b->yy_bs_lineno = 1;
 
1965
        b->yy_bs_column = 0;
 
1966
    }
 
1967
 
 
1968
        b->yy_is_interactive = 0;
 
1969
    
 
1970
        errno = oerrno;
 
1971
}
 
1972
 
 
1973
/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
 
1974
 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
 
1975
 * @param yyscanner The scanner object.
 
1976
 */
 
1977
    void glcpp__flush_buffer (YY_BUFFER_STATE  b , yyscan_t yyscanner)
 
1978
{
 
1979
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
1980
        if ( ! b )
 
1981
                return;
 
1982
 
 
1983
        b->yy_n_chars = 0;
 
1984
 
 
1985
        /* We always need two end-of-buffer characters.  The first causes
 
1986
         * a transition to the end-of-buffer state.  The second causes
 
1987
         * a jam in that state.
 
1988
         */
 
1989
        b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
 
1990
        b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
 
1991
 
 
1992
        b->yy_buf_pos = &b->yy_ch_buf[0];
 
1993
 
 
1994
        b->yy_at_bol = 1;
 
1995
        b->yy_buffer_status = YY_BUFFER_NEW;
 
1996
 
 
1997
        if ( b == YY_CURRENT_BUFFER )
 
1998
                glcpp__load_buffer_state(yyscanner );
 
1999
}
 
2000
 
 
2001
/** Pushes the new state onto the stack. The new state becomes
 
2002
 *  the current state. This function will allocate the stack
 
2003
 *  if necessary.
 
2004
 *  @param new_buffer The new state.
 
2005
 *  @param yyscanner The scanner object.
 
2006
 */
 
2007
void glcpp_push_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
 
2008
{
 
2009
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
2010
        if (new_buffer == NULL)
 
2011
                return;
 
2012
 
 
2013
        glcpp_ensure_buffer_stack(yyscanner);
 
2014
 
 
2015
        /* This block is copied from glcpp__switch_to_buffer. */
 
2016
        if ( YY_CURRENT_BUFFER )
 
2017
                {
 
2018
                /* Flush out information for old buffer. */
 
2019
                *yyg->yy_c_buf_p = yyg->yy_hold_char;
 
2020
                YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
 
2021
                YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
 
2022
                }
 
2023
 
 
2024
        /* Only push if top exists. Otherwise, replace top. */
 
2025
        if (YY_CURRENT_BUFFER)
 
2026
                yyg->yy_buffer_stack_top++;
 
2027
        YY_CURRENT_BUFFER_LVALUE = new_buffer;
 
2028
 
 
2029
        /* copied from glcpp__switch_to_buffer. */
 
2030
        glcpp__load_buffer_state(yyscanner );
 
2031
        yyg->yy_did_buffer_switch_on_eof = 1;
 
2032
}
 
2033
 
 
2034
/** Removes and deletes the top of the stack, if present.
 
2035
 *  The next element becomes the new top.
 
2036
 *  @param yyscanner The scanner object.
 
2037
 */
 
2038
void glcpp_pop_buffer_state (yyscan_t yyscanner)
 
2039
{
 
2040
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
2041
        if (!YY_CURRENT_BUFFER)
 
2042
                return;
 
2043
 
 
2044
        glcpp__delete_buffer(YY_CURRENT_BUFFER ,yyscanner);
 
2045
        YY_CURRENT_BUFFER_LVALUE = NULL;
 
2046
        if (yyg->yy_buffer_stack_top > 0)
 
2047
                --yyg->yy_buffer_stack_top;
 
2048
 
 
2049
        if (YY_CURRENT_BUFFER) {
 
2050
                glcpp__load_buffer_state(yyscanner );
 
2051
                yyg->yy_did_buffer_switch_on_eof = 1;
 
2052
        }
 
2053
}
 
2054
 
 
2055
/* Allocates the stack if it does not exist.
 
2056
 *  Guarantees space for at least one push.
 
2057
 */
 
2058
static void glcpp_ensure_buffer_stack (yyscan_t yyscanner)
 
2059
{
 
2060
        int num_to_alloc;
 
2061
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
2062
 
 
2063
        if (!yyg->yy_buffer_stack) {
 
2064
 
 
2065
                /* First allocation is just for 2 elements, since we don't know if this
 
2066
                 * scanner will even need a stack. We use 2 instead of 1 to avoid an
 
2067
                 * immediate realloc on the next call.
 
2068
         */
 
2069
                num_to_alloc = 1;
 
2070
                yyg->yy_buffer_stack = (struct yy_buffer_state**)glcpp_alloc
 
2071
                                                                (num_to_alloc * sizeof(struct yy_buffer_state*)
 
2072
                                                                , yyscanner);
 
2073
                if ( ! yyg->yy_buffer_stack )
 
2074
                        YY_FATAL_ERROR( "out of dynamic memory in glcpp_ensure_buffer_stack()" );
 
2075
                                                                  
 
2076
                memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
 
2077
                                
 
2078
                yyg->yy_buffer_stack_max = num_to_alloc;
 
2079
                yyg->yy_buffer_stack_top = 0;
 
2080
                return;
 
2081
        }
 
2082
 
 
2083
        if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
 
2084
 
 
2085
                /* Increase the buffer to prepare for a possible push. */
 
2086
                int grow_size = 8 /* arbitrary grow size */;
 
2087
 
 
2088
                num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
 
2089
                yyg->yy_buffer_stack = (struct yy_buffer_state**)glcpp_realloc
 
2090
                                                                (yyg->yy_buffer_stack,
 
2091
                                                                num_to_alloc * sizeof(struct yy_buffer_state*)
 
2092
                                                                , yyscanner);
 
2093
                if ( ! yyg->yy_buffer_stack )
 
2094
                        YY_FATAL_ERROR( "out of dynamic memory in glcpp_ensure_buffer_stack()" );
 
2095
 
 
2096
                /* zero only the new slots.*/
 
2097
                memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
 
2098
                yyg->yy_buffer_stack_max = num_to_alloc;
 
2099
        }
 
2100
}
 
2101
 
 
2102
/** Setup the input buffer state to scan directly from a user-specified character buffer.
 
2103
 * @param base the character buffer
 
2104
 * @param size the size in bytes of the character buffer
 
2105
 * @param yyscanner The scanner object.
 
2106
 * @return the newly allocated buffer state object. 
 
2107
 */
 
2108
YY_BUFFER_STATE glcpp__scan_buffer  (char * base, yy_size_t  size , yyscan_t yyscanner)
 
2109
{
 
2110
        YY_BUFFER_STATE b;
 
2111
    
 
2112
        if ( size < 2 ||
 
2113
             base[size-2] != YY_END_OF_BUFFER_CHAR ||
 
2114
             base[size-1] != YY_END_OF_BUFFER_CHAR )
 
2115
                /* They forgot to leave room for the EOB's. */
 
2116
                return 0;
 
2117
 
 
2118
        b = (YY_BUFFER_STATE) glcpp_alloc(sizeof( struct yy_buffer_state ) ,yyscanner );
 
2119
        if ( ! b )
 
2120
                YY_FATAL_ERROR( "out of dynamic memory in glcpp__scan_buffer()" );
 
2121
 
 
2122
        b->yy_buf_size = size - 2;      /* "- 2" to take care of EOB's */
 
2123
        b->yy_buf_pos = b->yy_ch_buf = base;
 
2124
        b->yy_is_our_buffer = 0;
 
2125
        b->yy_input_file = 0;
 
2126
        b->yy_n_chars = b->yy_buf_size;
 
2127
        b->yy_is_interactive = 0;
 
2128
        b->yy_at_bol = 1;
 
2129
        b->yy_fill_buffer = 0;
 
2130
        b->yy_buffer_status = YY_BUFFER_NEW;
 
2131
 
 
2132
        glcpp__switch_to_buffer(b ,yyscanner );
 
2133
 
 
2134
        return b;
 
2135
}
 
2136
 
 
2137
/** Setup the input buffer state to scan a string. The next call to glcpp_lex() will
 
2138
 * scan from a @e copy of @a str.
 
2139
 * @param yystr a NUL-terminated string to scan
 
2140
 * @param yyscanner The scanner object.
 
2141
 * @return the newly allocated buffer state object.
 
2142
 * @note If you want to scan bytes that may contain NUL values, then use
 
2143
 *       glcpp__scan_bytes() instead.
 
2144
 */
 
2145
YY_BUFFER_STATE glcpp__scan_string (yyconst char * yystr , yyscan_t yyscanner)
 
2146
{
 
2147
    
 
2148
        return glcpp__scan_bytes(yystr,strlen(yystr) ,yyscanner);
 
2149
}
 
2150
 
 
2151
/** Setup the input buffer state to scan the given bytes. The next call to glcpp_lex() will
 
2152
 * scan from a @e copy of @a bytes.
 
2153
 * @param bytes the byte buffer to scan
 
2154
 * @param len the number of bytes in the buffer pointed to by @a bytes.
 
2155
 * @param yyscanner The scanner object.
 
2156
 * @return the newly allocated buffer state object.
 
2157
 */
 
2158
YY_BUFFER_STATE glcpp__scan_bytes  (yyconst char * yybytes, int  _yybytes_len , yyscan_t yyscanner)
 
2159
{
 
2160
        YY_BUFFER_STATE b;
 
2161
        char *buf;
 
2162
        yy_size_t n;
 
2163
        int i;
 
2164
    
 
2165
        /* Get memory for full buffer, including space for trailing EOB's. */
 
2166
        n = _yybytes_len + 2;
 
2167
        buf = (char *) glcpp_alloc(n ,yyscanner );
 
2168
        if ( ! buf )
 
2169
                YY_FATAL_ERROR( "out of dynamic memory in glcpp__scan_bytes()" );
 
2170
 
 
2171
        for ( i = 0; i < _yybytes_len; ++i )
 
2172
                buf[i] = yybytes[i];
 
2173
 
 
2174
        buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
 
2175
 
 
2176
        b = glcpp__scan_buffer(buf,n ,yyscanner);
 
2177
        if ( ! b )
 
2178
                YY_FATAL_ERROR( "bad buffer in glcpp__scan_bytes()" );
 
2179
 
 
2180
        /* It's okay to grow etc. this buffer, and we should throw it
 
2181
         * away when we're done.
 
2182
         */
 
2183
        b->yy_is_our_buffer = 1;
 
2184
 
 
2185
        return b;
 
2186
}
 
2187
 
 
2188
    static void yy_push_state (int  new_state , yyscan_t yyscanner)
 
2189
{
 
2190
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
2191
        if ( yyg->yy_start_stack_ptr >= yyg->yy_start_stack_depth )
 
2192
                {
 
2193
                yy_size_t new_size;
 
2194
 
 
2195
                yyg->yy_start_stack_depth += YY_START_STACK_INCR;
 
2196
                new_size = yyg->yy_start_stack_depth * sizeof( int );
 
2197
 
 
2198
                if ( ! yyg->yy_start_stack )
 
2199
                        yyg->yy_start_stack = (int *) glcpp_alloc(new_size ,yyscanner );
 
2200
 
 
2201
                else
 
2202
                        yyg->yy_start_stack = (int *) glcpp_realloc((void *) yyg->yy_start_stack,new_size ,yyscanner );
 
2203
 
 
2204
                if ( ! yyg->yy_start_stack )
 
2205
                        YY_FATAL_ERROR( "out of memory expanding start-condition stack" );
 
2206
                }
 
2207
 
 
2208
        yyg->yy_start_stack[yyg->yy_start_stack_ptr++] = YY_START;
 
2209
 
 
2210
        BEGIN(new_state);
 
2211
}
 
2212
 
 
2213
    static void yy_pop_state  (yyscan_t yyscanner)
 
2214
{
 
2215
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
2216
        if ( --yyg->yy_start_stack_ptr < 0 )
 
2217
                YY_FATAL_ERROR( "start-condition stack underflow" );
 
2218
 
 
2219
        BEGIN(yyg->yy_start_stack[yyg->yy_start_stack_ptr]);
 
2220
}
 
2221
 
 
2222
    static int yy_top_state  (yyscan_t yyscanner)
 
2223
{
 
2224
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
2225
        return yyg->yy_start_stack[yyg->yy_start_stack_ptr - 1];
 
2226
}
 
2227
 
 
2228
#ifndef YY_EXIT_FAILURE
 
2229
#define YY_EXIT_FAILURE 2
 
2230
#endif
 
2231
 
 
2232
static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner)
 
2233
{
 
2234
        (void) fprintf( stderr, "%s\n", msg );
 
2235
        exit( YY_EXIT_FAILURE );
 
2236
}
 
2237
 
 
2238
/* Redefine yyless() so it works in section 3 code. */
 
2239
 
 
2240
#undef yyless
 
2241
#define yyless(n) \
 
2242
        do \
 
2243
                { \
 
2244
                /* Undo effects of setting up yytext. */ \
 
2245
        int yyless_macro_arg = (n); \
 
2246
        YY_LESS_LINENO(yyless_macro_arg);\
 
2247
                yytext[yyleng] = yyg->yy_hold_char; \
 
2248
                yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
 
2249
                yyg->yy_hold_char = *yyg->yy_c_buf_p; \
 
2250
                *yyg->yy_c_buf_p = '\0'; \
 
2251
                yyleng = yyless_macro_arg; \
 
2252
                } \
 
2253
        while ( 0 )
 
2254
 
 
2255
/* Accessor  methods (get/set functions) to struct members. */
 
2256
 
 
2257
/** Get the user-defined data for this scanner.
 
2258
 * @param yyscanner The scanner object.
 
2259
 */
 
2260
YY_EXTRA_TYPE glcpp_get_extra  (yyscan_t yyscanner)
 
2261
{
 
2262
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
2263
    return yyextra;
 
2264
}
 
2265
 
 
2266
/** Get the current line number.
 
2267
 * @param yyscanner The scanner object.
 
2268
 */
 
2269
int glcpp_get_lineno  (yyscan_t yyscanner)
 
2270
{
 
2271
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
2272
    
 
2273
        if (! YY_CURRENT_BUFFER)
 
2274
            return 0;
 
2275
    
 
2276
    return yylineno;
 
2277
}
 
2278
 
 
2279
/** Get the current column number.
 
2280
 * @param yyscanner The scanner object.
 
2281
 */
 
2282
int glcpp_get_column  (yyscan_t yyscanner)
 
2283
{
 
2284
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
2285
    
 
2286
        if (! YY_CURRENT_BUFFER)
 
2287
            return 0;
 
2288
    
 
2289
    return yycolumn;
 
2290
}
 
2291
 
 
2292
/** Get the input stream.
 
2293
 * @param yyscanner The scanner object.
 
2294
 */
 
2295
FILE *glcpp_get_in  (yyscan_t yyscanner)
 
2296
{
 
2297
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
2298
    return yyin;
 
2299
}
 
2300
 
 
2301
/** Get the output stream.
 
2302
 * @param yyscanner The scanner object.
 
2303
 */
 
2304
FILE *glcpp_get_out  (yyscan_t yyscanner)
 
2305
{
 
2306
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
2307
    return yyout;
 
2308
}
 
2309
 
 
2310
/** Get the length of the current token.
 
2311
 * @param yyscanner The scanner object.
 
2312
 */
 
2313
int glcpp_get_leng  (yyscan_t yyscanner)
 
2314
{
 
2315
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
2316
    return yyleng;
 
2317
}
 
2318
 
 
2319
/** Get the current token.
 
2320
 * @param yyscanner The scanner object.
 
2321
 */
 
2322
 
 
2323
char *glcpp_get_text  (yyscan_t yyscanner)
 
2324
{
 
2325
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
2326
    return yytext;
 
2327
}
 
2328
 
 
2329
/** Set the user-defined data. This data is never touched by the scanner.
 
2330
 * @param user_defined The data to be associated with this scanner.
 
2331
 * @param yyscanner The scanner object.
 
2332
 */
 
2333
void glcpp_set_extra (YY_EXTRA_TYPE  user_defined , yyscan_t yyscanner)
 
2334
{
 
2335
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
2336
    yyextra = user_defined ;
 
2337
}
 
2338
 
 
2339
/** Set the current line number.
 
2340
 * @param line_number
 
2341
 * @param yyscanner The scanner object.
 
2342
 */
 
2343
void glcpp_set_lineno (int  line_number , yyscan_t yyscanner)
 
2344
{
 
2345
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
2346
 
 
2347
        /* lineno is only valid if an input buffer exists. */
 
2348
        if (! YY_CURRENT_BUFFER )
 
2349
           yy_fatal_error( "glcpp_set_lineno called with no buffer" , yyscanner); 
 
2350
    
 
2351
    yylineno = line_number;
 
2352
}
 
2353
 
 
2354
/** Set the current column.
 
2355
 * @param line_number
 
2356
 * @param yyscanner The scanner object.
 
2357
 */
 
2358
void glcpp_set_column (int  column_no , yyscan_t yyscanner)
 
2359
{
 
2360
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
2361
 
 
2362
        /* column is only valid if an input buffer exists. */
 
2363
        if (! YY_CURRENT_BUFFER )
 
2364
           yy_fatal_error( "glcpp_set_column called with no buffer" , yyscanner); 
 
2365
    
 
2366
    yycolumn = column_no;
 
2367
}
 
2368
 
 
2369
/** Set the input stream. This does not discard the current
 
2370
 * input buffer.
 
2371
 * @param in_str A readable stream.
 
2372
 * @param yyscanner The scanner object.
 
2373
 * @see glcpp__switch_to_buffer
 
2374
 */
 
2375
void glcpp_set_in (FILE *  in_str , yyscan_t yyscanner)
 
2376
{
 
2377
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
2378
    yyin = in_str ;
 
2379
}
 
2380
 
 
2381
void glcpp_set_out (FILE *  out_str , yyscan_t yyscanner)
 
2382
{
 
2383
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
2384
    yyout = out_str ;
 
2385
}
 
2386
 
 
2387
int glcpp_get_debug  (yyscan_t yyscanner)
 
2388
{
 
2389
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
2390
    return yy_flex_debug;
 
2391
}
 
2392
 
 
2393
void glcpp_set_debug (int  bdebug , yyscan_t yyscanner)
 
2394
{
 
2395
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
2396
    yy_flex_debug = bdebug ;
 
2397
}
 
2398
 
 
2399
/* Accessor methods for yylval and yylloc */
 
2400
 
 
2401
YYSTYPE * glcpp_get_lval  (yyscan_t yyscanner)
 
2402
{
 
2403
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
2404
    return yylval;
 
2405
}
 
2406
 
 
2407
void glcpp_set_lval (YYSTYPE *  yylval_param , yyscan_t yyscanner)
 
2408
{
 
2409
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
2410
    yylval = yylval_param;
 
2411
}
 
2412
 
 
2413
YYLTYPE *glcpp_get_lloc  (yyscan_t yyscanner)
 
2414
{
 
2415
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
2416
    return yylloc;
 
2417
}
 
2418
    
 
2419
void glcpp_set_lloc (YYLTYPE *  yylloc_param , yyscan_t yyscanner)
 
2420
{
 
2421
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
2422
    yylloc = yylloc_param;
 
2423
}
 
2424
    
 
2425
/* User-visible API */
 
2426
 
 
2427
/* glcpp_lex_init is special because it creates the scanner itself, so it is
 
2428
 * the ONLY reentrant function that doesn't take the scanner as the last argument.
 
2429
 * That's why we explicitly handle the declaration, instead of using our macros.
 
2430
 */
 
2431
 
 
2432
int glcpp_lex_init(yyscan_t* ptr_yy_globals)
 
2433
 
 
2434
{
 
2435
    if (ptr_yy_globals == NULL){
 
2436
        errno = EINVAL;
 
2437
        return 1;
 
2438
    }
 
2439
 
 
2440
    *ptr_yy_globals = (yyscan_t) glcpp_alloc ( sizeof( struct yyguts_t ), NULL );
 
2441
 
 
2442
    if (*ptr_yy_globals == NULL){
 
2443
        errno = ENOMEM;
 
2444
        return 1;
 
2445
    }
 
2446
 
 
2447
    /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
 
2448
    memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
 
2449
 
 
2450
    return yy_init_globals ( *ptr_yy_globals );
 
2451
}
 
2452
 
 
2453
/* glcpp_lex_init_extra has the same functionality as glcpp_lex_init, but follows the
 
2454
 * convention of taking the scanner as the last argument. Note however, that
 
2455
 * this is a *pointer* to a scanner, as it will be allocated by this call (and
 
2456
 * is the reason, too, why this function also must handle its own declaration).
 
2457
 * The user defined value in the first argument will be available to glcpp_alloc in
 
2458
 * the yyextra field.
 
2459
 */
 
2460
 
 
2461
int glcpp_lex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals )
 
2462
 
 
2463
{
 
2464
    struct yyguts_t dummy_yyguts;
 
2465
 
 
2466
    glcpp_set_extra (yy_user_defined, &dummy_yyguts);
 
2467
 
 
2468
    if (ptr_yy_globals == NULL){
 
2469
        errno = EINVAL;
 
2470
        return 1;
 
2471
    }
 
2472
        
 
2473
    *ptr_yy_globals = (yyscan_t) glcpp_alloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
 
2474
        
 
2475
    if (*ptr_yy_globals == NULL){
 
2476
        errno = ENOMEM;
 
2477
        return 1;
 
2478
    }
 
2479
    
 
2480
    /* By setting to 0xAA, we expose bugs in
 
2481
    yy_init_globals. Leave at 0x00 for releases. */
 
2482
    memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
 
2483
    
 
2484
    glcpp_set_extra (yy_user_defined, *ptr_yy_globals);
 
2485
    
 
2486
    return yy_init_globals ( *ptr_yy_globals );
 
2487
}
 
2488
 
 
2489
static int yy_init_globals (yyscan_t yyscanner)
 
2490
{
 
2491
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
2492
    /* Initialization is the same as for the non-reentrant scanner.
 
2493
     * This function is called from glcpp_lex_destroy(), so don't allocate here.
 
2494
     */
 
2495
 
 
2496
    yyg->yy_buffer_stack = 0;
 
2497
    yyg->yy_buffer_stack_top = 0;
 
2498
    yyg->yy_buffer_stack_max = 0;
 
2499
    yyg->yy_c_buf_p = (char *) 0;
 
2500
    yyg->yy_init = 0;
 
2501
    yyg->yy_start = 0;
 
2502
 
 
2503
    yyg->yy_start_stack_ptr = 0;
 
2504
    yyg->yy_start_stack_depth = 0;
 
2505
    yyg->yy_start_stack =  NULL;
 
2506
 
 
2507
    yyg->yy_state_buf = 0;
 
2508
    yyg->yy_state_ptr = 0;
 
2509
    yyg->yy_full_match = 0;
 
2510
    yyg->yy_lp = 0;
 
2511
 
 
2512
/* Defined in main.c */
 
2513
#ifdef YY_STDINIT
 
2514
    yyin = stdin;
 
2515
    yyout = stdout;
 
2516
#else
 
2517
    yyin = (FILE *) 0;
 
2518
    yyout = (FILE *) 0;
 
2519
#endif
 
2520
 
 
2521
    /* For future reference: Set errno on error, since we are called by
 
2522
     * glcpp_lex_init()
 
2523
     */
 
2524
    return 0;
 
2525
}
 
2526
 
 
2527
/* glcpp_lex_destroy is for both reentrant and non-reentrant scanners. */
 
2528
int glcpp_lex_destroy  (yyscan_t yyscanner)
 
2529
{
 
2530
    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
2531
 
 
2532
    /* Pop the buffer stack, destroying each element. */
 
2533
        while(YY_CURRENT_BUFFER){
 
2534
                glcpp__delete_buffer(YY_CURRENT_BUFFER ,yyscanner );
 
2535
                YY_CURRENT_BUFFER_LVALUE = NULL;
 
2536
                glcpp_pop_buffer_state(yyscanner);
 
2537
        }
 
2538
 
 
2539
        /* Destroy the stack itself. */
 
2540
        glcpp_free(yyg->yy_buffer_stack ,yyscanner);
 
2541
        yyg->yy_buffer_stack = NULL;
 
2542
 
 
2543
    /* Destroy the start condition stack. */
 
2544
        glcpp_free(yyg->yy_start_stack ,yyscanner );
 
2545
        yyg->yy_start_stack = NULL;
 
2546
 
 
2547
    glcpp_free ( yyg->yy_state_buf , yyscanner);
 
2548
    yyg->yy_state_buf  = NULL;
 
2549
 
 
2550
    /* Reset the globals. This is important in a non-reentrant scanner so the next time
 
2551
     * glcpp_lex() is called, initialization will occur. */
 
2552
    yy_init_globals( yyscanner);
 
2553
 
 
2554
    /* Destroy the main struct (reentrant only). */
 
2555
    glcpp_free ( yyscanner , yyscanner );
 
2556
    yyscanner = NULL;
 
2557
    return 0;
 
2558
}
 
2559
 
 
2560
/*
 
2561
 * Internal utility routines.
 
2562
 */
 
2563
 
 
2564
#ifndef yytext_ptr
 
2565
static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner)
 
2566
{
 
2567
        register int i;
 
2568
        for ( i = 0; i < n; ++i )
 
2569
                s1[i] = s2[i];
 
2570
}
 
2571
#endif
 
2572
 
 
2573
#ifdef YY_NEED_STRLEN
 
2574
static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner)
 
2575
{
 
2576
        register int n;
 
2577
        for ( n = 0; s[n]; ++n )
 
2578
                ;
 
2579
 
 
2580
        return n;
 
2581
}
 
2582
#endif
 
2583
 
 
2584
void *glcpp_alloc (yy_size_t  size , yyscan_t yyscanner)
 
2585
{
 
2586
        return (void *) malloc( size );
 
2587
}
 
2588
 
 
2589
void *glcpp_realloc  (void * ptr, yy_size_t  size , yyscan_t yyscanner)
 
2590
{
 
2591
        /* The cast to (char *) in the following accommodates both
 
2592
         * implementations that use char* generic pointers, and those
 
2593
         * that use void* generic pointers.  It works with the latter
 
2594
         * because both ANSI C and C++ allow castless assignment from
 
2595
         * any pointer type to void*, and deal with argument conversions
 
2596
         * as though doing an assignment.
 
2597
         */
 
2598
        return (void *) realloc( (char *) ptr, size );
 
2599
}
 
2600
 
 
2601
void glcpp_free (void * ptr , yyscan_t yyscanner)
 
2602
{
 
2603
        free( (char *) ptr );   /* see glcpp_realloc() for (char *) cast */
 
2604
}
 
2605
 
 
2606
#define YYTABLES_NAME "yytables"
 
2607
 
 
2608
#line 318 "glcpp/glcpp-lex.l"
 
2609
 
 
2610
 
 
2611
 
 
2612
void
 
2613
glcpp_lex_set_source_string(glcpp_parser_t *parser, const char *shader)
 
2614
{
 
2615
        glcpp__scan_string(shader,parser->scanner);
 
2616
}
 
2617