From b5135febfa3f342c5642282eac517b95450e51fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Javier=20Font=C3=A1n=20Mui=C3=B1os?= Date: Mon, 20 Jul 2009 13:44:59 +0000 Subject: [PATCH] Real fix for missing stdio.h, #121 git-svn-id: http://svn.opennebula.org/one/trunk@705 3034c82b-c49b-4eb3-8279-a7acafdc01c0 --- src/host/host_parser.c | 51 +++++++++------------------------ src/template/template_parser.c | 51 +++++++++------------------------ src/template/template_syntax.cc | 2 +- src/template/template_syntax.y | 2 +- src/vm/vm_var_parser.c | 51 +++++++++------------------------ 5 files changed, 44 insertions(+), 113 deletions(-) diff --git a/src/host/host_parser.c b/src/host/host_parser.c index f2789ba760..4de6dc32fe 100644 --- a/src/host/host_parser.c +++ b/src/host/host_parser.c @@ -28,7 +28,7 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 35 +#define YY_FLEX_SUBMINOR_VERSION 34 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -73,6 +73,7 @@ typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN @@ -103,8 +104,6 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif -#endif /* ! C99 */ - #endif /* ! FLEXINT_H */ #ifdef __cplusplus @@ -212,6 +211,13 @@ extern FILE *host_in, *host_out; #define unput(c) yyunput( c, (yytext_ptr) ) +/* The following is because we cannot portably get our hands on size_t + * (without autoconf's help, which isn't available because we want + * flex-generated scanners to compile on their own). + * Given that the standard has decreed that size_t exists since 1989, + * I guess we can afford to depend on it. Manoj. + */ + #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T typedef size_t yy_size_t; @@ -525,7 +531,7 @@ char *host_text; #define YY_USER_ACTION llocp->first_line = host_lineno; \ llocp->first_column = llocp->last_column; \ llocp->last_column += host_leng; -#line 529 "host_parser.c" +#line 535 "host_parser.c" #define INITIAL 0 @@ -543,35 +549,6 @@ char *host_text; static int yy_init_globals (void ); -/* Accessor methods to globals. - These are made visible to non-reentrant scanners for convenience. */ - -int host_lex_destroy (void ); - -int host_get_debug (void ); - -void host_set_debug (int debug_flag ); - -YY_EXTRA_TYPE host_get_extra (void ); - -void host_set_extra (YY_EXTRA_TYPE user_defined ); - -FILE *host_get_in (void ); - -void host_set_in (FILE * in_str ); - -FILE *host_get_out (void ); - -void host_set_out (FILE * out_str ); - -int host_get_leng (void ); - -char *host_get_text (void ); - -int host_get_lineno (void ); - -void host_set_lineno (int line_number ); - /* Macros after this point can all be overridden by user definitions in * section 1. */ @@ -612,7 +589,7 @@ static int input (void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO do { if (fwrite( host_text, host_leng, 1, host_out )) {} } while (0) +#define ECHO fwrite( host_text, host_leng, 1, host_out ) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -623,7 +600,7 @@ static int input (void ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - size_t n; \ + int n; \ for ( n = 0; n < max_size && \ (c = getc( host_in )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -709,7 +686,7 @@ YY_DECL /* --- Tokens --- */ -#line 713 "host_parser.c" +#line 690 "host_parser.c" if ( !(yy_init) ) { @@ -852,7 +829,7 @@ YY_RULE_SETUP #line 66 "host_parser.l" ECHO; YY_BREAK -#line 856 "host_parser.c" +#line 833 "host_parser.c" case YY_STATE_EOF(INITIAL): yyterminate(); diff --git a/src/template/template_parser.c b/src/template/template_parser.c index 27a5fcd488..0324ec740b 100644 --- a/src/template/template_parser.c +++ b/src/template/template_parser.c @@ -28,7 +28,7 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 35 +#define YY_FLEX_SUBMINOR_VERSION 34 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -73,6 +73,7 @@ typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN @@ -103,8 +104,6 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif -#endif /* ! C99 */ - #endif /* ! FLEXINT_H */ #ifdef __cplusplus @@ -212,6 +211,13 @@ extern FILE *template_in, *template_out; #define unput(c) yyunput( c, (yytext_ptr) ) +/* The following is because we cannot portably get our hands on size_t + * (without autoconf's help, which isn't available because we want + * flex-generated scanners to compile on their own). + * Given that the standard has decreed that size_t exists since 1989, + * I guess we can afford to depend on it. Manoj. + */ + #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T typedef size_t yy_size_t; @@ -551,7 +557,7 @@ char *template_text; llocp->first_column = llocp->last_column; \ llocp->last_column += template_leng; -#line 555 "template_parser.c" +#line 561 "template_parser.c" #define INITIAL 0 #define VALUE 1 @@ -570,35 +576,6 @@ char *template_text; static int yy_init_globals (void ); -/* Accessor methods to globals. - These are made visible to non-reentrant scanners for convenience. */ - -int template_lex_destroy (void ); - -int template_get_debug (void ); - -void template_set_debug (int debug_flag ); - -YY_EXTRA_TYPE template_get_extra (void ); - -void template_set_extra (YY_EXTRA_TYPE user_defined ); - -FILE *template_get_in (void ); - -void template_set_in (FILE * in_str ); - -FILE *template_get_out (void ); - -void template_set_out (FILE * out_str ); - -int template_get_leng (void ); - -char *template_get_text (void ); - -int template_get_lineno (void ); - -void template_set_lineno (int line_number ); - /* Macros after this point can all be overridden by user definitions in * section 1. */ @@ -639,7 +616,7 @@ static int input (void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO do { if (fwrite( template_text, template_leng, 1, template_out )) {} } while (0) +#define ECHO fwrite( template_text, template_leng, 1, template_out ) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -650,7 +627,7 @@ static int input (void ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - size_t n; \ + int n; \ for ( n = 0; n < max_size && \ (c = getc( template_in )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -738,7 +715,7 @@ YY_DECL /* ------------------------------------------------------------------------- */ /* Comments (lines with an starting #), and empty lines */ /* ------------------------------------------------------------------------- */ -#line 742 "template_parser.c" +#line 719 "template_parser.c" if ( !(yy_init) ) { @@ -914,7 +891,7 @@ YY_RULE_SETUP #line 85 "template_parser.l" ECHO; YY_BREAK -#line 918 "template_parser.c" +#line 895 "template_parser.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(VALUE): yyterminate(); diff --git a/src/template/template_syntax.cc b/src/template/template_syntax.cc index bb533cc40f..2afa9c479a 100644 --- a/src/template/template_syntax.cc +++ b/src/template/template_syntax.cc @@ -105,7 +105,7 @@ #include #include -#include +#include #include "template_syntax.h" #include "Template.h" diff --git a/src/template/template_syntax.y b/src/template/template_syntax.y index 3a38741d3d..d88dd6adfc 100644 --- a/src/template/template_syntax.y +++ b/src/template/template_syntax.y @@ -23,7 +23,7 @@ #include #include -#include +#include #include "template_syntax.h" #include "Template.h" diff --git a/src/vm/vm_var_parser.c b/src/vm/vm_var_parser.c index 66a2cd18f8..915b73edf9 100644 --- a/src/vm/vm_var_parser.c +++ b/src/vm/vm_var_parser.c @@ -28,7 +28,7 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 -#define YY_FLEX_SUBMINOR_VERSION 35 +#define YY_FLEX_SUBMINOR_VERSION 34 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif @@ -73,6 +73,7 @@ typedef int flex_int32_t; typedef unsigned char flex_uint8_t; typedef unsigned short int flex_uint16_t; typedef unsigned int flex_uint32_t; +#endif /* ! C99 */ /* Limits of integral types. */ #ifndef INT8_MIN @@ -103,8 +104,6 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif -#endif /* ! C99 */ - #endif /* ! FLEXINT_H */ #ifdef __cplusplus @@ -212,6 +211,13 @@ extern FILE *vm_var_in, *vm_var_out; #define unput(c) yyunput( c, (yytext_ptr) ) +/* The following is because we cannot portably get our hands on size_t + * (without autoconf's help, which isn't available because we want + * flex-generated scanners to compile on their own). + * Given that the standard has decreed that size_t exists since 1989, + * I guess we can afford to depend on it. Manoj. + */ + #ifndef YY_TYPEDEF_YY_SIZE_T #define YY_TYPEDEF_YY_SIZE_T typedef size_t yy_size_t; @@ -534,7 +540,7 @@ char *vm_var_text; llocp->first_column = llocp->last_column; \ llocp->last_column += vm_var_leng; -#line 538 "vm_var_parser.c" +#line 544 "vm_var_parser.c" #define INITIAL 0 #define VAR 1 @@ -553,35 +559,6 @@ char *vm_var_text; static int yy_init_globals (void ); -/* Accessor methods to globals. - These are made visible to non-reentrant scanners for convenience. */ - -int vm_var_lex_destroy (void ); - -int vm_var_get_debug (void ); - -void vm_var_set_debug (int debug_flag ); - -YY_EXTRA_TYPE vm_var_get_extra (void ); - -void vm_var_set_extra (YY_EXTRA_TYPE user_defined ); - -FILE *vm_var_get_in (void ); - -void vm_var_set_in (FILE * in_str ); - -FILE *vm_var_get_out (void ); - -void vm_var_set_out (FILE * out_str ); - -int vm_var_get_leng (void ); - -char *vm_var_get_text (void ); - -int vm_var_get_lineno (void ); - -void vm_var_set_lineno (int line_number ); - /* Macros after this point can all be overridden by user definitions in * section 1. */ @@ -622,7 +599,7 @@ static int input (void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO do { if (fwrite( vm_var_text, vm_var_leng, 1, vm_var_out )) {} } while (0) +#define ECHO fwrite( vm_var_text, vm_var_leng, 1, vm_var_out ) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -633,7 +610,7 @@ static int input (void ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - size_t n; \ + int n; \ for ( n = 0; n < max_size && \ (c = getc( vm_var_in )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ @@ -726,7 +703,7 @@ YY_DECL /* $NUM.CONTEXT_VARIABLE */ /* ------------------------------------------------------------------------- */ -#line 730 "vm_var_parser.c" +#line 707 "vm_var_parser.c" if ( !(yy_init) ) { @@ -898,7 +875,7 @@ YY_RULE_SETUP #line 80 "vm_var_parser.l" ECHO; YY_BREAK -#line 902 "vm_var_parser.c" +#line 879 "vm_var_parser.c" case YY_STATE_EOF(INITIAL): yyterminate();