Index: trunk/scconfig/Rev.h =================================================================== --- trunk/scconfig/Rev.h (revision 8972) +++ trunk/scconfig/Rev.h (revision 8973) @@ -1 +1 @@ -static const int myrev = 8972; +static const int myrev = 8973; Index: trunk/scconfig/Rev.tab =================================================================== --- trunk/scconfig/Rev.tab (revision 8972) +++ trunk/scconfig/Rev.tab (revision 8973) @@ -1,4 +1,4 @@ -8972 configure new source file in lib for sheet utils +8973 configure new source file for sheet utils 8741 configure enable the sim plugins by default 8712 configure new sources for sim gui and sim config 8169 configure lib_target: support plugin to get some attributes put in the tEDAx netlist Index: trunk/src/libcschem/util_sheet.c =================================================================== --- trunk/src/libcschem/util_sheet.c (revision 8972) +++ trunk/src/libcschem/util_sheet.c (nonexistent) @@ -1,38 +0,0 @@ -/* - * COPYRIGHT - * - * cschem - modular/flexible schematics editor - libcschem (core library) - * Copyright (C) 2023 Tibor 'Igor2' Palinkas - * - * (Supported by NLnet NGI0 Entrust in 2023) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version.* - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; 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 "config.h" - -#include - -#include "util_sheet.h" - -void csch_sheet_setup(csch_sheet_t *dst, csch_sheet_setup_cfg_t cfg, int (*chk_copy_pen)(void *udata, csch_sheet_t *dst), void *udata) -{ - -} Index: trunk/src/libcschem/util_sheet.h =================================================================== --- trunk/src/libcschem/util_sheet.h (revision 8972) +++ trunk/src/libcschem/util_sheet.h (nonexistent) @@ -1,12 +0,0 @@ -#include - -typedef enum csch_sheet_setup_cfg_e { /* bitfield */ - CSCH_SSC_PENS, - CSCH_SSC_UUID -} csch_sheet_setup_cfg_t; - -/* Copy defaults into dst (from the default sheet) as cfg dictates; if - CSCH_SSC_PENS is true chk_copy_pen is called on each pen and the pen - is copied only if it returns non-zero. If chk_copy_pen is NULL, it is - assumed to always return 1. */ -void csch_sheet_setup(csch_sheet_t *dst, csch_sheet_setup_cfg_t cfg, int (*chk_copy_pen)(void *udata, csch_sheet_t *dst), void *udata); Index: trunk/src/libcschem/Makefile.in =================================================================== --- trunk/src/libcschem/Makefile.in (revision 8972) +++ trunk/src/libcschem/Makefile.in (revision 8973) @@ -53,7 +53,6 @@ util_path.o util_parse.o util_project.o - util_sheet.o util_wirenet.o vtcoutline.o vtoid.o Index: trunk/src/plugins/lib_alien/read_helper.c =================================================================== --- trunk/src/plugins/lib_alien/read_helper.c (revision 8972) +++ trunk/src/plugins/lib_alien/read_helper.c (revision 8973) @@ -29,7 +29,7 @@ #include #include #include -#include +/*#include */ #include #include #include @@ -46,6 +46,7 @@ #include #include +#include #include #include @@ -373,23 +374,9 @@ dst->line.spec.p2.y = CRDY(y2); } - void csch_alien_sheet_setup(csch_alien_read_ctx_t *ctx, int pen) { - if (pen != 0) { /* create temp new sheet only if we are to do anything */ - csch_sheet_t *tmp = sch_rnd_sheet_new((csch_project_t *)ctx->sheet->hidlib.project); - if (pen != 0) { - htip_entry_t *e; - for(e = htip_first(&tmp->direct.id2obj); e != NULL; e = htip_next(&tmp->direct.id2obj, e)) { - csch_cpen_t *p = e->value; - if (p->hdr.type == CSCH_CTYPE_PEN) - csch_pen_dup(ctx->sheet, &ctx->sheet->direct, p); - } - } - minuid_gen(&csch_minuid, ctx->sheet->direct.uuid); - minuid_clr(ctx->sheet->direct.data.grp.src_uuid); - csch_project_remove_sheet((csch_project_t *)ctx->sheet->hidlib.project, tmp); - } + sch_rnd_sheet_setup(ctx->sheet, (pen ? SCH_RND_SSC_PENS : 0) | SCH_RND_SSC_UUID, NULL, NULL); } csch_cgrp_t *csch_alien_convert_to_grp(csch_alien_read_ctx_t *ctx, csch_chdr_t **obj) Index: trunk/src/sch-rnd/Makefile.in =================================================================== --- trunk/src/sch-rnd/Makefile.in (revision 8972) +++ trunk/src/sch-rnd/Makefile.in (revision 8973) @@ -32,6 +32,7 @@ project.o style.o sheet.o + util_sheet.o @] Index: trunk/src/sch-rnd/util_sheet.c =================================================================== --- trunk/src/sch-rnd/util_sheet.c (nonexistent) +++ trunk/src/sch-rnd/util_sheet.c (revision 8973) @@ -0,0 +1,58 @@ +/* + * COPYRIGHT + * + * cschem - modular/flexible schematics editor - libcschem (core library) + * Copyright (C) 2023 Tibor 'Igor2' Palinkas + * + * (Supported by NLnet NGI0 Entrust in 2023) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version.* + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; 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 "config.h" + +#include +#include +#include +#include +#include "sheet.h" + +#include "util_sheet.h" + +void sch_rnd_sheet_setup(csch_sheet_t *dst, sch_rnd_sheet_setup_cfg_t cfg, int (*chk_copy_pen)(void *udata, csch_sheet_t *dst, csch_cpen_t *p), void *udata) +{ + if (cfg & SCH_RND_SSC_PENS) { /* create temp new sheet only if we are to do anything */ + csch_sheet_t *tmp = sch_rnd_sheet_new((csch_project_t *)dst->hidlib.project); + htip_entry_t *e; + for(e = htip_first(&tmp->direct.id2obj); e != NULL; e = htip_next(&tmp->direct.id2obj, e)) { + csch_cpen_t *p = e->value; + if (p->hdr.type == CSCH_CTYPE_PEN) { + if ((chk_copy_pen == NULL) || chk_copy_pen(udata, dst, p)) + csch_pen_dup(dst, &dst->direct, p); + } + } + csch_project_remove_sheet((csch_project_t *)dst->hidlib.project, tmp); + } + + if (cfg & SCH_RND_SSC_UUID) { + minuid_gen(&csch_minuid, dst->direct.uuid); + minuid_clr(dst->direct.data.grp.src_uuid); + } +} Index: trunk/src/sch-rnd/util_sheet.h =================================================================== --- trunk/src/sch-rnd/util_sheet.h (nonexistent) +++ trunk/src/sch-rnd/util_sheet.h (revision 8973) @@ -0,0 +1,12 @@ +#include + +typedef enum sch_rnd_sheet_setup_cfg_e { /* bitfield */ + SCH_RND_SSC_PENS = 1, /* create pens */ + SCH_RND_SSC_UUID = 2 /* set up a new uuid for direct */ +} sch_rnd_sheet_setup_cfg_t; + +/* Copy defaults into dst (from the default sheet) as cfg dictates; if + CSCH_SSC_PENS is true chk_copy_pen is called on each pen and the pen + is copied only if it returns non-zero. If chk_copy_pen is NULL, it is + assumed to always return 1. */ +void sch_rnd_sheet_setup(csch_sheet_t *dst, sch_rnd_sheet_setup_cfg_t cfg, int (*chk_copy_pen)(void *udata, csch_sheet_t *dst, csch_cpen_t *p), void *udata);