2011-10-25 Kai Tietz <ktietz@redhat.com>
* winduni.h (unicode_from_ascii_len): New prototype. * winduni.c (unicode_from_ascii_len): New function. * windres.h (define_stringtable): Add additional length argument. * windres.c (define_stringtable): Add length argument for string. * rcparse.y (res_unicode_sizedstring): New rule. (res_unicode_sizedstring_concat): Likewise. (string_data): Adjust rule. 2011-10-25 Kai Tietz <ktietz@redhat.com> * binutils-all/windres/strtab4.rc: New test. * binutils-all/windres/strtab4.rsd: Likewise.
This commit is contained in:
parent
977888b990
commit
81472056d7
9 changed files with 175 additions and 12 deletions
|
@ -164,7 +164,7 @@ static const rc_res_id res_null_text = { 1, {{0, &null_unichar}}};
|
|||
%type <s> file_name
|
||||
%type <uni> res_unicode_string resname res_unicode_string_concat
|
||||
%type <ss> sizedstring
|
||||
%type <suni> sizedunistring
|
||||
%type <suni> sizedunistring res_unicode_sizedstring res_unicode_sizedstring_concat
|
||||
%type <i> sizednumexpr sizedposnumexpr
|
||||
|
||||
%left '|'
|
||||
|
@ -1260,20 +1260,20 @@ rcdata_data:
|
|||
|
||||
stringtable:
|
||||
STRINGTABLE suboptions BEG
|
||||
{ sub_res_info = $2; }
|
||||
string_data END
|
||||
{ sub_res_info = $2; rcparse_rcdata (); }
|
||||
string_data END { rcparse_normal (); }
|
||||
;
|
||||
|
||||
string_data:
|
||||
/* 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 ();
|
||||
}
|
||||
| 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 ();
|
||||
}
|
||||
| string_data error
|
||||
|
@ -1718,6 +1718,43 @@ res_unicode_string:
|
|||
}
|
||||
;
|
||||
|
||||
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
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue