Index: trunk/src/examples/psu.lht =================================================================== --- trunk/src/examples/psu.lht (revision 1356) +++ trunk/src/examples/psu.lht (revision 1357) @@ -38,11 +38,11 @@ # (visible) objects directly under the sheet ha:obj_direct.2 { li:objects { - ha:pen.1 { shape=circle; size=250; color=#777777; name=sheet-decor; } - ha:pen.3 { shape=circle; size=250; color=#2222BB; name=wire; } - ha:pen.5 { shape=circle; size=250; color=#991111; name=terminal; } - ha:pen.8 { shape=circle; size=250; color=#119911; name=sym-decor; } - ha:pen.13 { shape=circle; size=800; color=#2222BB; name=junction; } + ha:pen.sheet-decor { shape=circle; size=250; color=#777777; } + ha:pen.wire { shape=circle; size=250; color=#2222BB; } + ha:pen.terminal { shape=circle; size=250; color=#991111; } + ha:pen.sym-decor { shape=circle; size=250; color=#119911; } + ha:pen.junction { shape=circle; size=800; color=#2222BB; } ha:group_ref.20 { x=10000; y=10000; rot=0; mirror=x; Index: trunk/src/libcschem/cnc_pen.c =================================================================== --- trunk/src/libcschem/cnc_pen.c (revision 1356) +++ trunk/src/libcschem/cnc_pen.c (revision 1357) @@ -49,9 +49,13 @@ return pen_shape_names[shape]; } -csch_cpen_t *csch_pen_alloc(csch_sheet_t *sheet, csch_cgrp_t *parent, csch_oid_t oid, const char *name) +csch_cpen_t *csch_pen_alloc(csch_sheet_t *sheet, csch_cgrp_t *parent, const char *name) { csch_cpen_t *pen; + csch_oid_t oid; + + sheet->auto_oid--; + oid = sheet->auto_oid; pen = htip_get(&parent->id2obj, oid); if (pen != NULL) @@ -67,7 +71,7 @@ csch_cpen_t *csch_pen_dup(csch_sheet_t *sheet, csch_cgrp_t *parent, const csch_cpen_t *src) { - csch_cpen_t *dst = csch_pen_alloc(sheet, parent, src->hdr.oid, src->name); + csch_cpen_t *dst = csch_pen_alloc(sheet, parent, src->name); dst->shape = src->shape; dst->size = src->size; dst->color = src->color; Index: trunk/src/libcschem/cnc_pen.h =================================================================== --- trunk/src/libcschem/cnc_pen.h (revision 1356) +++ trunk/src/libcschem/cnc_pen.h (revision 1357) @@ -69,7 +69,7 @@ const char *csch_pen_shape_name(csch_pen_shape_t shape); -csch_cpen_t *csch_pen_alloc(csch_sheet_t *sheet, csch_cgrp_t *parent, csch_oid_t oid, const char *name); +csch_cpen_t *csch_pen_alloc(csch_sheet_t *sheet, csch_cgrp_t *parent, const char *name); csch_cpen_t *csch_pen_dup(csch_sheet_t *sheet, csch_cgrp_t *parent, const csch_cpen_t *src); void csch_pen_free(csch_cpen_t *pen); csch_cpen_t *csch_pen_get(csch_sheet_t *sheet, csch_cgrp_t *grp, const char *name); Index: trunk/src/libcschem/concrete.h =================================================================== --- trunk/src/libcschem/concrete.h (revision 1356) +++ trunk/src/libcschem/concrete.h (revision 1357) @@ -158,6 +158,7 @@ /* caches and temporary storage */ uundo_list_t undo; htsp_t comm_str; /* common strings, like pen names, stored only once; key=strdup(str), val=NULL; referenceed as csch_comm_str_t */ + csch_oid_t auto_oid; /* negative oids for objects that have automatically assigned oid; decrease first, use after */ unsigned int load_pending:1; /* when set, the sheet has not yet been loaded (but got referenced from the project file) */ unsigned int loose_sym:1; /* allow editing symbol part objects, bypassing the symbol lock */ Index: trunk/src/plugins/io_lihata/read.c =================================================================== --- trunk/src/plugins/io_lihata/read.c (revision 1356) +++ trunk/src/plugins/io_lihata/read.c (revision 1357) @@ -176,9 +176,11 @@ if (sep != NULL) { len = sep - nd->name; - oid = load_oid(ctx, parent, nd, sep+1); - if (oid == 0) - return -1; + if (strncmp(nd->name, "pen.", 4) != 0) { + oid = load_oid(ctx, parent, nd, sep+1); + if (oid == 0) + return -1; + } } else len = strlen(nd->name); @@ -345,23 +347,14 @@ { csch_cpen_t *pen; const char *name = NULL; - lht_node_t *nname; if (subtree == NULL) return 0; - if (oid == 0) - return -1; + name = subtree->name + 4; + printf("pen name='%s' '%s'\n", subtree->name, name); - nname = lht_dom_hash_get(subtree, "name"); - if (nname != NULL) { - if (nname->type == LHT_TEXT) - name = nname->data.text.value; - else - error(nname, ("pen name must be a text node\n")); - } - - pen = csch_pen_alloc(ctx->sheet, parent, oid, name); + pen = csch_pen_alloc(ctx->sheet, parent, name); if (pen == NULL) { error(subtree, ("failed to allocate pen\n")); return -1;