From 90a1316345c1e347908ec29e0b2865a6f03ad4ab Mon Sep 17 00:00:00 2001 From: Bart Schaefer Date: Sat, 19 May 2001 00:31:22 +0000 Subject: Fix re-set of integer special params after unset. --- Src/params.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) (limited to 'Src/params.c') diff --git a/Src/params.c b/Src/params.c index acbe448a2..28a8f1e85 100644 --- a/Src/params.c +++ b/Src/params.c @@ -1998,17 +1998,16 @@ setiparam(char *s, zlong val) if (!(v = getvalue(&vbuf, &s, 1))) { if ((ss = strchr(s, '['))) *ss = '\0'; - pm = createparam(t, ss ? PM_ARRAY : PM_INTEGER); + if (!(pm = createparam(t, ss ? PM_ARRAY : PM_INTEGER))) + pm = (Param) paramtab->getnode(paramtab, t); DPUTS(!pm, "BUG: parameter not created"); if (ss) { *ss = '['; - v = getvalue(&vbuf, &t, 1); - DPUTS(!v, "BUG: value not found for new parameter"); } else { - pm->u.val = val; - unqueue_signals(); - return pm; + pm->ct = outputradix; } + v = getvalue(&vbuf, &t, 1); + DPUTS(!v, "BUG: value not found for new parameter"); } mnval.type = MN_INTEGER; mnval.u.l = val; @@ -2042,20 +2041,16 @@ setnparam(char *s, mnumber val) *ss = '\0'; pm = createparam(t, ss ? PM_ARRAY : (val.type & MN_INTEGER) ? PM_INTEGER : PM_FFLOAT); + if (!pm) + pm = (Param) paramtab->getnode(paramtab, t); DPUTS(!pm, "BUG: parameter not created"); if (ss) { *ss = '['; - v = getvalue(&vbuf, &t, 1); - DPUTS(!v, "BUG: value not found for new parameter"); - } else { - if (val.type & MN_INTEGER) { - pm->ct = outputradix; - pm->u.val = val.u.l; - } else - pm->u.dval = val.u.d; - unqueue_signals(); - return pm; + } else if (val.type & MN_INTEGER) { + pm->ct = outputradix; } + v = getvalue(&vbuf, &t, 1); + DPUTS(!v, "BUG: value not found for new parameter"); } setnumvalue(v, val); unqueue_signals(); -- cgit 1.4.1