13 all_ascii(const uint8_t *p, size_t n)
15 for (size_t i = 0; i < n; i++)
16 if (p[i] < 32 || p[i] > 126)
22 try_find(const char *target, size_t target_len)
24 const uint8_t *pos = (const uint8_t *) memmem (data, n, target, target_len);
25 return pos ? pos - data : 0;
29 try_find_tail(const char *target, size_t target_len)
31 size_t pos = try_find(target, target_len);
32 return pos ? pos + target_len : 0;
36 find(const char *target, size_t target_len)
38 size_t pos = try_find(target, target_len);
41 fprintf (stderr, "not found\n");
48 find_tail(const char *target, size_t target_len)
50 size_t pos = try_find_tail(target, target_len);
53 fprintf (stderr, "not found\n");
62 #define STR(x) XSTR(x)
63 #define WHERE __FILE__":" STR(__LINE__)
69 memcpy(&x, &data[pos], 4);
78 memcpy(&x, &data[pos], 8);
93 match_u32_assert(uint32_t x, const char *where)
95 unsigned int y = get_u32();
98 fprintf(stderr, "%s: 0x%x: expected i%u, got i%u\n", where, pos - 4, x, y);
102 #define match_u32_assert(x) match_u32_assert(x, WHERE)
105 match_byte(uint8_t b)
107 if (pos < n && data[pos] == b)
117 match_byte_assert(uint8_t b, const char *where)
121 fprintf(stderr, "%s: 0x%x: expected %02x, got %02x\n", where, pos, b, data[pos]);
125 #define match_byte_assert(b) match_byte_assert(b, WHERE)
128 get_string(const char *where)
131 /*data[pos + 1] == 0 && data[pos + 2] == 0 && data[pos + 3] == 0*/
132 /*&& all_ascii(&data[pos + 4], data[pos])*/)
134 int len = data[pos] + data[pos + 1] * 256;
135 char *s = malloc(len + 1);
137 memcpy(s, &data[pos + 4], len);
144 fprintf(stderr, "%s: 0x%x: expected string\n", where, pos);
148 #define get_string() get_string(WHERE)
153 if (match_byte (0x31))
157 match_u32_assert (0);
158 int subn = get_u32 ();
159 printf ("nested %d bytes", subn);
162 else if (match_u32 (1))
164 printf("(footnote %d) ", get_u32());
165 match_byte_assert (0);
166 match_byte_assert (0);
167 int subn = get_u32 ();
168 printf ("nested %d bytes", subn);
171 else if (match_u32 (2))
173 printf("(special 2)");
174 match_byte_assert(0);
175 match_byte_assert(0);
177 match_byte_assert(0);
178 match_byte_assert(0);
179 int subn = get_u32 ();
180 printf ("nested %d bytes", subn);
186 printf("(special 3)");
187 match_byte_assert(0);
188 match_byte_assert(0);
189 match_byte_assert(1);
190 match_byte_assert(0);
191 int subn = get_u32 ();
192 printf ("nested %d bytes, ", subn);
195 printf ("nested %d bytes, ", subn);
200 match_byte_assert (0x58);
204 dump_value(int level)
206 for (int i = 0; i <= level; i++)
215 char *s1 = get_string();
217 char *s2 = get_string();
218 char *s3 = get_string();
220 printf("strings \"%s\", \"%s\" and \"%s\"", s1, s2, s3);
222 printf("string \"%s\" and \"%s\"", s1, s2);
233 else if (match_byte (5))
235 match_byte_assert (0x58);
236 printf ("variable \"%s\"", get_string());
238 if (!match_byte(1) && !match_byte(2))
239 match_byte_assert(3);
245 else if (match_byte (2))
251 match_byte_assert (0x58);
253 value = get_double ();
255 vallab = get_string ();
256 printf ("value %g format %d(%d.%d) var \"%s\" vallab \"%s\"",
257 value, format >> 16, (format >> 8) & 0xff, format & 0xff, var, vallab);
258 if (!match_byte (1) && !match_byte(2))
259 match_byte_assert (3);
268 else if (match_byte (4))
271 char *var, *vallab, *value;
273 match_byte_assert (0x58);
275 vallab = get_string ();
277 if (!match_byte(1) && !match_byte(2))
278 match_byte_assert (3);
279 value = get_string ();
280 printf ("value \"%s\" format %d(%d.%d) var \"%s\" vallab \"%s\"",
281 value, format >> 16, (format >> 8) & 0xff, format & 0xff, var, vallab);
287 else if (match_byte (1))
294 value = get_double ();
295 printf ("value %g format %d(%d.%d)", value, format >> 16, (format >> 8) & 0xff, format & 0xff);
305 char *base = get_string();
307 printf ("\"%s\" with %d variables:\n", base, x);
310 for (int i = 0; i < x; i++)
312 dump_value (level+1);
318 for (int i = 0; i < x; i++)
322 for (int j = 0; j <= level; j++)
324 printf("variable %d has %d values:\n", i, y);
325 for (int j = 0; j < y; j++)
329 char *a = get_string();
330 match_byte_assert(0x58);
331 char *b = get_string();
332 char *c = get_string();
333 for (int k = 0; k <= level + 1; k++)
335 printf ("\"%s\", \"%s\", \"%s\"", a, b, c);
343 dump_value (level+1);
352 dump_dim_value(int level)
354 for (int i = 0; i <= level; i++)
360 if (match_byte (0x31))
363 printf("(footnote %d) ", get_u32());
364 match_byte_assert (0);
365 match_byte_assert (0);
366 int subn = get_u32 ();
367 printf ("nested %d bytes", subn);
371 match_byte_assert (0x58);
373 printf("string \"%s\"", get_string());
375 match_byte_assert (1);
381 else if (match_byte (5))
383 match_byte_assert (0x58);
384 printf ("variable \"%s\"", get_string());
386 match_byte_assert (2);
388 else if (match_byte (2))
394 match_byte_assert (0x58);
396 value = get_double ();
398 vallab = get_string ();
399 printf ("value %g format %d(%d.%d) var \"%s\" vallab \"%s\"",
400 value, format >> 16, (format >> 8) & 0xff, format & 0xff, var, vallab);
402 match_u32_assert (2);
405 else if (match_byte (1))
410 match_byte_assert (0x58);
412 value = get_double ();
413 printf ("value %g format %d(%d.%d)", value, format >> 16, (format >> 8) & 0xff, format & 0xff);
425 match_byte_assert (0x31);
426 match_u32_assert (0);
427 match_u32_assert (0);
429 printf ("nested %d bytes", subn);
431 printf ("; \"%s\", substitutions:", get_string());
432 int total_subs = get_u32();
436 total_subs = (total_subs - 1) + x;
437 match_u32_assert (0);
439 printf (" (total %d)", total_subs);
441 for (int i = 0; i < total_subs; i++)
444 dump_value (level + 1);
450 dump_category(int level)
460 else if (match_u32 (1))
467 else if (match_byte (1))
471 match_u32_assert (1);
477 match_u32_assert (0);
481 int n_categories = get_u32();
482 if (n_categories > 0)
483 printf (", %d subcategories:", n_categories);
485 for (int i = 0; i < n_categories; i++)
486 dump_category (level + 1);
493 printf("next dim\n");
498 match_byte_assert(0x58);
500 printf("string \"%s\": ", get_string());
501 match_byte(1) || match_byte(0);
503 else if (match_byte(5))
505 match_byte_assert(0x58);
506 printf("variable \"%s\": ", get_string());
509 match_byte_assert(3);
511 else if (match_byte(0x31))
516 match_u32_assert (0);
517 match_u32_assert (0);
519 printf ("nested %d bytes", subn);
521 printf ("; \"%s\", substitutions:", get_string());
524 int n_subst = get_u32();
527 printf (" %d", n_subst);
528 total_subs *= n_subst;
531 for (int i = 0; i < total_subs; i++)
541 match_byte_assert (0x58);
542 printf ("\"%s\" with substitutions:", get_string());
545 int n_subst = get_u32();
548 printf (" %d", n_subst);
549 total_subs *= n_subst;
552 for (int i = 0; i < total_subs; i++)
559 /* This byte is usually 0x02 but 0x00 and 0x75 (!) have also been spotted. */
562 if (!match_byte(0) && !match_byte(1))
563 match_byte_assert(2);
567 match_byte_assert(1);
577 n_categories = get_u32();
578 printf("%d nested categories\n", n_categories);
579 for (int i = 0; i < n_categories; i++)
588 printf ("%u dimensions\n", n_dims);
589 for (int i = 0; i < n_dims; i++)
597 dump_data_value_31(void)
599 if (match_byte (0x31))
606 match_u32_assert (0);
607 int subn = get_u32 ();
608 printf ("nested %d bytes", subn);
611 else if (match_u32 (1))
613 printf("(footnote %d) ", get_u32());
614 match_byte_assert (0);
615 match_byte_assert (0);
616 int subn = get_u32 ();
617 printf ("nested %d bytes", subn);
620 else if (match_u32 (2))
622 printf("(special 2)");
623 match_byte_assert(0);
624 match_byte_assert(0);
626 match_byte_assert(0);
627 match_byte_assert(0);
628 int subn = get_u32 ();
629 printf ("nested %d bytes", subn);
635 printf("(special 3)");
636 match_byte_assert(0);
637 match_byte_assert(0);
638 match_byte_assert(1);
639 match_byte_assert(0);
640 int subn = get_u32 ();
641 printf ("nested %d bytes, ", subn);
644 printf ("nested %d bytes, ", subn);
649 match_byte_assert (0x58);
657 for (int i = 0; i < 3 + n_dims; i++)
659 printf ("data intro:");
660 for (int i = 0; i < 3 + n_dims; i++)
664 fprintf (stderr,"data intro (%d dims):", n_dims);
665 for (int i = 0; i < 3+n_dims; i++)
666 fprintf (stderr," %d", get_u32());
667 fprintf(stderr,"\n");
670 printf ("%d data values, starting at %08x\n", x, pos);
671 for (int i = 0; i < x; i++)
673 printf("%08x, index %d:\n", pos, get_u32());
684 dump_data_value_31();
686 value = get_double ();
687 printf (" value %g format %d(%d.%d)", value, format >> 16, (format >> 8) & 0xff, format & 0xff);
689 else if (match_byte (3))
692 dump_data_value_31();
694 printf("string \"%s\"", get_string());
697 else if (match_byte (2))
703 match_byte_assert (0x58);
705 value = get_double ();
707 vallab = get_string ();
708 printf ("value %g format %d(%d.%d) var \"%s\" vallab \"%s\"",
709 value, format >> 16, (format >> 8) & 0xff, format & 0xff, var, vallab);
710 if (!match_byte (1) && !match_byte(2))
711 match_byte_assert (3);
713 else if (match_byte (4))
716 char *var, *vallab, *value;
718 match_byte_assert (0x58);
720 vallab = get_string ();
722 if (!match_byte(1) && !match_byte(2))
723 match_byte_assert (3);
724 value = get_string ();
725 printf ("value \"%s\" format %d(%d.%d) var \"%s\" vallab \"%s\"",
726 value, format >> 16, (format >> 8) & 0xff, format & 0xff, var, vallab);
728 else if (match_byte (5))
730 match_byte_assert (0x58);
731 printf ("variable \"%s\"", get_string());
733 if (!match_byte(1) && !match_byte(2))
734 match_byte_assert(3);
742 dump_data_value_31();
743 char *base = get_string();
745 printf ("\"%s\"; %d variables:\n", base, x);
746 for (int i = 0; i < x; i++)
753 for (int j = 0; j <= 0; j++)
755 printf("variable %d has %d values:\n", i, y);
756 for (int j = 0; j < y; j++)
763 dump_data_value_31();
765 value = get_double ();
766 printf (" value %g format %d(%d.%d)", value, format >> 16, (format >> 8) & 0xff, format & 0xff);
768 else if (match_byte(3))
770 char *a = get_string();
771 match_byte_assert(0x58);
772 char *b = get_string();
773 char *c = get_string();
774 for (int k = 0; k <= 1; k++)
776 printf ("\"%s\", \"%s\", \"%s\"", a, b, c);
782 else if (match_byte(5))
784 match_byte_assert (0x58);
785 printf ("variable \"%s\"", get_string());
787 if (!match_byte(1) && !match_byte(2))
788 match_byte_assert(3);
805 dump_title_value_31(int level)
807 if (match_byte (0x31))
811 match_u32_assert (0);
812 int subn = get_u32 ();
813 printf ("nested %d bytes", subn);
816 else if (match_u32 (1))
818 printf("(footnote %d) ", get_u32());
819 match_byte_assert (0);
820 match_byte_assert (0);
821 int subn = get_u32 ();
822 printf ("nested %d bytes", subn);
825 else if (match_u32 (2))
827 printf("(special 2)");
828 match_byte_assert(0);
829 match_byte_assert(0);
832 match_byte_assert(0);
833 match_byte_assert(0);
834 int subn = get_u32 ();
835 printf ("nested %d bytes", subn);
841 printf("(special 3)");
842 match_byte_assert(0);
843 match_byte_assert(0);
844 match_byte_assert(1);
845 match_byte_assert(0);
846 int subn = get_u32 ();
847 printf ("nested %d bytes, ", subn);
850 printf ("nested %d bytes, ", subn);
855 match_byte_assert (0x58);
859 dump_title_value(int level)
861 for (int i = 0; i <= level; i++)
872 dump_title_value_31(level);
874 printf("string \"%s\"", get_string());
885 else if (match_byte (5))
887 dump_title_value_31(level);
888 printf ("variable \"%s\"", get_string());
890 if (!match_byte(1) && !match_byte(2))
891 match_byte_assert(3);
893 else if (match_byte (2))
899 match_byte_assert (0x58);
901 value = get_double ();
903 vallab = get_string ();
904 printf ("value %g format %d(%d.%d) var \"%s\" vallab \"%s\"",
905 value, format >> 16, (format >> 8) & 0xff, format & 0xff, var, vallab);
906 if (!match_byte (1) && !match_byte(2))
907 match_byte_assert (3);
916 else if (match_byte (4))
919 char *var, *vallab, *value;
921 match_byte_assert (0x58);
923 vallab = get_string ();
925 if (!match_byte(1) && !match_byte(2))
926 match_byte_assert (3);
927 value = get_string ();
928 printf ("value \"%s\" format %d(%d.%d) var \"%s\" vallab \"%s\"",
929 value, format >> 16, (format >> 8) & 0xff, format & 0xff, var, vallab);
935 else if (match_byte (1))
940 dump_title_value_31(level);
942 value = get_double ();
943 printf ("value %g format %d(%d.%d)", value, format >> 16, (format >> 8) & 0xff, format & 0xff);
952 dump_title_value_31(level);
954 char *base = get_string();
956 printf ("\"%s\" with %d variables:\n", base, x);
957 for (int i = 0; i < x; i++)
964 for (int j = 0; j <= level; j++)
966 printf("variable %d has %d values:\n", i, y);
967 for (int j = 0; j < y; j++)
972 char *a = get_string();
973 match_byte_assert(0x58);
974 char *b = get_string();
975 char *c = get_string();
976 for (int k = 0; k <= level + 1; k++)
978 printf ("\"%s\", \"%s\", \"%s\"", a, b, c);
981 dump_title_value (level+1);
989 dump_footnote_value(int level)
991 for (int i = 0; i <= level; i++)
1001 if (match_byte (0x31))
1005 printf("(footnote %d) ", get_u32());
1006 match_byte_assert (0);
1007 match_byte_assert (0);
1008 int subn = get_u32 ();
1009 printf ("nested %d bytes", subn);
1012 else if (match_u32 (2))
1014 printf("(special 2)");
1015 match_byte_assert(0);
1016 match_byte_assert(0);
1017 match_u32_assert(1);
1018 match_byte_assert(0);
1019 match_byte_assert(0);
1020 int subn = get_u32 ();
1021 printf ("nested %d bytes", subn);
1026 match_u32_assert(3);
1027 printf("(special 3)");
1028 match_byte_assert(0);
1029 match_byte_assert(0);
1030 match_byte_assert(1);
1031 match_byte_assert(0);
1032 int subn = get_u32 ();
1033 printf ("nested %d bytes, ", subn);
1036 printf ("nested %d bytes, ", subn);
1041 match_byte_assert (0x58);
1043 printf("string \"%s\"", get_string());
1044 if (!match_byte (0))
1045 match_byte_assert (1);
1047 else if (match_byte (5))
1049 match_byte_assert (0x58);
1050 printf ("variable \"%s\"", get_string());
1052 if (!match_byte(1) && !match_byte(2))
1053 match_byte_assert(3);
1055 else if (match_byte (2))
1057 unsigned int format;
1061 match_byte_assert (0x58);
1062 format = get_u32 ();
1063 value = get_double ();
1064 var = get_string ();
1065 vallab = get_string ();
1066 printf ("value %g format %d(%d.%d) var \"%s\" vallab \"%s\"",
1067 value, format >> 16, (format >> 8) & 0xff, format & 0xff, var, vallab);
1068 if (!match_byte (1) && !match_byte(2))
1069 match_byte_assert (3);
1078 else if (match_byte (4))
1080 unsigned int format;
1081 char *var, *vallab, *value;
1083 match_byte_assert (0x58);
1084 format = get_u32 ();
1085 vallab = get_string ();
1086 var = get_string ();
1087 if (!match_byte(1) && !match_byte(2))
1088 match_byte_assert (3);
1089 value = get_string ();
1090 printf ("value \"%s\" format %d(%d.%d) var \"%s\" vallab \"%s\"",
1091 value, format >> 16, (format >> 8) & 0xff, format & 0xff, var, vallab);
1097 else if (match_byte (1))
1099 unsigned int format;
1102 if (match_byte (0x31))
1106 printf("(footnote %d) ", get_u32());
1107 match_byte_assert (0);
1108 match_byte_assert (0);
1109 int subn = get_u32 ();
1110 printf ("nested %d bytes", subn);
1115 match_byte_assert (0x58);
1116 format = get_u32 ();
1117 value = get_double ();
1118 printf ("value %g format %d(%d.%d)", value, format >> 16, (format >> 8) & 0xff, format & 0xff);
1120 else if (match_byte (0x31))
1124 printf("(footnote %d) ", get_u32());
1125 match_byte_assert (0);
1126 match_byte_assert (0);
1127 int subn = get_u32 ();
1128 printf ("nested %d bytes", subn);
1133 match_u32_assert (0);
1134 match_u32_assert (0);
1135 int subn = get_u32 ();
1136 printf ("nested %d bytes", subn);
1139 char *base = get_string();
1141 printf ("\"%s\"; %d variables:\n", base, x);
1142 for (int i = 0; i < x; i++)
1148 match_u32_assert(0);
1149 for (int j = 0; j <= level; j++)
1151 printf("variable %d has %d values:\n", i, y);
1152 for (int j = 0; j < y; j++)
1156 char *a = get_string();
1157 match_byte_assert(0x58);
1158 char *b = get_string();
1159 char *c = get_string();
1160 for (int k = 0; k <= level + 1; k++)
1162 printf ("\"%s\", \"%s\", \"%s\"", a, b, c);
1164 match_byte_assert(0);
1167 dump_footnote_value (level+1);
1175 match_byte_assert (0x58);
1176 char *base = get_string();
1178 printf ("\"%s\" with %d variables:\n", base, x);
1179 for (int i = 0; i < x; i++)
1185 match_u32_assert(0);
1186 for (int j = 0; j <= level; j++)
1188 printf("variable %d has %d values:\n", i, y);
1189 for (int j = 0; j < y; j++)
1193 char *a = get_string();
1194 match_byte_assert(0x58);
1195 char *b = get_string();
1196 char *c = get_string();
1197 for (int k = 0; k <= level + 1; k++)
1199 printf ("\"%s\", \"%s\", \"%s\"", a, b, c);
1200 match_byte_assert(0);
1203 dump_footnote_value (level+1);
1214 dump_title_value(0); putchar('\n');
1215 dump_title_value(0); putchar('\n');
1216 match_byte_assert(0x31);
1217 dump_title_value(0); putchar('\n');
1219 match_byte_assert(0x58);
1220 if (match_byte(0x31))
1222 dump_footnote_value(0); putchar('\n');
1225 match_byte_assert(0x58);
1228 int n_footnotes = get_u32();
1229 if (n_footnotes >= 20)
1231 fprintf(stderr, "%08x: %d footnotes\n", pos - 4, n_footnotes);
1235 printf("------\n%d footnotes\n", n_footnotes);
1236 if (n_footnotes < 20)
1238 for (int i = 0; i < n_footnotes; i++)
1240 printf("footnote %d:\n", i);
1241 dump_footnote_value(0);
1248 unsigned int format;
1251 if (match_byte (0x31))
1255 printf("(footnote %d) ", get_u32());
1256 match_byte_assert (0);
1257 match_byte_assert (0);
1258 int subn = get_u32 ();
1259 printf ("nested %d bytes", subn);
1264 match_byte_assert (0x58);
1265 format = get_u32 ();
1266 value = get_double ();
1267 printf ("value %g format %d(%d.%d)", value, format >> 16, (format >> 8) & 0xff, format & 0xff);
1274 else if (match_byte (0x31))
1276 match_byte_assert(3);
1278 match_byte_assert(0x58);
1279 match_u32_assert(0);
1284 match_byte_assert (0x58);
1285 printf("(%d)\n", get_u32());
1291 find_dimensions(void)
1294 const char dimensions[] = "-,,,.\0";
1295 int x = try_find_tail(dimensions, sizeof dimensions - 1);
1300 const char dimensions[] = "-,,, .\0";
1301 return find_tail(dimensions, sizeof dimensions - 1);
1307 printf("fonts: offset=%08x\n", pos);
1309 for (int i = 1; i <= 8; i++)
1311 printf("%08x: font %d, ", pos, i);
1312 match_byte_assert(i);
1313 match_byte_assert(0x31);
1314 printf("%s, ", get_string());
1315 match_byte_assert(0);
1316 match_byte_assert(0);
1317 if (!match_byte(0x40) && !match_byte(0x20) && !match_byte(0x80) && !match_byte(0x10))
1318 match_byte_assert(0x50);
1319 if (!match_byte(0x41))
1320 match_byte_assert(0x51);
1322 printf ("%s, ", get_string());
1323 printf ("%s, ", get_string());
1324 match_u32_assert(0);
1325 match_u32_assert(0);
1334 match_u32_assert(240);
1337 match_u32_assert(18);
1344 match_u32_assert(142);
1348 int count = get_u32();
1351 char *encoding = get_string();
1352 printf("encoding=%s\n", encoding);
1355 match_u32_assert(UINT32_MAX);
1357 match_byte_assert(1);
1358 match_byte_assert(0);
1360 match_byte_assert(1);
1361 if (!match_byte(0x99) && !match_byte(0x98))
1362 match_byte_assert(0x97);
1363 match_byte_assert(7);
1364 match_byte_assert(0);
1365 match_byte_assert(0);
1366 if (match_byte('.'))
1367 match_byte_assert(',');
1370 match_byte_assert(',');
1371 if (!match_byte('.'))
1372 match_byte_assert(' ');
1374 match_u32_assert(5);
1375 for (int i = 0; i < 5; i++)
1378 if (pos != find_dimensions())
1379 fprintf (stderr, "%08x / %08x\n", pos, find_dimensions());
1383 main(int argc, char *argv[])
1388 if (isatty(STDIN_FILENO))
1390 fprintf(stderr, "redirect stdin from a .bin file\n");
1393 if (fstat(STDIN_FILENO, &s))
1405 if (read(STDIN_FILENO, data, n) != n)
1413 if (!strcmp(argv[1], "title0"))
1416 if (match_byte (0x03)
1417 || (match_byte (0x05) && match_byte (0x58)))
1418 printf ("%s\n", get_string());
1420 printf ("<unknown>\n");
1423 else if (!strcmp(argv[1], "title"))
1428 else if (!strcmp(argv[1], "titleraw"))
1430 const char fonts[] = "\x01\x31\x09\0\0\0SansSerif";
1432 n = find(fonts, sizeof fonts - 1);
1434 else if (!strcmp(argv[1], "fonts"))
1436 const char fonts[] = "\x01\x31\x09\0\0\0SansSerif";
1437 const char styles[] = "\xf0\0\0\0";
1438 start = find(fonts, sizeof fonts - 1);
1439 n = find(styles, sizeof styles - 1);
1441 else if (!strcmp(argv[1], "styles"))
1443 const char styles[] = "\xf0\0\0\0";
1444 const char dimensions[] = "-,,,.\0";
1445 start = find(styles, sizeof styles - 1);
1446 n = find(dimensions, sizeof dimensions - 1) + sizeof dimensions - 1;
1448 else if (!strcmp(argv[1], "dimensions") || !strcmp(argv[1], "all"))
1451 match_byte_assert(1);
1452 match_byte_assert(0);
1453 match_u32_assert(3);
1454 match_byte_assert(1);
1456 match_byte_assert(1);
1457 match_byte_assert(0);
1458 match_byte_assert(0);
1460 match_byte_assert(1);
1462 match_byte_assert(0);
1463 match_byte_assert(0);
1464 match_byte_assert(0);
1468 printf("\n\ndata:\n");
1471 match_byte_assert (1);
1474 fprintf (stderr, "%x / %x\n", pos, n);
1481 fprintf (stderr, "unknown section %s\n", argv[1]);
1488 for (size_t i = start; i < n; )
1495 && i + 4 + data[i] + data[i + 1] * 256 <= n
1496 && all_ascii(&data[i + 4], data[i] + data[i + 1] * 256))
1498 fputs("\n\"", stdout);
1499 fwrite(&data[i + 4], 1, data[i] + data[i + 1] * 256, stdout);
1500 fputs("\" ", stdout);
1502 i += 4 + data[i] + data[i + 1] * 256;
1504 else if (i + 12 <= n
1505 && data[i + 1] == 40
1507 && data[i + 3] == 0)
1511 memcpy (&d, &data[i + 4], 8);
1512 printf ("F40.%d(%.*f)\n", data[i], data[i], d);
1515 else if (i + 12 <= n
1516 && data[i + 1] == 40
1517 && data[i + 2] == 31
1518 && data[i + 3] == 0)
1522 memcpy (&d, &data[i + 4], 8);
1523 printf ("PCT40.%d(%.*f)\n", data[i], data[i], d);
1527 && (data[i] && data[i] != 88 && data[i] != 0x41)
1532 printf ("i%d ", data[i]);
1537 printf("%02x ", data[i]);