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