From: Ben Pfaff Date: Fri, 7 Nov 2014 03:36:43 +0000 (-0800) Subject: More generalizing dump_dim_value(). X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=96a6dc9eaad991314ad7ff8618126a3f0e9b4e8b;p=pspp More generalizing dump_dim_value(). --- 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();