4 #define YY_INT_ALIGNED short int
6 /* A lexical scanner generated by flex */
9 #define YY_FLEX_MAJOR_VERSION 2
10 #define YY_FLEX_MINOR_VERSION 5
11 #define YY_FLEX_SUBMINOR_VERSION 31
12 #if YY_FLEX_SUBMINOR_VERSION > 0
16 /* First, we deal with platform-specific or compiler-specific issues. */
18 /* begin standard C headers. */
24 /* end standard C headers. */
26 /* flex integer type definitions */
31 /* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
33 #if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
35 typedef int8_t flex_int8_t;
36 typedef uint8_t flex_uint8_t;
37 typedef int16_t flex_int16_t;
38 typedef uint16_t flex_uint16_t;
39 typedef int32_t flex_int32_t;
40 typedef uint32_t flex_uint32_t;
42 typedef signed char flex_int8_t;
43 typedef short int flex_int16_t;
44 typedef int flex_int32_t;
45 typedef unsigned char flex_uint8_t;
46 typedef unsigned short int flex_uint16_t;
47 typedef unsigned int flex_uint32_t;
50 /* Limits of integral types. */
52 #define INT8_MIN (-128)
55 #define INT16_MIN (-32767-1)
58 #define INT32_MIN (-2147483647-1)
61 #define INT8_MAX (127)
64 #define INT16_MAX (32767)
67 #define INT32_MAX (2147483647)
70 #define UINT8_MAX (255U)
73 #define UINT16_MAX (65535U)
76 #define UINT32_MAX (4294967295U)
79 #endif /* ! FLEXINT_H */
83 /* The "const" storage-class-modifier is valid. */
86 #else /* ! __cplusplus */
93 #endif /* ! __cplusplus */
101 /* Returned upon end-of-file. */
104 /* Promotes a possibly negative, possibly signed char to an unsigned
105 * integer for use as an array index. If the signed char is negative,
106 * we want to instead treat it as an 8-bit unsigned char, hence the
109 #define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
111 /* Enter a start condition. This macro really ought to take a parameter,
112 * but we do it the disgusting crufty way forced on us by the ()-less
113 * definition of BEGIN.
115 #define BEGIN (yy_start) = 1 + 2 *
117 /* Translate the current start state into a value that can be later handed
118 * to BEGIN to return to the state. The YYSTATE alias is for lex
121 #define YY_START (((yy_start) - 1) / 2)
122 #define YYSTATE YY_START
124 /* Action number for EOF rule of a given start state. */
125 #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
127 /* Special action meaning "start processing a new file". */
128 #define YY_NEW_FILE yyrestart(yyin )
130 #define YY_END_OF_BUFFER_CHAR 0
132 /* Size of default input buffer. */
134 #define YY_BUF_SIZE 16384
137 #ifndef YY_TYPEDEF_YY_BUFFER_STATE
138 #define YY_TYPEDEF_YY_BUFFER_STATE
139 typedef struct yy_buffer_state *YY_BUFFER_STATE;
144 extern FILE *yyin, *yyout;
146 #define EOB_ACT_CONTINUE_SCAN 0
147 #define EOB_ACT_END_OF_FILE 1
148 #define EOB_ACT_LAST_MATCH 2
150 #define YY_LESS_LINENO(n)
152 /* Return all but the first "n" matched characters back to the input stream. */
156 /* Undo effects of setting up yytext. */ \
157 int yyless_macro_arg = (n); \
158 YY_LESS_LINENO(yyless_macro_arg);\
159 *yy_cp = (yy_hold_char); \
160 YY_RESTORE_YY_MORE_OFFSET \
161 (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
162 YY_DO_BEFORE_ACTION; /* set up yytext again */ \
166 #define unput(c) yyunput( c, (yytext_ptr) )
168 /* The following is because we cannot portably get our hands on size_t
169 * (without autoconf's help, which isn't available because we want
170 * flex-generated scanners to compile on their own).
173 #ifndef YY_TYPEDEF_YY_SIZE_T
174 #define YY_TYPEDEF_YY_SIZE_T
175 typedef unsigned int yy_size_t;
178 #ifndef YY_STRUCT_YY_BUFFER_STATE
179 #define YY_STRUCT_YY_BUFFER_STATE
180 struct yy_buffer_state
184 char *yy_ch_buf; /* input buffer */
185 char *yy_buf_pos; /* current position in input buffer */
187 /* Size of input buffer in bytes, not including room for EOB
190 yy_size_t yy_buf_size;
192 /* Number of characters read into yy_ch_buf, not including EOB
197 /* Whether we "own" the buffer - i.e., we know we created it,
198 * and can realloc() it to grow it, and should free() it to
201 int yy_is_our_buffer;
203 /* Whether this is an "interactive" input source; if so, and
204 * if we're using stdio for input, then we want to use getc()
205 * instead of fread(), to make sure we stop fetching input after
208 int yy_is_interactive;
210 /* Whether we're considered to be at the beginning of a line.
211 * If so, '^' rules will be active on the next match, otherwise
216 int yy_bs_lineno; /**< The line count. */
217 int yy_bs_column; /**< The column count. */
219 /* Whether to try to fill the input buffer when we reach the
224 int yy_buffer_status;
226 #define YY_BUFFER_NEW 0
227 #define YY_BUFFER_NORMAL 1
228 /* When an EOF's been seen but there's still some text to process
229 * then we mark the buffer as YY_EOF_PENDING, to indicate that we
230 * shouldn't try reading from the input source any more. We might
231 * still have a bunch of tokens to match, though, because of
232 * possible backing-up.
234 * When we actually see the EOF, we change the status to "new"
235 * (via yyrestart()), so that the user can continue scanning by
236 * just pointing yyin at a new input file.
238 #define YY_BUFFER_EOF_PENDING 2
241 #endif /* !YY_STRUCT_YY_BUFFER_STATE */
243 /* Stack of input buffers. */
244 static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
245 static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
246 static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
248 /* We provide macros for accessing buffer states in case in the
249 * future we want to put the buffer states in a more general
252 * Returns the top of the stack, or NULL.
254 #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
255 ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
258 /* Same as previous macro, but useful when we know that the buffer stack is not
259 * NULL or when we need an lvalue. For internal use only.
261 #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
263 /* yy_hold_char holds the character lost when yytext is formed. */
264 static char yy_hold_char;
265 static int yy_n_chars; /* number of characters read into yy_ch_buf */
268 /* Points to current character in buffer. */
269 static char *yy_c_buf_p = (char *) 0;
270 static int yy_init = 1; /* whether we need to initialize */
271 static int yy_start = 0; /* start state number */
273 /* Flag which is used to allow yywrap()'s to do buffer switches
274 * instead of setting up a fresh yyin. A bit of a hack ...
276 static int yy_did_buffer_switch_on_eof;
278 void yyrestart (FILE *input_file );
279 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer );
280 YY_BUFFER_STATE yy_create_buffer (FILE *file,int size );
281 void yy_delete_buffer (YY_BUFFER_STATE b );
282 void yy_flush_buffer (YY_BUFFER_STATE b );
283 void yypush_buffer_state (YY_BUFFER_STATE new_buffer );
284 void yypop_buffer_state (void );
286 static void yyensure_buffer_stack (void );
287 static void yy_load_buffer_state (void );
288 static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file );
290 #define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
292 YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size );
293 YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str );
294 YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len );
296 void *yyalloc (yy_size_t );
297 void *yyrealloc (void *,yy_size_t );
298 void yyfree (void * );
300 #define yy_new_buffer yy_create_buffer
302 #define yy_set_interactive(is_interactive) \
304 if ( ! YY_CURRENT_BUFFER ){ \
305 yyensure_buffer_stack (); \
306 YY_CURRENT_BUFFER_LVALUE = \
307 yy_create_buffer(yyin,YY_BUF_SIZE ); \
309 YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
312 #define yy_set_bol(at_bol) \
314 if ( ! YY_CURRENT_BUFFER ){\
315 yyensure_buffer_stack (); \
316 YY_CURRENT_BUFFER_LVALUE = \
317 yy_create_buffer(yyin,YY_BUF_SIZE ); \
319 YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
322 #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
324 /* Begin user sect3 */
327 #define YY_SKIP_YYWRAP
329 typedef unsigned char YY_CHAR;
331 FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
333 typedef int yy_state_type;
340 #define yytext_ptr yytext
342 static yy_state_type yy_get_previous_state (void );
343 static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
344 static int yy_get_next_buffer (void );
345 static void yy_fatal_error (yyconst char msg[] );
347 /* Done after the current pattern has been matched and before the
348 * corresponding action - sets up yytext.
350 #define YY_DO_BEFORE_ACTION \
351 (yytext_ptr) = yy_bp; \
352 yyleng = (size_t) (yy_cp - yy_bp); \
353 (yy_hold_char) = *yy_cp; \
355 (yy_c_buf_p) = yy_cp;
357 #define YY_NUM_RULES 25
358 #define YY_END_OF_BUFFER 26
359 /* This struct is not used in this scanner,
360 but its presence is necessary. */
363 flex_int32_t yy_verify;
366 static yyconst flex_int16_t yy_accept[97] =
368 0, 0, 26, 25, 23, 24, 22, 21, 20, 21,
369 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
370 23, 0, 21, 9, 21, 21, 21, 21, 21, 21,
371 1, 21, 13, 21, 21, 21, 21, 21, 21, 21,
372 21, 14, 21, 21, 21, 21, 8, 21, 21, 21,
373 2, 21, 21, 21, 21, 16, 21, 21, 21, 21,
374 21, 21, 4, 21, 21, 21, 21, 21, 21, 21,
375 21, 21, 5, 21, 21, 21, 21, 6, 21, 21,
376 21, 10, 21, 21, 12, 19, 15, 3, 7, 17,
377 21, 21, 21, 18, 11, 0
381 static yyconst flex_int32_t yy_ec[256] =
383 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
384 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
385 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
386 1, 2, 1, 1, 1, 1, 4, 1, 1, 1,
387 1, 1, 1, 1, 5, 6, 7, 8, 8, 8,
388 8, 8, 8, 8, 8, 8, 8, 9, 1, 1,
389 1, 1, 1, 1, 10, 10, 10, 10, 10, 10,
390 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
391 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
392 1, 1, 1, 1, 6, 1, 11, 12, 13, 14,
394 15, 16, 10, 17, 18, 10, 10, 19, 20, 21,
395 22, 23, 24, 25, 26, 27, 28, 10, 10, 10,
396 29, 10, 1, 1, 1, 1, 1, 1, 1, 1,
397 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
398 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
399 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
400 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
401 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
402 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
403 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
405 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
406 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
407 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
408 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
409 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
413 static yyconst flex_int32_t yy_meta[30] =
415 1, 1, 1, 2, 1, 2, 1, 3, 2, 3,
416 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
417 3, 3, 3, 3, 3, 3, 3, 3, 3
420 static yyconst flex_int16_t yy_base[99] =
422 0, 0, 191, 192, 188, 192, 192, 185, 192, 26,
423 27, 30, 28, 29, 31, 33, 32, 36, 34, 37,
424 186, 0, 183, 182, 35, 38, 49, 40, 53, 63,
425 181, 64, 180, 66, 65, 67, 68, 72, 70, 69,
426 0, 179, 71, 74, 85, 77, 178, 79, 90, 91,
427 177, 92, 93, 95, 99, 176, 96, 100, 104, 103,
428 105, 106, 175, 108, 107, 109, 113, 114, 117, 123,
429 125, 126, 174, 128, 131, 133, 130, 173, 134, 142,
430 135, 172, 140, 138, 171, 154, 170, 164, 162, 155,
431 139, 161, 143, 163, 153, 192, 170, 147
435 static yyconst flex_int16_t yy_def[99] =
437 96, 1, 96, 96, 96, 96, 96, 97, 96, 97,
438 97, 97, 97, 97, 97, 97, 97, 97, 97, 97,
439 96, 98, 97, 97, 97, 97, 97, 97, 97, 97,
440 97, 97, 97, 97, 97, 97, 97, 97, 97, 97,
441 98, 97, 97, 97, 97, 97, 97, 97, 97, 97,
442 97, 97, 97, 97, 97, 97, 97, 97, 97, 97,
443 97, 97, 97, 97, 97, 97, 97, 97, 97, 97,
444 97, 97, 97, 97, 97, 97, 97, 97, 97, 97,
445 97, 97, 97, 97, 97, 97, 97, 97, 97, 97,
446 97, 97, 97, 97, 97, 0, 96, 96
450 static yyconst flex_int16_t yy_nxt[222] =
452 4, 5, 6, 4, 7, 8, 9, 8, 8, 8,
453 10, 11, 8, 12, 13, 8, 8, 14, 8, 15,
454 16, 17, 8, 8, 18, 8, 19, 20, 8, 22,
455 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
456 22, 22, 24, 22, 27, 33, 25, 28, 29, 31,
457 36, 32, 22, 30, 34, 26, 22, 39, 37, 35,
458 43, 38, 40, 42, 44, 45, 22, 22, 22, 22,
459 22, 22, 22, 22, 22, 22, 48, 22, 53, 46,
460 22, 57, 22, 56, 58, 47, 50, 55, 22, 49,
461 52, 51, 54, 22, 22, 22, 22, 59, 22, 22,
463 61, 60, 22, 22, 62, 63, 22, 22, 22, 22,
464 22, 22, 22, 65, 70, 66, 22, 22, 73, 64,
465 22, 68, 67, 76, 72, 74, 22, 69, 22, 22,
466 71, 22, 75, 22, 22, 79, 22, 22, 22, 78,
467 77, 22, 22, 22, 86, 22, 22, 80, 82, 41,
468 81, 85, 83, 84, 90, 88, 22, 22, 22, 91,
469 87, 89, 92, 93, 22, 22, 22, 22, 94, 95,
470 94, 23, 23, 22, 22, 22, 22, 22, 22, 22,
471 22, 22, 22, 22, 22, 22, 22, 21, 22, 21,
472 96, 3, 96, 96, 96, 96, 96, 96, 96, 96,
474 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
475 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
479 static yyconst flex_int16_t yy_chk[222] =
481 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
482 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
483 1, 1, 1, 1, 1, 1, 1, 1, 1, 10,
484 11, 13, 14, 12, 15, 17, 16, 19, 25, 18,
485 20, 26, 10, 28, 12, 15, 10, 12, 13, 14,
486 18, 14, 27, 13, 16, 11, 29, 20, 19, 17,
487 26, 19, 20, 25, 27, 28, 30, 32, 35, 34,
488 36, 37, 40, 39, 43, 38, 32, 44, 37, 29,
489 46, 43, 48, 40, 44, 30, 34, 39, 45, 32,
490 36, 35, 38, 49, 50, 52, 53, 45, 54, 57,
492 48, 46, 55, 58, 49, 50, 60, 59, 61, 62,
493 65, 64, 66, 53, 59, 54, 67, 68, 62, 52,
494 69, 57, 55, 66, 61, 64, 70, 58, 71, 72,
495 60, 74, 65, 77, 75, 69, 76, 79, 81, 68,
496 67, 84, 91, 83, 77, 80, 93, 70, 72, 98,
497 71, 76, 74, 75, 83, 80, 95, 86, 90, 84,
498 79, 81, 86, 91, 92, 89, 94, 88, 92, 93,
499 94, 97, 97, 87, 85, 82, 78, 73, 63, 56,
500 51, 47, 42, 33, 31, 24, 23, 21, 8, 5,
501 3, 96, 96, 96, 96, 96, 96, 96, 96, 96,
503 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
504 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
508 static yy_state_type yy_last_accepting_state;
509 static char *yy_last_accepting_cpos;
511 extern int yy_flex_debug;
512 int yy_flex_debug = 0;
514 /* The intent behind this definition is that it'll catch
515 * any uses of REJECT which flex missed.
517 #define REJECT reject_used_but_not_detected
518 #define yymore() yymore_used_but_not_detected
519 #define YY_MORE_ADJ 0
520 #define YY_RESTORE_YY_MORE_OFFSET
522 #line 1 "policy_token.l"
523 /* $KAME: policy_token.l,v 1.13 2003/05/09 05:19:55 sakane Exp $ */
525 * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
526 * All rights reserved.
528 * Redistribution and use in source and binary forms, with or without
529 * modification, are permitted provided that the following conditions
531 * 1. Redistributions of source code must retain the above copyright
532 * notice, this list of conditions and the following disclaimer.
533 * 2. Redistributions in binary form must reproduce the above copyright
534 * notice, this list of conditions and the following disclaimer in the
535 * documentation and/or other materials provided with the distribution.
536 * 3. Neither the name of the project nor the names of its contributors
537 * may be used to endorse or promote products derived from this software
538 * without specific prior written permission.
540 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
541 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
542 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
543 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
544 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
545 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
546 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
547 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
548 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
549 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
552 #line 33 "policy_token.l"
554 #include <sys/types.h>
555 #include <sys/param.h>
556 #include <sys/socket.h>
557 #include <net/route.h>
558 #include <net/pfkeyv2.h>
559 #include <netkey/keydb.h>
560 #include <netinet/in.h>
561 #include <netinet6/ipsec.h>
570 #include "policy_parse.tab.h"
575 #include "policy_parse.h"
577 #define yylval __libyylval /* XXX */
580 int yylex __P((void));
586 #ifndef YY_NO_UNISTD_H
587 /* Special case for "unistd.h", since it is non-ANSI. We include it way
588 * down here because we want the user's section 1 to have been scanned first.
589 * The user has a chance to override it with an option.
594 #ifndef YY_EXTRA_TYPE
595 #define YY_EXTRA_TYPE void *
598 /* Macros after this point can all be overridden by user definitions in
602 #ifndef YY_SKIP_YYWRAP
604 extern "C" int yywrap (void );
606 extern int yywrap (void );
611 static void yy_flex_strncpy (char *,yyconst char *,int );
614 #ifdef YY_NEED_STRLEN
615 static int yy_flex_strlen (yyconst char * );
621 static int yyinput (void );
623 static int input (void );
628 /* Amount of stuff to slurp up with each read. */
629 #ifndef YY_READ_BUF_SIZE
630 #define YY_READ_BUF_SIZE 8192
633 /* Copy whatever the last rule matched to the standard output. */
635 /* This used to be an fputs(), but since the string might contain NUL's,
636 * we now use fwrite().
638 #define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
641 /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
642 * is returned in "result".
645 #define YY_INPUT(buf,result,max_size) \
646 if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
650 for ( n = 0; n < max_size && \
651 (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
654 buf[n++] = (char) c; \
655 if ( c == EOF && ferror( yyin ) ) \
656 YY_FATAL_ERROR( "input in flex scanner failed" ); \
662 while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
664 if( errno != EINTR) \
666 YY_FATAL_ERROR( "input in flex scanner failed" ); \
677 /* No semi-colon after return; correct usage is to write "yyterminate();" -
678 * we don't want an extra ';' after the "return" because that will cause
679 * some compilers to complain about unreachable statements.
682 #define yyterminate() return YY_NULL
685 /* Number of entries by which start-condition stack grows. */
686 #ifndef YY_START_STACK_INCR
687 #define YY_START_STACK_INCR 25
690 /* Report a fatal error. */
691 #ifndef YY_FATAL_ERROR
692 #define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
695 /* end tables serialization structures and prototypes */
697 /* Default declaration of generated scanner - a define so the user can
698 * easily add parameters.
701 #define YY_DECL_IS_OURS 1
703 extern int yylex (void);
705 #define YY_DECL int yylex (void)
706 #endif /* !YY_DECL */
708 /* Code executed at the beginning of each rule, after yytext and yyleng
711 #ifndef YY_USER_ACTION
712 #define YY_USER_ACTION
715 /* Code executed at the end of each rule. */
717 #define YY_BREAK break;
720 #define YY_RULE_SETUP \
723 /** The main scanner function which does all the work.
727 register yy_state_type yy_current_state;
728 register char *yy_cp, *yy_bp;
731 #line 94 "policy_token.l"
745 (yy_start) = 1; /* first start state */
753 if ( ! YY_CURRENT_BUFFER ) {
754 yyensure_buffer_stack ();
755 YY_CURRENT_BUFFER_LVALUE =
756 yy_create_buffer(yyin,YY_BUF_SIZE );
759 yy_load_buffer_state( );
762 while ( 1 ) /* loops until end-of-file is reached */
764 yy_cp = (yy_c_buf_p);
766 /* Support of yytext. */
767 *yy_cp = (yy_hold_char);
769 /* yy_bp points to the position in yy_ch_buf of the start of
774 yy_current_state = (yy_start);
778 register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
779 if ( yy_accept[yy_current_state] )
781 (yy_last_accepting_state) = yy_current_state;
782 (yy_last_accepting_cpos) = yy_cp;
784 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
786 yy_current_state = (int) yy_def[yy_current_state];
787 if ( yy_current_state >= 97 )
788 yy_c = yy_meta[(unsigned int) yy_c];
790 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
793 while ( yy_base[yy_current_state] != 192 );
796 yy_act = yy_accept[yy_current_state];
798 { /* have to back up */
799 yy_cp = (yy_last_accepting_cpos);
800 yy_current_state = (yy_last_accepting_state);
801 yy_act = yy_accept[yy_current_state];
806 do_action: /* This label is used only to access EOF actions. */
809 { /* beginning of action switch */
810 case 0: /* must back up */
811 /* undo the effects of YY_DO_BEFORE_ACTION */
812 *yy_cp = (yy_hold_char);
813 yy_cp = (yy_last_accepting_cpos);
814 yy_current_state = (yy_last_accepting_state);
819 #line 96 "policy_token.l"
820 { yylval.num = IPSEC_DIR_INBOUND; return(DIR); }
824 #line 97 "policy_token.l"
825 { yylval.num = IPSEC_DIR_OUTBOUND; return(DIR); }
829 #line 99 "policy_token.l"
830 { yylval.num = IPSEC_POLICY_DISCARD; return(ACTION); }
834 #line 100 "policy_token.l"
835 { yylval.num = IPSEC_POLICY_NONE; return(ACTION); }
839 #line 101 "policy_token.l"
840 { yylval.num = IPSEC_POLICY_IPSEC; return(ACTION); }
844 #line 102 "policy_token.l"
845 { yylval.num = IPSEC_POLICY_BYPASS; return(ACTION); }
849 #line 103 "policy_token.l"
850 { yylval.num = IPSEC_POLICY_ENTRUST; return(ACTION); }
854 #line 105 "policy_token.l"
855 { yylval.num = IPPROTO_ESP; return(PROTOCOL); }
859 #line 106 "policy_token.l"
860 { yylval.num = IPPROTO_AH; return(PROTOCOL); }
864 #line 107 "policy_token.l"
865 { yylval.num = IPPROTO_IPCOMP; return(PROTOCOL); }
869 #line 109 "policy_token.l"
870 { yylval.num = IPSEC_MODE_TRANSPORT; return(MODE); }
874 #line 110 "policy_token.l"
875 { yylval.num = IPSEC_MODE_TUNNEL; return(MODE); }
879 #line 112 "policy_token.l"
884 #line 113 "policy_token.l"
889 #line 115 "policy_token.l"
890 { yylval.num = IPSEC_LEVEL_DEFAULT; return(LEVEL); }
894 #line 116 "policy_token.l"
895 { yylval.num = IPSEC_LEVEL_USE; return(LEVEL); }
899 #line 117 "policy_token.l"
900 { yylval.num = IPSEC_LEVEL_REQUIRE; return(LEVEL); }
904 #line 118 "policy_token.l"
906 yylval.val.len = strlen(yytext + 7);
907 yylval.val.buf = yytext + 7;
908 return(LEVEL_SPECIFY);
913 #line 123 "policy_token.l"
914 { yylval.num = IPSEC_LEVEL_UNIQUE; return(LEVEL); }
918 #line 124 "policy_token.l"
923 #line 126 "policy_token.l"
925 yylval.val.len = strlen(yytext);
926 yylval.val.buf = yytext;
932 #line 132 "policy_token.l"
937 #line 134 "policy_token.l"
941 /* rule 24 can match eol */
943 #line 135 "policy_token.l"
948 #line 137 "policy_token.l"
952 case YY_STATE_EOF(INITIAL):
955 case YY_END_OF_BUFFER:
957 /* Amount of text matched not including the EOB char. */
958 int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
960 /* Undo the effects of YY_DO_BEFORE_ACTION. */
961 *yy_cp = (yy_hold_char);
962 YY_RESTORE_YY_MORE_OFFSET
964 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
966 /* We're scanning a new file or input source. It's
967 * possible that this happened because the user
968 * just pointed yyin at a new source and called
969 * yylex(). If so, then we have to assure
970 * consistency between YY_CURRENT_BUFFER and our
971 * globals. Here is the right place to do so, because
972 * this is the first action (other than possibly a
973 * back-up) that will match for the new input source.
975 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
976 YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
977 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
980 /* Note that here we test for yy_c_buf_p "<=" to the position
981 * of the first EOB in the buffer, since yy_c_buf_p will
982 * already have been incremented past the NUL character
983 * (since all states make transitions on EOB to the
984 * end-of-buffer state). Contrast this with the test
987 if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
988 { /* This was really a NUL. */
989 yy_state_type yy_next_state;
991 (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
993 yy_current_state = yy_get_previous_state( );
995 /* Okay, we're now positioned to make the NUL
996 * transition. We couldn't have
997 * yy_get_previous_state() go ahead and do it
998 * for us because it doesn't know how to deal
999 * with the possibility of jamming (and we don't
1000 * want to build jamming into it because then it
1001 * will run more slowly).
1004 yy_next_state = yy_try_NUL_trans( yy_current_state );
1006 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1008 if ( yy_next_state )
1010 /* Consume the NUL. */
1011 yy_cp = ++(yy_c_buf_p);
1012 yy_current_state = yy_next_state;
1018 yy_cp = (yy_c_buf_p);
1019 goto yy_find_action;
1023 else switch ( yy_get_next_buffer( ) )
1025 case EOB_ACT_END_OF_FILE:
1027 (yy_did_buffer_switch_on_eof) = 0;
1031 /* Note: because we've taken care in
1032 * yy_get_next_buffer() to have set up
1033 * yytext, we can now set up
1034 * yy_c_buf_p so that if some total
1035 * hoser (like flex itself) wants to
1036 * call the scanner after we return the
1037 * YY_NULL, it'll still work - another
1038 * YY_NULL will get returned.
1040 (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
1042 yy_act = YY_STATE_EOF(YY_START);
1048 if ( ! (yy_did_buffer_switch_on_eof) )
1054 case EOB_ACT_CONTINUE_SCAN:
1056 (yytext_ptr) + yy_amount_of_matched_text;
1058 yy_current_state = yy_get_previous_state( );
1060 yy_cp = (yy_c_buf_p);
1061 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1064 case EOB_ACT_LAST_MATCH:
1066 &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
1068 yy_current_state = yy_get_previous_state( );
1070 yy_cp = (yy_c_buf_p);
1071 yy_bp = (yytext_ptr) + YY_MORE_ADJ;
1072 goto yy_find_action;
1079 "fatal flex scanner internal error--no action found" );
1080 } /* end of action switch */
1081 } /* end of scanning one token */
1082 } /* end of yylex */
1084 /* yy_get_next_buffer - try to read in a new buffer
1086 * Returns a code representing an action:
1087 * EOB_ACT_LAST_MATCH -
1088 * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
1089 * EOB_ACT_END_OF_FILE - end of file
1091 static int yy_get_next_buffer (void)
1093 register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
1094 register char *source = (yytext_ptr);
1095 register int number_to_move, i;
1098 if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
1100 "fatal flex scanner internal error--end of buffer missed" );
1102 if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
1103 { /* Don't try to fill the buffer, so this is an EOF. */
1104 if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
1106 /* We matched a single character, the EOB, so
1107 * treat this as a final EOF.
1109 return EOB_ACT_END_OF_FILE;
1114 /* We matched some text prior to the EOB, first
1117 return EOB_ACT_LAST_MATCH;
1121 /* Try to read more data. */
1123 /* First move last chars to start of buffer. */
1124 number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
1126 for ( i = 0; i < number_to_move; ++i )
1127 *(dest++) = *(source++);
1129 if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
1130 /* don't do the read, it's not guaranteed to return an EOF,
1133 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
1137 size_t num_to_read =
1138 YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
1140 while ( num_to_read <= 0 )
1141 { /* Not enough room in the buffer - grow it. */
1143 /* just a shorter name for the current buffer */
1144 YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
1146 int yy_c_buf_p_offset =
1147 (int) ((yy_c_buf_p) - b->yy_ch_buf);
1149 if ( b->yy_is_our_buffer )
1151 int new_size = b->yy_buf_size * 2;
1153 if ( new_size <= 0 )
1154 b->yy_buf_size += b->yy_buf_size / 8;
1156 b->yy_buf_size *= 2;
1158 b->yy_ch_buf = (char *)
1159 /* Include room in for 2 EOB chars. */
1160 yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
1163 /* Can't grow it, we don't own it. */
1166 if ( ! b->yy_ch_buf )
1168 "fatal error - scanner input buffer overflow" );
1170 (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
1172 num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
1177 if ( num_to_read > YY_READ_BUF_SIZE )
1178 num_to_read = YY_READ_BUF_SIZE;
1180 /* Read in more data. */
1181 YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
1182 (yy_n_chars), num_to_read );
1184 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1187 if ( (yy_n_chars) == 0 )
1189 if ( number_to_move == YY_MORE_ADJ )
1191 ret_val = EOB_ACT_END_OF_FILE;
1197 ret_val = EOB_ACT_LAST_MATCH;
1198 YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
1199 YY_BUFFER_EOF_PENDING;
1204 ret_val = EOB_ACT_CONTINUE_SCAN;
1206 (yy_n_chars) += number_to_move;
1207 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
1208 YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
1210 (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
1215 /* yy_get_previous_state - get the state just before the EOB char was reached */
1217 static yy_state_type yy_get_previous_state (void)
1219 register yy_state_type yy_current_state;
1220 register char *yy_cp;
1222 yy_current_state = (yy_start);
1224 for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
1226 register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
1227 if ( yy_accept[yy_current_state] )
1229 (yy_last_accepting_state) = yy_current_state;
1230 (yy_last_accepting_cpos) = yy_cp;
1232 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1234 yy_current_state = (int) yy_def[yy_current_state];
1235 if ( yy_current_state >= 97 )
1236 yy_c = yy_meta[(unsigned int) yy_c];
1238 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1241 return yy_current_state;
1244 /* yy_try_NUL_trans - try to make a transition on the NUL character
1247 * next_state = yy_try_NUL_trans( current_state );
1249 static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
1251 register int yy_is_jam;
1252 register char *yy_cp = (yy_c_buf_p);
1254 register YY_CHAR yy_c = 1;
1255 if ( yy_accept[yy_current_state] )
1257 (yy_last_accepting_state) = yy_current_state;
1258 (yy_last_accepting_cpos) = yy_cp;
1260 while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
1262 yy_current_state = (int) yy_def[yy_current_state];
1263 if ( yy_current_state >= 97 )
1264 yy_c = yy_meta[(unsigned int) yy_c];
1266 yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
1267 yy_is_jam = (yy_current_state == 96);
1269 return yy_is_jam ? 0 : yy_current_state;
1274 static int yyinput (void)
1276 static int input (void)
1282 *(yy_c_buf_p) = (yy_hold_char);
1284 if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
1286 /* yy_c_buf_p now points to the character we want to return.
1287 * If this occurs *before* the EOB characters, then it's a
1288 * valid NUL; if not, then we've hit the end of the buffer.
1290 if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
1291 /* This was really a NUL. */
1292 *(yy_c_buf_p) = '\0';
1295 { /* need more input */
1296 int offset = (yy_c_buf_p) - (yytext_ptr);
1299 switch ( yy_get_next_buffer( ) )
1301 case EOB_ACT_LAST_MATCH:
1302 /* This happens because yy_g_n_b()
1303 * sees that we've accumulated a
1304 * token and flags that we need to
1305 * try matching the token before
1306 * proceeding. But for input(),
1307 * there's no matching to consider.
1308 * So convert the EOB_ACT_LAST_MATCH
1309 * to EOB_ACT_END_OF_FILE.
1312 /* Reset buffer status. */
1317 case EOB_ACT_END_OF_FILE:
1322 if ( ! (yy_did_buffer_switch_on_eof) )
1331 case EOB_ACT_CONTINUE_SCAN:
1332 (yy_c_buf_p) = (yytext_ptr) + offset;
1338 c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
1339 *(yy_c_buf_p) = '\0'; /* preserve yytext */
1340 (yy_hold_char) = *++(yy_c_buf_p);
1344 #endif /* ifndef YY_NO_INPUT */
1346 /** Immediately switch to a different input stream.
1347 * @param input_file A readable stream.
1349 * @note This function does not reset the start condition to @c INITIAL .
1351 void yyrestart (FILE * input_file )
1354 if ( ! YY_CURRENT_BUFFER ){
1355 yyensure_buffer_stack ();
1356 YY_CURRENT_BUFFER_LVALUE =
1357 yy_create_buffer(yyin,YY_BUF_SIZE );
1360 yy_init_buffer(YY_CURRENT_BUFFER,input_file );
1361 yy_load_buffer_state( );
1364 /** Switch to a different input buffer.
1365 * @param new_buffer The new input buffer.
1368 void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
1371 /* TODO. We should be able to replace this entire function body
1373 * yypop_buffer_state();
1374 * yypush_buffer_state(new_buffer);
1376 yyensure_buffer_stack ();
1377 if ( YY_CURRENT_BUFFER == new_buffer )
1380 if ( YY_CURRENT_BUFFER )
1382 /* Flush out information for old buffer. */
1383 *(yy_c_buf_p) = (yy_hold_char);
1384 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1385 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1388 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1389 yy_load_buffer_state( );
1391 /* We don't actually know whether we did this switch during
1392 * EOF (yywrap()) processing, but the only time this flag
1393 * is looked at is after yywrap() is called, so it's safe
1394 * to go ahead and always set it.
1396 (yy_did_buffer_switch_on_eof) = 1;
1399 static void yy_load_buffer_state (void)
1401 (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
1402 (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
1403 yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
1404 (yy_hold_char) = *(yy_c_buf_p);
1407 /** Allocate and initialize an input buffer state.
1408 * @param file A readable stream.
1409 * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
1411 * @return the allocated buffer state.
1413 YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
1417 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1419 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1421 b->yy_buf_size = size;
1423 /* yy_ch_buf has to be 2 characters longer than the size given because
1424 * we need to put in 2 end-of-buffer characters.
1426 b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 );
1427 if ( ! b->yy_ch_buf )
1428 YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
1430 b->yy_is_our_buffer = 1;
1432 yy_init_buffer(b,file );
1437 /** Destroy the buffer.
1438 * @param b a buffer created with yy_create_buffer()
1441 void yy_delete_buffer (YY_BUFFER_STATE b )
1447 if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
1448 YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
1450 if ( b->yy_is_our_buffer )
1451 yyfree((void *) b->yy_ch_buf );
1453 yyfree((void *) b );
1457 extern int isatty (int );
1458 #endif /* __cplusplus */
1460 /* Initializes or reinitializes a buffer.
1461 * This function is sometimes called more than once on the same buffer,
1462 * such as during a yyrestart() or at EOF.
1464 static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
1469 yy_flush_buffer(b );
1471 b->yy_input_file = file;
1472 b->yy_fill_buffer = 1;
1474 /* If b is the current buffer, then yy_init_buffer was _probably_
1475 * called from yyrestart() or through yy_get_next_buffer.
1476 * In that case, we don't want to reset the lineno or column.
1478 if (b != YY_CURRENT_BUFFER){
1479 b->yy_bs_lineno = 1;
1480 b->yy_bs_column = 0;
1483 b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
1488 /** Discard all buffered characters. On the next scan, YY_INPUT will be called.
1489 * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
1492 void yy_flush_buffer (YY_BUFFER_STATE b )
1499 /* We always need two end-of-buffer characters. The first causes
1500 * a transition to the end-of-buffer state. The second causes
1501 * a jam in that state.
1503 b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
1504 b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
1506 b->yy_buf_pos = &b->yy_ch_buf[0];
1509 b->yy_buffer_status = YY_BUFFER_NEW;
1511 if ( b == YY_CURRENT_BUFFER )
1512 yy_load_buffer_state( );
1515 /** Pushes the new state onto the stack. The new state becomes
1516 * the current state. This function will allocate the stack
1518 * @param new_buffer The new state.
1521 void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
1523 if (new_buffer == NULL)
1526 yyensure_buffer_stack();
1528 /* This block is copied from yy_switch_to_buffer. */
1529 if ( YY_CURRENT_BUFFER )
1531 /* Flush out information for old buffer. */
1532 *(yy_c_buf_p) = (yy_hold_char);
1533 YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
1534 YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
1537 /* Only push if top exists. Otherwise, replace top. */
1538 if (YY_CURRENT_BUFFER)
1539 (yy_buffer_stack_top)++;
1540 YY_CURRENT_BUFFER_LVALUE = new_buffer;
1542 /* copied from yy_switch_to_buffer. */
1543 yy_load_buffer_state( );
1544 (yy_did_buffer_switch_on_eof) = 1;
1547 /** Removes and deletes the top of the stack, if present.
1548 * The next element becomes the new top.
1551 void yypop_buffer_state (void)
1553 if (!YY_CURRENT_BUFFER)
1556 yy_delete_buffer(YY_CURRENT_BUFFER );
1557 YY_CURRENT_BUFFER_LVALUE = NULL;
1558 if ((yy_buffer_stack_top) > 0)
1559 --(yy_buffer_stack_top);
1561 if (YY_CURRENT_BUFFER) {
1562 yy_load_buffer_state( );
1563 (yy_did_buffer_switch_on_eof) = 1;
1567 /* Allocates the stack if it does not exist.
1568 * Guarantees space for at least one push.
1570 static void yyensure_buffer_stack (void)
1574 if (!(yy_buffer_stack)) {
1576 /* First allocation is just for 2 elements, since we don't know if this
1577 * scanner will even need a stack. We use 2 instead of 1 to avoid an
1578 * immediate realloc on the next call.
1581 (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
1582 (num_to_alloc * sizeof(struct yy_buffer_state*)
1585 memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
1587 (yy_buffer_stack_max) = num_to_alloc;
1588 (yy_buffer_stack_top) = 0;
1592 if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
1594 /* Increase the buffer to prepare for a possible push. */
1595 int grow_size = 8 /* arbitrary grow size */;
1597 num_to_alloc = (yy_buffer_stack_max) + grow_size;
1598 (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
1600 num_to_alloc * sizeof(struct yy_buffer_state*)
1603 /* zero only the new slots.*/
1604 memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
1605 (yy_buffer_stack_max) = num_to_alloc;
1609 /** Setup the input buffer state to scan directly from a user-specified character buffer.
1610 * @param base the character buffer
1611 * @param size the size in bytes of the character buffer
1613 * @return the newly allocated buffer state object.
1615 YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
1620 base[size-2] != YY_END_OF_BUFFER_CHAR ||
1621 base[size-1] != YY_END_OF_BUFFER_CHAR )
1622 /* They forgot to leave room for the EOB's. */
1625 b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
1627 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
1629 b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
1630 b->yy_buf_pos = b->yy_ch_buf = base;
1631 b->yy_is_our_buffer = 0;
1632 b->yy_input_file = 0;
1633 b->yy_n_chars = b->yy_buf_size;
1634 b->yy_is_interactive = 0;
1636 b->yy_fill_buffer = 0;
1637 b->yy_buffer_status = YY_BUFFER_NEW;
1639 yy_switch_to_buffer(b );
1644 /** Setup the input buffer state to scan a string. The next call to yylex() will
1645 * scan from a @e copy of @a str.
1646 * @param str a NUL-terminated string to scan
1648 * @return the newly allocated buffer state object.
1649 * @note If you want to scan bytes that may contain NUL values, then use
1650 * yy_scan_bytes() instead.
1652 YY_BUFFER_STATE yy_scan_string (yyconst char * yy_str )
1655 return yy_scan_bytes(yy_str,strlen(yy_str) );
1658 /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
1659 * scan from a @e copy of @a bytes.
1660 * @param bytes the byte buffer to scan
1661 * @param len the number of bytes in the buffer pointed to by @a bytes.
1663 * @return the newly allocated buffer state object.
1665 YY_BUFFER_STATE yy_scan_bytes (yyconst char * bytes, int len )
1672 /* Get memory for full buffer, including space for trailing EOB's. */
1674 buf = (char *) yyalloc(n );
1676 YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
1678 for ( i = 0; i < len; ++i )
1681 buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
1683 b = yy_scan_buffer(buf,n );
1685 YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
1687 /* It's okay to grow etc. this buffer, and we should throw it
1688 * away when we're done.
1690 b->yy_is_our_buffer = 1;
1695 #ifndef YY_EXIT_FAILURE
1696 #define YY_EXIT_FAILURE 2
1699 static void yy_fatal_error (yyconst char* msg )
1701 (void) fprintf( stderr, "%s\n", msg );
1702 exit( YY_EXIT_FAILURE );
1705 /* Redefine yyless() so it works in section 3 code. */
1711 /* Undo effects of setting up yytext. */ \
1712 int yyless_macro_arg = (n); \
1713 YY_LESS_LINENO(yyless_macro_arg);\
1714 yytext[yyleng] = (yy_hold_char); \
1715 (yy_c_buf_p) = yytext + yyless_macro_arg; \
1716 (yy_hold_char) = *(yy_c_buf_p); \
1717 *(yy_c_buf_p) = '\0'; \
1718 yyleng = yyless_macro_arg; \
1722 /* Accessor methods (get/set functions) to struct members. */
1724 /** Get the current line number.
1727 int yyget_lineno (void)
1733 /** Get the input stream.
1736 FILE *yyget_in (void)
1741 /** Get the output stream.
1744 FILE *yyget_out (void)
1749 /** Get the length of the current token.
1752 int yyget_leng (void)
1757 /** Get the current token.
1761 char *yyget_text (void)
1766 /** Set the current line number.
1767 * @param line_number
1770 void yyset_lineno (int line_number )
1773 yylineno = line_number;
1776 /** Set the input stream. This does not discard the current
1778 * @param in_str A readable stream.
1780 * @see yy_switch_to_buffer
1782 void yyset_in (FILE * in_str )
1787 void yyset_out (FILE * out_str )
1792 int yyget_debug (void)
1794 return yy_flex_debug;
1797 void yyset_debug (int bdebug )
1799 yy_flex_debug = bdebug ;
1802 /* yylex_destroy is for both reentrant and non-reentrant scanners. */
1803 int yylex_destroy (void)
1806 /* Pop the buffer stack, destroying each element. */
1807 while(YY_CURRENT_BUFFER){
1808 yy_delete_buffer(YY_CURRENT_BUFFER );
1809 YY_CURRENT_BUFFER_LVALUE = NULL;
1810 yypop_buffer_state();
1813 /* Destroy the stack itself. */
1814 yyfree((yy_buffer_stack) );
1815 (yy_buffer_stack) = NULL;
1821 * Internal utility routines.
1825 static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
1828 for ( i = 0; i < n; ++i )
1833 #ifdef YY_NEED_STRLEN
1834 static int yy_flex_strlen (yyconst char * s )
1837 for ( n = 0; s[n]; ++n )
1844 void *yyalloc (yy_size_t size )
1846 return (void *) malloc( size );
1849 void *yyrealloc (void * ptr, yy_size_t size )
1851 /* The cast to (char *) in the following accommodates both
1852 * implementations that use char* generic pointers, and those
1853 * that use void* generic pointers. It works with the latter
1854 * because both ANSI C and C++ allow castless assignment from
1855 * any pointer type to void*, and deal with argument conversions
1856 * as though doing an assignment.
1858 return (void *) realloc( (char *) ptr, size );
1861 void yyfree (void * ptr )
1863 free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
1866 #define YYTABLES_NAME "yytables"
1869 #undef YY_FLUSH_BUFFER
1871 #undef yy_new_buffer
1872 #undef yy_set_interactive
1874 #undef YY_DO_BEFORE_ACTION
1876 #ifdef YY_DECL_IS_OURS
1877 #undef YY_DECL_IS_OURS
1880 #line 137 "policy_token.l"
1884 void __policy__strbuffer__init__ __P((char *));
1885 void __policy__strbuffer__free__ __P((void));
1887 static YY_BUFFER_STATE strbuffer;
1890 __policy__strbuffer__init__(msg)
1893 #if YY_FLEX_MAJOR_VERSION==2 && YY_FLEX_MINOR_VERSION==5 && YY_FLEX_SUBMINOR_VERSION>30
1894 if (YY_CURRENT_BUFFER)
1895 yy_delete_buffer(YY_CURRENT_BUFFER);
1898 if (yy_current_buffer)
1899 yy_delete_buffer(yy_current_buffer);
1901 strbuffer = (YY_BUFFER_STATE)yy_scan_string(msg);
1902 yy_switch_to_buffer(strbuffer);
1908 __policy__strbuffer__free__()
1910 yy_delete_buffer(strbuffer);