+ if (!match_byte('.') && !match_byte(' ') && !match_byte(','))
+ match_byte_assert(0);
+ }
+ printf("<format decimal=\"%c\" grouping=\"", decimal);
+ if (grouping)
+ putchar(grouping);
+ printf("\"/>\n");
+ if (match_u32(5))
+ {
+ for (int i = 0; i < 5; i++)
+ printf("<CC%c>%s</CC%c>\n", 'A' + i, get_string(), 'A' + i);
+ }
+ else
+ match_u32_assert(0);
+
+ /* The last chunk is an outer envelope that contains two inner envelopes.
+ The second inner envelope has some interesting data like the encoding and
+ the locale. */
+ if (version == 3)
+ {
+ int outer_end = get_end();
+
+ /* First inner envelope: byte*33 int[n] int*[n]. */
+ int inner_len = get_u32();
+ int inner_end = pos + inner_len;
+ int array_start = pos + 33;
+ match_byte_assert(0);
+ pos++; /* 0, 1, 10 seen. */
+ match_byte_assert(0);
+ pos++; /* 0...11 seen. */
+ if (!match_byte(0) && !match_byte(1) && !match_byte(2))
+ match_byte_assert(3);
+ if (!match_byte(0) && !match_byte(2))
+ match_byte_assert(3);
+ if (!match_u64(0))
+ match_u64_assert(UINT64_MAX);
+ match_u32_assert(0);
+ match_u32_assert(0);
+ match_u32_assert(0);
+ match_u32_assert(0);
+ match_byte_assert(0);
+ if (!match_byte(0))
+ match_byte_assert(1);
+ match_byte_assert(1);
+ pos = array_start;
+#if 1
+ printf("widths:");
+ while (pos < inner_end)
+ printf(" %d", get_u32());
+ printf("\n");
+#endif
+ pos = inner_end;;
+
+ /* Second inner envelope. */
+ assert(get_end() == outer_end);
+
+ match_byte_assert(1);
+ match_byte_assert(0);
+ if (!match_byte(3) && !match_byte(4))
+ match_byte_assert(5);
+ match_byte_assert(0);
+ match_byte_assert(0);
+ match_byte_assert(0);
+
+ printf("<command>%s</command>\n", get_string());
+ printf("<subcommand>%s</subcommand>\n", get_string());
+ printf("<language>%s</language>\n", get_string());
+ printf("<charset>%s</charset>\n", get_string());
+ printf("<locale>%s</locale>\n", get_string());
+
+ if (!match_byte(0))
+ match_byte_assert(1);
+ match_byte_assert(0);
+ if (!match_byte(0))
+ match_byte_assert(1);
+ if (!match_byte(0))
+ match_byte_assert(1);
+
+ printf("<epoch2>%d</epoch2>\n", get_u32());
+
+ if (match_byte('.'))
+ {
+ if (!match_byte(',') && !match_byte('\''))
+ match_byte_assert(' ');
+ }
+ else
+ {
+ match_byte_assert(',');
+ if (!match_byte('.') && !match_byte(' ') && !match_byte(','))
+ match_byte_assert(0);
+ }
+
+ printf ("small: %g\n", get_double());
+
+ match_byte_assert(1);
+ if (outer_end - pos > 6)
+ {
+ /* There might be a pair of strings representing a dataset and
+ datafile name, or there might be a set of custom currency strings.
+ The custom currency strings start with a pair of integers, so we
+ can distinguish these from a string by checking for a null byte; a
+ small 32-bit integer will always contain a null and a text string
+ never will. */
+ int save_pos = pos;
+ int len = get_u32();
+ bool has_dataset = !memchr(&data[pos], '\0', len);
+ pos = save_pos;
+
+ if (has_dataset)
+ {
+ printf("<dataset>%s</dataset>\n", get_string());
+ printf("<datafile>%s</datafile>\n", get_string());
+
+ match_u32_assert(0);
+
+ time_t date = get_u32();
+ struct tm tm = *localtime(&date);
+ char s[128];
+ strftime(s, sizeof s, "%a, %d %b %Y %H:%M:%S %z", &tm);
+ printf("<date>%s</date>\n", s);
+
+ match_u32_assert(0);
+ }
+ }
+
+ if (match_u32(5))
+ {
+ for (int i = 0; i < 5; i++)
+ printf("<CC%c>%s</CC%c>\n", 'A' + i, get_string(), 'A' + i);
+ }
+ else
+ match_u32_assert(0);
+
+ match_byte_assert('.');
+ if (!match_byte(0))
+ match_byte_assert(1);
+
+ if (pos < outer_end)
+ {
+ printf("<seed>%d</seed>\n", get_u32());
+ match_u32_assert(0);
+ }
+ assert(pos == outer_end);
+
+ pos = outer_end;
+ }
+ else
+ {
+ pos = get_end();