aboutsummaryrefslogtreecommitdiff
path: root/binutils/rcparse.y
diff options
context:
space:
mode:
authorDanny Smith <dannysmith@users.sourceforge.net>2003-06-28 02:37:43 +0000
committerDanny Smith <dannysmith@users.sourceforge.net>2003-06-28 02:37:43 +0000
commitb9ae04920ab4f0d0c10fad9dff55c4ca3e2d2251 (patch)
tree918a73ac0eae39204bb36020ad53b7c2a7d4b393 /binutils/rcparse.y
parent0b2828595e905458c688820815152abdb9fc7c6d (diff)
downloadbinutils-b9ae04920ab4f0d0c10fad9dff55c4ca3e2d2251.zip
binutils-b9ae04920ab4f0d0c10fad9dff55c4ca3e2d2251.tar.gz
binutils-b9ae04920ab4f0d0c10fad9dff55c4ca3e2d2251.tar.bz2
* 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.
Diffstat (limited to 'binutils/rcparse.y')
-rw-r--r--binutils/rcparse.y115
1 files changed, 70 insertions, 45 deletions
diff --git a/binutils/rcparse.y b/binutils/rcparse.y
index f287eb4..1866c90 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;
}
;