Index: trunk/scconfig/Rev.h =================================================================== --- trunk/scconfig/Rev.h (revision 10229) +++ trunk/scconfig/Rev.h (revision 10230) @@ -1 +1 @@ -static const int myrev = 10028; +static const int myrev = 10230; Index: trunk/scconfig/Rev.tab =================================================================== --- trunk/scconfig/Rev.tab (revision 10229) +++ trunk/scconfig/Rev.tab (revision 10230) @@ -1,3 +1,4 @@ +10230 configure new plugin for hierarchic library from file system 10028 configure hierarchy support 9983 configure io_orcad: enable by default 9928 configure librnd 4.1.0: remove local implementation of functionality moved into librnd Index: trunk/scconfig/plugins.h =================================================================== --- trunk/scconfig/plugins.h (revision 10229) +++ trunk/scconfig/plugins.h (revision 10230) @@ -29,6 +29,7 @@ plugin_def("std_tools", "standard drawing tools", sbuildin, 1) plugin_header("\nSymbol library accessors:\n") +plugin_def("hlibrary_fs", "hierarchic sheets (file system)", sbuildin, 1) plugin_def("symlib_fs", "file system symbols", sbuildin, 1) plugin_def("symlib_local", "sheet local symbols", sbuildin, 1) @@ -51,7 +52,7 @@ plugin_def("io_lihata", "lihata schematics and symbols", sbuildin, 1) plugin_def("io_ngrp_fawk", "fawk non-graphical sheets", sbuildin, 1) plugin_def("io_ngrp_tedax", "tEDAx non-graphical sheets", sbuildin, 1) -plugin_def("io_orcad", "OrCAD schematics", sdisable, 0) +plugin_def("io_orcad", "OrCAD schematics", sbuildin, 1) plugin_def("io_tinycad", "TinyCAD schematics", sbuildin, 1) plugin_def("lib_alien", "alien format helper", sbuildin, 1) plugin_def("lib_ngrp", "non-graphical seet helper", sbuildin, 1) Index: trunk/src/plugins/hlibrary_fs/Makefile =================================================================== --- trunk/src/plugins/hlibrary_fs/Makefile (nonexistent) +++ trunk/src/plugins/hlibrary_fs/Makefile (revision 10230) @@ -0,0 +1,2 @@ +all: + cd ../../sch-rnd && make mod_hlibrary_fs Index: trunk/src/plugins/hlibrary_fs/Plug.tmpasm =================================================================== --- trunk/src/plugins/hlibrary_fs/Plug.tmpasm (nonexistent) +++ trunk/src/plugins/hlibrary_fs/Plug.tmpasm (revision 10230) @@ -0,0 +1,10 @@ +put /local/rnd/mod {hlibrary_fs} +put /local/rnd/mod/OBJS [@ + $(PLUGDIR)/hlibrary_fs/hlibrary_fs.o +@] + +switch /local/module/hlibrary_fs/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/hlibrary_fs/hlibrary_fs.c =================================================================== --- trunk/src/plugins/hlibrary_fs/hlibrary_fs.c (nonexistent) +++ trunk/src/plugins/hlibrary_fs/hlibrary_fs.c (revision 10230) @@ -0,0 +1,128 @@ +/* + * COPYRIGHT + * + * cschem - modular/flexible schematics editor - library of hierarchic child sheets (from the local file system) + * Copyright (C) 2024 Tibor 'Igor2' Palinkas + * + * (Supported by NLnet NGI0 Entrust in 2024) + * + * 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 +#include + +static csch_lib_backend_t be_hlibrary_fs; + +static char *hlibrary_fs_realpath(rnd_design_t *hl, const char *root) +{ + /* accept only non-prefixed paths */ + if (strchr(root, '@') != NULL) + return NULL; + + return csch_lib_fs_realpath(hl, root); +} + +csch_lib_type_t hlibrary_fs_file_type(rnd_design_t *hl, const char *fn) +{ + return CSCH_SLIB_STATIC; + TODO("test-parse and return this if not a sheet:"); + return CSCH_SLIB_invalid; +} + +static int hlibrary_fs_map(rnd_design_t *hl, csch_lib_t *root_dir) +{ + gds_t tmp = {0}; + gds_append_str(&tmp, root_dir->realpath); + csch_lib_fs_map(hl, &be_hlibrary_fs, root_dir, &tmp, hlibrary_fs_file_type); + gds_uninit(&tmp); + return 0; +} + +static int hlibrary_fs_load(csch_sheet_t *sheet, void *dst_, csch_lib_t *src, const char *params) +{ + csch_sheet_t *dst = dst_; + csch_cgrp_t *grp = NULL; + + switch(src->type) { + case CSCH_SLIB_PARAMETRIC: + rnd_message(RND_MSG_ERROR, "hlibrary_fs_load(): can't handle parametric\n"); + return -1; + + case CSCH_SLIB_STATIC: + TODO("call the loader?"); +/* grp = csch_load_grp(dst, src->realpath, NULL);*/ + return -1; + break; + + case CSCH_SLIB_invalid: + case CSCH_SLIB_DIR: + return -1; + } + + if (grp == NULL) + return -1; + + grp->sym_prefer_loclib = 1; + csch_cgrp_render_all(dst, &dst->direct); + csch_cobj_update(dst, &dst->direct.hdr, 1); + + return 0; +} + +static void hlibrary_fs_free(csch_lib_t *src) +{ +} + + +int pplg_check_ver_hlibrary_fs(int ver_needed) { return 0; } + +void pplg_uninit_hlibrary_fs(void) +{ + +} + +int pplg_init_hlibrary_fs(void) +{ + RND_API_CHK_VER; + + be_hlibrary_fs.name = "hlibrary_fs"; + be_hlibrary_fs.realpath = hlibrary_fs_realpath; + be_hlibrary_fs.map = hlibrary_fs_map; + be_hlibrary_fs.load = hlibrary_fs_load; /* loads a group into dst sheet */ + be_hlibrary_fs.free = hlibrary_fs_free; + + csch_lib_backend_reg(csch_lib_get_master("hlibrary", 1), &be_hlibrary_fs); + + return 0; +} + Index: trunk/src/plugins/hlibrary_fs/hlibrary_fs.pup =================================================================== --- trunk/src/plugins/hlibrary_fs/hlibrary_fs.pup (nonexistent) +++ trunk/src/plugins/hlibrary_fs/hlibrary_fs.pup (revision 10230) @@ -0,0 +1,7 @@ +$class symlib +$short hierarchic sheets (file system) +$long access libraries of hierarchic child sheets stored on the local file system +$state works +$package (core) +default buildin +autoload 1 Index: trunk/src/plugins/plugins_ALL.tmpasm =================================================================== --- trunk/src/plugins/plugins_ALL.tmpasm (revision 10229) +++ trunk/src/plugins/plugins_ALL.tmpasm (revision 10230) @@ -14,6 +14,7 @@ include {../src/plugins/export_tedax/Plug.tmpasm} include {../src/plugins/funcmap/Plug.tmpasm} include {../src/plugins/gui/Plug.tmpasm} +include {../src/plugins/hlibrary_fs/Plug.tmpasm} include {../src/plugins/io_altium/Plug.tmpasm} include {../src/plugins/io_geda/Plug.tmpasm} include {../src/plugins/io_lihata/Plug.tmpasm}