pcsc-lite  1.8.25
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 #define NDEBUG
771 #include <assert.h>
772 
773 #include "simclist.h"
774 #include "debuglog.h"
775 #include "parser.h"
776 
777 static void eval_key(char *pcToken, list_t *list_key);
778 static void eval_value(char *pcToken, list_t *list_values);
779 void tperrorCheck (char *pcToken_error);
780 
781 static list_t *ListKeys;
782 static list_t *ListValues;
783 
784 #line 785 "tokenparser.c"
785 #define YY_NO_INPUT 1
786 #line 787 "tokenparser.c"
787 
788 #define INITIAL 0
789 
790 #ifndef YY_NO_UNISTD_H
791 /* Special case for "unistd.h", since it is non-ANSI. We include it way
792  * down here because we want the user's section 1 to have been scanned first.
793  * The user has a chance to override it with an option.
794  */
795 #include <unistd.h>
796 #endif
797 
798 #ifndef YY_EXTRA_TYPE
799 #define YY_EXTRA_TYPE void *
800 #endif
801 
802 static int yy_init_globals ( void );
803 
804 /* Accessor methods to globals.
805  These are made visible to non-reentrant scanners for convenience. */
806 
807 int yylex_destroy ( void );
808 
809 int yyget_debug ( void );
810 
811 void yyset_debug ( int debug_flag );
812 
813 YY_EXTRA_TYPE yyget_extra ( void );
814 
815 void yyset_extra ( YY_EXTRA_TYPE user_defined );
816 
817 FILE *yyget_in ( void );
818 
819 void yyset_in ( FILE * _in_str );
820 
821 FILE *yyget_out ( void );
822 
823 void yyset_out ( FILE * _out_str );
824 
825  int yyget_leng ( void );
826 
827 char *yyget_text ( void );
828 
829 int yyget_lineno ( void );
830 
831 void yyset_lineno ( int _line_number );
832 
833 /* Macros after this point can all be overridden by user definitions in
834  * section 1.
835  */
836 
837 #ifndef YY_SKIP_YYWRAP
838 #ifdef __cplusplus
839 extern "C" int yywrap ( void );
840 #else
841 extern int yywrap ( void );
842 #endif
843 #endif
844 
845 #ifndef YY_NO_UNPUT
846 
847 #endif
848 
849 #ifndef yytext_ptr
850 static void yy_flex_strncpy ( char *, const char *, int );
851 #endif
852 
853 #ifdef YY_NEED_STRLEN
854 static int yy_flex_strlen ( const char * );
855 #endif
856 
857 #ifndef YY_NO_INPUT
858 #ifdef __cplusplus
859 static int yyinput ( void );
860 #else
861 static int input ( void );
862 #endif
863 
864 #endif
865 
866 /* Amount of stuff to slurp up with each read. */
867 #ifndef YY_READ_BUF_SIZE
868 #ifdef __ia64__
869 /* On IA-64, the buffer size is 16k, not 8k */
870 #define YY_READ_BUF_SIZE 16384
871 #else
872 #define YY_READ_BUF_SIZE 8192
873 #endif /* __ia64__ */
874 #endif
875 
876 /* Copy whatever the last rule matched to the standard output. */
877 #ifndef ECHO
878 /* This used to be an fputs(), but since the string might contain NUL's,
879  * we now use fwrite().
880  */
881 #define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
882 #endif
883 
884 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
885  * is returned in "result".
886  */
887 #ifndef YY_INPUT
888 #define YY_INPUT(buf,result,max_size) \
889  if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
890  { \
891  int c = '*'; \
892  int n; \
893  for ( n = 0; n < max_size && \
894  (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
895  buf[n] = (char) c; \
896  if ( c == '\n' ) \
897  buf[n++] = (char) c; \
898  if ( c == EOF && ferror( yyin ) ) \
899  YY_FATAL_ERROR( "input in flex scanner failed" ); \
900  result = n; \
901  } \
902  else \
903  { \
904  errno=0; \
905  while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \
906  { \
907  if( errno != EINTR) \
908  { \
909  YY_FATAL_ERROR( "input in flex scanner failed" ); \
910  break; \
911  } \
912  errno=0; \
913  clearerr(yyin); \
914  } \
915  }\
916 \
917 
918 #endif
919 
920 /* No semi-colon after return; correct usage is to write "yyterminate();" -
921  * we don't want an extra ';' after the "return" because that will cause
922  * some compilers to complain about unreachable statements.
923  */
924 #ifndef yyterminate
925 #define yyterminate() return YY_NULL
926 #endif
927 
928 /* Number of entries by which start-condition stack grows. */
929 #ifndef YY_START_STACK_INCR
930 #define YY_START_STACK_INCR 25
931 #endif
932 
933 /* Report a fatal error. */
934 #ifndef YY_FATAL_ERROR
935 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
936 #endif
937 
938 /* end tables serialization structures and prototypes */
939 
940 /* Default declaration of generated scanner - a define so the user can
941  * easily add parameters.
942  */
943 #ifndef YY_DECL
944 #define YY_DECL_IS_OURS 1
945 
946 extern int yylex (void);
947 
948 #define YY_DECL int yylex (void)
949 #endif /* !YY_DECL */
950 
951 /* Code executed at the beginning of each rule, after yytext and yyleng
952  * have been set up.
953  */
954 #ifndef YY_USER_ACTION
955 #define YY_USER_ACTION
956 #endif
957 
958 /* Code executed at the end of each rule. */
959 #ifndef YY_BREAK
960 #define YY_BREAK /*LINTED*/break;
961 #endif
962 
963 #define YY_RULE_SETUP \
964  YY_USER_ACTION
965 
968 YY_DECL
969 {
970  yy_state_type yy_current_state;
971  char *yy_cp, *yy_bp;
972  int yy_act;
973 
974  if ( !(yy_init) )
975  {
976  (yy_init) = 1;
977 
978 #ifdef YY_USER_INIT
979  YY_USER_INIT;
980 #endif
981 
982  if ( ! (yy_start) )
983  (yy_start) = 1; /* first start state */
984 
985  if ( ! yyin )
986  yyin = stdin;
987 
988  if ( ! yyout )
989  yyout = stdout;
990 
991  if ( ! YY_CURRENT_BUFFER ) {
992  yyensure_buffer_stack ();
993  YY_CURRENT_BUFFER_LVALUE =
994  yy_create_buffer( yyin, YY_BUF_SIZE );
995  }
996 
997  yy_load_buffer_state( );
998  }
999 
1000  {
1001 #line 67 "tokenparser.l"
1002 
1003 
1004 #line 1005 "tokenparser.c"
1005 
1006  while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
1007  {
1008  yy_cp = (yy_c_buf_p);
1009 
1010  /* Support of yytext. */
1011  *yy_cp = (yy_hold_char);
1012 
1013  /* yy_bp points to the position in yy_ch_buf of the start of
1014  * the current run.
1015  */
1016  yy_bp = yy_cp;
1017 
1018  yy_current_state = (yy_start);
1019 yy_match:
1020  do
1021  {
1022  YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
1023  if ( yy_accept[yy_current_state] )
1024  {
1025  (yy_last_accepting_state) = yy_current_state;
1026  (yy_last_accepting_cpos) = yy_cp;
1027  }
1028  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1029  {
1030  yy_current_state = (int) yy_def[yy_current_state];
1031  if ( yy_current_state >= 39 )
1032  yy_c = yy_meta[yy_c];
1033  }
1034  yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
1035  ++yy_cp;
1036  }
1037  while ( yy_base[yy_current_state] != 50 );
1038 
1039 yy_find_action:
1040  yy_act = yy_accept[yy_current_state];
1041  if ( yy_act == 0 )
1042  { /* have to back up */
1043  yy_cp = (yy_last_accepting_cpos);
1044  yy_current_state = (yy_last_accepting_state);
1045  yy_act = yy_accept[yy_current_state];
1046  }
1047 
1048  YY_DO_BEFORE_ACTION;
1049 
1050 do_action: /* This label is used only to access EOF actions. */
1051 
1052  switch ( yy_act )
1053  { /* beginning of action switch */
1054  case 0: /* must back up */
1055  /* undo the effects of YY_DO_BEFORE_ACTION */
1056  *yy_cp = (yy_hold_char);
1057  yy_cp = (yy_last_accepting_cpos);
1058  yy_current_state = (yy_last_accepting_state);
1059  goto yy_find_action;
1060 
1061 case 1:
1062 YY_RULE_SETUP
1063 #line 69 "tokenparser.l"
1064 {}
1065  YY_BREAK
1066 case 2:
1067 /* rule 2 can match eol */
1068 YY_RULE_SETUP
1069 #line 70 "tokenparser.l"
1070 {}
1071  YY_BREAK
1072 case 3:
1073 YY_RULE_SETUP
1074 #line 71 "tokenparser.l"
1075 { eval_key(yytext, ListKeys); }
1076  YY_BREAK
1077 case 4:
1078 YY_RULE_SETUP
1079 #line 72 "tokenparser.l"
1080 {}
1081  YY_BREAK
1082 case 5:
1083 YY_RULE_SETUP
1084 #line 73 "tokenparser.l"
1085 { eval_value(yytext, ListValues); }
1086  YY_BREAK
1087 case 6:
1088 YY_RULE_SETUP
1089 #line 74 "tokenparser.l"
1090 { tperrorCheck(yytext); }
1091  YY_BREAK
1092 case 7:
1093 YY_RULE_SETUP
1094 #line 75 "tokenparser.l"
1095 ECHO;
1096  YY_BREAK
1097 #line 1098 "tokenparser.c"
1098 case YY_STATE_EOF(INITIAL):
1099  yyterminate();
1100 
1101  case YY_END_OF_BUFFER:
1102  {
1103  /* Amount of text matched not including the EOB char. */
1104  int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
1105 
1106  /* Undo the effects of YY_DO_BEFORE_ACTION. */
1107  *yy_cp = (yy_hold_char);
1108  YY_RESTORE_YY_MORE_OFFSET
1109 
1110  if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
1111  {
1112  /* We're scanning a new file or input source. It's
1113  * possible that this happened because the user
1114  * just pointed yyin at a new source and called
1115  * yylex(). If so, then we have to assure
1116  * consistency between YY_CURRENT_BUFFER and our
1117  * globals. Here is the right place to do so, because
1118  * this is the first action (other than possibly a
1119  * back-up) that will match for the new input source.
1120  */
1121  (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1122  YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
1123  YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
1124  }
1125 
1126  /* Note that here we test for yy_c_buf_p "<=" to the position
1127  * of the first EOB in the buffer, since yy_c_buf_p will
1128  * already have been incremented past the NUL character
1129  * (since all states make transitions on EOB to the
1130  * end-of-buffer state). Contrast this with the test
1131  * in input().
1132  */
1133  if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1134  { /* This was really a NUL. */
1135  yy_state_type yy_next_state;
1136 
1137  (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
1138 
1139  yy_current_state = yy_get_previous_state( );
1140 
1141  /* Okay, we're now positioned to make the NUL
1142  * transition. We couldn't have
1143  * yy_get_previous_state() go ahead and do it
1144  * for us because it doesn't know how to deal
1145  * with the possibility of jamming (and we don't
1146  * want to build jamming into it because then it
1147  * will run more slowly).
1148  */
1149 
1150  yy_next_state = yy_try_NUL_trans( yy_current_state );
1151 
1152  yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1153 
1154  if ( yy_next_state )
1155  {
1156  /* Consume the NUL. */
1157  yy_cp = ++(yy_c_buf_p);
1158  yy_current_state = yy_next_state;
1159  goto yy_match;
1160  }
1161 
1162  else
1163  {
1164  yy_cp = (yy_c_buf_p);
1165  goto yy_find_action;
1166  }
1167  }
1168 
1169  else switch ( yy_get_next_buffer( ) )
1170  {
1171  case EOB_ACT_END_OF_FILE:
1172  {
1173  (yy_did_buffer_switch_on_eof) = 0;
1174 
1175  if ( yywrap( ) )
1176  {
1177  /* Note: because we've taken care in
1178  * yy_get_next_buffer() to have set up
1179  * yytext, we can now set up
1180  * yy_c_buf_p so that if some total
1181  * hoser (like flex itself) wants to
1182  * call the scanner after we return the
1183  * YY_NULL, it'll still work - another
1184  * YY_NULL will get returned.
1185  */
1186  (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1187 
1188  yy_act = YY_STATE_EOF(YY_START);
1189  goto do_action;
1190  }
1191 
1192  else
1193  {
1194  if ( ! (yy_did_buffer_switch_on_eof) )
1195  YY_NEW_FILE;
1196  }
1197  break;
1198  }
1199 
1200  case EOB_ACT_CONTINUE_SCAN:
1201  (yy_c_buf_p) =
1202  (yytext_ptr) + yy_amount_of_matched_text;
1203 
1204  yy_current_state = yy_get_previous_state( );
1205 
1206  yy_cp = (yy_c_buf_p);
1207  yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1208  goto yy_match;
1209 
1210  case EOB_ACT_LAST_MATCH:
1211  (yy_c_buf_p) =
1212  &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1213 
1214  yy_current_state = yy_get_previous_state( );
1215 
1216  yy_cp = (yy_c_buf_p);
1217  yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1218  goto yy_find_action;
1219  }
1220  break;
1221  }
1222 
1223  default:
1224  YY_FATAL_ERROR(
1225  "fatal flex scanner internal error--no action found" );
1226  } /* end of action switch */
1227  } /* end of scanning one token */
1228  } /* end of user's declarations */
1229 } /* end of yylex */
1230 
1231 /* yy_get_next_buffer - try to read in a new buffer
1232  *
1233  * Returns a code representing an action:
1234  * EOB_ACT_LAST_MATCH -
1235  * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1236  * EOB_ACT_END_OF_FILE - end of file
1237  */
1238 static int yy_get_next_buffer (void)
1239 {
1240  char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1241  char *source = (yytext_ptr);
1242  int number_to_move, i;
1243  int ret_val;
1244 
1245  if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1246  YY_FATAL_ERROR(
1247  "fatal flex scanner internal error--end of buffer missed" );
1248 
1249  if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1250  { /* Don't try to fill the buffer, so this is an EOF. */
1251  if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1252  {
1253  /* We matched a single character, the EOB, so
1254  * treat this as a final EOF.
1255  */
1256  return EOB_ACT_END_OF_FILE;
1257  }
1258 
1259  else
1260  {
1261  /* We matched some text prior to the EOB, first
1262  * process it.
1263  */
1264  return EOB_ACT_LAST_MATCH;
1265  }
1266  }
1267 
1268  /* Try to read more data. */
1269 
1270  /* First move last chars to start of buffer. */
1271  number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1);
1272 
1273  for ( i = 0; i < number_to_move; ++i )
1274  *(dest++) = *(source++);
1275 
1276  if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1277  /* don't do the read, it's not guaranteed to return an EOF,
1278  * just force an EOF
1279  */
1280  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1281 
1282  else
1283  {
1284  int num_to_read =
1285  YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1286 
1287  while ( num_to_read <= 0 )
1288  { /* Not enough room in the buffer - grow it. */
1289 
1290  /* just a shorter name for the current buffer */
1291  YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
1292 
1293  int yy_c_buf_p_offset =
1294  (int) ((yy_c_buf_p) - b->yy_ch_buf);
1295 
1296  if ( b->yy_is_our_buffer )
1297  {
1298  int new_size = b->yy_buf_size * 2;
1299 
1300  if ( new_size <= 0 )
1301  b->yy_buf_size += b->yy_buf_size / 8;
1302  else
1303  b->yy_buf_size *= 2;
1304 
1305  b->yy_ch_buf = (char *)
1306  /* Include room in for 2 EOB chars. */
1307  yyrealloc( (void *) b->yy_ch_buf,
1308  (yy_size_t) (b->yy_buf_size + 2) );
1309  }
1310  else
1311  /* Can't grow it, we don't own it. */
1312  b->yy_ch_buf = NULL;
1313 
1314  if ( ! b->yy_ch_buf )
1315  YY_FATAL_ERROR(
1316  "fatal error - scanner input buffer overflow" );
1317 
1318  (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1319 
1320  num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1321  number_to_move - 1;
1322 
1323  }
1324 
1325  if ( num_to_read > YY_READ_BUF_SIZE )
1326  num_to_read = YY_READ_BUF_SIZE;
1327 
1328  /* Read in more data. */
1329  YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1330  (yy_n_chars), num_to_read );
1331 
1332  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1333  }
1334 
1335  if ( (yy_n_chars) == 0 )
1336  {
1337  if ( number_to_move == YY_MORE_ADJ )
1338  {
1339  ret_val = EOB_ACT_END_OF_FILE;
1340  yyrestart( yyin );
1341  }
1342 
1343  else
1344  {
1345  ret_val = EOB_ACT_LAST_MATCH;
1346  YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1347  YY_BUFFER_EOF_PENDING;
1348  }
1349  }
1350 
1351  else
1352  ret_val = EOB_ACT_CONTINUE_SCAN;
1353 
1354  if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1355  /* Extend the array by 50%, plus the number we really need. */
1356  int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1357  YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
1358  (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size );
1359  if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1360  YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
1361  /* "- 2" to take care of EOB's */
1362  YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
1363  }
1364 
1365  (yy_n_chars) += number_to_move;
1366  YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1367  YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1368 
1369  (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1370 
1371  return ret_val;
1372 }
1373 
1374 /* yy_get_previous_state - get the state just before the EOB char was reached */
1375 
1376  static yy_state_type yy_get_previous_state (void)
1377 {
1378  yy_state_type yy_current_state;
1379  char *yy_cp;
1380 
1381  yy_current_state = (yy_start);
1382 
1383  for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1384  {
1385  YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1386  if ( yy_accept[yy_current_state] )
1387  {
1388  (yy_last_accepting_state) = yy_current_state;
1389  (yy_last_accepting_cpos) = yy_cp;
1390  }
1391  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1392  {
1393  yy_current_state = (int) yy_def[yy_current_state];
1394  if ( yy_current_state >= 39 )
1395  yy_c = yy_meta[yy_c];
1396  }
1397  yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
1398  }
1399 
1400  return yy_current_state;
1401 }
1402 
1403 /* yy_try_NUL_trans - try to make a transition on the NUL character
1404  *
1405  * synopsis
1406  * next_state = yy_try_NUL_trans( current_state );
1407  */
1408  static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1409 {
1410  int yy_is_jam;
1411  char *yy_cp = (yy_c_buf_p);
1412 
1413  YY_CHAR yy_c = 1;
1414  if ( yy_accept[yy_current_state] )
1415  {
1416  (yy_last_accepting_state) = yy_current_state;
1417  (yy_last_accepting_cpos) = yy_cp;
1418  }
1419  while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1420  {
1421  yy_current_state = (int) yy_def[yy_current_state];
1422  if ( yy_current_state >= 39 )
1423  yy_c = yy_meta[yy_c];
1424  }
1425  yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
1426  yy_is_jam = (yy_current_state == 38);
1427 
1428  return yy_is_jam ? 0 : yy_current_state;
1429 }
1430 
1431 #ifndef YY_NO_UNPUT
1432 
1433 #endif
1434 
1435 #ifndef YY_NO_INPUT
1436 #ifdef __cplusplus
1437  static int yyinput (void)
1438 #else
1439  static int input (void)
1440 #endif
1441 
1442 {
1443  int c;
1444 
1445  *(yy_c_buf_p) = (yy_hold_char);
1446 
1447  if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1448  {
1449  /* yy_c_buf_p now points to the character we want to return.
1450  * If this occurs *before* the EOB characters, then it's a
1451  * valid NUL; if not, then we've hit the end of the buffer.
1452  */
1453  if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1454  /* This was really a NUL. */
1455  *(yy_c_buf_p) = '\0';
1456 
1457  else
1458  { /* need more input */
1459  int offset = (int) ((yy_c_buf_p) - (yytext_ptr));
1460  ++(yy_c_buf_p);
1461 
1462  switch ( yy_get_next_buffer( ) )
1463  {
1464  case EOB_ACT_LAST_MATCH:
1465  /* This happens because yy_g_n_b()
1466  * sees that we've accumulated a
1467  * token and flags that we need to
1468  * try matching the token before
1469  * proceeding. But for input(),
1470  * there's no matching to consider.
1471  * So convert the EOB_ACT_LAST_MATCH
1472  * to EOB_ACT_END_OF_FILE.
1473  */
1474 
1475  /* Reset buffer status. */
1476  yyrestart( yyin );
1477 
1478  /*FALLTHROUGH*/
1479 
1480  case EOB_ACT_END_OF_FILE:
1481  {
1482  if ( yywrap( ) )
1483  return 0;
1484 
1485  if ( ! (yy_did_buffer_switch_on_eof) )
1486  YY_NEW_FILE;
1487 #ifdef __cplusplus
1488  return yyinput();
1489 #else
1490  return input();
1491 #endif
1492  }
1493 
1494  case EOB_ACT_CONTINUE_SCAN:
1495  (yy_c_buf_p) = (yytext_ptr) + offset;
1496  break;
1497  }
1498  }
1499  }
1500 
1501  c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1502  *(yy_c_buf_p) = '\0'; /* preserve yytext */
1503  (yy_hold_char) = *++(yy_c_buf_p);
1504 
1505  return c;
1506 }
1507 #endif /* ifndef YY_NO_INPUT */
1508 
1514  void yyrestart (FILE * input_file )
1515 {
1516 
1517  if ( ! YY_CURRENT_BUFFER ){
1518  yyensure_buffer_stack ();
1519  YY_CURRENT_BUFFER_LVALUE =
1520  yy_create_buffer( yyin, YY_BUF_SIZE );
1521  }
1522 
1523  yy_init_buffer( YY_CURRENT_BUFFER, input_file );
1524  yy_load_buffer_state( );
1525 }
1526 
1531  void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1532 {
1533 
1534  /* TODO. We should be able to replace this entire function body
1535  * with
1536  * yypop_buffer_state();
1537  * yypush_buffer_state(new_buffer);
1538  */
1539  yyensure_buffer_stack ();
1540  if ( YY_CURRENT_BUFFER == new_buffer )
1541  return;
1542 
1543  if ( YY_CURRENT_BUFFER )
1544  {
1545  /* Flush out information for old buffer. */
1546  *(yy_c_buf_p) = (yy_hold_char);
1547  YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1548  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1549  }
1550 
1551  YY_CURRENT_BUFFER_LVALUE = new_buffer;
1552  yy_load_buffer_state( );
1553 
1554  /* We don't actually know whether we did this switch during
1555  * EOF (yywrap()) processing, but the only time this flag
1556  * is looked at is after yywrap() is called, so it's safe
1557  * to go ahead and always set it.
1558  */
1559  (yy_did_buffer_switch_on_eof) = 1;
1560 }
1561 
1562 static void yy_load_buffer_state (void)
1563 {
1564  (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1565  (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1566  yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1567  (yy_hold_char) = *(yy_c_buf_p);
1568 }
1569 
1576  YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
1577 {
1578  YY_BUFFER_STATE b;
1579 
1580  b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) );
1581  if ( ! b )
1582  YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1583 
1584  b->yy_buf_size = size;
1585 
1586  /* yy_ch_buf has to be 2 characters longer than the size given because
1587  * we need to put in 2 end-of-buffer characters.
1588  */
1589  b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) );
1590  if ( ! b->yy_ch_buf )
1591  YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1592 
1593  b->yy_is_our_buffer = 1;
1594 
1595  yy_init_buffer( b, file );
1596 
1597  return b;
1598 }
1599 
1604  void yy_delete_buffer (YY_BUFFER_STATE b )
1605 {
1606 
1607  if ( ! b )
1608  return;
1609 
1610  if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1611  YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1612 
1613  if ( b->yy_is_our_buffer )
1614  yyfree( (void *) b->yy_ch_buf );
1615 
1616  yyfree( (void *) b );
1617 }
1618 
1619 /* Initializes or reinitializes a buffer.
1620  * This function is sometimes called more than once on the same buffer,
1621  * such as during a yyrestart() or at EOF.
1622  */
1623  static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
1624 
1625 {
1626  int oerrno = errno;
1627 
1628  yy_flush_buffer( b );
1629 
1630  b->yy_input_file = file;
1631  b->yy_fill_buffer = 1;
1632 
1633  /* If b is the current buffer, then yy_init_buffer was _probably_
1634  * called from yyrestart() or through yy_get_next_buffer.
1635  * In that case, we don't want to reset the lineno or column.
1636  */
1637  if (b != YY_CURRENT_BUFFER){
1638  b->yy_bs_lineno = 1;
1639  b->yy_bs_column = 0;
1640  }
1641 
1642  b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1643 
1644  errno = oerrno;
1645 }
1646 
1651  void yy_flush_buffer (YY_BUFFER_STATE b )
1652 {
1653  if ( ! b )
1654  return;
1655 
1656  b->yy_n_chars = 0;
1657 
1658  /* We always need two end-of-buffer characters. The first causes
1659  * a transition to the end-of-buffer state. The second causes
1660  * a jam in that state.
1661  */
1662  b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1663  b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1664 
1665  b->yy_buf_pos = &b->yy_ch_buf[0];
1666 
1667  b->yy_at_bol = 1;
1668  b->yy_buffer_status = YY_BUFFER_NEW;
1669 
1670  if ( b == YY_CURRENT_BUFFER )
1671  yy_load_buffer_state( );
1672 }
1673 
1680 void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
1681 {
1682  if (new_buffer == NULL)
1683  return;
1684 
1685  yyensure_buffer_stack();
1686 
1687  /* This block is copied from yy_switch_to_buffer. */
1688  if ( YY_CURRENT_BUFFER )
1689  {
1690  /* Flush out information for old buffer. */
1691  *(yy_c_buf_p) = (yy_hold_char);
1692  YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1693  YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1694  }
1695 
1696  /* Only push if top exists. Otherwise, replace top. */
1697  if (YY_CURRENT_BUFFER)
1698  (yy_buffer_stack_top)++;
1699  YY_CURRENT_BUFFER_LVALUE = new_buffer;
1700 
1701  /* copied from yy_switch_to_buffer. */
1702  yy_load_buffer_state( );
1703  (yy_did_buffer_switch_on_eof) = 1;
1704 }
1705 
1710 void yypop_buffer_state (void)
1711 {
1712  if (!YY_CURRENT_BUFFER)
1713  return;
1714 
1715  yy_delete_buffer(YY_CURRENT_BUFFER );
1716  YY_CURRENT_BUFFER_LVALUE = NULL;
1717  if ((yy_buffer_stack_top) > 0)
1718  --(yy_buffer_stack_top);
1719 
1720  if (YY_CURRENT_BUFFER) {
1721  yy_load_buffer_state( );
1722  (yy_did_buffer_switch_on_eof) = 1;
1723  }
1724 }
1725 
1726 /* Allocates the stack if it does not exist.
1727  * Guarantees space for at least one push.
1728  */
1729 static void yyensure_buffer_stack (void)
1730 {
1731  yy_size_t num_to_alloc;
1732 
1733  if (!(yy_buffer_stack)) {
1734 
1735  /* First allocation is just for 2 elements, since we don't know if this
1736  * scanner will even need a stack. We use 2 instead of 1 to avoid an
1737  * immediate realloc on the next call.
1738  */
1739  num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
1740  (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
1741  (num_to_alloc * sizeof(struct yy_buffer_state*)
1742  );
1743  if ( ! (yy_buffer_stack) )
1744  YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1745 
1746  memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1747 
1748  (yy_buffer_stack_max) = num_to_alloc;
1749  (yy_buffer_stack_top) = 0;
1750  return;
1751  }
1752 
1753  if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1754 
1755  /* Increase the buffer to prepare for a possible push. */
1756  yy_size_t grow_size = 8 /* arbitrary grow size */;
1757 
1758  num_to_alloc = (yy_buffer_stack_max) + grow_size;
1759  (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
1760  ((yy_buffer_stack),
1761  num_to_alloc * sizeof(struct yy_buffer_state*)
1762  );
1763  if ( ! (yy_buffer_stack) )
1764  YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
1765 
1766  /* zero only the new slots.*/
1767  memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1768  (yy_buffer_stack_max) = num_to_alloc;
1769  }
1770 }
1771 
1778 YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
1779 {
1780  YY_BUFFER_STATE b;
1781 
1782  if ( size < 2 ||
1783  base[size-2] != YY_END_OF_BUFFER_CHAR ||
1784  base[size-1] != YY_END_OF_BUFFER_CHAR )
1785  /* They forgot to leave room for the EOB's. */
1786  return NULL;
1787 
1788  b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) );
1789  if ( ! b )
1790  YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1791 
1792  b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */
1793  b->yy_buf_pos = b->yy_ch_buf = base;
1794  b->yy_is_our_buffer = 0;
1795  b->yy_input_file = NULL;
1796  b->yy_n_chars = b->yy_buf_size;
1797  b->yy_is_interactive = 0;
1798  b->yy_at_bol = 1;
1799  b->yy_fill_buffer = 0;
1800  b->yy_buffer_status = YY_BUFFER_NEW;
1801 
1802  yy_switch_to_buffer( b );
1803 
1804  return b;
1805 }
1806 
1815 YY_BUFFER_STATE yy_scan_string (const char * yystr )
1816 {
1817 
1818  return yy_scan_bytes( yystr, (int) strlen(yystr) );
1819 }
1820 
1828 YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len )
1829 {
1830  YY_BUFFER_STATE b;
1831  char *buf;
1832  yy_size_t n;
1833  int i;
1834 
1835  /* Get memory for full buffer, including space for trailing EOB's. */
1836  n = (yy_size_t) (_yybytes_len + 2);
1837  buf = (char *) yyalloc( n );
1838  if ( ! buf )
1839  YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1840 
1841  for ( i = 0; i < _yybytes_len; ++i )
1842  buf[i] = yybytes[i];
1843 
1844  buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1845 
1846  b = yy_scan_buffer( buf, n );
1847  if ( ! b )
1848  YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1849 
1850  /* It's okay to grow etc. this buffer, and we should throw it
1851  * away when we're done.
1852  */
1853  b->yy_is_our_buffer = 1;
1854 
1855  return b;
1856 }
1857 
1858 #ifndef YY_EXIT_FAILURE
1859 #define YY_EXIT_FAILURE 2
1860 #endif
1861 
1862 static void yynoreturn yy_fatal_error (const char* msg )
1863 {
1864  fprintf( stderr, "%s\n", msg );
1865  exit( YY_EXIT_FAILURE );
1866 }
1867 
1868 /* Redefine yyless() so it works in section 3 code. */
1869 
1870 #undef yyless
1871 #define yyless(n) \
1872  do \
1873  { \
1874  /* Undo effects of setting up yytext. */ \
1875  int yyless_macro_arg = (n); \
1876  YY_LESS_LINENO(yyless_macro_arg);\
1877  yytext[yyleng] = (yy_hold_char); \
1878  (yy_c_buf_p) = yytext + yyless_macro_arg; \
1879  (yy_hold_char) = *(yy_c_buf_p); \
1880  *(yy_c_buf_p) = '\0'; \
1881  yyleng = yyless_macro_arg; \
1882  } \
1883  while ( 0 )
1884 
1885 /* Accessor methods (get/set functions) to struct members. */
1886 
1890 int yyget_lineno (void)
1891 {
1892 
1893  return yylineno;
1894 }
1895 
1899 FILE *yyget_in (void)
1900 {
1901  return yyin;
1902 }
1903 
1907 FILE *yyget_out (void)
1908 {
1909  return yyout;
1910 }
1911 
1915 int yyget_leng (void)
1916 {
1917  return yyleng;
1918 }
1919 
1924 char *yyget_text (void)
1925 {
1926  return yytext;
1927 }
1928 
1933 void yyset_lineno (int _line_number )
1934 {
1935 
1936  yylineno = _line_number;
1937 }
1938 
1945 void yyset_in (FILE * _in_str )
1946 {
1947  yyin = _in_str ;
1948 }
1949 
1950 void yyset_out (FILE * _out_str )
1951 {
1952  yyout = _out_str ;
1953 }
1954 
1955 int yyget_debug (void)
1956 {
1957  return yy_flex_debug;
1958 }
1959 
1960 void yyset_debug (int _bdebug )
1961 {
1962  yy_flex_debug = _bdebug ;
1963 }
1964 
1965 static int yy_init_globals (void)
1966 {
1967  /* Initialization is the same as for the non-reentrant scanner.
1968  * This function is called from yylex_destroy(), so don't allocate here.
1969  */
1970 
1971  (yy_buffer_stack) = NULL;
1972  (yy_buffer_stack_top) = 0;
1973  (yy_buffer_stack_max) = 0;
1974  (yy_c_buf_p) = NULL;
1975  (yy_init) = 0;
1976  (yy_start) = 0;
1977 
1978 /* Defined in main.c */
1979 #ifdef YY_STDINIT
1980  yyin = stdin;
1981  yyout = stdout;
1982 #else
1983  yyin = NULL;
1984  yyout = NULL;
1985 #endif
1986 
1987  /* For future reference: Set errno on error, since we are called by
1988  * yylex_init()
1989  */
1990  return 0;
1991 }
1992 
1993 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
1994 int yylex_destroy (void)
1995 {
1996 
1997  /* Pop the buffer stack, destroying each element. */
1998  while(YY_CURRENT_BUFFER){
1999  yy_delete_buffer( YY_CURRENT_BUFFER );
2000  YY_CURRENT_BUFFER_LVALUE = NULL;
2001  yypop_buffer_state();
2002  }
2003 
2004  /* Destroy the stack itself. */
2005  yyfree((yy_buffer_stack) );
2006  (yy_buffer_stack) = NULL;
2007 
2008  /* Reset the globals. This is important in a non-reentrant scanner so the next time
2009  * yylex() is called, initialization will occur. */
2010  yy_init_globals( );
2011 
2012  return 0;
2013 }
2014 
2015 /*
2016  * Internal utility routines.
2017  */
2018 
2019 #ifndef yytext_ptr
2020 static void yy_flex_strncpy (char* s1, const char * s2, int n )
2021 {
2022 
2023  int i;
2024  for ( i = 0; i < n; ++i )
2025  s1[i] = s2[i];
2026 }
2027 #endif
2028 
2029 #ifdef YY_NEED_STRLEN
2030 static int yy_flex_strlen (const char * s )
2031 {
2032  int n;
2033  for ( n = 0; s[n]; ++n )
2034  ;
2035 
2036  return n;
2037 }
2038 #endif
2039 
2040 void *yyalloc (yy_size_t size )
2041 {
2042  return malloc(size);
2043 }
2044 
2045 void *yyrealloc (void * ptr, yy_size_t size )
2046 {
2047 
2048  /* The cast to (char *) in the following accommodates both
2049  * implementations that use char* generic pointers, and those
2050  * that use void* generic pointers. It works with the latter
2051  * because both ANSI C and C++ allow castless assignment from
2052  * any pointer type to void*, and deal with argument conversions
2053  * as though doing an assignment.
2054  */
2055  return realloc(ptr, size);
2056 }
2057 
2058 void yyfree (void * ptr )
2059 {
2060  free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
2061 }
2062 
2063 #define YYTABLES_NAME "yytables"
2064 
2065 #line 75 "tokenparser.l"
2066 
2067 
2068 
2069 static void eval_key(char *pcToken, list_t *list_key)
2070 {
2071  struct bundleElt *elt;
2072  int r;
2073  size_t len;
2074 
2075  /* create a new list element */
2076  elt = malloc(sizeof(*elt));
2077  assert(elt);
2078 
2079  /* <key>foobar</key>
2080  * 012345 : 5 is the first key character index */
2081 
2082  /* calculate the argument length */
2083  for (len=0; pcToken[len+5] != '<'; len++)
2084  ;
2085  len++; /* final NULL byte */
2086 
2087  elt->key = malloc(len);
2088  memcpy(elt->key, &pcToken[5], len-1);
2089  elt->key[len-1] = '\0';
2090 
2091  r = list_init(&elt->values);
2092  assert(r >= 0);
2093  (void)r;
2094 
2095  /* add the key/values */
2096  list_append(list_key, elt);
2097 
2098  /* set the list to store the values */
2099  ListValues = &elt->values;
2100 }
2101 
2102 static void eval_value(char *pcToken, list_t *list_values)
2103 {
2104  int r;
2105  size_t len;
2106  char *value;
2107  char *amp;
2108 
2109  /* <string>foobar</string>
2110  * 012345678 : 8 is the first string character index */
2111 
2112  /* calculate the argument length */
2113  for (len=0; pcToken[len+8] != '<'; len++)
2114  ;
2115  len++; /* final NULL byte */
2116 
2117  value = malloc(len);
2118  assert(value);
2119 
2120  memcpy(value, &pcToken[8], len-1);
2121  value[len-1] = '\0';
2122 
2123  /* for all &amp; in the string */
2124  amp = value;
2125  while ((amp = strstr(amp, "&amp;")) != NULL)
2126  {
2127  char *p;
2128 
2129  /* just skip "amp;" substring (4 letters) */
2130  for (p = amp+1; *(p+4); p++)
2131  {
2132  *p = *(p+4);
2133  }
2134  /* terminate the now shorter string */
2135  *p = '\0';
2136 
2137  /* skip the & and continue */
2138  amp++;
2139  }
2140 
2141  r = list_append(list_values, value);
2142  assert(r >= 0);
2143  (void)r;
2144 }
2145 
2146 void tperrorCheck (char *token_error)
2147 {
2148  (void)token_error;
2149 }
2150 
2161 int LTPBundleFindValueWithKey(list_t *l, const char *key, list_t **values)
2162 {
2163  unsigned int i;
2164  int ret = 1;
2165 
2166  for (i=0; i < list_size(l); i++)
2167  {
2168  struct bundleElt *elt;
2169 
2170  elt = list_get_at(l, i);
2171  assert(elt);
2172 
2173  if (0 == strcmp(elt->key, key))
2174  {
2175  *values = &elt->values;
2176  ret = 0;
2177  }
2178  }
2179 
2180  return ret;
2181 }
2182 
2183 
2192 int bundleParse(const char *fileName, list_t *l)
2193 {
2194  FILE *file = NULL;
2195  int r;
2196 #ifndef NDEBUG
2197  int i;
2198 #endif
2199 
2200  file = fopen(fileName, "r");
2201  if (!file)
2202  {
2203  Log3(PCSC_LOG_CRITICAL, "Could not open bundle file %s: %s",
2204  fileName, strerror(errno));
2205  return 1;
2206  }
2207 
2208  r = list_init(l);
2209  assert(r >= 0);
2210  (void)r;
2211 
2212  ListKeys = l;
2213  yyin = file;
2214 
2215  do
2216  {
2217  (void)yylex();
2218  } while (!feof(file));
2219  yylex_destroy();
2220 
2221  (void)fclose(file);
2222 
2223 #ifndef NDEBUG
2224  printf("size: %d\n", list_size(l));
2225  for (i=0; i < list_size(l); i++)
2226  {
2227  struct bundleElt *elt;
2228  unsigned int j;
2229 
2230  elt = list_get_at(l, i);
2231  assert(elt);
2232  printf("Key: %s\n", elt->key);
2233 
2234  for (j=0; j<list_size(&elt->values); j++)
2235  {
2236  char *v = list_get_at(&elt->values, j);
2237  printf(" value: %s\n", v);
2238  }
2239  }
2240 #endif
2241 
2242  return 0;
2243 }
2244 
2250 void bundleRelease(list_t *l)
2251 {
2252  unsigned int i;
2253 
2254  for (i=0; i < list_size(l); i++)
2255  {
2256  struct bundleElt *elt;
2257  unsigned int j;
2258 
2259  elt = list_get_at(l, i);
2260  assert(elt);
2261 
2262  /* free all the values */
2263  for (j=0; j<list_size(&elt->values); j++)
2264  free(list_get_at(&elt->values, j));
2265  list_destroy(&elt->values);
2266 
2267  /* free the key */
2268  free(elt->key);
2269  free(elt);
2270  }
2271 
2272  list_destroy(l);
2273 }
2274 
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:969
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