Michael Mohr
2006-04-27 00:26:36 UTC
There appears to be a problem with the cvs tree that prevents me from building winex from cvs. This may well be a problem with my version of m4, or possibly flex. However, these problems will likely manifest themselves whenever someone uses the same versions of these tools that I do. So I thought that I might help out someone else by submitting a patch.
The first fix is to ppl.l in wrc and widl. The file isn't parsed properly unless a space is inserted on a specific line near the top of the file.
The second fix is with wrc's parser.l. It is used to generate lex.yy.c. The problem is that lex.yy.c's yy_scan_string() function doesn't match its prototype. I have never used flex in my projects and so am not familiar with how it works. However, a quick bludgeon with sed sets it straight if you replace all occurrences of yystr with yy_str.
I realize that fix #2 isn't all that elegant, but it appears to work thus far. If anyone cares to reply to this message, please include me in your CC as I'm not subscribed to winex-devel.
TIA
Mike
diff -urN winex/tools/widl/ppl.l winex.new/tools/widl/ppl.l
--- winex/tools/widl/ppl.l 2002-08-04 12:42:56.000000000 -0700
+++ winex.new/tools/widl/ppl.l 2006-04-26 17:09:32.000000000 -0700
@@ -30,7 +30,7 @@
* | {ws} # {ws} error {ws} {anytext} \n
* | {ws} # {ws} warning {ws} {anytext} \n
* | {ws} # {ws} line {ws} " {anytext} " {number} \n
- * | {ws} # {ws} {number} " {anytext} " {number} [{number} [{number}]] \n
+ * | {ws} # {ws} {number} " {anytext} " {number} [{number} [{number}] ] \n
* | {ws} # {ws} \n
*
* ws := [ \t\r\f\v]*
diff -urN winex/tools/wrc/parser.l winex.new/tools/wrc/parser.l
--- winex/tools/wrc/parser.l 2006-01-09 10:21:50.000000000 -0800
+++ winex.new/tools/wrc/parser.l 2006-04-26 17:08:54.000000000 -0700
@@ -53,7 +53,7 @@
*/
/* Exclusive string handling */
-%x yystr
+%x yy_str
/* Exclusive unicode string handling */
%x yylstr
/* Exclusive rcdata single quoted data handling */
@@ -440,46 +440,46 @@
/*
* Normal string scanning
*/
-\" yy_push_state(yystr); cbufidx = 0;
-<yystr>\"{ws}+ |
-<yystr>\" {
+\" yy_push_state(yy_str); cbufidx = 0;
+<yy_str>\"{ws}+ |
+<yy_str>\" {
yy_pop_state();
yylval.str = get_buffered_cstring();
return tSTRING;
}
-<yystr>\\[0-7]{1,3} { /* octal escape sequence */
+<yy_str>\\[0-7]{1,3} { /* octal escape sequence */
int result;
result = strtol(yytext+1, 0, 8);
if ( result > 0xff )
yyerror("Character constant out of range");
addcchar((char)result);
}
-<yystr>\\x[0-9a-fA-F]{2} { /* hex escape sequence */
+<yy_str>\\x[0-9a-fA-F]{2} { /* hex escape sequence */
int result;
result = strtol(yytext+2, 0, 16);
addcchar((char)result);
}
-<yystr>\\x[0-9a-fA-F] { yyerror("Invalid hex escape sequence '%s'", yytext); }
+<yy_str>\\x[0-9a-fA-F] { yyerror("Invalid hex escape sequence '%s'", yytext); }
-<yystr>\\[0-9]+ yyerror("Bad escape secuence");
-<yystr>\\a addcchar('\a');
-<yystr>\\b addcchar('\b');
-<yystr>\\f addcchar('\f');
-<yystr>\\n addcchar('\n');
-<yystr>\\r addcchar('\r');
-<yystr>\\t addcchar('\t');
-<yystr>\\v addcchar('\v');
-<yystr>\\(\n|.) addcchar(yytext[1]);
-<yystr>\\\r\n addcchar(yytext[2]);
-<yystr>[^\\\n\"]+ {
+<yy_str>\\[0-9]+ yyerror("Bad escape secuence");
+<yy_str>\\a addcchar('\a');
+<yy_str>\\b addcchar('\b');
+<yy_str>\\f addcchar('\f');
+<yy_str>\\n addcchar('\n');
+<yy_str>\\r addcchar('\r');
+<yy_str>\\t addcchar('\t');
+<yy_str>\\v addcchar('\v');
+<yy_str>\\(\n|.) addcchar(yytext[1]);
+<yy_str>\\\r\n addcchar(yytext[2]);
+<yy_str>[^\\\n\"]+ {
char *yptr = yytext;
while(*yptr)
addcchar(*yptr++);
}
-<yystr>\"\" addcchar('\"'); /* "bla""bla" -> "bla\"bla" */
-<yystr>\\\"\" addcchar('\"'); /* "bla\""bla" -> "bla\"bla" */
-<yystr>\"{ws}+\" ; /* "bla" "bla" -> "blabla" */
-<yystr>\n yyerror("Unterminated string");
+<yy_str>\"\" addcchar('\"'); /* "bla""bla" -> "bla\"bla" */
+<yy_str>\\\"\" addcchar('\"'); /* "bla\""bla" -> "bla\"bla" */
+<yy_str>\"{ws}+\" ; /* "bla" "bla" -> "blabla" */
+<yy_str>\n yyerror("Unterminated string");
/*
* Raw data scanning
diff -urN winex/tools/wrc/ppl.l winex.new/tools/wrc/ppl.l
--- winex/tools/wrc/ppl.l 2001-12-31 02:53:15.000000000 -0800
+++ winex.new/tools/wrc/ppl.l 2006-04-26 17:09:20.000000000 -0700
@@ -30,7 +30,7 @@
* | {ws} # {ws} error {ws} {anytext} \n
* | {ws} # {ws} warning {ws} {anytext} \n
* | {ws} # {ws} line {ws} " {anytext} " {number} \n
- * | {ws} # {ws} {number} " {anytext} " {number} [{number} [{number}]] \n
+ * | {ws} # {ws} {number} " {anytext} " {number} [{number} [{number}] ] \n
* | {ws} # {ws} \n
*
* ws := [ \t\r\f\v]*
The first fix is to ppl.l in wrc and widl. The file isn't parsed properly unless a space is inserted on a specific line near the top of the file.
The second fix is with wrc's parser.l. It is used to generate lex.yy.c. The problem is that lex.yy.c's yy_scan_string() function doesn't match its prototype. I have never used flex in my projects and so am not familiar with how it works. However, a quick bludgeon with sed sets it straight if you replace all occurrences of yystr with yy_str.
I realize that fix #2 isn't all that elegant, but it appears to work thus far. If anyone cares to reply to this message, please include me in your CC as I'm not subscribed to winex-devel.
TIA
Mike
diff -urN winex/tools/widl/ppl.l winex.new/tools/widl/ppl.l
--- winex/tools/widl/ppl.l 2002-08-04 12:42:56.000000000 -0700
+++ winex.new/tools/widl/ppl.l 2006-04-26 17:09:32.000000000 -0700
@@ -30,7 +30,7 @@
* | {ws} # {ws} error {ws} {anytext} \n
* | {ws} # {ws} warning {ws} {anytext} \n
* | {ws} # {ws} line {ws} " {anytext} " {number} \n
- * | {ws} # {ws} {number} " {anytext} " {number} [{number} [{number}]] \n
+ * | {ws} # {ws} {number} " {anytext} " {number} [{number} [{number}] ] \n
* | {ws} # {ws} \n
*
* ws := [ \t\r\f\v]*
diff -urN winex/tools/wrc/parser.l winex.new/tools/wrc/parser.l
--- winex/tools/wrc/parser.l 2006-01-09 10:21:50.000000000 -0800
+++ winex.new/tools/wrc/parser.l 2006-04-26 17:08:54.000000000 -0700
@@ -53,7 +53,7 @@
*/
/* Exclusive string handling */
-%x yystr
+%x yy_str
/* Exclusive unicode string handling */
%x yylstr
/* Exclusive rcdata single quoted data handling */
@@ -440,46 +440,46 @@
/*
* Normal string scanning
*/
-\" yy_push_state(yystr); cbufidx = 0;
-<yystr>\"{ws}+ |
-<yystr>\" {
+\" yy_push_state(yy_str); cbufidx = 0;
+<yy_str>\"{ws}+ |
+<yy_str>\" {
yy_pop_state();
yylval.str = get_buffered_cstring();
return tSTRING;
}
-<yystr>\\[0-7]{1,3} { /* octal escape sequence */
+<yy_str>\\[0-7]{1,3} { /* octal escape sequence */
int result;
result = strtol(yytext+1, 0, 8);
if ( result > 0xff )
yyerror("Character constant out of range");
addcchar((char)result);
}
-<yystr>\\x[0-9a-fA-F]{2} { /* hex escape sequence */
+<yy_str>\\x[0-9a-fA-F]{2} { /* hex escape sequence */
int result;
result = strtol(yytext+2, 0, 16);
addcchar((char)result);
}
-<yystr>\\x[0-9a-fA-F] { yyerror("Invalid hex escape sequence '%s'", yytext); }
+<yy_str>\\x[0-9a-fA-F] { yyerror("Invalid hex escape sequence '%s'", yytext); }
-<yystr>\\[0-9]+ yyerror("Bad escape secuence");
-<yystr>\\a addcchar('\a');
-<yystr>\\b addcchar('\b');
-<yystr>\\f addcchar('\f');
-<yystr>\\n addcchar('\n');
-<yystr>\\r addcchar('\r');
-<yystr>\\t addcchar('\t');
-<yystr>\\v addcchar('\v');
-<yystr>\\(\n|.) addcchar(yytext[1]);
-<yystr>\\\r\n addcchar(yytext[2]);
-<yystr>[^\\\n\"]+ {
+<yy_str>\\[0-9]+ yyerror("Bad escape secuence");
+<yy_str>\\a addcchar('\a');
+<yy_str>\\b addcchar('\b');
+<yy_str>\\f addcchar('\f');
+<yy_str>\\n addcchar('\n');
+<yy_str>\\r addcchar('\r');
+<yy_str>\\t addcchar('\t');
+<yy_str>\\v addcchar('\v');
+<yy_str>\\(\n|.) addcchar(yytext[1]);
+<yy_str>\\\r\n addcchar(yytext[2]);
+<yy_str>[^\\\n\"]+ {
char *yptr = yytext;
while(*yptr)
addcchar(*yptr++);
}
-<yystr>\"\" addcchar('\"'); /* "bla""bla" -> "bla\"bla" */
-<yystr>\\\"\" addcchar('\"'); /* "bla\""bla" -> "bla\"bla" */
-<yystr>\"{ws}+\" ; /* "bla" "bla" -> "blabla" */
-<yystr>\n yyerror("Unterminated string");
+<yy_str>\"\" addcchar('\"'); /* "bla""bla" -> "bla\"bla" */
+<yy_str>\\\"\" addcchar('\"'); /* "bla\""bla" -> "bla\"bla" */
+<yy_str>\"{ws}+\" ; /* "bla" "bla" -> "blabla" */
+<yy_str>\n yyerror("Unterminated string");
/*
* Raw data scanning
diff -urN winex/tools/wrc/ppl.l winex.new/tools/wrc/ppl.l
--- winex/tools/wrc/ppl.l 2001-12-31 02:53:15.000000000 -0800
+++ winex.new/tools/wrc/ppl.l 2006-04-26 17:09:20.000000000 -0700
@@ -30,7 +30,7 @@
* | {ws} # {ws} error {ws} {anytext} \n
* | {ws} # {ws} warning {ws} {anytext} \n
* | {ws} # {ws} line {ws} " {anytext} " {number} \n
- * | {ws} # {ws} {number} " {anytext} " {number} [{number} [{number}]] \n
+ * | {ws} # {ws} {number} " {anytext} " {number} [{number} [{number}] ] \n
* | {ws} # {ws} \n
*
* ws := [ \t\r\f\v]*