Index: trunk/scconfig/Rev.h =================================================================== --- trunk/scconfig/Rev.h (revision 6680) +++ trunk/scconfig/Rev.h (revision 6681) @@ -1 +1 @@ -static const int myrev = 6294; +static const int myrev = 6681; Index: trunk/scconfig/Rev.tab =================================================================== --- trunk/scconfig/Rev.tab (revision 6680) +++ trunk/scconfig/Rev.tab (revision 6681) @@ -1,3 +1,4 @@ +6681 configure new libcschem source file for project support 6294 configure remove excess export API 6180 configure move plug_io_act from lib to sch-rnd as it depends on sch-rnd assumptions on project file naming and file formats and other implementation-specific details 6070 configure rnd_printf support for %rc for printing 'k' coords properly Index: trunk/src/libcschem/Makefile.dep =================================================================== --- trunk/src/libcschem/Makefile.dep (revision 6680) +++ trunk/src/libcschem/Makefile.dep (revision 6681) @@ -68,10 +68,11 @@ ../../src_3rd/gengeo2d/xform.h ../../src_3rd/gengeo2d/vect.h \ ../../src_3rd/gengeo2d/box.h event.h cnc_grp.h ../libcschem/concrete.h \ cnc_grp_child.h ../libcschem/cnc_any_obj.h ../libcschem/concrete.h \ - ../libcschem/rotate.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 undo.h util_grp.h rotate.h project.h \ - ../libcschem/engine.h abstract.h TODO.h libcschem.h cnc_grp_ref.c + ../libcschem/rotate.h cnc_conn.h ../libcschem/vtoidpath.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 \ + undo.h util_grp.h rotate.h project.h ../libcschem/engine.h abstract.h \ + TODO.h libcschem.h cnc_grp_ref.c 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 \ @@ -338,6 +339,13 @@ ../../src_3rd/gengeo2d/common.h ../../src_3rd/gengeo2d/prim.h engine.h \ project.h ../libcschem/concrete.h ../libcschem/engine.h util_parse.h \ ../libcschem/project.h +util_project.o: util_project.c config.h util_project.h \ + ../libcschem/concrete.h ../libcschem/common_types.h \ + ../libcschem/config.h ../libcschem/rtree.h ../libcschem/attrib.h \ + ../libcschem/oidpath.h ../libcschem/vtoid.h \ + ../../src_3rd/libuundo/uundo.h ../../src_3rd/libminuid/libminuid.h \ + ../../src_3rd/gengeo2d/typecfg_long_double.h ../../src_3rd/opc89.h \ + ../../src_3rd/gengeo2d/common.h ../../src_3rd/gengeo2d/prim.h util_wirenet.o: util_wirenet.c config.h search.h ../libcschem/concrete.h \ ../libcschem/common_types.h ../libcschem/config.h ../libcschem/rtree.h \ ../libcschem/attrib.h ../libcschem/oidpath.h ../libcschem/vtoid.h \ Index: trunk/src/libcschem/Makefile.in =================================================================== --- trunk/src/libcschem/Makefile.in (revision 6680) +++ trunk/src/libcschem/Makefile.in (revision 6681) @@ -50,6 +50,7 @@ util_lib_fs.o util_loclib.o util_parse.o + util_project.o util_wirenet.o vtcoutline.o vtoid.o Index: trunk/src/libcschem/util_project.c =================================================================== --- trunk/src/libcschem/util_project.c (nonexistent) +++ trunk/src/libcschem/util_project.c (revision 6681) @@ -0,0 +1,40 @@ +/* + * COPYRIGHT + * + * cschem - modular/flexible schematics editor - sch-rnd (executable) + * 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 "util_project.h" + +void csch_sheet_type_detect(csch_sheet_t *sheet, const rnd_conflist_t *roots, const rnd_conflist_t *aux) +{ + csch_project_t *prj = (csch_project_t *)sheet->hidlib.project; + sheet->stype = CSCH_SHTY_unknown; + if (prj == NULL) + return; +} + Index: trunk/src/libcschem/util_project.h =================================================================== --- trunk/src/libcschem/util_project.h (nonexistent) +++ trunk/src/libcschem/util_project.h (revision 6681) @@ -0,0 +1,11 @@ +#ifndef CSCH_UTIL_PROJECT_H +#define CSCH_UTIL_PROJECT_H + +#include +#include + +/* Look at sheet's project and fill in sheet->type accordingly + (root, aux or unlisted) */ +void csch_sheet_type_detect(csch_sheet_t *sheet, const rnd_conflist_t *roots, const rnd_conflist_t *aux); + +#endif Index: trunk/src/sch-rnd/Makefile.dep =================================================================== --- trunk/src/sch-rnd/Makefile.dep (revision 6680) +++ trunk/src/sch-rnd/Makefile.dep (revision 6681) @@ -806,7 +806,7 @@ ../../src_3rd/gengeo2d/common.h ../../src_3rd/gengeo2d/prim.h \ ../libcschem/plug_library.h ../libcschem/event.h ../libcschem/plug_io.h \ ../libcschem/abstract.h ../libcschem/TODO.h sheet.h conf_core.h \ - build_run.h + build_run.h multi.h project.h font.o: font.c ../libcschem/config.h ../libcschem/cnc_pen.h \ ../libcschem/concrete.h ../libcschem/common_types.h ../libcschem/rtree.h \ ../libcschem/attrib.h ../libcschem/oidpath.h ../libcschem/vtoid.h \ @@ -858,7 +858,8 @@ ../../src_3rd/gengeo2d/typecfg_long_double.h ../../src_3rd/opc89.h \ ../../src_3rd/gengeo2d/common.h ../../src_3rd/gengeo2d/prim.h \ ../libcschem/project.h ../libcschem/engine.h ../libcschem/util_parse.h \ - ../../src_3rd/load_cache/load_cache.h multi.h conf_core.h + ../../src_3rd/load_cache/load_cache.h ../libcschem/event.h multi.h \ + conf_core.h sch-rnd.o: sch-rnd.c config.h ../libcschem/config.h \ ../libcschem/libcschem.h ../../src_3rd/libminuid/libminuid.h \ ../libcschem/project.h ../libcschem/common_types.h \ Index: trunk/src/sch-rnd/multi.c =================================================================== --- trunk/src/sch-rnd/multi.c (revision 6680) +++ trunk/src/sch-rnd/multi.c (revision 6681) @@ -39,6 +39,7 @@ #include #include +#include #include #include "conf_core.h" @@ -235,7 +236,10 @@ csch_sheet_t *sch_rnd_multi_load(const char *fn, const char *fmt, int *is_project) { - return sch_rnd_multi_load_(fn, fmt, NULL, is_project); + csch_sheet_t *sheet = sch_rnd_multi_load_(fn, fmt, NULL, is_project); + if ((sheet != NULL) && (sheet->stype == CSCH_SHTY_unknown)) + csch_sheet_type_detect(sheet, &conf_core.prj.root_sheets, &conf_core.prj.aux_sheets); + return sheet; } csch_sheet_t *sch_rnd_multi_new_empty(const char *fn) Index: trunk/src/sch-rnd/project.c =================================================================== --- trunk/src/sch-rnd/project.c (revision 6680) +++ trunk/src/sch-rnd/project.c (revision 6681) @@ -33,7 +33,7 @@ #include #include #include -#include "librnd/core/compat_lrealpath.h" +#include #include #include #include