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