From: Nick Clifton Date: Tue, 9 Apr 2002 15:59:13 +0000 (+0000) Subject: Don't add default dialog style when explicit style specified. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=91eafb409b7bdf9462b9e5d0ba690c288814e979;p=binutils-gdb.git Don't add default dialog style when explicit style specified. Print style even if it is 0. Add testcase. --- diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 299621dc989..7414ba1e116 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -3,11 +3,14 @@ * rcparse.y: CLASS definitions in DIALOG resources are quoted. Fix typo in BEDIT warning. + Don't add default dialog style when explicit style specified. * rclex.l: "\xhex" encoding in strings corrected. "\a" escape (used for right justified key definitions in menus) is encodes as binary 8. + * resrc.c: Print style even if it is 0. + 2002-04-09 Gunnar Degnbol * resrc.c: print CLASS names in quotes diff --git a/binutils/rcparse.y b/binutils/rcparse.y index b141f4a18ed..fcd34cc2315 100644 --- a/binutils/rcparse.y +++ b/binutils/rcparse.y @@ -340,6 +340,7 @@ dialog: dialog.ex = NULL; dialog.controls = NULL; sub_res_info = $3; + style = 0; } styles BEG controls END { @@ -363,6 +364,7 @@ dialog: memset (dialog.ex, 0, sizeof (struct dialog_ex)); dialog.controls = NULL; sub_res_info = $3; + style = 0; } styles BEG controls END { @@ -387,6 +389,7 @@ dialog: dialog.ex->help = $9; dialog.controls = NULL; sub_res_info = $3; + style = 0; } styles BEG controls END { @@ -416,7 +419,6 @@ styles: dialog.class = $3; } | styles STYLE - { style = dialog.style; } styleexpr { dialog.style = style; @@ -432,12 +434,14 @@ styles: | styles FONT numexpr ',' QUOTEDSTRING { dialog.style |= DS_SETFONT; + style |= DS_SETFONT; dialog.pointsize = $3; unicode_from_ascii ((int *) NULL, &dialog.font, $5); } | styles FONT numexpr ',' QUOTEDSTRING cnumexpr cnumexpr { dialog.style |= DS_SETFONT; + style |= DS_SETFONT; dialog.pointsize = $3; unicode_from_ascii ((int *) NULL, &dialog.font, $5); if (dialog.ex == NULL) diff --git a/binutils/resrc.c b/binutils/resrc.c index a576c80fdfc..a9b3ba8f0b4 100644 --- a/binutils/resrc.c +++ b/binutils/resrc.c @@ -131,7 +131,7 @@ static FILE *cpp_pipe; static char *cpp_temp_file; -/* Input stream is either a file or a pipe. */ +/* Input stream is either a file or a pipe. */ static enum {ISTREAM_PIPE, ISTREAM_FILE} istream_type; @@ -2052,10 +2052,11 @@ write_rc_dialog (e, dialog) { const struct dialog_control *control; - if (dialog->style != 0) - fprintf (e, "STYLE 0x%lx\n", dialog->style); + fprintf (e, "STYLE 0x%lx\n", dialog->style); + if (dialog->exstyle != 0) fprintf (e, "EXSTYLE 0x%lx\n", dialog->exstyle); + if ((dialog->class.named && dialog->class.u.n.length > 0) || dialog->class.u.id != 0) { @@ -2063,12 +2064,14 @@ write_rc_dialog (e, dialog) res_id_print (e, dialog->class, 1); fprintf (e, "\n"); } + if (dialog->caption != NULL) { fprintf (e, "CAPTION \""); unicode_print (e, dialog->caption, -1); fprintf (e, "\"\n"); } + if ((dialog->menu.named && dialog->menu.u.n.length > 0) || dialog->menu.u.id != 0) { @@ -2076,6 +2079,7 @@ write_rc_dialog (e, dialog) res_id_print (e, dialog->menu, 0); fprintf (e, "\n"); } + if (dialog->font != NULL) { fprintf (e, "FONT %d, \"", dialog->pointsize); diff --git a/binutils/testsuite/binutils-all/windres/printstyle.rc b/binutils/testsuite/binutils-all/windres/printstyle.rc new file mode 100644 index 00000000000..0066c995eea --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/printstyle.rc @@ -0,0 +1,6 @@ +101 DIALOG DISCARDABLE 0, 0, 186, 95 +STYLE 0 +BEGIN + DEFPUSHBUTTON "OK",1,129,7,50,14 +END + diff --git a/binutils/testsuite/binutils-all/windres/printstyle.rsd b/binutils/testsuite/binutils-all/windres/printstyle.rsd new file mode 100644 index 00000000000..df203cb6c15 --- /dev/null +++ b/binutils/testsuite/binutils-all/windres/printstyle.rsd @@ -0,0 +1,8 @@ + 0000 00000000 20000000 ffff0000 ffff0000 .... ........... + 0010 00000000 00000000 00000000 00000000 ................ + 0020 36000000 20000000 ffff0500 ffff6500 6... .........e. + 0030 00000000 10100000 00000000 00000000 ................ + 0040 00000000 00000000 01000000 0000ba00 ................ + 0050 5f000000 00000000 01000150 00000000 _..........P.... + 0060 81000700 32000e00 0100ffff 80004f00 ....2.........O. + 0070 4b000000 00000000 K.......