progress?
authorBen Pfaff <blp@cs.stanford.edu>
Sun, 28 Jun 2020 06:29:42 +0000 (06:29 +0000)
committerBen Pfaff <blp@cs.stanford.edu>
Sun, 28 Jun 2020 06:29:42 +0000 (06:29 +0000)
dump-spo2.c

index 58dbf0539ddb370535ca1c3af431cecde0099cee..93606cd9b9a1f465ff4a8e41ff677409a75718f2 100644 (file)
@@ -125,7 +125,8 @@ match_u16_assert(uint16_t x, const char *where)
   unsigned int y = get_u16();
   if (x != y)
     {
-      fprintf(stderr, "%s: 0x%x: expected u16:%u, got u16:%u\n", where, pos - 2, x, y);
+      fprintf(stderr, "%s: 0x%x: expected u16:%u, got u16:%u: ", where, pos - 2, x, y);
+      hex_dump(stderr, pos - 2, 64);
       exit(1);
     }
 }
@@ -870,6 +871,12 @@ parse_flexible(void)
         match_byte_assert(3);
       else if (!strcmp(heading, "NDimensional__DspCell"))
         parse_NDimensional__DspCell();
+      else if (!strcmp(heading, "PMPivotItemTree"))
+        match_byte_assert(0);
+      else if (!strcmp(heading, "PMModelItemInfo"))
+        parse_PMModelItemInfo();
+      else if (!strcmp(heading, "AbstractTreeBranch"))
+        match_byte_assert(0);
       else
         {
           fprintf(stderr, "don't know %s at offset 0x%x: ", heading, start);
@@ -908,9 +915,29 @@ parse_flexible(void)
             {
               printf ("15 80(%f", get_double());
               printf (" %s)\n", get_string1());
+              if (match_byte(1))
+                {
+                  match_byte_assert(0);
+                  get_string1();
+                  if (!match_byte(2) && !match_byte(3))
+                    match_byte_assert(0);
+                  match_zeros_assert(3);
+                  get_string1();
+                  match_byte_assert(0);
+                  match_byte_assert(1);
+                  match_zeros_assert(3);
+                  match_byte_assert(1);
+                  match_byte_assert(0);
+                }
             }
           else
-            match_zeros_assert(14);
+            {
+              match_byte_assert(0);
+              if (match_u32(0xc))
+                match_u16_assert(1);
+              else
+                match_zeros_assert(13);
+            }
         }
       else if (data[pos] == 0x9 && data[pos + 1] == 0x80)
         {
@@ -921,25 +948,155 @@ parse_flexible(void)
       else if (data[pos] == 0x11 || data[pos] == 0x13)
         {
           pos += 2;
-          match_zeros_assert(14);
+          match_byte_assert(0);
+          if (match_u32(0xc) || match_u32(0xd))
+            match_u16_assert(1);
+          else
+            match_zeros_assert(13);
+        }
+      else if (data[pos] == 0x29 ||
+               data[pos] == 0x2b ||
+               data[pos] == 0x2d ||
+               data[pos] == 0x31 ||
+               data[pos] == 0x32 ||
+               data[pos] == 0x4a ||
+               data[pos] == 0x4c ||
+               data[pos] == 0x4f ||
+               data[pos] == 0x4d ||
+               data[pos] == 0x50 ||
+               data[pos] == 0x36 ||
+               data[pos] == 0x52 ||
+               data[pos] == 0x53 ||
+               data[pos] == 0x54 ||
+               data[pos] == 0x55 ||
+               data[pos] == 0x57 ||
+               data[pos] == 0x56 ||
+               data[pos] == 0x58 ||
+               data[pos] == 0x5c ||
+               data[pos] == 0x5b ||
+               data[pos] == 0x5e ||
+               data[pos] == 0x62 ||
+               data[pos] == 0x64 ||
+               data[pos] == 0x4e ||
+               data[pos] == 0x51 ||
+               data[pos] == 0x59 ||
+               data[pos] == 0x5a ||
+               data[pos] == 0x5d ||
+               data[pos] == 0x66 ||
+               data[pos] == 0x60 ||
+               data[pos] == 0x68 ||
+               data[pos] == 0x48 ||
+               data[pos] == 0x6a ||
+               data[pos] == 0x37)
+        {
+          pos += 2;
+          match_byte_assert(0);
+        }
+      else if (data[pos] == 0x2c ||
+               data[pos] == 0x2e ||
+               data[pos] == 0x30 ||
+               data[pos] == 0x34 ||
+               data[pos] == 0x3d ||
+               data[pos] == 0x40 ||
+               data[pos] == 0x3f ||
+               data[pos] == 0x42 ||
+               data[pos] == 0x43 ||
+               data[pos] == 0x44 ||
+               data[pos] == 0x49 ||
+               data[pos] == 0x3e ||
+               data[pos] == 0x46)
+        {
+          pos += 2;
+          parse_format();
         }
       else
         {
+#if 0
           fprintf (stderr, "bad record 0x%02x at offset %x: ",
                    data[pos], pos);
+#endif
           hex_dump (stderr, pos, 64);
           assert(0);
         }
     }
   else if (match_byte(0xa)) 
     {
-      match_zeros_assert(5);
-      assert(pos == n);
-      exit (0);
+      match_byte_assert(0);
+      if (match_u16(0x0e74))
+        match_byte_assert(0);
+      else
+        {
+          match_zeros_assert(4);
+          assert(pos == n);
+          exit (0);
+        }
+    }
+  else if (match_byte(1))
+    {
+      match_byte_assert(0);
+      get_string1();
+      if (!match_byte(2))
+        match_byte_assert(0);
+      match_zeros_assert(3);
+      get_string1();
+      if (match_byte(0x08))
+        {
+          match_byte_assert(0);
+          match_u16_assert(0x0e74);
+          match_byte_assert(0);
+        }
+      else if (match_byte(3))
+        {
+          match_byte_assert(0);
+          if (match_u16(0x0e74))
+            match_byte_assert(0);
+          else
+            {
+              match_zeros_assert(6);
+              if (!match_byte(0xe) && !match_byte(0x11))
+                match_byte_assert(0);
+              match_byte_assert(0);
+              if (!match_u16(0x0e74))
+                match_u16_assert(0);
+              match_byte_assert(0);
+            }
+        }
+      else
+        {
+          match_byte_assert(0);
+          match_byte_assert(1);
+          match_zeros_assert(3);
+          match_byte_assert(1);
+          match_byte_assert(0);
+        }
+    }
+  else if (match_byte(7) || match_byte(4) || match_byte(5) || match_byte(6) || match_byte(8) || match_byte(9) || match_byte(0xb) || match_byte(0xc))
+    {
+      match_byte_assert(0);
+      if (!match_u16(0x0e74))
+        match_byte_assert(0);
+      match_byte_assert(0);
+    }
+  else if (match_byte(2) || match_byte(3))
+    {
+      match_byte_assert(0);
+      if (!match_u16(0x0e74))
+        {
+          match_zeros_assert(6);
+          if (match_byte(0))
+            match_zeros_assert(4);
+          else
+            {
+              pos++;
+              match_byte(0);
+              match_u16_assert(0x0e74);
+            }
+        }
+      //match_byte_assert(0);
     }
   else
     {
-      fprintf (stderr, "bad record start at offset %x: ", pos);
+      //fprintf (stderr, "bad record start at offset %x: ", pos);
       hex_dump (stderr, pos, 64);
       assert(0);
     }
@@ -1075,23 +1232,13 @@ main(int argc, char *argv[])
     exit(0);
   parse_heading("NavLog");
   parse_NavLog();
-  parse_flexible();
-  parse_flexible();
-  parse_flexible();
-  parse_flexible();
-  parse_flexible();
-  parse_flexible();
-  parse_flexible();
-  parse_flexible();
-  parse_flexible();
-  parse_flexible();
-  parse_flexible();
-  parse_flexible();
-  parse_flexible();
-  parse_flexible();
-  parse_flexible();
-  parse_flexible();
-  parse_flexible();
+  for (;;)
+    {
+      if (data[pos] == 0)
+        pos++;
+      else
+        parse_flexible();
+    }
   exit(0);
   puts(get_padded_string(32));
   if (!match_u32(80))