configfile.c

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

Generated on Wed Mar 31 11:47:35 2010 for pcsc-lite by  doxygen 1.4.7