This is the mail archive of the
binutils@sourceware.cygnus.com
mailing list for the binutils project.
(patch) small windres fixes
- To: binutils at sourceware dot cygnus dot com
- Subject: (patch) small windres fixes
- From: Mumit Khan <khan at nanotech dot wisc dot edu>
- Date: Tue, 23 Nov 1999 14:09:22 -0600
Few small changes to windres (in order of appearance in ChangeLog):
1. Handle L"string" as well as "string" in QUOTEDSTRING and SIZEDSTRINGS.
Note that I haven't dealt with two-byte Unicode escape sequences here
as I don't know what those are, and haven't found any .rc files that
actually use those esc seq ... still looking at MS docs.
2. If the optional string arg (first arg) for controls is left out,
windres sets that to NULL, which instead should be initialized to an
empty string. For Edit controls, this shows up as garbage, and other
controls react differently.
3. Fix handling of CLASS id in styles, which may be posnumexpr or a
quoted string (and not uppercase'd as in id).
Mon Nov 22 17:47:38 1999 Mumit Khan <khan@xraylith.wisc.edu>
* rclex.l: Accept wide character strings.
(handle_quotes): Handle.
* rcparse.y (class_id): New non-terminal.
(styles): Use.
* resrc.c (define_control): Default to empty, not NULL, string when
not specified.
Index: rclex.l
===================================================================
RCS file: /homes/khan/src/CVSROOT/cygwin/binutils/rclex.l,v
retrieving revision 1.1.1.1
diff -u -3 -p -r1.1.1.1 rclex.l
--- rclex.l 1999/02/19 05:36:05 1.1.1.1
+++ rclex.l 1999/11/22 23:13:54
@@ -179,7 +179,7 @@ static char *get_string PARAMS ((int));
return NUMBER;
}
-("\""[^\"\n]*"\""[ \t]*)+ {
+[L]?("\""[^\"\n]*"\""[ \t]*)+ {
char *s;
unsigned long length;
@@ -277,7 +277,11 @@ handle_quotes (input, len)
char *ret, *s;
const char *t;
int ch;
+ int wchar = (input[0] == 'L');
+ if (wchar)
+ ++input;
+
ret = get_string (strlen (input) + 1);
s = ret;
@@ -286,6 +290,8 @@ handle_quotes (input, len)
++t;
while (*t != '\0')
{
+ /* FIXME: How to handle two-byte (Unicode) escape sequences for
+ wide character strings? */
if (*t == '\\')
{
++t;
Index: rcparse.y
===================================================================
RCS file: /homes/khan/src/CVSROOT/cygwin/binutils/rcparse.y,v
retrieving revision 1.1.1.1
diff -u -3 -p -r1.1.1.1 rcparse.y
--- rcparse.y 1999/02/19 05:36:05 1.1.1.1
+++ rcparse.y 1999/11/21 23:13:34
@@ -135,7 +135,7 @@ static unsigned long class;
%type <vervar> vertrans
%type <res_info> suboptions memflags_move_discard memflags_move
%type <memflags> memflag
-%type <id> id
+%type <id> id class_id
%type <il> exstyle parennumber
%type <il> numexpr posnumexpr cnumexpr optcnumexpr cposnumexpr
%type <is> acc_options acc_option menuitem_flags menuitem_flag
@@ -410,7 +410,7 @@ styles:
{
unicode_from_ascii ((int *) NULL, &dialog.caption, $3);
}
- | styles CLASS id
+ | styles CLASS class_id
{
dialog.class = $3;
}
@@ -1267,6 +1267,20 @@ id:
*s = toupper ((unsigned char) *s);
res_string_to_id (&$$, copy);
free (copy);
+ }
+ ;
+
+/* A class ID. */
+
+class_id:
+ posnumexpr
+ {
+ $$.named = 0;
+ $$.u.id = $1;
+ }
+ | QUOTEDSTRING
+ {
+ res_string_to_id (&$$, $1);
}
;
Index: resrc.c
===================================================================
RCS file: /homes/khan/src/CVSROOT/cygwin/binutils/resrc.c,v
retrieving revision 1.1.1.1
diff -u -3 -p -r1.1.1.1 resrc.c
--- resrc.c 1999/02/19 05:36:05 1.1.1.1
+++ resrc.c 1999/11/22 23:16:41
@@ -499,13 +499,7 @@ define_control (text, id, x, y, width, h
n->height = height;
n->class.named = 0;
n->class.u.id = class;
- if (text != NULL)
- res_string_to_id (&n->text, text);
- else
- {
- n->text.named = 0;
- n->text.u.id = 0;
- }
+ res_string_to_id (&n->text, (text) ? text : "");
n->data = NULL;
n->help = 0;