Index: trunk/scconfig/Rev.h =================================================================== --- trunk/scconfig/Rev.h (revision 3269) +++ trunk/scconfig/Rev.h (revision 3270) @@ -1 +1 @@ -static const int myrev = 3260; +static const int myrev = 3270; Index: trunk/scconfig/Rev.tab =================================================================== --- trunk/scconfig/Rev.tab (revision 3269) +++ trunk/scconfig/Rev.tab (revision 3270) @@ -1,3 +1,4 @@ +3270 configure rename library.[ch] to util_fs_lib.[ch] for naming consistency 3260 configure new engine plugins: target_pcb, target_none 3225 configure new dialog box: view change/edit 3203 configure compile action Index: trunk/src/libcschem/library.c =================================================================== --- trunk/src/libcschem/library.c (revision 3269) +++ trunk/src/libcschem/library.c (nonexistent) @@ -1,93 +0,0 @@ -/* - * COPYRIGHT - * - * cschem - modular/flexible schematics editor - libcschem (core library) - * Copyright (C) 2019,2020 Tibor 'Igor2' Palinkas - * - * 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/cschem - * lead developer: email to cschem (at) igor2.repo.hu - * mailing list: cschem (at) list.repo.hu (send "subscribe") - */ - -#include -#include "config.h" -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "library.h" - - -char *csch_lib_fs_realpath(rnd_hidlib_t *hl, char *root) -{ - char *path = root, *rp; - - if (*path == '?') - path++; - - path = rnd_build_fn(hl, path); - rp = rnd_lrealpath(path); - free(path); - return rp; -} - -void csch_lib_fs_map(rnd_hidlib_t *hl, csch_lib_backend_t *be, csch_lib_t *parent, gds_t *path, csch_lib_type_t (*type_cb)(rnd_hidlib_t *, const char *fn)) -{ - DIR *dir; - struct dirent *de; - long save = path->used, restore; - csch_lib_t *newent; - - dir = rnd_opendir(hl, path->array); - if (dir == NULL) - return; - - gds_append(path, '/'); - restore = path->used; - - while((de = rnd_readdir(dir)) != NULL) { - if (*de->d_name == '.') continue; - - gds_append_str(path, de->d_name); - - if (rnd_is_dir(hl, path->array)) { - newent = csch_lib_alloc_append(be, parent, rnd_strdup(de->d_name), CSCH_SLIB_DIR); - csch_lib_fs_map(hl, be, newent, path, type_cb); - } - else { - csch_lib_type_t type = type_cb(hl, path->array); - if (type != CSCH_SLIB_invalid) - newent = csch_lib_alloc_append(be, parent, rnd_strdup(de->d_name), type); - else - newent = NULL; - } - if (newent != NULL) - newent->realpath = rnd_strdup(path->array); - path->used = restore; - } - - path->used = save; - rnd_closedir(dir); -} Index: trunk/src/libcschem/library.h =================================================================== --- trunk/src/libcschem/library.h (revision 3269) +++ trunk/src/libcschem/library.h (nonexistent) @@ -1,42 +0,0 @@ -/* - * COPYRIGHT - * - * cschem - modular/flexible schematics editor - libcschem (core library) - * Copyright (C) 2019 Tibor 'Igor2' Palinkas - * - * 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/cschem - * lead developer: email to cschem (at) igor2.repo.hu - * mailing list: cschem (at) list.repo.hu (send "subscribe") - */ - -#include "config.h" - -#include -#include - -#include - -#include - -/* look up library root_path's real path, skipping the ? prefix */ -char *csch_lib_fs_realpath(rnd_hidlib_t *hl, char *root_path); - -/* map path dir recursively for library entries; check each entry with - type_cb, if it returns invalid type, omit the entry. */ -void csch_lib_fs_map(rnd_hidlib_t *hl, csch_lib_backend_t *be, csch_lib_t *parent, gds_t *path, csch_lib_type_t (*type_cb)(rnd_hidlib_t *, const char *fn)); - Index: trunk/src/libcschem/Makefile.dep =================================================================== --- trunk/src/libcschem/Makefile.dep (revision 3269) +++ trunk/src/libcschem/Makefile.dep (revision 3270) @@ -68,7 +68,8 @@ ../../src_3rd/gengeo2d/box.h event.h cnc_grp.h ../libcschem/concrete.h \ cnc_obj.h attrib.h cnc_pen.h cnc_text.h ../libcschem/cnc_text_dyn.h \ ../libcschem/cnc_text.h cnc_any_obj.h cnc_loop.h op_common.h operation.h \ - message.h undo.h util_grp.h rotate.h + message.h undo.h util_grp.h rotate.h project.h ../libcschem/engine.h \ + abstract.h cnc_line.o: cnc_line.c config.h event.h concrete.h \ ../libcschem/common_types.h ../libcschem/config.h ../libcschem/rtree.h \ ../libcschem/attrib.h ../libcschem/oidpath.h ../libcschem/vtoid.h \ @@ -119,27 +120,29 @@ ../../src_3rd/gengeo2d/common.h ../../src_3rd/gengeo2d/prim.h TODO.h \ cnc_text.h ../libcschem/concrete.h ../libcschem/cnc_text_dyn.h \ ../libcschem/cnc_text.h cnc_obj.h attrib.h cnc_pen.h op_common.h \ - operation.h undo.h rotate.h ../../src_3rd/gengeo2d/box.h \ - ../../src_3rd/gengeo2d/vect.h ../../src_3rd/gengeo2d/xform.h -cnc_text_dyn.o: cnc_text_dyn.c config.h cnc_text.h \ - ../libcschem/concrete.h ../libcschem/common_types.h \ - ../libcschem/config.h ../libcschem/rtree.h ../libcschem/attrib.h \ + operation.h undo.h rotate.h project.h ../libcschem/engine.h \ + ../../src_3rd/gengeo2d/box.h ../../src_3rd/gengeo2d/vect.h \ + ../../src_3rd/gengeo2d/xform.h +cnc_text_dyn.o: cnc_text_dyn.c config.h abstract.h \ + ../libcschem/common_types.h ../libcschem/config.h ../libcschem/attrib.h \ + TODO.h cnc_text.h ../libcschem/concrete.h ../libcschem/rtree.h \ ../libcschem/oidpath.h ../libcschem/vtoid.h \ ../../src_3rd/libuundo/uundo.h \ ../../src_3rd/gengeo2d/typecfg_long_double.h ../../src_3rd/opc89.h \ ../../src_3rd/gengeo2d/common.h ../../src_3rd/gengeo2d/prim.h \ ../libcschem/TODO.h ../libcschem/cnc_text_dyn.h ../libcschem/cnc_text.h \ - cnc_text_dyn.h + cnc_grp.h cnc_text_dyn.h compile.o: compile.c config.h abstract.h ../libcschem/common_types.h \ ../libcschem/config.h ../libcschem/attrib.h TODO.h actions_csch.h \ message.h concrete.h ../libcschem/rtree.h ../libcschem/oidpath.h \ ../libcschem/vtoid.h ../../src_3rd/libuundo/uundo.h \ ../../src_3rd/gengeo2d/typecfg_long_double.h ../../src_3rd/opc89.h \ - ../../src_3rd/gengeo2d/common.h ../../src_3rd/gengeo2d/prim.h cnc_line.h \ - ../libcschem/concrete.h cnc_arc.h cnc_poly.h ../libcschem/vtcoutline.h \ - ../libcschem/cnc_arc.h ../libcschem/cnc_line.h cnc_bitmap.h cnc_conn.h \ - ../libcschem/vtoidpath.h cnc_grp.h cnc_pen.h engine.h project.h \ - ../libcschem/engine.h + ../../src_3rd/gengeo2d/common.h ../../src_3rd/gengeo2d/prim.h event.h \ + cnc_line.h ../libcschem/concrete.h cnc_arc.h cnc_poly.h \ + ../libcschem/vtcoutline.h ../libcschem/cnc_arc.h ../libcschem/cnc_line.h \ + cnc_text.h ../libcschem/cnc_text_dyn.h ../libcschem/cnc_text.h \ + cnc_bitmap.h cnc_conn.h ../libcschem/vtoidpath.h cnc_grp.h cnc_pen.h \ + engine.h project.h ../libcschem/engine.h concrete.o: concrete.c concrete.h ../libcschem/common_types.h \ ../libcschem/config.h ../libcschem/rtree.h ../libcschem/attrib.h \ ../libcschem/oidpath.h ../libcschem/vtoid.h \ @@ -195,7 +198,6 @@ ../../src_3rd/gengeo2d/typecfg_long_double.h ../../src_3rd/opc89.h \ ../../src_3rd/gengeo2d/common.h ../../src_3rd/gengeo2d/prim.h TODO.h \ undo.h -library.o: library.c config.h message.h library.h message.o: message.c config.h message.h oidpath.o: oidpath.c config.h oidpath.h ../libcschem/vtoid.h \ ../libcschem/common_types.h ../libcschem/config.h concrete.h \ @@ -257,7 +259,7 @@ ../../src_3rd/gengeo2d/typecfg_long_double.h ../../src_3rd/opc89.h \ ../../src_3rd/gengeo2d/common.h ../../src_3rd/gengeo2d/prim.h \ ../libcschem/TODO.h ../libcschem/engine.h libcschem.h message.h \ - plug_io.h ../libcschem/abstract.h + plug_io.h ../libcschem/abstract.h event.h project_act.o: project_act.c config.h event.h project.h \ ../libcschem/common_types.h ../libcschem/config.h \ ../libcschem/concrete.h ../libcschem/rtree.h ../libcschem/attrib.h \ @@ -301,6 +303,9 @@ cnc_grp.h ../libcschem/concrete.h cnc_pen.h cnc_text.h \ ../libcschem/cnc_text_dyn.h ../libcschem/cnc_text.h cnc_any_obj.h \ cnc_obj.h event.h attrib.h operation.h util_grp.h +util_lib_fs.o: util_lib_fs.c config.h util_lib_fs.h \ + ../libcschem/plug_library.h ../libcschem/common_types.h \ + ../libcschem/config.h util_parse.o: util_parse.c config.h ../../src_3rd/load_cache/load_cache.h \ cnc_any_obj.h concrete.h ../libcschem/common_types.h \ ../libcschem/config.h ../libcschem/rtree.h ../libcschem/attrib.h \ Index: trunk/src/libcschem/Makefile.in =================================================================== --- trunk/src/libcschem/Makefile.in (revision 3269) +++ trunk/src/libcschem/Makefile.in (revision 3270) @@ -32,7 +32,6 @@ integrity.o intersect.o libcschem.o - library.o message.o oidpath.o op_common.o @@ -47,6 +46,7 @@ undo.o util_compile.o util_grp.o + util_lib_fs.o util_parse.o util_wirenet.o vtcoutline.o Index: trunk/src/libcschem/util_lib_fs.c =================================================================== --- trunk/src/libcschem/util_lib_fs.c (nonexistent) +++ trunk/src/libcschem/util_lib_fs.c (revision 3270) @@ -0,0 +1,93 @@ +/* + * COPYRIGHT + * + * cschem - modular/flexible schematics editor - libcschem (core library) + * Copyright (C) 2019,2020 Tibor 'Igor2' Palinkas + * + * 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/cschem + * lead developer: email to cschem (at) igor2.repo.hu + * mailing list: cschem (at) list.repo.hu (send "subscribe") + */ + +#include +#include "config.h" +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "util_lib_fs.h" + + +char *csch_lib_fs_realpath(rnd_hidlib_t *hl, char *root) +{ + char *path = root, *rp; + + if (*path == '?') + path++; + + path = rnd_build_fn(hl, path); + rp = rnd_lrealpath(path); + free(path); + return rp; +} + +void csch_lib_fs_map(rnd_hidlib_t *hl, csch_lib_backend_t *be, csch_lib_t *parent, gds_t *path, csch_lib_type_t (*type_cb)(rnd_hidlib_t *, const char *fn)) +{ + DIR *dir; + struct dirent *de; + long save = path->used, restore; + csch_lib_t *newent; + + dir = rnd_opendir(hl, path->array); + if (dir == NULL) + return; + + gds_append(path, '/'); + restore = path->used; + + while((de = rnd_readdir(dir)) != NULL) { + if (*de->d_name == '.') continue; + + gds_append_str(path, de->d_name); + + if (rnd_is_dir(hl, path->array)) { + newent = csch_lib_alloc_append(be, parent, rnd_strdup(de->d_name), CSCH_SLIB_DIR); + csch_lib_fs_map(hl, be, newent, path, type_cb); + } + else { + csch_lib_type_t type = type_cb(hl, path->array); + if (type != CSCH_SLIB_invalid) + newent = csch_lib_alloc_append(be, parent, rnd_strdup(de->d_name), type); + else + newent = NULL; + } + if (newent != NULL) + newent->realpath = rnd_strdup(path->array); + path->used = restore; + } + + path->used = save; + rnd_closedir(dir); +} Index: trunk/src/libcschem/util_lib_fs.h =================================================================== --- trunk/src/libcschem/util_lib_fs.h (nonexistent) +++ trunk/src/libcschem/util_lib_fs.h (revision 3270) @@ -0,0 +1,42 @@ +/* + * COPYRIGHT + * + * cschem - modular/flexible schematics editor - libcschem (core library) + * Copyright (C) 2019 Tibor 'Igor2' Palinkas + * + * 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/cschem + * lead developer: email to cschem (at) igor2.repo.hu + * mailing list: cschem (at) list.repo.hu (send "subscribe") + */ + +#include "config.h" + +#include +#include + +#include + +#include + +/* look up library root_path's real path, skipping the ? prefix */ +char *csch_lib_fs_realpath(rnd_hidlib_t *hl, char *root_path); + +/* map path dir recursively for library entries; check each entry with + type_cb, if it returns invalid type, omit the entry. */ +void csch_lib_fs_map(rnd_hidlib_t *hl, csch_lib_backend_t *be, csch_lib_t *parent, gds_t *path, csch_lib_type_t (*type_cb)(rnd_hidlib_t *, const char *fn)); + Index: trunk/src/plugins/std_devmap/std_devmap.c =================================================================== --- trunk/src/plugins/std_devmap/std_devmap.c (revision 3269) +++ trunk/src/plugins/std_devmap/std_devmap.c (revision 3270) @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include #include Index: trunk/src/plugins/symlib_fs/symlib_fs.c =================================================================== --- trunk/src/plugins/symlib_fs/symlib_fs.c (revision 3269) +++ trunk/src/plugins/symlib_fs/symlib_fs.c (revision 3270) @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include Index: trunk/src/sch-rnd/Makefile.dep =================================================================== --- trunk/src/sch-rnd/Makefile.dep (revision 3269) +++ trunk/src/sch-rnd/Makefile.dep (revision 3270) @@ -436,9 +436,10 @@ ../../src_3rd/gengeo2d/typecfg_long_double.h ../../src_3rd/opc89.h \ ../../src_3rd/gengeo2d/common.h ../../src_3rd/gengeo2d/prim.h \ ../libcschem/engine.h ../libcschem/actions_csch.h ../libcschem/message.h \ - ../libcschem/libcschem.h ../libcschem/library.h ../libcschem/config.h \ - ../libcschem/plug_library.h ../libcschem/project.h \ - ../libcschem/util_parse.h ../plugins/sch_dialogs/quick_attr_util.h \ + ../libcschem/libcschem.h ../libcschem/util_lib_fs.h \ + ../libcschem/config.h ../libcschem/plug_library.h ../libcschem/project.h \ + ../libcschem/event.h ../libcschem/util_parse.h \ + ../plugins/sch_dialogs/quick_attr_util.h \ ../plugins/std_devmap/std_devmap_conf.h \ ../plugins/std_devmap/conf_internal.c \ ../plugins/std_devmap/quick_attr_portmap.c \ @@ -472,7 +473,8 @@ ../../src_3rd/libuundo/uundo.h \ ../../src_3rd/gengeo2d/typecfg_long_double.h ../../src_3rd/opc89.h \ ../../src_3rd/gengeo2d/common.h ../../src_3rd/gengeo2d/prim.h \ - ../libcschem/TODO.h ../libcschem/abstract.h ../libcschem/plug_library.h + ../libcschem/TODO.h ../libcschem/abstract.h ../libcschem/plug_library.h \ + ../libcschem/util_lib_fs.h ../libcschem/config.h ../plugins/symlib_local/symlib_local.o: \ ../plugins/symlib_local/symlib_local.c ../libcschem/config.h \ ../libcschem/concrete.h ../libcschem/common_types.h ../libcschem/rtree.h \