diff options
author | Kai Tietz <kai.tietz@onevision.com> | 2011-10-25 08:03:18 +0000 |
---|---|---|
committer | Kai Tietz <kai.tietz@onevision.com> | 2011-10-25 08:03:18 +0000 |
commit | 81472056d738c3b07914f3dad5edb0f4af45a050 (patch) | |
tree | 3273d71c8c4bf457ccf5ba1bcbfda3792f41a151 /binutils/rcparse.y | |
parent | 977888b9906f450cc0f3f2ecf917e7b33aaf1217 (diff) | |
download | gdb-81472056d738c3b07914f3dad5edb0f4af45a050.zip gdb-81472056d738c3b07914f3dad5edb0f4af45a050.tar.gz gdb-81472056d738c3b07914f3dad5edb0f4af45a050.tar.bz2 |
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.
Diffstat (limited to 'binutils/rcparse.y')
-rw-r--r-- | binutils/rcparse.y | 51 |
1 files changed, 44 insertions, 7 deletions
diff --git a/binutils/rcparse.y b/binutils/rcparse.y index e260792..e80cbc6 100644 --- a/binutils/rcparse.y +++ b/binutils/rcparse.y @@ -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 { |