}
static void
-dump_data_value(void)
+dump_substs(void (*dump)(int level), int level)
{
+ dump_value_31();
+
+ char *base = get_string();
+ int x = get_u32();
+ printf ("\"%s\" with %d variables:\n", base, x);
+ 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++)
+ {
+ dump (level+1);
+ putchar('\n');
+ }
+ }
+}
+
+static void
+dump_data_value(int level)
+{
+ for (int i = 0; i <= level; i++)
+ printf (" ");
+
match_byte(0);
match_byte(0);
match_byte(0);
match_byte(0);
- if (data[pos] == 2 || data[pos] == 4 || data[pos] == 3 || data[pos] == 1)
+ if (data[pos] == 1 || data[pos] == 2 || data[pos] == 3 || data[pos] == 4)
dump_value__(0, false);
else if (data[pos] == 5)
dump_value (0);
else
- {
- dump_value_31();
- char *base = get_string();
- int x = get_u32();
- printf ("\"%s\"; %d variables:\n", base, x);
- 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 <= 0; j++)
- printf (" ");
- printf("variable %d has %d values:\n", i, y);
- for (int j = 0; j < y; j++)
- dump_data_value();
- }
- }
+ dump_substs (dump_data_value, level + 1);
}
static void
{
printf("%08x, index %d:\n", pos, get_u32());
match_u32_assert(0);
- dump_data_value();
+ dump_data_value(0);
putchar('\n');
}
}
match_byte (0);
match_byte (0);
match_byte (0);
- if (data[pos] == 3 || data[pos] == 2 || data[pos] == 4 || data[pos] == 1)
+ if (data[pos] == 1 || data[pos] == 2 || data[pos] == 3 || data[pos] == 4)
dump_value(level);
else if (data[pos] == 5)
dump_value__(level, true);
else
- {
- dump_value_31();
-
- char *base = get_string();
- int x = get_u32();
- printf ("\"%s\" with %d variables:\n", base, x);
- 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++)
- {
- dump_title_value (level+1);
- putchar('\n');
- }
- }
- }
+ dump_substs(dump_title_value, level + 1);
}
static void
match_byte (0);
if (data[pos] == 2 || data[pos] == 4)
dump_value(level);
- else if (data[pos] == 5 || data[pos] == 3 || data[pos] == 1)
+ else if (data[pos] == 1 || data[pos] == 3 || data[pos] == 5)
dump_value__(level, false);
else
- {
- dump_value_31();
- char *base = get_string();
- int x = get_u32();
- printf ("\"%s\"; %d variables:\n", base, x);
- 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++)
- {
- dump_footnote_value (level+1);
- putchar('\n');
- }
- }
- }
+ dump_substs(dump_footnote_value, level + 1);
}
static void