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