Index: trunk/scconfig/Rev.h =================================================================== --- trunk/scconfig/Rev.h (revision 8515) +++ trunk/scconfig/Rev.h (revision 8516) @@ -1 +1 @@ -static const int myrev = 8452; +static const int myrev = 8516; Index: trunk/scconfig/Rev.tab =================================================================== --- trunk/scconfig/Rev.tab (revision 8515) +++ trunk/scconfig/Rev.tab (revision 8516) @@ -1,4 +1,4 @@ -8452 configure new sources for sim gui and sim config +8516 configure new sources for sim gui and sim config 8169 configure lib_target: support plugin to get some attributes put in the tEDAx netlist 8150 configure bom export plugin 8124 configure sch_dialogs: stance dialog Index: trunk/src/plugins/sim/Plug.tmpasm =================================================================== --- trunk/src/plugins/sim/Plug.tmpasm (revision 8515) +++ trunk/src/plugins/sim/Plug.tmpasm (revision 8516) @@ -2,6 +2,7 @@ put /local/rnd/mod/OBJS [@ $(PLUGDIR)/sim/sim.o $(PLUGDIR)/sim/sim_conf.o + $(PLUGDIR)/sim/mods.o $(PLUGDIR)/sim/util.o @] Index: trunk/src/plugins/sim/mods.c =================================================================== --- trunk/src/plugins/sim/mods.c (nonexistent) +++ trunk/src/plugins/sim/mods.c (revision 8516) @@ -0,0 +1,49 @@ +/* + * COPYRIGHT + * + * cschem - modular/flexible schematics editor - high level sim (non-GUI) + * Copyright (C) 2023 Tibor 'Igor2' Palinkas + * + * (Supported by NLnet NGI0 Entrust in 2023) + * + * 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 "sim_conf.h" + +#include "mods.h" + +int sch_sim_mods_perform(csch_project_t *prj, const char *setup_name, csch_abstract_t *abst) +{ + if (setup_name == NULL) + setup_name = sch_sim_conf.plugins.sim.active_setup; + + if ((setup_name == NULL) || (*setup_name == "")) { + rnd_message(RND_MSG_ERROR, "Failed to perform modifications for simulation setup:\nactive simulation setup name is empty\n"); + return -1; + } + + return -1; +} + Index: trunk/src/plugins/sim/mods.h =================================================================== --- trunk/src/plugins/sim/mods.h (nonexistent) +++ trunk/src/plugins/sim/mods.h (revision 8516) @@ -0,0 +1,7 @@ +#include +#include + +/* Look at the current project's setup called setup_name and execute all + the mods it has on abst. If setup_name is NULL, get it from the current + config. */ +int sch_sim_mods_perform(csch_project_t *prj, const char *setup_name, csch_abstract_t *abst); Index: trunk/src/plugins/sim/sim_conf.h =================================================================== --- trunk/src/plugins/sim/sim_conf.h (revision 8515) +++ trunk/src/plugins/sim/sim_conf.h (revision 8516) @@ -2,6 +2,7 @@ #define SCH_RND_SIM_CONF_H #include +#include typedef struct { const struct { Index: trunk/src/plugins/sim_ngspice/sim_ngspice.c =================================================================== --- trunk/src/plugins/sim_ngspice/sim_ngspice.c (revision 8515) +++ trunk/src/plugins/sim_ngspice/sim_ngspice.c (revision 8516) @@ -115,6 +115,7 @@ static fgw_error_t sim_ngspice_compile_project_after(fgw_arg_t *res, int argc, fgw_arg_t *argv) { + int r = 0; /* csch_hook_call_ctx_t *cctx = argv[0].val.argv0.user_call_ctx;*/ fgw_obj_t *obj = argv[0].val.argv0.func->obj; /* spicelib_ctx_t *ctx = obj->script_data; - because the object is used there */ @@ -127,9 +128,12 @@ rnd_trace("NGSPICE project after\n"); if (spice_compile_project_after != NULL) - return spice_compile_project_after(res, argc, argv); + r = spice_compile_project_after(res, argc, argv); - return 0; + if (sch_sim_mods_perform(prj, NULL, abst) != 0) + return -1; + + return r; }