X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ce3ed50dbe32d118321082db84c3a9abb047d5b7..6a44bffd1ac68163e4c1cfe8aa8fe4f7f98a02e7:/src/common/doslex.c diff --git a/src/common/doslex.c b/src/common/doslex.c index 08572e333c..233e20ab3d 100644 --- a/src/common/doslex.c +++ b/src/common/doslex.c @@ -29,6 +29,10 @@ #include #endif +#ifdef __VISAGECPP__ +#include +#endif + #ifdef __cplusplus static int yyinput() #else @@ -81,7 +85,6 @@ char *malloc(); int free(); */ -int read(); #endif @@ -131,6 +134,7 @@ int read(); * done when it reached the ';' after the YY_FATAL_ERROR() call. */ +#if !defined(__VISAGECPP__) #define YY_FATAL_ERROR(msg) \ do \ { \ @@ -139,6 +143,18 @@ int read(); exit( 1 ); \ } \ while ( 0 ) +#else +/* suppress expression always false warning */ +int os2var = 0; +#define YY_FATAL_ERROR(msg) \ + do \ + { \ + (void) fputs( msg, stderr ); \ + (void) putc( '\n', stderr ); \ + exit( 1 ); \ + } \ + while ( os2var == 0 ) +#endif /* default yywrap function - always treat EOF as an EOF */ int yywrap(void) { return 1; } @@ -154,6 +170,7 @@ int yywrap(void) { return 1; } #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) /* special action meaning "start processing a new file" */ +#if !defined(__VISAGECPP__) #define YY_NEW_FILE \ do \ { \ @@ -161,11 +178,20 @@ int yywrap(void) { return 1; } yy_load_buffer_state(); \ } \ while ( 0 ) +#else +#define YY_NEW_FILE \ + do \ + { \ + yy_init_buffer( yy_current_buffer, yyin ); \ + yy_load_buffer_state(); \ + } \ + while ( os2var == 0 ) +#endif /* default declaration of generated scanner - a define so the user can * easily add parameters */ -#define YY_DECL int yylex YY_PROTO(( void )) +#define YY_DECL int yylex YY_PROTO(( void )) /* code executed at the end of each rule */ #define YY_BREAK break; @@ -204,7 +230,7 @@ extern char *malloc(); #endif #define Return(x) return x; -#if defined(VMS) && !defined(strdup) +#if defined(VMS) && ( __VMS_VER < 70000000 ) #define strdup(s) (strcpy((char *)malloc(strlen(s)+1), s)); #endif @@ -225,7 +251,9 @@ static int my_unput(char); if ( (result = read( fileno(yyin), (char *) buf, max_size )) < 0 ) \ YY_FATAL_ERROR( "read() in flex scanner failed" ); #else -# undef unput +# ifndef unput +# undef unput +# endif # define unput(_c) my_unput(_c) #endif @@ -246,6 +274,7 @@ static int my_unput(char); #define EOB_ACT_LAST_MATCH 2 /* return all but the first 'n' matched characters back to the input stream */ +#if !defined(__VISAGECPP__) #define yyless(n) \ do \ { \ @@ -255,6 +284,17 @@ static int my_unput(char); YY_DO_BEFORE_ACTION; /* set up yytext again */ \ } \ while ( 0 ) +#else +#define yyless(n) \ + do \ + { \ + /* undo effects of setting up yytext */ \ + *yy_cp = yy_hold_char; \ + yy_c_buf_p = yy_cp = yy_bp + n; \ + YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + } \ + while ( os2var == 0 ) +#endif #undef unput #define unput(c) yyunput( c, yytext ) @@ -477,7 +517,13 @@ YY_DECL yy_init = 0; } +#if !defined(__VISAGECPP__) while ( 1 ) /* loops until end-of-file is reached */ +#else + os2var = 1; + if (os2var == 0) return 0; + while ( os2var == 1 ) /* loops until end-of-file is reached */ +#endif { yy_cp = yy_c_buf_p; @@ -729,6 +775,10 @@ case YY_STATE_EOF(INITIAL): "fatal flex scanner internal error--no action found" ); } } +#if defined(__VISAGECPP__) +/* VA complains about proc maybe not returning a value so return one */ +return 0; +#endif } @@ -736,9 +786,9 @@ case YY_STATE_EOF(INITIAL): * * synopsis * int yy_get_next_buffer(); - * + * * returns a code representing an action - * EOB_ACT_LAST_MATCH - + * EOB_ACT_LAST_MATCH - * EOB_ACT_CONTINUE_SCAN - continue scanning from current position * EOB_ACT_END_OF_FILE - end of file */ @@ -1175,7 +1225,7 @@ static int my_unput(char c) #endif -/* Public */ +/* Public */ void LexFromFile(FILE *fd) { lex_read_from_string = 0;