numparam, use `toupper_c()'
This commit is contained in:
parent
6d5b968464
commit
e88e75a8d4
|
|
@ -30,7 +30,6 @@ bool steq(const char *s, const char *t);
|
||||||
bool stne(const char *s, const char *t);
|
bool stne(const char *s, const char *t);
|
||||||
void stri(long n, SPICE_DSTRINGPTR s);
|
void stri(long n, SPICE_DSTRINGPTR s);
|
||||||
|
|
||||||
char upcase(char c);
|
|
||||||
bool alfa(char c);
|
bool alfa(char c);
|
||||||
bool num(char c);
|
bool num(char c);
|
||||||
bool alfanum(char c);
|
bool alfanum(char c);
|
||||||
|
|
|
||||||
|
|
@ -147,16 +147,6 @@ sins(SPICE_DSTRINGPTR dstr_p, const char *t)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
char
|
|
||||||
upcase(char c)
|
|
||||||
{
|
|
||||||
if ((c >= 'a') && (c <= 'z'))
|
|
||||||
return (char) (c + 'A' - 'a');
|
|
||||||
else
|
|
||||||
return c;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* -----------------------------------------------------------------
|
/* -----------------------------------------------------------------
|
||||||
* Create copy of the dynamic string. Dynamic strings are always NULL
|
* Create copy of the dynamic string. Dynamic strings are always NULL
|
||||||
* terminated.
|
* terminated.
|
||||||
|
|
@ -195,7 +185,7 @@ scopy_up(SPICE_DSTRINGPTR dstr_p, const char *str) /* returns success flag */
|
||||||
spice_dstring_reinit(dstr_p);
|
spice_dstring_reinit(dstr_p);
|
||||||
up[1] = '\0';
|
up[1] = '\0';
|
||||||
for (ptr = str; ptr && *ptr; ptr++) {
|
for (ptr = str; ptr && *ptr; ptr++) {
|
||||||
up[0] = upcase(*ptr);
|
up[0] = toupper_c(*ptr);
|
||||||
spice_dstring_append(dstr_p, up, 1);
|
spice_dstring_append(dstr_p, up, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -275,7 +265,7 @@ pscopy_up(SPICE_DSTRINGPTR dstr_p, const char *t, int start, int leng)
|
||||||
s_p = spice_dstring_value(dstr_p);
|
s_p = spice_dstring_value(dstr_p);
|
||||||
|
|
||||||
for (i = 0; i < leng; i++)
|
for (i = 0; i < leng; i++)
|
||||||
s_p[i] = upcase(t[start + i]);
|
s_p[i] = toupper_c(t[start + i]);
|
||||||
|
|
||||||
s_p[leng] = '\0';
|
s_p[leng] = '\0';
|
||||||
|
|
||||||
|
|
@ -449,7 +439,7 @@ stupcase(char *s)
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
while (s[i] != '\0') {
|
while (s[i] != '\0') {
|
||||||
s[i] = upcase(s[i]);
|
s[i] = toupper_c(s[i]);
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -216,7 +216,7 @@ findsubname(dico_t *dico, SPICE_DSTRINGPTR dstr_p)
|
||||||
spice_dstring_reinit(&name);
|
spice_dstring_reinit(&name);
|
||||||
j = k + 1;
|
j = k + 1;
|
||||||
while (alfanum(s[j])) {
|
while (alfanum(s[j])) {
|
||||||
cadd(&name, upcase(s[j]));
|
cadd(&name, toupper_c(s[j]));
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
entry = entrynb(dico, spice_dstring_value(&name));
|
entry = entrynb(dico, spice_dstring_value(&name));
|
||||||
|
|
@ -365,7 +365,7 @@ transform(dico_t *dico, SPICE_DSTRINGPTR dstr_p, bool incontrol,
|
||||||
/* private style preprocessor line */
|
/* private style preprocessor line */
|
||||||
s[0] = '*';
|
s[0] = '*';
|
||||||
category = 'P';
|
category = 'P';
|
||||||
} else if (upcase(s[0]) == 'X') {
|
} else if (toupper_c(s[0]) == 'X') {
|
||||||
/* strip actual parameters */
|
/* strip actual parameters */
|
||||||
findsubname(dico, dstr_p); /* i= index following last identifier in s */
|
findsubname(dico, dstr_p); /* i= index following last identifier in s */
|
||||||
category = 'X';
|
category = 'X';
|
||||||
|
|
|
||||||
|
|
@ -600,7 +600,7 @@ keyword(const char *keys, const char *s, const char *s_end)
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
const char *p = s;
|
const char *p = s;
|
||||||
while ((p < s_end) && (upcase(*p) == *keys))
|
while ((p < s_end) && (toupper_c(*p) == *keys))
|
||||||
p++, keys++;
|
p++, keys++;
|
||||||
if ((p >= s_end) && (*keys <= ' '))
|
if ((p >= s_end) && (*keys <= ' '))
|
||||||
return j;
|
return j;
|
||||||
|
|
@ -976,7 +976,7 @@ formula(dico_t *dico, const char *s, const char *s_end, bool *perror)
|
||||||
} else {
|
} else {
|
||||||
spice_dstring_reinit(&tstr);
|
spice_dstring_reinit(&tstr);
|
||||||
while (s < s_next)
|
while (s < s_next)
|
||||||
cadd(&tstr, upcase(*s++));
|
cadd(&tstr, toupper_c(*s++));
|
||||||
u = fetchnumentry(dico, spice_dstring_value(&tstr), &error);
|
u = fetchnumentry(dico, spice_dstring_value(&tstr), &error);
|
||||||
state = S_atom;
|
state = S_atom;
|
||||||
}
|
}
|
||||||
|
|
@ -1343,7 +1343,7 @@ getword(char *s, SPICE_DSTRINGPTR tstr_p, int after, int *pi)
|
||||||
spice_dstring_reinit(tstr_p);
|
spice_dstring_reinit(tstr_p);
|
||||||
|
|
||||||
while ((i <= ls) && (alfa(s[i - 1]) || num(s[i - 1]))) {
|
while ((i <= ls) && (alfa(s[i - 1]) || num(s[i - 1]))) {
|
||||||
cadd(tstr_p, upcase(s[i - 1]));
|
cadd(tstr_p, toupper_c(s[i - 1]));
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue