Index: eagle_bin/test_parser/eagle_bin.c =================================================================== --- eagle_bin/test_parser/eagle_bin.c (revision 9555) +++ eagle_bin/test_parser/eagle_bin.c (revision 9556) @@ -4,6 +4,7 @@ #include #include "eagle_bin.h" +#include "egb_tree.h" /* Describe a bitfield: width of the field that hosts the bitfield, first and last bit offsets, inclusive. Bit offsets are starting from 0 at LSB. */ @@ -2092,7 +2093,7 @@ } -int read_block(long *numblocks, int level, void *ctx, FILE *f, const char *fn) +int read_block(long *numblocks, int level, void *ctx, FILE *f, const char *fn, egb_node_t *parent) { unsigned char block[24]; char tmp[25]; @@ -2178,7 +2179,7 @@ long lp = 0; printf("%s #About to parse %ld direct sub-blocks for %s {\n", ind, numch, ss->tree_name); for(n = 0; n < numch && *numblocks > 0; n++) { - int res = read_block(numblocks, level+1, ctx, f, fn); + int res = read_block(numblocks, level+1, ctx, f, fn, parent); if (res < 0) return res; processed += res; @@ -2193,7 +2194,7 @@ numch--; rem = numch; for(n = 0; n < numch && rem > 0; n++) { - int res = read_block(&rem, level+1, ctx, f, fn); + int res = read_block(&rem, level+1, ctx, f, fn, parent); if (res < 0) return res; *numblocks -= res; @@ -2212,14 +2213,16 @@ int pcb_egle_bin_load(void *ctx, FILE *f, const char *fn) { - long *numblocks = NULL; + long test = -1; + long *numblocks = &test; int res = 0; - long test = -1; - numblocks = &test; - + egb_node_t *root; + printf("blocks remaining prior to function call = %ld\n", *numblocks); - res = read_block(numblocks, 1, ctx, f, fn); + root = egb_node_alloc(0, "eagle"); + + res = read_block(numblocks, 1, ctx, f, fn, root); if (res < 0) { return res; } @@ -2231,6 +2234,10 @@ read_notes(ctx, f, fn); read_drc(ctx, f, fn); + printf("@@@ tree @@@\n"); + egb_dump(stdout, root); + egb_node_free(root); + return 0; }