Don't add default dialog style when explicit style specified.
authorNick Clifton <nickc@redhat.com>
Tue, 9 Apr 2002 15:59:13 +0000 (15:59 +0000)
committerNick Clifton <nickc@redhat.com>
Tue, 9 Apr 2002 15:59:13 +0000 (15:59 +0000)
Print style even if it is 0.
Add testcase.

binutils/ChangeLog
binutils/rcparse.y
binutils/resrc.c
binutils/testsuite/binutils-all/windres/printstyle.rc [new file with mode: 0644]
binutils/testsuite/binutils-all/windres/printstyle.rsd [new file with mode: 0644]

index 299621d..7414ba1 100644 (file)
@@ -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 <degnbol@danbbs.dk>
 
        * resrc.c: print CLASS names in quotes
index b141f4a..fcd34cc 100644 (file)
@@ -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)
index a576c80..a9b3ba8 100644 (file)
@@ -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 (file)
index 0000000..0066c99
--- /dev/null
@@ -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 (file)
index 0000000..df203cb
--- /dev/null
@@ -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.......