lots more acceptable files
authorBen Pfaff <blp@cs.stanford.edu>
Sat, 27 Jun 2020 20:14:18 +0000 (20:14 +0000)
committerBen Pfaff <blp@cs.stanford.edu>
Sat, 27 Jun 2020 20:14:18 +0000 (20:14 +0000)
dump-float.c
dump-spo2.c

index 21aa391d068cc319a863100348a0b01f9cf53782..4f41280f002ff021c7dc587a15bf2d20703cf7a5 100644 (file)
@@ -21,7 +21,7 @@ print_float (const uint8_t *b)
 int
 main (void)
 {
-  uint8_t b[] = { 0x1f, 0x05, 0, 0, 0xa2, 3, 0, 0, 0x64, 0, 0, 0 };
+  uint8_t b[] = { 0, 0, 0, 0, 0, 0x49, 0xd2, 0x40 };
   int n = sizeof b;
   for (int i = 0; i <= n - 8; i++)
     print_double (b + i);
index f416bf696210382b4abb676d5f27893b58309265..847dcac45c96ebb568ad515d3429edce9f2c018d 100644 (file)
@@ -501,16 +501,22 @@ put_safe(const char *s)
 static void
 parse_DspString(void)
 {
-  match_byte_assert(1);
-  match_byte_assert(2);
-  match_byte_assert(40);
-  if (!match_byte(0))
-    match_byte_assert(5);
-  match_byte_assert(0);
-  match_byte_assert(1);
-  printf ("DspString(\"");
-  put_safe(get_string1());
-  printf("\")\n");
+  if (match_byte(2))
+    {
+      printf("DspString(%f, \"", get_double());
+      printf("%s\")\n", get_string1());
+    }
+  else
+    {
+      match_byte_assert(1);
+      printf ("DspString(");
+      parse_format();
+      printf(" \"");
+      match_byte_assert(0);
+      match_byte_assert(1);
+      put_safe(get_string1());
+      printf("\")\n");
+    }
 }
 
 static void
@@ -647,8 +653,32 @@ parse_flexible(void)
     match_DspCell();
   else if (data[pos] == 0x5 && data[pos + 1] == 0x80)
     match_DspString();
+  else if ((data[pos] == 0x3c || data[pos] == 0x39)
+            && data[pos + 1] == 0x80)
+    {
+      /* 3c 80 */
+      /* 39 80 */
+      pos += 2;
+      parse_format();
+/*      match_byte_assert(0x01);
+      match_byte_assert(0x02);
+      match_byte_assert(0x0d); */
+    }
+  else if (data[pos] == 0x15 && data[pos + 1] == 0x80)
+    {
+      /* 15 80 */
+      data += 2;
+      match_byte_assert(2);
+      printf ("15 80(%f", get_double());
+      printf (" %s)\n", get_string1());
+    }
   else
-    assert(0);
+    {
+      fprintf (stderr, "bad data cell 0x%02x at offset %x\n",
+               data[pos], pos);
+      hex_dump (stderr, pos, 64);
+      assert(0);
+    }
 }
 
 int