long treestack_dump(Dataptr matrix, Treestack *sp, FILE *const outfp) /* pop all trees on stack *sp and dump them to file outfp; * first branch (number 0); return number of trees dumped */ { long cnt = 0; /* tree count */ long root; /* number of root branch */ Branch *barray; /* current unpacked tree */ /* "local" dynamic heap memory */ barray = treealloc(matrix); while ((treestack_pop(matrix, barray, &root, sp)) != 0){ treedump(matrix, outfp, barray); cnt++; } if (fflush(outfp) != 0) crash("file write error when dumping best trees"); /* free "local" dynamic heap memory */ free(barray); return cnt; } /* end bstdump() */
void sect2dump(void) { print("Sect 2:\n"); treedump(); }