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