Index: trunk/scconfig/Rev.h =================================================================== --- trunk/scconfig/Rev.h (revision 8344) +++ trunk/scconfig/Rev.h (revision 8345) @@ -1 +1 @@ -static const int myrev = 8329; +static const int myrev = 8345; Index: trunk/scconfig/Rev.tab =================================================================== --- trunk/scconfig/Rev.tab (revision 8344) +++ trunk/scconfig/Rev.tab (revision 8345) @@ -1,4 +1,4 @@ -8329 configure new sources for sim gui and sim config +8345 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 8344) +++ trunk/src/plugins/sim/Plug.tmpasm (revision 8345) @@ -1,6 +1,7 @@ put /local/rnd/mod {sim} put /local/rnd/mod/OBJS [@ $(PLUGDIR)/sim/sim.o + $(PLUGDIR)/sim/util.o @] put /local/rnd/mod/CONFFILE {sim.conf} Index: trunk/src/plugins/sim/util.c =================================================================== --- trunk/src/plugins/sim/util.c (nonexistent) +++ trunk/src/plugins/sim/util.c (revision 8345) @@ -0,0 +1,66 @@ +/* + * 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 "util.h" + +void sim_append_print_mod(gds_t *tmp, lht_node_t *nmod, const char *fld_sep) +{ + const char *skip = NULL; + int first = 1; + lht_node_t *n; + lht_dom_iterator_t it; + + assert(nmod->type == LHT_HASH); + + if (strcmp(nmod->name, "add") == 0) { + lht_node_t *ntype = lht_dom_hash_get(nmod, "type"); + + if (ntype != NULL) { + skip = "type"; + gds_append_str(tmp, ntype->data.text.value); + first = 0; + } + } + + for(n = lht_dom_first(&it, nmod); n != NULL; n = lht_dom_next(&it)) { + if ((skip != NULL) && (strcmp(n->name, skip) == 0)) + continue; + if (!first) + gds_append_str(tmp, fld_sep); + gds_append_str(tmp, n->name); + gds_append(tmp, '='); + if (n->type == LHT_TEXT) + gds_append_str(tmp, n->data.text.value); + else + gds_append_str(tmp, ""); + first = 0; + } +} Index: trunk/src/plugins/sim/util.h =================================================================== --- trunk/src/plugins/sim/util.h (nonexistent) +++ trunk/src/plugins/sim/util.h (revision 8345) @@ -0,0 +1,6 @@ +#include +#include + +/* print the content of a sim mod item (hash) appending it to tmp */ +void sim_append_print_mod(gds_t *tmp, lht_node_t *nmod, const char *fld_sep); +