Successfully interpret data in most files whose data begin with 0 1 1 0 1.
authorBen Pfaff <blp@cs.stanford.edu>
Sun, 2 Nov 2014 00:01:09 +0000 (17:01 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Sun, 2 Nov 2014 00:01:09 +0000 (17:01 -0700)
dump.c
notes

diff --git a/dump.c b/dump.c
index 28c0ca3bbc08c9068c08f1aaf6cace5320598cb8..7dd86feb89b0a88061ea0e7f3b8106c7736e691c 100644 (file)
--- a/dump.c
+++ b/dump.c
@@ -271,7 +271,20 @@ dump_value(int level)
       unsigned int format;
       double value;
 
-      match_byte_assert (0x58);
+      if (match_byte (0x31))
+        {
+          if (match_u32 (1))
+            {
+              printf("(footnote %d) ", get_u32());
+              match_byte_assert (0);
+              match_byte_assert (0);
+              int subn = get_u32 ();
+              printf ("nested %d bytes", subn);
+              pos += subn;
+            }
+        }
+      else
+        match_byte_assert (0x58);
       format = get_u32 ();
       value = get_double ();
       printf ("value %g format %d(%d.%d)", value, format >> 16, (format >> 8) & 0xff, format & 0xff);
@@ -641,6 +654,103 @@ dump_dims(void)
     }
 }
 
+static void
+dump_data(void)
+{
+  if (!match_u32 (0) || !match_u32 (1) || !match_u32(1) || !match_u32(0) || !match_u32(1))
+    {
+      printf ("skipping data\n");
+      return;
+    }
+#if 0
+  fprintf (stderr,"data intro:");
+  for (int i = 0; i < 5; i++)
+    fprintf (stderr," %d", get_u32());
+  fprintf(stderr,"\n");
+#endif
+  int x = get_u32();
+  printf ("%d data values, starting at %08x\n", x, pos);
+  for (int i = 0; i < x; i++)
+    {
+      printf("%08x, index %d:\n", pos, get_u32());
+      match_u32_assert(0);
+      if (match_byte (1))
+        {
+          unsigned int format;
+          double value;
+
+          if (match_byte (0x31))
+            {
+              if (match_u32 (1))
+                {
+                  printf("(footnote %d) ", get_u32());
+                  match_byte_assert (0);
+                  match_byte_assert (0);
+                  int subn = get_u32 ();
+                  printf ("nested %d bytes", subn);
+                  pos += subn;
+                }
+            }
+          else
+            match_byte_assert (0x58);
+          format = get_u32 ();
+          value = get_double ();
+          printf ("    value %g format %d(%d.%d)", value, format >> 16, (format >> 8) & 0xff, format & 0xff);
+        }
+      else if (match_byte (3))
+        {
+          get_string();
+          if (match_byte (0x31))
+            {
+              if (match_u32 (1))
+                {
+                  printf("(footnote %d) ", get_u32());
+                  match_byte_assert (0);
+                  match_byte_assert (0);
+                  int subn = get_u32 ();
+                  printf ("nested %d bytes", subn);
+                  pos += subn;
+                }
+              else if (match_u32 (2))
+                {
+                  printf("(special 2)");
+                  match_byte_assert(0);
+                  match_byte_assert(0);
+                  match_u32_assert(1);
+                  match_byte_assert(0);
+                  match_byte_assert(0);
+                  int subn = get_u32 ();
+                  printf ("nested %d bytes", subn);
+                  pos += subn;
+                }
+              else
+                {
+                  match_u32_assert(3);
+                  printf("(special 3)");
+                  match_byte_assert(0);
+                  match_byte_assert(0);
+                  match_byte_assert(1);
+                  match_byte_assert(0);
+                  int subn = get_u32 ();
+                  printf ("nested %d bytes, ", subn);
+                  pos += subn;
+                  subn = get_u32 ();
+                  printf ("nested %d bytes, ", subn);
+                  pos += subn;
+                }
+            }
+          else
+            match_byte_assert (0x58);
+          get_string();
+          printf("string \"%s\"", get_string());
+          match_byte (0);
+        }
+      else
+        dump_value(0);
+      putchar('\n');
+    }
+}
+
 int
 main(int argc, char *argv[])
 {
@@ -717,7 +827,8 @@ main(int argc, char *argv[])
 
           pos = start;
           dump_dims ();
-          return 0;
+          dump_data ();
+          start = pos;
         }
       else
         {
diff --git a/notes b/notes
index 44336aad9c22e3a499cddae5d9dd7bfd7ab84ad9..fa512602848e7c198f1767f420b18bed218db818 100644 (file)
--- a/notes
+++ b/notes
@@ -1398,6 +1398,42 @@ web/bf0de88830dd9a93323cfb8d7501f342/00000000075_lightTableData.bin (Default Mul
        03 "Sig." 58 "significance_level" "Significance" i1 i2 i4 00 00 00 00 00 00 00 00
 
 
+Data
+----
+
+williams/00000000053_lightTableData.bin:
+
+    i0 i1 i1 i0 i1 i4
+
+    i0 i0 01 31 i1 i0 00 00 i11: (i5: ("" 58) 58 58) F40.3(0.760)
+    i1 i0 01 58 F40.3(0.578)
+    i2 i0 01 58 F40.3(0.573)
+    i3 i0 01 58 F40.3(0.666)
+
+germano/Crosstabs/00000000014_lightTableData.bin:
+
+    00 00 00 00 00 00 00 00 i2 i1 i2 00 00 00 00 i1 432
+    i0 i0 03 
+    "<5                                       " i49 00 i1 
+    "a" i11 i5 00 00 00 00 58 58 58 00 00 00 00 
+    "<5                                       " 00 i96 00 00 00 00 03 
+    "<5                                       " i49 00 i1 
+    "a" i11 i5 00 00 00 00 58 58 58 00 00 00 00 
+    "<5                                       " 00 i192 00 00 00 00 03 
+    "<5                                       " i49 00 i1 
+    "a" i11 i5 00 00 00 00 58 58 58 00 00 00 00 
+    "<5                                       " 00 20 i1 00 00 00 03 
+    "<5                                       " i49 00 i1 
+
+web/c6b0660f7afccdb067f766a44ded21ab/00000000038_lightTableData.bin (Rotated Factor Matrix):
+
+    i315 i0 03 " " 58 "" "" 00
+    i1 i0 03 " " 58 "" "" 00
+    i6 i0 03 
+    " " 58 00 00 00 00 
+    " " 00 i11 00 00 00 00 03 
+    " " 58 00 00 00 00 
+
 Data: tdump21 (germano/Crosstabs.pdf)
 -------------