diff options
author | Nick Clifton <nickc@redhat.com> | 2002-04-15 14:12:41 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2002-04-15 14:12:41 +0000 |
commit | 45b99827916a4cbbf1b721ff346e69255550899b (patch) | |
tree | cfa480422fb9c85db2bfca51b5cb3d3ebdc1a2c7 /binutils | |
parent | 272423870a26d8a7cabfc48b10b6f2b8c365e7b5 (diff) | |
download | gdb-45b99827916a4cbbf1b721ff346e69255550899b.zip gdb-45b99827916a4cbbf1b721ff346e69255550899b.tar.gz gdb-45b99827916a4cbbf1b721ff346e69255550899b.tar.bz2 |
Allow two to five parameter in FONT statement of DIALOGEX resources.
Diffstat (limited to 'binutils')
-rw-r--r-- | binutils/ChangeLog | 15 | ||||
-rw-r--r-- | binutils/rcparse.y | 37 | ||||
-rw-r--r-- | binutils/resbin.c | 12 | ||||
-rw-r--r-- | binutils/resrc.c | 7 | ||||
-rw-r--r-- | binutils/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/windres/dlgfont.rc | 29 | ||||
-rw-r--r-- | binutils/testsuite/binutils-all/windres/dlgfont.rsd | 39 | ||||
-rw-r--r-- | binutils/windres.h | 8 |
8 files changed, 145 insertions, 8 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index ba1c648..347bb4b 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,18 @@ +2002-04-15 Nick Clifton <nickc@cambridge.redhat.com> + + * resrc.c (write_rc_dialog): If charset is non-default value + display all of the DIALOGEX parameters. + +2002-04-15 Eric Kohl <ekohl@rz-online.de> + + * rcparse.y: Allow two to five parameter in FONT statement of + DIALOGEX resources. + * resbin.c (bin_to_res_dialog): Fixed read/write code for dialogex + resource data. + (res_to_bin_dialog): Likewise. + * windres.h: Added misssing charset variable to dialog_ex + structure. + 2002-04-10 Nick Clifton <nickc@cambridge.redhat.com> * rcparse.y: Set MEMFLAG_PURE by default. diff --git a/binutils/rcparse.y b/binutils/rcparse.y index 572d9c2..24ef35c 100644 --- a/binutils/rcparse.y +++ b/binutils/rcparse.y @@ -439,6 +439,27 @@ styles: style |= DS_SETFONT; dialog.pointsize = $3; unicode_from_ascii ((int *) NULL, &dialog.font, $5); + if (dialog.ex != NULL) + { + dialog.ex->weight = 0; + dialog.ex->italic = 0; + dialog.ex->charset = 1; + } + } + | styles FONT numexpr ',' QUOTEDSTRING cnumexpr + { + dialog.style |= DS_SETFONT; + style |= DS_SETFONT; + dialog.pointsize = $3; + unicode_from_ascii ((int *) NULL, &dialog.font, $5); + if (dialog.ex == NULL) + rcparse_warning (_("extended FONT requires DIALOGEX")); + else + { + dialog.ex->weight = $6; + dialog.ex->italic = 0; + dialog.ex->charset = 1; + } } | styles FONT numexpr ',' QUOTEDSTRING cnumexpr cnumexpr { @@ -452,6 +473,22 @@ styles: { dialog.ex->weight = $6; dialog.ex->italic = $7; + dialog.ex->charset = 1; + } + } + | styles FONT numexpr ',' QUOTEDSTRING cnumexpr cnumexpr cnumexpr + { + dialog.style |= DS_SETFONT; + style |= DS_SETFONT; + dialog.pointsize = $3; + unicode_from_ascii ((int *) NULL, &dialog.font, $5); + if (dialog.ex == NULL) + rcparse_warning (_("extended FONT requires DIALOGEX")); + else + { + dialog.ex->weight = $6; + dialog.ex->italic = $7; + dialog.ex->charset = $8; } } | styles MENU id diff --git a/binutils/resbin.c b/binutils/resbin.c index 0684aec..e9ea900 100644 --- a/binutils/resbin.c +++ b/binutils/resbin.c @@ -30,6 +30,7 @@ /* Macros to swap in values. */ +#define get_8(s) (*((unsigned char *)(s))) #define get_16(be, s) ((be) ? bfd_getb16 (s) : bfd_getl16 (s)) #define get_32(be, s) ((be) ? bfd_getb32 (s) : bfd_getl32 (s)) @@ -528,6 +529,7 @@ bin_to_res_dialog (data, length, big_endian) { d->ex->weight = 0; d->ex->italic = 0; + d->ex->charset = 1; /* Default charset. */ } } else @@ -543,7 +545,8 @@ bin_to_res_dialog (data, length, big_endian) if (length < off + 4) toosmall (_("dialogex font information")); d->ex->weight = get_16 (big_endian, data + off); - d->ex->italic = get_16 (big_endian, data + off + 2); + d->ex->italic = get_8 (data + off + 2); + d->ex->charset = get_8 (data + off + 3); off += 4; } @@ -1257,6 +1260,7 @@ bin_to_res_userdata (data, length, big_endian) /* Macros to swap out values. */ +#define put_8(v, s) (*((unsigned char *) (s)) = (unsigned char) (v)) #define put_16(be, v, s) ((be) ? bfd_putb16 ((v), (s)) : bfd_putl16 ((v), (s))) #define put_32(be, v, s) ((be) ? bfd_putb32 ((v), (s)) : bfd_putl32 ((v), (s))) @@ -1626,12 +1630,14 @@ res_to_bin_dialog (dialog, big_endian) if (dialog->ex == NULL) { put_16 (big_endian, 0, d->data + 2); - put_16 (big_endian, 0, d->data + 4); + put_8 (0, d->data + 4); + put_8 (1, d->data + 5); } else { put_16 (big_endian, dialog->ex->weight, d->data + 2); - put_16 (big_endian, dialog->ex->italic, d->data + 4); + put_8 (dialog->ex->italic, d->data + 4); + put_8 (dialog->ex->charset, d->data + 5); } } diff --git a/binutils/resrc.c b/binutils/resrc.c index 773e08a..96de59c 100644 --- a/binutils/resrc.c +++ b/binutils/resrc.c @@ -2087,8 +2087,11 @@ write_rc_dialog (e, dialog) unicode_print (e, dialog->font, -1); fprintf (e, "\""); if (dialog->ex != NULL - && (dialog->ex->weight != 0 || dialog->ex->italic != 0)) - fprintf (e, ", %d, %d", dialog->ex->weight, dialog->ex->italic); + && (dialog->ex->weight != 0 + || dialog->ex->italic != 0 + || dialog->ex->charset != 1)) + fprintf (e, ", %d, %d, %d", + dialog->ex->weight, dialog->ex->italic, dialog->ex->charset); fprintf (e, "\n"); } diff --git a/binutils/testsuite/ChangeLog b/binutils/testsuite/ChangeLog index 8b24f7c..3077224 100644 --- a/binutils/testsuite/ChangeLog +++ b/binutils/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2002-04-15 Eric Kohl <ekohl@rz-online.de> + + * binutils-all/windres/dlgfont.rc: New test case: Checks FONT + statement in DIALOG and DIALOGEX resources. + * binutils-all/windres/dlgfont.rsd: Expected output. + 2002-04-11 Nick Clifton <nickc@cambridge.redhat.com> * binutils-all/ar.exp (long_filenames): Use 'file delete' instead diff --git a/binutils/testsuite/binutils-all/windres/dlgfont.rc b/binutils/testsuite/binutils-all/windres/dlgfont.rc new file mode 100644 index 0000000..9c763e5 --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/dlgfont.rc @@ -0,0 +1,29 @@ +101 DIALOG DISCARDABLE 0, 0, 186, 95 +FONT 8, "Tahoma" +BEGIN + DEFPUSHBUTTON "OK", 1, 129, 7, 50, 14 +END + +102 DIALOGEX DISCARDABLE 0, 0, 186, 95 +FONT 8, "Tahoma" +BEGIN + DEFPUSHBUTTON "OK", 1, 129, 7, 50, 14 +END + +103 DIALOGEX DISCARDABLE 0, 0, 186, 95 +FONT 8, "Tahoma", 0 +BEGIN + DEFPUSHBUTTON "OK", 1, 129, 7, 50, 14 +END + +104 DIALOGEX DISCARDABLE 0, 0, 186, 95 +FONT 8, "Tahoma", 0, 0 +BEGIN + DEFPUSHBUTTON "OK", 1, 129, 7, 50, 14 +END + +105 DIALOGEX DISCARDABLE 0, 0, 186, 95 +FONT 8, "Tahoma", 0, 0, 1 +BEGIN + DEFPUSHBUTTON "OK", 1, 129, 7, 50, 14 +END diff --git a/binutils/testsuite/binutils-all/windres/dlgfont.rsd b/binutils/testsuite/binutils-all/windres/dlgfont.rsd new file mode 100644 index 0000000..8a25cfa --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/dlgfont.rsd @@ -0,0 +1,39 @@ + 0000 00000000 20000000 ffff0000 ffff0000 .... ........... + 0010 00000000 00000000 00000000 00000000 ................ + 0020 46000000 20000000 ffff0500 ffff6500 F... .........e. + 0030 00000000 30100904 00000000 00000000 ....0........... + 0040 40008880 00000000 01000000 0000ba00 @............... + 0050 5f000000 00000000 08005400 61006800 _.........T.a.h. + 0060 6f006d00 61000000 01000150 00000000 o.m.a......P.... + 0070 81000700 32000e00 0100ffff 80004f00 ....2.........O. + 0080 4b000000 00000000 58000000 20000000 K.......X... ... + 0090 ffff0500 ffff6600 00000000 30100904 ......f.....0... + 00a0 00000000 00000000 0100ffff 00000000 ................ + 00b0 00000000 40008880 01000000 0000ba00 ....@........... + 00c0 5f000000 00000000 08000000 00015400 _.............T. + 00d0 61006800 6f006d00 61000000 00000000 a.h.o.m.a....... + 00e0 00000000 01000150 81000700 32000e00 .......P....2... + 00f0 01000000 ffff8000 4f004b00 00000000 ........O.K..... + 0100 58000000 20000000 ffff0500 ffff6700 X... .........g. + 0110 00000000 30100904 00000000 00000000 ....0........... + 0120 0100ffff 00000000 00000000 40008880 ............@... + 0130 01000000 0000ba00 5f000000 00000000 ........_....... + 0140 08000000 00015400 61006800 6f006d00 ......T.a.h.o.m. + 0150 61000000 00000000 00000000 01000150 a..............P + 0160 81000700 32000e00 01000000 ffff8000 ....2........... + 0170 4f004b00 00000000 58000000 20000000 O.K.....X... ... + 0180 ffff0500 ffff6800 00000000 30100904 ......h.....0... + 0190 00000000 00000000 0100ffff 00000000 ................ + 01a0 00000000 40008880 01000000 0000ba00 ....@........... + 01b0 5f000000 00000000 08000000 00015400 _.............T. + 01c0 61006800 6f006d00 61000000 00000000 a.h.o.m.a....... + 01d0 00000000 01000150 81000700 32000e00 .......P....2... + 01e0 01000000 ffff8000 4f004b00 00000000 ........O.K..... + 01f0 58000000 20000000 ffff0500 ffff6900 X... .........i. + 0200 00000000 30100904 00000000 00000000 ....0........... + 0210 0100ffff 00000000 00000000 40008880 ............@... + 0220 01000000 0000ba00 5f000000 00000000 ........_....... + 0230 08000000 00015400 61006800 6f006d00 ......T.a.h.o.m. + 0240 61000000 00000000 00000000 01000150 a..............P + 0250 81000700 32000e00 01000000 ffff8000 ....2........... + 0260 4f004b00 00000000 O.K..... diff --git a/binutils/windres.h b/binutils/windres.h index 157d751..64b6050 100644 --- a/binutils/windres.h +++ b/binutils/windres.h @@ -1,5 +1,5 @@ /* windres.h -- header file for windres program. - Copyright 1997, 1998, 2000 Free Software Foundation, Inc. + Copyright 1997, 1998, 2000, 2002 Free Software Foundation, Inc. Written by Ian Lance Taylor, Cygnus Support. This file is part of GNU Binutils. @@ -315,7 +315,9 @@ struct dialog_ex /* Font weight. */ unsigned short weight; /* Whether the font is italic. */ - unsigned short italic; + unsigned char italic; + /* Character set. */ + unsigned char charset; }; /* Window style flags, from the winsup Defines.h header file. These @@ -519,7 +521,7 @@ struct fontdir short index; /* Length of font information. */ unsigned long length; - /* Font information. */ + /* Font information. */ const unsigned char *data; }; |