More generalizing dump_dim_value().
authorBen Pfaff <blp@cs.stanford.edu>
Fri, 7 Nov 2014 03:36:43 +0000 (19:36 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Fri, 7 Nov 2014 03:36:43 +0000 (19:36 -0800)
dump.c

diff --git a/dump.c b/dump.c
index f2eaa5aec1082a94d904657ff8ebfa1b984cb46d..230274f8af12c289d22009d1375139f7ec7756c8 100644 (file)
--- a/dump.c
+++ b/dump.c
@@ -349,17 +349,19 @@ dump_value(int level)
 }
 
 static void
-dump_dim_value(int level)
+dump_dim_value_31(void)
 {
-  for (int i = 0; i <= level; i++)
-    printf ("    ");
-
-  if (match_byte (3))
+  if (match_byte (0x31))
     {
-      get_string();
-      if (match_byte (0x31))
+      if (match_u32 (0))
+        {
+          match_u32_assert (0);
+          int subn = get_u32 ();
+          printf ("nested %d bytes", subn);
+          pos += subn;
+        }
+      else if (match_u32 (1)) 
         {
-          match_u32 (1);
           printf("(footnote %d) ", get_u32());
           match_byte_assert (0);
           match_byte_assert (0);
@@ -367,8 +369,21 @@ dump_dim_value(int level)
           printf ("nested %d bytes", subn);
           pos += subn;
         }
-      else
-        match_byte_assert (0x58);
+    }
+  else
+    match_byte_assert (0x58);
+}
+
+static void
+dump_dim_value(int level)
+{
+  for (int i = 0; i <= level; i++)
+    printf ("    ");
+
+  if (match_byte (3))
+    {
+      get_string();
+      dump_dim_value_31();
       get_string();
       printf("string \"%s\"", get_string());
       match_byte (0);
@@ -416,19 +431,8 @@ dump_dim_value(int level)
     }
   else
     {
-      int subn;
-
       match_byte (0);
-      if (match_byte (0x31))
-        {
-          match_u32_assert (0);
-          match_u32_assert (0);
-          subn = get_u32 ();
-          printf ("nested %d bytes", subn);
-          pos += subn;
-        }
-      else
-        match_byte_assert(0x58);
+      dump_dim_value_31();
       printf ("; \"%s\", substitutions:", get_string());
       int total_subs = get_u32();
       int x = get_u32();