pcsc-lite  1.8.26
tokenparser.c
Go to the documentation of this file.
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 yy_create_buffer tp_create_buffer
9 #define yy_delete_buffer tp_delete_buffer
10 #define yy_scan_buffer tp_scan_buffer
11 #define yy_scan_string tp_scan_string
12 #define yy_scan_bytes tp_scan_bytes
13 #define yy_init_buffer tp_init_buffer
14 #define yy_flush_buffer tp_flush_buffer
15 #define yy_load_buffer_state tp_load_buffer_state
16 #define yy_switch_to_buffer tp_switch_to_buffer
17 #define yypush_buffer_state tppush_buffer_state
18 #define yypop_buffer_state tppop_buffer_state
19 #define yyensure_buffer_stack tpensure_buffer_stack
20 #define yy_flex_debug tp_flex_debug
21 #define yyin tpin
22 #define yyleng tpleng
23 #define yylex tplex
24 #define yylineno tplineno
25 #define yyout tpout
26 #define yyrestart tprestart
27 #define yytext tptext
28 #define yywrap tpwrap
29 #define yyalloc tpalloc
30 #define yyrealloc tprealloc
31 #define yyfree tpfree
32 
33 #define FLEX_SCANNER
34 #define YY_FLEX_MAJOR_VERSION 2
35 #define YY_FLEX_MINOR_VERSION 6
36 #define YY_FLEX_SUBMINOR_VERSION 4
37 #if YY_FLEX_SUBMINOR_VERSION > 0
38 #define FLEX_BETA
39 #endif
40 
41 #ifdef yy_create_buffer
42 #define tp_create_buffer_ALREADY_DEFINED
43 #else
44 #define yy_create_buffer tp_create_buffer
45 #endif
46 
47 #ifdef yy_delete_buffer
48 #define tp_delete_buffer_ALREADY_DEFINED
49 #else
50 #define yy_delete_buffer tp_delete_buffer
51 #endif
52 
53 #ifdef yy_scan_buffer
54 #define tp_scan_buffer_ALREADY_DEFINED
55 #else
56 #define yy_scan_buffer tp_scan_buffer
57 #endif
58 
59 #ifdef yy_scan_string
60 #define tp_scan_string_ALREADY_DEFINED
61 #else
62 #define yy_scan_string tp_scan_string
63 #endif
64 
65 #ifdef yy_scan_bytes
66 #define tp_scan_bytes_ALREADY_DEFINED
67 #else
68 #define yy_scan_bytes tp_scan_bytes
69 #endif
70 
71 #ifdef yy_init_buffer
72 #define tp_init_buffer_ALREADY_DEFINED
73 #else
74 #define yy_init_buffer tp_init_buffer
75 #endif
76 
77 #ifdef yy_flush_buffer
78 #define tp_flush_buffer_ALREADY_DEFINED
79 #else
80 #define yy_flush_buffer tp_flush_buffer
81 #endif
82 
83 #ifdef yy_load_buffer_state
84 #define tp_load_buffer_state_ALREADY_DEFINED
85 #else
86 #define yy_load_buffer_state tp_load_buffer_state
87 #endif
88 
89 #ifdef yy_switch_to_buffer
90 #define tp_switch_to_buffer_ALREADY_DEFINED
91 #else
92 #define yy_switch_to_buffer tp_switch_to_buffer
93 #endif
94 
95 #ifdef yypush_buffer_state
96 #define tppush_buffer_state_ALREADY_DEFINED
97 #else
98 #define yypush_buffer_state tppush_buffer_state
99 #endif
100 
101 #ifdef yypop_buffer_state
102 #define tppop_buffer_state_ALREADY_DEFINED
103 #else
104 #define yypop_buffer_state tppop_buffer_state
105 #endif
106 
107 #ifdef yyensure_buffer_stack
108 #define tpensure_buffer_stack_ALREADY_DEFINED
109 #else
110 #define yyensure_buffer_stack tpensure_buffer_stack
111 #endif
112 
113 #ifdef yylex
114 #define tplex_ALREADY_DEFINED
115 #else
116 #define yylex tplex
117 #endif
118 
119 #ifdef yyrestart
120 #define tprestart_ALREADY_DEFINED
121 #else
122 #define yyrestart tprestart
123 #endif
124 
125 #ifdef yylex_init
126 #define tplex_init_ALREADY_DEFINED
127 #else
128 #define yylex_init tplex_init
129 #endif
130 
131 #ifdef yylex_init_extra
132 #define tplex_init_extra_ALREADY_DEFINED
133 #else
134 #define yylex_init_extra tplex_init_extra
135 #endif
136 
137 #ifdef yylex_destroy
138 #define tplex_destroy_ALREADY_DEFINED
139 #else
140 #define yylex_destroy tplex_destroy
141 #endif
142 
143 #ifdef yyget_debug
144 #define tpget_debug_ALREADY_DEFINED
145 #else
146 #define yyget_debug tpget_debug
147 #endif
148 
149 #ifdef yyset_debug
150 #define tpset_debug_ALREADY_DEFINED
151 #else
152 #define yyset_debug tpset_debug
153 #endif
154 
155 #ifdef yyget_extra
156 #define tpget_extra_ALREADY_DEFINED
157 #else
158 #define yyget_extra tpget_extra
159 #endif
160 
161 #ifdef yyset_extra
162 #define tpset_extra_ALREADY_DEFINED
163 #else
164 #define yyset_extra tpset_extra
165 #endif
166 
167 #ifdef yyget_in
168 #define tpget_in_ALREADY_DEFINED
169 #else
170 #define yyget_in tpget_in
171 #endif
172 
173 #ifdef yyset_in
174 #define tpset_in_ALREADY_DEFINED
175 #else
176 #define yyset_in tpset_in
177 #endif
178 
179 #ifdef yyget_out
180 #define tpget_out_ALREADY_DEFINED
181 #else
182 #define yyget_out tpget_out
183 #endif
184 
185 #ifdef yyset_out
186 #define tpset_out_ALREADY_DEFINED
187 #else
188 #define yyset_out tpset_out
189 #endif
190 
191 #ifdef yyget_leng
192 #define tpget_leng_ALREADY_DEFINED
193 #else
194 #define yyget_leng tpget_leng
195 #endif
196 
197 #ifdef yyget_text
198 #define tpget_text_ALREADY_DEFINED
199 #else
200 #define yyget_text tpget_text
201 #endif
202 
203 #ifdef yyget_lineno
204 #define tpget_lineno_ALREADY_DEFINED
205 #else
206 #define yyget_lineno tpget_lineno
207 #endif
208 
209 #ifdef yyset_lineno
210 #define tpset_lineno_ALREADY_DEFINED
211 #else
212 #define yyset_lineno tpset_lineno
213 #endif
214 
215 #ifdef yywrap
216 #define tpwrap_ALREADY_DEFINED
217 #else
218 #define yywrap tpwrap
219 #endif
220 
221 #ifdef yyalloc
222 #define tpalloc_ALREADY_DEFINED
223 #else
224 #define yyalloc tpalloc
225 #endif
226 
227 #ifdef yyrealloc
228 #define tprealloc_ALREADY_DEFINED
229 #else
230 #define yyrealloc tprealloc
231 #endif
232 
233 #ifdef yyfree
234 #define tpfree_ALREADY_DEFINED
235 #else
236 #define yyfree tpfree
237 #endif
238 
239 #ifdef yytext
240 #define tptext_ALREADY_DEFINED
241 #else
242 #define yytext tptext
243 #endif
244 
245 #ifdef yyleng
246 #define tpleng_ALREADY_DEFINED
247 #else
248 #define yyleng tpleng
249 #endif
250 
251 #ifdef yyin
252 #define tpin_ALREADY_DEFINED
253 #else
254 #define yyin tpin
255 #endif
256 
257 #ifdef yyout
258 #define tpout_ALREADY_DEFINED
259 #else
260 #define yyout tpout
261 #endif
262 
263 #ifdef yy_flex_debug
264 #define tp_flex_debug_ALREADY_DEFINED
265 #else
266 #define yy_flex_debug tp_flex_debug
267 #endif
268 
269 #ifdef yylineno
270 #define tplineno_ALREADY_DEFINED
271 #else
272 #define yylineno tplineno
273 #endif
274 
275 /* First, we deal with platform-specific or compiler-specific issues. */
276 
277 /* begin standard C headers. */
278 #include <stdio.h>
279 #include <string.h>
280 #include <errno.h>
281 #include <stdlib.h>
282 
283 /* end standard C headers. */
284 
285 /* flex integer type definitions */
286 
287 #ifndef FLEXINT_H
288 #define FLEXINT_H
289 
290 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
291 
292 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
293 
294 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
295  * if you want the limit (max/min) macros for int types.
296  */
297 #ifndef __STDC_LIMIT_MACROS
298 #define __STDC_LIMIT_MACROS 1
299 #endif
300 
301 #include <inttypes.h>
302 typedef int8_t flex_int8_t;
303 typedef uint8_t flex_uint8_t;
304 typedef int16_t flex_int16_t;
305 typedef uint16_t flex_uint16_t;
306 typedef int32_t flex_int32_t;
307 typedef uint32_t flex_uint32_t;
308 #else
309 typedef signed char flex_int8_t;
310 typedef short int flex_int16_t;
311 typedef int flex_int32_t;
312 typedef unsigned char flex_uint8_t;
313 typedef unsigned short int flex_uint16_t;
314 typedef unsigned int flex_uint32_t;
315 
316 /* Limits of integral types. */
317 #ifndef INT8_MIN
318 #define INT8_MIN (-128)
319 #endif
320 #ifndef INT16_MIN
321 #define INT16_MIN (-32767-1)
322 #endif
323 #ifndef INT32_MIN
324 #define INT32_MIN (-2147483647-1)
325 #endif
326 #ifndef INT8_MAX
327 #define INT8_MAX (127)
328 #endif
329 #ifndef INT16_MAX
330 #define INT16_MAX (32767)
331 #endif
332 #ifndef INT32_MAX
333 #define INT32_MAX (2147483647)
334 #endif
335 #ifndef UINT8_MAX
336 #define UINT8_MAX (255U)
337 #endif
338 #ifndef UINT16_MAX
339 #define UINT16_MAX (65535U)
340 #endif
341 #ifndef UINT32_MAX
342 #define UINT32_MAX (4294967295U)
343 #endif
344 
345 #ifndef SIZE_MAX
346 #define SIZE_MAX (~(size_t)0)
347 #endif
348 
349 #endif /* ! C99 */
350 
351 #endif /* ! FLEXINT_H */
352 
353 /* begin standard C++ headers. */
354 
355 /* TODO: this is always defined, so inline it */
356 #define yyconst const
357 
358 #if defined(__GNUC__) && __GNUC__ >= 3
359 #define yynoreturn __attribute__((__noreturn__))
360 #else
361 #define yynoreturn
362 #endif
363 
364 /* Returned upon end-of-file. */
365 #define YY_NULL 0
366 
367 /* Promotes a possibly negative, possibly signed char to an
368  * integer in range [0..255] for use as an array index.
369  */
370 #define YY_SC_TO_UI(c) ((YY_CHAR) (c))
371 
372 /* Enter a start condition. This macro really ought to take a parameter,
373  * but we do it the disgusting crufty way forced on us by the ()-less
374  * definition of BEGIN.
375  */
376 #define BEGIN (yy_start) = 1 + 2 *
377 /* Translate the current start state into a value that can be later handed
378  * to BEGIN to return to the state. The YYSTATE alias is for lex
379  * compatibility.
380  */
381 #define YY_START (((yy_start) - 1) / 2)
382 #define YYSTATE YY_START
383 /* Action number for EOF rule of a given start state. */
384 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
385 /* Special action meaning "start processing a new file". */
386 #define YY_NEW_FILE yyrestart( yyin )
387 #define YY_END_OF_BUFFER_CHAR 0
388 
389 /* Size of default input buffer. */
390 #ifndef YY_BUF_SIZE
391 #ifdef __ia64__
392 /* On IA-64, the buffer size is 16k, not 8k.
393  * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
394  * Ditto for the __ia64__ case accordingly.
395  */
396 #define YY_BUF_SIZE 32768
397 #else
398 #define YY_BUF_SIZE 16384
399 #endif /* __ia64__ */
400 #endif
401 
402 /* The state buf must be large enough to hold one state per character in the main buffer.
403  */
404 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
405 
406 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
407 #define YY_TYPEDEF_YY_BUFFER_STATE
408 typedef struct yy_buffer_state *YY_BUFFER_STATE;
409 #endif
410 
411 #ifndef YY_TYPEDEF_YY_SIZE_T
412 #define YY_TYPEDEF_YY_SIZE_T
413 typedef size_t yy_size_t;
414 #endif
415 
416 extern int yyleng;
417 
418 extern FILE *yyin, *yyout;
419 
420 #define EOB_ACT_CONTINUE_SCAN 0
421 #define EOB_ACT_END_OF_FILE 1
422 #define EOB_ACT_LAST_MATCH 2
423 
424  #define YY_LESS_LINENO(n)
425  #define YY_LINENO_REWIND_TO(ptr)
426 
427 /* Return all but the first "n" matched characters back to the input stream. */
428 #define yyless(n) \
429  do \
430  { \
431  /* Undo effects of setting up yytext. */ \
432  int yyless_macro_arg = (n); \
433  YY_LESS_LINENO(yyless_macro_arg);\
434  *yy_cp = (yy_hold_char); \
435  YY_RESTORE_YY_MORE_OFFSET \
436  (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
437  YY_DO_BEFORE_ACTION; /* set up yytext again */ \
438  } \
439  while ( 0 )
440 #define unput(c) yyunput( c, (yytext_ptr) )
441 
442 #ifndef YY_STRUCT_YY_BUFFER_STATE
443 #define YY_STRUCT_YY_BUFFER_STATE
444 struct yy_buffer_state
445  {
446  FILE *yy_input_file;
447 
448  char *yy_ch_buf; /* input buffer */
449  char *yy_buf_pos; /* current position in input buffer */
450 
451  /* Size of input buffer in bytes, not including room for EOB
452  * characters.
453  */
454  int yy_buf_size;
455 
456  /* Number of characters read into yy_ch_buf, not including EOB
457  * characters.
458  */
459  int yy_n_chars;
460 
461  /* Whether we "own" the buffer - i.e., we know we created it,
462  * and can realloc() it to grow it, and should free() it to
463  * delete it.
464  */
465  int yy_is_our_buffer;
466 
467  /* Whether this is an "interactive" input source; if so, and
468  * if we're using stdio for input, then we want to use getc()
469  * instead of fread(), to make sure we stop fetching input after
470  * each newline.
471  */
472  int yy_is_interactive;
473 
474  /* Whether we're considered to be at the beginning of a line.
475  * If so, '^' rules will be active on the next match, otherwise
476  * not.
477  */
478  int yy_at_bol;
479 
480  int yy_bs_lineno;
481  int yy_bs_column;
483  /* Whether to try to fill the input buffer when we reach the
484  * end of it.
485  */
486  int yy_fill_buffer;
487 
488  int yy_buffer_status;
489 
490 #define YY_BUFFER_NEW 0
491 #define YY_BUFFER_NORMAL 1
492  /* When an EOF's been seen but there's still some text to process
493  * then we mark the buffer as YY_EOF_PENDING, to indicate that we
494  * shouldn't try reading from the input source any more. We might
495  * still have a bunch of tokens to match, though, because of
496  * possible backing-up.
497  *
498  * When we actually see the EOF, we change the status to "new"
499  * (via yyrestart()), so that the user can continue scanning by
500  * just pointing yyin at a new input file.
501  */
502 #define YY_BUFFER_EOF_PENDING 2
503 
504  };
505 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
506 
507 /* Stack of input buffers. */
508 static size_t yy_buffer_stack_top = 0;
509 static size_t yy_buffer_stack_max = 0;
512 /* We provide macros for accessing buffer states in case in the
513  * future we want to put the buffer states in a more general
514  * "scanner state".
515  *
516  * Returns the top of the stack, or NULL.
517  */
518 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
519  ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
520  : NULL)
521 /* Same as previous macro, but useful when we know that the buffer stack is not
522  * NULL or when we need an lvalue. For internal use only.
523  */
524 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
525 
526 /* yy_hold_char holds the character lost when yytext is formed. */
527 static char yy_hold_char;
528 static int yy_n_chars; /* number of characters read into yy_ch_buf */
529 int yyleng;
530 
531 /* Points to current character in buffer. */
532 static char *yy_c_buf_p = NULL;
533 static int yy_init = 0; /* whether we need to initialize */
534 static int yy_start = 0; /* start state number */
535 
536 /* Flag which is used to allow yywrap()'s to do buffer switches
537  * instead of setting up a fresh yyin. A bit of a hack ...
538  */
539 static int yy_did_buffer_switch_on_eof;
540 
541 void yyrestart ( FILE *input_file );
542 void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer );
543 YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size );
544 void yy_delete_buffer ( YY_BUFFER_STATE b );
545 void yy_flush_buffer ( YY_BUFFER_STATE b );
546 void yypush_buffer_state ( YY_BUFFER_STATE new_buffer );
547 void yypop_buffer_state ( void );
548 
549 static void yyensure_buffer_stack ( void );
550 static void yy_load_buffer_state ( void );
551 static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file );
552 #define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER )
553 
554 YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size );
555 YY_BUFFER_STATE yy_scan_string ( const char *yy_str );
556 YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len );
557 
558 void *yyalloc ( yy_size_t );
559 void *yyrealloc ( void *, yy_size_t );
560 void yyfree ( void * );
561 
562 #define yy_new_buffer yy_create_buffer
563 #define yy_set_interactive(is_interactive) \
564  { \
565  if ( ! YY_CURRENT_BUFFER ){ \
566  yyensure_buffer_stack (); \
567  YY_CURRENT_BUFFER_LVALUE = \
568  yy_create_buffer( yyin, YY_BUF_SIZE ); \
569  } \
570  YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
571  }
572 #define yy_set_bol(at_bol) \
573  { \
574  if ( ! YY_CURRENT_BUFFER ){\
575  yyensure_buffer_stack (); \
576  YY_CURRENT_BUFFER_LVALUE = \
577  yy_create_buffer( yyin, YY_BUF_SIZE ); \
578  } \
579  YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
580  }
581 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
582 
583 /* Begin user sect3 */
584 
585 #define tpwrap() (/*CONSTCOND*/1)
586 #define YY_SKIP_YYWRAP
587 typedef flex_uint8_t YY_CHAR;
588 
589 FILE *yyin = NULL, *yyout = NULL;
590 
591 typedef int yy_state_type;
592 
593 extern int yylineno;
594 int yylineno = 1;
595 
596 extern char *yytext;
597 #ifdef yytext_ptr
598 #undef yytext_ptr
599 #endif
600 #define yytext_ptr yytext
601 
602 static yy_state_type yy_get_previous_state ( void );
603 static yy_state_type yy_try_NUL_trans ( yy_state_type current_state );
604 static int yy_get_next_buffer ( void );
605 static void yynoreturn yy_fatal_error ( const char* msg );
606 
607 /* Done after the current pattern has been matched and before the
608  * corresponding action - sets up yytext.
609  */
610 #define YY_DO_BEFORE_ACTION \
611  (yytext_ptr) = yy_bp; \
612  yyleng = (int) (yy_cp - yy_bp); \
613  (yy_hold_char) = *yy_cp; \
614  *yy_cp = '\0'; \
615  (yy_c_buf_p) = yy_cp;
616 #define YY_NUM_RULES 7
617 #define YY_END_OF_BUFFER 8
618 /* This struct is not used in this scanner,
619  but its presence is necessary. */
620 struct yy_trans_info
621  {
622  flex_int32_t yy_verify;
623  flex_int32_t yy_nxt;
624  };
625 static const flex_int16_t yy_accept[39] =
626  { 0,
627  0, 0, 8, 6, 4, 2, 1, 6, 1, 0,
628  0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
629  0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
630  0, 0, 0, 0, 0, 0, 5, 0
631  } ;
632 
633 static const YY_CHAR yy_ec[256] =
634  { 0,
635  1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
636  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
637  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
638  1, 2, 4, 4, 5, 4, 4, 4, 4, 4,
639  4, 4, 4, 4, 4, 4, 6, 7, 7, 7,
640  7, 7, 7, 7, 7, 7, 7, 4, 4, 8,
641  4, 9, 4, 4, 10, 10, 10, 10, 10, 10,
642  10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
643  10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
644  4, 1, 4, 4, 4, 1, 11, 11, 11, 11,
645 
646  12, 11, 13, 11, 14, 11, 15, 11, 11, 16,
647  11, 11, 11, 17, 18, 19, 11, 11, 11, 11,
648  20, 11, 1, 1, 1, 4, 1, 1, 1, 1,
649  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
650  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
651  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
652  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
653  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
654  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
655  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
656 
657  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
658  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
659  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
660  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
661  1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
662  1, 1, 1, 1, 1
663  } ;
664 
665 static const YY_CHAR yy_meta[21] =
666  { 0,
667  1, 2, 3, 4, 4, 4, 2, 1, 1, 2,
668  2, 2, 2, 2, 2, 2, 2, 2, 2, 2
669  } ;
670 
671 static const flex_int16_t yy_base[43] =
672  { 0,
673  0, 7, 49, 50, 50, 50, 0, 1, 0, 36,
674  28, 26, 28, 35, 29, 0, 26, 33, 27, 33,
675  29, 22, 0, 24, 27, 14, 27, 23, 13, 50,
676  10, 9, 4, 1, 0, 2, 50, 50, 19, 23,
677  2, 26
678  } ;
679 
680 static const flex_int16_t yy_def[43] =
681  { 0,
682  39, 39, 38, 38, 38, 38, 40, 38, 40, 38,
683  38, 38, 38, 38, 38, 41, 38, 41, 38, 38,
684  38, 38, 42, 38, 42, 38, 38, 38, 38, 38,
685  38, 38, 38, 38, 38, 38, 38, 0, 38, 38,
686  38, 38
687  } ;
688 
689 static const flex_int16_t yy_nxt[71] =
690  { 0,
691  38, 5, 6, 18, 7, 38, 38, 8, 5, 6,
692  37, 7, 36, 38, 8, 10, 35, 34, 11, 4,
693  4, 4, 4, 9, 9, 33, 9, 25, 32, 25,
694  31, 30, 29, 28, 27, 26, 24, 23, 22, 21,
695  20, 19, 17, 16, 15, 14, 13, 12, 38, 3,
696  38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
697  38, 38, 38, 38, 38, 38, 38, 38, 38, 38
698  } ;
699 
700 static const flex_int16_t yy_chk[71] =
701  { 0,
702  0, 1, 1, 41, 1, 0, 0, 1, 2, 2,
703  36, 2, 35, 0, 2, 8, 34, 33, 8, 39,
704  39, 39, 39, 40, 40, 32, 40, 42, 31, 42,
705  29, 28, 27, 26, 25, 24, 22, 21, 20, 19,
706  18, 17, 15, 14, 13, 12, 11, 10, 3, 38,
707  38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
708  38, 38, 38, 38, 38, 38, 38, 38, 38, 38
709  } ;
710 
711 static yy_state_type yy_last_accepting_state;
712 static char *yy_last_accepting_cpos;
713 
714 extern int yy_flex_debug;
715 int yy_flex_debug = 0;
716 
717 /* The intent behind this definition is that it'll catch
718  * any uses of REJECT which flex missed.
719  */
720 #define REJECT reject_used_but_not_detected
721 #define yymore() yymore_used_but_not_detected
722 #define YY_MORE_ADJ 0
723 #define YY_RESTORE_YY_MORE_OFFSET
724 char *yytext;
725 #line 1 "tokenparser.l"
726 /*
727  * Reads lexical config files and updates database.
728  *
729  * MUSCLE SmartCard Development ( https://pcsclite.apdu.fr/ )
730  *
731  * Copyright (C) 2001-2003
732  * David Corcoran <corcoran@musclecard.com>
733  * Copyright (C) 2003-2010
734  * Ludovic Rousseau <ludovic.rousseau@free.fr>
735  *
736 Redistribution and use in source and binary forms, with or without
737 modification, are permitted provided that the following conditions
738 are met:
739 
740 1. Redistributions of source code must retain the above copyright
741  notice, this list of conditions and the following disclaimer.
742 2. Redistributions in binary form must reproduce the above copyright
743  notice, this list of conditions and the following disclaimer in the
744  documentation and/or other materials provided with the distribution.
745 3. The name of the author may not be used to endorse or promote products
746  derived from this software without specific prior written permission.
747 
748 THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
749 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
750 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
751 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
752 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
753 NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
754 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
755 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
756 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
757 THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
758  */
764 #line 42 "tokenparser.l"
765 
766 #include "config.h"
767 #include <stdio.h>
768 #include <string.h>
769 #include <errno.h>
770 #ifndef NDEBUG
771 #define NDEBUG
772 #endif
773 #include <assert.h>
774 
775 #include "simclist.h"
776 #include "debuglog.h"
777 #include "parser.h"
778 
779 static void eval_key(char *pcToken, list_t *list_key);
780 static void eval_value(char *pcToken, list_t *list_values);
781 void tperrorCheck (char *pcToken_error);
782 
783 static list_t *ListKeys;
784 static list_t *ListValues;
785 
786 #line 787 "tokenparser.c"
787 #define YY_NO_INPUT 1
788 #line 789 "tokenparser.c"
789 
790 #define INITIAL 0
791 
792 #ifndef YY_NO_UNISTD_H
793 /* Special case for "unistd.h", since it is non-ANSI. We include it way
794  * down here because we want the user's section 1 to have been scanned first.
795  * The user has a chance to override it with an option.
796  */
797 #include <unistd.h>
798 #endif
799 
800 #ifndef YY_EXTRA_TYPE
801 #define YY_EXTRA_TYPE void *
802 #endif
803 
804 static int yy_init_globals ( void );
805 
806 /* Accessor methods to globals.
807  These are made visible to non-reentrant scanners for convenience. */
808 
809 int yylex_destroy ( void );
810 
811 int yyget_debug ( void );
812 
813 void yyset_debug ( int debug_flag );
814 
815 YY_EXTRA_TYPE yyget_extra ( void );
816 
817 void yyset_extra ( YY_EXTRA_TYPE user_defined );
818 
819 FILE *yyget_in ( void );
820 
821 void yyset_in ( FILE * _in_str );
822 
823 FILE *yyget_out ( void );
824 
825 void yyset_out ( FILE * _out_str );
826 
827  int yyget_leng ( void );
828 
829 char *yyget_text ( void );
830 
831 int yyget_lineno ( void );
832 
833 void yyset_lineno ( int _line_number );
834 
835 /* Macros after this point can all be overridden by user definitions in
836  * section 1.
837  */
838 
839 #ifndef YY_SKIP_YYWRAP
840 #ifdef __cplusplus
841 extern "C" int yywrap ( void );
842 #else
843 extern int yywrap ( void );
844 #endif
845 #endif
846 
847 #ifndef YY_NO_UNPUT
848 
849 #endif
850 
851 #ifndef yytext_ptr
852 static void yy_flex_strncpy ( char *, const char *, int );
853 #endif
854 
855 #ifdef YY_NEED_STRLEN
856 static int yy_flex_strlen ( const char * );
857 #endif
858 
859 #ifndef YY_NO_INPUT
860 #ifdef __cplusplus
861 static int yyinput ( void );
862 #else
863 static int input ( void );
864 #endif
865 
866 #endif
867 
868 /* Amount of stuff to slurp up with each read. */
869 #ifndef YY_READ_BUF_SIZE
870 #ifdef __ia64__
871 /* On IA-64, the buffer size is 16k, not 8k */
872 #define YY_READ_BUF_SIZE 16384
873 #else
874 #define YY_READ_BUF_SIZE 8192
875 #endif /* __ia64__ */
876 #endif
877 
878 /* Copy whatever the last rule matched to the standard output. */
879 #ifndef ECHO
880 /* This used to be an fputs(), but since the string might contain NUL's,
881  * we now use fwrite().
882  */
883 #define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
884 #endif
885 
886 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
887  * is returned in "result".
888  */
889 #ifndef YY_INPUT
890 #define YY_INPUT(buf,result,max_size) \
891  if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
892  { \
893  int c = '*'; \
894  int n; \
895  for ( n = 0; n < max_size && \
896  (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
897  buf[n] = (char) c; \
898  if ( c == '\n' ) \
899  buf[n++] = (char) c; \
900  if ( c == EOF && ferror( yyin ) ) \
901  YY_FATAL_ERROR( "input in flex scanner failed" ); \
902  result = n; \
903  } \
904  else \
905  { \
906  errno=0; \
907  while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \
908  { \
909  if( errno != EINTR) \
910  { \
911  YY_FATAL_ERROR( "input in flex scanner failed" ); \
912  break; \
913  } \
914  errno=0; \
915  clearerr(yyin); \
916  } \
917  }\
918 \
919 
920 #endif
921 
922 /* No semi-colon after return; correct usage is to write "yyterminate();" -
923  * we don't want an extra ';' after the "return" because that will cause
924  * some compilers to complain about unreachable statements.
925  */
926 #ifndef yyterminate
927 #define yyterminate() return YY_NULL
928 #endif
929 
930 /* Number of entries by which start-condition stack grows. */
931 #ifndef YY_START_STACK_INCR
932 #define YY_START_STACK_INCR 25
933 #endif
934 
935 /* Report a fatal error. */
936 #ifndef YY_FATAL_ERROR
937 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
938 #endif
939 
940 /* end tables serialization structures and prototypes */
941 
942 /* Default declaration of generated scanner - a define so the user can
943  * easily add parameters.
944  */
945 #ifndef YY_DECL
946 #define YY_DECL_IS_OURS 1
947 
948 extern int yylex (void);
949 
950 #define YY_DECL int yylex (void)
951 #endif /* !YY_DECL */
952 
953 /* Code executed at the beginning of each rule, after yytext and yyleng
954  * have been set up.
955  */
956 #ifndef YY_USER_ACTION
957 #define YY_USER_ACTION
958 #endif
959 
960 /* Code executed at the end of each rule. */
961 #ifndef YY_BREAK
962 #define YY_BREAK /*LINTED*/break;
963 #endif
964 
965 #define YY_RULE_SETUP \
966  YY_USER_ACTION
967 
970 YY_DECL
971 {
972  yy_state_type yy_current_state;
973  char *yy_cp, *yy_bp;
974  int yy_act;
975 
976  if ( !(yy_init) )
977  {
978  (yy_init) = 1;
979 
980 #ifdef YY_USER_INIT
981  YY_USER_INIT;
982 #endif
983 
984  if ( ! (yy_start) )
985  (yy_start) = 1; /* first start state */
986 
987  if ( ! yyin )
988  yyin = stdin;
989 
990  if ( ! yyout )
991  yyout = stdout;
992 
993  if ( ! YY_CURRENT_BUFFER ) {
994  yyensure_buffer_stack ();
995  YY_CURRENT_BUFFER_LVALUE =
996  yy_create_buffer( yyin, YY_BUF_SIZE );
997  }
998 
999  yy_load_buffer_state( );
1000  }
1001 
1002  {
1003 #line 69 "tokenparser.l"
1004 
1005 
1006 #line 1007 "tokenparser.c"
1007 
1008  while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
1009  {
1010  yy_cp = (yy_c_buf_p);
1011 
1012  /* Support of yytext. */
1013  *yy_cp = (yy_hold_char);
1014 
1015  /* yy_bp points to the position in yy_ch_buf of the start of
1016  * the current run.
1017  */
1018  yy_bp = yy_cp;
1019 
1020  yy_current_state = (yy_start);
1021 yy_match:
1022  do
1023  {
1024  YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
1025  if ( yy_accept[yy_current_state] )
1026  {
1027  (yy_last_accepting_state) = yy_current_state;
1028  (yy_last_accepting_cpos) = yy_cp;
1029  }
1030  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1031  {
1032  yy_current_state = (int) yy_def[yy_current_state];
1033  if ( yy_current_state >= 39 )
1034  yy_c = yy_meta[yy_c];
1035  }
1036  yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
1037  ++yy_cp;
1038  }
1039  while ( yy_base[yy_current_state] != 50 );
1040 
1041 yy_find_action:
1042  yy_act = yy_accept[yy_current_state];
1043  if ( yy_act == 0 )
1044  { /* have to back up */
1045  yy_cp = (yy_last_accepting_cpos);
1046  yy_current_state = (yy_last_accepting_state);
1047  yy_act = yy_accept[yy_current_state];
1048  }
1049 
1050  YY_DO_BEFORE_ACTION;
1051 
1052 do_action: /* This label is used only to access EOF actions. */
1053 
1054  switch ( yy_act )
1055  { /* beginning of action switch */
1056  case 0: /* must back up */
1057  /* undo the effects of YY_DO_BEFORE_ACTION */
1058  *yy_cp = (yy_hold_char);
1059  yy_cp = (yy_last_accepting_cpos);
1060  yy_current_state = (yy_last_accepting_state);
1061  goto yy_find_action;
1062 
1063 case 1:
1064 YY_RULE_SETUP
1065 #line 71 "tokenparser.l"
1066 {}
1067  YY_BREAK
1068 case 2:
1069 /* rule 2 can match eol */
1070 YY_RULE_SETUP
1071 #line 72 "tokenparser.l"
1072 {}
1073  YY_BREAK
1074 case 3:
1075 YY_RULE_SETUP
1076 #line 73 "tokenparser.l"
1077 { eval_key(yytext, ListKeys); }
1078  YY_BREAK
1079 case 4:
1080 YY_RULE_SETUP
1081 #line 74 "tokenparser.l"
1082 {}
1083  YY_BREAK
1084 case 5:
1085 YY_RULE_SETUP
1086 #line 75 "tokenparser.l"
1087 { eval_value(yytext, ListValues); }
1088  YY_BREAK
1089 case 6:
1090 YY_RULE_SETUP
1091 #line 76 "tokenparser.l"
1092 { tperrorCheck(yytext); }
1093  YY_BREAK
1094 case 7:
1095 YY_RULE_SETUP
1096 #line 77 "tokenparser.l"
1097 ECHO;
1098  YY_BREAK
1099 #line 1100 "tokenparser.c"
1100 case YY_STATE_EOF(INITIAL):
1101  yyterminate();
1102 
1103  case YY_END_OF_BUFFER:
1104  {
1105  /* Amount of text matched not including the EOB char. */
1106  int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1107 
1108  /* Undo the effects of YY_DO_BEFORE_ACTION. */
1109  *yy_cp = (yy_hold_char);
1110  YY_RESTORE_YY_MORE_OFFSET
1111 
1112  if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1113  {
1114  /* We're scanning a new file or input source. It's
1115  * possible that this happened because the user
1116  * just pointed yyin at a new source and called
1117  * yylex(). If so, then we have to assure
1118  * consistency between YY_CURRENT_BUFFER and our
1119  * globals. Here is the right place to do so, because
1120  * this is the first action (other than possibly a
1121  * back-up) that will match for the new input source.
1122  */
1123  (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1124  YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1125  YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1126  }
1127 
1128  /* Note that here we test for yy_c_buf_p "<=" to the position
1129  * of the first EOB in the buffer, since yy_c_buf_p will
1130  * already have been incremented past the NUL character
1131  * (since all states make transitions on EOB to the
1132  * end-of-buffer state). Contrast this with the test
1133  * in input().
1134  */
1135  if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1136  { /* This was really a NUL. */
1137  yy_state_type yy_next_state;
1138 
1139  (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1140 
1141  yy_current_state = yy_get_previous_state( );
1142 
1143  /* Okay, we're now positioned to make the NUL
1144  * transition. We couldn't have
1145  * yy_get_previous_state() go ahead and do it
1146  * for us because it doesn't know how to deal
1147  * with the possibility of jamming (and we don't
1148  * want to build jamming into it because then it
1149  * will run more slowly).
1150  */
1151 
1152  yy_next_state = yy_try_NUL_trans( yy_current_state );
1153 
1154  yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1155 
1156  if ( yy_next_state )
1157  {
1158  /* Consume the NUL. */
1159  yy_cp = ++(yy_c_buf_p);
1160  yy_current_state = yy_next_state;
1161  goto yy_match;
1162  }
1163 
1164  else
1165  {
1166  yy_cp = (yy_c_buf_p);
1167  goto yy_find_action;
1168  }
1169  }
1170 
1171  else switch ( yy_get_next_buffer( ) )
1172  {
1173  case EOB_ACT_END_OF_FILE:
1174  {
1175  (yy_did_buffer_switch_on_eof) = 0;
1176 
1177  if ( yywrap( ) )
1178  {
1179  /* Note: because we've taken care in
1180  * yy_get_next_buffer() to have set up
1181  * yytext, we can now set up
1182  * yy_c_buf_p so that if some total
1183  * hoser (like flex itself) wants to
1184  * call the scanner after we return the
1185  * YY_NULL, it'll still work - another
1186  * YY_NULL will get returned.
1187  */
1188  (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1189 
1190  yy_act = YY_STATE_EOF(YY_START);
1191  goto do_action;
1192  }
1193 
1194  else
1195  {
1196  if ( ! (yy_did_buffer_switch_on_eof) )
1197  YY_NEW_FILE;
1198  }
1199  break;
1200  }
1201 
1202  case EOB_ACT_CONTINUE_SCAN:
1203  (yy_c_buf_p) =
1204  (yytext_ptr) + yy_amount_of_matched_text;
1205 
1206  yy_current_state = yy_get_previous_state( );
1207 
1208  yy_cp = (yy_c_buf_p);
1209  yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1210  goto yy_match;
1211 
1212  case EOB_ACT_LAST_MATCH:
1213  (yy_c_buf_p) =
1214  &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1215 
1216  yy_current_state = yy_get_previous_state( );
1217 
1218  yy_cp = (yy_c_buf_p);
1219  yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1220  goto yy_find_action;
1221  }
1222  break;
1223  }
1224 
1225  default:
1226  YY_FATAL_ERROR(
1227  "fatal flex scanner internal error--no action found" );
1228  } /* end of action switch */
1229  } /* end of scanning one token */
1230  } /* end of user's declarations */
1231 } /* end of yylex */
1232 
1233 /* yy_get_next_buffer - try to read in a new buffer
1234  *
1235  * Returns a code representing an action:
1236  * EOB_ACT_LAST_MATCH -
1237  * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1238  * EOB_ACT_END_OF_FILE - end of file
1239  */
1240 static int yy_get_next_buffer (void)
1241 {
1242  char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1243  char *source = (yytext_ptr);
1244  int number_to_move, i;
1245  int ret_val;
1246 
1247  if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1248  YY_FATAL_ERROR(
1249  "fatal flex scanner internal error--end of buffer missed" );
1250 
1251  if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1252  { /* Don't try to fill the buffer, so this is an EOF. */
1253  if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1254  {
1255  /* We matched a single character, the EOB, so
1256  * treat this as a final EOF.
1257  */
1258  return EOB_ACT_END_OF_FILE;
1259  }
1260 
1261  else
1262  {
1263  /* We matched some text prior to the EOB, first
1264  * process it.
1265  */
1266  return EOB_ACT_LAST_MATCH;
1267  }
1268  }
1269 
1270  /* Try to read more data. */
1271 
1272  /* First move last chars to start of buffer. */
1273  number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1);
1274 
1275  for ( i = 0; i < number_to_move; ++i )
1276  *(dest++) = *(source++);
1277 
1278  if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1279  /* don't do the read, it's not guaranteed to return an EOF,
1280  * just force an EOF
1281  */
1282  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1283 
1284  else
1285  {
1286  int num_to_read =
1287  YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1288 
1289  while ( num_to_read <= 0 )
1290  { /* Not enough room in the buffer - grow it. */
1291 
1292  /* just a shorter name for the current buffer */
1293  YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
1294 
1295  int yy_c_buf_p_offset =
1296  (int) ((yy_c_buf_p) - b->yy_ch_buf);
1297 
1298  if ( b->yy_is_our_buffer )
1299  {
1300  int new_size = b->yy_buf_size * 2;
1301 
1302  if ( new_size <= 0 )
1303  b->yy_buf_size += b->yy_buf_size / 8;
1304  else
1305  b->yy_buf_size *= 2;
1306 
1307  b->yy_ch_buf = (char *)
1308  /* Include room in for 2 EOB chars. */
1309  yyrealloc( (void *) b->yy_ch_buf,
1310  (yy_size_t) (b->yy_buf_size + 2) );
1311  }
1312  else
1313  /* Can't grow it, we don't own it. */
1314  b->yy_ch_buf = NULL;
1315 
1316  if ( ! b->yy_ch_buf )
1317  YY_FATAL_ERROR(
1318  "fatal error - scanner input buffer overflow" );
1319 
1320  (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1321 
1322  num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1323  number_to_move - 1;
1324 
1325  }
1326 
1327  if ( num_to_read > YY_READ_BUF_SIZE )
1328  num_to_read = YY_READ_BUF_SIZE;
1329 
1330  /* Read in more data. */
1331  YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1332  (yy_n_chars), num_to_read );
1333 
1334  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1335  }
1336 
1337  if ( (yy_n_chars) == 0 )
1338  {
1339  if ( number_to_move == YY_MORE_ADJ )
1340  {
1341  ret_val = EOB_ACT_END_OF_FILE;
1342  yyrestart( yyin );
1343  }
1344 
1345  else
1346  {
1347  ret_val = EOB_ACT_LAST_MATCH;
1348  YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1349  YY_BUFFER_EOF_PENDING;
1350  }
1351  }
1352 
1353  else
1354  ret_val = EOB_ACT_CONTINUE_SCAN;
1355 
1356  if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1357  /* Extend the array by 50%, plus the number we really need. */
1358  int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1359  YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
1360  (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size );
1361  if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1362  YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1363  /* "- 2" to take care of EOB's */
1364  YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
1365  }
1366 
1367  (yy_n_chars) += number_to_move;
1368  YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1369  YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1370 
1371  (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1372 
1373  return ret_val;
1374 }
1375 
1376 /* yy_get_previous_state - get the state just before the EOB char was reached */
1377 
1378  static yy_state_type yy_get_previous_state (void)
1379 {
1380  yy_state_type yy_current_state;
1381  char *yy_cp;
1382 
1383  yy_current_state = (yy_start);
1384 
1385  for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1386  {
1387  YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1388  if ( yy_accept[yy_current_state] )
1389  {
1390  (yy_last_accepting_state) = yy_current_state;
1391  (yy_last_accepting_cpos) = yy_cp;
1392  }
1393  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1394  {
1395  yy_current_state = (int) yy_def[yy_current_state];
1396  if ( yy_current_state >= 39 )
1397  yy_c = yy_meta[yy_c];
1398  }
1399  yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
1400  }
1401 
1402  return yy_current_state;
1403 }
1404 
1405 /* yy_try_NUL_trans - try to make a transition on the NUL character
1406  *
1407  * synopsis
1408  * next_state = yy_try_NUL_trans( current_state );
1409  */
1410  static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1411 {
1412  int yy_is_jam;
1413  char *yy_cp = (yy_c_buf_p);
1414 
1415  YY_CHAR yy_c = 1;
1416  if ( yy_accept[yy_current_state] )
1417  {
1418  (yy_last_accepting_state) = yy_current_state;
1419  (yy_last_accepting_cpos) = yy_cp;
1420  }
1421  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1422  {
1423  yy_current_state = (int) yy_def[yy_current_state];
1424  if ( yy_current_state >= 39 )
1425  yy_c = yy_meta[yy_c];
1426  }
1427  yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
1428  yy_is_jam = (yy_current_state == 38);
1429 
1430  return yy_is_jam ? 0 : yy_current_state;
1431 }
1432 
1433 #ifndef YY_NO_UNPUT
1434 
1435 #endif
1436 
1437 #ifndef YY_NO_INPUT
1438 #ifdef __cplusplus
1439  static int yyinput (void)
1440 #else
1441  static int input (void)
1442 #endif
1443 
1444 {
1445  int c;
1446 
1447  *(yy_c_buf_p) = (yy_hold_char);
1448 
1449  if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1450  {
1451  /* yy_c_buf_p now points to the character we want to return.
1452  * If this occurs *before* the EOB characters, then it's a
1453  * valid NUL; if not, then we've hit the end of the buffer.
1454  */
1455  if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1456  /* This was really a NUL. */
1457  *(yy_c_buf_p) = '\0';
1458 
1459  else
1460  { /* need more input */
1461  int offset = (int) ((yy_c_buf_p) - (yytext_ptr));
1462  ++(yy_c_buf_p);
1463 
1464  switch ( yy_get_next_buffer( ) )
1465  {
1466  case EOB_ACT_LAST_MATCH:
1467  /* This happens because yy_g_n_b()
1468  * sees that we've accumulated a
1469  * token and flags that we need to
1470  * try matching the token before
1471  * proceeding. But for input(),
1472  * there's no matching to consider.
1473  * So convert the EOB_ACT_LAST_MATCH
1474  * to EOB_ACT_END_OF_FILE.
1475  */
1476 
1477  /* Reset buffer status. */
1478  yyrestart( yyin );
1479 
1480  /*FALLTHROUGH*/
1481 
1482  case EOB_ACT_END_OF_FILE:
1483  {
1484  if ( yywrap( ) )
1485  return 0;
1486 
1487  if ( ! (yy_did_buffer_switch_on_eof) )
1488  YY_NEW_FILE;
1489 #ifdef __cplusplus
1490  return yyinput();
1491 #else
1492  return input();
1493 #endif
1494  }
1495 
1496  case EOB_ACT_CONTINUE_SCAN:
1497  (yy_c_buf_p) = (yytext_ptr) + offset;
1498  break;
1499  }
1500  }
1501  }
1502 
1503  c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1504  *(yy_c_buf_p) = '\0'; /* preserve yytext */
1505  (yy_hold_char) = *++(yy_c_buf_p);
1506 
1507  return c;
1508 }
1509 #endif /* ifndef YY_NO_INPUT */
1510 
1516  void yyrestart (FILE * input_file )
1517 {
1518 
1519  if ( ! YY_CURRENT_BUFFER ){
1520  yyensure_buffer_stack ();
1521  YY_CURRENT_BUFFER_LVALUE =
1522  yy_create_buffer( yyin, YY_BUF_SIZE );
1523  }
1524 
1525  yy_init_buffer( YY_CURRENT_BUFFER, input_file );
1526  yy_load_buffer_state( );
1527 }
1528 
1533  void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1534 {
1535 
1536  /* TODO. We should be able to replace this entire function body
1537  * with
1538  * yypop_buffer_state();
1539  * yypush_buffer_state(new_buffer);
1540  */
1541  yyensure_buffer_stack ();
1542  if ( YY_CURRENT_BUFFER == new_buffer )
1543  return;
1544 
1545  if ( YY_CURRENT_BUFFER )
1546  {
1547  /* Flush out information for old buffer. */
1548  *(yy_c_buf_p) = (yy_hold_char);
1549  YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1550  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1551  }
1552 
1553  YY_CURRENT_BUFFER_LVALUE = new_buffer;
1554  yy_load_buffer_state( );
1555 
1556  /* We don't actually know whether we did this switch during
1557  * EOF (yywrap()) processing, but the only time this flag
1558  * is looked at is after yywrap() is called, so it's safe
1559  * to go ahead and always set it.
1560  */
1561  (yy_did_buffer_switch_on_eof) = 1;
1562 }
1563 
1564 static void yy_load_buffer_state (void)
1565 {
1566  (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1567  (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1568  yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1569  (yy_hold_char) = *(yy_c_buf_p);
1570 }
1571 
1578  YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
1579 {
1580  YY_BUFFER_STATE b;
1581 
1582  b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) );
1583  if ( ! b )
1584  YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1585 
1586  b->yy_buf_size = size;
1587 
1588  /* yy_ch_buf has to be 2 characters longer than the size given because
1589  * we need to put in 2 end-of-buffer characters.
1590  */
1591  b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) );
1592  if ( ! b->yy_ch_buf )
1593  YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1594 
1595  b->yy_is_our_buffer = 1;
1596 
1597  yy_init_buffer( b, file );
1598 
1599  return b;
1600 }
1601 
1606  void yy_delete_buffer (YY_BUFFER_STATE b )
1607 {
1608 
1609  if ( ! b )
1610  return;
1611 
1612  if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1613  YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1614 
1615  if ( b->yy_is_our_buffer )
1616  yyfree( (void *) b->yy_ch_buf );
1617 
1618  yyfree( (void *) b );
1619 }
1620 
1621 /* Initializes or reinitializes a buffer.
1622  * This function is sometimes called more than once on the same buffer,
1623  * such as during a yyrestart() or at EOF.
1624  */
1625  static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
1626 
1627 {
1628  int oerrno = errno;
1629 
1630  yy_flush_buffer( b );
1631 
1632  b->yy_input_file = file;
1633  b->yy_fill_buffer = 1;
1634 
1635  /* If b is the current buffer, then yy_init_buffer was _probably_
1636  * called from yyrestart() or through yy_get_next_buffer.
1637  * In that case, we don't want to reset the lineno or column.
1638  */
1639  if (b != YY_CURRENT_BUFFER){
1640  b->yy_bs_lineno = 1;
1641  b->yy_bs_column = 0;
1642  }
1643 
1644  b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1645 
1646  errno = oerrno;
1647 }
1648 
1653  void yy_flush_buffer (YY_BUFFER_STATE b )
1654 {
1655  if ( ! b )
1656  return;
1657 
1658  b->yy_n_chars = 0;
1659 
1660  /* We always need two end-of-buffer characters. The first causes
1661  * a transition to the end-of-buffer state. The second causes
1662  * a jam in that state.
1663  */
1664  b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1665  b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1666 
1667  b->yy_buf_pos = &b->yy_ch_buf[0];
1668 
1669  b->yy_at_bol = 1;
1670  b->yy_buffer_status = YY_BUFFER_NEW;
1671 
1672  if ( b == YY_CURRENT_BUFFER )
1673  yy_load_buffer_state( );
1674 }
1675 
1682 void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
1683 {
1684  if (new_buffer == NULL)
1685  return;
1686 
1687  yyensure_buffer_stack();
1688 
1689  /* This block is copied from yy_switch_to_buffer. */
1690  if ( YY_CURRENT_BUFFER )
1691  {
1692  /* Flush out information for old buffer. */
1693  *(yy_c_buf_p) = (yy_hold_char);
1694  YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1695  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1696  }
1697 
1698  /* Only push if top exists. Otherwise, replace top. */
1699  if (YY_CURRENT_BUFFER)
1700  (yy_buffer_stack_top)++;
1701  YY_CURRENT_BUFFER_LVALUE = new_buffer;
1702 
1703  /* copied from yy_switch_to_buffer. */
1704  yy_load_buffer_state( );
1705  (yy_did_buffer_switch_on_eof) = 1;
1706 }
1707 
1712 void yypop_buffer_state (void)
1713 {
1714  if (!YY_CURRENT_BUFFER)
1715  return;
1716 
1717  yy_delete_buffer(YY_CURRENT_BUFFER );
1718  YY_CURRENT_BUFFER_LVALUE = NULL;
1719  if ((yy_buffer_stack_top) > 0)
1720  --(yy_buffer_stack_top);
1721 
1722  if (YY_CURRENT_BUFFER) {
1723  yy_load_buffer_state( );
1724  (yy_did_buffer_switch_on_eof) = 1;
1725  }
1726 }
1727 
1728 /* Allocates the stack if it does not exist.
1729  * Guarantees space for at least one push.
1730  */
1731 static void yyensure_buffer_stack (void)
1732 {
1733  yy_size_t num_to_alloc;
1734 
1735  if (!(yy_buffer_stack)) {
1736 
1737  /* First allocation is just for 2 elements, since we don't know if this
1738  * scanner will even need a stack. We use 2 instead of 1 to avoid an
1739  * immediate realloc on the next call.
1740  */
1741  num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
1742  (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
1743  (num_to_alloc * sizeof(struct yy_buffer_state*)
1744  );
1745  if ( ! (yy_buffer_stack) )
1746  YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1747 
1748  memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1749 
1750  (yy_buffer_stack_max) = num_to_alloc;
1751  (yy_buffer_stack_top) = 0;
1752  return;
1753  }
1754 
1755  if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1756 
1757  /* Increase the buffer to prepare for a possible push. */
1758  yy_size_t grow_size = 8 /* arbitrary grow size */;
1759 
1760  num_to_alloc = (yy_buffer_stack_max) + grow_size;
1761  (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
1762  ((yy_buffer_stack),
1763  num_to_alloc * sizeof(struct yy_buffer_state*)
1764  );
1765  if ( ! (yy_buffer_stack) )
1766  YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1767 
1768  /* zero only the new slots.*/
1769  memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1770  (yy_buffer_stack_max) = num_to_alloc;
1771  }
1772 }
1773 
1780 YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
1781 {
1782  YY_BUFFER_STATE b;
1783 
1784  if ( size < 2 ||
1785  base[size-2] != YY_END_OF_BUFFER_CHAR ||
1786  base[size-1] != YY_END_OF_BUFFER_CHAR )
1787  /* They forgot to leave room for the EOB's. */
1788  return NULL;
1789 
1790  b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) );
1791  if ( ! b )
1792  YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1793 
1794  b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */
1795  b->yy_buf_pos = b->yy_ch_buf = base;
1796  b->yy_is_our_buffer = 0;
1797  b->yy_input_file = NULL;
1798  b->yy_n_chars = b->yy_buf_size;
1799  b->yy_is_interactive = 0;
1800  b->yy_at_bol = 1;
1801  b->yy_fill_buffer = 0;
1802  b->yy_buffer_status = YY_BUFFER_NEW;
1803 
1804  yy_switch_to_buffer( b );
1805 
1806  return b;
1807 }
1808 
1817 YY_BUFFER_STATE yy_scan_string (const char * yystr )
1818 {
1819 
1820  return yy_scan_bytes( yystr, (int) strlen(yystr) );
1821 }
1822 
1830 YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len )
1831 {
1832  YY_BUFFER_STATE b;
1833  char *buf;
1834  yy_size_t n;
1835  int i;
1836 
1837  /* Get memory for full buffer, including space for trailing EOB's. */
1838  n = (yy_size_t) (_yybytes_len + 2);
1839  buf = (char *) yyalloc( n );
1840  if ( ! buf )
1841  YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1842 
1843  for ( i = 0; i < _yybytes_len; ++i )
1844  buf[i] = yybytes[i];
1845 
1846  buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1847 
1848  b = yy_scan_buffer( buf, n );
1849  if ( ! b )
1850  YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1851 
1852  /* It's okay to grow etc. this buffer, and we should throw it
1853  * away when we're done.
1854  */
1855  b->yy_is_our_buffer = 1;
1856 
1857  return b;
1858 }
1859 
1860 #ifndef YY_EXIT_FAILURE
1861 #define YY_EXIT_FAILURE 2
1862 #endif
1863 
1864 static void yynoreturn yy_fatal_error (const char* msg )
1865 {
1866  fprintf( stderr, "%s\n", msg );
1867  exit( YY_EXIT_FAILURE );
1868 }
1869 
1870 /* Redefine yyless() so it works in section 3 code. */
1871 
1872 #undef yyless
1873 #define yyless(n) \
1874  do \
1875  { \
1876  /* Undo effects of setting up yytext. */ \
1877  int yyless_macro_arg = (n); \
1878  YY_LESS_LINENO(yyless_macro_arg);\
1879  yytext[yyleng] = (yy_hold_char); \
1880  (yy_c_buf_p) = yytext + yyless_macro_arg; \
1881  (yy_hold_char) = *(yy_c_buf_p); \
1882  *(yy_c_buf_p) = '\0'; \
1883  yyleng = yyless_macro_arg; \
1884  } \
1885  while ( 0 )
1886 
1887 /* Accessor methods (get/set functions) to struct members. */
1888 
1892 int yyget_lineno (void)
1893 {
1894 
1895  return yylineno;
1896 }
1897 
1901 FILE *yyget_in (void)
1902 {
1903  return yyin;
1904 }
1905 
1909 FILE *yyget_out (void)
1910 {
1911  return yyout;
1912 }
1913 
1917 int yyget_leng (void)
1918 {
1919  return yyleng;
1920 }
1921 
1926 char *yyget_text (void)
1927 {
1928  return yytext;
1929 }
1930 
1935 void yyset_lineno (int _line_number )
1936 {
1937 
1938  yylineno = _line_number;
1939 }
1940 
1947 void yyset_in (FILE * _in_str )
1948 {
1949  yyin = _in_str ;
1950 }
1951 
1952 void yyset_out (FILE * _out_str )
1953 {
1954  yyout = _out_str ;
1955 }
1956 
1957 int yyget_debug (void)
1958 {
1959  return yy_flex_debug;
1960 }
1961 
1962 void yyset_debug (int _bdebug )
1963 {
1964  yy_flex_debug = _bdebug ;
1965 }
1966 
1967 static int yy_init_globals (void)
1968 {
1969  /* Initialization is the same as for the non-reentrant scanner.
1970  * This function is called from yylex_destroy(), so don't allocate here.
1971  */
1972 
1973  (yy_buffer_stack) = NULL;
1974  (yy_buffer_stack_top) = 0;
1975  (yy_buffer_stack_max) = 0;
1976  (yy_c_buf_p) = NULL;
1977  (yy_init) = 0;
1978  (yy_start) = 0;
1979 
1980 /* Defined in main.c */
1981 #ifdef YY_STDINIT
1982  yyin = stdin;
1983  yyout = stdout;
1984 #else
1985  yyin = NULL;
1986  yyout = NULL;
1987 #endif
1988 
1989  /* For future reference: Set errno on error, since we are called by
1990  * yylex_init()
1991  */
1992  return 0;
1993 }
1994 
1995 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
1996 int yylex_destroy (void)
1997 {
1998 
1999  /* Pop the buffer stack, destroying each element. */
2000  while(YY_CURRENT_BUFFER){
2001  yy_delete_buffer( YY_CURRENT_BUFFER );
2002  YY_CURRENT_BUFFER_LVALUE = NULL;
2003  yypop_buffer_state();
2004  }
2005 
2006  /* Destroy the stack itself. */
2007  yyfree((yy_buffer_stack) );
2008  (yy_buffer_stack) = NULL;
2009 
2010  /* Reset the globals. This is important in a non-reentrant scanner so the next time
2011  * yylex() is called, initialization will occur. */
2012  yy_init_globals( );
2013 
2014  return 0;
2015 }
2016 
2017 /*
2018  * Internal utility routines.
2019  */
2020 
2021 #ifndef yytext_ptr
2022 static void yy_flex_strncpy (char* s1, const char * s2, int n )
2023 {
2024 
2025  int i;
2026  for ( i = 0; i < n; ++i )
2027  s1[i] = s2[i];
2028 }
2029 #endif
2030 
2031 #ifdef YY_NEED_STRLEN
2032 static int yy_flex_strlen (const char * s )
2033 {
2034  int n;
2035  for ( n = 0; s[n]; ++n )
2036  ;
2037 
2038  return n;
2039 }
2040 #endif
2041 
2042 void *yyalloc (yy_size_t size )
2043 {
2044  return malloc(size);
2045 }
2046 
2047 void *yyrealloc (void * ptr, yy_size_t size )
2048 {
2049 
2050  /* The cast to (char *) in the following accommodates both
2051  * implementations that use char* generic pointers, and those
2052  * that use void* generic pointers. It works with the latter
2053  * because both ANSI C and C++ allow castless assignment from
2054  * any pointer type to void*, and deal with argument conversions
2055  * as though doing an assignment.
2056  */
2057  return realloc(ptr, size);
2058 }
2059 
2060 void yyfree (void * ptr )
2061 {
2062  free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
2063 }
2064 
2065 #define YYTABLES_NAME "yytables"
2066 
2067 #line 77 "tokenparser.l"
2068 
2069 
2070 
2071 static void eval_key(char *pcToken, list_t *list_key)
2072 {
2073  struct bundleElt *elt;
2074  int r;
2075  size_t len;
2076 
2077  /* create a new list element */
2078  elt = malloc(sizeof(*elt));
2079  assert(elt);
2080 
2081  /* <key>foobar</key>
2082  * 012345 : 5 is the first key character index */
2083 
2084  /* calculate the argument length */
2085  for (len=0; pcToken[len+5] != '<'; len++)
2086  ;
2087  len++; /* final NULL byte */
2088 
2089  elt->key = malloc(len);
2090  memcpy(elt->key, &pcToken[5], len-1);
2091  elt->key[len-1] = '\0';
2092 
2093  r = list_init(&elt->values);
2094  assert(r >= 0);
2095  (void)r;
2096 
2097  /* add the key/values */
2098  list_append(list_key, elt);
2099 
2100  /* set the list to store the values */
2101  ListValues = &elt->values;
2102 }
2103 
2104 static void eval_value(char *pcToken, list_t *list_values)
2105 {
2106  int r;
2107  size_t len;
2108  char *value;
2109  char *amp;
2110 
2111  /* <string>foobar</string>
2112  * 012345678 : 8 is the first string character index */
2113 
2114  /* calculate the argument length */
2115  for (len=0; pcToken[len+8] != '<'; len++)
2116  ;
2117  len++; /* final NULL byte */
2118 
2119  value = malloc(len);
2120  assert(value);
2121 
2122  memcpy(value, &pcToken[8], len-1);
2123  value[len-1] = '\0';
2124 
2125  /* for all &amp; in the string */
2126  amp = value;
2127  while ((amp = strstr(amp, "&amp;")) != NULL)
2128  {
2129  char *p;
2130 
2131  /* just skip "amp;" substring (4 letters) */
2132  for (p = amp+1; *(p+4); p++)
2133  {
2134  *p = *(p+4);
2135  }
2136  /* terminate the now shorter string */
2137  *p = '\0';
2138 
2139  /* skip the & and continue */
2140  amp++;
2141  }
2142 
2143  r = list_append(list_values, value);
2144  assert(r >= 0);
2145  (void)r;
2146 }
2147 
2148 void tperrorCheck (char *token_error)
2149 {
2150  (void)token_error;
2151 }
2152 
2163 int LTPBundleFindValueWithKey(list_t *l, const char *key, list_t **values)
2164 {
2165  unsigned int i;
2166  int ret = 1;
2167 
2168  for (i=0; i < list_size(l); i++)
2169  {
2170  struct bundleElt *elt;
2171 
2172  elt = list_get_at(l, i);
2173  assert(elt);
2174 
2175  if (0 == strcmp(elt->key, key))
2176  {
2177  *values = &elt->values;
2178  ret = 0;
2179  }
2180  }
2181 
2182  return ret;
2183 }
2184 
2185 
2194 int bundleParse(const char *fileName, list_t *l)
2195 {
2196  FILE *file = NULL;
2197  int r;
2198 #ifndef NDEBUG
2199  int i;
2200 #endif
2201 
2202  file = fopen(fileName, "r");
2203  if (!file)
2204  {
2205  Log3(PCSC_LOG_CRITICAL, "Could not open bundle file %s: %s",
2206  fileName, strerror(errno));
2207  return 1;
2208  }
2209 
2210  r = list_init(l);
2211  assert(r >= 0);
2212  (void)r;
2213 
2214  ListKeys = l;
2215  yyin = file;
2216 
2217  do
2218  {
2219  (void)yylex();
2220  } while (!feof(file));
2221  yylex_destroy();
2222 
2223  (void)fclose(file);
2224 
2225 #ifndef NDEBUG
2226  printf("size: %d\n", list_size(l));
2227  for (i=0; i < list_size(l); i++)
2228  {
2229  struct bundleElt *elt;
2230  unsigned int j;
2231 
2232  elt = list_get_at(l, i);
2233  assert(elt);
2234  printf("Key: %s\n", elt->key);
2235 
2236  for (j=0; j<list_size(&elt->values); j++)
2237  {
2238  char *v = list_get_at(&elt->values, j);
2239  printf(" value: %s\n", v);
2240  }
2241  }
2242 #endif
2243 
2244  return 0;
2245 }
2246 
2252 void bundleRelease(list_t *l)
2253 {
2254  unsigned int i;
2255 
2256  for (i=0; i < list_size(l); i++)
2257  {
2258  struct bundleElt *elt;
2259  unsigned int j;
2260 
2261  elt = list_get_at(l, i);
2262  assert(elt);
2263 
2264  /* free all the values */
2265  for (j=0; j<list_size(&elt->values); j++)
2266  free(list_get_at(&elt->values, j));
2267  list_destroy(&elt->values);
2268 
2269  /* free the key */
2270  free(elt->key);
2271  free(elt);
2272  }
2273 
2274  list_destroy(l);
2275 }
2276 
list object
Definition: simclist.h:181
static YY_BUFFER_STATE * yy_buffer_stack
Stack as an array.
Definition: tokenparser.c:510
int yy_bs_column
The column count.
Definition: configfile.c:222
Reads lexical config files and updates database.
static size_t yy_buffer_stack_max
capacity of stack.
Definition: tokenparser.c:509
YY_DECL
The main scanner function which does all the work.
Definition: tokenparser.c:971
static size_t yy_buffer_stack_top
index of top of stack.
Definition: tokenparser.c:508
This handles debugging.
int yy_bs_lineno
The line count.
Definition: configfile.c:221