From b9ae04920ab4f0d0c10fad9dff55c4ca3e2d2251 Mon Sep 17 00:00:00 2001 From: Danny Smith Date: Sat, 28 Jun 2003 02:37:43 +0000 Subject: [PATCH] * rcparse.y (res_text_field): New res_id variable. (res_null_text): New static const struct res_id object, with empty unicode name field. (control): Pop parsing of optresidc up one level. Set res_text_field to $2 except for controls which do not accept a text field. Set res_text_field to res_null_text for the special cases (viz. COMBOBOX, EDITTEXT, LISTBOX, SCROLLBAR). (control_params): Adjust to use res_text_field rather than optresidc. (COMBOBOX): Add comment about discrepency between documented vs. observed default style. * resrc.c (define_control): Make first param const. * windres.h (define_control): Adjust prototype. testsuite: * binutils-all/windres/checkbox.rc: New file. * binutils-all/windres/checkbox.rsd: New file. * binutils-all/windres/combobox.rc: New file. * binutils-all/windres/combobox.rsd: New file. * binutils-all/windres/edittext.rc: New file. * binutils-all/windres/edittext.rsd: New file. * binutils-all/windres/listbox.rc: New file. * binutils-all/windres/listbox.rsd: New file. * binutils-all/windres/scrollbar.rc: New file. * binutils-all/windres/scrollbar.rsd: New file. --- binutils/ChangeLog | 16 +++ binutils/rcparse.y | 115 +++++++++++------- binutils/resrc.c | 2 +- binutils/testsuite/ChangeLog | 13 ++ .../binutils-all/windres/checkbox.rc | 5 + .../binutils-all/windres/checkbox.rsd | 12 ++ .../binutils-all/windres/combobox.rc | 8 ++ .../binutils-all/windres/combobox.rsd | 8 ++ .../binutils-all/windres/edittext.rc | 4 + .../binutils-all/windres/edittext.rsd | 8 ++ .../testsuite/binutils-all/windres/listbox.rc | 4 + .../binutils-all/windres/listbox.rsd | 8 ++ .../binutils-all/windres/scrollbar.rc | 4 + .../binutils-all/windres/scrollbar.rsd | 8 ++ binutils/windres.h | 2 +- 15 files changed, 170 insertions(+), 47 deletions(-) create mode 100644 binutils/testsuite/binutils-all/windres/checkbox.rc create mode 100644 binutils/testsuite/binutils-all/windres/checkbox.rsd create mode 100644 binutils/testsuite/binutils-all/windres/combobox.rc create mode 100644 binutils/testsuite/binutils-all/windres/combobox.rsd create mode 100644 binutils/testsuite/binutils-all/windres/edittext.rc create mode 100644 binutils/testsuite/binutils-all/windres/edittext.rsd create mode 100644 binutils/testsuite/binutils-all/windres/listbox.rc create mode 100644 binutils/testsuite/binutils-all/windres/listbox.rsd create mode 100644 binutils/testsuite/binutils-all/windres/scrollbar.rc create mode 100644 binutils/testsuite/binutils-all/windres/scrollbar.rsd diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 1cbaca6d0da..4c9e958b537 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,19 @@ +2003-06-28 Danny Smith + + * rcparse.y (res_text_field): New res_id variable. + (res_null_text): New static const struct res_id object, + with empty unicode name field. + (control): Pop parsing of optresidc up one level. Set + res_text_field to $2 except for controls which do not accept + a text field. Set res_text_field to res_null_text for the + special cases (viz. COMBOBOX, EDITTEXT, LISTBOX, SCROLLBAR). + (control_params): Adjust to use res_text_field rather + than optresidc. + (COMBOBOX): Add comment about discrepency between documented + vs. observed default style. + * resrc.c (define_control): Make first param const. + * windres.h (define_control): Adjust prototype. + 2003-06-27 Nick Clifton * objcopy.c (copy_object): Replace call to diff --git a/binutils/rcparse.y b/binutils/rcparse.y index f287eb44f28..1866c90912c 100644 --- a/binutils/rcparse.y +++ b/binutils/rcparse.y @@ -52,6 +52,11 @@ static unsigned long style; static unsigned long base_style; static unsigned long default_style; static unsigned long class; +static struct res_id res_text_field; + +/* This is used for COMBOBOX, LISTBOX and EDITTEXT which + do not allow resource 'text' field in control definition. */ +static const struct res_id res_null_text = { 1, {{0, L""}}}; %} @@ -533,64 +538,72 @@ controls: ; control: - AUTO3STATE + AUTO3STATE optresidc { default_style = BS_AUTO3STATE | WS_TABSTOP; base_style = BS_AUTO3STATE; class = CTL_BUTTON; + res_text_field = $2; } control_params { - $$ = $3; + $$ = $4; } - | AUTOCHECKBOX + | AUTOCHECKBOX optresidc { default_style = BS_AUTOCHECKBOX | WS_TABSTOP; base_style = BS_AUTOCHECKBOX; class = CTL_BUTTON; + res_text_field = $2; } control_params { - $$ = $3; + $$ = $4; } - | AUTORADIOBUTTON + | AUTORADIOBUTTON optresidc { default_style = BS_AUTORADIOBUTTON | WS_TABSTOP; base_style = BS_AUTORADIOBUTTON; class = CTL_BUTTON; + res_text_field = $2; } control_params { - $$ = $3; + $$ = $4; } - | BEDIT + | BEDIT optresidc { default_style = ES_LEFT | WS_BORDER | WS_TABSTOP; base_style = ES_LEFT | WS_BORDER | WS_TABSTOP; class = CTL_EDIT; + res_text_field = $2; } control_params { - $$ = $3; + $$ = $4; if (dialog.ex == NULL) rcparse_warning (_("BEDIT requires DIALOGEX")); res_string_to_id (&$$->class, "BEDIT"); } - | CHECKBOX + | CHECKBOX optresidc { default_style = BS_CHECKBOX | WS_TABSTOP; base_style = BS_CHECKBOX | WS_TABSTOP; class = CTL_BUTTON; + res_text_field = $2; } control_params { - $$ = $3; + $$ = $4; } | COMBOBOX { + /* This is as per MSDN documentation. With some (???) + versions of MS rc.exe their is no default style. */ default_style = CBS_SIMPLE | WS_TABSTOP; base_style = 0; class = CTL_COMBOBOX; + res_text_field = res_null_text; } control_params { @@ -640,55 +653,60 @@ control: $$->class.named = 1; unicode_from_ascii (&$$->class.u.n.length, &$$->class.u.n.name, $5); } - | CTEXT + | CTEXT optresidc { default_style = SS_CENTER | WS_GROUP; base_style = SS_CENTER; class = CTL_STATIC; + res_text_field = $2; } control_params { - $$ = $3; + $$ = $4; } - | DEFPUSHBUTTON + | DEFPUSHBUTTON optresidc { default_style = BS_DEFPUSHBUTTON | WS_TABSTOP; base_style = BS_DEFPUSHBUTTON | WS_TABSTOP; class = CTL_BUTTON; + res_text_field = $2; } control_params { - $$ = $3; + $$ = $4; } | EDITTEXT { default_style = ES_LEFT | WS_BORDER | WS_TABSTOP; base_style = ES_LEFT | WS_BORDER | WS_TABSTOP; class = CTL_EDIT; + res_text_field = res_null_text; } control_params { $$ = $3; } - | GROUPBOX + | GROUPBOX optresidc { default_style = BS_GROUPBOX; base_style = BS_GROUPBOX; class = CTL_BUTTON; + res_text_field = $2; } control_params { - $$ = $3; + $$ = $4; } - | HEDIT + | HEDIT optresidc { default_style = ES_LEFT | WS_BORDER | WS_TABSTOP; base_style = ES_LEFT | WS_BORDER | WS_TABSTOP; class = CTL_EDIT; + res_text_field = $2; } control_params { - $$ = $3; + $$ = $4; if (dialog.ex == NULL) rcparse_warning (_("IEDIT requires DIALOGEX")); res_string_to_id (&$$->class, "HEDIT"); @@ -716,15 +734,16 @@ control: $$ = define_icon_control ($2, $3, $4, $5, style, $9, $10, $11, dialog.ex); } - | IEDIT + | IEDIT optresidc { default_style = ES_LEFT | WS_BORDER | WS_TABSTOP; base_style = ES_LEFT | WS_BORDER | WS_TABSTOP; class = CTL_EDIT; + res_text_field = $2; } control_params { - $$ = $3; + $$ = $4; if (dialog.ex == NULL) rcparse_warning (_("IEDIT requires DIALOGEX")); res_string_to_id (&$$->class, "IEDIT"); @@ -734,22 +753,24 @@ control: default_style = LBS_NOTIFY | WS_BORDER; base_style = LBS_NOTIFY | WS_BORDER; class = CTL_LISTBOX; + res_text_field = res_null_text; } control_params { $$ = $3; } - | LTEXT + | LTEXT optresidc { default_style = SS_LEFT | WS_GROUP; base_style = SS_LEFT; class = CTL_STATIC; + res_text_field = $2; } control_params { - $$ = $3; + $$ = $4; } - | PUSHBOX + | PUSHBOX optresidc { default_style = BS_PUSHBOX | WS_TABSTOP; base_style = BS_PUSHBOX; @@ -757,57 +778,62 @@ control: } control_params { - $$ = $3; + $$ = $4; } - | PUSHBUTTON + | PUSHBUTTON optresidc { default_style = BS_PUSHBUTTON | WS_TABSTOP; base_style = BS_PUSHBUTTON | WS_TABSTOP; class = CTL_BUTTON; + res_text_field = $2; } control_params { - $$ = $3; + $$ = $4; } - | RADIOBUTTON + | RADIOBUTTON optresidc { default_style = BS_RADIOBUTTON | WS_TABSTOP; base_style = BS_RADIOBUTTON; class = CTL_BUTTON; + res_text_field = $2; } control_params { - $$ = $3; + $$ = $4; } - | RTEXT + | RTEXT optresidc { default_style = SS_RIGHT | WS_GROUP; base_style = SS_RIGHT; class = CTL_STATIC; + res_text_field = $2; } control_params { - $$ = $3; + $$ = $4; } | SCROLLBAR { default_style = SBS_HORZ; base_style = 0; class = CTL_SCROLLBAR; + res_text_field = res_null_text; } control_params { $$ = $3; } - | STATE3 + | STATE3 optresidc { default_style = BS_3STATE | WS_TABSTOP; base_style = BS_3STATE; class = CTL_BUTTON; + res_text_field = $2; } control_params { - $$ = $3; + $$ = $4; } | USERBUTTON resref numexpr ',' numexpr ',' numexpr ',' numexpr ',' numexpr ',' @@ -827,37 +853,36 @@ control: style. CLASS is the class of the control. */ control_params: - optresidc numexpr cnumexpr cnumexpr cnumexpr cnumexpr - opt_control_data + numexpr cnumexpr cnumexpr cnumexpr cnumexpr opt_control_data { - $$ = define_control ($1, $2, $3, $4, $5, $6, class, + $$ = define_control (res_text_field, $1, $2, $3, $4, $5, class, default_style | WS_CHILD | WS_VISIBLE, 0); - if ($7 != NULL) + if ($6 != NULL) { if (dialog.ex == NULL) rcparse_warning (_("control data requires DIALOGEX")); - $$->data = $7; + $$->data = $6; } } - | optresidc numexpr cnumexpr cnumexpr cnumexpr cnumexpr + | numexpr cnumexpr cnumexpr cnumexpr cnumexpr control_params_styleexpr optcnumexpr opt_control_data { - $$ = define_control ($1, $2, $3, $4, $5, $6, class, style, $8); - if ($9 != NULL) + $$ = define_control (res_text_field, $1, $2, $3, $4, $5, class, style, $7); + if ($8 != NULL) { if (dialog.ex == NULL) rcparse_warning (_("control data requires DIALOGEX")); - $$->data = $9; + $$->data = $8; } } - | optresidc numexpr cnumexpr cnumexpr cnumexpr cnumexpr + | numexpr cnumexpr cnumexpr cnumexpr cnumexpr control_params_styleexpr cnumexpr cnumexpr opt_control_data { - $$ = define_control ($1, $2, $3, $4, $5, $6, class, style, $8); + $$ = define_control (res_text_field, $1, $2, $3, $4, $5, class, style, $7); if (dialog.ex == NULL) rcparse_warning (_("help ID requires DIALOGEX")); - $$->help = $9; - $$->data = $10; + $$->help = $8; + $$->data = $9; } ; diff --git a/binutils/resrc.c b/binutils/resrc.c index a8955976363..cced3f20113 100644 --- a/binutils/resrc.c +++ b/binutils/resrc.c @@ -819,7 +819,7 @@ define_dialog (id, resinfo, dialog) struct dialog_control * define_control (iid, id, x, y, width, height, class, style, exstyle) - struct res_id iid; + const struct res_id iid; unsigned long id; unsigned long x; unsigned long y; diff --git a/binutils/testsuite/ChangeLog b/binutils/testsuite/ChangeLog index 8b07dc5580e..235f9ced837 100644 --- a/binutils/testsuite/ChangeLog +++ b/binutils/testsuite/ChangeLog @@ -1,3 +1,16 @@ +2003-06-28 Danny Smith + + * binutils-all/windres/checkbox.rc: New file. + * binutils-all/windres/checkbox.rsd: New file. + * binutils-all/windres/combobox.rc: New file. + * binutils-all/windres/combobox.rsd: New file. + * binutils-all/windres/edittext.rc: New file. + * binutils-all/windres/edittext.rsd: New file. + * binutils-all/windres/listbox.rc: New file. + * binutils-all/windres/listbox.rsd: New file. + * binutils-all/windres/scrollbar.rc: New file. + * binutils-all/windres/scrollbar.rsd: New file. + 2003-06-27 Thiemo Seufer * binutils-all/readelf.ss-tmips: Adjust symbol indices. diff --git a/binutils/testsuite/binutils-all/windres/checkbox.rc b/binutils/testsuite/binutils-all/windres/checkbox.rc new file mode 100644 index 00000000000..a941d6a5680 --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/checkbox.rc @@ -0,0 +1,5 @@ +501 DIALOGEX DISCARDABLE 0, 0, 168, 137 +BEGIN + CHECKBOX 108, 1002, 12, 76, 123, 41 + CHECKBOX "tick me", 1001, 12, 15, 123, 41 +END diff --git a/binutils/testsuite/binutils-all/windres/checkbox.rsd b/binutils/testsuite/binutils-all/windres/checkbox.rsd new file mode 100644 index 00000000000..f3ea5a04edc --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/checkbox.rsd @@ -0,0 +1,12 @@ + 0000 00000000 20000000 ffff0000 ffff0000 .... ........... + 0010 00000000 00000000 00000000 00000000 ................ + 0020 72000000 20000000 ffff0500 fffff501 r... ........... + 0030 00000000 30100904 00000000 00000000 ....0........... + 0040 0100ffff 00000000 00000000 00008880 ................ + 0050 02000000 0000a800 89000000 00000000 ................ + 0060 00000000 00000000 02000150 0c004c00 ...........P..L. + 0070 7b002900 ea030000 ffff8000 ffff6c00 {.)...........l. + 0080 00000000 00000000 00000000 02000150 ...............P + 0090 0c000f00 7b002900 e9030000 ffff8000 ....{.)......... + 00a0 74006900 63006b00 20006d00 65000000 t.i.c.k. .m.e... + 00b0 00000000 .... diff --git a/binutils/testsuite/binutils-all/windres/combobox.rc b/binutils/testsuite/binutils-all/windres/combobox.rc new file mode 100644 index 00000000000..f9f52d18185 --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/combobox.rc @@ -0,0 +1,8 @@ +#define CBS_SIMPLE 0x1 +#define WS_TABSTOP 0x10000 + +501 DIALOG DISCARDABLE 0, 0, 168, 137 +BEGIN + COMBOBOX 1001,10,10,50,54, CBS_SIMPLE | WS_TABSTOP +END + diff --git a/binutils/testsuite/binutils-all/windres/combobox.rsd b/binutils/testsuite/binutils-all/windres/combobox.rsd new file mode 100644 index 00000000000..509c738268e --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/combobox.rsd @@ -0,0 +1,8 @@ + 0000 00000000 20000000 ffff0000 ffff0000 .... ........... + 0010 00000000 00000000 00000000 00000000 ................ + 0020 32000000 20000000 ffff0500 fffff501 2... ........... + 0030 00000000 30100904 00000000 00000000 ....0........... + 0040 00008880 00000000 01000000 0000a800 ................ + 0050 89000000 00000000 01000150 00000000 ...........P.... + 0060 0a000a00 32003600 e903ffff 85000000 ....2.6......... + 0070 00000000 .... diff --git a/binutils/testsuite/binutils-all/windres/edittext.rc b/binutils/testsuite/binutils-all/windres/edittext.rc new file mode 100644 index 00000000000..0fd7000126a --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/edittext.rc @@ -0,0 +1,4 @@ +501 DIALOG DISCARDABLE 0, 0, 168, 137 +BEGIN + EDITTEXT 1001, 28, 63, 137, 52 +END diff --git a/binutils/testsuite/binutils-all/windres/edittext.rsd b/binutils/testsuite/binutils-all/windres/edittext.rsd new file mode 100644 index 00000000000..7132b20f4f9 --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/edittext.rsd @@ -0,0 +1,8 @@ + 0000 00000000 20000000 ffff0000 ffff0000 .... ........... + 0010 00000000 00000000 00000000 00000000 ................ + 0020 32000000 20000000 ffff0500 fffff501 2... ........... + 0030 00000000 30100904 00000000 00000000 ....0........... + 0040 00008880 00000000 01000000 0000a800 ................ + 0050 89000000 00000000 00008150 00000000 ...........P.... + 0060 1c003f00 89003400 e903ffff 81000000 ..?...4......... + 0070 00000000 .... diff --git a/binutils/testsuite/binutils-all/windres/listbox.rc b/binutils/testsuite/binutils-all/windres/listbox.rc new file mode 100644 index 00000000000..bb7c121e98f --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/listbox.rc @@ -0,0 +1,4 @@ +501 DIALOG DISCARDABLE 0, 0, 168, 137 +BEGIN + LISTBOX 1001, 28, 63, 137, 52 +END diff --git a/binutils/testsuite/binutils-all/windres/listbox.rsd b/binutils/testsuite/binutils-all/windres/listbox.rsd new file mode 100644 index 00000000000..4c3eadfc550 --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/listbox.rsd @@ -0,0 +1,8 @@ + 0000 00000000 20000000 ffff0000 ffff0000 .... ........... + 0010 00000000 00000000 00000000 00000000 ................ + 0020 32000000 20000000 ffff0500 fffff501 2... ........... + 0030 00000000 30100904 00000000 00000000 ....0........... + 0040 00008880 00000000 01000000 0000a800 ................ + 0050 89000000 00000000 01008050 00000000 ...........P.... + 0060 1c003f00 89003400 e903ffff 83000000 ..?...4......... + 0070 00000000 .... diff --git a/binutils/testsuite/binutils-all/windres/scrollbar.rc b/binutils/testsuite/binutils-all/windres/scrollbar.rc new file mode 100644 index 00000000000..9391d1abb09 --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/scrollbar.rc @@ -0,0 +1,4 @@ +501 DIALOGEX 0, 0, 168, 137 +BEGIN + SCROLLBAR 1001,43,68,105,10,0,0,0x81f503e9 +END diff --git a/binutils/testsuite/binutils-all/windres/scrollbar.rsd b/binutils/testsuite/binutils-all/windres/scrollbar.rsd new file mode 100644 index 00000000000..c509c4cd105 --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/scrollbar.rsd @@ -0,0 +1,8 @@ + 0000 00000000 20000000 ffff0000 ffff0000 .... ........... + 0010 00000000 00000000 00000000 00000000 ................ + 0020 40000000 20000000 ffff0500 fffff501 @... ........... + 0030 00000000 30100904 00000000 00000000 ....0........... + 0040 0100ffff 00000000 00000000 00008880 ................ + 0050 01000000 0000a800 89000000 00000000 ................ + 0060 e903f581 00000000 00000050 2b004400 ...........P+.D. + 0070 69000a00 e9030000 ffff8400 00000000 i............... diff --git a/binutils/windres.h b/binutils/windres.h index a6c6ef76e8d..52b53ca9e75 100644 --- a/binutils/windres.h +++ b/binutils/windres.h @@ -814,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 ((struct res_id, unsigned long, unsigned long, unsigned long, + PARAMS ((const 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 -- 2.30.2