projects
/
pspp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
crosstabs-only also
[pspp]
/
dump-spo2.c
diff --git
a/dump-spo2.c
b/dump-spo2.c
index 2ed8b7fc24649fc3a0b490f76ff169bd9a9e268f..ff9e5300692260ae9f705fe3effb7171d683e544 100644
(file)
--- a/
dump-spo2.c
+++ b/
dump-spo2.c
@@
-703,11
+703,14
@@
match_NavLog(void)
}
static void
}
static void
-parse_category(int
j
)
+parse_category(int
level, int j, int *n_leaves
)
{
{
+ for (size_t k = 0; k < level; k++)
+ putchar('\t');
get_u16(); match_byte_assert(0);
get_u16(); match_byte_assert(0);
get_u16(); match_byte_assert(0);
get_u16(); match_byte_assert(0);
- match_u32_assert(j);
+ int leaf_idx = get_u32();
+ printf("%d ", leaf_idx);
match_u32_assert(0);
if (get_u16() == 0xffff)
match_u16_assert(0xffff);
match_u32_assert(0);
if (get_u16() == 0xffff)
match_u16_assert(0xffff);
@@
-715,8
+718,24
@@
parse_category(int j)
match_u16_assert(0x0e74);
match_byte_assert(0);
match_DspSimpleText();
match_u16_assert(0x0e74);
match_byte_assert(0);
match_DspSimpleText();
+ if (match_u16(0x8018))
+ {
+ printf("18 80(%02x %02x %02x) ",
+ data[pos], data[pos + 1], data[pos + 2]);
+ pos += 3;
+ }
match_DspString();
match_DspString();
- match_u32_assert(0);
+
+ int n_subcategories = get_u32();
+ if (n_subcategories)
+ assert (leaf_idx == 0);
+ else
+ {
+ assert (leaf_idx == *n_leaves);
+ ++*n_leaves;
+ }
+ for (int k = 0; k < n_subcategories; k++)
+ parse_category(level + 1, k, n_leaves);
}
static void
}
static void
@@
-727,13
+746,6
@@
parse_dimension(int i)
{
match_zeros_assert(5);
match_u32_assert(1);
{
match_zeros_assert(5);
match_u32_assert(1);
- get_u16(); match_u16_assert(0x0e74); match_byte_assert(0);
- match_DspSimpleText();
- match_DspString();
-
- int n_categories = get_u32();
- for (int j = 0; j < n_categories; j++)
- parse_category(j);
}
else
{
}
else
{
@@
-757,15
+769,19
@@
parse_dimension(int i)
get_u16(); match_byte_assert(0);
match_u32_assert(0);
match_u32_assert(1);
get_u16(); match_byte_assert(0);
match_u32_assert(0);
match_u32_assert(1);
+ }
- get_u16(); match_u16_assert(0x0e74); match_byte_assert(0);
- match_DspSimpleText();
- match_DspString();
+ get_u16();
+ if (!match_u16(0xffff))
+ match_u16_assert(0x0e74);
+ match_byte_assert(0);
+ match_DspSimpleText();
+ match_DspString();
-
int n_categories = get_u32()
;
- for (int j = 0; j < n_categories; j++)
- parse_category(j);
- }
+
int n_leaves = 0
;
+ int n_categories = get_u32();
+ for (int j = 0; j < n_categories; j++)
+ parse_category(1, j, &n_leaves);
}
static void
}
static void
@@
-1081,13
+1097,15
@@
parse_flexible(void)
match_byte_assert(0x02);
match_byte_assert(0x0d); */
}
match_byte_assert(0x02);
match_byte_assert(0x0d); */
}
- else if (data[pos] == 0x15 && data[pos + 1] == 0x80)
+ else if ((data[pos] == 0x15 || data[pos] == 0x14)
+ && data[pos + 1] == 0x80)
{
{
+ /* 14 80 */
/* 15 80 */
pos += 2;
if (match_byte(2))
{
/* 15 80 */
pos += 2;
if (match_byte(2))
{
- printf ("
15 80(%f"
, get_double());
+ printf ("
%02x 80(%f", data[pos - 2]
, get_double());
printf (" \"%s\")\n", get_string1());
if (match_byte(1))
{
printf (" \"%s\")\n", get_string1());
if (match_byte(1))
{
@@
-1107,10
+1125,15
@@
parse_flexible(void)
else
{
match_byte_assert(0);
else
{
match_byte_assert(0);
- if (match_u32(0xc))
- match_u16_assert(1);
}
}
}
}
+ else if (data[pos] == 0x17)
+ {
+ printf("%02x %02x(%02x %02x %02x)\n",
+ data[pos], data[pos + 1],
+ data[pos + 2], data[pos + 3], data[pos + 4]);
+ pos += 5;
+ }
else if (data[pos] == 0x9 && data[pos + 1] == 0x80)
{
match_NavLog();
else if (data[pos] == 0x9 && data[pos + 1] == 0x80)
{
match_NavLog();
@@
-1197,12
+1220,9
@@
parse_flexible(void)
}
else
{
}
else
{
-#if 0
- fprintf (stderr, "bad record 0x%02x at offset %x: ",
- data[pos], pos);
-#endif
+ fprintf (stderr, "%#x: unknown record", pos);
hex_dump (stderr, pos, 64);
hex_dump (stderr, pos, 64);
-
assert(0
);
+
exit(1
);
}
}
else if (match_byte(0xa))
}
}
else if (match_byte(0xa))
@@
-1268,11
+1288,13
@@
parse_flexible(void)
int start_pos = pos;
char *title = get_string1();
printf("%#x: title(\"%s\", ", start_pos, title);
int start_pos = pos;
char *title = get_string1();
printf("%#x: title(\"%s\", ", start_pos, title);
- match_u32_assert(0);
+ if (!match_u32(2))
+ match_u32_assert(0);
char *id = get_string1();
printf("\"%s\")\n", id);
match_byte_assert(0);
char *id = get_string1();
printf("\"%s\")\n", id);
match_byte_assert(0);
- match_u32_assert(3);
+ if (!match_u32(2))
+ match_u32_assert(3);
match_u16_assert(1);
}
else //if (match_u16(2) || match_u16(3) || match_u16(4) || match_u16(5) || match_u16(6) || match_u16(7) || match_u16(8) || match_u16(9))
match_u16_assert(1);
}
else //if (match_u16(2) || match_u16(3) || match_u16(4) || match_u16(5) || match_u16(6) || match_u16(7) || match_u16(8) || match_u16(9))