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

Generated on Sat Oct 14 22:17:33 2006 for pcsc-lite by  doxygen 1.4.7