You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

434 lines
14 KiB

Index: Makefile.in
--- Makefile.in.orig 2006-02-21 03:45:12 +0100
+++ Makefile.in 2007-11-04 10:35:32 +0100
@@ -291,7 +291,7 @@
localedir = $(datadir)/locale
-AM_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\" -I@includedir@ -I$(top_srcdir)/intl
+AM_CPPFLAGS = -DLOCALEDIR=\"$(localedir)\" -I$(top_srcdir)/intl
# Run GNU indent on sources. Don't run this unless all the sources compile cleanly.
#
Index: doc/flex.texi
--- doc/flex.texi.orig 2006-02-20 18:30:19 +0100
+++ doc/flex.texi 2006-02-23 15:27:26 +0100
@@ -3807,6 +3807,7 @@
@example
@verbatim
// An example of using the flex C++ scanner class.
+ %option noyywrap
%{
int mylineno = 0;
@@ -3835,7 +3836,7 @@
if(c == '\n')
++mylineno;
- else if(c == @samp{*})
+ else if(c == '*')
{
if((c = yyinput()) == '/')
break;
@@ -3845,19 +3846,19 @@
}
}
- {number} cout "number " YYText() '\n';
+ {number} std::cout << "number " << YYText() << '\n';
\n mylineno++;
- {name} cout "name " YYText() '\n';
+ {name} std::cout << "name " << YYText() << '\n';
- {string} cout "string " YYText() '\n';
+ {string} std::cout << "string " << YYText() << '\n';
%%
int main( int /* argc */, char** /* argv */ )
{
- @code{flex}Lexer* lexer = new yyFlexLexer;
+ FlexLexer* lexer = new yyFlexLexer;
while(lexer->yylex() != 0)
;
return 0;
Index: flex.skl
--- flex.skl.orig 2006-02-16 23:20:43 +0100
+++ flex.skl 2006-02-23 15:32:55 +0100
@@ -54,6 +54,34 @@ m4_changequote([[, ]])
%# the generated scanner as a C-style comment. This is to aid those who
%# edit the skeleton.
%#
+
+%not-for-header
+%if-c-only
+%if-not-reentrant
+m4_ifelse(M4_YY_PREFIX,yy,,
+#define yy_create_buffer M4_YY_PREFIX[[_create_buffer]]
+#define yy_delete_buffer M4_YY_PREFIX[[_delete_buffer]]
+#define yy_flex_debug M4_YY_PREFIX[[_flex_debug]]
+#define yy_init_buffer M4_YY_PREFIX[[_init_buffer]]
+#define yy_flush_buffer M4_YY_PREFIX[[_flush_buffer]]
+#define yy_load_buffer_state M4_YY_PREFIX[[_load_buffer_state]]
+#define yy_switch_to_buffer M4_YY_PREFIX[[_switch_to_buffer]]
+#define yyin M4_YY_PREFIX[[in]]
+#define yyleng M4_YY_PREFIX[[leng]]
+#define yylex M4_YY_PREFIX[[lex]]
+#define yylineno M4_YY_PREFIX[[lineno]]
+#define yyout M4_YY_PREFIX[[out]]
+#define yyrestart M4_YY_PREFIX[[restart]]
+#define yytext M4_YY_PREFIX[[text]]
+#define yywrap M4_YY_PREFIX[[wrap]]
+#define yyalloc M4_YY_PREFIX[[alloc]]
+#define yyrealloc M4_YY_PREFIX[[realloc]]
+#define yyfree M4_YY_PREFIX[[free]]
+)
+%endif
+%endif
+%ok-for-header
+
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION FLEX_MAJOR_VERSION
#define YY_FLEX_MINOR_VERSION FLEX_MINOR_VERSION
@@ -916,6 +916,18 @@
void yyset_lineno M4_YY_PARAMS( int line_number M4_YY_PROTO_LAST_ARG );
]])
+m4_ifdef( [[M4_YY_REENTRANT]],
+[[
+m4_ifdef( [[M4_YY_NO_GET_COLUMN]],,
+[[
+int yyget_column M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );
+]])
+m4_ifdef( [[M4_YY_NO_SET_COLUMN]],,
+[[
+void yyset_column M4_YY_PARAMS( int column_no M4_YY_PROTO_LAST_ARG );
+]])
+]])
+
%if-bison-bridge
m4_ifdef( [[M4_YY_NO_GET_LVAL]],,
[[
@@ -1140,9 +1152,9 @@
m4_dnl The bison pure parser is used. Redefine yylex to
m4_dnl accept the lval parameter.
- m4_define( [[M4_YY_LEX_PROTO]],
+ m4_define( [[M4_YY_LEX_PROTO]], [[\]]
[[M4_YY_PARAMS(YYSTYPE * yylval_param M4_YY_PROTO_LAST_ARG)]])
- m4_define( [[M4_YY_LEX_DECLARATION]],
+ m4_define( [[M4_YY_LEX_DECLARATION]], [[\]]
[[YYFARGS1(YYSTYPE *,yylval_param)]])
]])
@@ -1150,9 +1162,9 @@
[[
m4_dnl Locations are used. yylex should also accept the ylloc parameter.
- m4_define( [[M4_YY_LEX_PROTO]],
+ m4_define( [[M4_YY_LEX_PROTO]], [[\]]
[[M4_YY_PARAMS(YYSTYPE * yylval_param, YYLTYPE * yylloc_param M4_YY_PROTO_LAST_ARG)]])
- m4_define( [[M4_YY_LEX_DECLARATION]],
+ m4_define( [[M4_YY_LEX_DECLARATION]], [[\]]
[[YYFARGS2(YYSTYPE *,yylval_param, YYLTYPE *,yylloc_param)]])
]])
@@ -2800,8 +2812,10 @@
m4_ifdef( [[M4_YY_HAS_START_STACK_VARS]],
[[
/* Destroy the start condition stack. */
+ if (YY_G(yy_start_stack) != NULL) {
yyfree( YY_G(yy_start_stack) M4_YY_CALL_LAST_ARG );
YY_G(yy_start_stack) = NULL;
+ }
]])
m4_ifdef( [[M4_YY_USES_REJECT]],
Index: main.c
--- main.c.orig 2006-02-14 19:55:42 +0100
+++ main.c 2006-02-23 15:27:46 +0100
@@ -211,6 +211,7 @@
#if ENABLE_NLS
#if HAVE_LOCALE_H
setlocale (LC_MESSAGES, "");
+ setlocale (LC_CTYPE, "");
textdomain (PACKAGE);
bindtextdomain (PACKAGE, LOCALEDIR);
#endif
@@ -1159,7 +1160,6 @@
break;
case OPT_NO_UNISTD_H:
- //buf_strdefine (&userdef_buf, "YY_NO_UNISTD_H", "1");
buf_m4_define( &m4defs_buf, "M4_YY_NO_UNISTD_H",0);
break;
@@ -1274,7 +1274,6 @@
break;
case OPT_STACK:
- //buf_strdefine (&userdef_buf, "YY_STACK_USED", "1");
buf_m4_define( &m4defs_buf, "M4_YY_STACK_USED",0);
break;
@@ -1331,87 +1330,66 @@
break;
case OPT_NO_YY_PUSH_STATE:
- //buf_strdefine (&userdef_buf, "YY_NO_PUSH_STATE", "1");
buf_m4_define( &m4defs_buf, "M4_YY_NO_PUSH_STATE",0);
break;
case OPT_NO_YY_POP_STATE:
- //buf_strdefine (&userdef_buf, "YY_NO_POP_STATE", "1");
buf_m4_define( &m4defs_buf, "M4_YY_NO_POP_STATE",0);
break;
case OPT_NO_YY_TOP_STATE:
- //buf_strdefine (&userdef_buf, "YY_NO_TOP_STATE", "1");
buf_m4_define( &m4defs_buf, "M4_YY_NO_TOP_STATE",0);
break;
case OPT_NO_UNPUT:
- //buf_strdefine (&userdef_buf, "YY_NO_UNPUT", "1");
buf_m4_define( &m4defs_buf, "M4_YY_NO_UNPUT",0);
break;
case OPT_NO_YY_SCAN_BUFFER:
- //buf_strdefine (&userdef_buf, "YY_NO_SCAN_BUFFER", "1");
buf_m4_define( &m4defs_buf, "M4_YY_NO_SCAN_BUFFER",0);
break;
case OPT_NO_YY_SCAN_BYTES:
- //buf_strdefine (&userdef_buf, "YY_NO_SCAN_BYTES", "1");
buf_m4_define( &m4defs_buf, "M4_YY_NO_SCAN_BYTES",0);
break;
case OPT_NO_YY_SCAN_STRING:
- //buf_strdefine (&userdef_buf, "YY_NO_SCAN_STRING", "1");
buf_m4_define( &m4defs_buf, "M4_YY_NO_SCAN_STRING",0);
break;
case OPT_NO_YYGET_EXTRA:
- //buf_strdefine (&userdef_buf, "YY_NO_GET_EXTRA", "1");
buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_EXTRA",0);
break;
case OPT_NO_YYSET_EXTRA:
- //buf_strdefine (&userdef_buf, "YY_NO_SET_EXTRA", "1");
buf_m4_define( &m4defs_buf, "M4_YY_NO_SET_EXTRA",0);
break;
case OPT_NO_YYGET_LENG:
- //buf_strdefine (&userdef_buf, "YY_NO_GET_LENG", "1");
buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_LENG",0);
break;
case OPT_NO_YYGET_TEXT:
- //buf_strdefine (&userdef_buf, "YY_NO_GET_TEXT", "1");
buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_TEXT",0);
break;
case OPT_NO_YYGET_LINENO:
- //buf_strdefine (&userdef_buf, "YY_NO_GET_LINENO", "1");
buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_LINENO",0);
break;
case OPT_NO_YYSET_LINENO:
- //buf_strdefine (&userdef_buf, "YY_NO_SET_LINENO", "1");
buf_m4_define( &m4defs_buf, "M4_YY_NO_SET_LINENO",0);
break;
case OPT_NO_YYGET_IN:
- //buf_strdefine (&userdef_buf, "YY_NO_GET_IN", "1");
buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_IN",0);
break;
case OPT_NO_YYSET_IN:
- //buf_strdefine (&userdef_buf, "YY_NO_SET_IN", "1");
buf_m4_define( &m4defs_buf, "M4_YY_NO_SET_IN",0);
break;
case OPT_NO_YYGET_OUT:
- //buf_strdefine (&userdef_buf, "YY_NO_GET_OUT", "1");
buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_OUT",0);
break;
case OPT_NO_YYSET_OUT:
- //buf_strdefine (&userdef_buf, "YY_NO_SET_OUT", "1");
buf_m4_define( &m4defs_buf, "M4_YY_NO_SET_OUT",0);
break;
case OPT_NO_YYGET_LVAL:
- //buf_strdefine (&userdef_buf, "YY_NO_GET_LVAL", "1");
buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_LVAL",0);
break;
case OPT_NO_YYSET_LVAL:
- //buf_strdefine (&userdef_buf, "YY_NO_SET_LVAL", "1");
buf_m4_define( &m4defs_buf, "M4_YY_NO_SET_LVAL",0);
break;
case OPT_NO_YYGET_LLOC:
- //buf_strdefine (&userdef_buf, "YY_NO_GET_LLOC", "1");
buf_m4_define( &m4defs_buf, "M4_YY_NO_GET_LLOC",0);
break;
case OPT_NO_YYSET_LLOC:
- //buf_strdefine (&userdef_buf, "YY_NO_SET_LLOC", "1");
buf_m4_define( &m4defs_buf, "M4_YY_NO_SET_LLOC",0);
break;
@@ -1564,11 +1542,10 @@
if (reject){
out_m4_define( "M4_YY_USES_REJECT", NULL);
- //outn ("\n#define YY_USES_REJECT");
}
if (!do_yywrap) {
- outn ("\n#define yywrap(n) 1");
+ outn ("\n#define yywrap(M4_YY_CALL_ONLY_ARG) 1");
outn ("#define YY_SKIP_YYWRAP");
}
Index: scan.c
--- scan.c.orig 2006-02-21 03:45:51 +0100
+++ scan.c 2006-02-23 15:41:40 +0100
@@ -2649,7 +2649,7 @@
case 77:
YY_RULE_SETUP
#line 354 "scan.l"
-ACTION_IFDEF("YY_NO_UNISTD_H", ! option_sense);
+ACTION_M4_IFDEF("M4""_YY_NO_UNISTD_H", ! option_sense);
YY_BREAK
case 78:
YY_RULE_SETUP
Index: scan.l
--- scan.l.orig 2006-02-14 20:28:53 +0100
+++ scan.l 2006-02-23 15:27:46 +0100
@@ -351,7 +351,7 @@
stack ACTION_M4_IFDEF( "M4""_YY_STACK_USED", option_sense );
stdinit do_stdinit = option_sense;
stdout use_stdout = option_sense;
- unistd ACTION_IFDEF("YY_NO_UNISTD_H", ! option_sense);
+ unistd ACTION_M4_IFDEF("M4""_YY_NO_UNISTD_H", ! option_sense);
unput ACTION_M4_IFDEF("M4""_YY_NO_UNPUT", ! option_sense);
verbose printstats = option_sense;
warn nowarn = ! option_sense;
Index: skel.c
--- skel.c.orig 2006-02-21 03:45:41 +0100
+++ skel.c 2006-02-23 15:43:40 +0100
@@ -59,6 +59,34 @@ const char *skel[] = {
"%# the generated scanner as a C-style comment. This is to aid those who",
"%# edit the skeleton.",
"%#",
+ "",
+ "%not-for-header",
+ "%if-c-only",
+ "%if-not-reentrant",
+ "m4_ifelse(M4_YY_PREFIX,yy,,",
+ "#define yy_create_buffer M4_YY_PREFIX[[_create_buffer]]",
+ "#define yy_delete_buffer M4_YY_PREFIX[[_delete_buffer]]",
+ "#define yy_flex_debug M4_YY_PREFIX[[_flex_debug]]",
+ "#define yy_init_buffer M4_YY_PREFIX[[_init_buffer]]",
+ "#define yy_flush_buffer M4_YY_PREFIX[[_flush_buffer]]",
+ "#define yy_load_buffer_state M4_YY_PREFIX[[_load_buffer_state]]",
+ "#define yy_switch_to_buffer M4_YY_PREFIX[[_switch_to_buffer]]",
+ "#define yyin M4_YY_PREFIX[[in]]",
+ "#define yyleng M4_YY_PREFIX[[leng]]",
+ "#define yylex M4_YY_PREFIX[[lex]]",
+ "#define yylineno M4_YY_PREFIX[[lineno]]",
+ "#define yyout M4_YY_PREFIX[[out]]",
+ "#define yyrestart M4_YY_PREFIX[[restart]]",
+ "#define yytext M4_YY_PREFIX[[text]]",
+ "#define yywrap M4_YY_PREFIX[[wrap]]",
+ "#define yyalloc M4_YY_PREFIX[[alloc]]",
+ "#define yyrealloc M4_YY_PREFIX[[realloc]]",
+ "#define yyfree M4_YY_PREFIX[[free]]",
+ ")",
+ "%endif",
+ "%endif",
+ "%ok-for-header",
+ "",
"#define FLEX_SCANNER",
"#define YY_FLEX_MAJOR_VERSION 2",
"#define YY_FLEX_MINOR_VERSION 5",
@@ -983,6 +983,18 @@
"void yyset_lineno M4_YY_PARAMS( int line_number M4_YY_PROTO_LAST_ARG );",
"]])",
"",
+ "m4_ifdef( [[M4_YY_REENTRANT]],",
+ "[[",
+ "m4_ifdef( [[M4_YY_NO_GET_COLUMN]],,",
+ "[[",
+ "int yyget_column M4_YY_PARAMS( M4_YY_PROTO_ONLY_ARG );",
+ "]])",
+ "m4_ifdef( [[M4_YY_NO_SET_COLUMN]],,",
+ "[[",
+ "void yyset_column M4_YY_PARAMS( int column_no M4_YY_PROTO_LAST_ARG );",
+ "]])",
+ "]])",
+ "",
"%if-bison-bridge",
"m4_ifdef( [[M4_YY_NO_GET_LVAL]],,",
"[[",
@@ -1351,9 +1363,9 @@
" m4_dnl The bison pure parser is used. Redefine yylex to",
" m4_dnl accept the lval parameter.",
"",
- " m4_define( [[M4_YY_LEX_PROTO]],",
+ " m4_define( [[M4_YY_LEX_PROTO]], [[\\]]",
" [[M4_YY_PARAMS(YYSTYPE * yylval_param M4_YY_PROTO_LAST_ARG)]])",
- " m4_define( [[M4_YY_LEX_DECLARATION]],",
+ " m4_define( [[M4_YY_LEX_DECLARATION]], [[\\]]",
" [[YYFARGS1(YYSTYPE *,yylval_param)]])",
"]])",
"",
@@ -1361,9 +1373,9 @@
"[[",
" m4_dnl Locations are used. yylex should also accept the ylloc parameter.",
"",
- " m4_define( [[M4_YY_LEX_PROTO]],",
+ " m4_define( [[M4_YY_LEX_PROTO]], [[\\]]",
" [[M4_YY_PARAMS(YYSTYPE * yylval_param, YYLTYPE * yylloc_param M4_YY_PROTO_LAST_ARG)]])",
- " m4_define( [[M4_YY_LEX_DECLARATION]],",
+ " m4_define( [[M4_YY_LEX_DECLARATION]], [[\\]]",
" [[YYFARGS2(YYSTYPE *,yylval_param, YYLTYPE *,yylloc_param)]])",
"]])",
"",
Index: tables.c
--- tables.c.orig 2002-11-27 15:43:24 +0100
+++ tables.c 2006-02-23 15:27:48 +0100
@@ -86,7 +86,7 @@
th->th_magic = YYTBL_MAGIC;
th->th_hsize = 14 + strlen (version_str) + 1 + strlen (name) + 1;
th->th_hsize += yypad64 (th->th_hsize);
- th->th_ssize = 0; // Not known at this point.
+ th->th_ssize = 0;
th->th_flags = 0;
th->th_version = copy_string (version_str);
th->th_name = copy_string (name);
Index: scanopt.c
--- scanopt.c.orig 2002-08-29 22:30:25.000000000 +0200
+++ scanopt.c 2007-05-11 17:48:29.000000000 +0200
@@ -789,12 +789,12 @@ int scanopt (svoid, arg, optindex)
}
optarg = pstart + 1;
- arglen = 0;
- while (optarg[arglen])
- arglen++;
-
- if (arglen == 0)
+ if (!*optarg) {
optarg = NULL;
+ arglen = 0;
+ }
+ else
+ arglen = strlen (optarg);
}
/* At this point, we have a long or short option matched at opt_offset into
@@ -812,13 +812,16 @@ int scanopt (svoid, arg, optindex)
/* case: no args allowed */
if (auxp->flags & ARG_NONE) {
- if (optarg) {
+ if (optarg && !is_short) {
scanopt_err (s, opt_offset, is_short, errcode =
SCANOPT_ERR_ARG_NOT_ALLOWED);
INC_INDEX (s, 1);
return errcode;
}
- INC_INDEX (s, 1);
+ else if (!optarg)
+ INC_INDEX (s, 1);
+ else
+ s->subscript++;
return optp->r_val;
}