Re: [Request for review] wrc: Add support for nameID with quotes
Alexandre Julliard wrote: Matijn Woudt tijn...@gmail.com writes: Thanks, didn't notice that one. I've checked it with the rc from visual studio 2008 and you're right, it's really mysterious(just like the rest of windows). Single and double quotes are just copied, but only if they are in pairs. Though, there can be a single quote within two double quotes, and the other way around. I've attached a patch for this behaviour, is it ready to send to wine-patches? I expect it will break parsing of normal strings. As you state (AJ): A test case would be great to show what Windows(TM) and what Wine does to see if the patch really fixes the problem. James McKenzie
Re: [Request for review] wrc: Add support for nameID with quotes
James McKenzie jjmckenzi...@earthlink.net wrote: As you state (AJ): A test case would be great to show what Windows(TM) and what Wine does to see if the patch really fixes the problem. Windows(TM) does nothing with resource files. -- Dmitry.
Re: [Request for review] wrc: Add support for nameID with quotes
Tijnema tijn...@gmail.com writes: Hello all, I was just checking around some old bugs and found 786 still opened. I've written a patch for it, but I want to know if I'm anywhere close to get it in. That would be a good way to handle quoted strings, but that's not what Windows does. It doesn't really handle them, the quotes are simply copied through. You can probably even put quotes in the middle of the name. The behavior of the RC parser can be quite mysterious at times. -- Alexandre Julliard julli...@winehq.org
Re: [Request for review] wrc: Add support for nameID with quotes
On Wed, Jun 3, 2009 at 9:28 AM, Alexandre Julliard julli...@winehq.org wrote: Tijnema tijn...@gmail.com writes: Hello all, I was just checking around some old bugs and found 786 still opened. I've written a patch for it, but I want to know if I'm anywhere close to get it in. That would be a good way to handle quoted strings, but that's not what Windows does. It doesn't really handle them, the quotes are simply copied through. You can probably even put quotes in the middle of the name. The behavior of the RC parser can be quite mysterious at times. Thanks, didn't notice that one. I've checked it with the rc from visual studio 2008 and you're right, it's really mysterious(just like the rest of windows). Single and double quotes are just copied, but only if they are in pairs. Though, there can be a single quote within two double quotes, and the other way around. I've attached a patch for this behaviour, is it ready to send to wine-patches? Matijn Woudt From 6064f93f1d0479efa5da627045c693dde8d69f8c Mon Sep 17 00:00:00 2001 From: Matijn Woudt tijn...@gmail.com Date: Wed, 3 Jun 2009 12:42:21 +0200 Subject: wrc: Add support for nameID with single and double quotes. --- tools/wrc/parser.l |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/tools/wrc/parser.l b/tools/wrc/parser.l index bddc309..be73068 100644 --- a/tools/wrc/parser.l +++ b/tools/wrc/parser.l @@ -404,7 +404,7 @@ static unsigned long xstrtoul(const char *nptr, char **endptr, int base) * and *only* in a filename. In this case, the second * rule will be reduced because it is longer. */ -[A-Za-z_0-9.]+ { +((['][A-Za-z_0-9.]+['])|([]['A-Za-z_0-9.]+[])|([A-Za-z_0-9.]+))+{ struct keyword *tok = iskeyword(yytext); if(tok) -- 1.6.0.4
Re: [Request for review] wrc: Add support for nameID with quotes
Matijn Woudt tijn...@gmail.com writes: Thanks, didn't notice that one. I've checked it with the rc from visual studio 2008 and you're right, it's really mysterious(just like the rest of windows). Single and double quotes are just copied, but only if they are in pairs. Though, there can be a single quote within two double quotes, and the other way around. I've attached a patch for this behaviour, is it ready to send to wine-patches? I expect it will break parsing of normal strings. -- Alexandre Julliard julli...@winehq.org
[Request for review] wrc: Add support for nameID with quotes
Hello all, I was just checking around some old bugs and found 786 still opened. I've written a patch for it, but I want to know if I'm anywhere close to get it in. I'm sorry if I'm only wasting your time. Matijn From 60244428d2ef1af082c99acce6e51da9ef247eec Mon Sep 17 00:00:00 2001 From: Matijn Woudt tijn...@gmail.com Date: Wed, 3 Jun 2009 01:04:12 +0200 Subject: wrc: Add support for nameID with quotes --- tools/wrc/parser.l | 39 --- 1 files changed, 32 insertions(+), 7 deletions(-) diff --git a/tools/wrc/parser.l b/tools/wrc/parser.l index bddc309..5b92ce3 100644 --- a/tools/wrc/parser.l +++ b/tools/wrc/parser.l @@ -125,7 +125,7 @@ static void addcchar(char c); static void addwchar(WCHAR s); static string_t *get_buffered_cstring(void); static string_t *get_buffered_wstring(void); -static string_t *make_string(char *s); +static string_t *make_string(char *s, int withQuotes); static char *cbuffer; /* Buffers for string collection */ static int cbufidx; @@ -411,7 +411,7 @@ static unsigned long xstrtoul(const char *nptr, char **endptr, int base) { if(wanted_id !tok-alwayskw) { - parser_lval.str = make_string(yytext); + parser_lval.str = make_string(yytext, 0); return tIDENT; } else @@ -419,11 +419,30 @@ static unsigned long xstrtoul(const char *nptr, char **endptr, int base) } else { - parser_lval.str = make_string(yytext); + parser_lval.str = make_string(yytext, 0); return tIDENT; } } -[A-Za-z_0-9./\\]+ parser_lval.str = make_string(yytext); return tFILENAME; +[][A-Za-z_0-9.]+[] { + struct keyword *tok = iskeyword(yytext); + + if(tok) + { + if(wanted_id !tok-alwayskw) + { + parser_lval.str = make_string(yytext, 1); + return tIDENT; + } + else + return tok-token; + } + else + { + parser_lval.str = make_string(yytext, 1); + return tIDENT; + } + } +[A-Za-z_0-9./\\]+ parser_lval.str = make_string(yytext, 0); return tFILENAME; /* * Wide string scanning @@ -650,12 +669,18 @@ static string_t *get_buffered_wstring(void) return str; } -static string_t *make_string(char *s) +static string_t *make_string(char *s, int withQuotes) { string_t *str = new_string(); str-size = strlen(s); str-type = str_char; - str-str.cstr = xmalloc(str-size+1); - memcpy(str-str.cstr, s, str-size+1); + if(withQuotes) { + str-str.cstr = xmalloc(str-size-1); + *(s + str-size - 1) = 0; + memcpy(str-str.cstr, s+1, str-size-1); + } else { + str-str.cstr = xmalloc(str-size+1); + memcpy(str-str.cstr, s, str-size+1); + } return str; } -- 1.6.0.4