Index: work/alien_formats/eagle/eagle_bin/test_parser/eagle_bin.c =================================================================== --- work/alien_formats/eagle/eagle_bin/test_parser/eagle_bin.c (revision 9375) +++ work/alien_formats/eagle/eagle_bin/test_parser/eagle_bin.c (revision 9376) @@ -179,7 +179,7 @@ TERM }, { /* subsection sizes */ - {4, 4, SS_DIRECT}, + {4, 4, SS_RECURSIVE}, TERM }, { /* attributes */ @@ -268,7 +268,7 @@ TERM }, { /* subsection sizes */ - {2, 2, SS_DIRECT}, + {2, 2, SS_RECURSIVE}, TERM }, { /* attributes */ @@ -962,13 +962,28 @@ for(ss = sc->subs; ss->offs != 0; ss++) { unsigned long int n, numch = load_ulong(block, ss->offs, ss->len); - printf("About to parse %ld sub-blocks\n", numch); - for(n = 0; n < numch && *numblocks != 0; n++) { - int res = read_block(numblocks, level+1, ctx, f, fn); - if (res < 0) - return res; - processed += res; + + + if (ss->ss_type == SS_DIRECT) { + printf("About to parse %ld direct sub-blocks\n", numch); + for(n = 0; n < numch && *numblocks != 0; n++) { + int res = read_block(numblocks, level+1, ctx, f, fn); + if (res < 0) + return res; + processed += res; + } } + else { + long rem = numch; + printf("About to parse %ld recursive sub-blocks\n", numch); + for(n = 0; n < numch && rem != 0; n++) { + int res = read_block(&rem, level+1, ctx, f, fn); + if (res < 0) + return res; + *numblocks -= res; + processed += res; + } + } } printf("blocks remaining at end of read_block routine = %ld (processed=%d)\n", *numblocks, processed);