Index: trunk/scconfig/Rev.h =================================================================== --- trunk/scconfig/Rev.h (revision 7506) +++ trunk/scconfig/Rev.h (revision 7507) @@ -1 +1 @@ -static const int myrev = 7502; +static const int myrev = 7506; Index: trunk/scconfig/Rev.tab =================================================================== --- trunk/scconfig/Rev.tab (revision 7506) +++ trunk/scconfig/Rev.tab (revision 7507) @@ -1,4 +1,4 @@ -7502 configure new plugin: export_spice +7506 configure new plugins: export_spice, target_spice 7469 configure new plugin for non-graphical fawk sheets 7468 configure new plugin for non-graphical tEDAx sheets 7370 configure cleanup: get rid of local "inline" defs Index: trunk/scconfig/plugins.h =================================================================== --- trunk/scconfig/plugins.h (revision 7506) +++ trunk/scconfig/plugins.h (revision 7507) @@ -10,6 +10,7 @@ plugin_def("std_forge", "standard cschem attr forge", sbuildin, 1) plugin_def("target_none", "dummy attr. xform", sbuildin, 1) plugin_def("target_pcb", "attr. xform for PCB workflow", sbuildin, 1) +plugin_def("target_spice", "attr. xform for SPICE workflow", sbuildin, 1) plugin_header("\nFeature plugins:\n") plugin_def("act_draw", "Draw object actions", sbuildin, 1) Index: trunk/src/plugins/plugins_ALL.tmpasm =================================================================== --- trunk/src/plugins/plugins_ALL.tmpasm (revision 7506) +++ trunk/src/plugins/plugins_ALL.tmpasm (revision 7507) @@ -34,3 +34,4 @@ include {../src/plugins/symlib_local/Plug.tmpasm} include {../src/plugins/target_none/Plug.tmpasm} include {../src/plugins/target_pcb/Plug.tmpasm} +include {../src/plugins/target_spice/Plug.tmpasm} Index: trunk/src/plugins/target_spice/Makefile =================================================================== --- trunk/src/plugins/target_spice/Makefile (nonexistent) +++ trunk/src/plugins/target_spice/Makefile (revision 7507) @@ -0,0 +1,2 @@ +all: + cd ../../sch-rnd && make mod_target_spice Index: trunk/src/plugins/target_spice/Plug.tmpasm =================================================================== --- trunk/src/plugins/target_spice/Plug.tmpasm (nonexistent) +++ trunk/src/plugins/target_spice/Plug.tmpasm (revision 7507) @@ -0,0 +1,10 @@ +put /local/rnd/mod {target_spice} +put /local/rnd/mod/OBJS [@ + $(PLUGDIR)/target_spice/target_spice.o +@] + +switch /local/module/target_spice/controls + case {buildin} include /local/csch/tmpasm/buildin; end; + case {plugin} include /local/csch/tmpasm/plugin; end; + case {disable} include /local/csch/tmpasm/disable; end; +end Index: trunk/src/plugins/target_spice/target_spice.c =================================================================== --- trunk/src/plugins/target_spice/target_spice.c (nonexistent) +++ trunk/src/plugins/target_spice/target_spice.c (revision 7507) @@ -0,0 +1,108 @@ +/* + * COPYRIGHT + * + * cschem - modular/flexible schematics editor - attr. transf. for PCB workflow + * Copyright (C) 2023 Tibor 'Igor2' Palinkas + * + * (Supported by NLnet NGI0 Entrust in 2022) + * + * 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/sch-rnd + * contact lead developer: http://www.repo.hu/projects/sch-rnd/contact.html + * mailing list: http://www.repo.hu/projects/sch-rnd/contact.html + */ + +#include + +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +/*** hooks ***/ + +fgw_error_t target_spice_compile_port(fgw_arg_t *res, int argc, fgw_arg_t *argv) +{ +/* csch_hook_call_ctx_t *cctx = argv[0].val.argv0.user_call_ctx;*/ + fgw_obj_t *obj = argv[0].val.argv0.func->obj; + csch_view_eng_t *eng = obj->script_data; + csch_aport_t *port; + const char *pinnum; + csch_source_arg_t *src; + + + CSCH_HOOK_CONVARG(1, FGW_AOBJ, std_cschem_comp_update, port = fgw_aobj(&argv[1])); + assert(port->hdr.type == CSCH_ATYPE_PORT); + + pinnum = csch_attrib_get_str(&port->hdr.attr, "spice/pinnum"); + if (pinnum != NULL) + src = csch_attrib_src_pa(&port->hdr, "spice/pinnum", "target_spice", NULL); + + if (pinnum == NULL) { + pinnum = csch_attrib_get_str(&port->hdr.attr, "pinnum"); + if (pinnum != NULL) + src = csch_attrib_src_pa(&port->hdr, "pinnum", "target_spice", NULL); + } + if (pinnum == NULL) { + pinnum = port->name; + if (pinnum != NULL) + src = csch_attrib_src_p("target_spice", "fallback on port name"); + } + + if (pinnum != NULL) + csch_attrib_set(&port->hdr.attr, eng->eprio + CSCH_PRI_PLUGIN_NORMAL, "display/name", pinnum, src, NULL); + + return 0; +} + +static int on_load(fgw_obj_t *obj, const char *filename, const char *opts) +{ + fgw_func_reg(obj, "compile_port", target_spice_compile_port); + obj->script_data = obj->script_user_call_ctx; /* save eng ptr */ + return 0; +} + +static const fgw_eng_t fgw_target_spice_eng = { + "target_spice", + csch_c_call_script, + NULL, + on_load, + NULL, /* on_unload */ +}; + +int pplg_check_ver_target_spice(int ver_needed) { return 0; } + +void pplg_uninit_target_spice(void) +{ +} + +int pplg_init_target_spice(void) +{ + RND_API_CHK_VER; + + fgw_eng_reg(&fgw_target_spice_eng); + return 0; +} + Index: trunk/src/plugins/target_spice/target_spice.pup =================================================================== --- trunk/src/plugins/target_spice/target_spice.pup (nonexistent) +++ trunk/src/plugins/target_spice/target_spice.pup (revision 7507) @@ -0,0 +1,7 @@ +$class engine +$short attr. xform for SPICE workflow +$long Attribute transformations for the SPICE workflow +$state works +$package (core) +default buildin +autoload 1