X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=dump-spo2.c;h=06b3902e3efd22cea75daf343f9906c14892100d;hb=53fb600bd20576419781bbca4c3d3c6be420a599;hp=f416bf696210382b4abb676d5f27893b58309265;hpb=d30e5471341fc071b9636162dad5ddb97ae2b96f;p=pspp diff --git a/dump-spo2.c b/dump-spo2.c index f416bf6962..06b3902e3e 100644 --- a/dump-spo2.c +++ b/dump-spo2.c @@ -307,7 +307,8 @@ get_string4(const char *where) /*data[pos + 1] == 0 && data[pos + 2] == 0 && data[pos + 3] == 0*/ /*&& all_ascii(&data[pos + 4], data[pos])*/) { - int len = data[pos] + data[pos + 1] * 256; + assert(data[pos + 3] == 0); + int len = data[pos] + data[pos + 1] * 256 + data[pos + 2] * 65536; char *s = malloc(len + 1); memcpy(s, &data[pos + 4], len); @@ -501,16 +502,22 @@ put_safe(const char *s) static void parse_DspString(void) { - match_byte_assert(1); - match_byte_assert(2); - match_byte_assert(40); - if (!match_byte(0)) - match_byte_assert(5); - match_byte_assert(0); - match_byte_assert(1); - printf ("DspString(\""); - put_safe(get_string1()); - printf("\")\n"); + if (match_byte(2)) + { + printf("DspString(%f, \"", get_double()); + printf("%s\")\n", get_string1()); + } + else + { + match_byte_assert(1); + printf ("DspString("); + parse_format(); + printf(" \""); + match_byte_assert(0); + match_byte_assert(1); + put_safe(get_string1()); + printf("\")\n"); + } } static void @@ -647,8 +654,32 @@ parse_flexible(void) match_DspCell(); else if (data[pos] == 0x5 && data[pos + 1] == 0x80) match_DspString(); + else if ((data[pos] == 0x3c || data[pos] == 0x39) + && data[pos + 1] == 0x80) + { + /* 3c 80 */ + /* 39 80 */ + pos += 2; + parse_format(); +/* match_byte_assert(0x01); + match_byte_assert(0x02); + match_byte_assert(0x0d); */ + } + else if (data[pos] == 0x15 && data[pos + 1] == 0x80) + { + /* 15 80 */ + data += 2; + match_byte_assert(2); + printf ("15 80(%f", get_double()); + printf (" %s)\n", get_string1()); + } else - assert(0); + { + fprintf (stderr, "bad data cell 0x%02x at offset %x\n", + data[pos], pos); + hex_dump (stderr, pos, 64); + assert(0); + } } int @@ -763,6 +794,7 @@ main(int argc, char *argv[]) match_u32_assert(132); match_zeros_assert(8); match_u32_assert(1); + printf ("0x%x\n", pos); get_string4(); match_byte_assert(0);