getexpress(), third argument, `char **pi' instead of `int *pi'

This commit is contained in:
rlar 2017-11-12 21:34:01 +01:00
parent 57b822e0e9
commit d4098d454b
1 changed files with 10 additions and 5 deletions

View File

@ -1334,13 +1334,13 @@ getword(const char *s, SPICE_DSTRINGPTR tstr_p)
static nupa_type
getexpress(const char * const s, SPICE_DSTRINGPTR tstr_p, int *pi)
getexpress(const char * const s, SPICE_DSTRINGPTR tstr_p, const char **pi)
/* returns expression-like string until next separator
Input i=position before expr, output i=just after expr, on separator.
returns tpe=='R' if (numeric, 'S' if (string only
*/
{
int i = *pi;
int i = (int) (*pi - s);
int ia, ls, level;
char c, d;
nupa_type tpe;
@ -1414,7 +1414,7 @@ getexpress(const char * const s, SPICE_DSTRINGPTR tstr_p, int *pi)
if (tpe == NUPA_STRING)
i++; /* beyond quote */
*pi = i;
*pi = s + i;
return tpe;
}
@ -1469,7 +1469,9 @@ nupa_assignment(dico_t *dico, char *s, char mode)
if (i > ls)
error = message(dico, " = sign expected.\n");
dtype = getexpress(s, &ustr, &i);
const char *tmp = s + i;
dtype = getexpress(s, &ustr, &tmp);
i = (int) (tmp - s);
if (dtype == NUPA_REAL) {
const char *tmp = spice_dstring_value(&ustr);
@ -1675,7 +1677,10 @@ nupa_subcktcall(dico_t *dico, char *s, char *x, char *inst_name)
pscopy(&ustr, spice_dstring_value(&tstr), h, k - h);
j = k;
} else if (t_p[k] == '{') {
getexpress(spice_dstring_value(&tstr), &ustr, &j);
char *aux = spice_dstring_value(&tstr);
const char *tmp = aux + j;
getexpress(aux, &ustr, &tmp);
j = (int) (tmp - aux);
j--; /* confusion: j was in Turbo Pascal convention */
} else {
j++;