Figure out more format details.
[pspp] / dump.c
diff --git a/dump.c b/dump.c
index 12ee73ebdf4d02d143776cb252eca089ac215a7e..205167951ca20dab22cf99d3b8143111d5d59abb 100644 (file)
--- a/dump.c
+++ b/dump.c
@@ -967,27 +967,34 @@ dump_fonts(void)
         printf(" underline=\"true\"");
 
       int halign = get_u32();
-      printf("\nhalign=%d\n", halign);
+      printf(" halign=%d", halign);
 
       int valign = get_u32();
-      printf("\nvalign=%d\n", valign);
+      printf(" valign=%d", valign);
 
       printf (" fgcolor=\"%s\"", get_string());
       printf (" bgcolor=\"%s\"", get_string());
 
       if (!match_byte(0))
         match_byte_assert(1);
-      match_u32_assert(0);
-      char *othercolor = get_string();
-      if (othercolor[0])
-        printf(" othercolor=\"%s\"", othercolor);
+
+      char *alt_fgcolor = get_string();
+      if (alt_fgcolor[0])
+        printf (" altfg=\"%s\"", alt_fgcolor);
+      char *alt_bgcolor = get_string();
+      if (alt_bgcolor[0])
+        printf (" altbg=\"%s\"", alt_bgcolor);
 
       if (version > 1)
         {
-          printf("\nfonts:");
+          printf(" margins=\"");
           for (int i = 0; i < 4; i++)
-            printf(" %2d", get_u32());
-          printf("\n");
+            {
+              if (i)
+                putchar(' ');
+              printf("%d", get_u32());
+            }
+          putchar('"');
         }
 
       printf ("/>\n");
@@ -1045,7 +1052,9 @@ dump_fonts(void)
       hex_dump(pos, nbytes);
       printf("\n");
       pos += nbytes;
-      get_string_be();
+      char *notes = get_string_be();
+      if (notes[0])
+        printf(" notes=\"%s\"", notes);
       char *look = get_string_be();
       if (look[0])
         printf(" look=\"%s\"", look);
@@ -1055,14 +1064,17 @@ dump_fonts(void)
 
   /* Manual column widths, if present. */
   int count = get_u32();
-  printf("<columnwidths>");
-  for (int i = 0; i < count; i++)
+  if (count > 0)
     {
-      if (i)
-        putchar(' ');
-      printf("%d", get_u32());
+      printf("<columnwidths>");
+      for (int i = 0; i < count; i++)
+        {
+          if (i)
+            putchar(' ');
+          printf("%d", get_u32());
+        }
+      printf("</columnwidths>\n");
     }
-  printf("</columnwidths>\n");
 
   const char *locale = get_string();
   printf ("<locale>%s</locale>\n", locale);
@@ -1323,55 +1335,19 @@ main(int argc, char *argv[])
         match_u32_assert(3);
 
       match_byte_assert(1);
-      if (!match_byte(0))
-        match_byte_assert(1);
-
-      /* Offset 8. */
-      match_byte_assert(0);
-      if (!match_byte(0))
-        match_byte_assert(1);
-      if (!match_byte(0))
-        match_byte_assert(1);
-
-      /* Offset 11. */
-      pos++;
-      match_byte_assert(0);
-      match_byte_assert(0);
-      match_byte_assert(0);
-
-      /* Offset 15. */
-      pos++;
-      if (!match_byte(0))
-        match_byte_assert(1);
-      match_byte_assert(0);
-      match_byte_assert(0);
-
-      /* Offset 19. */
-      pos++;
-      if (!match_byte(0))
-        match_byte_assert(1);
-      match_byte_assert(0);
-      match_byte_assert(0);
-
-      /* Offset 23. */
-      pos++;
-      if (!match_byte(0))
-        match_byte_assert(1);
-      match_byte_assert(0);
-      match_byte_assert(0);
-
-      /* Offset 27. */
-#if 1
-      pos++;
-      pos++;
-      pos++;
-      pos++;
-#else
-      printf("\nheader:");
       for (int i = 0; i < 4; i++)
-        printf(" %02x", data[pos++]);
-      printf("\n");
-#endif
+        if (!match_byte(0))
+          match_byte_assert(1);
+      get_u32();
+
+      int min_col_width = get_u32();
+      int max_col_width = get_u32();
+      int min_row_width = get_u32();
+      int max_row_width = get_u32();
+      printf("<label-width min-col=\"%d\" max-col=\"%d\" min-row=\"%d\" "
+             "max-row=\"%d\"/>\n",
+             min_col_width, max_col_width,
+             min_row_width, max_row_width);
 
       /* Offset 31. */
       printf("<tableid>%lld</tableid>", get_u64());