Index: trunk/src/libcschem/attrib.c =================================================================== --- trunk/src/libcschem/attrib.c (revision 3989) +++ trunk/src/libcschem/attrib.c (revision 3990) @@ -83,7 +83,7 @@ free(a); } -void csch_attr_src_uninit(csch_source_arg_t *src) +void csch_attr_src_free(csch_source_arg_t *src) { if (src == NULL) return; @@ -92,6 +92,7 @@ src->source = NULL; free(src->desc); src->desc = NULL; + free(src); } /*** API functions ***/ @@ -178,7 +179,7 @@ int csch_attrib_set(csch_attribs_t *attribs, int prio, const char *key, const char *val, csch_source_arg_t *source, csch_attrib_t **attr_out) { int res = csch_attrib_set_nofree(attribs, prio, key, val, source, attr_out); - csch_attr_src_uninit(source); + csch_attr_src_free(source); return res; } @@ -213,11 +214,11 @@ } vts0_set(&a->arr, idx, nval); if (attr_out != NULL) *attr_out = a; - csch_attr_src_uninit(source); + csch_attr_src_free(source); return 0; error:; - csch_attr_src_uninit(source); + csch_attr_src_free(source); return -1; } @@ -254,7 +255,7 @@ int csch_attrib_set_arr(csch_attribs_t *attribs, int prio, const char *key, const vts0_t *val, csch_source_arg_t *source, csch_attrib_t **attr_out) { int res = csch_attrib_set_arr_nofree(attribs, prio, key, val, source, attr_out); - csch_attr_src_uninit(source); + csch_attr_src_free(source); return res; } @@ -292,13 +293,13 @@ csch_attrib_t *a = htsp_get((csch_attribs_t *)attribs, key); if (a == NULL) { - csch_attr_src_uninit(source); + csch_attr_src_free(source); return -1; } a->deleted = 1; append_src(a, prio, source, 0); - csch_attr_src_uninit(source); + csch_attr_src_free(source); return 0; } @@ -315,7 +316,7 @@ err |= csch_attrib_set_arr_nofree(dst, a->prio, a->key, &a->arr, source, NULL); } - csch_attr_src_uninit(source); + csch_attr_src_free(source); return err; } @@ -503,7 +504,7 @@ undo_attr_modify_swap(u); if (undoable) csch_undo_inc_serial(sheet); - csch_attr_src_uninit(source); + csch_attr_src_free(source); } void csch_attr_modify_del(csch_sheet_t *sheet, csch_cgrp_t *obj, const char *key, int undoable) @@ -874,9 +875,10 @@ } -void csch_attrib_plugin_source_c(csch_source_arg_t *dst, const char *filename, long line, long col, const char *desc) +csch_source_arg_t *csch_attrib_plugin_source_c(const char *filename, long line, long col, const char *desc) { gds_t tmp = {0}; + csch_source_arg_t *dst = calloc(sizeof(csch_source_arg_t), 1); dst->type[0] = 'c'; dst->type[1] = '\0'; @@ -892,11 +894,13 @@ dst->source = rnd_strdup(filename); dst->desc = rnd_strdup(desc); + return dst; } -void csch_attrib_plugin_source_ac(csch_source_arg_t *dst, csch_chdr_t *cobj, const char *attr_name, const char *desc) +csch_source_arg_t *csch_attrib_plugin_source_ac(csch_chdr_t *cobj, const char *attr_name, const char *desc) { gds_t tmp = {0}; + csch_source_arg_t *dst = calloc(sizeof(csch_source_arg_t), 1);; csch_oidpath_t oidp = {0}; dst->type[0] = 'a'; @@ -915,11 +919,15 @@ dst->source = tmp.array; dst->desc = rnd_strdup(desc); + + return dst; } -void csch_attrib_plugin_source_pa(csch_source_arg_t *dst, csch_ahdr_t *aobj, const char *attr_name, const char *plugin_name, const char *desc) +csch_source_arg_t *csch_attrib_plugin_source_pa(csch_ahdr_t *aobj, const char *attr_name, const char *plugin_name, const char *desc) { + csch_source_arg_t *dst = calloc(sizeof(csch_source_arg_t), 1);; + dst->type[0] = 'p'; dst->type[1] = 'a'; dst->type[2] = '\0'; @@ -938,10 +946,14 @@ else dst->source = rnd_strdup_printf("%ld,%s,%s", aobj->aid, attr_name, plugin_name); dst->desc = rnd_strdup(desc); + + return dst; } -void csch_attrib_plugin_source_p(csch_source_arg_t *dst, const char *plugin_name, const char *desc) +csch_source_arg_t *csch_attrib_plugin_source_p(const char *plugin_name, const char *desc) { + csch_source_arg_t *dst = calloc(sizeof(csch_source_arg_t), 1);; + dst->type[0] = 'p'; dst->type[1] = '\0'; @@ -950,5 +962,7 @@ dst->source = rnd_strdup(plugin_name); dst->desc = rnd_strdup(desc); + + return dst; } Index: trunk/src/libcschem/attrib.h =================================================================== --- trunk/src/libcschem/attrib.h (revision 3989) +++ trunk/src/libcschem/attrib.h (revision 3990) @@ -59,10 +59,10 @@ /* Create source info in dst for different source addressing schemes, as specified in {des4:19} */ -void csch_attrib_plugin_source_c(csch_source_arg_t *dst, const char *filename, long line, long col, const char *desc); -void csch_attrib_plugin_source_ac(csch_source_arg_t *dst, csch_chdr_t *cobj, const char *attr_name, const char *desc); -void csch_attrib_plugin_source_pa(csch_source_arg_t *dst, csch_ahdr_t *aobj, const char *attr_name, const char *plugin_name, const char *desc); -void csch_attrib_plugin_source_p(csch_source_arg_t *dst, const char *plugin_name, const char *desc); +csch_source_arg_t *csch_attrib_plugin_source_c(const char *filename, long line, long col, const char *desc); +csch_source_arg_t *csch_attrib_plugin_source_ac(csch_chdr_t *cobj, const char *attr_name, const char *desc); +csch_source_arg_t *csch_attrib_plugin_source_pa(csch_ahdr_t *aobj, const char *attr_name, const char *plugin_name, const char *desc); +csch_source_arg_t *csch_attrib_plugin_source_p(const char *plugin_name, const char *desc); typedef htsp_t csch_attribs_t; @@ -80,17 +80,17 @@ /* Set a scalar attribute; the ptr version takes malloc()'d val and source; return 0 on write, -1 on failure or if the attrib didn't change because of prios - (ptr means "use the ptr provided, don't strdup"). src fields are always free'd. */ + (ptr means "use the ptr provided, don't strdup"). src is always free'd. */ int csch_attrib_set(csch_attribs_t *attribs, int prio, const char *key, const char *val, csch_source_arg_t *source, csch_attrib_t **attr_out); int csch_attrib_setptr(csch_attribs_t *attribs, int prio, const char *key, char *val, csch_source_arg_t *source); int csch_attrib_set_arr(csch_attribs_t *attribs, int prio, const char *key, const vts0_t *val, csch_source_arg_t *source, csch_attrib_t **attr_out); -/* Same as above, but for arrays: overwrite an existing item; src fields are always free'd. */ +/* Same as above, but for arrays: overwrite an existing item; src is always free'd. */ int csch_attrib_seti(csch_attribs_t *attribs, int prio, const char *key, long idx, const char *val, csch_source_arg_t *source, csch_attrib_t **attr_out); int csch_attrib_setiptr(csch_attribs_t *attribs, int prio, const char *key, long idx, char *val, csch_source_arg_t *source, csch_attrib_t **attr_out); -/* Prepend or append to an array; src fields are always free'd.*/ +/* Prepend or append to an array; src is always free'd.*/ int csch_attrib_prepend(csch_attribs_t *attribs, int prio, const char *key, const char *val, csch_source_arg_t *source); int csch_attrib_prependptr(csch_attribs_t *attribs, int prio, const char *key, char *val, csch_source_arg_t *source); int csch_attrib_append(csch_attribs_t *attribs, int prio, const char *key, const char *val, csch_source_arg_t *source); @@ -98,7 +98,7 @@ /* Del a key from an attribute hash; if history is not NULL, the key is kept and the value is emptied so source history is preserved. - src fields are always free'd. */ + src is always free'd. */ int csch_attrib_del(csch_attribs_t *attribs, int prio, const char *key, csch_source_arg_t *source); @@ -110,7 +110,7 @@ csch_attrib_t *csch_attrib_dup(csch_attrib_t *src); /* copy each src attrib to dst using a forced source; returns 0 on success; - src fields are always free'd. */ + src is always free'd. */ int csch_attrib_apply(csch_attribs_t *dst, const csch_attribs_t *src, csch_source_arg_t *source); unsigned csch_attrib_hash(const csch_attribs_t *attr); @@ -119,7 +119,7 @@ /* Standard undoable mod functions; negative prio means: keep original if possible, use positive version of the prio if original is not available; - src fields are always free'd. */ + src is always free'd. */ void csch_attr_modify_str(csch_sheet_t *sheet, csch_cgrp_t *obj, int prio, const char *key, const char *val, csch_source_arg_t *source, int undoable); void csch_attr_modify_del(csch_sheet_t *sheet, csch_cgrp_t *obj, const char *key, int undoable); void csch_attr_arr_modify_ins_before(csch_sheet_t *sheet, csch_cgrp_t *obj, const char *key, long idx, const char *newval, int undoable); @@ -129,8 +129,8 @@ void csch_attr_modify_conv_to_arr(csch_sheet_t *sheet, csch_cgrp_t *obj, const char *key, int undoable); void csch_attr_modify_conv_to_str(csch_sheet_t *sheet, csch_cgrp_t *obj, const char *key, int undoable); -/* Free fields of src */ -void csch_attr_src_uninit(csch_source_arg_t *src); +/* Free fields of src and src itself */ +void csch_attr_src_free(csch_source_arg_t *src); /*** implementation ***/ Index: trunk/src/libcschem/compile.c =================================================================== --- trunk/src/libcschem/compile.c (revision 3989) +++ trunk/src/libcschem/compile.c (revision 3990) @@ -56,7 +56,7 @@ htsp_entry_t *e; for(e = htsp_first(src); e; e = htsp_next(src, e)) { const csch_attrib_t *a = e->value, *aa; - csch_source_arg_t src; + csch_source_arg_t *src; int append = 0; const char *key = a->key; @@ -70,7 +70,7 @@ aa = csch_attrib_get(&dst->attr, key); - csch_attrib_plugin_source_ac(&src, &cgrp->hdr, a->key, "compile_attributes()"); + src = csch_attrib_plugin_source_ac(&cgrp->hdr, a->key, "compile_attributes()"); /* attribute merging logic */ if (a->val != NULL) { @@ -95,7 +95,7 @@ } } } - csch_attrib_set(&dst->attr, a->prio, key, a->val, &src, NULL); + csch_attrib_set(&dst->attr, a->prio, key, a->val, src, NULL); } else { if (append) { @@ -107,7 +107,7 @@ continue; } else - csch_attrib_set_arr(&dst->attr, a->prio, key, &a->arr, &src, NULL); + csch_attrib_set_arr(&dst->attr, a->prio, key, &a->arr, src, NULL); } } return 0; Index: trunk/src/libcschem/util_grp.c =================================================================== --- trunk/src/libcschem/util_grp.c (revision 3989) +++ trunk/src/libcschem/util_grp.c (revision 3990) @@ -182,11 +182,11 @@ void csch_auto_attr_create(csch_sheet_t *sheet, csch_cgrp_t *grp, const char *key, const char *val, const char *stroke, const char *atempl) { - static csch_source_arg_t src; + csch_source_arg_t *src; - csch_attrib_plugin_source_c(&src, NULL, 0, 0, NULL); + src = csch_attrib_plugin_source_c(NULL, 0, 0, NULL); - csch_cobj_attrib_set(sheet, grp, CSCH_ATP_USER_DEFAULT, key, val, &src); + csch_cobj_attrib_set(sheet, grp, CSCH_ATP_USER_DEFAULT, key, val, src); if (stroke != NULL) csch_auto_attr_place(sheet, grp, key, stroke, atempl); } Index: trunk/src/libcschem/util_loclib.c =================================================================== --- trunk/src/libcschem/util_loclib.c (revision 3989) +++ trunk/src/libcschem/util_loclib.c (revision 3990) @@ -48,7 +48,7 @@ csch_cgrp_t *grp = e->value; const char *gpurp = csch_attrib_get_str(&grp->attr, "purpose"); if ((gpurp != NULL) && (strcmp(gpurp, master->name) == 0)) { - csch_attr_src_uninit(src); + csch_attr_src_free(src); return grp; } } @@ -61,7 +61,7 @@ return grp; } - csch_attr_src_uninit(src); + csch_attr_src_free(src); return NULL; } @@ -79,7 +79,7 @@ if (master->uid >= sheet->local_libs.used) { rnd_message(RND_MSG_ERROR, "%s: master out of bounds #1\nPlease report this bug!\n", master->name); - csch_attr_src_uninit(src); + csch_attr_src_free(src); return -1; } @@ -86,7 +86,7 @@ libroot = sheet->local_libs.array[master->uid]; if (libroot->roots.used < 1) { rnd_message(RND_MSG_ERROR, "%s: master out of bounds #2\nPlease report this bug!\n", master->name); - csch_attr_src_uninit(src); + csch_attr_src_free(src); return -1; } Index: trunk/src/libcschem/util_parse.c =================================================================== --- trunk/src/libcschem/util_parse.c (revision 3989) +++ trunk/src/libcschem/util_parse.c (revision 3990) @@ -92,7 +92,7 @@ lht_node_t *i, *np, *nv; long idx; const char *val; - csch_source_arg_t src; + csch_source_arg_t *src; if (dstg != NULL) { assert(csch_obj_is_grp(&dstg->hdr)); @@ -101,19 +101,19 @@ switch(n->type) { case LHT_TEXT: /* plain text: scalar attrib */ val = n->data.text.value; - csch_attrib_plugin_source_c(&src, n->file_name, n->line, n->col, NULL); + src = csch_attrib_plugin_source_c(n->file_name, n->line, n->col, NULL); if (dstg != NULL) - csch_cobj_attrib_set(sheet, dstg, prio, key, val, &src); + csch_cobj_attrib_set(sheet, dstg, prio, key, val, src); else - csch_attrib_set(dsta, prio, key, val, &src, NULL); + csch_attrib_set(dsta, prio, key, val, src, NULL); break; case LHT_LIST: /* array attrib */ /* first create the attribute as an empty array, just in case it is indeed an empty arrya with no child */ - csch_attrib_plugin_source_c(&src, n->file_name, n->line, n->col, NULL); + src = csch_attrib_plugin_source_c(n->file_name, n->line, n->col, NULL); if (dstg != NULL) - csch_cobj_attrib_set(sheet, dstg, prio, key, NULL, &src); + csch_cobj_attrib_set(sheet, dstg, prio, key, NULL, src); else - csch_attrib_set(dsta, prio, key, NULL, &src, NULL); + csch_attrib_set(dsta, prio, key, NULL, src, NULL); for(i = n->data.list.first, idx = 0; i != NULL; i = i->next) { if (i->type != LHT_TEXT) { @@ -121,11 +121,11 @@ continue; } val = i->data.text.value; - csch_attrib_plugin_source_c(&src, i->file_name, i->line, i->col, NULL); + src = csch_attrib_plugin_source_c(i->file_name, i->line, i->col, NULL); if (dstg != NULL) - csch_cobj_attrib_seti(sheet, dstg, prio, key, idx, val, &src); + csch_cobj_attrib_seti(sheet, dstg, prio, key, idx, val, src); else - csch_attrib_seti(dsta, prio, key, idx, val, &src, NULL); + csch_attrib_seti(dsta, prio, key, idx, val, src, NULL); idx++; } break; Index: trunk/src/libcschem/util_wirenet.c =================================================================== --- trunk/src/libcschem/util_wirenet.c (revision 3989) +++ trunk/src/libcschem/util_wirenet.c (revision 3990) @@ -98,10 +98,10 @@ csch_cgrp_t *csch_wirenet_new(csch_sheet_t *sheet) { - csch_source_arg_t src; + csch_source_arg_t *src; csch_cgrp_t *grp = (csch_cgrp_t *)csch_op_create(sheet, &sheet->direct, CSCH_CTYPE_GRP); - csch_attrib_plugin_source_c(&src, NULL, 0, 0, "manual_draw_wirenet"); + src = csch_attrib_plugin_source_c(NULL, 0, 0, "manual_draw_wirenet"); if (grp == NULL) { rnd_message(RND_MSG_ERROR, "Internal error: failed to create direct group for wirenet\n"); @@ -108,7 +108,7 @@ return NULL; } - csch_attrib_set(&grp->attr, 0, "role", "wire-net", &src, NULL); + csch_attrib_set(&grp->attr, 0, "role", "wire-net", src, NULL); csch_cgrp_attrib_update(sheet, grp, 0, "role", "wire-net"); if (sheet->util_wirenet.recalc_inhibit) @@ -457,9 +457,8 @@ } if (new_name != NULL) { - csch_source_arg_t src; - csch_attrib_plugin_source_c(&src, NULL, 0, 0, "graphical network merge"); - csch_attrib_set(&grp->attr, 0, "name", new_name, &src, NULL); + csch_source_arg_t *src = csch_attrib_plugin_source_c(NULL, 0, 0, "graphical network merge"); + csch_attrib_set(&grp->attr, 0, "name", new_name, src, NULL); csch_wirenet_invalidate_dyntext(sheet, grp); } Index: trunk/src/plugins/io_geda/read.c =================================================================== --- trunk/src/plugins/io_geda/read.c (revision 3989) +++ trunk/src/plugins/io_geda/read.c (revision 3990) @@ -321,9 +321,7 @@ static csch_source_arg_t *geda_src(read_ctx_t *ctx) { - static csch_source_arg_t src; - csch_attrib_plugin_source_c(&src, ctx->fn, ctx->lineno, 0, NULL); - return &src; + return csch_attrib_plugin_source_c(ctx->fn, ctx->lineno, 0, NULL); } /* Create a text object and create attribue as needed. read_line returns an @@ -478,7 +476,7 @@ { long x1, y1, x2, y2; int color, pintype, whichend; - csch_source_arg_t src; + csch_source_arg_t *src; if (fscanf(ctx->f, "%ld %ld %ld %ld %d %d %d", &x1, &y1, &x2, &y2, &color, &pintype, &whichend) != 7) { error(ctx, ("invalid integer fields in 'P'\n")); @@ -489,7 +487,7 @@ TODO("if whichend is 0, swap coords?"); - csch_attrib_plugin_source_c(&src, ctx->fn, ctx->lineno, 0, NULL); + src = csch_attrib_plugin_source_c(ctx->fn, ctx->lineno, 0, NULL); ctx->last = csch_alien_mkpin_line(&ctx->alien, src, parent, x1, y1, x2, y2); return 0; @@ -617,10 +615,11 @@ dbg_printf("path of %ld:\n", numlines); if (numlines > 0) { - csch_source_arg_t src; + csch_source_arg_t *src; + grp = csch_cgrp_alloc(ctx->sheet, parent, csch_oid_new(ctx->sheet, parent)); - csch_attrib_plugin_source_c(&src, ctx->fn, ctx->lineno, 0, NULL); - csch_cobj_attrib_set(ctx->sheet, grp, CSCH_ATP_HARDWIRED, "purpose", "gEDA-path", &src); + src = csch_attrib_plugin_source_c(ctx->fn, ctx->lineno, 0, NULL); + csch_cobj_attrib_set(ctx->sheet, grp, CSCH_ATP_HARDWIRED, "purpose", "gEDA-path", src); ctx->last = &grp->hdr; penname = read_alloc_pen(ctx, parent, color, width, capstyle, dashstyle, dashlength, dashspace); } @@ -850,11 +849,11 @@ { htsp_entry_t *e; for(e = htsp_first(&src->attr); e != NULL; e = htsp_next(&src->attr, e)) { - csch_source_arg_t src; + csch_source_arg_t *src; csch_attrib_t *a = e->value; - csch_attrib_plugin_source_c(&src, ctx->fn, ctx->lineno, 0, NULL); - csch_attrib_set(&dst->attr, CSCH_ATP_USER_DEFAULT-1, a->key, a->val, &src, NULL); + src = csch_attrib_plugin_source_c(ctx->fn, ctx->lineno, 0, NULL); + csch_attrib_set(&dst->attr, CSCH_ATP_USER_DEFAULT-1, a->key, a->val, src, NULL); } } @@ -912,7 +911,7 @@ static int read_comp(read_ctx_t *ctx, csch_cgrp_t *parent) { - csch_source_arg_t src; + csch_source_arg_t *src; long x, y; int selectable, angle, mirror; char *name; @@ -930,8 +929,8 @@ flush_last_comp(ctx); ctx->last_comp = csch_cgrp_alloc(ctx->sheet, parent, csch_oid_new(ctx->sheet, parent)); - csch_attrib_plugin_source_c(&src, ctx->fn, ctx->lineno, 0, NULL); - csch_cobj_attrib_set(ctx->sheet, ctx->last_comp, CSCH_ATP_HARDWIRED, "role", "symbol", &src); + src = csch_attrib_plugin_source_c(ctx->fn, ctx->lineno, 0, NULL); + csch_cobj_attrib_set(ctx->sheet, ctx->last_comp, CSCH_ATP_HARDWIRED, "role", "symbol", src); ctx->last_comp->x = x; ctx->last_comp->y = y; ctx->last_comp->hdr.lock = !selectable; @@ -1122,7 +1121,7 @@ static csch_cgrp_t *load_sym_(read_ctx_t *ctx) { - csch_source_arg_t src; + csch_source_arg_t *src; csch_cgrp_t *resgrp = NULL; int rv = 0; @@ -1135,8 +1134,8 @@ } resgrp = csch_cgrp_alloc(ctx->sheet, &ctx->sheet->direct, csch_oid_new(ctx->sheet, &ctx->sheet->direct)); - csch_attrib_plugin_source_c(&src, ctx->fn, ctx->lineno, 0, NULL); - csch_cobj_attrib_set(ctx->sheet, resgrp, CSCH_ATP_HARDWIRED, "role", "symbol", &src); + src = csch_attrib_plugin_source_c(ctx->fn, ctx->lineno, 0, NULL); + csch_cobj_attrib_set(ctx->sheet, resgrp, CSCH_ATP_HARDWIRED, "role", "symbol", src); /* read the file */ for(;;) { Index: trunk/src/plugins/lib_alien/read_helper.c =================================================================== --- trunk/src/plugins/lib_alien/read_helper.c (revision 3989) +++ trunk/src/plugins/lib_alien/read_helper.c (revision 3990) @@ -128,7 +128,7 @@ return &poly->hdr; } -csch_chdr_t *csch_alien_mkpin_line(csch_alien_read_ctx_t *ctx, csch_source_arg_t src, csch_cgrp_t *parent, double x1, double y1, double x2, double y2) +csch_chdr_t *csch_alien_mkpin_line(csch_alien_read_ctx_t *ctx, csch_source_arg_t *src, csch_cgrp_t *parent, double x1, double y1, double x2, double y2) { csch_cgrp_t *pin; csch_line_t *line; @@ -141,7 +141,7 @@ } pin = csch_cgrp_alloc(ctx->sheet, parent, csch_oid_new(ctx->sheet, parent)); - csch_cobj_attrib_set(ctx->sheet, pin, CSCH_ATP_HARDWIRED, "role", "terminal", &src); + csch_cobj_attrib_set(ctx->sheet, pin, CSCH_ATP_HARDWIRED, "role", "terminal", src); line = csch_line_alloc(ctx->sheet, pin, csch_oid_new(ctx->sheet, pin)); line->spec.p1.x = rnd_round(x1); Index: trunk/src/plugins/lib_alien/read_helper.h =================================================================== --- trunk/src/plugins/lib_alien/read_helper.h (revision 3989) +++ trunk/src/plugins/lib_alien/read_helper.h (revision 3990) @@ -51,9 +51,11 @@ csch_chdr_t *csch_alien_mkline(csch_alien_read_ctx_t *ctx, csch_cgrp_t *parent, double x1, double y1, double x2, double y2, const char *penname); csch_chdr_t *csch_alien_mkarc(csch_alien_read_ctx_t *ctx, csch_cgrp_t *parent, double cx, double cy, double r, double sa, double da, const char *penname); csch_chdr_t *csch_alien_mkrect(csch_alien_read_ctx_t *ctx, csch_cgrp_t *parent, double x1, double y1, double x2, double y2, const char *stroke_penname, const char *fill_penname); -csch_chdr_t *csch_alien_mkpin_line(csch_alien_read_ctx_t *ctx, csch_source_arg_t src, csch_cgrp_t *parent, double x1, double y1, double x2, double y2); csch_chdr_t *csch_alien_mktext(csch_alien_read_ctx_t *ctx, csch_cgrp_t *parent, double x, double y, const char *penname); +/* Frees src */ +csch_chdr_t *csch_alien_mkpin_line(csch_alien_read_ctx_t *ctx, csch_source_arg_t *src, csch_cgrp_t *parent, double x1, double y1, double x2, double y2); + void csch_alien_mkbezier(csch_alien_read_ctx_t *ctx, csch_cgrp_t *parent, double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4, const char *penname); Index: trunk/src/plugins/propedit/propsel.c =================================================================== --- trunk/src/plugins/propedit/propsel.c (revision 3989) +++ trunk/src/plugins/propedit/propsel.c (revision 3990) @@ -290,9 +290,7 @@ static csch_source_arg_t *propsel_src(void) { - static csch_source_arg_t src; - csch_attrib_plugin_source_c(&src, NULL, 0, 0, "propsel user input"); - return &src; + return csch_attrib_plugin_source_c(NULL, 0, 0, "propsel user input"); } static void toggle_attr(csch_propset_ctx_t *st, csch_cgrp_t *grp) Index: trunk/src/plugins/sch_dialogs/dlg_attrib.c =================================================================== --- trunk/src/plugins/sch_dialogs/dlg_attrib.c (revision 3989) +++ trunk/src/plugins/sch_dialogs/dlg_attrib.c (revision 3990) @@ -345,9 +345,7 @@ static csch_source_arg_t *attrdlg_src(void) { - static csch_source_arg_t src; - csch_attrib_plugin_source_c(&src, NULL, 0, 0, "attr_dlg user input"); - return &src; + return csch_attrib_plugin_source_c(NULL, 0, 0, "attr_dlg user input"); } static void attr_val_set_meta_and_str(attrdlg_ctx_t *ctx, csch_attrib_t *a, int set_str) Index: trunk/src/plugins/sch_dialogs/dlg_text.c =================================================================== --- trunk/src/plugins/sch_dialogs/dlg_text.c (revision 3989) +++ trunk/src/plugins/sch_dialogs/dlg_text.c (revision 3990) @@ -228,13 +228,13 @@ static void dyntext_attr1_cb(void *hid_ctx, void *caller_data, rnd_hid_attribute_t *attr) { - csch_source_arg_t src; + csch_source_arg_t *src; dyntext_dlg_ctx_t *ctx = caller_data; const char *key = ctx->tmp.array + ctx->start + 5; const char *val = ctx->dlg[ctx->wattr1].val.str; - csch_attrib_plugin_source_c(&src, NULL, 0, 0, "dlg_text user input"); - csch_attr_modify_str(ctx->sheet, ctx->text->hdr.parent, CSCH_ATP_USER_DEFAULT, key, val, &src, 1); + src = csch_attrib_plugin_source_c(NULL, 0, 0, "dlg_text user input"); + csch_attr_modify_str(ctx->sheet, ctx->text->hdr.parent, CSCH_ATP_USER_DEFAULT, key, val, src, 1); rnd_gui->invalidate_all(rnd_gui); dyntext_dlg_text2dlg(ctx); ctx->timed.str.used = 0; Index: trunk/src/plugins/sch_dialogs/quick_attr.c =================================================================== --- trunk/src/plugins/sch_dialogs/quick_attr.c (revision 3989) +++ trunk/src/plugins/sch_dialogs/quick_attr.c (revision 3990) @@ -114,11 +114,11 @@ RND_ACT_IRES(0); if ((dres == 1) && (dlg[wenum].val.lng) != orig) { - csch_source_arg_t src; + csch_source_arg_t *src; const char *val = ((dlg[wenum].val.lng == 0) ? "" : roles[dlg[wenum].val.lng]); - csch_attrib_plugin_source_c(&src, NULL, 0, 0, "quick_attr_role user input"); - csch_attr_modify_str(sheet, grp, -CSCH_ATP_USER_DEFAULT, "role", val, &src, 1); + src = csch_attrib_plugin_source_c(NULL, 0, 0, "quick_attr_role user input"); + csch_attr_modify_str(sheet, grp, -CSCH_ATP_USER_DEFAULT, "role", val, src, 1); RND_ACT_IRES(1); } return 0; Index: trunk/src/plugins/std_devmap/compiler.c =================================================================== --- trunk/src/plugins/std_devmap/compiler.c (revision 3989) +++ trunk/src/plugins/std_devmap/compiler.c (revision 3990) @@ -61,15 +61,15 @@ /* csch_cgrp_t *sym;*/ csch_acomp_t *comp; csch_hook_call_ctx_t *cctx = argv[0].val.argv0.user_call_ctx; - csch_source_arg_t del_src; + csch_source_arg_t *del_src; /* CSCH_HOOK_CONVARG(1, FGW_COBJ, devmap_comp_update, sym = fgw_cobj(&argv[1]));*/ CSCH_HOOK_CONVARG(2, FGW_AOBJ, devmap_comp_update, comp = fgw_aobj(&argv[2])); - csch_attrib_plugin_source_p(&del_src, "std_devmp", "symbol_joined_comp"); + del_src = csch_attrib_plugin_source_p("std_devmp", "symbol_joined_comp"); - csch_attrib_del(&comp->hdr.attr, cctx->view_eng->eprio + CSCH_PRI_PLUGIN_NORMAL, "slot", &del_src); + csch_attrib_del(&comp->hdr.attr, cctx->view_eng->eprio + CSCH_PRI_PLUGIN_NORMAL, "slot", del_src); return 0; } @@ -80,7 +80,7 @@ csch_acomp_t *comp; csch_attribs_t *comp_attrs; csch_attrib_t *adevmap; - csch_source_arg_t src; + csch_source_arg_t *src; CSCH_HOOK_CONVARG(1, FGW_AOBJ, devmap_comp_update, comp = fgw_aobj(&argv[1])); assert(comp->hdr.type == CSCH_ATYPE_COMP); @@ -95,8 +95,8 @@ return -1; } - csch_attrib_plugin_source_p(&src, "std_devmap", "devmap_compile_comp1"); - csch_attrib_apply(&comp->hdr.attr, comp_attrs, &src); + src = csch_attrib_plugin_source_p("std_devmap", "devmap_compile_comp1"); + csch_attrib_apply(&comp->hdr.attr, comp_attrs, src); return 0; } @@ -103,7 +103,7 @@ fgw_error_t devmap_compile_port(fgw_arg_t *res, int argc, fgw_arg_t *argv) { csch_hook_call_ctx_t *cctx = argv[0].val.argv0.user_call_ctx; - csch_source_arg_t pm_src; + csch_source_arg_t *pm_src; csch_acomp_t *comp; csch_aport_t *port; csch_attrib_t *portmap; @@ -205,8 +205,8 @@ while(isspace(*key)) key++; /* eat up spaces after the "->" separator */ - csch_attrib_plugin_source_pa(&pm_src, &comp->hdr, "portmap", "std_devmap", "applied portmap"); - csch_attrib_set(&port->hdr.attr, cctx->view_eng->eprio + CSCH_PRI_PLUGIN_NORMAL, key, val, &pm_src, NULL); + pm_src = csch_attrib_plugin_source_pa(&comp->hdr, "portmap", "std_devmap", "applied portmap"); + csch_attrib_set(&port->hdr.attr, cctx->view_eng->eprio + CSCH_PRI_PLUGIN_NORMAL, key, val, pm_src, NULL); free(ktmp); } Index: trunk/src/plugins/std_devmap/loclib.c =================================================================== --- trunk/src/plugins/std_devmap/loclib.c (revision 3989) +++ trunk/src/plugins/std_devmap/loclib.c (revision 3990) @@ -76,10 +76,10 @@ csch_lib_t *root_dir = NULL; int alloced; csch_cgrp_t *root_grp; - csch_source_arg_t src; + csch_source_arg_t *src; - csch_attrib_plugin_source_p(&src, "std_devmap", NULL); - if (csch_loclib_get_roots(&root_dir, &root_grp, devmaster, sheet, &src, alloc, &alloced) == 0) + src = csch_attrib_plugin_source_p("std_devmap", NULL); + if (csch_loclib_get_roots(&root_dir, &root_grp, devmaster, sheet, src, alloc, &alloced) == 0) devmap_sheet_init_(&sheet->hidlib, root_dir, root_grp); if (root_dir_out != NULL) @@ -137,7 +137,7 @@ csch_lib_t *root_dir; csch_cgrp_t *devmap_root; htsp_t *map; - csch_source_arg_t src; + csch_source_arg_t *src; csch_cgrp_t *gd; devmap_sheet_init(sheet, &root_dir, 1); @@ -156,9 +156,9 @@ return; } - csch_attrib_plugin_source_p(&src, "std_devmap", "external lib"); + src = csch_attrib_plugin_source_p("std_devmap", "external lib"); gd->loclib_name = rnd_strdup(devmap_name); - csch_attrib_apply(&gd->attr, dma, &src); + csch_attrib_apply(&gd->attr, dma, src); csch_sheet_set_changed(sheet, 1); devmap_local_ins(map, root_dir, gd); Index: trunk/src/plugins/std_devmap/std_devmap.c =================================================================== --- trunk/src/plugins/std_devmap/std_devmap.c (revision 3989) +++ trunk/src/plugins/std_devmap/std_devmap.c (revision 3990) @@ -147,7 +147,7 @@ ret = rnd_actionv_bin(&sheet->hidlib, "librarydialog", &ares, 4, args); if ((ret == 0) && ((ares.type & FGW_STR) == FGW_STR)) { - csch_source_arg_t src; + csch_source_arg_t *src; char *path = ares.val.str, *sep = NULL; if ((path != NULL) && (*path != '\0')) @@ -157,8 +157,8 @@ if ((end != NULL) && (rnd_strcasecmp(end, ".devmap") == 0)) *end = '\0'; - csch_attrib_plugin_source_p(&src, "std_devmap", "manually picked from the devmap lib"); - csch_attr_modify_str(sheet, grp, -CSCH_ATP_USER_DEFAULT, "devmap", sep+1, &src, 1); + src = csch_attrib_plugin_source_p("std_devmap", "manually picked from the devmap lib"); + csch_attr_modify_str(sheet, grp, -CSCH_ATP_USER_DEFAULT, "devmap", sep+1, src, 1); rnd_trace("new devmap val: '%s'\n", sep+1); } } Index: trunk/src/plugins/symlib_local/symlib_local.c =================================================================== --- trunk/src/plugins/symlib_local/symlib_local.c (revision 3989) +++ trunk/src/plugins/symlib_local/symlib_local.c (revision 3990) @@ -230,7 +230,7 @@ /* insert *grp in indirect, place ref on the sheet */ static void local_paste_place(csch_sheet_t *sheet, csch_cgrp_t **grp) { - csch_source_arg_t src; + csch_source_arg_t *src; csch_cgrp_t *symlib, *loc; csch_lib_t *root_dir; htpi_t *sh, *shna; @@ -237,8 +237,8 @@ htpi_entry_t *e; int alloced = 0; - csch_attrib_plugin_source_p(&src, "symlib_local", NULL); - if (csch_loclib_get_roots(&root_dir, &symlib, loclib_master, sheet, &src, 1, &alloced) != 0) + src = csch_attrib_plugin_source_p("symlib_local", NULL); + if (csch_loclib_get_roots(&root_dir, &symlib, loclib_master, sheet, src, 1, &alloced) != 0) return; if (alloced) { Index: trunk/src/plugins/target_none/target_none.c =================================================================== --- trunk/src/plugins/target_none/target_none.c (revision 3989) +++ trunk/src/plugins/target_none/target_none.c (revision 3990) @@ -52,9 +52,8 @@ assert(port->hdr.type == CSCH_ATYPE_PORT); if (port->name != NULL) { - csch_source_arg_t src; - csch_attrib_plugin_source_p(&src, "target_none", NULL); - csch_attrib_set(&port->hdr.attr, eng->eprio + CSCH_PRI_PLUGIN_NORMAL, "display/name", port->name, &src, NULL); + csch_source_arg_t *src = csch_attrib_plugin_source_p("target_none", NULL); + csch_attrib_set(&port->hdr.attr, eng->eprio + CSCH_PRI_PLUGIN_NORMAL, "display/name", port->name, src, NULL); } return 0; Index: trunk/src/plugins/target_pcb/target_pcb.c =================================================================== --- trunk/src/plugins/target_pcb/target_pcb.c (revision 3989) +++ trunk/src/plugins/target_pcb/target_pcb.c (revision 3990) @@ -50,7 +50,7 @@ csch_view_eng_t *eng = obj->script_data; csch_aport_t *port; const char *pinnum; - csch_source_arg_t src; + csch_source_arg_t *src; CSCH_HOOK_CONVARG(1, FGW_AOBJ, std_cschem_comp_update, port = fgw_aobj(&argv[1])); @@ -58,21 +58,21 @@ pinnum = csch_attrib_get_str(&port->hdr.attr, "pcb/pinnum"); if (pinnum != NULL) - csch_attrib_plugin_source_pa(&src, port, "pcb/pinnum", "tagret_pcb", NULL); + src = csch_attrib_plugin_source_pa(&port->hdr, "pcb/pinnum", "tagret_pcb", NULL); if (pinnum == NULL) { pinnum = csch_attrib_get_str(&port->hdr.attr, "pinnum"); if (pinnum != NULL) - csch_attrib_plugin_source_pa(&src, port, "pinnum", "tagret_pcb", NULL); + src = csch_attrib_plugin_source_pa(&port->hdr, "pinnum", "tagret_pcb", NULL); } if (pinnum == NULL) { pinnum = port->name; if (pinnum != NULL) - csch_attrib_plugin_source_p(&src, "tagret_pcb", "fallback on port name"); + src = csch_attrib_plugin_source_p("tagret_pcb", "fallback on port name"); } if (pinnum != NULL) - csch_attrib_set(&port->hdr.attr, eng->eprio + CSCH_PRI_PLUGIN_NORMAL, "display/name", pinnum, &src, NULL); + csch_attrib_set(&port->hdr.attr, eng->eprio + CSCH_PRI_PLUGIN_NORMAL, "display/name", pinnum, src, NULL); return 0; }