summaryrefslogtreecommitdiff
path: root/binutils/rcparse.y
diff options
context:
space:
mode:
Diffstat (limited to 'binutils/rcparse.y')
-rw-r--r--binutils/rcparse.y540
1 files changed, 359 insertions, 181 deletions
diff --git a/binutils/rcparse.y b/binutils/rcparse.y
index fbc5bef6f8ae..ac72ee777789 100644
--- a/binutils/rcparse.y
+++ b/binutils/rcparse.y
@@ -1,7 +1,8 @@
%{ /* rcparse.y -- parser for Windows rc files
- Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005
+ Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2007
Free Software Foundation, Inc.
Written by Ian Lance Taylor, Cygnus Support.
+ Extended by Kai Tietz, Onevision.
This file is part of GNU Binutils.
@@ -23,6 +24,7 @@
/* This is a parser for Windows rc files. It is based on the parser
by Gunther Ebert <gunther.ebert@ixos-leipzig.de>. */
+#include "sysdep.h"
#include "bfd.h"
#include "bucomm.h"
#include "libiberty.h"
@@ -35,12 +37,12 @@ static unsigned short language;
/* The resource information during a sub statement. */
-static struct res_res_info sub_res_info;
+static rc_res_res_info sub_res_info;
/* Dialog information. This is built by the nonterminals styles and
controls. */
-static struct dialog dialog;
+static rc_dialog dialog;
/* This is used when building a style. It is modified by the
nonterminal styleexpr. */
@@ -50,56 +52,62 @@ static unsigned long style;
/* These are used when building a control. They are set before using
control_params. */
-static unsigned long base_style;
-static unsigned long default_style;
-static unsigned long class;
-static struct res_id res_text_field;
+static rc_uint_type base_style;
+static rc_uint_type default_style;
+static rc_res_id class;
+static rc_res_id res_text_field;
static unichar null_unichar;
/* 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, &null_unichar}}};
+static const rc_res_id res_null_text = { 1, {{0, &null_unichar}}};
%}
%union
{
- struct accelerator acc;
- struct accelerator *pacc;
- struct dialog_control *dialog_control;
- struct menuitem *menuitem;
+ rc_accelerator acc;
+ rc_accelerator *pacc;
+ rc_dialog_control *dialog_control;
+ rc_menuitem *menuitem;
struct
{
- struct rcdata_item *first;
- struct rcdata_item *last;
+ rc_rcdata_item *first;
+ rc_rcdata_item *last;
} rcdata;
- struct rcdata_item *rcdata_item;
- struct stringtable_data *stringtable;
- struct fixed_versioninfo *fixver;
- struct ver_info *verinfo;
- struct ver_stringinfo *verstring;
- struct ver_varinfo *vervar;
- struct res_id id;
- struct res_res_info res_info;
+ rc_rcdata_item *rcdata_item;
+ rc_fixed_versioninfo *fixver;
+ rc_ver_info *verinfo;
+ rc_ver_stringinfo *verstring;
+ rc_ver_varinfo *vervar;
+ rc_toolbar_item *toobar_item;
+ rc_res_id id;
+ rc_res_res_info res_info;
struct
{
- unsigned short on;
- unsigned short off;
+ rc_uint_type on;
+ rc_uint_type off;
} memflags;
struct
{
- unsigned long val;
+ rc_uint_type val;
/* Nonzero if this number was explicitly specified as long. */
int dword;
} i;
- unsigned long il;
- unsigned short is;
+ rc_uint_type il;
+ rc_uint_type is;
const char *s;
struct
{
- unsigned long length;
+ rc_uint_type length;
const char *s;
} ss;
+ unichar *uni;
+ struct
+ {
+ rc_uint_type length;
+ const unichar *s;
+ } suni;
};
%token BEG END
@@ -113,6 +121,7 @@ static const struct res_id res_null_text = { 1, {{0, &null_unichar}}};
%token BEDIT HEDIT IEDIT
%token FONT
%token ICON
+%token ANICURSOR ANIICON DLGINCLUDE DLGINIT FONTDIR HTML MANIFEST PLUGPLAY VXD TOOLBAR BUTTON
%token LANGUAGE CHARACTERISTICS VERSIONK
%token MENU MENUEX MENUITEM SEPARATOR POPUP CHECKED GRAYED HELP INACTIVE
%token MENUBARBREAK MENUBREAK
@@ -125,8 +134,10 @@ static const struct res_id res_null_text = { 1, {{0, &null_unichar}}};
%token <s> BLOCK
%token MOVEABLE FIXED PURE IMPURE PRELOAD LOADONCALL DISCARDABLE
%token NOT
+%token <uni> QUOTEDUNISTRING
%token <s> QUOTEDSTRING STRING
%token <i> NUMBER
+%token <suni> SIZEDUNISTRING
%token <ss> SIZEDSTRING
%token IGNORED_TOKEN
@@ -140,13 +151,17 @@ static const struct res_id res_null_text = { 1, {{0, &null_unichar}}};
%type <verinfo> verblocks
%type <verstring> vervals
%type <vervar> vertrans
+%type <toobar_item> toolbar_data
%type <res_info> suboptions memflags_move_discard memflags_move
%type <memflags> memflag
-%type <id> id optresidc resref
+%type <id> id rcdata_id optresidc resref resid cresid
%type <il> exstyle parennumber
%type <il> numexpr posnumexpr cnumexpr optcnumexpr cposnumexpr
%type <is> acc_options acc_option menuitem_flags menuitem_flag
-%type <s> file_name resname
+%type <s> file_name
+%type <uni> res_unicode_string resname res_unicode_string_concat
+%type <ss> sizedstring
+%type <suni> sizedunistring
%type <i> sizednumexpr sizedposnumexpr
%left '|'
@@ -170,8 +185,8 @@ input:
| input menu
| input menuex
| input messagetable
- | input rcdata
| input stringtable
+ | input toolbar
| input user
| input versioninfo
| input IGNORED_TOKEN
@@ -196,15 +211,15 @@ acc_entries:
}
| acc_entries acc_entry
{
- struct accelerator *a;
+ rc_accelerator *a;
- a = (struct accelerator *) res_alloc (sizeof *a);
+ a = (rc_accelerator *) res_alloc (sizeof *a);
*a = $2;
if ($1 == NULL)
$$ = a;
else
{
- struct accelerator **pp;
+ rc_accelerator **pp;
for (pp = &$1->next; *pp != NULL; pp = &(*pp)->next)
;
@@ -246,8 +261,7 @@ acc_event:
{
$$.flags = ACC_CONTROL | ACC_VIRTKEY;
++s;
- ch = *s;
- ch = TOUPPER (ch);
+ ch = TOUPPER (s[0]);
}
$$.key = ch;
if (s[1] != '\0')
@@ -371,9 +385,9 @@ dialog:
dialog.menu.named = 1;
dialog.class.named = 1;
dialog.font = NULL;
- dialog.ex = ((struct dialog_ex *)
- res_alloc (sizeof (struct dialog_ex)));
- memset (dialog.ex, 0, sizeof (struct dialog_ex));
+ dialog.ex = ((rc_dialog_ex *)
+ res_alloc (sizeof (rc_dialog_ex)));
+ memset (dialog.ex, 0, sizeof (rc_dialog_ex));
dialog.controls = NULL;
sub_res_info = $3;
style = 0;
@@ -398,9 +412,9 @@ dialog:
dialog.menu.named = 1;
dialog.class.named = 1;
dialog.font = NULL;
- dialog.ex = ((struct dialog_ex *)
- res_alloc (sizeof (struct dialog_ex)));
- memset (dialog.ex, 0, sizeof (struct dialog_ex));
+ dialog.ex = ((rc_dialog_ex *)
+ res_alloc (sizeof (rc_dialog_ex)));
+ memset (dialog.ex, 0, sizeof (rc_dialog_ex));
dialog.ex->help = $9;
dialog.controls = NULL;
sub_res_info = $3;
@@ -428,11 +442,11 @@ exstyle:
styles:
/* empty */
- | styles CAPTION QUOTEDSTRING
+ | styles CAPTION res_unicode_string_concat
{
dialog.style |= WS_CAPTION;
style |= WS_CAPTION;
- unicode_from_ascii ((int *) NULL, &dialog.caption, $3);
+ dialog.caption = $3;
}
| styles CLASS id
{
@@ -447,16 +461,16 @@ styles:
{
dialog.exstyle = $3;
}
- | styles CLASS QUOTEDSTRING
+ | styles CLASS res_unicode_string_concat
{
- res_string_to_id (& dialog.class, $3);
+ res_unistring_to_id (& dialog.class, $3);
}
- | styles FONT numexpr ',' QUOTEDSTRING
+ | styles FONT numexpr ',' res_unicode_string_concat
{
dialog.style |= DS_SETFONT;
style |= DS_SETFONT;
dialog.pointsize = $3;
- unicode_from_ascii ((int *) NULL, &dialog.font, $5);
+ dialog.font = $5;
if (dialog.ex != NULL)
{
dialog.ex->weight = 0;
@@ -464,12 +478,12 @@ styles:
dialog.ex->charset = 1;
}
}
- | styles FONT numexpr ',' QUOTEDSTRING cnumexpr
+ | styles FONT numexpr ',' res_unicode_string_concat cnumexpr
{
dialog.style |= DS_SETFONT;
style |= DS_SETFONT;
dialog.pointsize = $3;
- unicode_from_ascii ((int *) NULL, &dialog.font, $5);
+ dialog.font = $5;
if (dialog.ex == NULL)
rcparse_warning (_("extended FONT requires DIALOGEX"));
else
@@ -479,12 +493,12 @@ styles:
dialog.ex->charset = 1;
}
}
- | styles FONT numexpr ',' QUOTEDSTRING cnumexpr cnumexpr
+ | styles FONT numexpr ',' res_unicode_string_concat cnumexpr cnumexpr
{
dialog.style |= DS_SETFONT;
style |= DS_SETFONT;
dialog.pointsize = $3;
- unicode_from_ascii ((int *) NULL, &dialog.font, $5);
+ dialog.font = $5;
if (dialog.ex == NULL)
rcparse_warning (_("extended FONT requires DIALOGEX"));
else
@@ -494,12 +508,12 @@ styles:
dialog.ex->charset = 1;
}
}
- | styles FONT numexpr ',' QUOTEDSTRING cnumexpr cnumexpr cnumexpr
+ | styles FONT numexpr ',' res_unicode_string_concat cnumexpr cnumexpr cnumexpr
{
dialog.style |= DS_SETFONT;
style |= DS_SETFONT;
dialog.pointsize = $3;
- unicode_from_ascii ((int *) NULL, &dialog.font, $5);
+ dialog.font = $5;
if (dialog.ex == NULL)
rcparse_warning (_("extended FONT requires DIALOGEX"));
else
@@ -531,7 +545,7 @@ controls:
/* empty */
| controls control
{
- struct dialog_control **pp;
+ rc_dialog_control **pp;
for (pp = &dialog.controls; *pp != NULL; pp = &(*pp)->next)
;
@@ -544,7 +558,8 @@ control:
{
default_style = BS_AUTO3STATE | WS_TABSTOP;
base_style = BS_AUTO3STATE;
- class = CTL_BUTTON;
+ class.named = 0;
+ class.u.id = CTL_BUTTON;
res_text_field = $2;
}
control_params
@@ -555,7 +570,8 @@ control:
{
default_style = BS_AUTOCHECKBOX | WS_TABSTOP;
base_style = BS_AUTOCHECKBOX;
- class = CTL_BUTTON;
+ class.named = 0;
+ class.u.id = CTL_BUTTON;
res_text_field = $2;
}
control_params
@@ -566,7 +582,8 @@ control:
{
default_style = BS_AUTORADIOBUTTON | WS_TABSTOP;
base_style = BS_AUTORADIOBUTTON;
- class = CTL_BUTTON;
+ class.named = 0;
+ class.u.id = CTL_BUTTON;
res_text_field = $2;
}
control_params
@@ -577,7 +594,8 @@ control:
{
default_style = ES_LEFT | WS_BORDER | WS_TABSTOP;
base_style = ES_LEFT | WS_BORDER | WS_TABSTOP;
- class = CTL_EDIT;
+ class.named = 0;
+ class.u.id = CTL_EDIT;
res_text_field = $2;
}
control_params
@@ -591,7 +609,8 @@ control:
{
default_style = BS_CHECKBOX | WS_TABSTOP;
base_style = BS_CHECKBOX | WS_TABSTOP;
- class = CTL_BUTTON;
+ class.named = 0;
+ class.u.id = CTL_BUTTON;
res_text_field = $2;
}
control_params
@@ -604,14 +623,15 @@ control:
versions of MS rc.exe their is no default style. */
default_style = CBS_SIMPLE | WS_TABSTOP;
base_style = 0;
- class = CTL_COMBOBOX;
+ class.named = 0;
+ class.u.id = CTL_COMBOBOX;
res_text_field = res_null_text;
}
control_params
{
$$ = $3;
}
- | CONTROL optresidc numexpr cnumexpr control_styleexpr cnumexpr
+ | CONTROL optresidc numexpr cresid control_styleexpr cnumexpr
cnumexpr cnumexpr cnumexpr optcnumexpr opt_control_data
{
$$ = define_control ($2, $3, $6, $7, $8, $9, $4, style, $10);
@@ -622,7 +642,7 @@ control:
$$->data = $11;
}
}
- | CONTROL optresidc numexpr cnumexpr control_styleexpr cnumexpr
+ | CONTROL optresidc numexpr cresid control_styleexpr cnumexpr
cnumexpr cnumexpr cnumexpr cnumexpr cnumexpr opt_control_data
{
$$ = define_control ($2, $3, $6, $7, $8, $9, $4, style, $10);
@@ -631,35 +651,12 @@ control:
$$->help = $11;
$$->data = $12;
}
- | 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);
- if ($12 != NULL)
- {
- if (dialog.ex == NULL)
- rcparse_warning ("control data requires DIALOGEX");
- $$->data = $12;
- }
- $$->class.named = 1;
- unicode_from_ascii (&$$->class.u.n.length, &$$->class.u.n.name, $5);
- }
- | 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);
- if (dialog.ex == NULL)
- rcparse_warning ("help ID requires DIALOGEX");
- $$->help = $12;
- $$->data = $13;
- $$->class.named = 1;
- unicode_from_ascii (&$$->class.u.n.length, &$$->class.u.n.name, $5);
- }
| CTEXT optresidc
{
default_style = SS_CENTER | WS_GROUP;
base_style = SS_CENTER;
- class = CTL_STATIC;
+ class.named = 0;
+ class.u.id = CTL_STATIC;
res_text_field = $2;
}
control_params
@@ -670,7 +667,8 @@ control:
{
default_style = BS_DEFPUSHBUTTON | WS_TABSTOP;
base_style = BS_DEFPUSHBUTTON | WS_TABSTOP;
- class = CTL_BUTTON;
+ class.named = 0;
+ class.u.id = CTL_BUTTON;
res_text_field = $2;
}
control_params
@@ -681,7 +679,8 @@ control:
{
default_style = ES_LEFT | WS_BORDER | WS_TABSTOP;
base_style = ES_LEFT | WS_BORDER | WS_TABSTOP;
- class = CTL_EDIT;
+ class.named = 0;
+ class.u.id = CTL_EDIT;
res_text_field = res_null_text;
}
control_params
@@ -692,7 +691,8 @@ control:
{
default_style = BS_GROUPBOX;
base_style = BS_GROUPBOX;
- class = CTL_BUTTON;
+ class.named = 0;
+ class.u.id = CTL_BUTTON;
res_text_field = $2;
}
control_params
@@ -703,7 +703,8 @@ control:
{
default_style = ES_LEFT | WS_BORDER | WS_TABSTOP;
base_style = ES_LEFT | WS_BORDER | WS_TABSTOP;
- class = CTL_EDIT;
+ class.named = 0;
+ class.u.id = CTL_EDIT;
res_text_field = $2;
}
control_params
@@ -740,7 +741,8 @@ control:
{
default_style = ES_LEFT | WS_BORDER | WS_TABSTOP;
base_style = ES_LEFT | WS_BORDER | WS_TABSTOP;
- class = CTL_EDIT;
+ class.named = 0;
+ class.u.id = CTL_EDIT;
res_text_field = $2;
}
control_params
@@ -754,7 +756,8 @@ control:
{
default_style = LBS_NOTIFY | WS_BORDER;
base_style = LBS_NOTIFY | WS_BORDER;
- class = CTL_LISTBOX;
+ class.named = 0;
+ class.u.id = CTL_LISTBOX;
res_text_field = res_null_text;
}
control_params
@@ -765,7 +768,8 @@ control:
{
default_style = SS_LEFT | WS_GROUP;
base_style = SS_LEFT;
- class = CTL_STATIC;
+ class.named = 0;
+ class.u.id = CTL_STATIC;
res_text_field = $2;
}
control_params
@@ -776,7 +780,8 @@ control:
{
default_style = BS_PUSHBOX | WS_TABSTOP;
base_style = BS_PUSHBOX;
- class = CTL_BUTTON;
+ class.named = 0;
+ class.u.id = CTL_BUTTON;
}
control_params
{
@@ -786,7 +791,8 @@ control:
{
default_style = BS_PUSHBUTTON | WS_TABSTOP;
base_style = BS_PUSHBUTTON | WS_TABSTOP;
- class = CTL_BUTTON;
+ class.named = 0;
+ class.u.id = CTL_BUTTON;
res_text_field = $2;
}
control_params
@@ -797,7 +803,8 @@ control:
{
default_style = BS_RADIOBUTTON | WS_TABSTOP;
base_style = BS_RADIOBUTTON;
- class = CTL_BUTTON;
+ class.named = 0;
+ class.u.id = CTL_BUTTON;
res_text_field = $2;
}
control_params
@@ -808,7 +815,8 @@ control:
{
default_style = SS_RIGHT | WS_GROUP;
base_style = SS_RIGHT;
- class = CTL_STATIC;
+ class.named = 0;
+ class.u.id = CTL_STATIC;
res_text_field = $2;
}
control_params
@@ -819,7 +827,8 @@ control:
{
default_style = SBS_HORZ;
base_style = 0;
- class = CTL_SCROLLBAR;
+ class.named = 0;
+ class.u.id = CTL_SCROLLBAR;
res_text_field = res_null_text;
}
control_params
@@ -830,7 +839,8 @@ control:
{
default_style = BS_3STATE | WS_TABSTOP;
base_style = BS_3STATE;
- class = CTL_BUTTON;
+ class.named = 0;
+ class.u.id = CTL_BUTTON;
res_text_field = $2;
}
control_params
@@ -842,7 +852,10 @@ control:
{ style = WS_CHILD | WS_VISIBLE; }
styleexpr optcnumexpr
{
- $$ = define_control ($2, $3, $5, $7, $9, $11, CTL_BUTTON,
+ rc_res_id cid;
+ cid.named = 0;
+ cid.u.id = CTL_BUTTON;
+ $$ = define_control ($2, $3, $5, $7, $9, $11, cid,
style, $15);
}
;
@@ -888,23 +901,35 @@ control_params:
}
;
+cresid:
+ ',' resid
+ {
+ if ($2.named)
+ res_unistring_to_id (&$$, $2.u.n.name);
+ else
+ $$=$2;
+ }
+ ;
+
optresidc:
/* empty */
{
res_string_to_id (&$$, "");
}
- | posnumexpr ','
+ | resid ',' { $$=$1; }
+ ;
+
+resid:
+ posnumexpr
{
$$.named = 0;
$$.u.id = $1;
}
- | QUOTEDSTRING
- {
- res_string_to_id (&$$, $1);
- }
- | QUOTEDSTRING ','
+ | res_unicode_string
{
- res_string_to_id (&$$, $1);
+ $$.named = 1;
+ $$.u.n.name = $1;
+ $$.u.n.length = unichar_len ($1);
}
;
@@ -996,7 +1021,7 @@ menuitems:
$$ = $2;
else
{
- struct menuitem **pp;
+ rc_menuitem **pp;
for (pp = &$1->next; *pp != NULL; pp = &(*pp)->next)
;
@@ -1007,7 +1032,7 @@ menuitems:
;
menuitem:
- MENUITEM QUOTEDSTRING cnumexpr menuitem_flags
+ MENUITEM res_unicode_string_concat cnumexpr menuitem_flags
{
$$ = define_menuitem ($2, $3, $4, 0, 0, NULL);
}
@@ -1015,7 +1040,7 @@ menuitem:
{
$$ = define_menuitem (NULL, 0, 0, 0, 0, NULL);
}
- | POPUP QUOTEDSTRING menuitem_flags BEG menuitems END
+ | POPUP res_unicode_string_concat menuitem_flags BEG menuitems END
{
$$ = define_menuitem ($2, 0, $3, 0, 0, $5);
}
@@ -1086,7 +1111,7 @@ menuexitems:
$$ = $2;
else
{
- struct menuitem **pp;
+ rc_menuitem **pp;
for (pp = &$1->next; *pp != NULL; pp = &(*pp)->next)
;
@@ -1097,15 +1122,15 @@ menuexitems:
;
menuexitem:
- MENUITEM QUOTEDSTRING
+ MENUITEM res_unicode_string_concat
{
$$ = define_menuitem ($2, 0, 0, 0, 0, NULL);
}
- | MENUITEM QUOTEDSTRING cnumexpr
+ | MENUITEM res_unicode_string_concat cnumexpr
{
$$ = define_menuitem ($2, $3, 0, 0, 0, NULL);
}
- | MENUITEM QUOTEDSTRING cnumexpr cnumexpr optcnumexpr
+ | MENUITEM res_unicode_string_concat cnumexpr cnumexpr optcnumexpr
{
$$ = define_menuitem ($2, $3, $4, $5, 0, NULL);
}
@@ -1113,19 +1138,19 @@ menuexitem:
{
$$ = define_menuitem (NULL, 0, 0, 0, 0, NULL);
}
- | POPUP QUOTEDSTRING BEG menuexitems END
+ | POPUP res_unicode_string_concat BEG menuexitems END
{
$$ = define_menuitem ($2, 0, 0, 0, 0, $4);
}
- | POPUP QUOTEDSTRING cnumexpr BEG menuexitems END
+ | POPUP res_unicode_string_concat cnumexpr BEG menuexitems END
{
$$ = define_menuitem ($2, $3, 0, 0, 0, $5);
}
- | POPUP QUOTEDSTRING cnumexpr cnumexpr BEG menuexitems END
+ | POPUP res_unicode_string_concat cnumexpr cnumexpr BEG menuexitems END
{
$$ = define_menuitem ($2, $3, $4, 0, 0, $6);
}
- | POPUP QUOTEDSTRING cnumexpr cnumexpr cnumexpr optcnumexpr
+ | POPUP res_unicode_string_concat cnumexpr cnumexpr cnumexpr optcnumexpr
BEG menuexitems END
{
$$ = define_menuitem ($2, $3, $4, $5, $6, $8);
@@ -1144,25 +1169,6 @@ messagetable:
}
;
-/* Rcdata resources. */
-
-rcdata:
- id RCDATA suboptions BEG optrcdata_data END
- {
- define_rcdata ($1, &$3, $5.first);
- if (yychar != YYEMPTY)
- YYERROR;
- rcparse_discard_strings ();
- }
- | id RCDATA suboptions file_name
- {
- define_rcdata_file ($1, &$3, $4);
- if (yychar != YYEMPTY)
- YYERROR;
- rcparse_discard_strings ();
- }
- ;
-
/* We use a different lexing algorithm, because rcdata strings may
contain embedded null bytes, and we need to know the length to use. */
@@ -1190,34 +1196,51 @@ optrcdata_data_int:
;
rcdata_data:
- SIZEDSTRING
+ sizedstring
{
- struct rcdata_item *ri;
+ rc_rcdata_item *ri;
ri = define_rcdata_string ($1.s, $1.length);
$$.first = ri;
$$.last = ri;
}
+ | sizedunistring
+ {
+ rc_rcdata_item *ri;
+
+ ri = define_rcdata_unistring ($1.s, $1.length);
+ $$.first = ri;
+ $$.last = ri;
+ }
| sizednumexpr
{
- struct rcdata_item *ri;
+ rc_rcdata_item *ri;
ri = define_rcdata_number ($1.val, $1.dword);
$$.first = ri;
$$.last = ri;
}
- | rcdata_data ',' SIZEDSTRING
+ | rcdata_data ',' sizedstring
{
- struct rcdata_item *ri;
+ rc_rcdata_item *ri;
ri = define_rcdata_string ($3.s, $3.length);
$$.first = $1.first;
$1.last->next = ri;
$$.last = ri;
}
+ | rcdata_data ',' sizedunistring
+ {
+ rc_rcdata_item *ri;
+
+ ri = define_rcdata_unistring ($3.s, $3.length);
+ $$.first = $1.first;
+ $1.last->next = ri;
+ $$.last = ri;
+ }
| rcdata_data ',' sizednumexpr
{
- struct rcdata_item *ri;
+ rc_rcdata_item *ri;
ri = define_rcdata_number ($3.val, $3.dword);
$$.first = $1.first;
@@ -1236,14 +1259,14 @@ stringtable:
string_data:
/* empty */
- | string_data numexpr QUOTEDSTRING
+ | string_data numexpr res_unicode_string_concat
{
define_stringtable (&sub_res_info, $2, $3);
if (yychar != YYEMPTY)
YYERROR;
rcparse_discard_strings ();
}
- | string_data numexpr ',' QUOTEDSTRING
+ | string_data numexpr ',' res_unicode_string_concat
{
define_stringtable (&sub_res_info, $2, $4);
if (yychar != YYEMPTY)
@@ -1252,18 +1275,70 @@ string_data:
}
;
+rcdata_id:
+ id
+ {
+ $$=$1;
+ }
+ | HTML
+ {
+ $$.named = 0;
+ $$.u.id = 23;
+ }
+ | RCDATA
+ {
+ $$.named = 0;
+ $$.u.id = RT_RCDATA;
+ }
+ | MANIFEST
+ {
+ $$.named = 0;
+ $$.u.id = RT_MANIFEST;
+ }
+ | PLUGPLAY
+ {
+ $$.named = 0;
+ $$.u.id = RT_PLUGPLAY;
+ }
+ | VXD
+ {
+ $$.named = 0;
+ $$.u.id = RT_VXD;
+ }
+ | DLGINCLUDE
+ {
+ $$.named = 0;
+ $$.u.id = RT_DLGINCLUDE;
+ }
+ | DLGINIT
+ {
+ $$.named = 0;
+ $$.u.id = RT_DLGINIT;
+ }
+ | ANICURSOR
+ {
+ $$.named = 0;
+ $$.u.id = RT_ANICURSOR;
+ }
+ | ANIICON
+ {
+ $$.named = 0;
+ $$.u.id = RT_ANIICON;
+ }
+ ;
+
/* User defined resources. We accept general suboptions in the
file_name case to keep the parser happy. */
user:
- id id suboptions BEG optrcdata_data END
+ id rcdata_id suboptions BEG optrcdata_data END
{
define_user_data ($1, $2, &$3, $5.first);
if (yychar != YYEMPTY)
YYERROR;
rcparse_discard_strings ();
}
- | id id suboptions file_name
+ | id rcdata_id suboptions file_name
{
define_user_file ($1, $2, &$3, $4);
if (yychar != YYEMPTY)
@@ -1272,6 +1347,55 @@ user:
}
;
+toolbar:
+ id TOOLBAR suboptions numexpr cnumexpr BEG toolbar_data END
+ {
+ define_toolbar ($1, &$3, $4, $5, $7);
+ }
+ ;
+
+toolbar_data: /* empty */ { $$= NULL; }
+ | toolbar_data BUTTON id
+ {
+ rc_toolbar_item *c,*n;
+ c = $1;
+ n= (rc_toolbar_item *)
+ res_alloc (sizeof (rc_toolbar_item));
+ if (c != NULL)
+ while (c->next != NULL)
+ c = c->next;
+ n->prev = c;
+ n->next = NULL;
+ if (c != NULL)
+ c->next = n;
+ n->id = $3;
+ if ($1 == NULL)
+ $$ = n;
+ else
+ $$ = $1;
+ }
+ | toolbar_data SEPARATOR
+ {
+ rc_toolbar_item *c,*n;
+ c = $1;
+ n= (rc_toolbar_item *)
+ res_alloc (sizeof (rc_toolbar_item));
+ if (c != NULL)
+ while (c->next != NULL)
+ c = c->next;
+ n->prev = c;
+ n->next = NULL;
+ if (c != NULL)
+ c->next = n;
+ n->id.named = 0;
+ n->id.u.id = 0;
+ if ($1 == NULL)
+ $$ = n;
+ else
+ $$ = $1;
+ }
+ ;
+
/* Versioninfo resources. */
versioninfo:
@@ -1287,9 +1411,9 @@ versioninfo:
fixedverinfo:
/* empty */
{
- $$ = ((struct fixed_versioninfo *)
- res_alloc (sizeof (struct fixed_versioninfo)));
- memset ($$, 0, sizeof (struct fixed_versioninfo));
+ $$ = ((rc_fixed_versioninfo *)
+ res_alloc (sizeof (rc_fixed_versioninfo)));
+ memset ($$, 0, sizeof (rc_fixed_versioninfo));
}
| fixedverinfo FILEVERSION numexpr cnumexpr cnumexpr cnumexpr
{
@@ -1345,7 +1469,7 @@ verblocks:
{
$$ = append_ver_stringfileinfo ($1, $4, $6);
}
- | verblocks BLOCKVARFILEINFO BEG VALUE QUOTEDSTRING vertrans END
+ | verblocks BLOCKVARFILEINFO BEG VALUE res_unicode_string_concat vertrans END
{
$$ = append_ver_varfileinfo ($1, $5, $6);
}
@@ -1356,7 +1480,7 @@ vervals:
{
$$ = NULL;
}
- | vervals VALUE QUOTEDSTRING ',' QUOTEDSTRING
+ | vervals VALUE res_unicode_string_concat ',' res_unicode_string_concat
{
$$ = append_verval ($1, $3, $5);
}
@@ -1381,33 +1505,24 @@ id:
$$.named = 0;
$$.u.id = $1;
}
- | STRING
+ | resname
{
- char *copy, *s;
-
- /* It seems that resource ID's are forced to upper case. */
- copy = xstrdup ($1);
- for (s = copy; *s != '\0'; s++)
- *s = TOUPPER (*s);
- res_string_to_id (&$$, copy);
- free (copy);
+ res_unistring_to_id (&$$, $1);
}
;
/* A resource reference. */
resname:
- QUOTEDSTRING
- {
- $$ = $1;
- }
- | QUOTEDSTRING ','
+ res_unicode_string
{
$$ = $1;
}
- | STRING ','
+ | STRING
{
- $$ = $1;
+ unichar *h = NULL;
+ unicode_from_ascii ((rc_uint_type *) NULL, &h, $1);
+ $$ = h;
}
;
@@ -1420,14 +1535,11 @@ resref:
}
| resname
{
- char *copy, *s;
-
- /* It seems that resource ID's are forced to upper case. */
- copy = xstrdup ($1);
- for (s = copy; *s != '\0'; s++)
- *s = TOUPPER (*s);
- res_string_to_id (&$$, copy);
- free (copy);
+ res_unistring_to_id (&$$, $1);
+ }
+ | resname ','
+ {
+ res_unistring_to_id (&$$, $1);
}
;
@@ -1437,7 +1549,7 @@ resref:
suboptions:
/* empty */
{
- memset (&$$, 0, sizeof (struct res_res_info));
+ memset (&$$, 0, sizeof (rc_res_res_info));
$$.language = language;
/* FIXME: Is this the right default? */
$$.memflags = MEMFLAG_MOVEABLE | MEMFLAG_PURE | MEMFLAG_DISCARDABLE;
@@ -1470,7 +1582,7 @@ suboptions:
memflags_move_discard:
/* empty */
{
- memset (&$$, 0, sizeof (struct res_res_info));
+ memset (&$$, 0, sizeof (rc_res_res_info));
$$.language = language;
$$.memflags = MEMFLAG_MOVEABLE | MEMFLAG_DISCARDABLE;
}
@@ -1487,7 +1599,7 @@ memflags_move_discard:
memflags_move:
/* empty */
{
- memset (&$$, 0, sizeof (struct res_res_info));
+ memset (&$$, 0, sizeof (rc_res_res_info));
$$.language = language;
$$.memflags = MEMFLAG_MOVEABLE | MEMFLAG_PURE | MEMFLAG_DISCARDABLE;
}
@@ -1553,6 +1665,72 @@ file_name:
}
;
+/* Concat string */
+res_unicode_string_concat:
+ res_unicode_string
+ {
+ $$ = $1;
+ }
+ |
+ res_unicode_string_concat res_unicode_string
+ {
+ rc_uint_type l1 = unichar_len ($1);
+ rc_uint_type l2 = unichar_len ($2);
+ unichar *h = (unichar *) res_alloc ((l1 + l2 + 1) * sizeof (unichar));
+ if (l1 != 0)
+ memcpy (h, $1, l1 * sizeof (unichar));
+ if (l2 != 0)
+ memcpy (h + l1, $2, l2 * sizeof (unichar));
+ h[l1 + l2] = 0;
+ $$ = h;
+ }
+ ;
+
+res_unicode_string:
+ QUOTEDUNISTRING
+ {
+ $$ = unichar_dup ($1);
+ }
+ | QUOTEDSTRING
+ {
+ unichar *h = NULL;
+ unicode_from_ascii ((rc_uint_type *) NULL, &h, $1);
+ $$ = h;
+ }
+ ;
+
+sizedstring:
+ SIZEDSTRING
+ {
+ $$ = $1;
+ }
+ | sizedstring SIZEDSTRING
+ {
+ rc_uint_type l = $1.length + $2.length;
+ char *h = (char *) res_alloc (l);
+ memcpy (h, $1.s, $1.length);
+ memcpy (h + $1.length, $2.s, $2.length);
+ $$.s = h;
+ $$.length = l;
+ }
+ ;
+
+sizedunistring:
+ SIZEDUNISTRING
+ {
+ $$ = $1;
+ }
+ | sizedunistring SIZEDUNISTRING
+ {
+ rc_uint_type l = $1.length + $2.length;
+ unichar *h = (unichar *) res_alloc (l * sizeof (unichar));
+ memcpy (h, $1.s, $1.length * sizeof (unichar));
+ memcpy (h + $1.length, $2.s, $2.length * sizeof (unichar));
+ $$.s = h;
+ $$.length = l;
+ }
+ ;
+
/* A style expression. This changes the static variable STYLE. We do
it this way because rc appears to permit a style to be set to
something like