Index: work/alien_formats/altium/pcbdoc_bin.c =================================================================== --- work/alien_formats/altium/pcbdoc_bin.c (revision 35466) +++ work/alien_formats/altium/pcbdoc_bin.c (revision 35467) @@ -127,6 +127,19 @@ return read_rec_l4b(fp, tmp); } +static long read_rec_ilb(ucdf_file_t *fp, altium_buf_t *tmp, int *id) +{ + char ids[2]; + long res; + + if ((res = ucdf_fread(fp, (void *)ids, 2)) != 2) + return res; + + *id = load_int(ids, 2); + + return read_rec_l4b(fp, tmp); +} + static int pcbdoc_bin_parse_ascii(rnd_hidlib_t *hidlib, altium_tree_t *tree, const char *record, altium_buf_t *tmp) { #warning TODO: take over tmps buff and make it a block @@ -144,7 +157,21 @@ } } +int pcbdoc_bin_parse_rules6(rnd_hidlib_t *hidlib, altium_tree_t *tree, ucdf_file_t *fp, altium_buf_t *tmp) +{ + for(;;) { + int id; + long len = read_rec_ilb(fp, tmp, &id); + if (len <= 0) + return len; +#warning "Do we need the id?" + printf("id=%d\n", id); + if (pcbdoc_bin_parse_ascii(hidlib, tree, "RULES", tmp) != 0) + return -1; + } +} + int pcbdoc_bin_parse_tracks6(rnd_hidlib_t *hidlib, altium_tree_t *tree, ucdf_file_t *fp, altium_buf_t *tmp) { for(;;) { Index: work/alien_formats/altium/test.c =================================================================== --- work/alien_formats/altium/test.c (revision 35466) +++ work/alien_formats/altium/test.c (revision 35467) @@ -3,7 +3,7 @@ #include "pcbdoc_ascii.h" #include "pcbdoc_bin.h" -int pcbdoc_bin_parse_vias6(rnd_hidlib_t *hidlib, altium_tree_t *tree, ucdf_file_t *fp, altium_buf_t *tmp); +int pcbdoc_bin_parse_rules6(rnd_hidlib_t *hidlib, altium_tree_t *tree, ucdf_file_t *fp, altium_buf_t *tmp); int main(int argc, char *argv[]) { @@ -20,7 +20,7 @@ exit(1); } - res = pcbdoc_bin_parse_vias6(&hidlib, &tree, f, &tmp); + res = pcbdoc_bin_parse_rules6(&hidlib, &tree, f, &tmp); printf("res=%d @ %ld\n", res, ftell(f));