If we encounter tc1= or tc2= (temp coeffs.) or m= (multiplier),

the expression is done, thus keeping the brackets as is.
Enables tcx={} or m={} with their own expressions, dealt with
by numparam.
This commit is contained in:
Holger Vogt 2020-12-25 15:46:05 +01:00
parent d252d66984
commit 9ae462bde4
1 changed files with 9 additions and 19 deletions

View File

@ -6072,8 +6072,9 @@ static char *inp_modify_exp(/* NOT CONST */ char *expr)
char *s; char *s;
wordlist *wl = NULL, *wlist = NULL; wordlist *wl = NULL, *wlist = NULL;
/* Scan the expression and replace all '{' and '}' with ' ' */ /* Scan the expression and replace all '{' and '}' with ' '.
for (s = expr; *s; s++) { As soon as we encounter a tc1=, tc2=, or m=, stop it. */
for (s = expr; *s && !(ciprefix("tc1=", s) || ciprefix("tc2=", s) || ciprefix("m=", s)) ; s++) {
if ((*s == '{') || (*s == '}')) { if ((*s == '{') || (*s == '}')) {
*s = ' '; *s = ' ';
} }
@ -6163,23 +6164,12 @@ static char *inp_modify_exp(/* NOT CONST */ char *expr)
cieq(buf, "temp")) { cieq(buf, "temp")) {
wl->wl_word = copy(buf); wl->wl_word = copy(buf);
} }
else if (cieq(buf, "tc1") || cieq(buf, "tc2") || /* as soon as we encounter tc1= or tc2= (temp coeffs.) or
cieq(buf, "reciproctc") || cieq(buf, "m") || cieq(buf, "reciprocm")) { m= (multiplier), the expression is done */
s = skip_ws(s); else if ((*s == '=') && (cieq(buf, "tc1") || cieq(buf, "tc2") ||
/* no {} around tc1 = or tc2 = , these are temp coeffs. cieq(buf, "reciproctc") || cieq(buf, "m") || cieq(buf, "reciprocm"))) {
m= is a multiplier*/ wl->wl_word = tprintf("%s%s", buf, s);
if (s[0] == '=' && s[1] != '=') { break;
buf[i++] = '=';
buf[i] = '\0';
s++;
wl->wl_word = copy(buf);
}
else {
wl->wl_word = tprintf("({%s})", buf);
}
/* '-' following the '=' is attached to number as its sign
*/
c_arith = TRUE;
} }
else { else {
/* {} around all other tokens */ /* {} around all other tokens */