From 96c7d3dc94c2e3f2d587e42382b541c5ec70ec9a Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Sat, 27 Jun 2020 20:14:18 +0000 Subject: [PATCH] lots more acceptable files --- dump-float.c | 2 +- dump-spo2.c | 52 +++++++++++++++++++++++++++++++++++++++++----------- 2 files changed, 42 insertions(+), 12 deletions(-) diff --git a/dump-float.c b/dump-float.c index 21aa391d06..4f41280f00 100644 --- a/dump-float.c +++ b/dump-float.c @@ -21,7 +21,7 @@ print_float (const uint8_t *b) int main (void) { - uint8_t b[] = { 0x1f, 0x05, 0, 0, 0xa2, 3, 0, 0, 0x64, 0, 0, 0 }; + uint8_t b[] = { 0, 0, 0, 0, 0, 0x49, 0xd2, 0x40 }; int n = sizeof b; for (int i = 0; i <= n - 8; i++) print_double (b + i); diff --git a/dump-spo2.c b/dump-spo2.c index f416bf6962..847dcac45c 100644 --- a/dump-spo2.c +++ b/dump-spo2.c @@ -501,16 +501,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 +653,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 -- 2.30.2