diff options
author | Manoj Srivastava <srivasta@golden-gryphon.com> | 2006-02-26 11:25:45 -0800 |
---|---|---|
committer | Manoj Srivastava <srivasta@golden-gryphon.com> | 2006-02-26 11:25:45 -0800 |
commit | 8b69e240c2db8dd998a1f285a33a9dc7952c5a4d (patch) | |
tree | cc09f9873e88f53ad1549606451e5c7c250f8b83 /skel.c | |
parent | 174cabe1a0b3cc6b2a061106f74e9b1c04252eec (diff) |
Imported Upstream version 2.5.34
Diffstat (limited to 'skel.c')
-rw-r--r-- | skel.c | 156 |
1 files changed, 136 insertions, 20 deletions
@@ -59,10 +59,38 @@ const char *skel[] = { "%# the generated scanner as a C-style comment. This is to aid those who", "%# edit the skeleton.", "%#", + "", + "%not-for-header", + "%if-c-only", + "%if-not-reentrant", + "m4_ifelse(M4_YY_PREFIX,yy,,", + "#define yy_create_buffer M4_YY_PREFIX[[_create_buffer]]", + "#define yy_delete_buffer M4_YY_PREFIX[[_delete_buffer]]", + "#define yy_flex_debug M4_YY_PREFIX[[_flex_debug]]", + "#define yy_init_buffer M4_YY_PREFIX[[_init_buffer]]", + "#define yy_flush_buffer M4_YY_PREFIX[[_flush_buffer]]", + "#define yy_load_buffer_state M4_YY_PREFIX[[_load_buffer_state]]", + "#define yy_switch_to_buffer M4_YY_PREFIX[[_switch_to_buffer]]", + "#define yyin M4_YY_PREFIX[[in]]", + "#define yyleng M4_YY_PREFIX[[leng]]", + "#define yylex M4_YY_PREFIX[[lex]]", + "#define yylineno M4_YY_PREFIX[[lineno]]", + "#define yyout M4_YY_PREFIX[[out]]", + "#define yyrestart M4_YY_PREFIX[[restart]]", + "#define yytext M4_YY_PREFIX[[text]]", + "#define yywrap M4_YY_PREFIX[[wrap]]", + "#define yyalloc M4_YY_PREFIX[[alloc]]", + "#define yyrealloc M4_YY_PREFIX[[realloc]]", + "#define yyfree M4_YY_PREFIX[[free]]", + ")", + "%endif", + "%endif", + "%ok-for-header", + "", "#define FLEX_SCANNER", "#define YY_FLEX_MAJOR_VERSION 2", "#define YY_FLEX_MINOR_VERSION 5", - "#define YY_FLEX_SUBMINOR_VERSION 33", + "#define YY_FLEX_SUBMINOR_VERSION 34", "#if YY_FLEX_SUBMINOR_VERSION > 0", "#define FLEX_BETA", "#endif", @@ -110,6 +138,7 @@ const char *skel[] = { " m4_define(yy[[lex]], [[M4_YY_PREFIX[[lex]]m4_ifelse($#,0,,[[($@)]])]])", " m4_define(yy[[restart]], [[M4_YY_PREFIX[[restart]]m4_ifelse($#,0,,[[($@)]])]])", " m4_define(yy[[lex_init]], [[M4_YY_PREFIX[[lex_init]]m4_ifelse($#,0,,[[($@)]])]])", + " m4_define(yy[[lex_init_extra]], [[M4_YY_PREFIX[[lex_init_extra]]m4_ifelse($#,0,,[[($@)]])]])", " m4_define(yy[[lex_destroy]], [[M4_YY_PREFIX[[lex_destroy]]m4_ifelse($#,0,,[[($@)]])]])", " m4_define(yy[[get_debug]], [[M4_YY_PREFIX[[get_debug]]m4_ifelse($#,0,,[[($@)]])]])", " m4_define(yy[[set_debug]], [[M4_YY_PREFIX[[set_debug]]m4_ifelse($#,0,,[[($@)]])]])", @@ -192,7 +221,7 @@ const char *skel[] = { "", "/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */", "", - "#if __STDC_VERSION__ >= 199901L", + "#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L", "", "/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,", " * if you want the limit (max/min) macros for int types. ", @@ -267,11 +296,12 @@ const char *skel[] = { "", "#else /* ! __cplusplus */", "", - "#if __STDC__", + "/* C99 requires __STDC__ to be defined as 1. */", + "#if defined (__STDC__)", "", "#define YY_USE_CONST", "", - "#endif /* __STDC__ */", + "#endif /* defined (__STDC__) */", "#endif /* ! __cplusplus */", "", "#ifdef YY_USE_CONST", @@ -369,7 +399,6 @@ const char *skel[] = { " }while(0)", "]])", "", - "int yylex_init M4_YY_PARAMS(yyscan_t* scanner);", "%endif", "", "", @@ -479,13 +508,13 @@ const char *skel[] = { "#define YY_END_OF_BUFFER_CHAR 0", "]])", "", - "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],", - "[[", "/* Size of default input buffer. */", "#ifndef YY_BUF_SIZE", "#define YY_BUF_SIZE 16384", "#endif", "", + "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],", + "[[", "/* The state buf must be large enough to hold one state per character in the main buffer.", " */", "#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))", @@ -817,9 +846,16 @@ const char *skel[] = { "#endif", "]])", "", + "m4_ifdef( [[M4_EXTRA_TYPE_DEFS]],", + "[[", + "#define YY_EXTRA_TYPE M4_EXTRA_TYPE_DEFS", + "]],", + "[[", "#ifndef YY_EXTRA_TYPE", "#define YY_EXTRA_TYPE void *", "#endif", + "]]", + ")", "", "%if-c-only Reentrant structure and macros (non-C++).", "%if-reentrant", @@ -860,6 +896,12 @@ const char *skel[] = { " yy_state_type *yy_state_ptr;", " char *yy_full_match;", " int yy_lp;", + "", + " /* These are only needed for trailing context rules,", + " * but there's no conditional variable for that yet. */", + " int yy_looking_for_trail_begin;", + " int yy_full_lp;", + " int *yy_full_state;", "]])", "", "m4_ifdef( [[M4_YY_TEXT_IS_ARRAY]],", @@ -913,6 +955,10 @@ const char *skel[] = { " ]])", "]])", "", + "int yylex_init M4_YY_PARAMS(yyscan_t* scanner);", + "", + "int yylex_init_extra M4_YY_PARAMS( YY_EXTRA_TYPE user_defined, yyscan_t* scanner);", + "", "%endif", "", "/* Accessor methods to globals.", @@ -1099,7 +1145,7 @@ const char *skel[] = { "/* This used to be an fputs(), but since the string might contain NUL's,", " * we now use fwrite().", " */", - "#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )", + "#define ECHO fwrite( yytext, yyleng, 1, yyout )", "%endif", "%if-c++-only C++ definition", "#define ECHO LexerOutput( yytext, yyleng )", @@ -1351,9 +1397,9 @@ const char *skel[] = { " m4_dnl The bison pure parser is used. Redefine yylex to", " m4_dnl accept the lval parameter.", "", - " m4_define( [[M4_YY_LEX_PROTO]],", + " m4_define( [[M4_YY_LEX_PROTO]], [[\\]]", " [[M4_YY_PARAMS(YYSTYPE * yylval_param M4_YY_PROTO_LAST_ARG)]])", - " m4_define( [[M4_YY_LEX_DECLARATION]],", + " m4_define( [[M4_YY_LEX_DECLARATION]], [[\\]]", " [[YYFARGS1(YYSTYPE *,yylval_param)]])", "]])", "", @@ -1361,9 +1407,9 @@ const char *skel[] = { "[[", " m4_dnl Locations are used. yylex should also accept the ylloc parameter.", "", - " m4_define( [[M4_YY_LEX_PROTO]],", + " m4_define( [[M4_YY_LEX_PROTO]], [[\\]]", " [[M4_YY_PARAMS(YYSTYPE * yylval_param, YYLTYPE * yylloc_param M4_YY_PROTO_LAST_ARG)]])", - " m4_define( [[M4_YY_LEX_DECLARATION]],", + " m4_define( [[M4_YY_LEX_DECLARATION]], [[\\]]", " [[YYFARGS2(YYSTYPE *,yylval_param, YYLTYPE *,yylloc_param)]])", "]])", "", @@ -1446,6 +1492,8 @@ const char *skel[] = { " /* Create the reject buffer large enough to save one state per allowed character. */", " if ( ! YY_G(yy_state_buf) )", " YY_G(yy_state_buf) = (yy_state_type *)yyalloc(YY_STATE_BUF_SIZE M4_YY_CALL_LAST_ARG);", + " if ( ! YY_G(yy_state_buf) )", + " YY_FATAL_ERROR( \"out of dynamic memory in yylex()\" );", "]])", "", " if ( ! YY_G(yy_start) )", @@ -1638,6 +1686,8 @@ const char *skel[] = { "", "%if-c++-only", "%not-for-header", + "/* The contents of this function are C++ specific, so the YY_G macro is not used.", + " */", "yyFlexLexer::yyFlexLexer( std::istream* arg_yyin, std::ostream* arg_yyout )", "{", " yyin = arg_yyin;", @@ -1658,9 +1708,9 @@ const char *skel[] = { " yy_start_stack_ptr = yy_start_stack_depth = 0;", " yy_start_stack = NULL;", "", - " YY_G(yy_buffer_stack) = 0;", - " YY_G(yy_buffer_stack_top) = 0;", - " YY_G(yy_buffer_stack_max) = 0;", + " yy_buffer_stack = 0;", + " yy_buffer_stack_top = 0;", + " yy_buffer_stack_max = 0;", "", "", "m4_ifdef( [[M4_YY_USES_REJECT]],", @@ -1672,13 +1722,18 @@ const char *skel[] = { "]])", "}", "", + "/* The contents of this function are C++ specific, so the YY_G macro is not used.", + " */", "yyFlexLexer::~yyFlexLexer()", "{", " delete [] yy_state_buf;", " yyfree( yy_start_stack M4_YY_CALL_LAST_ARG );", " yy_delete_buffer( YY_CURRENT_BUFFER M4_YY_CALL_LAST_ARG);", + " yyfree( yy_buffer_stack M4_YY_CALL_LAST_ARG );", "}", "", + "/* The contents of this function are C++ specific, so the YY_G macro is not used.", + " */", "void yyFlexLexer::switch_streams( std::istream* new_in, std::ostream* new_out )", "{", " if ( new_in )", @@ -1840,7 +1895,7 @@ const char *skel[] = { "", " /* Read in more data. */", " YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),", - " YY_G(yy_n_chars), num_to_read );", + " YY_G(yy_n_chars), (size_t) num_to_read );", "", " YY_CURRENT_BUFFER_LVALUE->yy_n_chars = YY_G(yy_n_chars);", " }", @@ -1864,6 +1919,15 @@ const char *skel[] = { " else", " ret_val = EOB_ACT_CONTINUE_SCAN;", "", + " if ((yy_size_t) (YY_G(yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {", + " /* Extend the array by 50%, plus the number we really need. */", + " yy_size_t new_size = YY_G(yy_n_chars) + number_to_move + (YY_G(yy_n_chars) >> 1);", + " YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(", + " (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, new_size M4_YY_CALL_LAST_ARG );", + " if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )", + " YY_FATAL_ERROR( \"out of dynamic memory in yy_get_next_buffer()\" );", + " }", + "", " YY_G(yy_n_chars) += number_to_move;", " YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;", " YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[YY_G(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;", @@ -2397,6 +2461,9 @@ const char *skel[] = { " YY_G(yy_buffer_stack) = (struct yy_buffer_state**)yyalloc", " (num_to_alloc * sizeof(struct yy_buffer_state*)", " M4_YY_CALL_LAST_ARG);", + " if ( ! YY_G(yy_buffer_stack) )", + " YY_FATAL_ERROR( \"out of dynamic memory in yyensure_buffer_stack()\" );", + " ", " ", " memset(YY_G(yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));", " ", @@ -2415,6 +2482,8 @@ const char *skel[] = { " (YY_G(yy_buffer_stack),", " num_to_alloc * sizeof(struct yy_buffer_state*)", " M4_YY_CALL_LAST_ARG);", + " if ( ! YY_G(yy_buffer_stack) )", + " YY_FATAL_ERROR( \"out of dynamic memory in yyensure_buffer_stack()\" );", "", " /* zero only the new slots.*/", " memset(YY_G(yy_buffer_stack) + YY_G(yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));", @@ -2473,7 +2542,7 @@ const char *skel[] = { "%if-c-only", "/** Setup the input buffer state to scan a string. The next call to yylex() will", " * scan from a @e copy of @a str.", - " * @param str a NUL-terminated string to scan", + " * @param yystr a NUL-terminated string to scan", " * M4_YY_DOC_PARAM", " * @return the newly allocated buffer state object.", " * @note If you want to scan bytes that may contain NUL values, then use", @@ -2558,8 +2627,7 @@ const char *skel[] = { " (void *) YY_G(yy_start_stack), new_size M4_YY_CALL_LAST_ARG );", "", " if ( ! YY_G(yy_start_stack) )", - " YY_FATAL_ERROR(", - " \"out of memory expanding start-condition stack\" );", + " YY_FATAL_ERROR( \"out of memory expanding start-condition stack\" );", " }", "", " YY_G(yy_start_stack)[YY_G(yy_start_stack_ptr)++] = YY_START;", @@ -2927,7 +2995,51 @@ const char *skel[] = { " return yy_init_globals ( *ptr_yy_globals );", "}", "", - "%endif", + "", + "/* yylex_init_extra has the same functionality as yylex_init, but follows the", + " * convention of taking the scanner as the last argument. Note however, that", + " * this is a *pointer* to a scanner, as it will be allocated by this call (and", + " * is the reason, too, why this function also must handle its own declaration).", + " * The user defined value in the first argument will be available to yyalloc in", + " * the yyextra field.", + " */", + "m4_ifdef( [[M4_YY_NO_ANSI_FUNC_DEFS]],", + "[[", + "int yylex_init_extra( yy_user_defined, ptr_yy_globals )", + " YY_EXTRA_TYPE yy_user_defined;", + " yyscan_t* ptr_yy_globals;", + "]],", + "[[", + "int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals )", + "]])", + "{", + " struct yyguts_t dummy_yyguts;", + "", + " yyset_extra (yy_user_defined, &dummy_yyguts);", + "", + " if (ptr_yy_globals == NULL){", + " errno = EINVAL;", + " return 1;", + " }", + " ", + " *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );", + " ", + " if (*ptr_yy_globals == NULL){", + " errno = ENOMEM;", + " return 1;", + " }", + " ", + " /* By setting to 0xAA, we expose bugs in", + " yy_init_globals. Leave at 0x00 for releases. */", + " memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));", + " ", + " yyset_extra (yy_user_defined, *ptr_yy_globals);", + " ", + " return yy_init_globals ( *ptr_yy_globals );", + "}", + "", + "%endif if-c-only", + "", "", "%if-c-only", "static int yy_init_globals YYFARGS0(void)", @@ -3235,6 +3347,8 @@ const char *skel[] = { " /* Allocate enough space for the version and name fields */", " bytes = th->th_hsize - 14;", " th->th_version = (char *) yyalloc (bytes M4_YY_CALL_LAST_ARG);", + " if ( ! th->th_version )", + " YY_FATAL_ERROR( \"out of dynamic memory in yytbl_hdr_read()\" );", "", " /* we read it all into th_version, and point th_name into that data */", " if (fread (th->th_version, 1, bytes, rd->fp) != bytes){", @@ -3314,6 +3428,8 @@ const char *skel[] = { " else", " /* We point to the address of a pointer. */", " *dmap->dm_arr = p = (void *) yyalloc (bytes M4_YY_CALL_LAST_ARG);", + " if ( ! p )", + " YY_FATAL_ERROR( \"out of dynamic memory in yytbl_data_load()\" );", " }", "", " /* If it's a struct, we read 2 integers to get one element */", |