xpressn.c, cleanup char index bistromatic
This commit is contained in:
parent
5db94276d3
commit
dbb8a76adb
|
|
@ -760,7 +760,8 @@ fetchid(const char *s, SPICE_DSTRINGPTR t, int ls, int i)
|
||||||
char c;
|
char c;
|
||||||
bool ok;
|
bool ok;
|
||||||
|
|
||||||
c = s[i - 1];
|
c = s[i];
|
||||||
|
i++;
|
||||||
|
|
||||||
while (!alfa(c) && (i < ls)) {
|
while (!alfa(c) && (i < ls)) {
|
||||||
i++;
|
i++;
|
||||||
|
|
@ -820,6 +821,7 @@ exists(tdico *d, const char *s, int *pi, bool *perror)
|
||||||
|
|
||||||
if (ok)
|
if (ok)
|
||||||
{
|
{
|
||||||
|
i--;
|
||||||
i = fetchid(s, &t, ls, i);
|
i = fetchid(s, &t, ls, i);
|
||||||
i--;
|
i--;
|
||||||
if (entrynb(d, spice_dstring_value(&t)))
|
if (entrynb(d, spice_dstring_value(&t)))
|
||||||
|
|
@ -859,7 +861,7 @@ fetchnumber(tdico *dico, const char *s, int *pi, bool *perror)
|
||||||
double u;
|
double u;
|
||||||
int n = 0;
|
int n = 0;
|
||||||
|
|
||||||
s += *pi - 1; /* broken semantic !! */
|
s += *pi;
|
||||||
|
|
||||||
if (1 != sscanf(s, "%lG%n", &u, &n)) {
|
if (1 != sscanf(s, "%lG%n", &u, &n)) {
|
||||||
|
|
||||||
|
|
@ -879,7 +881,7 @@ fetchnumber(tdico *dico, const char *s, int *pi, bool *perror)
|
||||||
while (s[n] && alfa(s[n]))
|
while (s[n] && alfa(s[n]))
|
||||||
n++;
|
n++;
|
||||||
|
|
||||||
*pi += n-1; /* very broken semantic !!! */
|
*pi += n;
|
||||||
|
|
||||||
return u;
|
return u;
|
||||||
}
|
}
|
||||||
|
|
@ -901,7 +903,8 @@ fetchoperator(tdico *dico,
|
||||||
bool error = *perror;
|
bool error = *perror;
|
||||||
char c, d;
|
char c, d;
|
||||||
|
|
||||||
c = s[i - 1];
|
c = s[i];
|
||||||
|
i++;
|
||||||
|
|
||||||
if (i < ls)
|
if (i < ls)
|
||||||
d = s[i];
|
d = s[i];
|
||||||
|
|
@ -1239,6 +1242,7 @@ formula(tdico *dico, const char *s, bool *perror)
|
||||||
i = k;
|
i = k;
|
||||||
fu = 0;
|
fu = 0;
|
||||||
} else if (alfa(c)) {
|
} else if (alfa(c)) {
|
||||||
|
i--;
|
||||||
i = fetchid(s, &tstr, ls, i); /* user id, but sort out keywords */
|
i = fetchid(s, &tstr, ls, i); /* user id, but sort out keywords */
|
||||||
state = S_atom;
|
state = S_atom;
|
||||||
i--;
|
i--;
|
||||||
|
|
@ -1256,6 +1260,7 @@ formula(tdico *dico, const char *s, bool *perror)
|
||||||
if (kw == Defd)
|
if (kw == Defd)
|
||||||
u = exists(dico, s, &i, &error);
|
u = exists(dico, s, &i, &error);
|
||||||
} else if (((c == '.') || ((c >= '0') && (c <= '9')))) {
|
} else if (((c == '.') || ((c >= '0') && (c <= '9')))) {
|
||||||
|
i--;
|
||||||
u = fetchnumber(dico, s, &i, &error);
|
u = fetchnumber(dico, s, &i, &error);
|
||||||
if (negate) {
|
if (negate) {
|
||||||
u = -1 * u;
|
u = -1 * u;
|
||||||
|
|
@ -1263,6 +1268,7 @@ formula(tdico *dico, const char *s, bool *perror)
|
||||||
}
|
}
|
||||||
state = S_atom;
|
state = S_atom;
|
||||||
} else {
|
} else {
|
||||||
|
i--;
|
||||||
c = fetchoperator(dico, s, ls, &i, &state, &level, &error);
|
c = fetchoperator(dico, s, ls, &i, &state, &level, &error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue