~ubuntu-branches/ubuntu/breezy/gtick/breezy

« back to all changes in this revision

Viewing changes to src/optionlexer.c

  • Committer: Bazaar Package Importer
  • Author(s): Roland Stigge
  • Date: 2005-02-20 13:24:57 UTC
  • mfrom: (1.2.1 upstream) (2.1.2 hoary)
  • Revision ID: james.westby@ubuntu.com-20050220132457-akn7xjaplb1ev1cd
Tags: 0.3.5-1
New upstream release

Show diffs side-by-side

added added

removed removed

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