2 #line 3 "tokenparser.c"
4 #define YY_INT_ALIGNED short int
8 #define yy_create_buffer tp_create_buffer
9 #define yy_delete_buffer tp_delete_buffer
10 #define yy_flex_debug tp_flex_debug
11 #define yy_init_buffer tp_init_buffer
12 #define yy_flush_buffer tp_flush_buffer
13 #define yy_load_buffer_state tp_load_buffer_state
14 #define yy_switch_to_buffer tp_switch_to_buffer
18 #define yylineno tplineno
20 #define yyrestart tprestart
23 #define yyalloc tpalloc
24 #define yyrealloc tprealloc
28 #define YY_FLEX_MAJOR_VERSION 2
29 #define YY_FLEX_MINOR_VERSION 5
30 #define YY_FLEX_SUBMINOR_VERSION 35
31 #if YY_FLEX_SUBMINOR_VERSION > 0
52 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
57 #ifndef __STDC_LIMIT_MACROS
58 #define __STDC_LIMIT_MACROS 1
62 typedef int8_t flex_int8_t;
63 typedef uint8_t flex_uint8_t;
64 typedef int16_t flex_int16_t;
65 typedef uint16_t flex_uint16_t;
66 typedef int32_t flex_int32_t;
67 typedef uint32_t flex_uint32_t;
69 typedef signed char flex_int8_t;
70 typedef short int flex_int16_t;
71 typedef int flex_int32_t;
72 typedef unsigned char flex_uint8_t;
73 typedef unsigned short int flex_uint16_t;
74 typedef unsigned int flex_uint32_t;
78 #define INT8_MIN (-128)
81 #define INT16_MIN (-32767-1)
84 #define INT32_MIN (-2147483647-1)
87 #define INT8_MAX (127)
90 #define INT16_MAX (32767)
93 #define INT32_MAX (2147483647)
96 #define UINT8_MAX (255U)
99 #define UINT16_MAX (65535U)
102 #define UINT32_MAX (4294967295U)
117 #if defined (__STDC__)
125 #define yyconst const
138 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
144 #define BEGIN (yy_start) = 1 + 2 *
150 #define YY_START (((yy_start) - 1) / 2)
151 #define YYSTATE YY_START
154 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
157 #define YY_NEW_FILE tprestart(tpin )
159 #define YY_END_OF_BUFFER_CHAR 0
168 #define YY_BUF_SIZE 32768
170 #define YY_BUF_SIZE 16384
176 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
178 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
179 #define YY_TYPEDEF_YY_BUFFER_STATE
185 extern FILE *tpin, *tpout;
187 #define EOB_ACT_CONTINUE_SCAN 0
188 #define EOB_ACT_END_OF_FILE 1
189 #define EOB_ACT_LAST_MATCH 2
191 #define YY_LESS_LINENO(n)
198 int yyless_macro_arg = (n); \
199 YY_LESS_LINENO(yyless_macro_arg);\
200 *yy_cp = (yy_hold_char); \
201 YY_RESTORE_YY_MORE_OFFSET \
202 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
203 YY_DO_BEFORE_ACTION; \
207 #define unput(c) yyunput( c, (yytext_ptr) )
209 #ifndef YY_TYPEDEF_YY_SIZE_T
210 #define YY_TYPEDEF_YY_SIZE_T
211 typedef size_t yy_size_t;
214 #ifndef YY_STRUCT_YY_BUFFER_STATE
215 #define YY_STRUCT_YY_BUFFER_STATE
226 yy_size_t yy_buf_size;
237 int yy_is_our_buffer;
244 int yy_is_interactive;
260 int yy_buffer_status;
262 #define YY_BUFFER_NEW 0
263 #define YY_BUFFER_NORMAL 1
274 #define YY_BUFFER_EOF_PENDING 2
290 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
291 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
297 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
300 static char yy_hold_char;
301 static int yy_n_chars;
305 static char *yy_c_buf_p = (
char *) 0;
306 static int yy_init = 0;
307 static int yy_start = 0;
312 static int yy_did_buffer_switch_on_eof;
322 static void tpensure_buffer_stack (
void );
323 static void tp_load_buffer_state (
void );
324 static void tp_init_buffer (YY_BUFFER_STATE b,FILE *file );
326 #define YY_FLUSH_BUFFER tp_flush_buffer(YY_CURRENT_BUFFER )
330 YY_BUFFER_STATE
tp_scan_bytes (yyconst
char *bytes,
int len );
332 void *tpalloc (yy_size_t );
333 void *tprealloc (
void *,yy_size_t );
334 void tpfree (
void * );
336 #define yy_new_buffer tp_create_buffer
338 #define yy_set_interactive(is_interactive) \
340 if ( ! YY_CURRENT_BUFFER ){ \
341 tpensure_buffer_stack (); \
342 YY_CURRENT_BUFFER_LVALUE = \
343 tp_create_buffer(tpin,YY_BUF_SIZE ); \
345 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
348 #define yy_set_bol(at_bol) \
350 if ( ! YY_CURRENT_BUFFER ){\
351 tpensure_buffer_stack (); \
352 YY_CURRENT_BUFFER_LVALUE = \
353 tp_create_buffer(tpin,YY_BUF_SIZE ); \
355 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
358 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
363 #define YY_SKIP_YYWRAP
365 typedef unsigned char YY_CHAR;
367 FILE *tpin = (FILE *) 0, *tpout = (FILE *) 0;
369 typedef int yy_state_type;
376 #define yytext_ptr tptext
378 static yy_state_type yy_get_previous_state (
void );
379 static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
380 static int yy_get_next_buffer (
void );
381 static void yy_fatal_error (yyconst
char msg[] );
386 #define YY_DO_BEFORE_ACTION \
387 (yytext_ptr) = yy_bp; \
388 tpleng = (size_t) (yy_cp - yy_bp); \
389 (yy_hold_char) = *yy_cp; \
391 (yy_c_buf_p) = yy_cp;
393 #define YY_NUM_RULES 7
394 #define YY_END_OF_BUFFER 8
399 flex_int32_t yy_verify;
402 static yyconst flex_int16_t yy_accept[39] =
404 0, 0, 8, 6, 4, 2, 1, 6, 1, 0,
405 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
406 0, 0, 0, 0, 0, 0, 0, 0, 0, 3,
407 0, 0, 0, 0, 0, 0, 5, 0
410 static yyconst flex_int32_t yy_ec[256] =
412 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
413 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
414 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
415 1, 2, 4, 4, 5, 4, 4, 4, 4, 4,
416 4, 4, 4, 4, 4, 4, 6, 7, 7, 7,
417 7, 7, 7, 7, 7, 7, 7, 4, 4, 8,
418 4, 9, 4, 4, 10, 10, 10, 10, 10, 10,
419 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
420 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
421 4, 1, 4, 4, 4, 1, 11, 11, 11, 11,
423 12, 11, 13, 11, 14, 11, 15, 11, 11, 16,
424 11, 11, 11, 17, 18, 19, 11, 11, 11, 11,
425 20, 11, 1, 1, 1, 4, 1, 1, 1, 1,
426 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
427 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
428 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
429 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
430 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
431 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
432 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
434 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
435 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
436 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
437 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
438 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
442 static yyconst flex_int32_t yy_meta[21] =
444 1, 2, 3, 4, 4, 4, 2, 1, 1, 2,
445 2, 2, 2, 2, 2, 2, 2, 2, 2, 2
448 static yyconst flex_int16_t yy_base[43] =
450 0, 7, 49, 50, 50, 50, 0, 1, 0, 36,
451 28, 26, 28, 35, 29, 0, 26, 33, 27, 33,
452 29, 22, 0, 24, 27, 14, 27, 23, 13, 50,
453 10, 9, 4, 1, 0, 2, 50, 50, 19, 23,
457 static yyconst flex_int16_t yy_def[43] =
459 39, 39, 38, 38, 38, 38, 40, 38, 40, 38,
460 38, 38, 38, 38, 38, 41, 38, 41, 38, 38,
461 38, 38, 42, 38, 42, 38, 38, 38, 38, 38,
462 38, 38, 38, 38, 38, 38, 38, 0, 38, 38,
466 static yyconst flex_int16_t yy_nxt[71] =
468 38, 5, 6, 18, 7, 38, 38, 8, 5, 6,
469 37, 7, 36, 38, 8, 10, 35, 34, 11, 4,
470 4, 4, 4, 9, 9, 33, 9, 25, 32, 25,
471 31, 30, 29, 28, 27, 26, 24, 23, 22, 21,
472 20, 19, 17, 16, 15, 14, 13, 12, 38, 3,
473 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
474 38, 38, 38, 38, 38, 38, 38, 38, 38, 38
477 static yyconst flex_int16_t yy_chk[71] =
479 0, 1, 1, 41, 1, 0, 0, 1, 2, 2,
480 36, 2, 35, 0, 2, 8, 34, 33, 8, 39,
481 39, 39, 39, 40, 40, 32, 40, 42, 31, 42,
482 29, 28, 27, 26, 25, 24, 22, 21, 20, 19,
483 18, 17, 15, 14, 13, 12, 11, 10, 3, 38,
484 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
485 38, 38, 38, 38, 38, 38, 38, 38, 38, 38
488 static yy_state_type yy_last_accepting_state;
489 static char *yy_last_accepting_cpos;
491 extern int tp_flex_debug;
492 int tp_flex_debug = 0;
497 #define REJECT reject_used_but_not_detected
498 #define yymore() yymore_used_but_not_detected
499 #define YY_MORE_ADJ 0
500 #define YY_RESTORE_YY_MORE_OFFSET
502 #line 1 "tokenparser.l"
520 #line 21 "tokenparser.l"
529 #include "simclist.h"
534 static void eval_key(
char *pcToken,
list_t *list_key);
535 static void eval_value(
char *pcToken,
list_t *list_values);
536 void tperrorCheck (
char *pcToken_error);
539 static list_t *ListValues;
541 #define YY_NO_INPUT 1
542 #line 543 "tokenparser.c"
546 #ifndef YY_NO_UNISTD_H
554 #ifndef YY_EXTRA_TYPE
555 #define YY_EXTRA_TYPE void *
558 static int yy_init_globals (
void );
563 int tplex_destroy (
void );
565 int tpget_debug (
void );
567 void tpset_debug (
int debug_flag );
569 YY_EXTRA_TYPE tpget_extra (
void );
571 void tpset_extra (YY_EXTRA_TYPE user_defined );
579 void tpset_out (FILE * out_str );
593 #ifndef YY_SKIP_YYWRAP
595 extern "C" int tpwrap (
void );
597 extern int tpwrap (
void );
602 static void yy_flex_strncpy (
char *,yyconst
char *,
int );
605 #ifdef YY_NEED_STRLEN
606 static int yy_flex_strlen (yyconst
char * );
612 static int yyinput (
void );
614 static int input (
void );
620 #ifndef YY_READ_BUF_SIZE
623 #define YY_READ_BUF_SIZE 16384
625 #define YY_READ_BUF_SIZE 8192
634 #define ECHO do { if (fwrite( tptext, tpleng, 1, tpout )) {} } while (0)
641 #define YY_INPUT(buf,result,max_size) \
642 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
646 for ( n = 0; n < max_size && \
647 (c = getc( tpin )) != EOF && c != '\n'; ++n ) \
650 buf[n++] = (char) c; \
651 if ( c == EOF && ferror( tpin ) ) \
652 YY_FATAL_ERROR( "input in flex scanner failed" ); \
658 while ( (result = fread(buf, 1, max_size, tpin))==0 && ferror(tpin)) \
660 if( errno != EINTR) \
662 YY_FATAL_ERROR( "input in flex scanner failed" ); \
678 #define yyterminate() return YY_NULL
682 #ifndef YY_START_STACK_INCR
683 #define YY_START_STACK_INCR 25
687 #ifndef YY_FATAL_ERROR
688 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
697 #define YY_DECL_IS_OURS 1
699 extern int tplex (
void);
701 #define YY_DECL int tplex (void)
707 #ifndef YY_USER_ACTION
708 #define YY_USER_ACTION
713 #define YY_BREAK break;
716 #define YY_RULE_SETUP \
723 register yy_state_type yy_current_state;
724 register char *yy_cp, *yy_bp;
727 #line 47 "tokenparser.l"
730 #line 731 "tokenparser.c"
749 if ( ! YY_CURRENT_BUFFER ) {
750 tpensure_buffer_stack ();
751 YY_CURRENT_BUFFER_LVALUE =
755 tp_load_buffer_state( );
760 yy_cp = (yy_c_buf_p);
763 *yy_cp = (yy_hold_char);
770 yy_current_state = (yy_start);
774 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
775 if ( yy_accept[yy_current_state] )
777 (yy_last_accepting_state) = yy_current_state;
778 (yy_last_accepting_cpos) = yy_cp;
780 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
782 yy_current_state = (int) yy_def[yy_current_state];
783 if ( yy_current_state >= 39 )
784 yy_c = yy_meta[(
unsigned int) yy_c];
786 yy_current_state = yy_nxt[yy_base[yy_current_state] + (
unsigned int) yy_c];
789 while ( yy_base[yy_current_state] != 50 );
792 yy_act = yy_accept[yy_current_state];
795 yy_cp = (yy_last_accepting_cpos);
796 yy_current_state = (yy_last_accepting_state);
797 yy_act = yy_accept[yy_current_state];
808 *yy_cp = (yy_hold_char);
809 yy_cp = (yy_last_accepting_cpos);
810 yy_current_state = (yy_last_accepting_state);
815 #line 49 "tokenparser.l"
821 #line 50 "tokenparser.l"
826 #line 51 "tokenparser.l"
827 { eval_key(tptext, ListKeys); }
831 #line 52 "tokenparser.l"
836 #line 53 "tokenparser.l"
837 { eval_value(tptext, ListValues); }
841 #line 54 "tokenparser.l"
842 { tperrorCheck(tptext); }
846 #line 55 "tokenparser.l"
849 #line 850 "tokenparser.c"
850 case YY_STATE_EOF(INITIAL):
853 case YY_END_OF_BUFFER:
856 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
859 *yy_cp = (yy_hold_char);
860 YY_RESTORE_YY_MORE_OFFSET
862 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
873 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
874 YY_CURRENT_BUFFER_LVALUE->yy_input_file = tpin;
875 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
885 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
887 yy_state_type yy_next_state;
889 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
891 yy_current_state = yy_get_previous_state( );
902 yy_next_state = yy_try_NUL_trans( yy_current_state );
904 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
909 yy_cp = ++(yy_c_buf_p);
910 yy_current_state = yy_next_state;
916 yy_cp = (yy_c_buf_p);
921 else switch ( yy_get_next_buffer( ) )
923 case EOB_ACT_END_OF_FILE:
925 (yy_did_buffer_switch_on_eof) = 0;
938 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
940 yy_act = YY_STATE_EOF(YY_START);
946 if ( ! (yy_did_buffer_switch_on_eof) )
952 case EOB_ACT_CONTINUE_SCAN:
954 (yytext_ptr) + yy_amount_of_matched_text;
956 yy_current_state = yy_get_previous_state( );
958 yy_cp = (yy_c_buf_p);
959 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
962 case EOB_ACT_LAST_MATCH:
964 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
966 yy_current_state = yy_get_previous_state( );
968 yy_cp = (yy_c_buf_p);
969 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
977 "fatal flex scanner internal error--no action found" );
989 static int yy_get_next_buffer (
void)
991 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
992 register char *source = (yytext_ptr);
993 register int number_to_move, i;
996 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
998 "fatal flex scanner internal error--end of buffer missed" );
1000 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1002 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1007 return EOB_ACT_END_OF_FILE;
1015 return EOB_ACT_LAST_MATCH;
1022 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1024 for ( i = 0; i < number_to_move; ++i )
1025 *(dest++) = *(source++);
1027 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1031 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1036 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1038 while ( num_to_read <= 0 )
1042 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1044 int yy_c_buf_p_offset =
1045 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1047 if ( b->yy_is_our_buffer )
1049 int new_size = b->yy_buf_size * 2;
1051 if ( new_size <= 0 )
1052 b->yy_buf_size += b->yy_buf_size / 8;
1054 b->yy_buf_size *= 2;
1056 b->yy_ch_buf = (
char *)
1058 tprealloc((
void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1064 if ( ! b->yy_ch_buf )
1066 "fatal error - scanner input buffer overflow" );
1068 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1070 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1075 if ( num_to_read > YY_READ_BUF_SIZE )
1076 num_to_read = YY_READ_BUF_SIZE;
1079 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1080 (yy_n_chars), (
size_t) num_to_read );
1082 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1085 if ( (yy_n_chars) == 0 )
1087 if ( number_to_move == YY_MORE_ADJ )
1089 ret_val = EOB_ACT_END_OF_FILE;
1095 ret_val = EOB_ACT_LAST_MATCH;
1096 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1097 YY_BUFFER_EOF_PENDING;
1102 ret_val = EOB_ACT_CONTINUE_SCAN;
1104 if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
1106 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
1107 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (
char *) tprealloc((
void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
1108 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
1109 YY_FATAL_ERROR(
"out of dynamic memory in yy_get_next_buffer()" );
1112 (yy_n_chars) += number_to_move;
1113 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1114 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1116 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1123 static yy_state_type yy_get_previous_state (
void)
1125 register yy_state_type yy_current_state;
1126 register char *yy_cp;
1128 yy_current_state = (yy_start);
1130 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1132 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1133 if ( yy_accept[yy_current_state] )
1135 (yy_last_accepting_state) = yy_current_state;
1136 (yy_last_accepting_cpos) = yy_cp;
1138 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1140 yy_current_state = (int) yy_def[yy_current_state];
1141 if ( yy_current_state >= 39 )
1142 yy_c = yy_meta[(
unsigned int) yy_c];
1144 yy_current_state = yy_nxt[yy_base[yy_current_state] + (
unsigned int) yy_c];
1147 return yy_current_state;
1155 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1157 register int yy_is_jam;
1158 register char *yy_cp = (yy_c_buf_p);
1160 register YY_CHAR yy_c = 1;
1161 if ( yy_accept[yy_current_state] )
1163 (yy_last_accepting_state) = yy_current_state;
1164 (yy_last_accepting_cpos) = yy_cp;
1166 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1168 yy_current_state = (int) yy_def[yy_current_state];
1169 if ( yy_current_state >= 39 )
1170 yy_c = yy_meta[(
unsigned int) yy_c];
1172 yy_current_state = yy_nxt[yy_base[yy_current_state] + (
unsigned int) yy_c];
1173 yy_is_jam = (yy_current_state == 38);
1175 return yy_is_jam ? 0 : yy_current_state;
1180 static int yyinput (
void)
1182 static int input (
void)
1188 *(yy_c_buf_p) = (yy_hold_char);
1190 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1196 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1198 *(yy_c_buf_p) =
'\0';
1202 int offset = (yy_c_buf_p) - (yytext_ptr);
1205 switch ( yy_get_next_buffer( ) )
1207 case EOB_ACT_LAST_MATCH:
1223 case EOB_ACT_END_OF_FILE:
1228 if ( ! (yy_did_buffer_switch_on_eof) )
1237 case EOB_ACT_CONTINUE_SCAN:
1238 (yy_c_buf_p) = (yytext_ptr) + offset;
1244 c = *(
unsigned char *) (yy_c_buf_p);
1245 *(yy_c_buf_p) =
'\0';
1246 (yy_hold_char) = *++(yy_c_buf_p);
1260 if ( ! YY_CURRENT_BUFFER ){
1261 tpensure_buffer_stack ();
1262 YY_CURRENT_BUFFER_LVALUE =
1266 tp_init_buffer(YY_CURRENT_BUFFER,input_file );
1267 tp_load_buffer_state( );
1282 tpensure_buffer_stack ();
1283 if ( YY_CURRENT_BUFFER == new_buffer )
1286 if ( YY_CURRENT_BUFFER )
1289 *(yy_c_buf_p) = (yy_hold_char);
1290 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1291 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1294 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1295 tp_load_buffer_state( );
1302 (yy_did_buffer_switch_on_eof) = 1;
1305 static void tp_load_buffer_state (
void)
1307 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1308 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1309 tpin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1310 (yy_hold_char) = *(yy_c_buf_p);
1325 YY_FATAL_ERROR(
"out of dynamic memory in tp_create_buffer()" );
1327 b->yy_buf_size = size;
1332 b->yy_ch_buf = (
char *) tpalloc(b->yy_buf_size + 2 );
1333 if ( ! b->yy_ch_buf )
1334 YY_FATAL_ERROR(
"out of dynamic memory in tp_create_buffer()" );
1336 b->yy_is_our_buffer = 1;
1338 tp_init_buffer(b,file );
1353 if ( b == YY_CURRENT_BUFFER )
1354 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1356 if ( b->yy_is_our_buffer )
1357 tpfree((
void *) b->yy_ch_buf );
1359 tpfree((
void *) b );
1363 extern int isatty (
int );
1370 static void tp_init_buffer (YY_BUFFER_STATE b, FILE * file )
1377 b->yy_input_file = file;
1378 b->yy_fill_buffer = 1;
1384 if (b != YY_CURRENT_BUFFER){
1389 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1409 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1410 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1412 b->yy_buf_pos = &b->yy_ch_buf[0];
1415 b->yy_buffer_status = YY_BUFFER_NEW;
1417 if ( b == YY_CURRENT_BUFFER )
1418 tp_load_buffer_state( );
1429 if (new_buffer == NULL)
1432 tpensure_buffer_stack();
1435 if ( YY_CURRENT_BUFFER )
1438 *(yy_c_buf_p) = (yy_hold_char);
1439 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1440 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1444 if (YY_CURRENT_BUFFER)
1446 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1449 tp_load_buffer_state( );
1450 (yy_did_buffer_switch_on_eof) = 1;
1459 if (!YY_CURRENT_BUFFER)
1463 YY_CURRENT_BUFFER_LVALUE = NULL;
1467 if (YY_CURRENT_BUFFER) {
1468 tp_load_buffer_state( );
1469 (yy_did_buffer_switch_on_eof) = 1;
1476 static void tpensure_buffer_stack (
void)
1480 if (!(yy_buffer_stack)) {
1490 if ( ! (yy_buffer_stack) )
1491 YY_FATAL_ERROR(
"out of dynamic memory in tpensure_buffer_stack()" );
1493 memset((yy_buffer_stack), 0, num_to_alloc *
sizeof(
struct yy_buffer_state*));
1510 if ( ! (yy_buffer_stack) )
1511 YY_FATAL_ERROR(
"out of dynamic memory in tpensure_buffer_stack()" );
1530 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1531 base[size-1] != YY_END_OF_BUFFER_CHAR )
1537 YY_FATAL_ERROR(
"out of dynamic memory in tp_scan_buffer()" );
1539 b->yy_buf_size = size - 2;
1540 b->yy_buf_pos = b->yy_ch_buf = base;
1541 b->yy_is_our_buffer = 0;
1542 b->yy_input_file = 0;
1543 b->yy_n_chars = b->yy_buf_size;
1544 b->yy_is_interactive = 0;
1546 b->yy_fill_buffer = 0;
1547 b->yy_buffer_status = YY_BUFFER_NEW;
1583 n = _yybytes_len + 2;
1584 buf = (
char *) tpalloc(n );
1586 YY_FATAL_ERROR(
"out of dynamic memory in tp_scan_bytes()" );
1588 for ( i = 0; i < _yybytes_len; ++i )
1589 buf[i] = yybytes[i];
1591 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
1595 YY_FATAL_ERROR(
"bad buffer in tp_scan_bytes()" );
1600 b->yy_is_our_buffer = 1;
1605 #ifndef YY_EXIT_FAILURE
1606 #define YY_EXIT_FAILURE 2
1609 static void yy_fatal_error (yyconst
char* msg )
1611 (void) fprintf( stderr,
"%s\n", msg );
1612 exit( YY_EXIT_FAILURE );
1622 int yyless_macro_arg = (n); \
1623 YY_LESS_LINENO(yyless_macro_arg);\
1624 tptext[tpleng] = (yy_hold_char); \
1625 (yy_c_buf_p) = tptext + yyless_macro_arg; \
1626 (yy_hold_char) = *(yy_c_buf_p); \
1627 *(yy_c_buf_p) = '\0'; \
1628 tpleng = yyless_macro_arg; \
1683 tplineno = line_number;
1697 void tpset_out (FILE * out_str )
1702 int tpget_debug (
void)
1704 return tp_flex_debug;
1707 void tpset_debug (
int bdebug )
1709 tp_flex_debug = bdebug ;
1712 static int yy_init_globals (
void)
1721 (yy_c_buf_p) = (
char *) 0;
1741 int tplex_destroy (
void)
1745 while(YY_CURRENT_BUFFER){
1747 YY_CURRENT_BUFFER_LVALUE = NULL;
1752 tpfree((yy_buffer_stack) );
1767 static void yy_flex_strncpy (
char* s1, yyconst
char * s2,
int n )
1770 for ( i = 0; i < n; ++i )
1775 #ifdef YY_NEED_STRLEN
1776 static int yy_flex_strlen (yyconst
char * s )
1779 for ( n = 0; s[n]; ++n )
1786 void *tpalloc (yy_size_t size )
1788 return (
void *) malloc( size );
1791 void *tprealloc (
void * ptr, yy_size_t size )
1800 return (
void *) realloc( (
char *) ptr, size );
1803 void tpfree (
void * ptr )
1805 free( (
char *) ptr );
1808 #define YYTABLES_NAME "yytables"
1810 #line 55 "tokenparser.l"
1815 static void eval_key(
char *pcToken,
list_t *list_key)
1822 elt = malloc(
sizeof(*elt));
1829 for (len=0; pcToken[len+5] !=
'<'; len++)
1833 elt->key = malloc(len);
1834 (void)strlcpy(elt->key, &pcToken[5], len);
1836 r = list_init(&elt->values);
1841 list_append(list_key, elt);
1844 ListValues = &elt->values;
1847 static void eval_value(
char *pcToken,
list_t *list_values)
1858 for (len=0; pcToken[len+8] !=
'<'; len++)
1862 value = malloc(len);
1865 (void)strlcpy(value, &pcToken[8], len);
1869 while ((amp = strstr(amp,
"&")) != NULL)
1874 for (p = amp+1; *(p+4); p++)
1885 r = list_append(list_values, value);
1890 void tperrorCheck (
char *token_error)
1910 for (i=0; i < list_size(l); i++)
1914 elt = list_get_at(l, i);
1917 if (0 == strcmp(elt->key, key))
1919 *values = &elt->values;
1944 file = fopen(fileName,
"r");
1947 Log3(PCSC_LOG_CRITICAL,
"Could not open bundle file %s: %s",
1948 fileName, strerror(errno));
1962 }
while (!feof(file));
1967 printf(
"size: %d\n", list_size(l));
1968 for (i=0; i < list_size(l); i++)
1973 elt = list_get_at(l, i);
1975 printf(
"Key: %s\n", elt->key);
1977 for (j=0; j<list_size(&elt->values); j++)
1979 char *v = list_get_at(&elt->values, j);
1980 printf(
" value: %s\n", v);
1997 for (i=0; i < list_size(l); i++)
2002 elt = list_get_at(l, i);
2006 for (j=0; j<list_size(&elt->values); j++)
2007 free(list_get_at(&elt->values, j));
2008 list_destroy(&elt->values);
void tp_flush_buffer(YY_BUFFER_STATE b)
Discard all buffered characters.
void tp_switch_to_buffer(YY_BUFFER_STATE new_buffer)
Switch to a different input buffer.
static YY_BUFFER_STATE * yy_buffer_stack
Stack as an array.
void tpset_in(FILE *in_str)
Set the input stream.
YY_BUFFER_STATE tp_scan_string(yyconst char *yy_str)
Setup the input buffer state to scan a string.
int yy_bs_column
The column count.
int tpget_leng(void)
Get the length of the current token.
int tpget_lineno(void)
Get the current line number.
FILE * tpget_in(void)
Get the input stream.
void tppush_buffer_state(YY_BUFFER_STATE new_buffer)
Pushes the new state onto the stack.
FILE * tpget_out(void)
Get the output stream.
Reads lexical config files and updates database.
char * tpget_text(void)
Get the current token.
void tp_delete_buffer(YY_BUFFER_STATE b)
Destroy the buffer.
prototypes of strlcpy()/strlcat() imported from OpenBSD
static size_t yy_buffer_stack_max
capacity of stack.
YY_BUFFER_STATE tp_scan_bytes(yyconst char *bytes, int len)
Setup the input buffer state to scan the given bytes.
YY_DECL
The main scanner function which does all the work.
int LTPBundleFindValueWithKey(list_t *l, const char *key, list_t **values)
Find an optional key in a configuration file No error is logged if the key is not found...
static size_t yy_buffer_stack_top
index of top of stack.
void tppop_buffer_state(void)
Removes and deletes the top of the stack, if present.
int bundleParse(const char *fileName, list_t *l)
Parse a Info.plist file and file a list.
YY_BUFFER_STATE tp_scan_buffer(char *base, yy_size_t size)
Setup the input buffer state to scan directly from a user-specified character buffer.
void bundleRelease(list_t *l)
Free the list created by bundleParse()
void tpset_lineno(int line_number)
Set the current line number.
YY_BUFFER_STATE tp_create_buffer(FILE *file, int size)
Allocate and initialize an input buffer state.
void tprestart(FILE *input_file)
Immediately switch to a different input stream.
int yy_bs_lineno
The line count.