Index: trunk/src/examples/project.lht =================================================================== --- trunk/src/examples/project.lht (revision 859) +++ trunk/src/examples/project.lht (revision 860) @@ -5,9 +5,10 @@ desc={long description of the example project} } li:library { - fs={./symbols} - fs={~/.cschem/symbols} - fs={$libdir$/symbols} +# fs={./symbols} + fs={./devmaps} +# fs={~/.cschem/symbols} +# fs={$libdir$/symbols} } li:sheets { psu=psu.lht Index: trunk/src/examples/psu.lht =================================================================== --- trunk/src/examples/psu.lht (revision 859) +++ trunk/src/examples/psu.lht (revision 860) @@ -57,6 +57,11 @@ uid=xxxxx2 name=R1 footprint=1206 + slot=165 + li:portmap={ + {165/1->pcb/pinnum=11} + {165/2->pcb/pinnum=22} + } } } ha:group_ref.21 { @@ -66,6 +71,7 @@ uid=xxxxx3 name=R2 footprint=1206 + devmap=swap2 } } Index: trunk/src/libcschem/compat.c =================================================================== --- trunk/src/libcschem/compat.c (revision 859) +++ trunk/src/libcschem/compat.c (nonexistent) @@ -1,37 +0,0 @@ -/* - * COPYRIGHT - * - * cschem - modular/flexible schematics editor - libcschem (core library) - * Copyright (C) 2018 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 - -char *csch_strdup(const char *s) -{ - int l = strlen(s); - char *o = malloc(l+1); - return memcpy(o, s, l+1); -} Index: trunk/src/libcschem/compat.h =================================================================== --- trunk/src/libcschem/compat.h (revision 859) +++ trunk/src/libcschem/compat.h (nonexistent) @@ -1,27 +0,0 @@ -/* - * COPYRIGHT - * - * cschem - modular/flexible schematics editor - libcschem (core library) - * Copyright (C) 2018 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") - */ - -char *csch_strdup(const char *s); Index: trunk/src/libcschem/Makefile.dep =================================================================== --- trunk/src/libcschem/Makefile.dep (revision 859) +++ trunk/src/libcschem/Makefile.dep (revision 860) @@ -38,7 +38,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/cnc_grp.h ../libcschem/cnc_line.h \ - ../libcschem/cnc_conn.h ../libcschem/vtoidpath.h ../libcschem/compat.h \ + ../libcschem/cnc_conn.h ../libcschem/vtoidpath.h \ ../../src_3rd/liblihata/dom.h ../../src_3rd/liblihata/lihata.h \ ../../src_3rd/liblihata/parser.h ../plugins/io_lihata/read.h attrib.o: attrib.c config.h ../libcschem/common_types.h \ @@ -47,7 +47,7 @@ ../../src_3rd/genvector/gds_char.h \ ../../src_3rd/genvector/genvector_impl.h \ ../../src_3rd/genvector/genvector_undef.h ../../src_3rd/genvector/vts0.h \ - ../../src_3rd/genvector/vtp0.h attrib.h compat.h + ../../src_3rd/genvector/vtp0.h attrib.h buildin.o: buildin.c ../../src_3rd/puplug/libs.h \ ../../src_3rd/puplug/puplug.h ../../src_3rd/puplug/os_dep.h \ ../../src_3rd/puplug/config.h ../../src_3rd/puplug/libs.h @@ -223,7 +223,7 @@ ../../src_3rd/genvector/gds_char.h ../libcschem/vtoid.h \ ../../src_3rd/genht/htip.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 compat.h \ + ../../src_3rd/gengeo2d/prim.h ../libcschem/TODO.h \ ../../src_3rd/genvector/genvector_impl.c project.o: project.c project.h ../libcschem/concrete.h \ ../libcschem/common_types.h ../libcschem/config.h ../libcschem/rtree.h \ Index: trunk/src/libcschem/Makefile.in =================================================================== --- trunk/src/libcschem/Makefile.in (revision 859) +++ trunk/src/libcschem/Makefile.in (revision 860) @@ -8,7 +8,6 @@ actions_csch.o attrib.o buildin.o - compat.o concrete.o cnc_any_obj.o cnc_arc.o Index: trunk/src/libcschem/abstract.c =================================================================== --- trunk/src/libcschem/abstract.c (revision 859) +++ trunk/src/libcschem/abstract.c (revision 860) @@ -31,7 +31,7 @@ #include #include "abstract.h" -#include "compat.h" +#include "compat_misc.h" void csch_ahdr_uninit(csch_ahdr_t *hdr) { @@ -127,7 +127,7 @@ net = calloc(sizeof(csch_anet_t), 1); csch_aobj_init(abs, &net->hdr, CSCH_ATYPE_NET); - net->netname = csch_strdup(netname); + net->netname = pcb_strdup(netname); htsp_set(&abs->nets, net->netname, net); return net; } @@ -142,7 +142,7 @@ comp = calloc(sizeof(csch_acomp_t), 1); csch_aobj_init(abs, &comp->hdr, CSCH_ATYPE_COMP); - comp->name = csch_strdup(name); + comp->name = pcb_strdup(name); htsp_set(&abs->comps, comp->name, comp); htsp_init(&comp->ports, strhash, strkeyeq); return comp; @@ -158,7 +158,7 @@ port = calloc(sizeof(csch_aport_t), 1); csch_aobj_init(abs, &port->hdr, CSCH_ATYPE_PORT); - port->name = csch_strdup(name); + port->name = pcb_strdup(name); htsp_set(&comp->ports, port->name, port); return port; } Index: trunk/src/libcschem/attrib.c =================================================================== --- trunk/src/libcschem/attrib.c (revision 859) +++ trunk/src/libcschem/attrib.c (revision 860) @@ -33,7 +33,7 @@ #include #include #include "attrib.h" -#include "compat.h" +#include "compat_misc.h" /*** low level attribute manipulation */ @@ -40,7 +40,7 @@ static csch_attrib_t *attr_alloc(const char *key, int prio) { csch_attrib_t *a = calloc(sizeof(csch_attrib_t), 1); - a->key = csch_strdup(key); + a->key = pcb_strdup(key); a->prio = prio; return a; } @@ -146,7 +146,7 @@ } attr_free_val(a); } - a->val = csch_strdup(val); + a->val = pcb_strdup(val); append_src(a, prio, source, 0); if (attr_out != NULL) *attr_out = a; return 0; @@ -176,7 +176,7 @@ } } append_src(a, prio, source, 0); - nval = csch_strdup(val); + nval = pcb_strdup(val); if (idx < a->arr.used) { free(a->arr.array[idx]); a->arr.array[idx] = nval; @@ -211,7 +211,7 @@ free(a->arr.array[n]); a->arr.used = 0; for(n = 0; n < val->used; n++) - vts0_set(&a->arr, n, csch_strdup(val->array[n])); + vts0_set(&a->arr, n, pcb_strdup(val->array[n])); if (attr_out != NULL) *attr_out = a; return 0; } @@ -222,9 +222,9 @@ size_t n; csch_attrib_t *dst = calloc(sizeof(csch_attrib_t), 1); - dst->key = csch_strdup(src->key); + dst->key = pcb_strdup(src->key); if (src->val != NULL) - dst->val = csch_strdup(src->val); + dst->val = pcb_strdup(src->val); else dst->val = NULL; dst->prio = src->prio; @@ -232,12 +232,12 @@ if (src->arr.used > 0) { vts0_enlarge(&dst->arr, src->arr.used); for(n = 0; n < src->arr.used; n++) - vts0_append(&dst->arr, csch_strdup(src->arr.array[n])); + vts0_append(&dst->arr, pcb_strdup(src->arr.array[n])); } if (src->source.used > 0) { vts0_enlarge(&dst->source, src->source.used); for(n = 0; n < src->source.used; n++) - vts0_append(&dst->source, csch_strdup(src->source.array[n])); + vts0_append(&dst->source, pcb_strdup(src->source.array[n])); } return dst; Index: trunk/src/libcschem/engine.c =================================================================== --- trunk/src/libcschem/engine.c (revision 859) +++ trunk/src/libcschem/engine.c (revision 860) @@ -31,7 +31,7 @@ #include #include "actions_csch.h" -#include "compat.h" +#include "compat_misc.h" #include "project.h" #include "engine.h" @@ -173,7 +173,7 @@ ares.val.str = NULL; } else /* need to dup static string */ - sres = csch_strdup(ares.val.str); + sres = pcb_strdup(ares.val.str); } fgw_arg_free(&view->fgw_ctx, &ares); } Index: trunk/src/libcschem/library.c =================================================================== --- trunk/src/libcschem/library.c (revision 859) +++ trunk/src/libcschem/library.c (revision 860) @@ -28,7 +28,7 @@ #include "config.h" #include "misc_util.h" -#include "compat.h" +#include "compat_misc.h" #include "message.h" #include "library.h" @@ -53,7 +53,7 @@ vts0_append(&it->open, pcb_concat(cwd, "/", p, NULL)); } else - vts0_append(&it->open, csch_strdup(p)); + vts0_append(&it->open, pcb_strdup(p)); } } Index: trunk/src/libcschem/plug_io.c =================================================================== --- trunk/src/libcschem/plug_io.c (revision 859) +++ trunk/src/libcschem/plug_io.c (revision 860) @@ -31,7 +31,7 @@ #include #include #include "plug_io.h" -#include "compat.h" +#include "compat_misc.h" #include "project.h" #include "safe_fs.h" #include "compat_lrealpath.h" @@ -189,7 +189,7 @@ free(sheet->filename); sheet->filename = real_fn; free(sheet->loadname); - sheet->loadname = csch_strdup(load_fn); + sheet->loadname = pcb_strdup(load_fn); sheet->load_pending = 0; real_fn = NULL; load_postproc_sheet(sheet); @@ -248,7 +248,7 @@ proj->filename = real_fn; real_fn = NULL; free(proj->loadname); - proj->loadname = csch_strdup(load_fn); + proj->loadname = pcb_strdup(load_fn); load_postproc_project(proj); break; } Index: trunk/src/libcschem/project.c =================================================================== --- trunk/src/libcschem/project.c (revision 859) +++ trunk/src/libcschem/project.c (revision 860) @@ -31,7 +31,7 @@ #include "libcschem.h" #include "compat_lrealpath.h" #include "compat_fs.h" -#include "compat.h" +#include "compat_misc.h" csch_project_t *csch_project_alloc(void) { @@ -133,7 +133,7 @@ if (pcb_is_path_abs(sheet->loadname)) { free(sheet->filename); - sheet->filename = csch_strdup(sheet->loadname); + sheet->filename = pcb_strdup(sheet->loadname); return 0; } @@ -163,11 +163,11 @@ prj->filename = real_fn; free(prj->prjdir); - prj->prjdir = csch_strdup(real_fn); + prj->prjdir = pcb_strdup(real_fn); end = strrchr(prj->prjdir, '/'); if (end == NULL) { free(prj->prjdir); - prj->prjdir = csch_strdup(pcb_get_wd(NULL)); + prj->prjdir = pcb_strdup(pcb_get_wd(NULL)); } else *end = '\0'; Index: trunk/src/plugins/io_lihata/read.c =================================================================== --- trunk/src/plugins/io_lihata/read.c (revision 859) +++ trunk/src/plugins/io_lihata/read.c (revision 860) @@ -34,9 +34,9 @@ #include #include #include -#include #include #include +#include "compat_misc.h" #include "read.h" #define error(node, args) \ @@ -258,7 +258,7 @@ { if ((src == NULL) || (src->type != LHT_TEXT)) return -1; - *dst = csch_strdup(src->data.text.value); + *dst = pcb_strdup(src->data.text.value); return 0; } @@ -559,7 +559,7 @@ } sheet = csch_sheet_alloc(ctx->proj, oid++); - sheet->loadname = csch_strdup(n->data.text.value); + sheet->loadname = pcb_strdup(n->data.text.value); sheet->load_pending = 1; csch_proj_sheet_update_filename(ctx->proj, sheet); vtp0_append(&ctx->proj->sheets, sheet); @@ -668,7 +668,7 @@ return -1; } - vts0_append(&ctx->proj->symlibs, csch_strdup(n->data.text.value)); + vts0_append(&ctx->proj->symlibs, pcb_strdup(n->data.text.value)); } } @@ -770,7 +770,7 @@ ctx.ver = strtol(ctx.doc->root->name+18, &end, 10); if (*end == '\0') { free(dst->loadname); - dst->loadname = csch_strdup(fn); + dst->loadname = pcb_strdup(fn); csch_proj_update_filename(dst); res = parse_project(&ctx, ctx.doc->root); } Index: trunk/src/plugins/std_devmap/std_devmap.c =================================================================== --- trunk/src/plugins/std_devmap/std_devmap.c (revision 859) +++ trunk/src/plugins/std_devmap/std_devmap.c (revision 860) @@ -107,7 +107,7 @@ real_name = csch_lib_find_next(&it); if (real_name != NULL) - real_name = csch_strdup(real_name); + real_name = pcb_strdup(real_name); csch_lib_find_free(&it); free(dmname);