~ubuntu-branches/ubuntu/jaunty/pcsc-lite/jaunty-security

« back to all changes in this revision

Viewing changes to pcsc-lite/src/tokenparser.c

  • Committer: Bazaar Package Importer
  • Author(s): Ludovic Rousseau
  • Date: 2005-11-27 18:04:59 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051127180459-qrex2gzpq9d8jexd
Tags: 1.2.9-beta9-1
* New upstream version
* debian/compat: change from 3 to 4

Show diffs side-by-side

added added

removed removed

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