Figure out more format details.
authorBen Pfaff <blp@cs.stanford.edu>
Mon, 29 May 2017 05:03:47 +0000 (22:03 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Mon, 29 May 2017 05:03:47 +0000 (22:03 -0700)
dump.c
spv-file-format.texi

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());
index 6c690920ce504d3c649e1fd8067bf0963dbe9716..50a94141b924452dc0ee9bd255d6c4d2acdc6d35 100644 (file)
@@ -609,7 +609,7 @@ Header @result{}
     (i1 @math{|} i3)[@t{version}]
     01 bool*4 int
     int[@t{min-column-width}] int[@t{max-column-width}]
-    int[@t{min-row-height}] int[@t{max-row-height}]
+    int[@t{min-row-width}] int[@t{max-row-width}]
     int64[@t{table-id}]
 @end format
 @end cartouche
@@ -624,6 +624,13 @@ the structure member that refers to the detail member.  For example,
 if @code{tableId} is @code{-4122591256483201023}, then @code{table-id}
 would be 0xc6c99d183b300001.
 
+@code{min-column-width} is the minimum width that a column will be
+assigned automatically.  @code{max-column-width} is the maximum width
+that a column will be assigned to accommodate a long column label.
+@code{min-row-width} and @code{max-row-width} are a similar range for
+the width of row labels.  All of these measurements are in 1/96 inch
+units.
+
 The meaning of the other variable parts of the header is not known.
 
 @node SPV Light Member Title
@@ -727,6 +734,9 @@ background color, respectively.  In the corpus, these are always
 should be the same color.  When @code{alternate} is 01, @code{altfg}
 and @code{altbg} specify the colors for the alternate rows.
 
+@code{left-margin}, @code{right-margin}, @code{top-margin}, and
+@code{bottom-margin} are measured in multiples of 1/96 inch.
+
 @node SPV Light Member Borders
 @subsection Borders
 
@@ -803,7 +813,7 @@ opaque color, therefore opaque black is 0xff000000.
 @format
 PrintSettings @result{}
     b1[@t{endian}]
-    bool[@t{layers}]
+    bool[@t{all-layers}]
     bool[@t{paginate-layers}]
     bool[@t{fit-width}]
     bool[@t{fit-length}]
@@ -817,11 +827,12 @@ PrintSettings @result{}
 The PrintSettings reflect settings for printing.  The fixed value of
 @code{endian} can be used to validate the endianness.
 
-@code{layers} is 1 to print all layers, 0 to print only the visible
-layers.
+@code{all-layers} is 1 to print all layers, 0 to print only the
+visible layers.
 
 @code{paginate-layers} is 1 to print each layer at the start of a new
-page, 0 otherwise.
+page, 0 otherwise.  (This setting is honored only @code{all-layers} is
+1, since otherwise only one layer is printed.)
 
 @code{fit-width} and @code{fit-length} control whether the table is
 shrunk to fit within a page's width or length, respectively.
@@ -850,7 +861,7 @@ TableSettings @result{}
     v3(
       byte
       be32[@t{n}] byte*[@t{n}]
-      bestring
+      bestring[@t{notes}]
       bestring[@t{table-look}]
       00...
     )
@@ -875,6 +886,10 @@ shown as numbers starting from 1.
 When @code{footnote-marker-position} is 1, footnote markers are shown
 as superscripts, otherwise as subscripts.
 
+@code{notes} is a text string that contains user-specified notes.  It
+is displayed when the user hovers the cursor over the table, like
+``alt text'' on a webpage.  It is not printed.  It is usually empty.
+
 @code{table-look} is the name of a SPSS ``TableLook'' table style,
 such as ``Default'' or ``Academic''; it is often empty.
 
@@ -1249,7 +1264,7 @@ ValueMod @result{}
     v3(count(FormatString Style ValueModUnknown))
   @math{|} 31 int[@t{n-refs}] int16*[@t{n-refs}] Format
   @math{|} 58
-Style @result{} 58 @math{|} 31 01? 00? 00? 00? 01 string[@t{fgcolor}] string[@t{bgcolor}] string[@t{typeface}] byte
+Style @result{} 58 @math{|} 31 01? 00? 00? 00? 01 string[@t{fgcolor}] string[@t{bgcolor}] string[@t{typeface}] byte[@t{size}]
 Format @result{} 00 00 count(FormatString Style 58)
 FormatString @result{} count((i0 (58 @math{|} 31 string))?)
 ValueModUnknown @result{} 58 @math{|} 31 i0 i0 i0 i0 01 00 (01 @math{|} 02 @math{|} 08) 00 08 00 0a 00)
@@ -1273,6 +1288,7 @@ version of the localized format string in the Value in which the
 Format is nested.
 
 The Style, if present, changes the style for this individual Value.
+The @code{size} is a font size in units of 1/96 inch.
 
 @node SPV Legacy Detail Member Binary Format
 @section Legacy Detail Member Binary Format