Index: trunk/src_plugins/io_tedax/footprint.c =================================================================== --- trunk/src_plugins/io_tedax/footprint.c (revision 27350) +++ trunk/src_plugins/io_tedax/footprint.c (revision 27351) @@ -171,7 +171,7 @@ return 0; } -int tedax_fp_fsave_subc(pcb_subc_t *subc, const char *fpname, int lyrecipe, FILE *f) +int tedax_fp_fsave_subc_(pcb_subc_t *subc, const char *fpname, int lyrecipe, FILE *f) { htsp_t terms; htsp_entry_t *e; @@ -274,6 +274,21 @@ } +int tedax_fp_fsave_subc(pcb_subc_t *subc, FILE *f) +{ + const char *fpname = pcb_attribute_get(&subc->Attributes, "tedax::footprint"); + if (fpname == NULL) + fpname = pcb_attribute_get(&subc->Attributes, "visible_footprint"); + if (fpname == NULL) + fpname = pcb_attribute_get(&subc->Attributes, "footprint"); + if ((fpname == NULL) && (subc->refdes != NULL)) + fpname = subc->refdes; + if (fpname == NULL) + fpname = "-"; + + return tedax_fp_fsave_subc_(subc, fpname, 0, f); +} + int tedax_fp_fsave(pcb_data_t *data, FILE *f, long subc_idx) { int res = 0; @@ -284,19 +299,8 @@ PCB_SUBC_LOOP(data) { - if ((subc_idx == -1) || (subc_idx == cnt)) { - const char *fpname = pcb_attribute_get(&subc->Attributes, "tedax::footprint"); - if (fpname == NULL) - fpname = pcb_attribute_get(&subc->Attributes, "visible_footprint"); - if (fpname == NULL) - fpname = pcb_attribute_get(&subc->Attributes, "footprint"); - if ((fpname == NULL) && (subc->refdes != NULL)) - fpname = subc->refdes; - if (fpname == NULL) - fpname = "-"; - - res |= tedax_fp_fsave_subc(subc, fpname, 0, f); - } + if ((subc_idx == -1) || (subc_idx == cnt)) + res |= tedax_fp_fsave_subc(subc, f); cnt++; } PCB_END_LOOP; Index: trunk/src_plugins/io_tedax/footprint.h =================================================================== --- trunk/src_plugins/io_tedax/footprint.h (revision 27350) +++ trunk/src_plugins/io_tedax/footprint.h (revision 27351) @@ -3,6 +3,7 @@ int tedax_fp_save(pcb_data_t *data, const char *fn, long subc_idx); int tedax_fp_fsave(pcb_data_t *data, FILE *f, long subc_idx); +int tedax_fp_fsave_subc(pcb_subc_t *subc, FILE *f); int tedax_fp_load(pcb_data_t *data, const char *fn, int multi, const char *blk_id, int silent); /* parse a single footprint at current file pos; returns NULL on error */ @@ -9,7 +10,7 @@ pcb_subc_t *tedax_parse_1fp(pcb_data_t *data, FILE *fn, char *buff, int buff_size, char *argv[], int argv_size); /* Save a single subc, with footprint header */ -int tedax_fp_fsave_subc(pcb_subc_t *subc, const char *fpname, int lyrecipe, FILE *f); +int tedax_fp_fsave_subc_(pcb_subc_t *subc, const char *fpname, int lyrecipe, FILE *f); int tedax_pstk_fsave(pcb_pstk_t *padstack, pcb_coord_t ox, pcb_coord_t oy, FILE *f); Index: trunk/src_plugins/io_tedax/io_tedax.c =================================================================== --- trunk/src_plugins/io_tedax/io_tedax.c (revision 27350) +++ trunk/src_plugins/io_tedax/io_tedax.c (revision 27351) @@ -183,11 +183,22 @@ return tedax_fp_load(Ptr, name, 0, NULL, 0); } -static int io_tedax_write_element(pcb_plug_io_t *ctx, FILE *f, pcb_data_t *dt, long subc_idx) +int io_tedax_fp_write_subcs_head(pcb_plug_io_t *ctx, void **udata, FILE *f, int lib, long num_subcs) { - return tedax_fp_fsave(dt, f, subc_idx); + fprintf(f, "tEDAx v1\n"); + return 0; } +int io_tedax_fp_write_subcs_subc(pcb_plug_io_t *ctx, void **udata, FILE *f, pcb_subc_t *subc) +{ + return tedax_fp_fsave_subc(subc, f); +} + +int io_tedax_fp_write_subcs_tail(pcb_plug_io_t *ctx, void **udata, FILE *f) +{ + return 0; +} + static int io_tedax_test_parse(pcb_plug_io_t *plug_ctx, pcb_plug_iot_t typ, const char *Filename, FILE *f) { char line[515], *s; @@ -249,7 +260,9 @@ io_tedax.parse_footprint = io_tedax_parse_element; io_tedax.parse_font = NULL; io_tedax.write_buffer = NULL; - io_tedax.write_footprint = io_tedax_write_element; + io_tedax.write_subcs_head = io_tedax_fp_write_subcs_head; + io_tedax.write_subcs_subc = io_tedax_fp_write_subcs_subc; + io_tedax.write_subcs_tail = io_tedax_fp_write_subcs_tail; io_tedax.write_pcb = NULL; io_tedax.default_fmt = "tEDAx"; io_tedax.description = "Trivial EDA eXchange format"; Index: trunk/src_plugins/io_tedax/tboard.c =================================================================== --- trunk/src_plugins/io_tedax/tboard.c (revision 27350) +++ trunk/src_plugins/io_tedax/tboard.c (revision 27351) @@ -95,7 +95,7 @@ int res; subc2fpname(fpname, subc); - res = tedax_fp_fsave_subc(subc, fpname, 1, f); + res = tedax_fp_fsave_subc_(subc, fpname, 1, f); assert(res == 0); } return 0;