From: Ben Pfaff Date: Fri, 7 Nov 2014 03:12:46 +0000 (-0800) Subject: Generalize more special cases in dump_title_value(). X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?p=pspp;a=commitdiff_plain;h=fa35985d301d7cb26a0a33e6372705fab2795778 Generalize more special cases in dump_title_value(). --- diff --git a/dump.c b/dump.c index e6d2369a80..cb80dd9295 100644 --- a/dump.c +++ b/dump.c @@ -1007,6 +1007,53 @@ dump_data(void) } } +static void +dump_title_value_31(int level) +{ + if (match_byte (0x31)) + { + if (match_u32 (1)) + { + printf("(footnote %d) ", get_u32()); + match_byte_assert (0); + match_byte_assert (0); + int subn = get_u32 (); + printf ("nested %d bytes", subn); + pos += subn; + } + else if (match_u32 (2)) + { + printf("(special 2)"); + match_byte_assert(0); + match_byte_assert(0); + if (!match_u32(2)) + match_u32_assert(1); + match_byte_assert(0); + match_byte_assert(0); + int subn = get_u32 (); + printf ("nested %d bytes", subn); + pos += subn; + } + else + { + match_u32_assert(3); + printf("(special 3)"); + match_byte_assert(0); + match_byte_assert(0); + match_byte_assert(1); + match_byte_assert(0); + int subn = get_u32 (); + printf ("nested %d bytes, ", subn); + pos += subn; + subn = get_u32 (); + printf ("nested %d bytes, ", subn); + pos += subn; + } + } + else + match_byte_assert (0x58); +} + static void dump_title_value(int level) { @@ -1021,48 +1068,7 @@ dump_title_value(int level) if (match_byte (3)) { get_string(); - if (match_byte (0x31)) - { - if (match_u32 (1)) - { - printf("(footnote %d) ", get_u32()); - match_byte_assert (0); - match_byte_assert (0); - int subn = get_u32 (); - printf ("nested %d bytes", subn); - pos += subn; - } - else if (match_u32 (2)) - { - printf("(special 2)"); - match_byte_assert(0); - match_byte_assert(0); - if (!match_u32(2)) - match_u32_assert(1); - match_byte_assert(0); - match_byte_assert(0); - int subn = get_u32 (); - printf ("nested %d bytes", subn); - pos += subn; - } - else - { - match_u32_assert(3); - printf("(special 3)"); - match_byte_assert(0); - match_byte_assert(0); - match_byte_assert(1); - match_byte_assert(0); - int subn = get_u32 (); - printf ("nested %d bytes, ", subn); - pos += subn; - subn = get_u32 (); - printf ("nested %d bytes, ", subn); - pos += subn; - } - } - else - match_byte_assert (0x58); + dump_title_value_31(level); get_string(); printf("string \"%s\"", get_string()); match_byte (0); @@ -1077,20 +1083,7 @@ dump_title_value(int level) } else if (match_byte (5)) { - if (match_byte (0x31)) - { - if (match_u32 (1)) - { - printf("(footnote %d) ", get_u32()); - match_byte_assert (0); - match_byte_assert (0); - int subn = get_u32 (); - printf ("nested %d bytes", subn); - pos += subn; - } - } - else - match_byte_assert (0x58); + dump_title_value_31(level); printf ("variable \"%s\"", get_string()); get_string(); if (!match_byte(1) && !match_byte(2))