#ifdef __cplusplus
#include <stdlib.h>
+
+#ifdef __SALFORDC__
+#include <io.h>
+#include <clib.h>
+#else
#include <osfcn.h>
+#endif
+
+#ifdef __VISAGECPP__
+#include <io.h>
+#endif
+
+#ifdef __cplusplus
+static int yyinput()
+#else
+static int input()
+#endif
/* use prototypes in function declarations */
#define YY_USE_PROTOS
* done when it reached the ';' after the YY_FATAL_ERROR() call.
*/
+#if !defined(__VISAGECPP__)
#define YY_FATAL_ERROR(msg) \
do \
{ \
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; }
#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 \
{ \
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;
#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
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
#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 \
{ \
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 )
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;
case 1:
# line 60 "lexer.l"
-{yylval.s = strdup(yytext); Return(INTEGER);}
+{yylval.s = strdup((const char*) yytext); Return(INTEGER);}
YY_BREAK
case 2:
# line 62 "lexer.l"
YY_BREAK
case 3:
# line 64 "lexer.l"
-{yylval.s = strdup(yytext); Return(WORD);}
+{yylval.s = strdup((const char*) yytext); Return(WORD);}
YY_BREAK
case 4:
# line 66 "lexer.l"
-{int len = strlen(yytext);
+{int len = strlen((const char*) yytext);
yytext[len-1] = 0;
- yylval.s = strdup(yytext+1);
+ yylval.s = strdup((const char*) (yytext+1));
Return(WORD);}
YY_BREAK
case 5:
# line 71 "lexer.l"
-{yylval.s = strdup(yytext); Return(STRING);}
+{yylval.s = strdup((const char*) yytext); Return(STRING);}
YY_BREAK
case 6:
# line 73 "lexer.l"
"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
}
*
* 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
*/
#endif
-/* Public */
+/* Public */
void LexFromFile(FILE *fd)
{
lex_read_from_string = 0;
{
lex_read_from_string = 1;
lex_buffer = buffer;
- lex_buffer_length = strlen(buffer);
+ lex_buffer_length = strlen((const char*) buffer);
lex_string_ptr = 0;
/* Don't know why this is necessary, but otherwise
* lex only works _once_!