pcsc-lite 1.5.5
|
00001 00002 #line 3 "configfile.c" 00003 00004 #define YY_INT_ALIGNED short int 00005 00006 /* A lexical scanner generated by flex */ 00007 00008 #define FLEX_SCANNER 00009 #define YY_FLEX_MAJOR_VERSION 2 00010 #define YY_FLEX_MINOR_VERSION 5 00011 #define YY_FLEX_SUBMINOR_VERSION 35 00012 #if YY_FLEX_SUBMINOR_VERSION > 0 00013 #define FLEX_BETA 00014 #endif 00015 00016 /* First, we deal with platform-specific or compiler-specific issues. */ 00017 00018 /* begin standard C headers. */ 00019 #include <stdio.h> 00020 #include <string.h> 00021 #include <errno.h> 00022 #include <stdlib.h> 00023 00024 /* end standard C headers. */ 00025 00026 /* flex integer type definitions */ 00027 00028 #ifndef FLEXINT_H 00029 #define FLEXINT_H 00030 00031 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ 00032 00033 #if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 00034 00035 /* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, 00036 * if you want the limit (max/min) macros for int types. 00037 */ 00038 #ifndef __STDC_LIMIT_MACROS 00039 #define __STDC_LIMIT_MACROS 1 00040 #endif 00041 00042 #include <inttypes.h> 00043 typedef int8_t flex_int8_t; 00044 typedef uint8_t flex_uint8_t; 00045 typedef int16_t flex_int16_t; 00046 typedef uint16_t flex_uint16_t; 00047 typedef int32_t flex_int32_t; 00048 typedef uint32_t flex_uint32_t; 00049 #else 00050 typedef signed char flex_int8_t; 00051 typedef short int flex_int16_t; 00052 typedef int flex_int32_t; 00053 typedef unsigned char flex_uint8_t; 00054 typedef unsigned short int flex_uint16_t; 00055 typedef unsigned int flex_uint32_t; 00056 00057 /* Limits of integral types. */ 00058 #ifndef INT8_MIN 00059 #define INT8_MIN (-128) 00060 #endif 00061 #ifndef INT16_MIN 00062 #define INT16_MIN (-32767-1) 00063 #endif 00064 #ifndef INT32_MIN 00065 #define INT32_MIN (-2147483647-1) 00066 #endif 00067 #ifndef INT8_MAX 00068 #define INT8_MAX (127) 00069 #endif 00070 #ifndef INT16_MAX 00071 #define INT16_MAX (32767) 00072 #endif 00073 #ifndef INT32_MAX 00074 #define INT32_MAX (2147483647) 00075 #endif 00076 #ifndef UINT8_MAX 00077 #define UINT8_MAX (255U) 00078 #endif 00079 #ifndef UINT16_MAX 00080 #define UINT16_MAX (65535U) 00081 #endif 00082 #ifndef UINT32_MAX 00083 #define UINT32_MAX (4294967295U) 00084 #endif 00085 00086 #endif /* ! C99 */ 00087 00088 #endif /* ! FLEXINT_H */ 00089 00090 #ifdef __cplusplus 00091 00092 /* The "const" storage-class-modifier is valid. */ 00093 #define YY_USE_CONST 00094 00095 #else /* ! __cplusplus */ 00096 00097 /* C99 requires __STDC__ to be defined as 1. */ 00098 #if defined (__STDC__) 00099 00100 #define YY_USE_CONST 00101 00102 #endif /* defined (__STDC__) */ 00103 #endif /* ! __cplusplus */ 00104 00105 #ifdef YY_USE_CONST 00106 #define yyconst const 00107 #else 00108 #define yyconst 00109 #endif 00110 00111 /* Returned upon end-of-file. */ 00112 #define YY_NULL 0 00113 00114 /* Promotes a possibly negative, possibly signed char to an unsigned 00115 * integer for use as an array index. If the signed char is negative, 00116 * we want to instead treat it as an 8-bit unsigned char, hence the 00117 * double cast. 00118 */ 00119 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) 00120 00121 /* Enter a start condition. This macro really ought to take a parameter, 00122 * but we do it the disgusting crufty way forced on us by the ()-less 00123 * definition of BEGIN. 00124 */ 00125 #define BEGIN (yy_start) = 1 + 2 * 00126 00127 /* Translate the current start state into a value that can be later handed 00128 * to BEGIN to return to the state. The YYSTATE alias is for lex 00129 * compatibility. 00130 */ 00131 #define YY_START (((yy_start) - 1) / 2) 00132 #define YYSTATE YY_START 00133 00134 /* Action number for EOF rule of a given start state. */ 00135 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) 00136 00137 /* Special action meaning "start processing a new file". */ 00138 #define YY_NEW_FILE yyrestart(yyin ) 00139 00140 #define YY_END_OF_BUFFER_CHAR 0 00141 00142 /* Size of default input buffer. */ 00143 #ifndef YY_BUF_SIZE 00144 #define YY_BUF_SIZE 16384 00145 #endif 00146 00147 /* The state buf must be large enough to hold one state per character in the main buffer. 00148 */ 00149 #define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) 00150 00151 #ifndef YY_TYPEDEF_YY_BUFFER_STATE 00152 #define YY_TYPEDEF_YY_BUFFER_STATE 00153 typedef struct yy_buffer_state *YY_BUFFER_STATE; 00154 #endif 00155 00156 extern int yyleng; 00157 00158 extern FILE *yyin, *yyout; 00159 00160 #define EOB_ACT_CONTINUE_SCAN 0 00161 #define EOB_ACT_END_OF_FILE 1 00162 #define EOB_ACT_LAST_MATCH 2 00163 00164 #define YY_LESS_LINENO(n) 00165 00166 /* Return all but the first "n" matched characters back to the input stream. */ 00167 #define yyless(n) \ 00168 do \ 00169 { \ 00170 /* Undo effects of setting up yytext. */ \ 00171 int yyless_macro_arg = (n); \ 00172 YY_LESS_LINENO(yyless_macro_arg);\ 00173 *yy_cp = (yy_hold_char); \ 00174 YY_RESTORE_YY_MORE_OFFSET \ 00175 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ 00176 YY_DO_BEFORE_ACTION; /* set up yytext again */ \ 00177 } \ 00178 while ( 0 ) 00179 00180 #define unput(c) yyunput( c, (yytext_ptr) ) 00181 00182 #ifndef YY_TYPEDEF_YY_SIZE_T 00183 #define YY_TYPEDEF_YY_SIZE_T 00184 typedef size_t yy_size_t; 00185 #endif 00186 00187 #ifndef YY_STRUCT_YY_BUFFER_STATE 00188 #define YY_STRUCT_YY_BUFFER_STATE 00189 struct yy_buffer_state 00190 { 00191 FILE *yy_input_file; 00192 00193 char *yy_ch_buf; /* input buffer */ 00194 char *yy_buf_pos; /* current position in input buffer */ 00195 00196 /* Size of input buffer in bytes, not including room for EOB 00197 * characters. 00198 */ 00199 yy_size_t yy_buf_size; 00200 00201 /* Number of characters read into yy_ch_buf, not including EOB 00202 * characters. 00203 */ 00204 int yy_n_chars; 00205 00206 /* Whether we "own" the buffer - i.e., we know we created it, 00207 * and can realloc() it to grow it, and should free() it to 00208 * delete it. 00209 */ 00210 int yy_is_our_buffer; 00211 00212 /* Whether this is an "interactive" input source; if so, and 00213 * if we're using stdio for input, then we want to use getc() 00214 * instead of fread(), to make sure we stop fetching input after 00215 * each newline. 00216 */ 00217 int yy_is_interactive; 00218 00219 /* Whether we're considered to be at the beginning of a line. 00220 * If so, '^' rules will be active on the next match, otherwise 00221 * not. 00222 */ 00223 int yy_at_bol; 00224 00225 int yy_bs_lineno; 00226 int yy_bs_column; 00228 /* Whether to try to fill the input buffer when we reach the 00229 * end of it. 00230 */ 00231 int yy_fill_buffer; 00232 00233 int yy_buffer_status; 00234 00235 #define YY_BUFFER_NEW 0 00236 #define YY_BUFFER_NORMAL 1 00237 /* When an EOF's been seen but there's still some text to process 00238 * then we mark the buffer as YY_EOF_PENDING, to indicate that we 00239 * shouldn't try reading from the input source any more. We might 00240 * still have a bunch of tokens to match, though, because of 00241 * possible backing-up. 00242 * 00243 * When we actually see the EOF, we change the status to "new" 00244 * (via yyrestart()), so that the user can continue scanning by 00245 * just pointing yyin at a new input file. 00246 */ 00247 #define YY_BUFFER_EOF_PENDING 2 00248 00249 }; 00250 #endif /* !YY_STRUCT_YY_BUFFER_STATE */ 00251 00252 /* Stack of input buffers. */ 00253 static size_t yy_buffer_stack_top = 0; 00254 static size_t yy_buffer_stack_max = 0; 00255 static YY_BUFFER_STATE * yy_buffer_stack = 0; 00257 /* We provide macros for accessing buffer states in case in the 00258 * future we want to put the buffer states in a more general 00259 * "scanner state". 00260 * 00261 * Returns the top of the stack, or NULL. 00262 */ 00263 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ 00264 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ 00265 : NULL) 00266 00267 /* Same as previous macro, but useful when we know that the buffer stack is not 00268 * NULL or when we need an lvalue. For internal use only. 00269 */ 00270 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] 00271 00272 /* yy_hold_char holds the character lost when yytext is formed. */ 00273 static char yy_hold_char; 00274 static int yy_n_chars; /* number of characters read into yy_ch_buf */ 00275 int yyleng; 00276 00277 /* Points to current character in buffer. */ 00278 static char *yy_c_buf_p = (char *) 0; 00279 static int yy_init = 0; /* whether we need to initialize */ 00280 static int yy_start = 0; /* start state number */ 00281 00282 /* Flag which is used to allow yywrap()'s to do buffer switches 00283 * instead of setting up a fresh yyin. A bit of a hack ... 00284 */ 00285 static int yy_did_buffer_switch_on_eof; 00286 00287 void yyrestart (FILE *input_file ); 00288 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); 00289 YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); 00290 void yy_delete_buffer (YY_BUFFER_STATE b ); 00291 void yy_flush_buffer (YY_BUFFER_STATE b ); 00292 void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); 00293 void yypop_buffer_state (void ); 00294 00295 static void yyensure_buffer_stack (void ); 00296 static void yy_load_buffer_state (void ); 00297 static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); 00298 00299 #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) 00300 00301 YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); 00302 YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); 00303 YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); 00304 00305 void *yyalloc (yy_size_t ); 00306 void *yyrealloc (void *,yy_size_t ); 00307 void yyfree (void * ); 00308 00309 #define yy_new_buffer yy_create_buffer 00310 00311 #define yy_set_interactive(is_interactive) \ 00312 { \ 00313 if ( ! YY_CURRENT_BUFFER ){ \ 00314 yyensure_buffer_stack (); \ 00315 YY_CURRENT_BUFFER_LVALUE = \ 00316 yy_create_buffer(yyin,YY_BUF_SIZE ); \ 00317 } \ 00318 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ 00319 } 00320 00321 #define yy_set_bol(at_bol) \ 00322 { \ 00323 if ( ! YY_CURRENT_BUFFER ){\ 00324 yyensure_buffer_stack (); \ 00325 YY_CURRENT_BUFFER_LVALUE = \ 00326 yy_create_buffer(yyin,YY_BUF_SIZE ); \ 00327 } \ 00328 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ 00329 } 00330 00331 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) 00332 00333 /* Begin user sect3 */ 00334 00335 #define yywrap(n) 1 00336 #define YY_SKIP_YYWRAP 00337 00338 typedef unsigned char YY_CHAR; 00339 00340 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; 00341 00342 typedef int yy_state_type; 00343 00344 extern int yylineno; 00345 00346 int yylineno = 1; 00347 00348 extern char *yytext; 00349 #define yytext_ptr yytext 00350 00351 static yy_state_type yy_get_previous_state (void ); 00352 static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); 00353 static int yy_get_next_buffer (void ); 00354 static void yy_fatal_error (yyconst char msg[] ); 00355 00356 /* Done after the current pattern has been matched and before the 00357 * corresponding action - sets up yytext. 00358 */ 00359 #define YY_DO_BEFORE_ACTION \ 00360 (yytext_ptr) = yy_bp; \ 00361 yyleng = (size_t) (yy_cp - yy_bp); \ 00362 (yy_hold_char) = *yy_cp; \ 00363 *yy_cp = '\0'; \ 00364 (yy_c_buf_p) = yy_cp; 00365 00366 #define YY_NUM_RULES 7 00367 #define YY_END_OF_BUFFER 8 00368 /* This struct is not used in this scanner, 00369 but its presence is necessary. */ 00370 struct yy_trans_info 00371 { 00372 flex_int32_t yy_verify; 00373 flex_int32_t yy_nxt; 00374 }; 00375 static yyconst flex_int16_t yy_accept[17] = 00376 { 0, 00377 0, 0, 8, 6, 4, 2, 6, 1, 6, 5, 00378 0, 3, 1, 0, 5, 0 00379 } ; 00380 00381 static yyconst flex_int32_t yy_ec[256] = 00382 { 0, 00383 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 00384 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00385 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00386 1, 2, 1, 4, 5, 1, 1, 1, 6, 1, 00387 1, 1, 1, 1, 7, 7, 7, 8, 8, 8, 00388 8, 8, 8, 8, 8, 8, 8, 7, 1, 1, 00389 1, 1, 1, 7, 9, 9, 9, 9, 9, 9, 00390 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 00391 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 00392 1, 7, 1, 1, 7, 1, 10, 10, 10, 10, 00393 00394 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 00395 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 00396 10, 10, 1, 1, 1, 1, 1, 1, 1, 1, 00397 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00398 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00399 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00400 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00401 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00402 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00403 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00404 00405 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00406 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00407 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00408 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00409 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00410 1, 1, 1, 1, 1 00411 } ; 00412 00413 static yyconst flex_int32_t yy_meta[11] = 00414 { 0, 00415 1, 1, 2, 1, 1, 1, 1, 1, 1, 1 00416 } ; 00417 00418 static yyconst flex_int16_t yy_base[20] = 00419 { 0, 00420 0, 0, 15, 31, 31, 31, 8, 0, 10, 10, 00421 18, 31, 0, 20, 0, 31, 26, 13, 28 00422 } ; 00423 00424 static yyconst flex_int16_t yy_def[20] = 00425 { 0, 00426 16, 1, 16, 16, 16, 16, 17, 18, 19, 16, 00427 17, 16, 18, 19, 10, 0, 16, 16, 16 00428 } ; 00429 00430 static yyconst flex_int16_t yy_nxt[42] = 00431 { 0, 00432 4, 5, 6, 7, 8, 9, 10, 10, 10, 10, 00433 12, 12, 12, 13, 16, 12, 15, 15, 15, 15, 00434 12, 12, 12, 16, 16, 12, 11, 11, 14, 14, 00435 3, 16, 16, 16, 16, 16, 16, 16, 16, 16, 00436 16 00437 } ; 00438 00439 static yyconst flex_int16_t yy_chk[42] = 00440 { 0, 00441 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 00442 7, 7, 9, 18, 3, 9, 10, 10, 10, 10, 00443 11, 11, 14, 0, 0, 14, 17, 17, 19, 19, 00444 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 00445 16 00446 } ; 00447 00448 static yy_state_type yy_last_accepting_state; 00449 static char *yy_last_accepting_cpos; 00450 00451 extern int yy_flex_debug; 00452 int yy_flex_debug = 0; 00453 00454 /* The intent behind this definition is that it'll catch 00455 * any uses of REJECT which flex missed. 00456 */ 00457 #define REJECT reject_used_but_not_detected 00458 #define yymore() yymore_used_but_not_detected 00459 #define YY_MORE_ADJ 0 00460 #define YY_RESTORE_YY_MORE_OFFSET 00461 char *yytext; 00462 #line 1 "configfile.l" 00463 /* 00464 * Reads lexical config files and updates database. 00465 * 00466 * MUSCLE SmartCard Development ( http://www.linuxnet.com ) 00467 * 00468 * Copyright (C) 1999-2004 00469 * David Corcoran <corcoran@linuxnet.com> 00470 * Damien Sauveron <damien.sauveron@labri.fr> 00471 * Ludovic Rousseau <ludovic.rousseau@free.fr> 00472 * 00473 * $Id: configfile.l 3247 2009-01-02 13:22:46Z rousseau $ 00474 */ 00475 #line 15 "configfile.l" 00476 #include "wintypes.h" 00477 #include "pcscd.h" 00478 #include "readerfactory.h" 00479 #include "configfile.h" 00480 00481 int evaluatetoken(char *pcToken); 00482 00483 static int iLinenumber; 00484 static int iOldLinenumber; 00485 static char *pcPrevious; 00486 static char *pcCurrent; 00487 static char *pcFriendlyname; 00488 static char *pcDevicename; 00489 static char *pcLibpath; 00490 static char *pcChannelid; 00491 static int badError; 00492 static SerialReader *reader_list; 00493 static int reader_list_size; 00494 00495 void tok_error(char *pcToken_error); 00496 00497 #line 498 "configfile.c" 00498 00499 #define INITIAL 0 00500 00501 #ifndef YY_NO_UNISTD_H 00502 /* Special case for "unistd.h", since it is non-ANSI. We include it way 00503 * down here because we want the user's section 1 to have been scanned first. 00504 * The user has a chance to override it with an option. 00505 */ 00506 #include <unistd.h> 00507 #endif 00508 00509 #ifndef YY_EXTRA_TYPE 00510 #define YY_EXTRA_TYPE void * 00511 #endif 00512 00513 static int yy_init_globals (void ); 00514 00515 /* Accessor methods to globals. 00516 These are made visible to non-reentrant scanners for convenience. */ 00517 00518 int yylex_destroy (void ); 00519 00520 int yyget_debug (void ); 00521 00522 void yyset_debug (int debug_flag ); 00523 00524 YY_EXTRA_TYPE yyget_extra (void ); 00525 00526 void yyset_extra (YY_EXTRA_TYPE user_defined ); 00527 00528 FILE *yyget_in (void ); 00529 00530 void yyset_in (FILE * in_str ); 00531 00532 FILE *yyget_out (void ); 00533 00534 void yyset_out (FILE * out_str ); 00535 00536 int yyget_leng (void ); 00537 00538 char *yyget_text (void ); 00539 00540 int yyget_lineno (void ); 00541 00542 void yyset_lineno (int line_number ); 00543 00544 /* Macros after this point can all be overridden by user definitions in 00545 * section 1. 00546 */ 00547 00548 #ifndef YY_SKIP_YYWRAP 00549 #ifdef __cplusplus 00550 extern "C" int yywrap (void ); 00551 #else 00552 extern int yywrap (void ); 00553 #endif 00554 #endif 00555 00556 #ifndef yytext_ptr 00557 static void yy_flex_strncpy (char *,yyconst char *,int ); 00558 #endif 00559 00560 #ifdef YY_NEED_STRLEN 00561 static int yy_flex_strlen (yyconst char * ); 00562 #endif 00563 00564 #ifndef YY_NO_INPUT 00565 00566 #ifdef __cplusplus 00567 static int yyinput (void ); 00568 #else 00569 static int input (void ); 00570 #endif 00571 00572 #endif 00573 00574 /* Amount of stuff to slurp up with each read. */ 00575 #ifndef YY_READ_BUF_SIZE 00576 #define YY_READ_BUF_SIZE 8192 00577 #endif 00578 00579 /* Copy whatever the last rule matched to the standard output. */ 00580 #ifndef ECHO 00581 /* This used to be an fputs(), but since the string might contain NUL's, 00582 * we now use fwrite(). 00583 */ 00584 #define ECHO fwrite( yytext, yyleng, 1, yyout ) 00585 #endif 00586 00587 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, 00588 * is returned in "result". 00589 */ 00590 #ifndef YY_INPUT 00591 #define YY_INPUT(buf,result,max_size) \ 00592 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ 00593 { \ 00594 int c = '*'; \ 00595 size_t n; \ 00596 for ( n = 0; n < max_size && \ 00597 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ 00598 buf[n] = (char) c; \ 00599 if ( c == '\n' ) \ 00600 buf[n++] = (char) c; \ 00601 if ( c == EOF && ferror( yyin ) ) \ 00602 YY_FATAL_ERROR( "input in flex scanner failed" ); \ 00603 result = n; \ 00604 } \ 00605 else \ 00606 { \ 00607 errno=0; \ 00608 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ 00609 { \ 00610 if( errno != EINTR) \ 00611 { \ 00612 YY_FATAL_ERROR( "input in flex scanner failed" ); \ 00613 break; \ 00614 } \ 00615 errno=0; \ 00616 clearerr(yyin); \ 00617 } \ 00618 }\ 00619 \ 00620 00621 #endif 00622 00623 /* No semi-colon after return; correct usage is to write "yyterminate();" - 00624 * we don't want an extra ';' after the "return" because that will cause 00625 * some compilers to complain about unreachable statements. 00626 */ 00627 #ifndef yyterminate 00628 #define yyterminate() return YY_NULL 00629 #endif 00630 00631 /* Number of entries by which start-condition stack grows. */ 00632 #ifndef YY_START_STACK_INCR 00633 #define YY_START_STACK_INCR 25 00634 #endif 00635 00636 /* Report a fatal error. */ 00637 #ifndef YY_FATAL_ERROR 00638 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) 00639 #endif 00640 00641 /* end tables serialization structures and prototypes */ 00642 00643 /* Default declaration of generated scanner - a define so the user can 00644 * easily add parameters. 00645 */ 00646 #ifndef YY_DECL 00647 #define YY_DECL_IS_OURS 1 00648 00649 extern int yylex (void); 00650 00651 #define YY_DECL int yylex (void) 00652 #endif /* !YY_DECL */ 00653 00654 /* Code executed at the beginning of each rule, after yytext and yyleng 00655 * have been set up. 00656 */ 00657 #ifndef YY_USER_ACTION 00658 #define YY_USER_ACTION 00659 #endif 00660 00661 /* Code executed at the end of each rule. */ 00662 #ifndef YY_BREAK 00663 #define YY_BREAK break; 00664 #endif 00665 00666 #define YY_RULE_SETUP \ 00667 YY_USER_ACTION 00668 00671 YY_DECL 00672 { 00673 register yy_state_type yy_current_state; 00674 register char *yy_cp, *yy_bp; 00675 register int yy_act; 00676 00677 #line 41 "configfile.l" 00678 00679 00680 #line 681 "configfile.c" 00681 00682 if ( !(yy_init) ) 00683 { 00684 (yy_init) = 1; 00685 00686 #ifdef YY_USER_INIT 00687 YY_USER_INIT; 00688 #endif 00689 00690 if ( ! (yy_start) ) 00691 (yy_start) = 1; /* first start state */ 00692 00693 if ( ! yyin ) 00694 yyin = stdin; 00695 00696 if ( ! yyout ) 00697 yyout = stdout; 00698 00699 if ( ! YY_CURRENT_BUFFER ) { 00700 yyensure_buffer_stack (); 00701 YY_CURRENT_BUFFER_LVALUE = 00702 yy_create_buffer(yyin,YY_BUF_SIZE ); 00703 } 00704 00705 yy_load_buffer_state( ); 00706 } 00707 00708 while ( 1 ) /* loops until end-of-file is reached */ 00709 { 00710 yy_cp = (yy_c_buf_p); 00711 00712 /* Support of yytext. */ 00713 *yy_cp = (yy_hold_char); 00714 00715 /* yy_bp points to the position in yy_ch_buf of the start of 00716 * the current run. 00717 */ 00718 yy_bp = yy_cp; 00719 00720 yy_current_state = (yy_start); 00721 yy_match: 00722 do 00723 { 00724 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; 00725 if ( yy_accept[yy_current_state] ) 00726 { 00727 (yy_last_accepting_state) = yy_current_state; 00728 (yy_last_accepting_cpos) = yy_cp; 00729 } 00730 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 00731 { 00732 yy_current_state = (int) yy_def[yy_current_state]; 00733 if ( yy_current_state >= 17 ) 00734 yy_c = yy_meta[(unsigned int) yy_c]; 00735 } 00736 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 00737 ++yy_cp; 00738 } 00739 while ( yy_base[yy_current_state] != 31 ); 00740 00741 yy_find_action: 00742 yy_act = yy_accept[yy_current_state]; 00743 if ( yy_act == 0 ) 00744 { /* have to back up */ 00745 yy_cp = (yy_last_accepting_cpos); 00746 yy_current_state = (yy_last_accepting_state); 00747 yy_act = yy_accept[yy_current_state]; 00748 } 00749 00750 YY_DO_BEFORE_ACTION; 00751 00752 do_action: /* This label is used only to access EOF actions. */ 00753 00754 switch ( yy_act ) 00755 { /* beginning of action switch */ 00756 case 0: /* must back up */ 00757 /* undo the effects of YY_DO_BEFORE_ACTION */ 00758 *yy_cp = (yy_hold_char); 00759 yy_cp = (yy_last_accepting_cpos); 00760 yy_current_state = (yy_last_accepting_state); 00761 goto yy_find_action; 00762 00763 case 1: 00764 YY_RULE_SETUP 00765 #line 43 "configfile.l" 00766 {} 00767 YY_BREAK 00768 case 2: 00769 /* rule 2 can match eol */ 00770 YY_RULE_SETUP 00771 #line 44 "configfile.l" 00772 { iLinenumber++; } 00773 YY_BREAK 00774 case 3: 00775 /* rule 3 can match eol */ 00776 YY_RULE_SETUP 00777 #line 45 "configfile.l" 00778 { (void)evaluatetoken( yytext); } 00779 YY_BREAK 00780 case 4: 00781 YY_RULE_SETUP 00782 #line 46 "configfile.l" 00783 {} 00784 YY_BREAK 00785 case 5: 00786 YY_RULE_SETUP 00787 #line 47 "configfile.l" 00788 { (void)evaluatetoken( yytext ); } 00789 YY_BREAK 00790 case 6: 00791 YY_RULE_SETUP 00792 #line 48 "configfile.l" 00793 { tok_error( yytext ); } 00794 YY_BREAK 00795 case 7: 00796 YY_RULE_SETUP 00797 #line 49 "configfile.l" 00798 ECHO; 00799 YY_BREAK 00800 #line 801 "configfile.c" 00801 case YY_STATE_EOF(INITIAL): 00802 yyterminate(); 00803 00804 case YY_END_OF_BUFFER: 00805 { 00806 /* Amount of text matched not including the EOB char. */ 00807 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; 00808 00809 /* Undo the effects of YY_DO_BEFORE_ACTION. */ 00810 *yy_cp = (yy_hold_char); 00811 YY_RESTORE_YY_MORE_OFFSET 00812 00813 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) 00814 { 00815 /* We're scanning a new file or input source. It's 00816 * possible that this happened because the user 00817 * just pointed yyin at a new source and called 00818 * yylex(). If so, then we have to assure 00819 * consistency between YY_CURRENT_BUFFER and our 00820 * globals. Here is the right place to do so, because 00821 * this is the first action (other than possibly a 00822 * back-up) that will match for the new input source. 00823 */ 00824 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; 00825 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; 00826 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; 00827 } 00828 00829 /* Note that here we test for yy_c_buf_p "<=" to the position 00830 * of the first EOB in the buffer, since yy_c_buf_p will 00831 * already have been incremented past the NUL character 00832 * (since all states make transitions on EOB to the 00833 * end-of-buffer state). Contrast this with the test 00834 * in input(). 00835 */ 00836 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) 00837 { /* This was really a NUL. */ 00838 yy_state_type yy_next_state; 00839 00840 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; 00841 00842 yy_current_state = yy_get_previous_state( ); 00843 00844 /* Okay, we're now positioned to make the NUL 00845 * transition. We couldn't have 00846 * yy_get_previous_state() go ahead and do it 00847 * for us because it doesn't know how to deal 00848 * with the possibility of jamming (and we don't 00849 * want to build jamming into it because then it 00850 * will run more slowly). 00851 */ 00852 00853 yy_next_state = yy_try_NUL_trans( yy_current_state ); 00854 00855 yy_bp = (yytext_ptr) + YY_MORE_ADJ; 00856 00857 if ( yy_next_state ) 00858 { 00859 /* Consume the NUL. */ 00860 yy_cp = ++(yy_c_buf_p); 00861 yy_current_state = yy_next_state; 00862 goto yy_match; 00863 } 00864 00865 else 00866 { 00867 yy_cp = (yy_c_buf_p); 00868 goto yy_find_action; 00869 } 00870 } 00871 00872 else switch ( yy_get_next_buffer( ) ) 00873 { 00874 case EOB_ACT_END_OF_FILE: 00875 { 00876 (yy_did_buffer_switch_on_eof) = 0; 00877 00878 if ( yywrap( ) ) 00879 { 00880 /* Note: because we've taken care in 00881 * yy_get_next_buffer() to have set up 00882 * yytext, we can now set up 00883 * yy_c_buf_p so that if some total 00884 * hoser (like flex itself) wants to 00885 * call the scanner after we return the 00886 * YY_NULL, it'll still work - another 00887 * YY_NULL will get returned. 00888 */ 00889 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; 00890 00891 yy_act = YY_STATE_EOF(YY_START); 00892 goto do_action; 00893 } 00894 00895 else 00896 { 00897 if ( ! (yy_did_buffer_switch_on_eof) ) 00898 YY_NEW_FILE; 00899 } 00900 break; 00901 } 00902 00903 case EOB_ACT_CONTINUE_SCAN: 00904 (yy_c_buf_p) = 00905 (yytext_ptr) + yy_amount_of_matched_text; 00906 00907 yy_current_state = yy_get_previous_state( ); 00908 00909 yy_cp = (yy_c_buf_p); 00910 yy_bp = (yytext_ptr) + YY_MORE_ADJ; 00911 goto yy_match; 00912 00913 case EOB_ACT_LAST_MATCH: 00914 (yy_c_buf_p) = 00915 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; 00916 00917 yy_current_state = yy_get_previous_state( ); 00918 00919 yy_cp = (yy_c_buf_p); 00920 yy_bp = (yytext_ptr) + YY_MORE_ADJ; 00921 goto yy_find_action; 00922 } 00923 break; 00924 } 00925 00926 default: 00927 YY_FATAL_ERROR( 00928 "fatal flex scanner internal error--no action found" ); 00929 } /* end of action switch */ 00930 } /* end of scanning one token */ 00931 } /* end of yylex */ 00932 00933 /* yy_get_next_buffer - try to read in a new buffer 00934 * 00935 * Returns a code representing an action: 00936 * EOB_ACT_LAST_MATCH - 00937 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position 00938 * EOB_ACT_END_OF_FILE - end of file 00939 */ 00940 static int yy_get_next_buffer (void) 00941 { 00942 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; 00943 register char *source = (yytext_ptr); 00944 register int number_to_move, i; 00945 int ret_val; 00946 00947 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) 00948 YY_FATAL_ERROR( 00949 "fatal flex scanner internal error--end of buffer missed" ); 00950 00951 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) 00952 { /* Don't try to fill the buffer, so this is an EOF. */ 00953 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) 00954 { 00955 /* We matched a single character, the EOB, so 00956 * treat this as a final EOF. 00957 */ 00958 return EOB_ACT_END_OF_FILE; 00959 } 00960 00961 else 00962 { 00963 /* We matched some text prior to the EOB, first 00964 * process it. 00965 */ 00966 return EOB_ACT_LAST_MATCH; 00967 } 00968 } 00969 00970 /* Try to read more data. */ 00971 00972 /* First move last chars to start of buffer. */ 00973 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; 00974 00975 for ( i = 0; i < number_to_move; ++i ) 00976 *(dest++) = *(source++); 00977 00978 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) 00979 /* don't do the read, it's not guaranteed to return an EOF, 00980 * just force an EOF 00981 */ 00982 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; 00983 00984 else 00985 { 00986 int num_to_read = 00987 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; 00988 00989 while ( num_to_read <= 0 ) 00990 { /* Not enough room in the buffer - grow it. */ 00991 00992 /* just a shorter name for the current buffer */ 00993 YY_BUFFER_STATE b = YY_CURRENT_BUFFER; 00994 00995 int yy_c_buf_p_offset = 00996 (int) ((yy_c_buf_p) - b->yy_ch_buf); 00997 00998 if ( b->yy_is_our_buffer ) 00999 { 01000 int new_size = b->yy_buf_size * 2; 01001 01002 if ( new_size <= 0 ) 01003 b->yy_buf_size += b->yy_buf_size / 8; 01004 else 01005 b->yy_buf_size *= 2; 01006 01007 b->yy_ch_buf = (char *) 01008 /* Include room in for 2 EOB chars. */ 01009 yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); 01010 } 01011 else 01012 /* Can't grow it, we don't own it. */ 01013 b->yy_ch_buf = 0; 01014 01015 if ( ! b->yy_ch_buf ) 01016 YY_FATAL_ERROR( 01017 "fatal error - scanner input buffer overflow" ); 01018 01019 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; 01020 01021 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - 01022 number_to_move - 1; 01023 01024 } 01025 01026 if ( num_to_read > YY_READ_BUF_SIZE ) 01027 num_to_read = YY_READ_BUF_SIZE; 01028 01029 /* Read in more data. */ 01030 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), 01031 (yy_n_chars), (size_t) num_to_read ); 01032 01033 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); 01034 } 01035 01036 if ( (yy_n_chars) == 0 ) 01037 { 01038 if ( number_to_move == YY_MORE_ADJ ) 01039 { 01040 ret_val = EOB_ACT_END_OF_FILE; 01041 yyrestart(yyin ); 01042 } 01043 01044 else 01045 { 01046 ret_val = EOB_ACT_LAST_MATCH; 01047 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = 01048 YY_BUFFER_EOF_PENDING; 01049 } 01050 } 01051 01052 else 01053 ret_val = EOB_ACT_CONTINUE_SCAN; 01054 01055 if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { 01056 /* Extend the array by 50%, plus the number we really need. */ 01057 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); 01058 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); 01059 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) 01060 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); 01061 } 01062 01063 (yy_n_chars) += number_to_move; 01064 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; 01065 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; 01066 01067 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; 01068 01069 return ret_val; 01070 } 01071 01072 /* yy_get_previous_state - get the state just before the EOB char was reached */ 01073 01074 static yy_state_type yy_get_previous_state (void) 01075 { 01076 register yy_state_type yy_current_state; 01077 register char *yy_cp; 01078 01079 yy_current_state = (yy_start); 01080 01081 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) 01082 { 01083 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); 01084 if ( yy_accept[yy_current_state] ) 01085 { 01086 (yy_last_accepting_state) = yy_current_state; 01087 (yy_last_accepting_cpos) = yy_cp; 01088 } 01089 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 01090 { 01091 yy_current_state = (int) yy_def[yy_current_state]; 01092 if ( yy_current_state >= 17 ) 01093 yy_c = yy_meta[(unsigned int) yy_c]; 01094 } 01095 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 01096 } 01097 01098 return yy_current_state; 01099 } 01100 01101 /* yy_try_NUL_trans - try to make a transition on the NUL character 01102 * 01103 * synopsis 01104 * next_state = yy_try_NUL_trans( current_state ); 01105 */ 01106 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) 01107 { 01108 register int yy_is_jam; 01109 register char *yy_cp = (yy_c_buf_p); 01110 01111 register YY_CHAR yy_c = 1; 01112 if ( yy_accept[yy_current_state] ) 01113 { 01114 (yy_last_accepting_state) = yy_current_state; 01115 (yy_last_accepting_cpos) = yy_cp; 01116 } 01117 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 01118 { 01119 yy_current_state = (int) yy_def[yy_current_state]; 01120 if ( yy_current_state >= 17 ) 01121 yy_c = yy_meta[(unsigned int) yy_c]; 01122 } 01123 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 01124 yy_is_jam = (yy_current_state == 16); 01125 01126 return yy_is_jam ? 0 : yy_current_state; 01127 } 01128 01129 #ifndef YY_NO_INPUT 01130 #ifdef __cplusplus 01131 static int yyinput (void) 01132 #else 01133 static int input (void) 01134 #endif 01135 01136 { 01137 int c; 01138 01139 *(yy_c_buf_p) = (yy_hold_char); 01140 01141 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) 01142 { 01143 /* yy_c_buf_p now points to the character we want to return. 01144 * If this occurs *before* the EOB characters, then it's a 01145 * valid NUL; if not, then we've hit the end of the buffer. 01146 */ 01147 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) 01148 /* This was really a NUL. */ 01149 *(yy_c_buf_p) = '\0'; 01150 01151 else 01152 { /* need more input */ 01153 int offset = (yy_c_buf_p) - (yytext_ptr); 01154 ++(yy_c_buf_p); 01155 01156 switch ( yy_get_next_buffer( ) ) 01157 { 01158 case EOB_ACT_LAST_MATCH: 01159 /* This happens because yy_g_n_b() 01160 * sees that we've accumulated a 01161 * token and flags that we need to 01162 * try matching the token before 01163 * proceeding. But for input(), 01164 * there's no matching to consider. 01165 * So convert the EOB_ACT_LAST_MATCH 01166 * to EOB_ACT_END_OF_FILE. 01167 */ 01168 01169 /* Reset buffer status. */ 01170 yyrestart(yyin ); 01171 01172 /*FALLTHROUGH*/ 01173 01174 case EOB_ACT_END_OF_FILE: 01175 { 01176 if ( yywrap( ) ) 01177 return EOF; 01178 01179 if ( ! (yy_did_buffer_switch_on_eof) ) 01180 YY_NEW_FILE; 01181 #ifdef __cplusplus 01182 return yyinput(); 01183 #else 01184 return input(); 01185 #endif 01186 } 01187 01188 case EOB_ACT_CONTINUE_SCAN: 01189 (yy_c_buf_p) = (yytext_ptr) + offset; 01190 break; 01191 } 01192 } 01193 } 01194 01195 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ 01196 *(yy_c_buf_p) = '\0'; /* preserve yytext */ 01197 (yy_hold_char) = *++(yy_c_buf_p); 01198 01199 return c; 01200 } 01201 #endif /* ifndef YY_NO_INPUT */ 01202 01208 void yyrestart (FILE * input_file ) 01209 { 01210 01211 if ( ! YY_CURRENT_BUFFER ){ 01212 yyensure_buffer_stack (); 01213 YY_CURRENT_BUFFER_LVALUE = 01214 yy_create_buffer(yyin,YY_BUF_SIZE ); 01215 } 01216 01217 yy_init_buffer(YY_CURRENT_BUFFER,input_file ); 01218 yy_load_buffer_state( ); 01219 } 01220 01225 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) 01226 { 01227 01228 /* TODO. We should be able to replace this entire function body 01229 * with 01230 * yypop_buffer_state(); 01231 * yypush_buffer_state(new_buffer); 01232 */ 01233 yyensure_buffer_stack (); 01234 if ( YY_CURRENT_BUFFER == new_buffer ) 01235 return; 01236 01237 if ( YY_CURRENT_BUFFER ) 01238 { 01239 /* Flush out information for old buffer. */ 01240 *(yy_c_buf_p) = (yy_hold_char); 01241 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); 01242 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); 01243 } 01244 01245 YY_CURRENT_BUFFER_LVALUE = new_buffer; 01246 yy_load_buffer_state( ); 01247 01248 /* We don't actually know whether we did this switch during 01249 * EOF (yywrap()) processing, but the only time this flag 01250 * is looked at is after yywrap() is called, so it's safe 01251 * to go ahead and always set it. 01252 */ 01253 (yy_did_buffer_switch_on_eof) = 1; 01254 } 01255 01256 static void yy_load_buffer_state (void) 01257 { 01258 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; 01259 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; 01260 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; 01261 (yy_hold_char) = *(yy_c_buf_p); 01262 } 01263 01270 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) 01271 { 01272 YY_BUFFER_STATE b; 01273 01274 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); 01275 if ( ! b ) 01276 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); 01277 01278 b->yy_buf_size = size; 01279 01280 /* yy_ch_buf has to be 2 characters longer than the size given because 01281 * we need to put in 2 end-of-buffer characters. 01282 */ 01283 b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); 01284 if ( ! b->yy_ch_buf ) 01285 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); 01286 01287 b->yy_is_our_buffer = 1; 01288 01289 yy_init_buffer(b,file ); 01290 01291 return b; 01292 } 01293 01298 void yy_delete_buffer (YY_BUFFER_STATE b ) 01299 { 01300 01301 if ( ! b ) 01302 return; 01303 01304 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ 01305 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; 01306 01307 if ( b->yy_is_our_buffer ) 01308 yyfree((void *) b->yy_ch_buf ); 01309 01310 yyfree((void *) b ); 01311 } 01312 01313 #ifndef __cplusplus 01314 extern int isatty (int ); 01315 #endif /* __cplusplus */ 01316 01317 /* Initializes or reinitializes a buffer. 01318 * This function is sometimes called more than once on the same buffer, 01319 * such as during a yyrestart() or at EOF. 01320 */ 01321 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) 01322 01323 { 01324 int oerrno = errno; 01325 01326 yy_flush_buffer(b ); 01327 01328 b->yy_input_file = file; 01329 b->yy_fill_buffer = 1; 01330 01331 /* If b is the current buffer, then yy_init_buffer was _probably_ 01332 * called from yyrestart() or through yy_get_next_buffer. 01333 * In that case, we don't want to reset the lineno or column. 01334 */ 01335 if (b != YY_CURRENT_BUFFER){ 01336 b->yy_bs_lineno = 1; 01337 b->yy_bs_column = 0; 01338 } 01339 01340 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; 01341 01342 errno = oerrno; 01343 } 01344 01349 void yy_flush_buffer (YY_BUFFER_STATE b ) 01350 { 01351 if ( ! b ) 01352 return; 01353 01354 b->yy_n_chars = 0; 01355 01356 /* We always need two end-of-buffer characters. The first causes 01357 * a transition to the end-of-buffer state. The second causes 01358 * a jam in that state. 01359 */ 01360 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; 01361 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; 01362 01363 b->yy_buf_pos = &b->yy_ch_buf[0]; 01364 01365 b->yy_at_bol = 1; 01366 b->yy_buffer_status = YY_BUFFER_NEW; 01367 01368 if ( b == YY_CURRENT_BUFFER ) 01369 yy_load_buffer_state( ); 01370 } 01371 01378 void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) 01379 { 01380 if (new_buffer == NULL) 01381 return; 01382 01383 yyensure_buffer_stack(); 01384 01385 /* This block is copied from yy_switch_to_buffer. */ 01386 if ( YY_CURRENT_BUFFER ) 01387 { 01388 /* Flush out information for old buffer. */ 01389 *(yy_c_buf_p) = (yy_hold_char); 01390 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); 01391 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); 01392 } 01393 01394 /* Only push if top exists. Otherwise, replace top. */ 01395 if (YY_CURRENT_BUFFER) 01396 (yy_buffer_stack_top)++; 01397 YY_CURRENT_BUFFER_LVALUE = new_buffer; 01398 01399 /* copied from yy_switch_to_buffer. */ 01400 yy_load_buffer_state( ); 01401 (yy_did_buffer_switch_on_eof) = 1; 01402 } 01403 01408 void yypop_buffer_state (void) 01409 { 01410 if (!YY_CURRENT_BUFFER) 01411 return; 01412 01413 yy_delete_buffer(YY_CURRENT_BUFFER ); 01414 YY_CURRENT_BUFFER_LVALUE = NULL; 01415 if ((yy_buffer_stack_top) > 0) 01416 --(yy_buffer_stack_top); 01417 01418 if (YY_CURRENT_BUFFER) { 01419 yy_load_buffer_state( ); 01420 (yy_did_buffer_switch_on_eof) = 1; 01421 } 01422 } 01423 01424 /* Allocates the stack if it does not exist. 01425 * Guarantees space for at least one push. 01426 */ 01427 static void yyensure_buffer_stack (void) 01428 { 01429 int num_to_alloc; 01430 01431 if (!(yy_buffer_stack)) { 01432 01433 /* First allocation is just for 2 elements, since we don't know if this 01434 * scanner will even need a stack. We use 2 instead of 1 to avoid an 01435 * immediate realloc on the next call. 01436 */ 01437 num_to_alloc = 1; 01438 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc 01439 (num_to_alloc * sizeof(struct yy_buffer_state*) 01440 ); 01441 if ( ! (yy_buffer_stack) ) 01442 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); 01443 01444 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); 01445 01446 (yy_buffer_stack_max) = num_to_alloc; 01447 (yy_buffer_stack_top) = 0; 01448 return; 01449 } 01450 01451 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ 01452 01453 /* Increase the buffer to prepare for a possible push. */ 01454 int grow_size = 8 /* arbitrary grow size */; 01455 01456 num_to_alloc = (yy_buffer_stack_max) + grow_size; 01457 (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc 01458 ((yy_buffer_stack), 01459 num_to_alloc * sizeof(struct yy_buffer_state*) 01460 ); 01461 if ( ! (yy_buffer_stack) ) 01462 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); 01463 01464 /* zero only the new slots.*/ 01465 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); 01466 (yy_buffer_stack_max) = num_to_alloc; 01467 } 01468 } 01469 01476 YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) 01477 { 01478 YY_BUFFER_STATE b; 01479 01480 if ( size < 2 || 01481 base[size-2] != YY_END_OF_BUFFER_CHAR || 01482 base[size-1] != YY_END_OF_BUFFER_CHAR ) 01483 /* They forgot to leave room for the EOB's. */ 01484 return 0; 01485 01486 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); 01487 if ( ! b ) 01488 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); 01489 01490 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ 01491 b->yy_buf_pos = b->yy_ch_buf = base; 01492 b->yy_is_our_buffer = 0; 01493 b->yy_input_file = 0; 01494 b->yy_n_chars = b->yy_buf_size; 01495 b->yy_is_interactive = 0; 01496 b->yy_at_bol = 1; 01497 b->yy_fill_buffer = 0; 01498 b->yy_buffer_status = YY_BUFFER_NEW; 01499 01500 yy_switch_to_buffer(b ); 01501 01502 return b; 01503 } 01504 01513 YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) 01514 { 01515 01516 return yy_scan_bytes(yystr,strlen(yystr) ); 01517 } 01518 01526 YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) 01527 { 01528 YY_BUFFER_STATE b; 01529 char *buf; 01530 yy_size_t n; 01531 int i; 01532 01533 /* Get memory for full buffer, including space for trailing EOB's. */ 01534 n = _yybytes_len + 2; 01535 buf = (char *) yyalloc(n ); 01536 if ( ! buf ) 01537 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); 01538 01539 for ( i = 0; i < _yybytes_len; ++i ) 01540 buf[i] = yybytes[i]; 01541 01542 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; 01543 01544 b = yy_scan_buffer(buf,n ); 01545 if ( ! b ) 01546 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); 01547 01548 /* It's okay to grow etc. this buffer, and we should throw it 01549 * away when we're done. 01550 */ 01551 b->yy_is_our_buffer = 1; 01552 01553 return b; 01554 } 01555 01556 #ifndef YY_EXIT_FAILURE 01557 #define YY_EXIT_FAILURE 2 01558 #endif 01559 01560 static void yy_fatal_error (yyconst char* msg ) 01561 { 01562 (void) fprintf( stderr, "%s\n", msg ); 01563 exit( YY_EXIT_FAILURE ); 01564 } 01565 01566 /* Redefine yyless() so it works in section 3 code. */ 01567 01568 #undef yyless 01569 #define yyless(n) \ 01570 do \ 01571 { \ 01572 /* Undo effects of setting up yytext. */ \ 01573 int yyless_macro_arg = (n); \ 01574 YY_LESS_LINENO(yyless_macro_arg);\ 01575 yytext[yyleng] = (yy_hold_char); \ 01576 (yy_c_buf_p) = yytext + yyless_macro_arg; \ 01577 (yy_hold_char) = *(yy_c_buf_p); \ 01578 *(yy_c_buf_p) = '\0'; \ 01579 yyleng = yyless_macro_arg; \ 01580 } \ 01581 while ( 0 ) 01582 01583 /* Accessor methods (get/set functions) to struct members. */ 01584 01588 int yyget_lineno (void) 01589 { 01590 01591 return yylineno; 01592 } 01593 01597 FILE *yyget_in (void) 01598 { 01599 return yyin; 01600 } 01601 01605 FILE *yyget_out (void) 01606 { 01607 return yyout; 01608 } 01609 01613 int yyget_leng (void) 01614 { 01615 return yyleng; 01616 } 01617 01622 char *yyget_text (void) 01623 { 01624 return yytext; 01625 } 01626 01631 void yyset_lineno (int line_number ) 01632 { 01633 01634 yylineno = line_number; 01635 } 01636 01643 void yyset_in (FILE * in_str ) 01644 { 01645 yyin = in_str ; 01646 } 01647 01648 void yyset_out (FILE * out_str ) 01649 { 01650 yyout = out_str ; 01651 } 01652 01653 int yyget_debug (void) 01654 { 01655 return yy_flex_debug; 01656 } 01657 01658 void yyset_debug (int bdebug ) 01659 { 01660 yy_flex_debug = bdebug ; 01661 } 01662 01663 static int yy_init_globals (void) 01664 { 01665 /* Initialization is the same as for the non-reentrant scanner. 01666 * This function is called from yylex_destroy(), so don't allocate here. 01667 */ 01668 01669 (yy_buffer_stack) = 0; 01670 (yy_buffer_stack_top) = 0; 01671 (yy_buffer_stack_max) = 0; 01672 (yy_c_buf_p) = (char *) 0; 01673 (yy_init) = 0; 01674 (yy_start) = 0; 01675 01676 /* Defined in main.c */ 01677 #ifdef YY_STDINIT 01678 yyin = stdin; 01679 yyout = stdout; 01680 #else 01681 yyin = (FILE *) 0; 01682 yyout = (FILE *) 0; 01683 #endif 01684 01685 /* For future reference: Set errno on error, since we are called by 01686 * yylex_init() 01687 */ 01688 return 0; 01689 } 01690 01691 /* yylex_destroy is for both reentrant and non-reentrant scanners. */ 01692 int yylex_destroy (void) 01693 { 01694 01695 /* Pop the buffer stack, destroying each element. */ 01696 while(YY_CURRENT_BUFFER){ 01697 yy_delete_buffer(YY_CURRENT_BUFFER ); 01698 YY_CURRENT_BUFFER_LVALUE = NULL; 01699 yypop_buffer_state(); 01700 } 01701 01702 /* Destroy the stack itself. */ 01703 yyfree((yy_buffer_stack) ); 01704 (yy_buffer_stack) = NULL; 01705 01706 /* Reset the globals. This is important in a non-reentrant scanner so the next time 01707 * yylex() is called, initialization will occur. */ 01708 yy_init_globals( ); 01709 01710 return 0; 01711 } 01712 01713 /* 01714 * Internal utility routines. 01715 */ 01716 01717 #ifndef yytext_ptr 01718 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) 01719 { 01720 register int i; 01721 for ( i = 0; i < n; ++i ) 01722 s1[i] = s2[i]; 01723 } 01724 #endif 01725 01726 #ifdef YY_NEED_STRLEN 01727 static int yy_flex_strlen (yyconst char * s ) 01728 { 01729 register int n; 01730 for ( n = 0; s[n]; ++n ) 01731 ; 01732 01733 return n; 01734 } 01735 #endif 01736 01737 void *yyalloc (yy_size_t size ) 01738 { 01739 return (void *) malloc( size ); 01740 } 01741 01742 void *yyrealloc (void * ptr, yy_size_t size ) 01743 { 01744 /* The cast to (char *) in the following accommodates both 01745 * implementations that use char* generic pointers, and those 01746 * that use void* generic pointers. It works with the latter 01747 * because both ANSI C and C++ allow castless assignment from 01748 * any pointer type to void*, and deal with argument conversions 01749 * as though doing an assignment. 01750 */ 01751 return (void *) realloc( (char *) ptr, size ); 01752 } 01753 01754 void yyfree (void * ptr ) 01755 { 01756 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ 01757 } 01758 01759 #define YYTABLES_NAME "yytables" 01760 01761 #line 49 "configfile.l" 01762 01763 01764 01765 #include <stdio.h> 01766 #include <string.h> 01767 #include <errno.h> 01768 01769 #include "misc.h" 01770 #include "pcsclite.h" 01771 #include "pcscd.h" 01772 #include "debuglog.h" 01773 #include "config.h" 01774 #include "sys_generic.h" 01775 #include "readerfactory.h" 01776 01777 int evaluatetoken(char *pcToken) 01778 { 01779 01780 DWORD dwChannelId = 0; 01781 int p = 0; 01782 unsigned int n = 0; 01783 01784 if (pcPrevious == NULL) 01785 { /* This is the key */ 01786 pcPrevious = strdup(pcToken); 01787 iOldLinenumber = iLinenumber; 01788 } 01789 else 01790 { 01791 /* first and second tokens are not on the same line */ 01792 if (iOldLinenumber != iLinenumber) 01793 { 01794 tok_error(pcPrevious); 01795 pcPrevious = strdup(pcToken); 01796 iOldLinenumber = iLinenumber; 01797 return 1; 01798 } 01799 01800 pcCurrent = pcToken; 01801 if (strcmp(pcPrevious, "FRIENDLYNAME") == 0) 01802 { 01803 if (pcFriendlyname == NULL) 01804 { 01805 pcFriendlyname = malloc(strlen(pcCurrent) - 1); 01806 for (n = 0; n < strlen(pcCurrent); n++) 01807 { 01808 if (pcCurrent[n] != '"') 01809 { /* Strip off the quotes */ 01810 pcFriendlyname[p++] = pcCurrent[n]; 01811 } 01812 } 01813 pcFriendlyname[p++] = '\0'; 01814 } 01815 else 01816 { 01817 tok_error(pcPrevious); 01818 return 1; 01819 } 01820 } 01821 else if (strcmp(pcPrevious, "DEVICENAME") == 0) 01822 { 01823 if (pcDevicename == NULL) 01824 { 01825 struct stat fStatBuf; 01826 01827 pcDevicename = strdup(pcCurrent); 01828 if ((NULL == strchr(pcDevicename, ':')) 01829 && (SYS_Stat(pcDevicename, &fStatBuf) != 0)) 01830 { 01831 Log3(PCSC_LOG_CRITICAL, "Error with device %s: %s", 01832 pcDevicename, strerror(errno)); 01833 Log1(PCSC_LOG_CRITICAL, "You should use 'DEVICENAME /dev/null' if your driver does not use this field"); 01834 badError = 1; 01835 } 01836 } 01837 else 01838 { 01839 tok_error(pcPrevious); 01840 return 1; 01841 } 01842 } 01843 else if (strcmp(pcPrevious, "LIBPATH") == 0) 01844 { 01845 if (pcLibpath == NULL) 01846 { 01847 struct stat fStatBuf; 01848 01849 pcLibpath = strdup(pcCurrent); 01850 if (SYS_Stat(pcLibpath, &fStatBuf) != 0) 01851 { 01852 Log3(PCSC_LOG_CRITICAL, "Error with library %s: %s", 01853 pcLibpath, strerror(errno)); 01854 badError = 1; 01855 } 01856 01857 if (strstr(pcLibpath, ".bundle") != NULL) 01858 { 01859 Log1(PCSC_LOG_ERROR, "WARNING *************************************"); 01860 Log2(PCSC_LOG_ERROR, "WARNING: USB drivers SHOULD NOT be declared in reader.conf: %s", pcLibpath); 01861 Log1(PCSC_LOG_ERROR, "WARNING *************************************"); 01862 } 01863 } 01864 else 01865 { 01866 tok_error(pcPrevious); 01867 return 1; 01868 } 01869 } 01870 else if (strcmp(pcPrevious, "CHANNELID") == 0) 01871 { 01872 if (pcChannelid == NULL) 01873 pcChannelid = strdup(pcCurrent); 01874 else 01875 { 01876 tok_error(pcPrevious); 01877 return 1; 01878 } 01879 } 01880 else 01881 { 01882 tok_error(pcPrevious); 01883 free(pcPrevious); 01884 pcPrevious = NULL; 01885 return 1; 01886 } 01887 01888 free(pcPrevious); 01889 pcPrevious = NULL; 01890 } 01891 01892 if (pcFriendlyname != NULL && pcDevicename != NULL && 01893 pcLibpath != NULL && pcChannelid != NULL && badError != 1) 01894 { 01895 if (0 == reader_list_size) 01896 { 01897 /* one real reader and one end marker */ 01898 reader_list_size = 2; 01899 reader_list = malloc(reader_list_size * sizeof(SerialReader)); 01900 } 01901 else 01902 { 01903 reader_list_size++; 01904 reader_list = realloc(reader_list, reader_list_size * 01905 sizeof(SerialReader)); 01906 } 01907 01908 /* end marker */ 01909 reader_list[reader_list_size-1].pcFriendlyname = NULL; 01910 01911 dwChannelId = strtoul(pcChannelid, 0, 16); 01912 reader_list[reader_list_size-2].pcFriendlyname = strdup(pcFriendlyname); 01913 reader_list[reader_list_size-2].pcDevicename = strdup(pcDevicename); 01914 reader_list[reader_list_size-2].pcLibpath = strdup(pcLibpath), 01915 reader_list[reader_list_size-2].dwChannelId = dwChannelId; 01916 01917 pcFriendlyname = NULL; 01918 pcDevicename = NULL; 01919 pcLibpath = NULL; 01920 pcChannelid = NULL; 01921 } 01922 01923 return 0; 01924 } 01925 01926 void tok_error(char *token_error) 01927 { 01928 Log3(PCSC_LOG_ERROR, "tok_error: invalid value line %d in " PCSCLITE_READER_CONFIG ": %s", iOldLinenumber, token_error); 01929 badError = 1; 01930 } 01931 01932 int DBGetReaderList(const char *readerconf, SerialReader **caller_reader_list) 01933 { 01934 FILE *configFile = NULL; 01935 01936 *caller_reader_list = NULL; /* no list by default */ 01937 01938 configFile = fopen(readerconf, "r"); 01939 01940 if (configFile == NULL) 01941 return 1; 01942 01943 yyin = configFile; 01944 01945 /* (re)start with a clean state */ 01946 iLinenumber = 1; 01947 iOldLinenumber = -1; 01948 reader_list = NULL; 01949 reader_list_size = 0; 01950 pcFriendlyname = NULL; 01951 pcDevicename = NULL; 01952 pcLibpath = NULL; 01953 pcChannelid = NULL; 01954 pcPrevious = NULL; 01955 pcCurrent = NULL; 01956 badError = 0; 01957 01958 do 01959 { 01960 (void)yylex(); 01961 } 01962 while (!feof(configFile)); 01963 01964 (void)fclose(configFile); 01965 01966 *caller_reader_list = reader_list; 01967 01968 if (badError == 1) 01969 return -1; 01970 else 01971 return 0; 01972 } /* End of configfile.c */ 01973 01974