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