Main Page   Data Structures   File List   Data Fields   Globals   Related Pages  

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 2331 2007-01-11 16:54:51Z rousseau $
00477  */
00478 #line 15 "configfile.l"
00479 #include "wintypes.h"
00480 #include "readerfactory.h"
00481 #include "configfile.h"
00482 
00483 int evaluatetoken(char *pcToken);
00484 
00485 static int iLinenumber;
00486 static char *pcPrevious;
00487 static char *pcCurrent;
00488 static char *pcFriendlyname;
00489 static char *pcDevicename;
00490 static char *pcLibpath;
00491 static char *pcChannelid;
00492 static int badError;
00493 static SerialReader *reader_list;
00494 static int reader_list_size;
00495 
00496 void tok_error(char *pcToken_error);
00497 
00498 #line 499 "configfile.c"
00499 
00500 #define INITIAL 0
00501 
00502 #ifndef YY_NO_UNISTD_H
00503 /* Special case for "unistd.h", since it is non-ANSI. We include it way
00504  * down here because we want the user's section 1 to have been scanned first.
00505  * The user has a chance to override it with an option.
00506  */
00507 #include <unistd.h>
00508 #endif
00509 
00510 #ifndef YY_EXTRA_TYPE
00511 #define YY_EXTRA_TYPE void *
00512 #endif
00513 
00514 static int yy_init_globals (void );
00515 
00516 /* Macros after this point can all be overridden by user definitions in
00517  * section 1.
00518  */
00519 
00520 #ifndef YY_SKIP_YYWRAP
00521 #ifdef __cplusplus
00522 extern "C" int yywrap (void );
00523 #else
00524 extern int yywrap (void );
00525 #endif
00526 #endif
00527 
00528 #ifndef yytext_ptr
00529 static void yy_flex_strncpy (char *,yyconst char *,int );
00530 #endif
00531 
00532 #ifdef YY_NEED_STRLEN
00533 static int yy_flex_strlen (yyconst char * );
00534 #endif
00535 
00536 #ifndef YY_NO_INPUT
00537 
00538 #ifdef __cplusplus
00539 static int yyinput (void );
00540 #else
00541 static int input (void );
00542 #endif
00543 
00544 #endif
00545 
00546 /* Amount of stuff to slurp up with each read. */
00547 #ifndef YY_READ_BUF_SIZE
00548 #define YY_READ_BUF_SIZE 8192
00549 #endif
00550 
00551 /* Copy whatever the last rule matched to the standard output. */
00552 #ifndef ECHO
00553 /* This used to be an fputs(), but since the string might contain NUL's,
00554  * we now use fwrite().
00555  */
00556 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
00557 #endif
00558 
00559 /* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
00560  * is returned in "result".
00561  */
00562 #ifndef YY_INPUT
00563 #define YY_INPUT(buf,result,max_size) \
00564     if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
00565         { \
00566         int c = '*'; \
00567         size_t n; \
00568         for ( n = 0; n < max_size && \
00569                  (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
00570             buf[n] = (char) c; \
00571         if ( c == '\n' ) \
00572             buf[n++] = (char) c; \
00573         if ( c == EOF && ferror( yyin ) ) \
00574             YY_FATAL_ERROR( "input in flex scanner failed" ); \
00575         result = n; \
00576         } \
00577     else \
00578         { \
00579         errno=0; \
00580         while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
00581             { \
00582             if( errno != EINTR) \
00583                 { \
00584                 YY_FATAL_ERROR( "input in flex scanner failed" ); \
00585                 break; \
00586                 } \
00587             errno=0; \
00588             clearerr(yyin); \
00589             } \
00590         }\
00591 \
00592 
00593 #endif
00594 
00595 /* No semi-colon after return; correct usage is to write "yyterminate();" -
00596  * we don't want an extra ';' after the "return" because that will cause
00597  * some compilers to complain about unreachable statements.
00598  */
00599 #ifndef yyterminate
00600 #define yyterminate() return YY_NULL
00601 #endif
00602 
00603 /* Number of entries by which start-condition stack grows. */
00604 #ifndef YY_START_STACK_INCR
00605 #define YY_START_STACK_INCR 25
00606 #endif
00607 
00608 /* Report a fatal error. */
00609 #ifndef YY_FATAL_ERROR
00610 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
00611 #endif
00612 
00613 /* end tables serialization structures and prototypes */
00614 
00615 /* Default declaration of generated scanner - a define so the user can
00616  * easily add parameters.
00617  */
00618 #ifndef YY_DECL
00619 #define YY_DECL_IS_OURS 1
00620 
00621 extern int yylex (void);
00622 
00623 #define YY_DECL int yylex (void)
00624 #endif /* !YY_DECL */
00625 
00626 /* Code executed at the beginning of each rule, after yytext and yyleng
00627  * have been set up.
00628  */
00629 #ifndef YY_USER_ACTION
00630 #define YY_USER_ACTION
00631 #endif
00632 
00633 /* Code executed at the end of each rule. */
00634 #ifndef YY_BREAK
00635 #define YY_BREAK break;
00636 #endif
00637 
00638 #define YY_RULE_SETUP \
00639     YY_USER_ACTION
00640 
00643 YY_DECL
00644 {
00645     register yy_state_type yy_current_state;
00646     register char *yy_cp, *yy_bp;
00647     register int yy_act;
00648     
00649 #line 39 "configfile.l"
00650 
00651 
00652 #line 653 "configfile.c"
00653 
00654     if ( !(yy_init) )
00655         {
00656         (yy_init) = 1;
00657 
00658 #ifdef YY_USER_INIT
00659         YY_USER_INIT;
00660 #endif
00661 
00662         if ( ! (yy_start) )
00663             (yy_start) = 1; /* first start state */
00664 
00665         if ( ! yyin )
00666             yyin = stdin;
00667 
00668         if ( ! yyout )
00669             yyout = stdout;
00670 
00671         if ( ! YY_CURRENT_BUFFER ) {
00672             yyensure_buffer_stack ();
00673             YY_CURRENT_BUFFER_LVALUE =
00674                 yy_create_buffer(yyin,YY_BUF_SIZE );
00675         }
00676 
00677         yy_load_buffer_state( );
00678         }
00679 
00680     while ( 1 )     /* loops until end-of-file is reached */
00681         {
00682         yy_cp = (yy_c_buf_p);
00683 
00684         /* Support of yytext. */
00685         *yy_cp = (yy_hold_char);
00686 
00687         /* yy_bp points to the position in yy_ch_buf of the start of
00688          * the current run.
00689          */
00690         yy_bp = yy_cp;
00691 
00692         yy_current_state = (yy_start);
00693 yy_match:
00694         do
00695             {
00696             register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
00697             if ( yy_accept[yy_current_state] )
00698                 {
00699                 (yy_last_accepting_state) = yy_current_state;
00700                 (yy_last_accepting_cpos) = yy_cp;
00701                 }
00702             while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
00703                 {
00704                 yy_current_state = (int) yy_def[yy_current_state];
00705                 if ( yy_current_state >= 17 )
00706                     yy_c = yy_meta[(unsigned int) yy_c];
00707                 }
00708             yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
00709             ++yy_cp;
00710             }
00711         while ( yy_base[yy_current_state] != 31 );
00712 
00713 yy_find_action:
00714         yy_act = yy_accept[yy_current_state];
00715         if ( yy_act == 0 )
00716             { /* have to back up */
00717             yy_cp = (yy_last_accepting_cpos);
00718             yy_current_state = (yy_last_accepting_state);
00719             yy_act = yy_accept[yy_current_state];
00720             }
00721 
00722         YY_DO_BEFORE_ACTION;
00723 
00724 do_action:  /* This label is used only to access EOF actions. */
00725 
00726         switch ( yy_act )
00727     { /* beginning of action switch */
00728             case 0: /* must back up */
00729             /* undo the effects of YY_DO_BEFORE_ACTION */
00730             *yy_cp = (yy_hold_char);
00731             yy_cp = (yy_last_accepting_cpos);
00732             yy_current_state = (yy_last_accepting_state);
00733             goto yy_find_action;
00734 
00735 case 1:
00736 YY_RULE_SETUP
00737 #line 41 "configfile.l"
00738 {}
00739     YY_BREAK
00740 case 2:
00741 /* rule 2 can match eol */
00742 YY_RULE_SETUP
00743 #line 42 "configfile.l"
00744 { iLinenumber++; }
00745     YY_BREAK
00746 case 3:
00747 /* rule 3 can match eol */
00748 YY_RULE_SETUP
00749 #line 43 "configfile.l"
00750 { evaluatetoken( yytext); }
00751     YY_BREAK
00752 case 4:
00753 YY_RULE_SETUP
00754 #line 44 "configfile.l"
00755 {}
00756     YY_BREAK
00757 case 5:
00758 YY_RULE_SETUP
00759 #line 45 "configfile.l"
00760 { evaluatetoken( yytext ); }
00761     YY_BREAK
00762 case 6:
00763 YY_RULE_SETUP
00764 #line 46 "configfile.l"
00765 { tok_error( yytext ); }
00766     YY_BREAK
00767 case 7:
00768 YY_RULE_SETUP
00769 #line 47 "configfile.l"
00770 ECHO;
00771     YY_BREAK
00772 #line 773 "configfile.c"
00773 case YY_STATE_EOF(INITIAL):
00774     yyterminate();
00775 
00776     case YY_END_OF_BUFFER:
00777         {
00778         /* Amount of text matched not including the EOB char. */
00779         int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
00780 
00781         /* Undo the effects of YY_DO_BEFORE_ACTION. */
00782         *yy_cp = (yy_hold_char);
00783         YY_RESTORE_YY_MORE_OFFSET
00784 
00785         if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
00786             {
00787             /* We're scanning a new file or input source.  It's
00788              * possible that this happened because the user
00789              * just pointed yyin at a new source and called
00790              * yylex().  If so, then we have to assure
00791              * consistency between YY_CURRENT_BUFFER and our
00792              * globals.  Here is the right place to do so, because
00793              * this is the first action (other than possibly a
00794              * back-up) that will match for the new input source.
00795              */
00796             (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
00797             YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
00798             YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
00799             }
00800 
00801         /* Note that here we test for yy_c_buf_p "<=" to the position
00802          * of the first EOB in the buffer, since yy_c_buf_p will
00803          * already have been incremented past the NUL character
00804          * (since all states make transitions on EOB to the
00805          * end-of-buffer state).  Contrast this with the test
00806          * in input().
00807          */
00808         if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
00809             { /* This was really a NUL. */
00810             yy_state_type yy_next_state;
00811 
00812             (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
00813 
00814             yy_current_state = yy_get_previous_state(  );
00815 
00816             /* Okay, we're now positioned to make the NUL
00817              * transition.  We couldn't have
00818              * yy_get_previous_state() go ahead and do it
00819              * for us because it doesn't know how to deal
00820              * with the possibility of jamming (and we don't
00821              * want to build jamming into it because then it
00822              * will run more slowly).
00823              */
00824 
00825             yy_next_state = yy_try_NUL_trans( yy_current_state );
00826 
00827             yy_bp = (yytext_ptr) + YY_MORE_ADJ;
00828 
00829             if ( yy_next_state )
00830                 {
00831                 /* Consume the NUL. */
00832                 yy_cp = ++(yy_c_buf_p);
00833                 yy_current_state = yy_next_state;
00834                 goto yy_match;
00835                 }
00836 
00837             else
00838                 {
00839                 yy_cp = (yy_c_buf_p);
00840                 goto yy_find_action;
00841                 }
00842             }
00843 
00844         else switch ( yy_get_next_buffer(  ) )
00845             {
00846             case EOB_ACT_END_OF_FILE:
00847                 {
00848                 (yy_did_buffer_switch_on_eof) = 0;
00849 
00850                 if ( yywrap( ) )
00851                     {
00852                     /* Note: because we've taken care in
00853                      * yy_get_next_buffer() to have set up
00854                      * yytext, we can now set up
00855                      * yy_c_buf_p so that if some total
00856                      * hoser (like flex itself) wants to
00857                      * call the scanner after we return the
00858                      * YY_NULL, it'll still work - another
00859                      * YY_NULL will get returned.
00860                      */
00861                     (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
00862 
00863                     yy_act = YY_STATE_EOF(YY_START);
00864                     goto do_action;
00865                     }
00866 
00867                 else
00868                     {
00869                     if ( ! (yy_did_buffer_switch_on_eof) )
00870                         YY_NEW_FILE;
00871                     }
00872                 break;
00873                 }
00874 
00875             case EOB_ACT_CONTINUE_SCAN:
00876                 (yy_c_buf_p) =
00877                     (yytext_ptr) + yy_amount_of_matched_text;
00878 
00879                 yy_current_state = yy_get_previous_state(  );
00880 
00881                 yy_cp = (yy_c_buf_p);
00882                 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
00883                 goto yy_match;
00884 
00885             case EOB_ACT_LAST_MATCH:
00886                 (yy_c_buf_p) =
00887                 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
00888 
00889                 yy_current_state = yy_get_previous_state(  );
00890 
00891                 yy_cp = (yy_c_buf_p);
00892                 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
00893                 goto yy_find_action;
00894             }
00895         break;
00896         }
00897 
00898     default:
00899         YY_FATAL_ERROR(
00900             "fatal flex scanner internal error--no action found" );
00901     } /* end of action switch */
00902         } /* end of scanning one token */
00903 } /* end of yylex */
00904 
00905 /* yy_get_next_buffer - try to read in a new buffer
00906  *
00907  * Returns a code representing an action:
00908  *  EOB_ACT_LAST_MATCH -
00909  *  EOB_ACT_CONTINUE_SCAN - continue scanning from current position
00910  *  EOB_ACT_END_OF_FILE - end of file
00911  */
00912 static int yy_get_next_buffer (void)
00913 {
00914         register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
00915     register char *source = (yytext_ptr);
00916     register int number_to_move, i;
00917     int ret_val;
00918 
00919     if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
00920         YY_FATAL_ERROR(
00921         "fatal flex scanner internal error--end of buffer missed" );
00922 
00923     if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
00924         { /* Don't try to fill the buffer, so this is an EOF. */
00925         if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
00926             {
00927             /* We matched a single character, the EOB, so
00928              * treat this as a final EOF.
00929              */
00930             return EOB_ACT_END_OF_FILE;
00931             }
00932 
00933         else
00934             {
00935             /* We matched some text prior to the EOB, first
00936              * process it.
00937              */
00938             return EOB_ACT_LAST_MATCH;
00939             }
00940         }
00941 
00942     /* Try to read more data. */
00943 
00944     /* First move last chars to start of buffer. */
00945     number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
00946 
00947     for ( i = 0; i < number_to_move; ++i )
00948         *(dest++) = *(source++);
00949 
00950     if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
00951         /* don't do the read, it's not guaranteed to return an EOF,
00952          * just force an EOF
00953          */
00954         YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
00955 
00956     else
00957         {
00958             int num_to_read =
00959             YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
00960 
00961         while ( num_to_read <= 0 )
00962             { /* Not enough room in the buffer - grow it. */
00963 
00964             /* just a shorter name for the current buffer */
00965             YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
00966 
00967             int yy_c_buf_p_offset =
00968                 (int) ((yy_c_buf_p) - b->yy_ch_buf);
00969 
00970             if ( b->yy_is_our_buffer )
00971                 {
00972                 int new_size = b->yy_buf_size * 2;
00973 
00974                 if ( new_size <= 0 )
00975                     b->yy_buf_size += b->yy_buf_size / 8;
00976                 else
00977                     b->yy_buf_size *= 2;
00978 
00979                 b->yy_ch_buf = (char *)
00980                     /* Include room in for 2 EOB chars. */
00981                     yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
00982                 }
00983             else
00984                 /* Can't grow it, we don't own it. */
00985                 b->yy_ch_buf = 0;
00986 
00987             if ( ! b->yy_ch_buf )
00988                 YY_FATAL_ERROR(
00989                 "fatal error - scanner input buffer overflow" );
00990 
00991             (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
00992 
00993             num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
00994                         number_to_move - 1;
00995 
00996             }
00997 
00998         if ( num_to_read > YY_READ_BUF_SIZE )
00999             num_to_read = YY_READ_BUF_SIZE;
01000 
01001         /* Read in more data. */
01002         YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
01003             (yy_n_chars), (size_t) num_to_read );
01004 
01005         YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
01006         }
01007 
01008     if ( (yy_n_chars) == 0 )
01009         {
01010         if ( number_to_move == YY_MORE_ADJ )
01011             {
01012             ret_val = EOB_ACT_END_OF_FILE;
01013             yyrestart(yyin  );
01014             }
01015 
01016         else
01017             {
01018             ret_val = EOB_ACT_LAST_MATCH;
01019             YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
01020                 YY_BUFFER_EOF_PENDING;
01021             }
01022         }
01023 
01024     else
01025         ret_val = EOB_ACT_CONTINUE_SCAN;
01026 
01027     (yy_n_chars) += number_to_move;
01028     YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
01029     YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
01030 
01031     (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
01032 
01033     return ret_val;
01034 }
01035 
01036 /* yy_get_previous_state - get the state just before the EOB char was reached */
01037 
01038     static yy_state_type yy_get_previous_state (void)
01039 {
01040     register yy_state_type yy_current_state;
01041     register char *yy_cp;
01042     
01043     yy_current_state = (yy_start);
01044 
01045     for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
01046         {
01047         register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
01048         if ( yy_accept[yy_current_state] )
01049             {
01050             (yy_last_accepting_state) = yy_current_state;
01051             (yy_last_accepting_cpos) = yy_cp;
01052             }
01053         while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
01054             {
01055             yy_current_state = (int) yy_def[yy_current_state];
01056             if ( yy_current_state >= 17 )
01057                 yy_c = yy_meta[(unsigned int) yy_c];
01058             }
01059         yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
01060         }
01061 
01062     return yy_current_state;
01063 }
01064 
01065 /* yy_try_NUL_trans - try to make a transition on the NUL character
01066  *
01067  * synopsis
01068  *  next_state = yy_try_NUL_trans( current_state );
01069  */
01070     static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
01071 {
01072     register int yy_is_jam;
01073         register char *yy_cp = (yy_c_buf_p);
01074 
01075     register YY_CHAR yy_c = 1;
01076     if ( yy_accept[yy_current_state] )
01077         {
01078         (yy_last_accepting_state) = yy_current_state;
01079         (yy_last_accepting_cpos) = yy_cp;
01080         }
01081     while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
01082         {
01083         yy_current_state = (int) yy_def[yy_current_state];
01084         if ( yy_current_state >= 17 )
01085             yy_c = yy_meta[(unsigned int) yy_c];
01086         }
01087     yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
01088     yy_is_jam = (yy_current_state == 16);
01089 
01090     return yy_is_jam ? 0 : yy_current_state;
01091 }
01092 
01093 #ifndef YY_NO_INPUT
01094 #ifdef __cplusplus
01095     static int yyinput (void)
01096 #else
01097     static int input  (void)
01098 #endif
01099 
01100 {
01101     int c;
01102     
01103     *(yy_c_buf_p) = (yy_hold_char);
01104 
01105     if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
01106         {
01107         /* yy_c_buf_p now points to the character we want to return.
01108          * If this occurs *before* the EOB characters, then it's a
01109          * valid NUL; if not, then we've hit the end of the buffer.
01110          */
01111         if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
01112             /* This was really a NUL. */
01113             *(yy_c_buf_p) = '\0';
01114 
01115         else
01116             { /* need more input */
01117             int offset = (yy_c_buf_p) - (yytext_ptr);
01118             ++(yy_c_buf_p);
01119 
01120             switch ( yy_get_next_buffer(  ) )
01121                 {
01122                 case EOB_ACT_LAST_MATCH:
01123                     /* This happens because yy_g_n_b()
01124                      * sees that we've accumulated a
01125                      * token and flags that we need to
01126                      * try matching the token before
01127                      * proceeding.  But for input(),
01128                      * there's no matching to consider.
01129                      * So convert the EOB_ACT_LAST_MATCH
01130                      * to EOB_ACT_END_OF_FILE.
01131                      */
01132 
01133                     /* Reset buffer status. */
01134                     yyrestart(yyin );
01135 
01136                     /*FALLTHROUGH*/
01137 
01138                 case EOB_ACT_END_OF_FILE:
01139                     {
01140                     if ( yywrap( ) )
01141                         return EOF;
01142 
01143                     if ( ! (yy_did_buffer_switch_on_eof) )
01144                         YY_NEW_FILE;
01145 #ifdef __cplusplus
01146                     return yyinput();
01147 #else
01148                     return input();
01149 #endif
01150                     }
01151 
01152                 case EOB_ACT_CONTINUE_SCAN:
01153                     (yy_c_buf_p) = (yytext_ptr) + offset;
01154                     break;
01155                 }
01156             }
01157         }
01158 
01159     c = *(unsigned char *) (yy_c_buf_p);    /* cast for 8-bit char's */
01160     *(yy_c_buf_p) = '\0';   /* preserve yytext */
01161     (yy_hold_char) = *++(yy_c_buf_p);
01162 
01163     return c;
01164 }
01165 #endif  /* ifndef YY_NO_INPUT */
01166 
01172     void yyrestart  (FILE * input_file )
01173 {
01174     
01175     if ( ! YY_CURRENT_BUFFER ){
01176         yyensure_buffer_stack ();
01177         YY_CURRENT_BUFFER_LVALUE =
01178             yy_create_buffer(yyin,YY_BUF_SIZE );
01179     }
01180 
01181     yy_init_buffer(YY_CURRENT_BUFFER,input_file );
01182     yy_load_buffer_state( );
01183 }
01184 
01189     void yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer )
01190 {
01191     
01192     /* TODO. We should be able to replace this entire function body
01193      * with
01194      *      yypop_buffer_state();
01195      *      yypush_buffer_state(new_buffer);
01196      */
01197     yyensure_buffer_stack ();
01198     if ( YY_CURRENT_BUFFER == new_buffer )
01199         return;
01200 
01201     if ( YY_CURRENT_BUFFER )
01202         {
01203         /* Flush out information for old buffer. */
01204         *(yy_c_buf_p) = (yy_hold_char);
01205         YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
01206         YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
01207         }
01208 
01209     YY_CURRENT_BUFFER_LVALUE = new_buffer;
01210     yy_load_buffer_state( );
01211 
01212     /* We don't actually know whether we did this switch during
01213      * EOF (yywrap()) processing, but the only time this flag
01214      * is looked at is after yywrap() is called, so it's safe
01215      * to go ahead and always set it.
01216      */
01217     (yy_did_buffer_switch_on_eof) = 1;
01218 }
01219 
01220 static void yy_load_buffer_state  (void)
01221 {
01222         (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
01223     (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
01224     yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
01225     (yy_hold_char) = *(yy_c_buf_p);
01226 }
01227 
01234     YY_BUFFER_STATE yy_create_buffer  (FILE * file, int  size )
01235 {
01236     YY_BUFFER_STATE b;
01237     
01238     b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state )  );
01239     if ( ! b )
01240         YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
01241 
01242     b->yy_buf_size = size;
01243 
01244     /* yy_ch_buf has to be 2 characters longer than the size given because
01245      * we need to put in 2 end-of-buffer characters.
01246      */
01247     b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2  );
01248     if ( ! b->yy_ch_buf )
01249         YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
01250 
01251     b->yy_is_our_buffer = 1;
01252 
01253     yy_init_buffer(b,file );
01254 
01255     return b;
01256 }
01257 
01262     void yy_delete_buffer (YY_BUFFER_STATE  b )
01263 {
01264     
01265     if ( ! b )
01266         return;
01267 
01268     if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
01269         YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
01270 
01271     if ( b->yy_is_our_buffer )
01272         yyfree((void *) b->yy_ch_buf  );
01273 
01274     yyfree((void *) b  );
01275 }
01276 
01277 #ifndef __cplusplus
01278 extern int isatty (int );
01279 #endif /* __cplusplus */
01280     
01281 /* Initializes or reinitializes a buffer.
01282  * This function is sometimes called more than once on the same buffer,
01283  * such as during a yyrestart() or at EOF.
01284  */
01285     static void yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file )
01286 
01287 {
01288     int oerrno = errno;
01289     
01290     yy_flush_buffer(b );
01291 
01292     b->yy_input_file = file;
01293     b->yy_fill_buffer = 1;
01294 
01295     /* If b is the current buffer, then yy_init_buffer was _probably_
01296      * called from yyrestart() or through yy_get_next_buffer.
01297      * In that case, we don't want to reset the lineno or column.
01298      */
01299     if (b != YY_CURRENT_BUFFER){
01300         b->yy_bs_lineno = 1;
01301         b->yy_bs_column = 0;
01302     }
01303 
01304         b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
01305     
01306     errno = oerrno;
01307 }
01308 
01313     void yy_flush_buffer (YY_BUFFER_STATE  b )
01314 {
01315         if ( ! b )
01316         return;
01317 
01318     b->yy_n_chars = 0;
01319 
01320     /* We always need two end-of-buffer characters.  The first causes
01321      * a transition to the end-of-buffer state.  The second causes
01322      * a jam in that state.
01323      */
01324     b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
01325     b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
01326 
01327     b->yy_buf_pos = &b->yy_ch_buf[0];
01328 
01329     b->yy_at_bol = 1;
01330     b->yy_buffer_status = YY_BUFFER_NEW;
01331 
01332     if ( b == YY_CURRENT_BUFFER )
01333         yy_load_buffer_state( );
01334 }
01335 
01342 void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
01343 {
01344         if (new_buffer == NULL)
01345         return;
01346 
01347     yyensure_buffer_stack();
01348 
01349     /* This block is copied from yy_switch_to_buffer. */
01350     if ( YY_CURRENT_BUFFER )
01351         {
01352         /* Flush out information for old buffer. */
01353         *(yy_c_buf_p) = (yy_hold_char);
01354         YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
01355         YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
01356         }
01357 
01358     /* Only push if top exists. Otherwise, replace top. */
01359     if (YY_CURRENT_BUFFER)
01360         (yy_buffer_stack_top)++;
01361     YY_CURRENT_BUFFER_LVALUE = new_buffer;
01362 
01363     /* copied from yy_switch_to_buffer. */
01364     yy_load_buffer_state( );
01365     (yy_did_buffer_switch_on_eof) = 1;
01366 }
01367 
01372 void yypop_buffer_state (void)
01373 {
01374         if (!YY_CURRENT_BUFFER)
01375         return;
01376 
01377     yy_delete_buffer(YY_CURRENT_BUFFER );
01378     YY_CURRENT_BUFFER_LVALUE = NULL;
01379     if ((yy_buffer_stack_top) > 0)
01380         --(yy_buffer_stack_top);
01381 
01382     if (YY_CURRENT_BUFFER) {
01383         yy_load_buffer_state( );
01384         (yy_did_buffer_switch_on_eof) = 1;
01385     }
01386 }
01387 
01388 /* Allocates the stack if it does not exist.
01389  *  Guarantees space for at least one push.
01390  */
01391 static void yyensure_buffer_stack (void)
01392 {
01393     int num_to_alloc;
01394     
01395     if (!(yy_buffer_stack)) {
01396 
01397         /* First allocation is just for 2 elements, since we don't know if this
01398          * scanner will even need a stack. We use 2 instead of 1 to avoid an
01399          * immediate realloc on the next call.
01400          */
01401         num_to_alloc = 1;
01402         (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
01403                                 (num_to_alloc * sizeof(struct yy_buffer_state*)
01404                                 );
01405         
01406         memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
01407                 
01408         (yy_buffer_stack_max) = num_to_alloc;
01409         (yy_buffer_stack_top) = 0;
01410         return;
01411     }
01412 
01413     if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
01414 
01415         /* Increase the buffer to prepare for a possible push. */
01416         int grow_size = 8 /* arbitrary grow size */;
01417 
01418         num_to_alloc = (yy_buffer_stack_max) + grow_size;
01419         (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
01420                                 ((yy_buffer_stack),
01421                                 num_to_alloc * sizeof(struct yy_buffer_state*)
01422                                 );
01423 
01424         /* zero only the new slots.*/
01425         memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
01426         (yy_buffer_stack_max) = num_to_alloc;
01427     }
01428 }
01429 
01436 YY_BUFFER_STATE yy_scan_buffer  (char * base, yy_size_t  size )
01437 {
01438     YY_BUFFER_STATE b;
01439     
01440     if ( size < 2 ||
01441          base[size-2] != YY_END_OF_BUFFER_CHAR ||
01442          base[size-1] != YY_END_OF_BUFFER_CHAR )
01443         /* They forgot to leave room for the EOB's. */
01444         return 0;
01445 
01446     b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state )  );
01447     if ( ! b )
01448         YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
01449 
01450     b->yy_buf_size = size - 2;  /* "- 2" to take care of EOB's */
01451     b->yy_buf_pos = b->yy_ch_buf = base;
01452     b->yy_is_our_buffer = 0;
01453     b->yy_input_file = 0;
01454     b->yy_n_chars = b->yy_buf_size;
01455     b->yy_is_interactive = 0;
01456     b->yy_at_bol = 1;
01457     b->yy_fill_buffer = 0;
01458     b->yy_buffer_status = YY_BUFFER_NEW;
01459 
01460     yy_switch_to_buffer(b  );
01461 
01462     return b;
01463 }
01464 
01473 YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
01474 {
01475     
01476     return yy_scan_bytes(yystr,strlen(yystr) );
01477 }
01478 
01486 YY_BUFFER_STATE yy_scan_bytes  (yyconst char * yybytes, int  _yybytes_len )
01487 {
01488     YY_BUFFER_STATE b;
01489     char *buf;
01490     yy_size_t n;
01491     int i;
01492     
01493     /* Get memory for full buffer, including space for trailing EOB's. */
01494     n = _yybytes_len + 2;
01495     buf = (char *) yyalloc(n  );
01496     if ( ! buf )
01497         YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
01498 
01499     for ( i = 0; i < _yybytes_len; ++i )
01500         buf[i] = yybytes[i];
01501 
01502     buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
01503 
01504     b = yy_scan_buffer(buf,n );
01505     if ( ! b )
01506         YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
01507 
01508     /* It's okay to grow etc. this buffer, and we should throw it
01509      * away when we're done.
01510      */
01511     b->yy_is_our_buffer = 1;
01512 
01513     return b;
01514 }
01515 
01516 #ifndef YY_EXIT_FAILURE
01517 #define YY_EXIT_FAILURE 2
01518 #endif
01519 
01520 static void yy_fatal_error (yyconst char* msg )
01521 {
01522         (void) fprintf( stderr, "%s\n", msg );
01523     exit( YY_EXIT_FAILURE );
01524 }
01525 
01526 /* Redefine yyless() so it works in section 3 code. */
01527 
01528 #undef yyless
01529 #define yyless(n) \
01530     do \
01531         { \
01532         /* Undo effects of setting up yytext. */ \
01533         int yyless_macro_arg = (n); \
01534         YY_LESS_LINENO(yyless_macro_arg);\
01535         yytext[yyleng] = (yy_hold_char); \
01536         (yy_c_buf_p) = yytext + yyless_macro_arg; \
01537         (yy_hold_char) = *(yy_c_buf_p); \
01538         *(yy_c_buf_p) = '\0'; \
01539         yyleng = yyless_macro_arg; \
01540         } \
01541     while ( 0 )
01542 
01543 /* Accessor  methods (get/set functions) to struct members. */
01544 
01548 int yyget_lineno  (void)
01549 {
01550         
01551     return yylineno;
01552 }
01553 
01557 FILE *yyget_in  (void)
01558 {
01559         return yyin;
01560 }
01561 
01565 FILE *yyget_out  (void)
01566 {
01567         return yyout;
01568 }
01569 
01573 int yyget_leng  (void)
01574 {
01575         return yyleng;
01576 }
01577 
01582 char *yyget_text  (void)
01583 {
01584         return yytext;
01585 }
01586 
01591 void yyset_lineno (int  line_number )
01592 {
01593     
01594     yylineno = line_number;
01595 }
01596 
01603 void yyset_in (FILE *  in_str )
01604 {
01605         yyin = in_str ;
01606 }
01607 
01608 void yyset_out (FILE *  out_str )
01609 {
01610         yyout = out_str ;
01611 }
01612 
01613 int yyget_debug  (void)
01614 {
01615         return yy_flex_debug;
01616 }
01617 
01618 void yyset_debug (int  bdebug )
01619 {
01620         yy_flex_debug = bdebug ;
01621 }
01622 
01623 static int yy_init_globals (void)
01624 {
01625         /* Initialization is the same as for the non-reentrant scanner.
01626      * This function is called from yylex_destroy(), so don't allocate here.
01627      */
01628 
01629     (yy_buffer_stack) = 0;
01630     (yy_buffer_stack_top) = 0;
01631     (yy_buffer_stack_max) = 0;
01632     (yy_c_buf_p) = (char *) 0;
01633     (yy_init) = 0;
01634     (yy_start) = 0;
01635 
01636 /* Defined in main.c */
01637 #ifdef YY_STDINIT
01638     yyin = stdin;
01639     yyout = stdout;
01640 #else
01641     yyin = (FILE *) 0;
01642     yyout = (FILE *) 0;
01643 #endif
01644 
01645     /* For future reference: Set errno on error, since we are called by
01646      * yylex_init()
01647      */
01648     return 0;
01649 }
01650 
01651 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
01652 int yylex_destroy  (void)
01653 {
01654     
01655     /* Pop the buffer stack, destroying each element. */
01656     while(YY_CURRENT_BUFFER){
01657         yy_delete_buffer(YY_CURRENT_BUFFER  );
01658         YY_CURRENT_BUFFER_LVALUE = NULL;
01659         yypop_buffer_state();
01660     }
01661 
01662     /* Destroy the stack itself. */
01663     yyfree((yy_buffer_stack) );
01664     (yy_buffer_stack) = NULL;
01665 
01666     /* Reset the globals. This is important in a non-reentrant scanner so the next time
01667      * yylex() is called, initialization will occur. */
01668     yy_init_globals( );
01669 
01670     return 0;
01671 }
01672 
01673 /*
01674  * Internal utility routines.
01675  */
01676 
01677 #ifndef yytext_ptr
01678 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
01679 {
01680     register int i;
01681     for ( i = 0; i < n; ++i )
01682         s1[i] = s2[i];
01683 }
01684 #endif
01685 
01686 #ifdef YY_NEED_STRLEN
01687 static int yy_flex_strlen (yyconst char * s )
01688 {
01689     register int n;
01690     for ( n = 0; s[n]; ++n )
01691         ;
01692 
01693     return n;
01694 }
01695 #endif
01696 
01697 void *yyalloc (yy_size_t  size )
01698 {
01699     return (void *) malloc( size );
01700 }
01701 
01702 void *yyrealloc  (void * ptr, yy_size_t  size )
01703 {
01704     /* The cast to (char *) in the following accommodates both
01705      * implementations that use char* generic pointers, and those
01706      * that use void* generic pointers.  It works with the latter
01707      * because both ANSI C and C++ allow castless assignment from
01708      * any pointer type to void*, and deal with argument conversions
01709      * as though doing an assignment.
01710      */
01711     return (void *) realloc( (char *) ptr, size );
01712 }
01713 
01714 void yyfree (void * ptr )
01715 {
01716     free( (char *) ptr );   /* see yyrealloc() for (char *) cast */
01717 }
01718 
01719 #define YYTABLES_NAME "yytables"
01720 
01721 #line 47 "configfile.l"
01722 
01723 
01724 
01725 #include <stdio.h>
01726 #include <string.h>
01727 #include <errno.h>
01728 
01729 #include "misc.h"
01730 #include "pcsclite.h"
01731 #include "debuglog.h"
01732 #include "config.h"
01733 #include "sys_generic.h"
01734 #include "readerfactory.h"
01735 
01736 int evaluatetoken(char *pcToken)
01737 {
01738 
01739     DWORD dwChannelId = 0;
01740     int p = 0;
01741     unsigned int n = 0;
01742 
01743     if (pcPrevious == NULL)
01744     {                           /* This is the key */
01745         pcPrevious = strdup(pcToken);
01746     }
01747     else
01748     {
01749         pcCurrent = pcToken;
01750         if (strcmp(pcPrevious, "FRIENDLYNAME") == 0)
01751         {
01752             if (pcFriendlyname == NULL)
01753             {
01754                 pcFriendlyname = malloc(strlen(pcCurrent) - 1);
01755                 for (n = 0; n < strlen(pcCurrent); n++)
01756                 {
01757                     if (pcCurrent[n] != '"')
01758                     {           /* Strip off the quotes */
01759                         pcFriendlyname[p++] = pcCurrent[n];
01760                     }
01761                 }
01762                 pcFriendlyname[p++] = '\0';
01763             }
01764             else
01765             {
01766                 tok_error(pcPrevious);
01767                 return 1;
01768             }
01769         }
01770         else if (strcmp(pcPrevious, "DEVICENAME") == 0)
01771         {
01772             if (pcDevicename == NULL)
01773             {
01774                 struct stat fStatBuf;
01775 
01776                 pcDevicename = strdup(pcCurrent);
01777                 if ((NULL == strchr(pcDevicename, ':'))
01778                     && (SYS_Stat(pcDevicename, &fStatBuf) != 0))
01779                 {
01780                     Log3(PCSC_LOG_CRITICAL, "Error with device %s: %s",
01781                         pcDevicename, strerror(errno));
01782                     Log1(PCSC_LOG_CRITICAL, "You should use 'DEVICENAME /dev/null' if your driver does not use this field");
01783                     badError = 1;
01784                 }
01785             }
01786             else
01787             {
01788                 tok_error(pcPrevious);
01789                 return 1;
01790             }
01791         }
01792         else if (strcmp(pcPrevious, "LIBPATH") == 0)
01793         {
01794             if (pcLibpath == NULL)
01795             {
01796                 struct stat fStatBuf;
01797 
01798                 pcLibpath = strdup(pcCurrent);
01799                 if (SYS_Stat(pcLibpath, &fStatBuf) != 0)
01800                 {
01801                     Log3(PCSC_LOG_CRITICAL, "Error with library %s: %s",
01802                         pcLibpath, strerror(errno));
01803                     badError = 1;
01804                 }
01805 
01806                 if (strstr(pcLibpath, ".bundle") != NULL)
01807                 {
01808                     Log1(PCSC_LOG_ERROR, "WARNING *************************************");
01809                     Log2(PCSC_LOG_ERROR, "WARNING: USB drivers SHOULD NOT be declared in reader.conf: %s", pcLibpath);
01810                     Log1(PCSC_LOG_ERROR, "WARNING *************************************");
01811                 }
01812             }
01813             else
01814             {
01815                 tok_error(pcPrevious);
01816                 return 1;
01817             }
01818         }
01819         else if (strcmp(pcPrevious, "CHANNELID") == 0)
01820         {
01821             if (pcChannelid == NULL)
01822                 pcChannelid = strdup(pcCurrent);
01823             else
01824             {
01825                 tok_error(pcPrevious);
01826                 return 1;
01827             }
01828         }
01829         else
01830         {
01831             tok_error(pcPrevious);
01832             return 1;
01833         }
01834 
01835         free(pcPrevious);
01836         pcPrevious = NULL;
01837     }
01838 
01839     if (pcFriendlyname != NULL && pcDevicename != NULL &&
01840         pcLibpath != NULL && pcChannelid != NULL && badError != 1)
01841     {
01842         if (0 == reader_list_size)
01843         {
01844             /* one real reader and one end marker */
01845             reader_list_size = 2;
01846             reader_list = malloc(reader_list_size * sizeof(SerialReader));
01847         }
01848         else
01849         {
01850             reader_list_size++;
01851             reader_list = realloc(reader_list, reader_list_size *
01852                 sizeof(SerialReader));
01853         }
01854 
01855         /* end marker */
01856         reader_list[reader_list_size-1].pcFriendlyname = NULL;
01857 
01858         dwChannelId = strtoul(pcChannelid, 0, 16);
01859         reader_list[reader_list_size-2].pcFriendlyname = strdup(pcFriendlyname);
01860         reader_list[reader_list_size-2].pcDevicename = strdup(pcDevicename);
01861         reader_list[reader_list_size-2].pcLibpath = strdup(pcLibpath),
01862         reader_list[reader_list_size-2].dwChannelId = dwChannelId;
01863 
01864         pcFriendlyname = NULL;
01865         pcDevicename = NULL;
01866         pcLibpath = NULL;
01867         pcChannelid = NULL;
01868     }
01869 
01870     return 0;
01871 }
01872 
01873 void tok_error(char *token_error)
01874 {
01875     Log2(PCSC_LOG_ERROR, "tok_error: invalid value in reader.conf: %s",
01876         token_error);
01877     badError = 1;
01878 }
01879 
01880 int DBGetReaderList(const char *readerconf, SerialReader **caller_reader_list)
01881 {
01882     FILE *configFile = NULL;
01883 
01884     *caller_reader_list = NULL; /* no list by default */
01885 
01886     configFile = fopen(readerconf, "r");
01887 
01888     if (configFile == NULL)
01889         return 1;
01890 
01891     yyin = configFile;
01892 
01893     /* (re)start with a clean state */
01894     iLinenumber = 1;
01895     reader_list = NULL;
01896     reader_list_size = 0;
01897     pcFriendlyname = NULL;
01898     pcDevicename = NULL;
01899     pcLibpath = NULL;
01900     pcChannelid = NULL;
01901     pcPrevious = NULL;
01902     pcCurrent = NULL;
01903     badError = 0;
01904 
01905     do
01906     {
01907         yylex();
01908     }
01909     while (!feof(configFile));
01910 
01911     fclose(configFile);
01912 
01913     *caller_reader_list = reader_list;
01914 
01915     if (badError == 1)
01916         return -1;
01917     else
01918         return 0;
01919 }                               /* End of configfile.c */
01920 
01921 

Generated on Tue Apr 1 22:45:22 2008 for pcsc-lite by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002