From 6c7f4c1e3244a8f272d156dcfb3e2fb76725c215 Mon Sep 17 00:00:00 2001 From: Steve Murphy Date: Thu, 28 Dec 2006 17:56:21 +0000 Subject: Jason is having problems with the inclusion of ; it appears to be unnecessary for sucessful builds, so I either removed or commented out the inclusions from all the AEL related code. New outputs from bison/flex are included, etc. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@49019 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- main/ast_expr2f.c | 154 +++++++++++++++++++++++++----------------------------- 1 file changed, 71 insertions(+), 83 deletions(-) (limited to 'main/ast_expr2f.c') diff --git a/main/ast_expr2f.c b/main/ast_expr2f.c index eb4691dc4..3fec4a216 100644 --- a/main/ast_expr2f.c +++ b/main/ast_expr2f.c @@ -9,7 +9,7 @@ #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 31 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -31,15 +31,7 @@ /* C99 systems have . Non-C99 systems may or may not. */ -#if __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. - */ -#ifndef __STDC_LIMIT_MACROS -#define __STDC_LIMIT_MACROS 1 -#endif - +#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L #include typedef int8_t flex_int8_t; typedef uint8_t flex_uint8_t; @@ -162,10 +154,6 @@ int ast_yylex_init (yyscan_t* scanner); #define YY_BUF_SIZE 16384 #endif -/* 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)) - #ifndef YY_TYPEDEF_YY_BUFFER_STATE #define YY_TYPEDEF_YY_BUFFER_STATE typedef struct yy_buffer_state *YY_BUFFER_STATE; @@ -1367,7 +1355,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include #include #if !defined(SOLARIS) && !defined(__CYGWIN__) -#include +/* #include */ #else #define quad_t int64_t #endif @@ -1423,19 +1411,17 @@ int ast_yyget_column(yyscan_t yyscanner); static int curlycount = 0; static char *expr2_token_subst(char *mess); -#line 1427 "ast_expr2f.c" +#line 1415 "ast_expr2f.c" #define INITIAL 0 #define var 1 #define trail 2 -#ifndef YY_NO_UNISTD_H /* Special case for "unistd.h", since it is non-ANSI. We include it way * down here because we want the user's section 1 to have been scanned first. * The user has a chance to override it with an option. */ #include -#endif #ifndef YY_EXTRA_TYPE #define YY_EXTRA_TYPE void * @@ -1479,8 +1465,6 @@ struct yyguts_t }; /* end struct yyguts_t */ -static int yy_init_globals (yyscan_t yyscanner ); - /* This must go here because YYSTYPE and YYLTYPE are included * from bison output in section 1.*/ # define yylval yyg->yylval_r @@ -1615,11 +1599,9 @@ static int input (yyscan_t yyscanner ); #ifndef YY_DECL #define YY_DECL_IS_OURS 1 -extern int ast_yylex \ - (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner); +extern int ast_yylex (YYSTYPE * yylval_param,YYLTYPE * yylloc_param ,yyscan_t yyscanner); -#define YY_DECL int ast_yylex \ - (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner) +#define YY_DECL int ast_yylex (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner) #endif /* !YY_DECL */ /* Code executed at the beginning of each rule, after yytext and yyleng @@ -1649,15 +1631,15 @@ YY_DECL #line 104 "ast_expr2.fl" -#line 1653 "ast_expr2f.c" +#line 1635 "ast_expr2f.c" yylval = yylval_param; yylloc = yylloc_param; - if ( !yyg->yy_init ) + if ( yyg->yy_init ) { - yyg->yy_init = 1; + yyg->yy_init = 0; #ifdef YY_USER_INIT YY_USER_INIT; @@ -1966,7 +1948,7 @@ YY_RULE_SETUP #line 205 "ast_expr2.fl" ECHO; YY_BREAK -#line 1970 "ast_expr2f.c" +#line 1952 "ast_expr2f.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(var): yyterminate(); @@ -2154,7 +2136,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) else { - int num_to_read = + size_t num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) @@ -2199,7 +2181,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), - yyg->yy_n_chars, (size_t) num_to_read ); + yyg->yy_n_chars, num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; } @@ -2268,7 +2250,7 @@ static int yy_get_next_buffer (yyscan_t yyscanner) static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner) { register int yy_is_jam; - struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */ + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; register char *yy_cp = yyg->yy_c_buf_p; yy_current_state = yy_NUL_trans[yy_current_state]; @@ -2708,26 +2690,26 @@ YY_BUFFER_STATE ast_yy_scan_buffer (char * base, yy_size_t size , yyscan_t yys /** Setup the input buffer state to scan a string. The next call to ast_yylex() will * scan from a @e copy of @a str. - * @param yystr a NUL-terminated string to scan + * @param str a NUL-terminated string to scan * @param yyscanner The scanner object. * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use * ast_yy_scan_bytes() instead. */ -YY_BUFFER_STATE ast_yy_scan_string (yyconst char * yystr , yyscan_t yyscanner) +YY_BUFFER_STATE ast_yy_scan_string (yyconst char * str , yyscan_t yyscanner) { - return ast_yy_scan_bytes(yystr,strlen(yystr) ,yyscanner); + return ast_yy_scan_bytes(str,strlen(str) ,yyscanner); } /** Setup the input buffer state to scan the given bytes. The next call to ast_yylex() will * scan from a @e copy of @a bytes. - * @param yybytes the byte buffer to scan - * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. + * @param bytes the byte buffer to scan + * @param len the number of bytes in the buffer pointed to by @a bytes. * @param yyscanner The scanner object. * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE ast_yy_scan_bytes (yyconst char * yybytes, int _yybytes_len , yyscan_t yyscanner) +YY_BUFFER_STATE ast_yy_scan_bytes (yyconst char * bytes, int len , yyscan_t yyscanner) { YY_BUFFER_STATE b; char *buf; @@ -2735,15 +2717,15 @@ YY_BUFFER_STATE ast_yy_scan_bytes (yyconst char * yybytes, int _yybytes_len , int i; /* Get memory for full buffer, including space for trailing EOB's. */ - n = _yybytes_len + 2; + n = len + 2; buf = (char *) ast_yyalloc(n ,yyscanner ); if ( ! buf ) YY_FATAL_ERROR( "out of dynamic memory in ast_yy_scan_bytes()" ); - for ( i = 0; i < _yybytes_len; ++i ) - buf[i] = yybytes[i]; + for ( i = 0; i < len; ++i ) + buf[i] = bytes[i]; - buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; + buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR; b = ast_yy_scan_buffer(buf,n ,yyscanner); if ( ! b ) @@ -2884,7 +2866,7 @@ void ast_yyset_lineno (int line_number , yyscan_t yyscanner) } /** Set the current column. - * @param column_no + * @param line_number * @param yyscanner The scanner object. */ void ast_yyset_column (int column_no , yyscan_t yyscanner) @@ -2954,51 +2936,21 @@ void ast_yyset_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner) yylloc = yylloc_param; } -/* User-visible API */ - -/* ast_yylex_init is special because it creates the scanner itself, so it is - * the ONLY reentrant function that doesn't take the scanner as the last argument. - * That's why we explicitly handle the declaration, instead of using our macros. - */ - -int ast_yylex_init(yyscan_t* ptr_yy_globals) - -{ - if (ptr_yy_globals == NULL){ - errno = EINVAL; - return 1; - } - - *ptr_yy_globals = (yyscan_t) ast_yyalloc ( sizeof( struct yyguts_t ), NULL ); - - 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)); - - return yy_init_globals ( *ptr_yy_globals ); -} - static int yy_init_globals (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* Initialization is the same as for the non-reentrant scanner. - * This function is called from ast_yylex_destroy(), so don't allocate here. - */ + This function is called once per scanner lifetime. */ yyg->yy_buffer_stack = 0; yyg->yy_buffer_stack_top = 0; yyg->yy_buffer_stack_max = 0; yyg->yy_c_buf_p = (char *) 0; - yyg->yy_init = 0; + yyg->yy_init = 1; yyg->yy_start = 0; - yyg->yy_start_stack_ptr = 0; yyg->yy_start_stack_depth = 0; - yyg->yy_start_stack = NULL; + yyg->yy_start_stack = (int *) 0; /* Defined in main.c */ #ifdef YY_STDINIT @@ -3015,6 +2967,33 @@ static int yy_init_globals (yyscan_t yyscanner) return 0; } +/* User-visible API */ + +/* ast_yylex_init is special because it creates the scanner itself, so it is + * the ONLY reentrant function that doesn't take the scanner as the last argument. + * That's why we explicitly handle the declaration, instead of using our macros. + */ + +int ast_yylex_init(yyscan_t* ptr_yy_globals) + +{ + if (ptr_yy_globals == NULL){ + errno = EINVAL; + return 1; + } + + *ptr_yy_globals = (yyscan_t) ast_yyalloc ( sizeof( struct yyguts_t ), NULL ); + + if (*ptr_yy_globals == NULL){ + errno = ENOMEM; + return 1; + } + + memset(*ptr_yy_globals,0,sizeof(struct yyguts_t)); + + return yy_init_globals ( *ptr_yy_globals ); +} + /* ast_yylex_destroy is for both reentrant and non-reentrant scanners. */ int ast_yylex_destroy (yyscan_t yyscanner) { @@ -3035,13 +3014,8 @@ int ast_yylex_destroy (yyscan_t yyscanner) ast_yyfree(yyg->yy_start_stack ,yyscanner ); yyg->yy_start_stack = NULL; - /* Reset the globals. This is important in a non-reentrant scanner so the next time - * ast_yylex() is called, initialization will occur. */ - yy_init_globals( yyscanner); - /* Destroy the main struct (reentrant only). */ ast_yyfree ( yyscanner , yyscanner ); - yyscanner = NULL; return 0; } @@ -3053,6 +3027,7 @@ int ast_yylex_destroy (yyscan_t yyscanner) static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner) { register int i; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; for ( i = 0; i < n; ++i ) s1[i] = s2[i]; } @@ -3062,6 +3037,7 @@ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yysca static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner) { register int n; + struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; for ( n = 0; s[n]; ++n ) ; @@ -3093,6 +3069,18 @@ void ast_yyfree (void * ptr , yyscan_t yyscanner) #define YYTABLES_NAME "yytables" +#undef YY_NEW_FILE +#undef YY_FLUSH_BUFFER +#undef yy_set_bol +#undef yy_new_buffer +#undef yy_set_interactive +#undef yytext_ptr +#undef YY_DO_BEFORE_ACTION + +#ifdef YY_DECL_IS_OURS +#undef YY_DECL_IS_OURS +#undef YY_DECL +#endif #line 205 "ast_expr2.fl" @@ -3134,11 +3122,11 @@ int ast_expr(char *expr, char *buf, int length) res_length = snprintf(buf, length, "%ld", (long int) io.val->u.i); return_value = (res_length <= length) ? res_length : length; } else { -#if defined(STANDALONE) || defined(LOW_MEMORY) +#ifdef STANDALONE strncpy(buf, io.val->u.s, length - 1); -#else /* !STANDALONE && !LOW_MEMORY */ +#else /* !STANDALONE */ ast_copy_string(buf, io.val->u.s, length); -#endif /* STANDALONE || LOW_MEMORY */ +#endif /* STANDALONE */ return_value = strlen(buf); free(io.val->u.s); } -- cgit v1.2.3