diff --git a/bin/Release/README.txt b/bin/Release/README.txt index e2c3854..922ab5b 100644 --- a/bin/Release/README.txt +++ b/bin/Release/README.txt @@ -1,3 +1,9 @@ +version 2.2 +-------------- +added --wincompat option to win_flex (this option changes unix include with windows analog + also isatty/fileno functions changed to _isatty/_fileno) +fixed two "'<' : signed/unsigned mismatch" warnings in win_flex generated file + version 2.1 -------------- fixed crash when execute win_bison.exe under WindowsXP (argv[0] don't have full application path) diff --git a/bin/Release/UNISTD_ERROR.readme b/bin/Release/UNISTD_ERROR.readme new file mode 100644 index 0000000..3b14a38 --- /dev/null +++ b/bin/Release/UNISTD_ERROR.readme @@ -0,0 +1,4 @@ +In case compile errors like "cannot include " in win_flex generated file try add --wincompat invoke option. +This new option changes unix header with windows analog and replaces isatty/fileno functions to +"safe" windows analogs _isatty/_fileno as well. If you have compile issues with it afterwards please open ticket +at http://sourceforge.net/p/winflexbison/tickets . \ No newline at end of file diff --git a/bin/Release/win_bison.exe b/bin/Release/win_bison.exe index fa0bf03..2fcb6bd 100644 Binary files a/bin/Release/win_bison.exe and b/bin/Release/win_bison.exe differ diff --git a/bin/Release/win_flex.exe b/bin/Release/win_flex.exe index 6b23b49..dc87f20 100644 Binary files a/bin/Release/win_flex.exe and b/bin/Release/win_flex.exe differ diff --git a/flex/src/gen.c b/flex/src/gen.c index 5a5daef..8d24a86 100644 --- a/flex/src/gen.c +++ b/flex/src/gen.c @@ -1972,7 +1972,7 @@ void make_tables () ("if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )"); indent_up (); indent_puts ("{"); - indent_puts ("int yyl;"); + indent_puts ("yy_size_t yyl;"); do_indent (); out_str ("for ( yyl = %s; yyl < yyleng; ++yyl )\n", yymore_used ? (yytext_is_array ? "YY_G(yy_prev_more_offset)" : diff --git a/flex/src/main.c b/flex/src/main.c index dde0746..b0fe98d 100644 --- a/flex/src/main.c +++ b/flex/src/main.c @@ -1026,6 +1026,10 @@ void flexinit (argc, argv) buf_m4_define( &m4defs_buf, "M4_YY_NO_UNISTD_H",0); break; + case OPT_WIN_COMPAT: + buf_m4_define( &m4defs_buf, "M4_YY_WIN_COMPAT",0); + break; + case OPT_TABLES_FILE: tablesext = true; tablesfilename = arg; @@ -1711,6 +1715,7 @@ void usage () " --noansi-definitions old-style function definitions\n" " --noansi-prototypes empty parameter list in prototypes\n" " --nounistd do not include \n" + " --wincompat windows compatibility (uses instead of and _isatty, _fileno functions)\n" " --noFUNCTION do not generate a particular FUNCTION\n" "\n" "Miscellaneous:\n" " -c do-nothing POSIX option\n" diff --git a/flex/src/options.c b/flex/src/options.c index c673173..21ab0c2 100644 --- a/flex/src/options.c +++ b/flex/src/options.c @@ -193,10 +193,12 @@ optspec_t flexopts[] = { , /* Flex should run in trace mode. */ {"--tables-file[=FILE]", OPT_TABLES_FILE, 0} , /* Save tables to FILE */ - {"--tables-verify", OPT_TABLES_VERIFY, 0} - , /* Tables integrity check */ + {"--tables-verify", OPT_TABLES_VERIFY, 0} + , /* Tables integrity check */ {"--nounistd", OPT_NO_UNISTD_H, 0} , /* Do not include unistd.h */ + {"--wincompat", OPT_WIN_COMPAT, 0} + , /* windows compatibility */ {"-v", OPT_VERBOSE, 0} , {"--verbose", OPT_VERBOSE, 0} diff --git a/flex/src/options.h b/flex/src/options.h index 1f3925b..174e3c7 100644 --- a/flex/src/options.h +++ b/flex/src/options.h @@ -126,7 +126,8 @@ enum flexopt_flag_t { OPT_YYCLASS, OPT_YYLINENO, OPT_YYMORE, - OPT_YYWRAP + OPT_YYWRAP, + OPT_WIN_COMPAT }; #endif diff --git a/flex/src/skel.c b/flex/src/skel.c index 45a4a11..53a6f8d 100644 --- a/flex/src/skel.c +++ b/flex/src/skel.c @@ -831,6 +831,14 @@ const char *skel[] = { "", "m4_ifdef( [[M4_YY_NO_UNISTD_H]],,", "[[", + " m4_ifdef( [[M4_YY_WIN_COMPAT]],", + " [[", + "/*windows compatibility case*/", + "#include ", + "#define isatty _isatty", + "#define fileno _fileno", + " ]],", + " [[", "#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.", @@ -843,6 +851,7 @@ const char *skel[] = { "#include ", "%endif", "#endif", + " ]])", "]])", "", "m4_ifdef( [[M4_EXTRA_TYPE_DEFS]],", @@ -2571,7 +2580,7 @@ const char *skel[] = { " YY_BUFFER_STATE b;", " char *buf;", " yy_size_t n;", - " int i;", + " yy_size_t i;", " m4_dnl M4_YY_DECL_GUTS_VAR();", "", " /* Get memory for full buffer, including space for trailing EOB's. */",