}
static void
-dump_category(int level)
+dump_value(int level)
{
for (int i = 0; i <= level; i++)
printf (" ");
- match_byte (0);
- match_byte (0);
- match_byte (0);
- match_byte (0);
if (match_byte (3))
{
get_string();
- match_byte_assert (0x58);
+ if (match_byte (0x31))
+ {
+ 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);
get_string();
printf("string \"%s\"", get_string());
match_byte (0);
match_byte (0);
match_byte (0);
match_byte (0);
+ match_byte (0);
}
else if (match_byte (2))
{
value, format >> 16, (format >> 8) & 0xff, format & 0xff, var, vallab);
if (!match_u32 (3))
match_u32_assert (2);
+ match_byte (0);
}
else if (match_byte (1))
{
else
{
int subn;
+ int total_subs = 1;
+ match_byte (0);
match_byte_assert (0x31);
match_u32_assert (0);
match_u32_assert (0);
subn = get_u32 ();
printf ("nested %d bytes", subn);
pos += subn;
- printf ("; \"%s\"", get_string());
- fprintf (stderr, "got %02x\n", data[pos]);
- match_byte (1);
- match_byte (0);
- match_byte (0);
- match_byte (0);
- goto next;
+ printf ("; \"%s\", substitutions:", get_string());
+ fprintf (stderr, "substitutions:");
+ for (;;)
+ {
+ int n_subst = get_u32();
+ if (!n_subst)
+ break;
+ printf (" %d", n_subst);
+ fprintf (stderr, " %d", n_subst);
+ total_subs *= n_subst;
+ }
+ putc ('\n', stderr);
+
+ for (int i = 0; i < total_subs; i++)
+ {
+ putc ('\n', stdout);
+ dump_value (level + 1);
+ }
}
+}
+
+static void
+dump_category(int level)
+{
+ match_byte (0);
+ match_byte (0);
+ match_byte (0);
+ match_byte (0);
+ dump_value (level);
if (match_u32 (2))
get_u32 ();
match_u32_assert (0);
get_u32 ();
}
-next:;
+
int n_categories = get_u32();
if (n_categories > 0)
printf (", %d subcategories:", n_categories);
if (argc > 1)
{
+ if (!strcmp(argv[1], "title0"))
+ {
+ pos = 0x27;
+ if (match_byte (0x03)
+ || (match_byte (0x05) && match_byte (0x58)))
+ printf ("%s\n", get_string());
+ else
+ printf ("<unknown>\n");
+ return 0;
+ }
if (!strcmp(argv[1], "title"))
{
const char fonts[] = "\x01\x31\x09\0\0\0SansSerif";