From 96a6dc9eaad991314ad7ff8618126a3f0e9b4e8b Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Thu, 6 Nov 2014 19:36:43 -0800 Subject: [PATCH] More generalizing dump_dim_value(). --- dump.c | 48 ++++++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/dump.c b/dump.c index f2eaa5aec1..230274f8af 100644 --- 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(); -- 2.30.2