getexpress(), remove const, `pi' and rename xia_ptr --> s

This commit is contained in:
rlar 2016-05-22 12:38:46 +02:00
parent 9494f8d9af
commit f8fc4edf52
1 changed files with 13 additions and 14 deletions

View File

@ -1333,25 +1333,24 @@ getword(const char *s, SPICE_DSTRINGPTR tstr_p)
}
static const char *
getexpress(nupa_type *type, SPICE_DSTRINGPTR tstr_p, const char *pi)
static char *
getexpress(nupa_type *type, SPICE_DSTRINGPTR tstr_p, const char *s)
/* 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
*/
{
const char *xia_ptr = pi;
const char * const ls_ptr = xia_ptr + strlen(xia_ptr);
const char * const ls_ptr = s + strlen(s);
const char *p;
nupa_type tpe;
while ((xia_ptr < ls_ptr - 1) && (*xia_ptr <= ' '))
xia_ptr++; /*white space ? */
while ((s < ls_ptr - 1) && (*s <= ' '))
s++; /*white space ? */
if (*xia_ptr == '"') {
if (*s == '"') {
/* string constant */
xia_ptr++;
p = xia_ptr;
s++;
p = s;
while ((p < ls_ptr - 1) && (*p != '"'))
p++;
@ -1364,10 +1363,10 @@ getexpress(nupa_type *type, SPICE_DSTRINGPTR tstr_p, const char *pi)
} else {
if (*xia_ptr == '{')
xia_ptr++;
if (*s == '{')
s++;
p = xia_ptr - 1;
p = s - 1;
p++;
@ -1400,7 +1399,7 @@ getexpress(nupa_type *type, SPICE_DSTRINGPTR tstr_p, const char *pi)
tpe = NUPA_REAL;
}
pscopy(tstr_p, xia_ptr, 0, (int) (p - xia_ptr));
pscopy(tstr_p, s, 0, (int) (p - s));
if (*p == '}')
p++;
@ -1411,7 +1410,7 @@ getexpress(nupa_type *type, SPICE_DSTRINGPTR tstr_p, const char *pi)
if (type)
*type = tpe;
return p + 1;
return (char *) p + 1;
}