rcparse.y (78828) | rcparse.y (89857) |
---|---|
1%{ /* rcparse.y -- parser for Windows rc files | 1%{ /* rcparse.y -- parser for Windows rc files |
2 Copyright 1997, 1998, 1999, 2000 Free Software Foundation, Inc. | 2 Copyright 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. |
3 Written by Ian Lance Taylor, Cygnus Support. 4 5 This file is part of GNU Binutils. 6 7 This program is free software; you can redistribute it and/or modify 8 it under the terms of the GNU General Public License as published by 9 the Free Software Foundation; either version 2 of the License, or 10 (at your option) any later version. --- 10 unchanged lines hidden (view full) --- 21 22/* This is a parser for Windows rc files. It is based on the parser 23 by Gunther Ebert <gunther.ebert@ixos-leipzig.de>. */ 24 25#include "bfd.h" 26#include "bucomm.h" 27#include "libiberty.h" 28#include "windres.h" | 3 Written by Ian Lance Taylor, Cygnus Support. 4 5 This file is part of GNU Binutils. 6 7 This program is free software; you can redistribute it and/or modify 8 it under the terms of the GNU General Public License as published by 9 the Free Software Foundation; either version 2 of the License, or 10 (at your option) any later version. --- 10 unchanged lines hidden (view full) --- 21 22/* This is a parser for Windows rc files. It is based on the parser 23 by Gunther Ebert <gunther.ebert@ixos-leipzig.de>. */ 24 25#include "bfd.h" 26#include "bucomm.h" 27#include "libiberty.h" 28#include "windres.h" |
29#include "safe-ctype.h" |
|
29 | 30 |
30#include <ctype.h> 31 | |
32/* The current language. */ 33 34static unsigned short language; 35 36/* The resource information during a sub statement. */ 37 38static struct res_res_info sub_res_info; 39 --- 200 unchanged lines hidden (view full) --- 240 ch = *s; 241 if (ch != '^') 242 $$.flags = 0; 243 else 244 { 245 $$.flags = ACC_CONTROL | ACC_VIRTKEY; 246 ++s; 247 ch = *s; | 31/* The current language. */ 32 33static unsigned short language; 34 35/* The resource information during a sub statement. */ 36 37static struct res_res_info sub_res_info; 38 --- 200 unchanged lines hidden (view full) --- 239 ch = *s; 240 if (ch != '^') 241 $$.flags = 0; 242 else 243 { 244 $$.flags = ACC_CONTROL | ACC_VIRTKEY; 245 ++s; 246 ch = *s; |
248 ch = toupper ((unsigned char) ch); | 247 ch = TOUPPER (ch); |
249 } 250 $$.key = ch; 251 if (s[1] != '\0') 252 rcparse_warning (_("accelerator should only be one character")); 253 } 254 | posnumexpr 255 { 256 $$.next = NULL; --- 193 unchanged lines hidden (view full) --- 450 dialog.menu = $3; 451 } 452 | styles CHARACTERISTICS numexpr 453 { 454 sub_res_info.characteristics = $3; 455 } 456 | styles LANGUAGE numexpr cnumexpr 457 { | 248 } 249 $$.key = ch; 250 if (s[1] != '\0') 251 rcparse_warning (_("accelerator should only be one character")); 252 } 253 | posnumexpr 254 { 255 $$.next = NULL; --- 193 unchanged lines hidden (view full) --- 449 dialog.menu = $3; 450 } 451 | styles CHARACTERISTICS numexpr 452 { 453 sub_res_info.characteristics = $3; 454 } 455 | styles LANGUAGE numexpr cnumexpr 456 { |
458 sub_res_info.language = $3 | ($4 << 8); | 457 sub_res_info.language = $3 | ($4 << SUBLANG_SHIFT); |
459 } 460 | styles VERSIONK numexpr 461 { 462 sub_res_info.version = $3; 463 } 464 ; 465 466controls: --- 402 unchanged lines hidden (view full) --- 869 ; 870 871/* Language command. This changes the static variable language, which 872 affects all subsequent resources. */ 873 874language: 875 LANGUAGE numexpr cnumexpr 876 { | 458 } 459 | styles VERSIONK numexpr 460 { 461 sub_res_info.version = $3; 462 } 463 ; 464 465controls: --- 402 unchanged lines hidden (view full) --- 868 ; 869 870/* Language command. This changes the static variable language, which 871 affects all subsequent resources. */ 872 873language: 874 LANGUAGE numexpr cnumexpr 875 { |
877 language = $2 | ($3 << 8); | 876 language = $2 | ($3 << SUBLANG_SHIFT); |
878 } 879 ; 880 881/* Menu resources. */ 882 883menu: 884 id MENU suboptions BEG menuitems END 885 { --- 368 unchanged lines hidden (view full) --- 1254 } 1255 | STRING 1256 { 1257 char *copy, *s; 1258 1259 /* It seems that resource ID's are forced to upper case. */ 1260 copy = xstrdup ($1); 1261 for (s = copy; *s != '\0'; s++) | 877 } 878 ; 879 880/* Menu resources. */ 881 882menu: 883 id MENU suboptions BEG menuitems END 884 { --- 368 unchanged lines hidden (view full) --- 1253 } 1254 | STRING 1255 { 1256 char *copy, *s; 1257 1258 /* It seems that resource ID's are forced to upper case. */ 1259 copy = xstrdup ($1); 1260 for (s = copy; *s != '\0'; s++) |
1262 if (islower ((unsigned char) *s)) 1263 *s = toupper ((unsigned char) *s); | 1261 *s = TOUPPER (*s); |
1264 res_string_to_id (&$$, copy); 1265 free (copy); 1266 } 1267 ; 1268 1269/* A resource reference. */ 1270 1271resname: --- 20 unchanged lines hidden (view full) --- 1292 } 1293 | resname 1294 { 1295 char *copy, *s; 1296 1297 /* It seems that resource ID's are forced to upper case. */ 1298 copy = xstrdup ($1); 1299 for (s = copy; *s != '\0'; s++) | 1262 res_string_to_id (&$$, copy); 1263 free (copy); 1264 } 1265 ; 1266 1267/* A resource reference. */ 1268 1269resname: --- 20 unchanged lines hidden (view full) --- 1290 } 1291 | resname 1292 { 1293 char *copy, *s; 1294 1295 /* It seems that resource ID's are forced to upper case. */ 1296 copy = xstrdup ($1); 1297 for (s = copy; *s != '\0'; s++) |
1300 if (islower ((unsigned char) *s)) 1301 *s = toupper ((unsigned char) *s); | 1298 *s = TOUPPER (*s); |
1302 res_string_to_id (&$$, copy); 1303 free (copy); 1304 } 1305 ; 1306 1307/* Generic suboptions. These may appear before the BEGIN in any 1308 multiline statement. */ 1309 --- 14 unchanged lines hidden (view full) --- 1324 | suboptions CHARACTERISTICS numexpr 1325 { 1326 $$ = $1; 1327 $$.characteristics = $3; 1328 } 1329 | suboptions LANGUAGE numexpr cnumexpr 1330 { 1331 $$ = $1; | 1299 res_string_to_id (&$$, copy); 1300 free (copy); 1301 } 1302 ; 1303 1304/* Generic suboptions. These may appear before the BEGIN in any 1305 multiline statement. */ 1306 --- 14 unchanged lines hidden (view full) --- 1321 | suboptions CHARACTERISTICS numexpr 1322 { 1323 $$ = $1; 1324 $$.characteristics = $3; 1325 } 1326 | suboptions LANGUAGE numexpr cnumexpr 1327 { 1328 $$ = $1; |
1332 $$.language = $3 | ($4 << 8); | 1329 $$.language = $3 | ($4 << SUBLANG_SHIFT); |
1333 } 1334 | suboptions VERSIONK numexpr 1335 { 1336 $$ = $1; 1337 $$.version = $3; 1338 } 1339 ; 1340 --- 311 unchanged lines hidden --- | 1330 } 1331 | suboptions VERSIONK numexpr 1332 { 1333 $$ = $1; 1334 $$.version = $3; 1335 } 1336 ; 1337 --- 311 unchanged lines hidden --- |