|
|
@@ -21,6 +21,7 @@
|
|
|
#include <string.h>
|
|
|
#include <errno.h>
|
|
|
#include <stdlib.h>
|
|
|
+#include <c99_compat.h>
|
|
|
|
|
|
/* end standard C headers. */
|
|
|
|
|
|
@@ -34,7 +35,7 @@
|
|
|
#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.
|
|
|
+ * if you want the limit (max/min) macros for int types.
|
|
|
*/
|
|
|
#ifndef __STDC_LIMIT_MACROS
|
|
|
#define __STDC_LIMIT_MACROS 1
|
|
|
@@ -51,7 +52,7 @@ typedef uint32_t flex_uint32_t;
|
|
|
typedef signed char flex_int8_t;
|
|
|
typedef short int flex_int16_t;
|
|
|
typedef int flex_int32_t;
|
|
|
-typedef unsigned char flex_uint8_t;
|
|
|
+typedef unsigned char flex_uint8_t;
|
|
|
typedef unsigned short int flex_uint16_t;
|
|
|
typedef unsigned int flex_uint32_t;
|
|
|
|
|
|
@@ -184,7 +185,7 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE;
|
|
|
#define EOB_ACT_LAST_MATCH 2
|
|
|
|
|
|
#define YY_LESS_LINENO(n)
|
|
|
-
|
|
|
+
|
|
|
/* Return all but the first "n" matched characters back to the input stream. */
|
|
|
#define yyless(n) \
|
|
|
do \
|
|
|
@@ -246,7 +247,7 @@ struct yy_buffer_state
|
|
|
|
|
|
int yy_bs_lineno; /**< The line count. */
|
|
|
int yy_bs_column; /**< The column count. */
|
|
|
-
|
|
|
+
|
|
|
/* Whether to try to fill the input buffer when we reach the
|
|
|
* end of it.
|
|
|
*/
|
|
|
@@ -822,9 +823,9 @@ 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
|
|
|
-
|
|
|
+
|
|
|
# define yylloc yyg->yylloc_r
|
|
|
-
|
|
|
+
|
|
|
int glcpp_lex_init (yyscan_t* scanner);
|
|
|
|
|
|
int glcpp_lex_init_extra (YY_EXTRA_TYPE user_defined,yyscan_t* scanner);
|
|
|
@@ -863,9 +864,9 @@ YYSTYPE * glcpp_get_lval (yyscan_t yyscanner );
|
|
|
void glcpp_set_lval (YYSTYPE * yylval_param ,yyscan_t yyscanner );
|
|
|
|
|
|
YYLTYPE *glcpp_get_lloc (yyscan_t yyscanner );
|
|
|
-
|
|
|
+
|
|
|
void glcpp_set_lloc (YYLTYPE * yylloc_param ,yyscan_t yyscanner );
|
|
|
-
|
|
|
+
|
|
|
/* Macros after this point can all be overridden by user definitions in
|
|
|
* section 1.
|
|
|
*/
|
|
|
@@ -879,7 +880,7 @@ extern int glcpp_wrap (yyscan_t yyscanner );
|
|
|
#endif
|
|
|
|
|
|
static void yyunput (int c,char *buf_ptr ,yyscan_t yyscanner);
|
|
|
-
|
|
|
+
|
|
|
#ifndef yytext_ptr
|
|
|
static void yy_flex_strncpy (char *,yyconst char *,int ,yyscan_t yyscanner);
|
|
|
#endif
|
|
|
@@ -899,11 +900,11 @@ static int input (yyscan_t yyscanner );
|
|
|
#endif
|
|
|
|
|
|
static void yy_push_state (int new_state ,yyscan_t yyscanner);
|
|
|
-
|
|
|
+
|
|
|
static void yy_pop_state (yyscan_t yyscanner );
|
|
|
-
|
|
|
+
|
|
|
static int yy_top_state (yyscan_t yyscanner );
|
|
|
-
|
|
|
+
|
|
|
/* Amount of stuff to slurp up with each read. */
|
|
|
#ifndef YY_READ_BUF_SIZE
|
|
|
#ifdef __ia64__
|
|
|
@@ -1361,7 +1362,7 @@ YY_RULE_SETUP
|
|
|
* While in the <DEFINE> state we also need to explicitly
|
|
|
* handle a few other things that may appear before the
|
|
|
* identifier:
|
|
|
- *
|
|
|
+ *
|
|
|
* * Comments, (handled above with the main support for
|
|
|
* comments).
|
|
|
*
|
|
|
@@ -2184,7 +2185,7 @@ static void glcpp__load_buffer_state (yyscan_t yyscanner)
|
|
|
YY_BUFFER_STATE glcpp__create_buffer (FILE * file, int size , yyscan_t yyscanner)
|
|
|
{
|
|
|
YY_BUFFER_STATE b;
|
|
|
-
|
|
|
+
|
|
|
b = (YY_BUFFER_STATE) glcpp_alloc(sizeof( struct yy_buffer_state ) ,yyscanner );
|
|
|
if ( ! b )
|
|
|
YY_FATAL_ERROR( "out of dynamic memory in glcpp__create_buffer()" );
|
|
|
@@ -2250,7 +2251,7 @@ static void glcpp__load_buffer_state (yyscan_t yyscanner)
|
|
|
}
|
|
|
|
|
|
b->yy_is_interactive = 0;
|
|
|
-
|
|
|
+
|
|
|
errno = oerrno;
|
|
|
}
|
|
|
|
|
|
@@ -2356,9 +2357,9 @@ static void glcpp_ensure_buffer_stack (yyscan_t yyscanner)
|
|
|
, yyscanner);
|
|
|
if ( ! yyg->yy_buffer_stack )
|
|
|
YY_FATAL_ERROR( "out of dynamic memory in glcpp_ensure_buffer_stack()" );
|
|
|
-
|
|
|
+
|
|
|
memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
|
|
|
-
|
|
|
+
|
|
|
yyg->yy_buffer_stack_max = num_to_alloc;
|
|
|
yyg->yy_buffer_stack_top = 0;
|
|
|
return;
|
|
|
@@ -2387,12 +2388,12 @@ static void glcpp_ensure_buffer_stack (yyscan_t yyscanner)
|
|
|
* @param base the character buffer
|
|
|
* @param size the size in bytes of the character buffer
|
|
|
* @param yyscanner The scanner object.
|
|
|
- * @return the newly allocated buffer state object.
|
|
|
+ * @return the newly allocated buffer state object.
|
|
|
*/
|
|
|
YY_BUFFER_STATE glcpp__scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
|
|
|
{
|
|
|
YY_BUFFER_STATE b;
|
|
|
-
|
|
|
+
|
|
|
if ( size < 2 ||
|
|
|
base[size-2] != YY_END_OF_BUFFER_CHAR ||
|
|
|
base[size-1] != YY_END_OF_BUFFER_CHAR )
|
|
|
@@ -2428,7 +2429,7 @@ YY_BUFFER_STATE glcpp__scan_buffer (char * base, yy_size_t size , yyscan_t yys
|
|
|
*/
|
|
|
YY_BUFFER_STATE glcpp__scan_string (yyconst char * yystr , yyscan_t yyscanner)
|
|
|
{
|
|
|
-
|
|
|
+
|
|
|
return glcpp__scan_bytes(yystr,strlen(yystr) ,yyscanner);
|
|
|
}
|
|
|
|
|
|
@@ -2445,7 +2446,7 @@ YY_BUFFER_STATE glcpp__scan_bytes (yyconst char * yybytes, int _yybytes_len ,
|
|
|
char *buf;
|
|
|
yy_size_t n;
|
|
|
int i;
|
|
|
-
|
|
|
+
|
|
|
/* Get memory for full buffer, including space for trailing EOB's. */
|
|
|
n = _yybytes_len + 2;
|
|
|
buf = (char *) glcpp_alloc(n ,yyscanner );
|
|
|
@@ -2553,10 +2554,10 @@ YY_EXTRA_TYPE glcpp_get_extra (yyscan_t yyscanner)
|
|
|
int glcpp_get_lineno (yyscan_t yyscanner)
|
|
|
{
|
|
|
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
|
|
-
|
|
|
+
|
|
|
if (! YY_CURRENT_BUFFER)
|
|
|
return 0;
|
|
|
-
|
|
|
+
|
|
|
return yylineno;
|
|
|
}
|
|
|
|
|
|
@@ -2566,10 +2567,10 @@ int glcpp_get_lineno (yyscan_t yyscanner)
|
|
|
int glcpp_get_column (yyscan_t yyscanner)
|
|
|
{
|
|
|
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
|
|
-
|
|
|
+
|
|
|
if (! YY_CURRENT_BUFFER)
|
|
|
return 0;
|
|
|
-
|
|
|
+
|
|
|
return yycolumn;
|
|
|
}
|
|
|
|
|
|
@@ -2630,8 +2631,8 @@ void glcpp_set_lineno (int line_number , yyscan_t yyscanner)
|
|
|
|
|
|
/* lineno is only valid if an input buffer exists. */
|
|
|
if (! YY_CURRENT_BUFFER )
|
|
|
- yy_fatal_error( "glcpp_set_lineno called with no buffer" , yyscanner);
|
|
|
-
|
|
|
+ yy_fatal_error( "glcpp_set_lineno called with no buffer" , yyscanner);
|
|
|
+
|
|
|
yylineno = line_number;
|
|
|
}
|
|
|
|
|
|
@@ -2645,8 +2646,8 @@ void glcpp_set_column (int column_no , yyscan_t yyscanner)
|
|
|
|
|
|
/* column is only valid if an input buffer exists. */
|
|
|
if (! YY_CURRENT_BUFFER )
|
|
|
- yy_fatal_error( "glcpp_set_column called with no buffer" , yyscanner);
|
|
|
-
|
|
|
+ yy_fatal_error( "glcpp_set_column called with no buffer" , yyscanner);
|
|
|
+
|
|
|
yycolumn = column_no;
|
|
|
}
|
|
|
|
|
|
@@ -2699,13 +2700,13 @@ YYLTYPE *glcpp_get_lloc (yyscan_t yyscanner)
|
|
|
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
|
|
return yylloc;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
void glcpp_set_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner)
|
|
|
{
|
|
|
struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
|
|
|
yylloc = yylloc_param;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/* User-visible API */
|
|
|
|
|
|
/* glcpp_lex_init is special because it creates the scanner itself, so it is
|
|
|
@@ -2753,20 +2754,20 @@ int glcpp_lex_init_extra(YY_EXTRA_TYPE yy_user_defined,yyscan_t* ptr_yy_globals
|
|
|
errno = EINVAL;
|
|
|
return 1;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
*ptr_yy_globals = (yyscan_t) glcpp_alloc ( 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));
|
|
|
-
|
|
|
+
|
|
|
glcpp_set_extra (yy_user_defined, *ptr_yy_globals);
|
|
|
-
|
|
|
+
|
|
|
return yy_init_globals ( *ptr_yy_globals );
|
|
|
}
|
|
|
|