numparam, use `toupper_c()'

This commit is contained in:
rlar 2016-04-30 20:29:13 +02:00
parent 6d5b968464
commit e88e75a8d4
4 changed files with 8 additions and 19 deletions

View File

@ -30,7 +30,6 @@ bool steq(const char *s, const char *t);
bool stne(const char *s, const char *t);
void stri(long n, SPICE_DSTRINGPTR s);
char upcase(char c);
bool alfa(char c);
bool num(char c);
bool alfanum(char c);

View File

@ -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
* terminated.
@ -195,7 +185,7 @@ scopy_up(SPICE_DSTRINGPTR dstr_p, const char *str) /* returns success flag */
spice_dstring_reinit(dstr_p);
up[1] = '\0';
for (ptr = str; ptr && *ptr; ptr++) {
up[0] = upcase(*ptr);
up[0] = toupper_c(*ptr);
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);
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';
@ -449,7 +439,7 @@ stupcase(char *s)
int i = 0;
while (s[i] != '\0') {
s[i] = upcase(s[i]);
s[i] = toupper_c(s[i]);
i++;
}

View File

@ -216,7 +216,7 @@ findsubname(dico_t *dico, SPICE_DSTRINGPTR dstr_p)
spice_dstring_reinit(&name);
j = k + 1;
while (alfanum(s[j])) {
cadd(&name, upcase(s[j]));
cadd(&name, toupper_c(s[j]));
j++;
}
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 */
s[0] = '*';
category = 'P';
} else if (upcase(s[0]) == 'X') {
} else if (toupper_c(s[0]) == 'X') {
/* strip actual parameters */
findsubname(dico, dstr_p); /* i= index following last identifier in s */
category = 'X';

View File

@ -600,7 +600,7 @@ keyword(const char *keys, const char *s, const char *s_end)
for (;;) {
const char *p = s;
while ((p < s_end) && (upcase(*p) == *keys))
while ((p < s_end) && (toupper_c(*p) == *keys))
p++, keys++;
if ((p >= s_end) && (*keys <= ' '))
return j;
@ -976,7 +976,7 @@ formula(dico_t *dico, const char *s, const char *s_end, bool *perror)
} else {
spice_dstring_reinit(&tstr);
while (s < s_next)
cadd(&tstr, upcase(*s++));
cadd(&tstr, toupper_c(*s++));
u = fetchnumentry(dico, spice_dstring_value(&tstr), &error);
state = S_atom;
}
@ -1343,7 +1343,7 @@ getword(char *s, SPICE_DSTRINGPTR tstr_p, int after, int *pi)
spice_dstring_reinit(tstr_p);
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++;
}