Line 1... |
Line 1... |
%{ /* rcparse.y -- parser for Windows rc files
|
%{ /* rcparse.y -- parser for Windows rc files
|
Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2007, 2008
|
Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2007, 2008,
|
Free Software Foundation, Inc.
|
2011 Free Software Foundation, Inc.
|
Written by Ian Lance Taylor, Cygnus Support.
|
Written by Ian Lance Taylor, Cygnus Support.
|
Extended by Kai Tietz, Onevision.
|
Extended by Kai Tietz, Onevision.
|
|
|
This file is part of GNU Binutils.
|
This file is part of GNU Binutils.
|
|
|
Line 77... |
Line 77... |
rc_rcdata_item *last;
|
rc_rcdata_item *last;
|
} rcdata;
|
} rcdata;
|
rc_rcdata_item *rcdata_item;
|
rc_rcdata_item *rcdata_item;
|
rc_fixed_versioninfo *fixver;
|
rc_fixed_versioninfo *fixver;
|
rc_ver_info *verinfo;
|
rc_ver_info *verinfo;
|
|
rc_ver_stringtable *verstringtable;
|
rc_ver_stringinfo *verstring;
|
rc_ver_stringinfo *verstring;
|
rc_ver_varinfo *vervar;
|
rc_ver_varinfo *vervar;
|
rc_toolbar_item *toobar_item;
|
rc_toolbar_item *toobar_item;
|
rc_res_id id;
|
rc_res_id id;
|
rc_res_res_info res_info;
|
rc_res_res_info res_info;
|
Line 148... |
Line 149... |
%type
|
%type
|
%type optrcdata_data optrcdata_data_int rcdata_data
|
%type optrcdata_data optrcdata_data_int rcdata_data
|
%type opt_control_data
|
%type opt_control_data
|
%type fixedverinfo
|
%type fixedverinfo
|
%type verblocks
|
%type verblocks
|
|
%type verstringtables
|
%type vervals
|
%type vervals
|
%type vertrans
|
%type vertrans
|
%type toolbar_data
|
%type toolbar_data
|
%type suboptions memflags_move_discard memflags_move
|
%type suboptions memflags_move_discard memflags_move
|
%type memflag
|
%type memflag
|
Line 160... |
Line 162... |
%type numexpr posnumexpr cnumexpr optcnumexpr cposnumexpr
|
%type numexpr posnumexpr cnumexpr optcnumexpr cposnumexpr
|
%type acc_options acc_option menuitem_flags menuitem_flag
|
%type acc_options acc_option menuitem_flags menuitem_flag
|
%type file_name
|
%type file_name
|
%type res_unicode_string resname res_unicode_string_concat
|
%type res_unicode_string resname res_unicode_string_concat
|
%type sizedstring
|
%type sizedstring
|
%type sizedunistring
|
%type sizedunistring res_unicode_sizedstring res_unicode_sizedstring_concat
|
%type sizednumexpr sizedposnumexpr
|
%type sizednumexpr sizedposnumexpr
|
|
|
%left '|'
|
%left '|'
|
%left '^'
|
%left '^'
|
%left '&'
|
%left '&'
|
Line 1256... |
Line 1258... |
|
|
/* Stringtable resources. */
|
/* Stringtable resources. */
|
|
|
stringtable:
|
stringtable:
|
STRINGTABLE suboptions BEG
|
STRINGTABLE suboptions BEG
|
{ sub_res_info = $2; }
|
{ sub_res_info = $2; rcparse_rcdata (); }
|
string_data END
|
string_data END { rcparse_normal (); }
|
;
|
;
|
|
|
string_data:
|
string_data:
|
/* empty */
|
/* empty */
|
| string_data numexpr res_unicode_string_concat
|
| string_data numexpr res_unicode_sizedstring_concat
|
{
|
{
|
define_stringtable (&sub_res_info, $2, $3);
|
define_stringtable (&sub_res_info, $2, $3.s, $3.length);
|
rcparse_discard_strings ();
|
rcparse_discard_strings ();
|
}
|
}
|
| string_data numexpr ',' res_unicode_string_concat
|
| string_data numexpr ',' res_unicode_sizedstring_concat
|
{
|
{
|
define_stringtable (&sub_res_info, $2, $4);
|
define_stringtable (&sub_res_info, $2, $4.s, $4.length);
|
rcparse_discard_strings ();
|
rcparse_discard_strings ();
|
}
|
}
|
| string_data error
|
| string_data error
|
{
|
{
|
rcparse_warning (_("invalid stringtable resource."));
|
rcparse_warning (_("invalid stringtable resource."));
|
Line 1469... |
Line 1471... |
verblocks:
|
verblocks:
|
/* empty */
|
/* empty */
|
{
|
{
|
$$ = NULL;
|
$$ = NULL;
|
}
|
}
|
| verblocks BLOCKSTRINGFILEINFO BEG BLOCK BEG vervals END END
|
| verblocks BLOCKSTRINGFILEINFO BEG verstringtables END
|
{
|
{
|
$$ = append_ver_stringfileinfo ($1, $4, $6);
|
$$ = append_ver_stringfileinfo ($1, $4);
|
}
|
}
|
| verblocks BLOCKVARFILEINFO BEG VALUE res_unicode_string_concat vertrans END
|
| verblocks BLOCKVARFILEINFO BEG VALUE res_unicode_string_concat vertrans END
|
{
|
{
|
$$ = append_ver_varfileinfo ($1, $5, $6);
|
$$ = append_ver_varfileinfo ($1, $5, $6);
|
}
|
}
|
;
|
;
|
|
|
|
verstringtables:
|
|
/* empty */
|
|
{
|
|
$$ = NULL;
|
|
}
|
|
| verstringtables BLOCK BEG vervals END
|
|
{
|
|
$$ = append_ver_stringtable ($1, $2, $4);
|
|
}
|
|
;
|
|
|
vervals:
|
vervals:
|
/* empty */
|
/* empty */
|
{
|
{
|
$$ = NULL;
|
$$ = NULL;
|
}
|
}
|
Line 1703... |
Line 1716... |
unicode_from_ascii ((rc_uint_type *) NULL, &h, $1);
|
unicode_from_ascii ((rc_uint_type *) NULL, &h, $1);
|
$$ = h;
|
$$ = h;
|
}
|
}
|
;
|
;
|
|
|
|
res_unicode_sizedstring:
|
|
sizedunistring
|
|
{
|
|
$$ = $1;
|
|
}
|
|
| sizedstring
|
|
{
|
|
unichar *h = NULL;
|
|
rc_uint_type l = 0;
|
|
unicode_from_ascii_len (&l, &h, $1.s, $1.length);
|
|
$$.s = h;
|
|
$$.length = l;
|
|
}
|
|
;
|
|
|
|
/* Concat string */
|
|
res_unicode_sizedstring_concat:
|
|
res_unicode_sizedstring
|
|
{
|
|
$$ = $1;
|
|
}
|
|
|
|
|
res_unicode_sizedstring_concat res_unicode_sizedstring
|
|
{
|
|
rc_uint_type l1 = $1.length;
|
|
rc_uint_type l2 = $2.length;
|
|
unichar *h = (unichar *) res_alloc ((l1 + l2 + 1) * sizeof (unichar));
|
|
if (l1 != 0)
|
|
memcpy (h, $1.s, l1 * sizeof (unichar));
|
|
if (l2 != 0)
|
|
memcpy (h + l1, $2.s, l2 * sizeof (unichar));
|
|
h[l1 + l2] = 0;
|
|
$$.length = l1 + l2;
|
|
$$.s = h;
|
|
}
|
|
;
|
|
|
sizedstring:
|
sizedstring:
|
SIZEDSTRING
|
SIZEDSTRING
|
{
|
{
|
$$ = $1;
|
$$ = $1;
|
}
|
}
|