X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=dump.c;h=96611d976e2da517fa48dbbbc3d2d46aa321dd9a;hb=f5abc4d9b95aed4e1ab2734eec9e40cccb0547d8;hp=745cff4c2e4315e41955472234b07daca14425b8;hpb=255c639b7258b7fbb2a0813aecac618a7b501cc2;p=pspp diff --git a/dump.c b/dump.c index 745cff4c2e..96611d976e 100644 --- a/dump.c +++ b/dump.c @@ -1013,6 +1013,7 @@ dump_title_value(int level) match_byte (0); match_byte (0); match_byte (0); + match_byte (0); if (match_byte (3)) { get_string(); @@ -1032,7 +1033,8 @@ dump_title_value(int level) printf("(special 2)"); match_byte_assert(0); match_byte_assert(0); - match_u32_assert(1); + if (!match_u32(2)) + match_u32_assert(1); match_byte_assert(0); match_byte_assert(0); int subn = get_u32 (); @@ -1071,15 +1073,24 @@ dump_title_value(int level) } else if (match_byte (5)) { - match_byte_assert (0x58); + 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); printf ("variable \"%s\"", get_string()); 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)) { @@ -1188,44 +1199,32 @@ dump_title_value(int level) char *base = get_string(); int x = get_u32(); printf ("\"%s\"; %d variables:\n", base, x); - if (match_u32(0)) - { - for (int i = 0; i < x; i++) - { - dump_title_value (level+1); - putchar('\n'); - } - } - else + for (int i = 0; i < x; i++) { - for (int i = 0; i < x; i++) + int y = get_u32(); + if (!y) + y = 1; + else + match_u32_assert(0); + for (int j = 0; j <= level; j++) + printf (" "); + printf("variable %d has %d values:\n", i, y); + for (int j = 0; j < y; j++) { - int y = get_u32(); - match_u32_assert(0); - for (int j = 0; j <= level; j++) - printf (" "); - printf("variable %d has %d values:\n", i, y); - for (int j = 0; j < y; j++) + if (match_byte(3)) { - if (match_byte(3)) - { - char *a = get_string(); - match_byte_assert(0x58); - char *b = get_string(); - char *c = get_string(); - 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); - } - else - dump_title_value (level+1); - putchar('\n'); + char *a = get_string(); + match_byte_assert(0x58); + char *b = get_string(); + char *c = get_string(); + for (int k = 0; k <= level + 1; k++) + printf (" "); + printf ("\"%s\", \"%s\", \"%s\"", a, b, c); + match_byte(0); } + else + dump_title_value (level+1); + putchar('\n'); } } } @@ -1269,13 +1268,18 @@ static void dump_title(void) { pos = 0x27; - dump_title_value(0); putchar('\n'); - dump_title_value(0); putchar('\n'); + dump_title_value(0); putchar('\n'); putchar('\n'); + dump_title_value(0); putchar('\n'); putchar('\n'); match_byte_assert(0x31); - dump_title_value(0); putchar('\n'); + dump_title_value(0); putchar('\n'); putchar('\n'); + match_byte(0); match_byte_assert(0x58); - match_byte_assert(0x31); - dump_title_value(0); putchar('\n'); + if (match_byte(0x31)) + { + dump_title_value(0); putchar('\n'); + } + else + match_byte_assert(0x58); } int