Index: Plug.tmpasm =================================================================== --- Plug.tmpasm (revision 27402) +++ Plug.tmpasm (revision 27403) @@ -7,6 +7,7 @@ $(PLUGDIR)/io_tedax/tlayer.o $(PLUGDIR)/io_tedax/tboard.o $(PLUGDIR)/io_tedax/tdrc.o + $(PLUGDIR)/io_tedax/tetest.o $(PLUGDIR)/io_tedax/parse.o @] Index: io_tedax.c =================================================================== --- io_tedax.c (revision 27402) +++ io_tedax.c (revision 27403) @@ -46,6 +46,7 @@ #include "tlayer.h" #include "tboard.h" #include "tdrc.h" +#include "tetest.h" #include "tnetlist.h" static const char *tedax_cookie = "tEDAx IO"; @@ -64,7 +65,7 @@ } -static const char pcb_acts_Savetedax[] = "SaveTedax(netlist|board-footprints|stackup|layer|board|drc, filename)"; +static const char pcb_acts_Savetedax[] = "SaveTedax(netlist|board-footprints|stackup|layer|board|drc|etest, filename)"; static const char pcb_acth_Savetedax[] = "Saves the specific type of data in a tEDAx file."; static fgw_error_t pcb_act_Savetedax(fgw_arg_t *res, int argc, fgw_arg_t *argv) { @@ -103,6 +104,11 @@ return 0; } + if (pcb_strcasecmp(type, "etest") == 0) { + PCB_ACT_IRES(tedax_etest_save(PCB, NULL, fname)); + return 0; + } + PCB_ACT_FAIL(Savetedax); PCB_ACT_IRES(1); return 0; Index: tetest.c =================================================================== --- tetest.c (nonexistent) +++ tetest.c (revision 27403) @@ -0,0 +1,78 @@ +/* + * COPYRIGHT + * + * pcb-rnd, interactive printed circuit board design + * + * tedax IO plugin - electric test export + * pcb-rnd Copyright (C) 2019 Tibor 'Igor2' Palinkas + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Contact: + * Project page: http://repo.hu/projects/pcb-rnd + * lead developer: http://repo.hu/projects/pcb-rnd/contact.html + * mailing list: pcb-rnd (at) list.repo.hu (send "subscribe") + */ + +#include "config.h" + +#include +#include + +#include "board.h" +#include "data.h" +#include "parse.h" +#include "safe_fs.h" +#include "error.h" +#include "tetest.h" +#include "rtree.h" + + +int tedax_etest_fsave(pcb_board_t *pcb, const char *etestid, FILE *f) +{ + pcb_box_t *b; + pcb_rtree_it_t it; + + fprintf(f, "begin etest v1 "); + tedax_fprint_escape(f, etestid); + fputc('\n', f); + + for(b = pcb_r_first(pcb->Data->padstack_tree, &it); b != NULL; b = pcb_r_next(&it)) { + pcb_pstk_t *ps = b; + assert(ps->type == PCB_OBJ_PSTK); + } + pcb_r_end(&it); + + + fprintf(f, "end etest\n"); + return 0; +} + +int tedax_etest_save(pcb_board_t *pcb, const char *etestid, const char *fn) +{ + int res; + FILE *f; + + f = pcb_fopen_askovr(&PCB->hidlib, fn, "w", NULL); + if (f == NULL) { + pcb_message(PCB_MSG_ERROR, "tedax_etest_save(): can't open %s for writing\n", fn); + return -1; + } + fprintf(f, "tEDAx v1\n"); + res = tedax_etest_fsave(pcb, etestid, f); + fclose(f); + return res; +} + Index: tetest.h =================================================================== --- tetest.h (nonexistent) +++ tetest.h (revision 27403) @@ -0,0 +1,4 @@ +#include "board.h" + +int tedax_etest_save(pcb_board_t *pcb, const char *etestid, const char *fn); +int tedax_etest_fsave(pcb_board_t *pcb, const char *etestid, FILE *f);