- }
- }
- match_byte(0);
- match_byte(0);
- match_byte(0);
-}
-
-static void
-dump_dim_value(int level)
-{
- for (int i = 0; i <= level; i++)
- printf (" ");
-
- if (match_byte (3))
- {
- get_string();
- dump_value_31();
- get_string();
- printf("string \"%s\"", get_string());
- match_byte (0);
- match_byte (1);
- }
- else if (match_byte (5))
- {
- match_byte_assert (0x58);
- printf ("variable \"%s\"", get_string());
- get_string();
- if (!match_byte (1) && !match_byte (2))
- match_byte_assert(3);
- }
- else
- dump_value(level);
-}
-
-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 ();
- else if (match_u32 (1))
- {
- match_byte (0);
- match_byte (0);
- match_byte (0);
- get_u32 ();
- }
- else if (match_byte (1))
- {
- match_byte (0);
- if (!match_u32 (2))
- match_u32_assert (1);
- match_byte (0);
- get_u32();
- }
- else
- {
- match_u32_assert (0);
- get_u32 ();
- }
-
- int n_categories = get_u32();
- if (n_categories > 0)
- printf (", %d subcategories:", n_categories);
- printf("\n");
- for (int i = 0; i < n_categories; i++)
- dump_category (level + 1);
-}
-
-static void
-dump_dim(void)
-{
- int n_categories;
- printf("next dim\n");
- match_byte(0);
- dump_dim_value(0);
-
- /* This byte is usually 0x02 but 0x00 and 0x75 (!) have also been spotted. */
- pos++;
-
- if (!match_byte(0) && !match_byte(1))
- match_byte_assert(2);
- if (!match_u32(0))
- match_u32_assert(2);
- if (!match_byte(0))
- match_byte_assert(1);
- match_byte(0);
- match_byte(0);
- match_byte(0);
- match_byte(0);
- get_u32();
- match_byte(0);
- match_byte(0);
- match_byte(0);
- match_byte(0);
- n_categories = get_u32();
- printf("%d nested categories\n", n_categories);
- for (int i = 0; i < n_categories; i++)
- dump_category (0);
-}
-
-int n_dims;
-static void
-dump_dims(void)
-{
- n_dims = get_u32();
- printf ("%u dimensions\n", n_dims);
- for (int i = 0; i < n_dims; i++)
- {
- printf("\n");
- dump_dim ();
- }
-}
-
-static void
-dump_data_value(void)
-{
- match_byte(0);
- match_byte(0);
- match_byte(0);
- match_byte(0);
- if (match_byte (1))
- {
- unsigned int format;
- double value;
-
- dump_value_31();
- format = get_u32 ();
- value = get_double ();
- printf (" value %g format %d(%d.%d)", value, format >> 16, (format >> 8) & 0xff, format & 0xff);
- }
- else if (match_byte (3))
- {
- get_string();
- dump_value_31();
- get_string();
- printf("string \"%s\"", get_string());
- match_byte (0);
- }
- else if (match_byte (2))
- {
- unsigned int format;
- char *var, *vallab;
- double value;