X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=binutils%2Frcparse.y;h=152c8ee3086060a6d2d9946a136969bbfe86f9ab;hb=30d304de8b0593a62f7aab770f421f91fbea392a;hp=39551c2bf7b22f61ed1ee2372091dc2bf70c7cb6;hpb=27e232885db363fb545fd2f450e72d929e59b8f6;p=deliverable%2Fbinutils-gdb.git diff --git a/binutils/rcparse.y b/binutils/rcparse.y index 39551c2bf7..152c8ee308 100644 --- a/binutils/rcparse.y +++ b/binutils/rcparse.y @@ -1,5 +1,5 @@ %{ /* rcparse.y -- parser for Windows rc files - Copyright 1997, 1998 Free Software Foundation, Inc. + Copyright 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. This file is part of GNU Binutils. @@ -26,8 +26,7 @@ #include "bucomm.h" #include "libiberty.h" #include "windres.h" - -#include +#include "safe-ctype.h" /* The current language. */ @@ -136,11 +135,11 @@ static unsigned long class; %type vertrans %type suboptions memflags_move_discard memflags_move %type memflag -%type id +%type id resref %type exstyle parennumber %type numexpr posnumexpr cnumexpr optcnumexpr cposnumexpr %type acc_options acc_option menuitem_flags menuitem_flag -%type optstringc file_name +%type optstringc file_name resname %type sizednumexpr sizedposnumexpr %left '|' @@ -245,7 +244,7 @@ acc_event: $$.flags = ACC_CONTROL | ACC_VIRTKEY; ++s; ch = *s; - ch = toupper ((unsigned char) ch); + ch = TOUPPER (ch); } $$.key = ch; if (s[1] != '\0') @@ -455,7 +454,7 @@ styles: } | styles LANGUAGE numexpr cnumexpr { - sub_res_info.language = $3 | ($4 << 8); + sub_res_info.language = $3 | ($4 << SUBLANG_SHIFT); } | styles VERSIONK numexpr { @@ -636,24 +635,24 @@ control: rcparse_warning (_("IEDIT requires DIALOGEX")); res_string_to_id (&$$->class, "HEDIT"); } - | ICON id cnumexpr cnumexpr cnumexpr opt_control_data + | ICON resref numexpr cnumexpr cnumexpr opt_control_data { $$ = define_icon_control ($2, $3, $4, $5, 0, 0, 0, $6, dialog.ex); } - | ICON id cnumexpr cnumexpr cnumexpr cnumexpr cnumexpr + | ICON resref numexpr cnumexpr cnumexpr cnumexpr cnumexpr opt_control_data { $$ = define_icon_control ($2, $3, $4, $5, 0, 0, 0, $8, dialog.ex); } - | ICON id cnumexpr cnumexpr cnumexpr cnumexpr cnumexpr + | ICON resref numexpr cnumexpr cnumexpr cnumexpr cnumexpr icon_styleexpr optcnumexpr opt_control_data { $$ = define_icon_control ($2, $3, $4, $5, style, $9, 0, $10, dialog.ex); } - | ICON id numexpr cnumexpr cnumexpr cnumexpr cnumexpr + | ICON resref numexpr cnumexpr cnumexpr cnumexpr cnumexpr icon_styleexpr cnumexpr cnumexpr opt_control_data { $$ = define_icon_control ($2, $3, $4, $5, style, $9, $10, $11, @@ -809,6 +808,10 @@ optstringc: { $$ = NULL; } + | QUOTEDSTRING + { + $$ = $1; + } | QUOTEDSTRING ',' { $$ = $1; @@ -870,7 +873,7 @@ icon: language: LANGUAGE numexpr cnumexpr { - language = $2 | ($3 << 8); + language = $2 | ($3 << SUBLANG_SHIFT); } ; @@ -1255,8 +1258,44 @@ id: /* It seems that resource ID's are forced to upper case. */ copy = xstrdup ($1); for (s = copy; *s != '\0'; s++) - if (islower ((unsigned char) *s)) - *s = toupper ((unsigned char) *s); + *s = TOUPPER (*s); + res_string_to_id (&$$, copy); + free (copy); + } + ; + +/* A resource reference. */ + +resname: + QUOTEDSTRING + { + $$ = $1; + } + | QUOTEDSTRING ',' + { + $$ = $1; + } + | STRING ',' + { + $$ = $1; + } + ; + + +resref: + posnumexpr ',' + { + $$.named = 0; + $$.u.id = $1; + } + | 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); } @@ -1287,7 +1326,7 @@ suboptions: | suboptions LANGUAGE numexpr cnumexpr { $$ = $1; - $$.language = $3 | ($4 << 8); + $$.language = $3 | ($4 << SUBLANG_SHIFT); } | suboptions VERSIONK numexpr {