All pass (dimensions, data, title, footnotes!).
[pspp] / dump.c
diff --git a/dump.c b/dump.c
index cd4d362121f82bec29c9d7a706b64a1a632cccb6..310b6a15f596b70fe8395d09d05118a164825c25 100644 (file)
--- a/dump.c
+++ b/dump.c
@@ -1246,6 +1246,7 @@ dump_title_value(int level)
           printf("variable %d has %d values:\n", i, y);
           for (int j = 0; j < y; j++)
             {
+              match_byte(0);
               if (match_byte(3))
                 {
                   char *a = get_string();
@@ -1320,15 +1321,8 @@ dump_footnote_value(int level)
         match_byte_assert (0x58);
       get_string();
       printf("string \"%s\"", get_string());
-      match_byte (0);
-      match_byte (0);
-      match_byte (0);
-      match_byte (1);
-      match_byte (1);
-      match_byte (0);
-      match_byte (0);
-      match_byte (0);
-      match_byte (1);
+      if (!match_byte (0))
+        match_byte_assert (1);
     }
   else if (match_byte (5))
     {
@@ -1337,10 +1331,6 @@ dump_footnote_value(int level)
       get_string();
       if (!match_byte(1) && !match_byte(2))
         match_byte_assert(3);
-      match_byte (0);
-      match_byte (0);
-      match_byte (0);
-      match_byte (0);
     }
   else if (match_byte (2))
     {
@@ -1450,11 +1440,8 @@ dump_footnote_value(int level)
                   for (int k = 0; k <= level + 1; k++)
                     printf ("    ");
                   printf ("\"%s\", \"%s\", \"%s\"", a, b, c);
-                  match_byte(0);
-                  match_byte(0);
-                  match_byte(0);
-                  match_byte(0);
-                  match_byte(0);
+                  if (!match_byte(1))
+                    match_byte_assert(0);
                 }
               else
                 dump_footnote_value (level+1);
@@ -1490,11 +1477,7 @@ dump_footnote_value(int level)
                   for (int k = 0; k <= level + 1; k++)
                     printf ("    ");
                   printf ("\"%s\", \"%s\", \"%s\"", a, b, c);
-                  match_byte(0);
-                  match_byte(0);
-                  match_byte(0);
-                  match_byte(0);
-                  match_byte(0);
+                  match_byte_assert(0);
                 }
               else
                 dump_footnote_value (level+1);
@@ -1516,7 +1499,7 @@ dump_title(void)
   match_byte_assert(0x58);
   if (match_byte(0x31))
     {
-      dump_title_value(0); putchar('\n');
+      dump_footnote_value(0); putchar('\n');
     }
   else
     match_byte_assert(0x58);
@@ -1524,7 +1507,11 @@ dump_title(void)
 
   int n_footnotes = get_u32();
   if (n_footnotes >= 20)
-    fprintf(stderr, "%d footnotes\n", n_footnotes);
+    {
+      fprintf(stderr, "%08x: %d footnotes\n", pos - 4, n_footnotes);
+      exit(1);
+    }
+
   printf("------\n%d footnotes\n", n_footnotes);
   if (n_footnotes < 20)
     {