aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2003-03-31 10:15:58 +0000
committerNick Clifton <nickc@redhat.com>2003-03-31 10:15:58 +0000
commit7adbf450a7e4889b8e7a50b85679eab25b5b9242 (patch)
tree6c30a55e6a2cccb16259f8f9696a5d460c2767d1
parented234cf86397afc0a0e87f7d264a41aac93d0587 (diff)
downloadgdb-7adbf450a7e4889b8e7a50b85679eab25b5b9242.zip
gdb-7adbf450a7e4889b8e7a50b85679eab25b5b9242.tar.gz
gdb-7adbf450a7e4889b8e7a50b85679eab25b5b9242.tar.bz2
Allow resource IDs to be strings or numbers.
Add a test for this.
-rw-r--r--binutils/ChangeLog11
-rw-r--r--binutils/rcparse.y39
-rw-r--r--binutils/resrc.c15
-rw-r--r--binutils/testsuite/ChangeLog5
-rw-r--r--binutils/testsuite/binutils-all/windres/dialogid.rc9
-rw-r--r--binutils/testsuite/binutils-all/windres/dialogid.rsd13
-rw-r--r--binutils/windres.h8
7 files changed, 72 insertions, 28 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 276a3eb..dd9843f 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,12 @@
+2003-03-31 Ian Lance Taylor <ian@airs.com>
+
+ * rcparse.y: Replace uses of 'optstringrc' with 'optresid'.
+ (optresid): Handle a resource id that can be a string or a number.
+ * resrc.c (define_control): Replace 'text' parameter with 'iid' a
+ struct res_id.
+ (define_icon_control): Pass a struct res_id to define_control.
+ * windres.h (define_control): Change prototype.
+
2003-03-24 Elias Athanasopoulos <elathan@phys.uoa.gr>
* objcopy (OPTION_FORMATS_INFO): Define.
@@ -27,7 +36,7 @@
libbfd.h.
* Makefile.in: Regenerate.
-2003-03-22 Danny Smith <dannysmith@users.sourceforge,net>
+2003-03-22 Danny Smith <dannysmith@users.sourceforge.net>
* dlltool.c (gen_def_file): Put demangled name comments on
own line preceding export name.
diff --git a/binutils/rcparse.y b/binutils/rcparse.y
index 1f10da7..f287eb4 100644
--- a/binutils/rcparse.y
+++ b/binutils/rcparse.y
@@ -1,5 +1,5 @@
%{ /* rcparse.y -- parser for Windows rc files
- Copyright 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
This file is part of GNU Binutils.
@@ -135,11 +135,11 @@ static unsigned long class;
%type <vervar> vertrans
%type <res_info> suboptions memflags_move_discard memflags_move
%type <memflags> memflag
-%type <id> id resref
+%type <id> id optresidc resref
%type <il> exstyle parennumber
%type <il> numexpr posnumexpr cnumexpr optcnumexpr cposnumexpr
%type <is> acc_options acc_option menuitem_flags menuitem_flag
-%type <s> optstringc file_name resname
+%type <s> file_name resname
%type <i> sizednumexpr sizedposnumexpr
%left '|'
@@ -596,7 +596,7 @@ control:
{
$$ = $3;
}
- | CONTROL optstringc numexpr cnumexpr control_styleexpr cnumexpr
+ | CONTROL optresidc numexpr cnumexpr control_styleexpr cnumexpr
cnumexpr cnumexpr cnumexpr optcnumexpr opt_control_data
{
$$ = define_control ($2, $3, $6, $7, $8, $9, $4, style, $10);
@@ -607,7 +607,7 @@ control:
$$->data = $11;
}
}
- | CONTROL optstringc numexpr cnumexpr control_styleexpr cnumexpr
+ | CONTROL optresidc numexpr cnumexpr control_styleexpr cnumexpr
cnumexpr cnumexpr cnumexpr cnumexpr cnumexpr opt_control_data
{
$$ = define_control ($2, $3, $6, $7, $8, $9, $4, style, $10);
@@ -616,7 +616,7 @@ control:
$$->help = $11;
$$->data = $12;
}
- | CONTROL optstringc numexpr ',' QUOTEDSTRING control_styleexpr
+ | CONTROL optresidc numexpr ',' QUOTEDSTRING control_styleexpr
cnumexpr cnumexpr cnumexpr cnumexpr optcnumexpr opt_control_data
{
$$ = define_control ($2, $3, $7, $8, $9, $10, 0, style, $11);
@@ -629,7 +629,7 @@ control:
$$->class.named = 1;
unicode_from_ascii (&$$->class.u.n.length, &$$->class.u.n.name, $5);
}
- | CONTROL optstringc numexpr ',' QUOTEDSTRING control_styleexpr
+ | CONTROL optresidc numexpr ',' QUOTEDSTRING control_styleexpr
cnumexpr cnumexpr cnumexpr cnumexpr cnumexpr cnumexpr opt_control_data
{
$$ = define_control ($2, $3, $7, $8, $9, $10, 0, style, $11);
@@ -809,13 +809,13 @@ control:
{
$$ = $3;
}
- | USERBUTTON QUOTEDSTRING ',' numexpr ',' numexpr ',' numexpr ','
+ | USERBUTTON resref numexpr ',' numexpr ',' numexpr ','
numexpr ',' numexpr ','
{ style = WS_CHILD | WS_VISIBLE; }
styleexpr optcnumexpr
{
- $$ = define_control ($2, $4, $6, $8, $10, $12, CTL_BUTTON,
- style, $16);
+ $$ = define_control ($2, $3, $5, $7, $9, $11, CTL_BUTTON,
+ style, $15);
}
;
@@ -827,7 +827,7 @@ control:
style. CLASS is the class of the control. */
control_params:
- optstringc numexpr cnumexpr cnumexpr cnumexpr cnumexpr
+ optresidc numexpr cnumexpr cnumexpr cnumexpr cnumexpr
opt_control_data
{
$$ = define_control ($1, $2, $3, $4, $5, $6, class,
@@ -839,7 +839,7 @@ control_params:
$$->data = $7;
}
}
- | optstringc numexpr cnumexpr cnumexpr cnumexpr cnumexpr
+ | optresidc numexpr cnumexpr cnumexpr cnumexpr cnumexpr
control_params_styleexpr optcnumexpr opt_control_data
{
$$ = define_control ($1, $2, $3, $4, $5, $6, class, style, $8);
@@ -850,7 +850,7 @@ control_params:
$$->data = $9;
}
}
- | optstringc numexpr cnumexpr cnumexpr cnumexpr cnumexpr
+ | optresidc numexpr cnumexpr cnumexpr cnumexpr cnumexpr
control_params_styleexpr cnumexpr cnumexpr opt_control_data
{
$$ = define_control ($1, $2, $3, $4, $5, $6, class, style, $8);
@@ -861,18 +861,23 @@ control_params:
}
;
-optstringc:
+optresidc:
/* empty */
{
- $$ = NULL;
+ res_string_to_id (&$$, "");
+ }
+ | posnumexpr ','
+ {
+ $$.named = 0;
+ $$.u.id = $1;
}
| QUOTEDSTRING
{
- $$ = $1;
+ res_string_to_id (&$$, $1);
}
| QUOTEDSTRING ','
{
- $$ = $1;
+ res_string_to_id (&$$, $1);
}
;
diff --git a/binutils/resrc.c b/binutils/resrc.c
index 3cf708a..a895597 100644
--- a/binutils/resrc.c
+++ b/binutils/resrc.c
@@ -1,5 +1,5 @@
/* resrc.c -- read and write Windows rc files.
- Copyright 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
+ Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
This file is part of GNU Binutils.
@@ -818,8 +818,8 @@ define_dialog (id, resinfo, dialog)
merely allocates and fills in a structure. */
struct dialog_control *
-define_control (text, id, x, y, width, height, class, style, exstyle)
- const char *text;
+define_control (iid, id, x, y, width, height, class, style, exstyle)
+ struct res_id iid;
unsigned long id;
unsigned long x;
unsigned long y;
@@ -842,9 +842,7 @@ define_control (text, id, x, y, width, height, class, style, exstyle)
n->height = height;
n->class.named = 0;
n->class.u.id = class;
- if (text == NULL)
- text = "";
- res_string_to_id (&n->text, text);
+ n->text = iid;
n->data = NULL;
n->help = 0;
@@ -864,9 +862,12 @@ define_icon_control (iid, id, x, y, style, exstyle, help, data, ex)
struct dialog_ex *ex;
{
struct dialog_control *n;
+ struct res_id tid;
+
if (style == 0)
style = SS_ICON | WS_CHILD | WS_VISIBLE;
- n = define_control (0, id, x, y, 0, 0, CTL_STATIC, style, exstyle);
+ res_string_to_id (&tid, "");
+ n = define_control (tid, id, x, y, 0, 0, CTL_STATIC, style, exstyle);
n->text = iid;
if (help && !ex)
rcparse_warning (_("help ID requires DIALOGEX"));
diff --git a/binutils/testsuite/ChangeLog b/binutils/testsuite/ChangeLog
index da464da..b0bf165 100644
--- a/binutils/testsuite/ChangeLog
+++ b/binutils/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2003-03-31 Nick Clifton <nickc@redhat.com>
+
+ * binutils-all/windres/dialogid.rc: New test source file.
+ * binutils-all/windres/dialogid.rsd: New test expected results.
+
2002-11-07 Casper S. Hornstrup <chorns@users.sourceforge.net>
* binutils-all/dlltool.exp: New file for testing dlltool.
diff --git a/binutils/testsuite/binutils-all/windres/dialogid.rc b/binutils/testsuite/binutils-all/windres/dialogid.rc
new file mode 100644
index 0000000..16ffb1e
--- /dev/null
+++ b/binutils/testsuite/binutils-all/windres/dialogid.rc
@@ -0,0 +1,9 @@
+// Test created based on bug report submitted to binutils mailing list
+// See: http://sources.redhat.com/ml/binutils/2003-03/msg00312.html
+
+101 DIALOGEX 0, 0, 200, 200
+
+BEGIN
+CONTROL 108, -1, "Static", 77, 11, 11, 83, 162
+CONTROL "stringid", 102, "Static", 0x5000120e, 5, 5, 10, 10
+END
diff --git a/binutils/testsuite/binutils-all/windres/dialogid.rsd b/binutils/testsuite/binutils-all/windres/dialogid.rsd
new file mode 100644
index 0000000..d484186
--- /dev/null
+++ b/binutils/testsuite/binutils-all/windres/dialogid.rsd
@@ -0,0 +1,13 @@
+ 0000 00000000 20000000 ffff0000 ffff0000 .... ...........
+ 0010 00000000 00000000 00000000 00000000 ................
+ 0020 86000000 20000000 ffff0500 ffff6500 .... .........e.
+ 0030 00000000 30100904 00000000 00000000 ....0...........
+ 0040 0100ffff 00000000 00000000 00008880 ................
+ 0050 02000000 0000c800 c8000000 00000000 ................
+ 0060 00000000 00000000 4d000050 0b000b00 ........M..P....
+ 0070 5300a200 ffff0000 53007400 61007400 S.......S.t.a.t.
+ 0080 69006300 0000ffff 6c000000 00000000 i.c.....l.......
+ 0090 00000000 0e120050 05000500 0a000a00 .......P........
+ 00a0 66000000 53007400 61007400 69006300 f...S.t.a.t.i.c.
+ 00b0 00007300 74007200 69006e00 67006900 ..s.t.r.i.n.g.i.
+ 00c0 64000000 00000000 d.......
diff --git a/binutils/windres.h b/binutils/windres.h
index 177b1ee..a6c6ef7 100644
--- a/binutils/windres.h
+++ b/binutils/windres.h
@@ -1,5 +1,5 @@
/* windres.h -- header file for windres program.
- Copyright 1997, 1998, 2000, 2002 Free Software Foundation, Inc.
+ Copyright 1997, 1998, 2000, 2002, 2003 Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
This file is part of GNU Binutils.
@@ -795,6 +795,7 @@ extern int yydebug;
extern FILE *yyin;
extern char *rc_filename;
extern int rc_lineno;
+
extern int yyparse PARAMS ((void));
extern int yylex PARAMS ((void));
extern void yyerror PARAMS ((const char *));
@@ -813,7 +814,7 @@ extern void define_cursor
extern void define_dialog
PARAMS ((struct res_id, const struct res_res_info *, const struct dialog *));
extern struct dialog_control *define_control
- PARAMS ((const char *, unsigned long, unsigned long, unsigned long,
+ PARAMS ((struct res_id, unsigned long, unsigned long, unsigned long,
unsigned long, unsigned long, unsigned long, unsigned long,
unsigned long));
extern struct dialog_control *define_icon_control
@@ -835,7 +836,8 @@ extern void define_rcdata
PARAMS ((struct res_id, const struct res_res_info *, struct rcdata_item *));
extern struct rcdata_item *define_rcdata_string
PARAMS ((const char *, unsigned long));
-extern struct rcdata_item *define_rcdata_number PARAMS ((unsigned long, int));
+extern struct rcdata_item *define_rcdata_number
+ PARAMS ((unsigned long, int));
extern void define_stringtable
PARAMS ((const struct res_res_info *, unsigned long, const char *));
extern void define_user_data