diff options
Diffstat (limited to 'src/starter/lex.yy.c')
-rw-r--r-- | src/starter/lex.yy.c | 244 |
1 files changed, 127 insertions, 117 deletions
diff --git a/src/starter/lex.yy.c b/src/starter/lex.yy.c index 8edb9e3e6..4596c0cc3 100644 --- a/src/starter/lex.yy.c +++ b/src/starter/lex.yy.c @@ -141,7 +141,15 @@ typedef unsigned int flex_uint32_t; /* Size of default input buffer. */ #ifndef YY_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k. + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. + * Ditto for the __ia64__ case accordingly. + */ +#define YY_BUF_SIZE 32768 +#else #define YY_BUF_SIZE 16384 +#endif /* __ia64__ */ #endif /* The state buf must be large enough to hold one state per character in the main buffer. @@ -479,8 +487,9 @@ int yy_flex_debug = 0; #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET char *yytext; -#line 1 "parser.l" -#line 2 "parser.l" +#line 1 "./parser.l" +#define YY_NO_INPUT 1 +#line 4 "./parser.l" /* FreeS/WAN config file parser (parser.l) * Copyright (C) 2001 Mathieu Lafon - Arkoon Network Security * @@ -493,8 +502,6 @@ char *yytext; * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. - * - * RCSID $Id: parser.l 4632 2008-11-11 18:37:19Z martin $ */ #include <string.h> @@ -505,8 +512,6 @@ char *yytext; #define MAX_INCLUDE_DEPTH 20 -#define YY_NO_INPUT -#define YY_NO_UNPUT extern void yyerror(const char *); extern int yylex (void); @@ -525,94 +530,94 @@ int _parser_y_include (const char *filename); void _parser_y_error(char *b, int size, const char *s) { - extern char *yytext; // was: char yytext[]; + extern char *yytext; // was: char yytext[]; - snprintf(b, size, "%s:%d: %s [%s]", - __parser_y_private.filename[__parser_y_private.stack_ptr], - __parser_y_private.line[__parser_y_private.stack_ptr], - s, yytext); + snprintf(b, size, "%s:%d: %s [%s]", + __parser_y_private.filename[__parser_y_private.stack_ptr], + __parser_y_private.line[__parser_y_private.stack_ptr], + s, yytext); } void _parser_y_init (const char *f) { - memset(&__parser_y_private, 0, sizeof(__parser_y_private)); - __parser_y_private.line[0] = 1; - __parser_y_private.filename[0] = strdup(f); + memset(&__parser_y_private, 0, sizeof(__parser_y_private)); + __parser_y_private.line[0] = 1; + __parser_y_private.filename[0] = strdup(f); } void _parser_y_fini (void) { - unsigned int i; - - for (i = 0; i < MAX_INCLUDE_DEPTH; i++) - { - if (__parser_y_private.filename[i]) - free(__parser_y_private.filename[i]); - if (__parser_y_private.file[i]) - fclose(__parser_y_private.file[i]); - } - memset(&__parser_y_private, 0, sizeof(__parser_y_private)); + unsigned int i; + + for (i = 0; i < MAX_INCLUDE_DEPTH; i++) + { + if (__parser_y_private.filename[i]) + free(__parser_y_private.filename[i]); + if (__parser_y_private.file[i]) + fclose(__parser_y_private.file[i]); + } + memset(&__parser_y_private, 0, sizeof(__parser_y_private)); } int _parser_y_include (const char *filename) { - glob_t files; - int i, ret; - - ret = glob(filename, GLOB_ERR, NULL, &files); - if (ret) - { - const char *err; + glob_t files; + int i, ret; - switch (ret) + ret = glob(filename, GLOB_ERR, NULL, &files); + if (ret) { - case GLOB_NOSPACE: - err = "include files ran out of memory"; - break; - case GLOB_ABORTED: - err = "include files aborted due to read error"; - break; - case GLOB_NOMATCH: - err = "include files found no matches"; - break; - default: - err = "unknown include files error"; - } - yyerror(err); - return 1; - } - - for (i = 0; i < files.gl_pathc; i++) - { - FILE *f; - unsigned int p = __parser_y_private.stack_ptr + 1; + const char *err; - if (p >= MAX_INCLUDE_DEPTH) - { - yyerror("max inclusion depth reached"); - return 1; + switch (ret) + { + case GLOB_NOSPACE: + err = "include files ran out of memory"; + break; + case GLOB_ABORTED: + err = "include files aborted due to read error"; + break; + case GLOB_NOMATCH: + err = "include files found no matches"; + break; + default: + err = "unknown include files error"; + } + yyerror(err); + return 1; } - f = fopen(files.gl_pathv[i], "r"); - if (!f) + for (i = 0; i < files.gl_pathc; i++) { - yyerror("can't open include filename"); - continue; - } + FILE *f; + unsigned int p = __parser_y_private.stack_ptr + 1; - __parser_y_private.stack_ptr++; - __parser_y_private.file[p] = f; - __parser_y_private.stack[p] = YY_CURRENT_BUFFER; - __parser_y_private.line[p] = 1; - __parser_y_private.filename[p] = strdup(files.gl_pathv[i]); + if (p >= MAX_INCLUDE_DEPTH) + { + yyerror("max inclusion depth reached"); + return 1; + } - yy_switch_to_buffer(yy_create_buffer(f,YY_BUF_SIZE)); - } - globfree(&files); - return 0; + f = fopen(files.gl_pathv[i], "r"); + if (!f) + { + yyerror("can't open include filename"); + continue; + } + + __parser_y_private.stack_ptr++; + __parser_y_private.file[p] = f; + __parser_y_private.stack[p] = YY_CURRENT_BUFFER; + __parser_y_private.line[p] = 1; + __parser_y_private.filename[p] = strdup(files.gl_pathv[i]); + + yy_switch_to_buffer(yy_create_buffer(f,YY_BUF_SIZE)); + } + globfree(&files); + return 0; } -#line 616 "lex.yy.c" +#line 621 "lex.yy.c" #define INITIAL 0 @@ -691,7 +696,12 @@ static int input (void ); /* Amount of stuff to slurp up with each read. */ #ifndef YY_READ_BUF_SIZE +#ifdef __ia64__ +/* On IA-64, the buffer size is 16k, not 8k */ +#define YY_READ_BUF_SIZE 16384 +#else #define YY_READ_BUF_SIZE 8192 +#endif /* __ia64__ */ #endif /* Copy whatever the last rule matched to the standard output. */ @@ -795,10 +805,10 @@ YY_DECL register char *yy_cp, *yy_bp; register int yy_act; -#line 135 "parser.l" +#line 133 "./parser.l" -#line 802 "lex.yy.c" +#line 812 "lex.yy.c" if ( !(yy_init) ) { @@ -883,106 +893,106 @@ do_action: /* This label is used only to access EOF actions. */ goto yy_find_action; case YY_STATE_EOF(INITIAL): -#line 137 "parser.l" +#line 135 "./parser.l" { - if (__parser_y_private.filename[__parser_y_private.stack_ptr]) { - free(__parser_y_private.filename[__parser_y_private.stack_ptr]); - __parser_y_private.filename[__parser_y_private.stack_ptr] = NULL; - } - if (__parser_y_private.file[__parser_y_private.stack_ptr]) { - fclose(__parser_y_private.file[__parser_y_private.stack_ptr]); - __parser_y_private.file[__parser_y_private.stack_ptr] = NULL; - yy_delete_buffer (YY_CURRENT_BUFFER); - yy_switch_to_buffer - (__parser_y_private.stack[__parser_y_private.stack_ptr]); - } - if (--__parser_y_private.stack_ptr < 0) { - yyterminate(); - } + if (__parser_y_private.filename[__parser_y_private.stack_ptr]) { + free(__parser_y_private.filename[__parser_y_private.stack_ptr]); + __parser_y_private.filename[__parser_y_private.stack_ptr] = NULL; + } + if (__parser_y_private.file[__parser_y_private.stack_ptr]) { + fclose(__parser_y_private.file[__parser_y_private.stack_ptr]); + __parser_y_private.file[__parser_y_private.stack_ptr] = NULL; + yy_delete_buffer (YY_CURRENT_BUFFER); + yy_switch_to_buffer + (__parser_y_private.stack[__parser_y_private.stack_ptr]); + } + if (--__parser_y_private.stack_ptr < 0) { + yyterminate(); + } } YY_BREAK case 1: YY_RULE_SETUP -#line 154 "parser.l" +#line 152 "./parser.l" return FIRST_SPACES; YY_BREAK case 2: YY_RULE_SETUP -#line 156 "parser.l" +#line 154 "./parser.l" /* ignore spaces in line */ ; YY_BREAK case 3: YY_RULE_SETUP -#line 158 "parser.l" +#line 156 "./parser.l" return EQUAL; YY_BREAK case 4: /* rule 4 can match eol */ YY_RULE_SETUP -#line 160 "parser.l" +#line 158 "./parser.l" { - __parser_y_private.line[__parser_y_private.stack_ptr]++; - return EOL; - } + __parser_y_private.line[__parser_y_private.stack_ptr]++; + return EOL; + } YY_BREAK case 5: YY_RULE_SETUP -#line 165 "parser.l" +#line 163 "./parser.l" return CONFIG; YY_BREAK case 6: YY_RULE_SETUP -#line 166 "parser.l" +#line 164 "./parser.l" return SETUP; YY_BREAK case 7: YY_RULE_SETUP -#line 167 "parser.l" +#line 165 "./parser.l" return CONN; YY_BREAK case 8: YY_RULE_SETUP -#line 168 "parser.l" +#line 166 "./parser.l" return CA; YY_BREAK case 9: YY_RULE_SETUP -#line 169 "parser.l" +#line 167 "./parser.l" return INCLUDE; YY_BREAK case 10: YY_RULE_SETUP -#line 170 "parser.l" +#line 168 "./parser.l" return FILE_VERSION; YY_BREAK case 11: YY_RULE_SETUP -#line 172 "parser.l" +#line 170 "./parser.l" { - yylval.s = strdup(yytext); - return STRING; - } + yylval.s = strdup(yytext); + return STRING; + } YY_BREAK case 12: YY_RULE_SETUP -#line 177 "parser.l" +#line 175 "./parser.l" { - yylval.s = strdup(yytext+1); - if (yylval.s) yylval.s[strlen(yylval.s)-1]='\0'; - return STRING; - } + yylval.s = strdup(yytext+1); + if (yylval.s) yylval.s[strlen(yylval.s)-1]='\0'; + return STRING; + } YY_BREAK case 13: YY_RULE_SETUP -#line 183 "parser.l" +#line 181 "./parser.l" yyerror(yytext); YY_BREAK case 14: YY_RULE_SETUP -#line 185 "parser.l" +#line 183 "./parser.l" ECHO; YY_BREAK -#line 986 "lex.yy.c" +#line 996 "lex.yy.c" case YY_END_OF_BUFFER: { @@ -1704,8 +1714,8 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) /** Setup the input buffer state to scan the given bytes. The next call to yylex() will * scan from a @e copy of @a bytes. - * @param bytes the byte buffer to scan - * @param len the number of bytes in the buffer pointed to by @a bytes. + * @param yybytes the byte buffer to scan + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ @@ -1944,13 +1954,13 @@ void yyfree (void * ptr ) #define YYTABLES_NAME "yytables" -#line 185 "parser.l" +#line 183 "./parser.l" int yywrap(void) { - return 1; + return 1; } |