1 2#line 3 "configfile.c" 3 4#define YY_INT_ALIGNED short int 5 6/* A lexical scanner generated by flex */ 7 8#define FLEX_SCANNER 9#define YY_FLEX_MAJOR_VERSION 2 10#define YY_FLEX_MINOR_VERSION 5 11#define YY_FLEX_SUBMINOR_VERSION 35 12#if YY_FLEX_SUBMINOR_VERSION > 0 13#define FLEX_BETA 14#endif 15 16/* First, we deal with platform-specific or compiler-specific issues. */ 17 18/* begin standard C headers. */ 19#include <stdio.h> 20#include <string.h> 21#include <errno.h> 22#include <stdlib.h> 23 24/* end standard C headers. */ 25 26/* flex integer type definitions */ 27 28#ifndef FLEXINT_H 29#define FLEXINT_H 30 31/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */ 32 33#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L 34 35/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h, 36 * if you want the limit (max/min) macros for int types. 37 */ 38#ifndef __STDC_LIMIT_MACROS 39#define __STDC_LIMIT_MACROS 1 40#endif 41 42#include <inttypes.h> 43typedef int8_t flex_int8_t; 44typedef uint8_t flex_uint8_t; 45typedef int16_t flex_int16_t; 46typedef uint16_t flex_uint16_t; 47typedef int32_t flex_int32_t; 48typedef uint32_t flex_uint32_t; 49#else 50typedef signed char flex_int8_t; 51typedef short int flex_int16_t; 52typedef int flex_int32_t; 53typedef unsigned char flex_uint8_t; 54typedef unsigned short int flex_uint16_t; 55typedef unsigned int flex_uint32_t; 56 57/* Limits of integral types. */ 58#ifndef INT8_MIN 59#define INT8_MIN (-128) 60#endif 61#ifndef INT16_MIN 62#define INT16_MIN (-32767-1) 63#endif 64#ifndef INT32_MIN 65#define INT32_MIN (-2147483647-1) 66#endif 67#ifndef INT8_MAX 68#define INT8_MAX (127) 69#endif 70#ifndef INT16_MAX 71#define INT16_MAX (32767) 72#endif 73#ifndef INT32_MAX 74#define INT32_MAX (2147483647) 75#endif 76#ifndef UINT8_MAX 77#define UINT8_MAX (255U) 78#endif 79#ifndef UINT16_MAX 80#define UINT16_MAX (65535U) 81#endif 82#ifndef UINT32_MAX 83#define UINT32_MAX (4294967295U) 84#endif 85 86#endif /* ! C99 */ 87 88#endif /* ! FLEXINT_H */ 89 90#ifdef __cplusplus 91 92/* The "const" storage-class-modifier is valid. */ 93#define YY_USE_CONST 94 95#else /* ! __cplusplus */ 96 97/* C99 requires __STDC__ to be defined as 1. */ 98#if defined (__STDC__) 99 100#define YY_USE_CONST 101 102#endif /* defined (__STDC__) */ 103#endif /* ! __cplusplus */ 104 105#ifdef YY_USE_CONST 106#define yyconst const 107#else 108#define yyconst 109#endif 110 111/* Returned upon end-of-file. */ 112#define YY_NULL 0 113 114/* Promotes a possibly negative, possibly signed char to an unsigned 115 * integer for use as an array index. If the signed char is negative, 116 * we want to instead treat it as an 8-bit unsigned char, hence the 117 * double cast. 118 */ 119#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) 120 121/* Enter a start condition. This macro really ought to take a parameter, 122 * but we do it the disgusting crufty way forced on us by the ()-less 123 * definition of BEGIN. 124 */ 125#define BEGIN (yy_start) = 1 + 2 * 126 127/* Translate the current start state into a value that can be later handed 128 * to BEGIN to return to the state. The YYSTATE alias is for lex 129 * compatibility. 130 */ 131#define YY_START (((yy_start) - 1) / 2) 132#define YYSTATE YY_START 133 134/* Action number for EOF rule of a given start state. */ 135#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) 136 137/* Special action meaning "start processing a new file". */ 138#define YY_NEW_FILE yyrestart(yyin ) 139 140#define YY_END_OF_BUFFER_CHAR 0 141 142/* Size of default input buffer. */ 143#ifndef YY_BUF_SIZE 144#ifdef __ia64__ 145/* On IA-64, the buffer size is 16k, not 8k. 146 * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. 147 * Ditto for the __ia64__ case accordingly. 148 */ 149#define YY_BUF_SIZE 32768 150#else 151#define YY_BUF_SIZE 16384 152#endif /* __ia64__ */ 153#endif 154 155/* The state buf must be large enough to hold one state per character in the main buffer. 156 */ 157#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type)) 158 159#ifndef YY_TYPEDEF_YY_BUFFER_STATE 160#define YY_TYPEDEF_YY_BUFFER_STATE 161typedef struct yy_buffer_state *YY_BUFFER_STATE; 162#endif 163 164extern int yyleng; 165 166extern FILE *yyin, *yyout; 167 168#define EOB_ACT_CONTINUE_SCAN 0 169#define EOB_ACT_END_OF_FILE 1 170#define EOB_ACT_LAST_MATCH 2 171 172 #define YY_LESS_LINENO(n) 173 174/* Return all but the first "n" matched characters back to the input stream. */ 175#define yyless(n) \ 176 do \ 177 { \ 178 /* Undo effects of setting up yytext. */ \ 179 int yyless_macro_arg = (n); \ 180 YY_LESS_LINENO(yyless_macro_arg);\ 181 *yy_cp = (yy_hold_char); \ 182 YY_RESTORE_YY_MORE_OFFSET \ 183 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ 184 YY_DO_BEFORE_ACTION; /* set up yytext again */ \ 185 } \ 186 while ( 0 ) 187 188#define unput(c) yyunput( c, (yytext_ptr) ) 189 190#ifndef YY_TYPEDEF_YY_SIZE_T 191#define YY_TYPEDEF_YY_SIZE_T 192typedef size_t yy_size_t; 193#endif 194 195#ifndef YY_STRUCT_YY_BUFFER_STATE 196#define YY_STRUCT_YY_BUFFER_STATE 197struct yy_buffer_state 198 { 199 FILE *yy_input_file; 200 201 char *yy_ch_buf; /* input buffer */ 202 char *yy_buf_pos; /* current position in input buffer */ 203 204 /* Size of input buffer in bytes, not including room for EOB 205 * characters. 206 */ 207 yy_size_t yy_buf_size; 208 209 /* Number of characters read into yy_ch_buf, not including EOB 210 * characters. 211 */ 212 int yy_n_chars; 213 214 /* Whether we "own" the buffer - i.e., we know we created it, 215 * and can realloc() it to grow it, and should free() it to 216 * delete it. 217 */ 218 int yy_is_our_buffer; 219 220 /* Whether this is an "interactive" input source; if so, and 221 * if we're using stdio for input, then we want to use getc() 222 * instead of fread(), to make sure we stop fetching input after 223 * each newline. 224 */ 225 int yy_is_interactive; 226 227 /* Whether we're considered to be at the beginning of a line. 228 * If so, '^' rules will be active on the next match, otherwise 229 * not. 230 */ 231 int yy_at_bol; 232 233 int yy_bs_lineno; /**< The line count. */ 234 int yy_bs_column; /**< The column count. */ 235 236 /* Whether to try to fill the input buffer when we reach the 237 * end of it. 238 */ 239 int yy_fill_buffer; 240 241 int yy_buffer_status; 242 243#define YY_BUFFER_NEW 0 244#define YY_BUFFER_NORMAL 1 245 /* When an EOF's been seen but there's still some text to process 246 * then we mark the buffer as YY_EOF_PENDING, to indicate that we 247 * shouldn't try reading from the input source any more. We might 248 * still have a bunch of tokens to match, though, because of 249 * possible backing-up. 250 * 251 * When we actually see the EOF, we change the status to "new" 252 * (via yyrestart()), so that the user can continue scanning by 253 * just pointing yyin at a new input file. 254 */ 255#define YY_BUFFER_EOF_PENDING 2 256 257 }; 258#endif /* !YY_STRUCT_YY_BUFFER_STATE */ 259 260/* Stack of input buffers. */ 261static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ 262static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ 263static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ 264 265/* We provide macros for accessing buffer states in case in the 266 * future we want to put the buffer states in a more general 267 * "scanner state". 268 * 269 * Returns the top of the stack, or NULL. 270 */ 271#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ 272 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ 273 : NULL) 274 275/* Same as previous macro, but useful when we know that the buffer stack is not 276 * NULL or when we need an lvalue. For internal use only. 277 */ 278#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] 279 280/* yy_hold_char holds the character lost when yytext is formed. */ 281static char yy_hold_char; 282static int yy_n_chars; /* number of characters read into yy_ch_buf */ 283int yyleng; 284 285/* Points to current character in buffer. */ 286static char *yy_c_buf_p = (char *) 0; 287static int yy_init = 0; /* whether we need to initialize */ 288static int yy_start = 0; /* start state number */ 289 290/* Flag which is used to allow yywrap()'s to do buffer switches 291 * instead of setting up a fresh yyin. A bit of a hack ... 292 */ 293static int yy_did_buffer_switch_on_eof; 294 295void yyrestart (FILE *input_file ); 296void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); 297YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); 298void yy_delete_buffer (YY_BUFFER_STATE b ); 299void yy_flush_buffer (YY_BUFFER_STATE b ); 300void yypush_buffer_state (YY_BUFFER_STATE new_buffer ); 301void yypop_buffer_state (void ); 302 303static void yyensure_buffer_stack (void ); 304static void yy_load_buffer_state (void ); 305static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file ); 306 307#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER ) 308 309YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size ); 310YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str ); 311YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len ); 312 313void *yyalloc (yy_size_t ); 314void *yyrealloc (void *,yy_size_t ); 315void yyfree (void * ); 316 317#define yy_new_buffer yy_create_buffer 318 319#define yy_set_interactive(is_interactive) \ 320 { \ 321 if ( ! YY_CURRENT_BUFFER ){ \ 322 yyensure_buffer_stack (); \ 323 YY_CURRENT_BUFFER_LVALUE = \ 324 yy_create_buffer(yyin,YY_BUF_SIZE ); \ 325 } \ 326 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ 327 } 328 329#define yy_set_bol(at_bol) \ 330 { \ 331 if ( ! YY_CURRENT_BUFFER ){\ 332 yyensure_buffer_stack (); \ 333 YY_CURRENT_BUFFER_LVALUE = \ 334 yy_create_buffer(yyin,YY_BUF_SIZE ); \ 335 } \ 336 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ 337 } 338 339#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) 340 341/* Begin user sect3 */ 342 343#define yywrap(n) 1 344#define YY_SKIP_YYWRAP 345 346typedef unsigned char YY_CHAR; 347 348FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0; 349 350typedef int yy_state_type; 351 352extern int yylineno; 353 354int yylineno = 1; 355 356extern char *yytext; 357#define yytext_ptr yytext 358 359static yy_state_type yy_get_previous_state (void ); 360static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); 361static int yy_get_next_buffer (void ); 362static void yy_fatal_error (yyconst char msg[] ); 363 364/* Done after the current pattern has been matched and before the 365 * corresponding action - sets up yytext. 366 */ 367#define YY_DO_BEFORE_ACTION \ 368 (yytext_ptr) = yy_bp; \ 369 yyleng = (size_t) (yy_cp - yy_bp); \ 370 (yy_hold_char) = *yy_cp; \ 371 *yy_cp = '\0'; \ 372 (yy_c_buf_p) = yy_cp; 373 374#define YY_NUM_RULES 7 375#define YY_END_OF_BUFFER 8 376/* This struct is not used in this scanner, 377 but its presence is necessary. */ 378struct yy_trans_info 379 { 380 flex_int32_t yy_verify; 381 flex_int32_t yy_nxt; 382 }; 383static yyconst flex_int16_t yy_accept[17] = 384 { 0, 385 0, 0, 8, 6, 4, 2, 6, 1, 6, 5, 386 0, 3, 1, 0, 5, 0 387 } ; 388 389static yyconst flex_int32_t yy_ec[256] = 390 { 0, 391 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 392 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 393 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 394 1, 2, 1, 4, 5, 1, 1, 1, 6, 1, 395 1, 1, 1, 1, 7, 7, 7, 8, 8, 8, 396 8, 8, 8, 8, 8, 8, 8, 1, 1, 1, 397 1, 1, 1, 7, 9, 9, 9, 9, 9, 9, 398 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 399 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 400 1, 7, 1, 1, 7, 1, 10, 10, 10, 10, 401 402 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 403 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 404 10, 10, 1, 1, 1, 1, 1, 1, 1, 1, 405 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 406 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 407 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 408 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 409 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 410 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 411 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 412 413 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 414 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 415 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 416 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 417 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 418 1, 1, 1, 1, 1 419 } ; 420 421static yyconst flex_int32_t yy_meta[11] = 422 { 0, 423 1, 1, 2, 1, 1, 1, 1, 1, 1, 1 424 } ; 425 426static yyconst flex_int16_t yy_base[20] = 427 { 0, 428 0, 0, 15, 31, 31, 31, 8, 0, 10, 10, 429 18, 31, 0, 20, 0, 31, 26, 13, 28 430 } ; 431 432static yyconst flex_int16_t yy_def[20] = 433 { 0, 434 16, 1, 16, 16, 16, 16, 17, 18, 19, 16, 435 17, 16, 18, 19, 10, 0, 16, 16, 16 436 } ; 437 438static yyconst flex_int16_t yy_nxt[42] = 439 { 0, 440 4, 5, 6, 7, 8, 9, 10, 10, 10, 10, 441 12, 12, 12, 13, 16, 12, 15, 15, 15, 15, 442 12, 12, 12, 16, 16, 12, 11, 11, 14, 14, 443 3, 16, 16, 16, 16, 16, 16, 16, 16, 16, 444 16 445 } ; 446 447static yyconst flex_int16_t yy_chk[42] = 448 { 0, 449 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 450 7, 7, 9, 18, 3, 9, 10, 10, 10, 10, 451 11, 11, 14, 0, 0, 14, 17, 17, 19, 19, 452 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 453 16 454 } ; 455 456static yy_state_type yy_last_accepting_state; 457static char *yy_last_accepting_cpos; 458 459extern int yy_flex_debug; 460int yy_flex_debug = 0; 461 462/* The intent behind this definition is that it'll catch 463 * any uses of REJECT which flex missed. 464 */ 465#define REJECT reject_used_but_not_detected 466#define yymore() yymore_used_but_not_detected 467#define YY_MORE_ADJ 0 468#define YY_RESTORE_YY_MORE_OFFSET 469char *yytext; 470#line 1 "configfile.l" 471/***************************************************************** 472 473 File : configfile.ll 474 Author : David Corcoran 475 Date : February 12, 1999 modified 7/28/99 476 Purpose: Reads lexical config files and updates database. 477 See http://www.linuxnet.com for more information. 478 License: Copyright (C) 1999 David Corcoran 479 <corcoran@linuxnet.com> 480 481******************************************************************/ 482#line 14 "configfile.l" 483int evaluatetoken(char *pcToken); 484 485static int iLinenumber = 1; 486static char *pcPrevious = 0; 487static char *pcCurrent = 0; 488static char *pcFriendlyname = 0; 489static char *pcDevicename = 0; 490static char *pcLibpath = 0; 491static char *pcChannelid = 0; 492static int badError = 0; 493 494void tok_error(char *pcToken_error); 495 496#line 497 "configfile.c" 497 498#define INITIAL 0 499 500#ifndef YY_NO_UNISTD_H 501/* Special case for "unistd.h", since it is non-ANSI. We include it way 502 * down here because we want the user's section 1 to have been scanned first. 503 * The user has a chance to override it with an option. 504 */ 505#include <unistd.h> 506#endif 507 508#ifndef YY_EXTRA_TYPE 509#define YY_EXTRA_TYPE void * 510#endif 511 512static int yy_init_globals (void ); 513 514/* Accessor methods to globals. 515 These are made visible to non-reentrant scanners for convenience. */ 516 517int yylex_destroy (void ); 518 519int yyget_debug (void ); 520 521void yyset_debug (int debug_flag ); 522 523YY_EXTRA_TYPE yyget_extra (void ); 524 525void yyset_extra (YY_EXTRA_TYPE user_defined ); 526 527FILE *yyget_in (void ); 528 529void yyset_in (FILE * in_str ); 530 531FILE *yyget_out (void ); 532 533void yyset_out (FILE * out_str ); 534 535int yyget_leng (void ); 536 537char *yyget_text (void ); 538 539int yyget_lineno (void ); 540 541void yyset_lineno (int line_number ); 542 543/* Macros after this point can all be overridden by user definitions in 544 * section 1. 545 */ 546 547#ifndef YY_SKIP_YYWRAP 548#ifdef __cplusplus 549extern "C" int yywrap (void ); 550#else 551extern int yywrap (void ); 552#endif 553#endif 554 555#ifndef yytext_ptr 556static void yy_flex_strncpy (char *,yyconst char *,int ); 557#endif 558 559#ifdef YY_NEED_STRLEN 560static int yy_flex_strlen (yyconst char * ); 561#endif 562 563#ifndef YY_NO_INPUT 564 565#ifdef __cplusplus 566static int yyinput (void ); 567#else 568static int input (void ); 569#endif 570 571#endif 572 573/* Amount of stuff to slurp up with each read. */ 574#ifndef YY_READ_BUF_SIZE 575#ifdef __ia64__ 576/* On IA-64, the buffer size is 16k, not 8k */ 577#define YY_READ_BUF_SIZE 16384 578#else 579#define YY_READ_BUF_SIZE 8192 580#endif /* __ia64__ */ 581#endif 582 583/* Copy whatever the last rule matched to the standard output. */ 584#ifndef ECHO 585/* This used to be an fputs(), but since the string might contain NUL's, 586 * we now use fwrite(). 587 */ 588#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) 589#endif 590 591/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, 592 * is returned in "result". 593 */ 594#ifndef YY_INPUT 595#define YY_INPUT(buf,result,max_size) \ 596 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ 597 { \ 598 int c = '*'; \ 599 size_t n; \ 600 for ( n = 0; n < max_size && \ 601 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ 602 buf[n] = (char) c; \ 603 if ( c == '\n' ) \ 604 buf[n++] = (char) c; \ 605 if ( c == EOF && ferror( yyin ) ) \ 606 YY_FATAL_ERROR( "input in flex scanner failed" ); \ 607 result = n; \ 608 } \ 609 else \ 610 { \ 611 errno=0; \ 612 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \ 613 { \ 614 if( errno != EINTR) \ 615 { \ 616 YY_FATAL_ERROR( "input in flex scanner failed" ); \ 617 break; \ 618 } \ 619 errno=0; \ 620 clearerr(yyin); \ 621 } \ 622 }\ 623\ 624 625#endif 626 627/* No semi-colon after return; correct usage is to write "yyterminate();" - 628 * we don't want an extra ';' after the "return" because that will cause 629 * some compilers to complain about unreachable statements. 630 */ 631#ifndef yyterminate 632#define yyterminate() return YY_NULL 633#endif 634 635/* Number of entries by which start-condition stack grows. */ 636#ifndef YY_START_STACK_INCR 637#define YY_START_STACK_INCR 25 638#endif 639 640/* Report a fatal error. */ 641#ifndef YY_FATAL_ERROR 642#define YY_FATAL_ERROR(msg) yy_fatal_error( msg ) 643#endif 644 645/* end tables serialization structures and prototypes */ 646 647/* Default declaration of generated scanner - a define so the user can 648 * easily add parameters. 649 */ 650#ifndef YY_DECL 651#define YY_DECL_IS_OURS 1 652 653extern int yylex (void); 654 655#define YY_DECL int yylex (void) 656#endif /* !YY_DECL */ 657 658/* Code executed at the beginning of each rule, after yytext and yyleng 659 * have been set up. 660 */ 661#ifndef YY_USER_ACTION 662#define YY_USER_ACTION 663#endif 664 665/* Code executed at the end of each rule. */ 666#ifndef YY_BREAK 667#define YY_BREAK break; 668#endif 669 670#define YY_RULE_SETUP \ 671 YY_USER_ACTION 672 673/** The main scanner function which does all the work. 674 */ 675YY_DECL 676{ 677 register yy_state_type yy_current_state; 678 register char *yy_cp, *yy_bp; 679 register int yy_act; 680 681#line 32 "configfile.l" 682 683 684#line 685 "configfile.c" 685 686 if ( !(yy_init) ) 687 { 688 (yy_init) = 1; 689 690#ifdef YY_USER_INIT 691 YY_USER_INIT; 692#endif 693 694 if ( ! (yy_start) ) 695 (yy_start) = 1; /* first start state */ 696 697 if ( ! yyin ) 698 yyin = stdin; 699 700 if ( ! yyout ) 701 yyout = stdout; 702 703 if ( ! YY_CURRENT_BUFFER ) { 704 yyensure_buffer_stack (); 705 YY_CURRENT_BUFFER_LVALUE = 706 yy_create_buffer(yyin,YY_BUF_SIZE ); 707 } 708 709 yy_load_buffer_state( ); 710 } 711 712 while ( 1 ) /* loops until end-of-file is reached */ 713 { 714 yy_cp = (yy_c_buf_p); 715 716 /* Support of yytext. */ 717 *yy_cp = (yy_hold_char); 718 719 /* yy_bp points to the position in yy_ch_buf of the start of 720 * the current run. 721 */ 722 yy_bp = yy_cp; 723 724 yy_current_state = (yy_start); 725yy_match: 726 do 727 { 728 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)]; 729 if ( yy_accept[yy_current_state] ) 730 { 731 (yy_last_accepting_state) = yy_current_state; 732 (yy_last_accepting_cpos) = yy_cp; 733 } 734 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 735 { 736 yy_current_state = (int) yy_def[yy_current_state]; 737 if ( yy_current_state >= 17 ) 738 yy_c = yy_meta[(unsigned int) yy_c]; 739 } 740 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 741 ++yy_cp; 742 } 743 while ( yy_base[yy_current_state] != 31 ); 744 745yy_find_action: 746 yy_act = yy_accept[yy_current_state]; 747 if ( yy_act == 0 ) 748 { /* have to back up */ 749 yy_cp = (yy_last_accepting_cpos); 750 yy_current_state = (yy_last_accepting_state); 751 yy_act = yy_accept[yy_current_state]; 752 } 753 754 YY_DO_BEFORE_ACTION; 755 756do_action: /* This label is used only to access EOF actions. */ 757 758 switch ( yy_act ) 759 { /* beginning of action switch */ 760 case 0: /* must back up */ 761 /* undo the effects of YY_DO_BEFORE_ACTION */ 762 *yy_cp = (yy_hold_char); 763 yy_cp = (yy_last_accepting_cpos); 764 yy_current_state = (yy_last_accepting_state); 765 goto yy_find_action; 766 767case 1: 768YY_RULE_SETUP 769#line 34 "configfile.l" 770{} 771 YY_BREAK 772case 2: 773/* rule 2 can match eol */ 774YY_RULE_SETUP 775#line 35 "configfile.l" 776{ iLinenumber++; } 777 YY_BREAK 778case 3: 779/* rule 3 can match eol */ 780YY_RULE_SETUP 781#line 36 "configfile.l" 782{ (void)evaluatetoken(yytext); } 783 YY_BREAK 784case 4: 785YY_RULE_SETUP 786#line 37 "configfile.l" 787{} 788 YY_BREAK 789case 5: 790YY_RULE_SETUP 791#line 38 "configfile.l" 792{ (void)evaluatetoken(yytext); } 793 YY_BREAK 794case 6: 795YY_RULE_SETUP 796#line 39 "configfile.l" 797{ tok_error(yytext); } 798 YY_BREAK 799case 7: 800YY_RULE_SETUP 801#line 40 "configfile.l" 802ECHO; 803 YY_BREAK 804#line 805 "configfile.c" 805case YY_STATE_EOF(INITIAL): 806 yyterminate(); 807 808 case YY_END_OF_BUFFER: 809 { 810 /* Amount of text matched not including the EOB char. */ 811 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1; 812 813 /* Undo the effects of YY_DO_BEFORE_ACTION. */ 814 *yy_cp = (yy_hold_char); 815 YY_RESTORE_YY_MORE_OFFSET 816 817 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW ) 818 { 819 /* We're scanning a new file or input source. It's 820 * possible that this happened because the user 821 * just pointed yyin at a new source and called 822 * yylex(). If so, then we have to assure 823 * consistency between YY_CURRENT_BUFFER and our 824 * globals. Here is the right place to do so, because 825 * this is the first action (other than possibly a 826 * back-up) that will match for the new input source. 827 */ 828 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; 829 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; 830 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; 831 } 832 833 /* Note that here we test for yy_c_buf_p "<=" to the position 834 * of the first EOB in the buffer, since yy_c_buf_p will 835 * already have been incremented past the NUL character 836 * (since all states make transitions on EOB to the 837 * end-of-buffer state). Contrast this with the test 838 * in input(). 839 */ 840 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) 841 { /* This was really a NUL. */ 842 yy_state_type yy_next_state; 843 844 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text; 845 846 yy_current_state = yy_get_previous_state( ); 847 848 /* Okay, we're now positioned to make the NUL 849 * transition. We couldn't have 850 * yy_get_previous_state() go ahead and do it 851 * for us because it doesn't know how to deal 852 * with the possibility of jamming (and we don't 853 * want to build jamming into it because then it 854 * will run more slowly). 855 */ 856 857 yy_next_state = yy_try_NUL_trans( yy_current_state ); 858 859 yy_bp = (yytext_ptr) + YY_MORE_ADJ; 860 861 if ( yy_next_state ) 862 { 863 /* Consume the NUL. */ 864 yy_cp = ++(yy_c_buf_p); 865 yy_current_state = yy_next_state; 866 goto yy_match; 867 } 868 869 else 870 { 871 yy_cp = (yy_c_buf_p); 872 goto yy_find_action; 873 } 874 } 875 876 else switch ( yy_get_next_buffer( ) ) 877 { 878 case EOB_ACT_END_OF_FILE: 879 { 880 (yy_did_buffer_switch_on_eof) = 0; 881 882 if ( yywrap( ) ) 883 { 884 /* Note: because we've taken care in 885 * yy_get_next_buffer() to have set up 886 * yytext, we can now set up 887 * yy_c_buf_p so that if some total 888 * hoser (like flex itself) wants to 889 * call the scanner after we return the 890 * YY_NULL, it'll still work - another 891 * YY_NULL will get returned. 892 */ 893 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ; 894 895 yy_act = YY_STATE_EOF(YY_START); 896 goto do_action; 897 } 898 899 else 900 { 901 if ( ! (yy_did_buffer_switch_on_eof) ) 902 YY_NEW_FILE; 903 } 904 break; 905 } 906 907 case EOB_ACT_CONTINUE_SCAN: 908 (yy_c_buf_p) = 909 (yytext_ptr) + yy_amount_of_matched_text; 910 911 yy_current_state = yy_get_previous_state( ); 912 913 yy_cp = (yy_c_buf_p); 914 yy_bp = (yytext_ptr) + YY_MORE_ADJ; 915 goto yy_match; 916 917 case EOB_ACT_LAST_MATCH: 918 (yy_c_buf_p) = 919 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)]; 920 921 yy_current_state = yy_get_previous_state( ); 922 923 yy_cp = (yy_c_buf_p); 924 yy_bp = (yytext_ptr) + YY_MORE_ADJ; 925 goto yy_find_action; 926 } 927 break; 928 } 929 930 default: 931 YY_FATAL_ERROR( 932 "fatal flex scanner internal error--no action found" ); 933 } /* end of action switch */ 934 } /* end of scanning one token */ 935} /* end of yylex */ 936 937/* yy_get_next_buffer - try to read in a new buffer 938 * 939 * Returns a code representing an action: 940 * EOB_ACT_LAST_MATCH - 941 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position 942 * EOB_ACT_END_OF_FILE - end of file 943 */ 944static int yy_get_next_buffer (void) 945{ 946 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; 947 register char *source = (yytext_ptr); 948 register int number_to_move, i; 949 int ret_val; 950 951 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) 952 YY_FATAL_ERROR( 953 "fatal flex scanner internal error--end of buffer missed" ); 954 955 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) 956 { /* Don't try to fill the buffer, so this is an EOF. */ 957 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 ) 958 { 959 /* We matched a single character, the EOB, so 960 * treat this as a final EOF. 961 */ 962 return EOB_ACT_END_OF_FILE; 963 } 964 965 else 966 { 967 /* We matched some text prior to the EOB, first 968 * process it. 969 */ 970 return EOB_ACT_LAST_MATCH; 971 } 972 } 973 974 /* Try to read more data. */ 975 976 /* First move last chars to start of buffer. */ 977 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1; 978 979 for ( i = 0; i < number_to_move; ++i ) 980 *(dest++) = *(source++); 981 982 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) 983 /* don't do the read, it's not guaranteed to return an EOF, 984 * just force an EOF 985 */ 986 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0; 987 988 else 989 { 990 int num_to_read = 991 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; 992 993 while ( num_to_read <= 0 ) 994 { /* Not enough room in the buffer - grow it. */ 995 996 /* just a shorter name for the current buffer */ 997 YY_BUFFER_STATE b = YY_CURRENT_BUFFER; 998 999 int yy_c_buf_p_offset = 1000 (int) ((yy_c_buf_p) - b->yy_ch_buf); 1001 1002 if ( b->yy_is_our_buffer ) 1003 { 1004 int new_size = b->yy_buf_size * 2; 1005 1006 if ( new_size <= 0 ) 1007 b->yy_buf_size += b->yy_buf_size / 8; 1008 else 1009 b->yy_buf_size *= 2; 1010 1011 b->yy_ch_buf = (char *) 1012 /* Include room in for 2 EOB chars. */ 1013 yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); 1014 } 1015 else 1016 /* Can't grow it, we don't own it. */ 1017 b->yy_ch_buf = 0; 1018 1019 if ( ! b->yy_ch_buf ) 1020 YY_FATAL_ERROR( 1021 "fatal error - scanner input buffer overflow" ); 1022 1023 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset]; 1024 1025 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - 1026 number_to_move - 1; 1027 1028 } 1029 1030 if ( num_to_read > YY_READ_BUF_SIZE ) 1031 num_to_read = YY_READ_BUF_SIZE; 1032 1033 /* Read in more data. */ 1034 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), 1035 (yy_n_chars), (size_t) num_to_read ); 1036 1037 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); 1038 } 1039 1040 if ( (yy_n_chars) == 0 ) 1041 { 1042 if ( number_to_move == YY_MORE_ADJ ) 1043 { 1044 ret_val = EOB_ACT_END_OF_FILE; 1045 yyrestart(yyin ); 1046 } 1047 1048 else 1049 { 1050 ret_val = EOB_ACT_LAST_MATCH; 1051 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = 1052 YY_BUFFER_EOF_PENDING; 1053 } 1054 } 1055 1056 else 1057 ret_val = EOB_ACT_CONTINUE_SCAN; 1058 1059 if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { 1060 /* Extend the array by 50%, plus the number we really need. */ 1061 yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); 1062 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); 1063 if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) 1064 YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); 1065 } 1066 1067 (yy_n_chars) += number_to_move; 1068 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR; 1069 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR; 1070 1071 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; 1072 1073 return ret_val; 1074} 1075 1076/* yy_get_previous_state - get the state just before the EOB char was reached */ 1077 1078 static yy_state_type yy_get_previous_state (void) 1079{ 1080 register yy_state_type yy_current_state; 1081 register char *yy_cp; 1082 1083 yy_current_state = (yy_start); 1084 1085 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp ) 1086 { 1087 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1); 1088 if ( yy_accept[yy_current_state] ) 1089 { 1090 (yy_last_accepting_state) = yy_current_state; 1091 (yy_last_accepting_cpos) = yy_cp; 1092 } 1093 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 1094 { 1095 yy_current_state = (int) yy_def[yy_current_state]; 1096 if ( yy_current_state >= 17 ) 1097 yy_c = yy_meta[(unsigned int) yy_c]; 1098 } 1099 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 1100 } 1101 1102 return yy_current_state; 1103} 1104 1105/* yy_try_NUL_trans - try to make a transition on the NUL character 1106 * 1107 * synopsis 1108 * next_state = yy_try_NUL_trans( current_state ); 1109 */ 1110 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state ) 1111{ 1112 register int yy_is_jam; 1113 register char *yy_cp = (yy_c_buf_p); 1114 1115 register YY_CHAR yy_c = 1; 1116 if ( yy_accept[yy_current_state] ) 1117 { 1118 (yy_last_accepting_state) = yy_current_state; 1119 (yy_last_accepting_cpos) = yy_cp; 1120 } 1121 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state ) 1122 { 1123 yy_current_state = (int) yy_def[yy_current_state]; 1124 if ( yy_current_state >= 17 ) 1125 yy_c = yy_meta[(unsigned int) yy_c]; 1126 } 1127 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; 1128 yy_is_jam = (yy_current_state == 16); 1129 1130 return yy_is_jam ? 0 : yy_current_state; 1131} 1132 1133#ifndef YY_NO_INPUT 1134#ifdef __cplusplus 1135 static int yyinput (void) 1136#else 1137 static int input (void) 1138#endif 1139 1140{ 1141 int c; 1142 1143 *(yy_c_buf_p) = (yy_hold_char); 1144 1145 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR ) 1146 { 1147 /* yy_c_buf_p now points to the character we want to return. 1148 * If this occurs *before* the EOB characters, then it's a 1149 * valid NUL; if not, then we've hit the end of the buffer. 1150 */ 1151 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] ) 1152 /* This was really a NUL. */ 1153 *(yy_c_buf_p) = '\0'; 1154 1155 else 1156 { /* need more input */ 1157 int offset = (yy_c_buf_p) - (yytext_ptr); 1158 ++(yy_c_buf_p); 1159 1160 switch ( yy_get_next_buffer( ) ) 1161 { 1162 case EOB_ACT_LAST_MATCH: 1163 /* This happens because yy_g_n_b() 1164 * sees that we've accumulated a 1165 * token and flags that we need to 1166 * try matching the token before 1167 * proceeding. But for input(), 1168 * there's no matching to consider. 1169 * So convert the EOB_ACT_LAST_MATCH 1170 * to EOB_ACT_END_OF_FILE. 1171 */ 1172 1173 /* Reset buffer status. */ 1174 yyrestart(yyin ); 1175 1176 /*FALLTHROUGH*/ 1177 1178 case EOB_ACT_END_OF_FILE: 1179 { 1180 if ( yywrap( ) ) 1181 return EOF; 1182 1183 if ( ! (yy_did_buffer_switch_on_eof) ) 1184 YY_NEW_FILE; 1185#ifdef __cplusplus 1186 return yyinput(); 1187#else 1188 return input(); 1189#endif 1190 } 1191 1192 case EOB_ACT_CONTINUE_SCAN: 1193 (yy_c_buf_p) = (yytext_ptr) + offset; 1194 break; 1195 } 1196 } 1197 } 1198 1199 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ 1200 *(yy_c_buf_p) = '\0'; /* preserve yytext */ 1201 (yy_hold_char) = *++(yy_c_buf_p); 1202 1203 return c; 1204} 1205#endif /* ifndef YY_NO_INPUT */ 1206 1207/** Immediately switch to a different input stream. 1208 * @param input_file A readable stream. 1209 * 1210 * @note This function does not reset the start condition to @c INITIAL . 1211 */ 1212 void yyrestart (FILE * input_file ) 1213{ 1214 1215 if ( ! YY_CURRENT_BUFFER ){ 1216 yyensure_buffer_stack (); 1217 YY_CURRENT_BUFFER_LVALUE = 1218 yy_create_buffer(yyin,YY_BUF_SIZE ); 1219 } 1220 1221 yy_init_buffer(YY_CURRENT_BUFFER,input_file ); 1222 yy_load_buffer_state( ); 1223} 1224 1225/** Switch to a different input buffer. 1226 * @param new_buffer The new input buffer. 1227 * 1228 */ 1229 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) 1230{ 1231 1232 /* TODO. We should be able to replace this entire function body 1233 * with 1234 * yypop_buffer_state(); 1235 * yypush_buffer_state(new_buffer); 1236 */ 1237 yyensure_buffer_stack (); 1238 if ( YY_CURRENT_BUFFER == new_buffer ) 1239 return; 1240 1241 if ( YY_CURRENT_BUFFER ) 1242 { 1243 /* Flush out information for old buffer. */ 1244 *(yy_c_buf_p) = (yy_hold_char); 1245 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); 1246 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); 1247 } 1248 1249 YY_CURRENT_BUFFER_LVALUE = new_buffer; 1250 yy_load_buffer_state( ); 1251 1252 /* We don't actually know whether we did this switch during 1253 * EOF (yywrap()) processing, but the only time this flag 1254 * is looked at is after yywrap() is called, so it's safe 1255 * to go ahead and always set it. 1256 */ 1257 (yy_did_buffer_switch_on_eof) = 1; 1258} 1259 1260static void yy_load_buffer_state (void) 1261{ 1262 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; 1263 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; 1264 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; 1265 (yy_hold_char) = *(yy_c_buf_p); 1266} 1267 1268/** Allocate and initialize an input buffer state. 1269 * @param file A readable stream. 1270 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE. 1271 * 1272 * @return the allocated buffer state. 1273 */ 1274 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) 1275{ 1276 YY_BUFFER_STATE b; 1277 1278 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); 1279 if ( ! b ) 1280 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); 1281 1282 b->yy_buf_size = size; 1283 1284 /* yy_ch_buf has to be 2 characters longer than the size given because 1285 * we need to put in 2 end-of-buffer characters. 1286 */ 1287 b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 ); 1288 if ( ! b->yy_ch_buf ) 1289 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); 1290 1291 b->yy_is_our_buffer = 1; 1292 1293 yy_init_buffer(b,file ); 1294 1295 return b; 1296} 1297 1298/** Destroy the buffer. 1299 * @param b a buffer created with yy_create_buffer() 1300 * 1301 */ 1302 void yy_delete_buffer (YY_BUFFER_STATE b ) 1303{ 1304 1305 if ( ! b ) 1306 return; 1307 1308 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */ 1309 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; 1310 1311 if ( b->yy_is_our_buffer ) 1312 yyfree((void *) b->yy_ch_buf ); 1313 1314 yyfree((void *) b ); 1315} 1316 1317#ifndef __cplusplus 1318extern int isatty (int ); 1319#endif /* __cplusplus */ 1320 1321/* Initializes or reinitializes a buffer. 1322 * This function is sometimes called more than once on the same buffer, 1323 * such as during a yyrestart() or at EOF. 1324 */ 1325 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) 1326 1327{ 1328 int oerrno = errno; 1329 1330 yy_flush_buffer(b ); 1331 1332 b->yy_input_file = file; 1333 b->yy_fill_buffer = 1; 1334 1335 /* If b is the current buffer, then yy_init_buffer was _probably_ 1336 * called from yyrestart() or through yy_get_next_buffer. 1337 * In that case, we don't want to reset the lineno or column. 1338 */ 1339 if (b != YY_CURRENT_BUFFER){ 1340 b->yy_bs_lineno = 1; 1341 b->yy_bs_column = 0; 1342 } 1343 1344 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0; 1345 1346 errno = oerrno; 1347} 1348 1349/** Discard all buffered characters. On the next scan, YY_INPUT will be called. 1350 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. 1351 * 1352 */ 1353 void yy_flush_buffer (YY_BUFFER_STATE b ) 1354{ 1355 if ( ! b ) 1356 return; 1357 1358 b->yy_n_chars = 0; 1359 1360 /* We always need two end-of-buffer characters. The first causes 1361 * a transition to the end-of-buffer state. The second causes 1362 * a jam in that state. 1363 */ 1364 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR; 1365 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR; 1366 1367 b->yy_buf_pos = &b->yy_ch_buf[0]; 1368 1369 b->yy_at_bol = 1; 1370 b->yy_buffer_status = YY_BUFFER_NEW; 1371 1372 if ( b == YY_CURRENT_BUFFER ) 1373 yy_load_buffer_state( ); 1374} 1375 1376/** Pushes the new state onto the stack. The new state becomes 1377 * the current state. This function will allocate the stack 1378 * if necessary. 1379 * @param new_buffer The new state. 1380 * 1381 */ 1382void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) 1383{ 1384 if (new_buffer == NULL) 1385 return; 1386 1387 yyensure_buffer_stack(); 1388 1389 /* This block is copied from yy_switch_to_buffer. */ 1390 if ( YY_CURRENT_BUFFER ) 1391 { 1392 /* Flush out information for old buffer. */ 1393 *(yy_c_buf_p) = (yy_hold_char); 1394 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p); 1395 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars); 1396 } 1397 1398 /* Only push if top exists. Otherwise, replace top. */ 1399 if (YY_CURRENT_BUFFER) 1400 (yy_buffer_stack_top)++; 1401 YY_CURRENT_BUFFER_LVALUE = new_buffer; 1402 1403 /* copied from yy_switch_to_buffer. */ 1404 yy_load_buffer_state( ); 1405 (yy_did_buffer_switch_on_eof) = 1; 1406} 1407 1408/** Removes and deletes the top of the stack, if present. 1409 * The next element becomes the new top. 1410 * 1411 */ 1412void yypop_buffer_state (void) 1413{ 1414 if (!YY_CURRENT_BUFFER) 1415 return; 1416 1417 yy_delete_buffer(YY_CURRENT_BUFFER ); 1418 YY_CURRENT_BUFFER_LVALUE = NULL; 1419 if ((yy_buffer_stack_top) > 0) 1420 --(yy_buffer_stack_top); 1421 1422 if (YY_CURRENT_BUFFER) { 1423 yy_load_buffer_state( ); 1424 (yy_did_buffer_switch_on_eof) = 1; 1425 } 1426} 1427 1428/* Allocates the stack if it does not exist. 1429 * Guarantees space for at least one push. 1430 */ 1431static void yyensure_buffer_stack (void) 1432{ 1433 int num_to_alloc; 1434 1435 if (!(yy_buffer_stack)) { 1436 1437 /* First allocation is just for 2 elements, since we don't know if this 1438 * scanner will even need a stack. We use 2 instead of 1 to avoid an 1439 * immediate realloc on the next call. 1440 */ 1441 num_to_alloc = 1; 1442 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc 1443 (num_to_alloc * sizeof(struct yy_buffer_state*) 1444 ); 1445 if ( ! (yy_buffer_stack) ) 1446 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); 1447 1448 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); 1449 1450 (yy_buffer_stack_max) = num_to_alloc; 1451 (yy_buffer_stack_top) = 0; 1452 return; 1453 } 1454 1455 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){ 1456 1457 /* Increase the buffer to prepare for a possible push. */ 1458 int grow_size = 8 /* arbitrary grow size */; 1459 1460 num_to_alloc = (yy_buffer_stack_max) + grow_size; 1461 (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc 1462 ((yy_buffer_stack), 1463 num_to_alloc * sizeof(struct yy_buffer_state*) 1464 ); 1465 if ( ! (yy_buffer_stack) ) 1466 YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); 1467 1468 /* zero only the new slots.*/ 1469 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); 1470 (yy_buffer_stack_max) = num_to_alloc; 1471 } 1472} 1473 1474/** Setup the input buffer state to scan directly from a user-specified character buffer. 1475 * @param base the character buffer 1476 * @param size the size in bytes of the character buffer 1477 * 1478 * @return the newly allocated buffer state object. 1479 */ 1480YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) 1481{ 1482 YY_BUFFER_STATE b; 1483 1484 if ( size < 2 || 1485 base[size-2] != YY_END_OF_BUFFER_CHAR || 1486 base[size-1] != YY_END_OF_BUFFER_CHAR ) 1487 /* They forgot to leave room for the EOB's. */ 1488 return 0; 1489 1490 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) ); 1491 if ( ! b ) 1492 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); 1493 1494 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ 1495 b->yy_buf_pos = b->yy_ch_buf = base; 1496 b->yy_is_our_buffer = 0; 1497 b->yy_input_file = 0; 1498 b->yy_n_chars = b->yy_buf_size; 1499 b->yy_is_interactive = 0; 1500 b->yy_at_bol = 1; 1501 b->yy_fill_buffer = 0; 1502 b->yy_buffer_status = YY_BUFFER_NEW; 1503 1504 yy_switch_to_buffer(b ); 1505 1506 return b; 1507} 1508 1509/** Setup the input buffer state to scan a string. The next call to yylex() will 1510 * scan from a @e copy of @a str. 1511 * @param yystr a NUL-terminated string to scan 1512 * 1513 * @return the newly allocated buffer state object. 1514 * @note If you want to scan bytes that may contain NUL values, then use 1515 * yy_scan_bytes() instead. 1516 */ 1517YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) 1518{ 1519 1520 return yy_scan_bytes(yystr,strlen(yystr) ); 1521} 1522 1523/** Setup the input buffer state to scan the given bytes. The next call to yylex() will 1524 * scan from a @e copy of @a bytes. 1525 * @param yybytes the byte buffer to scan 1526 * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. 1527 * 1528 * @return the newly allocated buffer state object. 1529 */ 1530YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, int _yybytes_len ) 1531{ 1532 YY_BUFFER_STATE b; 1533 char *buf; 1534 yy_size_t n; 1535 int i; 1536 1537 /* Get memory for full buffer, including space for trailing EOB's. */ 1538 n = _yybytes_len + 2; 1539 buf = (char *) yyalloc(n ); 1540 if ( ! buf ) 1541 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); 1542 1543 for ( i = 0; i < _yybytes_len; ++i ) 1544 buf[i] = yybytes[i]; 1545 1546 buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; 1547 1548 b = yy_scan_buffer(buf,n ); 1549 if ( ! b ) 1550 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); 1551 1552 /* It's okay to grow etc. this buffer, and we should throw it 1553 * away when we're done. 1554 */ 1555 b->yy_is_our_buffer = 1; 1556 1557 return b; 1558} 1559 1560#ifndef YY_EXIT_FAILURE 1561#define YY_EXIT_FAILURE 2 1562#endif 1563 1564static void yy_fatal_error (yyconst char* msg ) 1565{ 1566 (void) fprintf( stderr, "%s\n", msg ); 1567 exit( YY_EXIT_FAILURE ); 1568} 1569 1570/* Redefine yyless() so it works in section 3 code. */ 1571 1572#undef yyless 1573#define yyless(n) \ 1574 do \ 1575 { \ 1576 /* Undo effects of setting up yytext. */ \ 1577 int yyless_macro_arg = (n); \ 1578 YY_LESS_LINENO(yyless_macro_arg);\ 1579 yytext[yyleng] = (yy_hold_char); \ 1580 (yy_c_buf_p) = yytext + yyless_macro_arg; \ 1581 (yy_hold_char) = *(yy_c_buf_p); \ 1582 *(yy_c_buf_p) = '\0'; \ 1583 yyleng = yyless_macro_arg; \ 1584 } \ 1585 while ( 0 ) 1586 1587/* Accessor methods (get/set functions) to struct members. */ 1588 1589/** Get the current line number. 1590 * 1591 */ 1592int yyget_lineno (void) 1593{ 1594 1595 return yylineno; 1596} 1597 1598/** Get the input stream. 1599 * 1600 */ 1601FILE *yyget_in (void) 1602{ 1603 return yyin; 1604} 1605 1606/** Get the output stream. 1607 * 1608 */ 1609FILE *yyget_out (void) 1610{ 1611 return yyout; 1612} 1613 1614/** Get the length of the current token. 1615 * 1616 */ 1617int yyget_leng (void) 1618{ 1619 return yyleng; 1620} 1621 1622/** Get the current token. 1623 * 1624 */ 1625 1626char *yyget_text (void) 1627{ 1628 return yytext; 1629} 1630 1631/** Set the current line number. 1632 * @param line_number 1633 * 1634 */ 1635void yyset_lineno (int line_number ) 1636{ 1637 1638 yylineno = line_number; 1639} 1640 1641/** Set the input stream. This does not discard the current 1642 * input buffer. 1643 * @param in_str A readable stream. 1644 * 1645 * @see yy_switch_to_buffer 1646 */ 1647void yyset_in (FILE * in_str ) 1648{ 1649 yyin = in_str ; 1650} 1651 1652void yyset_out (FILE * out_str ) 1653{ 1654 yyout = out_str ; 1655} 1656 1657int yyget_debug (void) 1658{ 1659 return yy_flex_debug; 1660} 1661 1662void yyset_debug (int bdebug ) 1663{ 1664 yy_flex_debug = bdebug ; 1665} 1666 1667static int yy_init_globals (void) 1668{ 1669 /* Initialization is the same as for the non-reentrant scanner. 1670 * This function is called from yylex_destroy(), so don't allocate here. 1671 */ 1672 1673 (yy_buffer_stack) = 0; 1674 (yy_buffer_stack_top) = 0; 1675 (yy_buffer_stack_max) = 0; 1676 (yy_c_buf_p) = (char *) 0; 1677 (yy_init) = 0; 1678 (yy_start) = 0; 1679 1680/* Defined in main.c */ 1681#ifdef YY_STDINIT 1682 yyin = stdin; 1683 yyout = stdout; 1684#else 1685 yyin = (FILE *) 0; 1686 yyout = (FILE *) 0; 1687#endif 1688 1689 /* For future reference: Set errno on error, since we are called by 1690 * yylex_init() 1691 */ 1692 return 0; 1693} 1694 1695/* yylex_destroy is for both reentrant and non-reentrant scanners. */ 1696int yylex_destroy (void) 1697{ 1698 1699 /* Pop the buffer stack, destroying each element. */ 1700 while(YY_CURRENT_BUFFER){ 1701 yy_delete_buffer(YY_CURRENT_BUFFER ); 1702 YY_CURRENT_BUFFER_LVALUE = NULL; 1703 yypop_buffer_state(); 1704 } 1705 1706 /* Destroy the stack itself. */ 1707 yyfree((yy_buffer_stack) ); 1708 (yy_buffer_stack) = NULL; 1709 1710 /* Reset the globals. This is important in a non-reentrant scanner so the next time 1711 * yylex() is called, initialization will occur. */ 1712 yy_init_globals( ); 1713 1714 return 0; 1715} 1716 1717/* 1718 * Internal utility routines. 1719 */ 1720 1721#ifndef yytext_ptr 1722static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) 1723{ 1724 register int i; 1725 for ( i = 0; i < n; ++i ) 1726 s1[i] = s2[i]; 1727} 1728#endif 1729 1730#ifdef YY_NEED_STRLEN 1731static int yy_flex_strlen (yyconst char * s ) 1732{ 1733 register int n; 1734 for ( n = 0; s[n]; ++n ) 1735 ; 1736 1737 return n; 1738} 1739#endif 1740 1741void *yyalloc (yy_size_t size ) 1742{ 1743 return (void *) malloc( size ); 1744} 1745 1746void *yyrealloc (void * ptr, yy_size_t size ) 1747{ 1748 /* The cast to (char *) in the following accommodates both 1749 * implementations that use char* generic pointers, and those 1750 * that use void* generic pointers. It works with the latter 1751 * because both ANSI C and C++ allow castless assignment from 1752 * any pointer type to void*, and deal with argument conversions 1753 * as though doing an assignment. 1754 */ 1755 return (void *) realloc( (char *) ptr, size ); 1756} 1757 1758void yyfree (void * ptr ) 1759{ 1760 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ 1761} 1762 1763#define YYTABLES_NAME "yytables" 1764 1765#line 40 "configfile.l" 1766 1767 1768 1769#include <stdio.h> 1770#include <string.h> 1771#include <wintypes.h> 1772 1773#include "pcsclite.h" 1774#include "sys_generic.h" 1775#include "readerfactory.h" 1776#include "debuglog.h" 1777 1778int evaluatetoken(char *pcToken) 1779{ 1780 1781 DWORD dwChannelId = 0; 1782 int p = 0; 1783 int n = 0; 1784 1785 if (pcPrevious == NULL) 1786 { /* This is the key */ 1787 pcPrevious = strdup(pcToken); 1788 } 1789 else 1790 { 1791 pcCurrent = pcToken; 1792 if (strcmp(pcPrevious, "FRIENDLYNAME") == 0) 1793 { 1794 if (pcFriendlyname == NULL) 1795 { 1796 pcFriendlyname = malloc(strlen(pcCurrent) - 1); 1797 for (n = 0; n < strlen(pcCurrent); n++) 1798 { 1799 if (pcCurrent[n] != '"') 1800 { /* Strip off the quotes */ 1801 pcFriendlyname[p++] = pcCurrent[n]; 1802 } 1803 } 1804 pcFriendlyname[p++] = '\0'; 1805 } 1806 else 1807 { 1808 tok_error(pcPrevious); 1809 return 1; 1810 } 1811 } 1812 else if (strcmp(pcPrevious, "DEVICENAME") == 0) 1813 { 1814 if (pcDevicename == NULL) 1815 { 1816 pcDevicename = strdup(pcCurrent); 1817 } 1818 else 1819 { 1820 tok_error(pcPrevious); 1821 return 1; 1822 } 1823 } 1824 else if (strcmp(pcPrevious, "LIBPATH") == 0) 1825 { 1826 if (pcLibpath == NULL) 1827 { 1828 pcLibpath = strdup(pcCurrent); 1829 } 1830 else 1831 { 1832 tok_error(pcPrevious); 1833 return 1; 1834 } 1835 } 1836 else if (strcmp(pcPrevious, "CHANNELID") == 0) 1837 { 1838 if (pcChannelid == NULL) 1839 pcChannelid = strdup(pcCurrent); 1840 else 1841 { 1842 tok_error(pcPrevious); 1843 return 1; 1844 } 1845 } 1846 else 1847 { 1848 tok_error(pcPrevious); 1849 return 1; 1850 } 1851 1852 free(pcPrevious); 1853 pcPrevious = NULL; 1854 } 1855 1856 if (pcFriendlyname != NULL && pcDevicename != NULL && 1857 pcLibpath != NULL && pcChannelid != NULL) 1858 { 1859 1860 dwChannelId = strtoul(pcChannelid, 0, 16); 1861 RFAddReader(pcFriendlyname, dwChannelId, pcLibpath, pcDevicename); 1862 1863 free(pcFriendlyname); 1864 free(pcDevicename); 1865 free(pcLibpath); 1866 free(pcChannelid); 1867 pcFriendlyname = NULL; 1868 pcDevicename = NULL; 1869 pcLibpath = NULL; 1870 pcChannelid = NULL; 1871 } 1872 1873 return 0; 1874} 1875 1876void tok_error (char *token_error) 1877{ 1878 Log2(PCSC_LOG_ERROR, "tok_error: invalid value in " PCSCLITE_READER_CONFIG ": %s", token_error); 1879 badError = 1; 1880} 1881 1882int DBUpdateReaders (const char *readerconf) 1883{ 1884 FILE *configFile = NULL; 1885 1886 configFile = fopen(readerconf, "r"); 1887 1888 if (configFile == NULL) 1889 return 1; 1890 1891 yyin = configFile; 1892 1893 do 1894 { 1895 (void)yylex(); 1896 } 1897 while (!feof(configFile)); 1898 1899 (void)fclose(configFile); 1900 1901 if (badError == 1) 1902 return -1; 1903 else 1904 return 0; 1905} /* End of configfile.c */ 1906 1907 1908