use char variants of the <ctype.h> isxxxx() family

This commit is contained in:
rlar 2016-03-08 21:20:11 +01:00
parent d0c5a495ca
commit 71a7c3459b
41 changed files with 259 additions and 259 deletions

View File

@ -60,7 +60,7 @@ com_stop(wordlist *wl)
} else {
#ifdef HAVE_CTYPE_H
for (s = wl->wl_next->wl_word, i = 0; *s; s++)
if (!isdigit(*s))
if (!isdigit_c(*s))
goto bad;
else
i = i * 10 + (*s - '0');
@ -345,7 +345,7 @@ com_delete(wordlist *wl)
if (wl->wl_word) {
#ifdef HAVE_CTYPE_H
for (s = wl->wl_word, i = 0; *s; s++)
if (!isdigit(*s)) {
if (!isdigit_c(*s)) {
fprintf(cp_err, "Error: %s isn't a number.\n",
wl->wl_word);
goto bad;

View File

@ -120,7 +120,7 @@ dohsubst(char *string)
wl = getevent(cp_event - scannum(++string));
if (!wl)
return (NULL);
while (isdigit(*string))
while (isdigit_c(*string))
string++;
break;
@ -141,11 +141,11 @@ dohsubst(char *string)
return (wl);
default:
if (isdigit(*string)) {
if (isdigit_c(*string)) {
wl = getevent(scannum(string));
if (!wl)
return (NULL);
while (isdigit(*string))
while (isdigit_c(*string))
string++;
} else {
(void) strcpy(buf, string);
@ -266,7 +266,7 @@ anothermod:
(*string)++;
break;
default:
if (!isdigit(**string)) {
if (!isdigit_c(**string)) {
fprintf(cp_err, "Error: %s: bad modifier.\n",
*string);
return (NULL);
@ -278,16 +278,16 @@ anothermod:
return (NULL);
}
eventhi = eventlo = i;
while (isdigit(**string))
while (isdigit_c(**string))
(*string)++;
if (**string == '*')
eventhi = numwords - 1;
if (**string == '-') {
if (!isdigit(*(*string + 1))) {
if (!isdigit_c(*(*string + 1))) {
eventhi = numwords - 1;
} else {
eventhi = scannum(++*string);
while (isdigit(**string))
while (isdigit_c(**string))
(*string)++;
}
}

View File

@ -111,7 +111,7 @@ com_let(wordlist *wl)
vec_free(t);
free_pnode(names); /* frees also t, if pnode `names' is simple value */
for (s = q; *s && isspace(*s); s++)
for (s = q; *s && isspace_c(*s); s++)
;
}
}
@ -123,7 +123,7 @@ com_let(wordlist *wl)
*++q = '\0';
/* sanity check */
if (eq(p, "all") || strchr(p, '@') || isdigit(*p)) {
if (eq(p, "all") || strchr(p, '@') || isdigit_c(*p)) {
fprintf(cp_err, "Error: bad variable name %s\n", p);
tfree(p);
return;

View File

@ -291,7 +291,7 @@ tesCreateSystemInfo(TesSystemInfo *info)
while ((strPtr = strstr(strPtr, matchStrProc)) != NULL) {
// numProcs++;
strPtr += strlen(matchStrProc);
if (isblank(*strPtr)) numProcs++;
if (isblank_c(*strPtr)) numProcs++;
}
info->numLogicalProcessors = numProcs;
physIDs = TMALLOC(tInt, numProcs);

View File

@ -245,10 +245,10 @@ ft_cpinit(void)
/* jump over leading spaces */
for (copys = s = cp_tildexpand(Lib_Path); copys && *copys; ) {
while (isspace(*s))
while (isspace_c(*s))
s++;
/* copy s into buf until space is seen, r is the actual position */
for (r = buf; *s && !isspace(*s); r++, s++)
for (r = buf; *s && !isspace_c(*s); r++, s++)
*r = *s;
tfree(copys);
/* add a path separator to buf at actual position */

View File

@ -90,7 +90,7 @@ com_define(wordlist *wlist)
(void) strcpy(tbuf, buf);
for (b = tbuf; *b; b++)
if (isspace(*b) || (*b == '(')) {
if (isspace_c(*b) || (*b == '(')) {
*b = '\0';
break;
}

View File

@ -34,7 +34,7 @@ cannonical_name(char *name, SPICE_DSTRINGPTR dbuf_p)
tmp++;
tmp++;
for (ptr = tmp; *ptr; ptr++)
if (isupper(*ptr))
if (isupper_c(*ptr))
tmp = spice_dstring_append_char(dbuf_p, (char)tolower(*ptr));
else
tmp = spice_dstring_append_char(dbuf_p, *ptr);
@ -42,7 +42,7 @@ cannonical_name(char *name, SPICE_DSTRINGPTR dbuf_p)
tmp++;
*tmp = '\0';
tmp = spice_dstring_append(dbuf_p, "#branch", -1);
} else if (isdigit(*name)) {
} else if (isdigit_c(*name)) {
spice_dstring_append(dbuf_p, "v(", -1);
spice_dstring_append(dbuf_p, name, -1);
tmp = spice_dstring_append_char(dbuf_p, ')');
@ -80,7 +80,7 @@ nameeq(char *n1, char *n2)
tmp++;
*tmp = '\0';
(void) strcat(buf1, "#branch");
} else if (isdigit(*n1)) {
} else if (isdigit_c(*n1)) {
(void) sprintf(buf1, "v(%s)", n1);
} else {
(void) strcpy(buf1, n1);
@ -97,7 +97,7 @@ nameeq(char *n1, char *n2)
tmp++;
*tmp = '\0';
(void) strcat(buf2, "#branch");
} else if (isdigit(*n2)) {
} else if (isdigit_c(*n2)) {
(void) sprintf(buf2, "v(%s)", n2);
} else {
(void) strcpy(buf2, n2);

View File

@ -132,12 +132,12 @@ atodims(char *p, int *data, int *outlength)
return 0;
}
while (*p && isspace(*p))
while (*p && isspace_c(*p))
p++;
if (*p == '[') {
p++;
while (*p && isspace(*p))
while (*p && isspace_c(*p))
p++;
needbracket = 1;
}
@ -150,11 +150,11 @@ atodims(char *p, int *data, int *outlength)
printf("Error: maximum of %d dimensions allowed.\n",
MAXDIMS);
length += 1;
} else if (!isdigit(*p)) {
} else if (!isdigit_c(*p)) {
data[length++] = 0; /* This position was empty. */
} else {
data[length++] = atoi(p);
while (isdigit(*p))
while (isdigit_c(*p))
p++;
}
state = 1;
@ -185,7 +185,7 @@ atodims(char *p, int *data, int *outlength)
break;
}
while (*p && isspace(*p))
while (*p && isspace_c(*p))
p++;
}
@ -218,7 +218,7 @@ skipdims(char *p)
if (!p)
return NULL;
while (*p && (*p == '[' || *p == ']' || *p == ',' || isspace(*p) || isdigit(*p)))
while (*p && (*p == '[' || *p == ']' || *p == ',' || isspace_c(*p) || isdigit_c(*p)))
p++;
return (p);

View File

@ -72,7 +72,7 @@ hlp_thandle(topic **parent)
return (NULL);
}
for (s = buf; *s && isspace(*s); s++)
for (s = buf; *s && isspace_c(*s); s++)
;
switch (*s) {
case '?':
@ -102,7 +102,7 @@ hlp_thandle(topic **parent)
*parent = curtop;
return (NULL);
}
if (!isdigit(*s)) {
if (!isdigit_c(*s)) {
fprintf(cp_err, "Invalid command\n");
continue;
}

View File

@ -202,7 +202,7 @@ inp_list(FILE *file, struct line *deck, struct line *extras, int type)
for (here = deck; here; here = here->li_next) {
if (renumber)
here->li_linenum = i;
if (ciprefix(".end", here->li_line) && !isalpha(here->li_line[4]))
if (ciprefix(".end", here->li_line) && !isalpha_c(here->li_line[4]))
continue;
if (*here->li_line != '*') {
Xprintf(file, "%6d : %s\n", here->li_linenum, upper(here->li_line));
@ -227,7 +227,7 @@ inp_list(FILE *file, struct line *deck, struct line *extras, int type)
if ((here->li_actual == NULL) || (here == deck)) {
if (renumber)
here->li_linenum = i;
if (ciprefix(".end", here->li_line) && !isalpha(here->li_line[4]))
if (ciprefix(".end", here->li_line) && !isalpha_c(here->li_line[4]))
continue;
if (type == LS_PHYSICAL)
Xprintf(file, "%6d : %s\n",
@ -239,7 +239,7 @@ inp_list(FILE *file, struct line *deck, struct line *extras, int type)
} else {
for (there = here->li_actual; there; there = there->li_next) {
there->li_linenum = i++;
if (ciprefix(".end", here->li_line) && isalpha(here->li_line[4]))
if (ciprefix(".end", here->li_line) && isalpha_c(here->li_line[4]))
continue;
if (type == LS_PHYSICAL)
Xprintf(file, "%6d : %s\n",
@ -395,7 +395,7 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile)
/* get temp from deck */
if (ciprefix(".temp", dd->li_line)) {
s = dd->li_line + 5;
while (isspace(*s))
while (isspace_c(*s))
s++;
if (temperature)
txfree(temperature);
@ -404,7 +404,7 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile)
/* Ignore comment lines, but not lines begining with '*#',
but remove them, if they are in a .control ... .endc section */
s = dd->li_line;
while (isspace(*s))
while (isspace_c(*s))
s++;
if ((*s == '*') && ((s != dd->li_line) || (s[1] != '#'))) {
if (commands) {
@ -420,9 +420,9 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile)
/* Put the first token from line into s */
strncpy(name, dd->li_line, BSIZE_SP);
for (s = name; *s && isspace(*s); s++)
for (s = name; *s && isspace_c(*s); s++)
;
for (t = s; *t && !isspace(*t); t++)
for (t = s; *t && !isspace_c(*t); t++)
;
*t = '\0';
@ -567,7 +567,7 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile)
s = dd->li_line;
*s = '*';
s = dd->li_line + 8;
while (isspace(*s))
while (isspace_c(*s))
s++;
cstoken[0] = gettok_char(&s, '=', FALSE, FALSE);
cstoken[1] = gettok_char(&s, '=', TRUE, FALSE);
@ -807,7 +807,7 @@ inp_dodeck(
if (!noparse) {
struct line *opt_beg = options;
for (; options; options = options->li_next) {
for (s = options->li_line; *s && !isspace(*s); s++)
for (s = options->li_line; *s && !isspace_c(*s); s++)
;
ii = cp_interactive;
@ -988,7 +988,7 @@ inp_dodeck(
if (!noparse) {
/*
* for (; options; options = options->li_next) {
* for (s = options->li_line; *s && !isspace(*s); s++)
* for (s = options->li_line; *s && !isspace_c(*s); s++)
* ;
* ii = cp_interactive;
* cp_interactive = FALSE;
@ -1279,7 +1279,7 @@ create_circbyline(char *line)
circarray = TMALLOC(char*, memlen);
circarray[linec++] = line;
if (linec < memlen) {
if (ciprefix(".end", line) && (line[4] == '\0' || isspace(line[4]))) {
if (ciprefix(".end", line) && (line[4] == '\0' || isspace_c(line[4]))) {
circarray[linec] = NULL;
inp_spsource(fp, FALSE, "", TRUE);
linec = 0;
@ -1444,9 +1444,9 @@ inp_parse_temper(struct line *card)
beg_tstr--;
beg_pstr = beg_tstr;
/* go back over param name */
while(isspace(*beg_pstr))
while(isspace_c(*beg_pstr))
beg_pstr--;
while(!isspace(*beg_pstr))
while(!isspace_c(*beg_pstr))
beg_pstr--;
/* get parameter name */
paramname = copy_substring(beg_pstr + 1, beg_tstr);
@ -1456,9 +1456,9 @@ inp_parse_temper(struct line *card)
/* go back over next param name */
if (*end_tstr == '=') {
end_tstr--;
while(isspace(*end_tstr))
while(isspace_c(*end_tstr))
end_tstr--;
while(!isspace(*end_tstr))
while(!isspace_c(*end_tstr))
end_tstr--;
}
/* copy the expression */
@ -1499,9 +1499,9 @@ inp_parse_temper(struct line *card)
beg_tstr--;
beg_pstr = beg_tstr;
/* go back over param name */
while(isspace(*beg_pstr))
while(isspace_c(*beg_pstr))
beg_pstr--;
while(!isspace(*beg_pstr))
while(!isspace_c(*beg_pstr))
beg_pstr--;
/* get parameter name */
paramname = copy_substring(beg_pstr + 1, beg_tstr);
@ -1511,9 +1511,9 @@ inp_parse_temper(struct line *card)
/* go back over next param name */
if (*end_tstr == '=') {
end_tstr--;
while(isspace(*end_tstr))
while(isspace_c(*end_tstr))
end_tstr--;
while(!isspace(*end_tstr))
while(!isspace_c(*end_tstr))
end_tstr--;
}
/* copy the expression */

View File

@ -140,13 +140,13 @@ static void inp_add_series_resistor(struct line *deck);
static void subckt_params_to_param(struct line *deck);
static void inp_fix_temper_in_param(struct line *deck);
static char *skip_back_non_ws(char *d) { while (d[-1] && !isspace(d[-1])) d--; return d; }
static char *skip_back_ws(char *d) { while (isspace(d[-1])) d--; return d; }
static char *skip_non_ws(char *d) { while (*d && !isspace(*d)) d++; return d; }
static char *skip_ws(char *d) { while (isspace(*d)) d++; return d; }
static char *skip_back_non_ws(char *d) { while (d[-1] && !isspace_c(d[-1])) d--; return d; }
static char *skip_back_ws(char *d) { while (isspace_c(d[-1])) d--; return d; }
static char *skip_non_ws(char *d) { while (*d && !isspace_c(*d)) d++; return d; }
static char *skip_ws(char *d) { while (isspace_c(*d)) d++; return d; }
static char *skip_back_non_ws_(char *d, char *start) { while (d > start && !isspace(d[-1])) d--; return d; }
static char *skip_back_ws_(char *d, char *start) { while (d > start && isspace(d[-1])) d--; return d; }
static char *skip_back_non_ws_(char *d, char *start) { while (d > start && !isspace_c(d[-1])) d--; return d; }
static char *skip_back_ws_(char *d, char *start) { while (d > start && isspace_c(d[-1])) d--; return d; }
static char *inp_spawn_brace(char *s);
@ -234,12 +234,12 @@ find_section_definition(struct line *c, char *name)
char *s, *t, *y;
s = skip_non_ws(line);
while (isspace(*s) || isquote(*s))
while (isspace_c(*s) || isquote(*s))
s++;
for (t = s; *t && !isspace(*t) && !isquote(*t); t++)
for (t = s; *t && !isspace_c(*t) && !isquote(*t); t++)
;
y = t;
while (isspace(*y) || isquote(*y))
while (isspace_c(*y) || isquote(*y))
y++;
if (!*y) {
@ -866,7 +866,7 @@ inp_read(FILE *fp, int call_depth, char *dir_name, bool comfile, bool intfile)
/* find the true .end command out of .endc, .ends, .endl, .end (comments may follow) */
if (ciprefix(".end", buffer))
if ((buffer[4] == '\0') || isspace(buffer[4])) {
if ((buffer[4] == '\0') || isspace_c(buffer[4])) {
found_end = TRUE;
*buffer = '*';
}
@ -955,7 +955,7 @@ is_absolute_pathname(const char *p)
return
p[0] == DIR_TERM ||
p[0] == DIR_TERM_LINUX ||
(isalpha(p[0]) && p[1] == ':' &&
(isalpha_c(p[0]) && p[1] == ':' &&
(p[2] == DIR_TERM_LINUX || p[2] == DIR_TERM));
#else
return
@ -1012,7 +1012,7 @@ inp_pathresolve(const char *name)
#if defined(__MINGW32__) || defined(_MSC_VER)
/* If variable 'mingwpath' is set: convert mingw /d/... to d:/... */
if (cp_getvar("mingwpath", CP_BOOL, NULL) && name[0] == DIR_TERM_LINUX && isalpha(name[1]) && name[2] == DIR_TERM_LINUX) {
if (cp_getvar("mingwpath", CP_BOOL, NULL) && name[0] == DIR_TERM_LINUX && isalpha_c(name[1]) && name[2] == DIR_TERM_LINUX) {
strcpy(buf, name);
buf[0] = buf[1];
buf[1] = ':';
@ -1161,8 +1161,8 @@ inp_fix_gnd_name(struct line *c)
// replace "?gnd?" by "? 0 ?", ? being a ' ' ',' '(' ')'.
while ((gnd = strstr(gnd, "gnd")) != NULL) {
if ((isspace(gnd[-1]) || gnd[-1] == '(' || gnd[-1] == ',') &&
(isspace(gnd[3]) || gnd[3] == ')' || gnd[3] == ',')) {
if ((isspace_c(gnd[-1]) || gnd[-1] == '(' || gnd[-1] == ',') &&
(isspace_c(gnd[3]) || gnd[3] == ')' || gnd[3] == ',')) {
memcpy(gnd, " 0 ", 3);
}
gnd += 3;
@ -1469,7 +1469,7 @@ inp_fix_macro_param_func_paren_io(struct line *card)
bool is_func = FALSE;
str_ptr = skip_non_ws(card->li_line); // skip over .param
str_ptr = skip_ws(str_ptr);
while (!isspace(*str_ptr) && *str_ptr != '=') {
while (!isspace_c(*str_ptr) && *str_ptr != '=') {
if (*str_ptr == '(')
is_func = TRUE;
str_ptr++;
@ -1542,7 +1542,7 @@ get_model_name(char *line, int num_terminals)
}
if (*line == 'r') /* special dealing for r models */
if ((*beg_ptr == '+') || (*beg_ptr == '-') || isdigit(*beg_ptr)) { /* looking for a value before model */
if ((*beg_ptr == '+') || (*beg_ptr == '-') || isdigit_c(*beg_ptr)) { /* looking for a value before model */
beg_ptr = skip_non_ws(beg_ptr); /* skip the value */
beg_ptr = skip_ws(beg_ptr);
}
@ -1593,19 +1593,19 @@ static int
is_a_modelname(const char *s)
{
/* first character of model name is character from alphabet */
if (isalpha(s[0]))
if (isalpha_c(s[0]))
return TRUE;
/* e.g. 1N4002 */
if (isdigit(s[0]) && isalpha(s[1]) && isdigit(s[2]))
if (isdigit_c(s[0]) && isalpha_c(s[1]) && isdigit_c(s[2]))
return TRUE;
/* e.g. 2SK456 */
if (isdigit(s[0]) && isalpha(s[1]) && isalpha(s[2]) && isdigit(s[3]))
if (isdigit_c(s[0]) && isalpha_c(s[1]) && isalpha_c(s[2]) && isdigit_c(s[3]))
return TRUE;
/* e.g. 1SMB4148 */
if (isdigit(s[0]) && isalpha(s[1]) && isalpha(s[2]) && isalpha(s[3]) && isdigit(s[4]))
if (isdigit_c(s[0]) && isalpha_c(s[1]) && isalpha_c(s[2]) && isalpha_c(s[3]) && isdigit_c(s[4]))
return TRUE;
return FALSE;
@ -1956,9 +1956,9 @@ inp_casefix(char *string)
if (*string == '"')
*string = ' ';
}
if (!isspace(*string) && !isprint(*string))
if (!isspace_c(*string) && !isprint_c(*string))
*string = '_';
if (isupper(*string))
if (isupper_c(*string))
*string = (char) tolower(*string);
string++;
}
@ -2124,7 +2124,7 @@ inp_fix_subckt(struct names *subckt_w_params, char *s)
/* get subckt name (ptr1 will point to name) */
ptr1 = skip_non_ws(s);
ptr1 = skip_ws(ptr1);
for (ptr2 = ptr1; *ptr2 && !isspace(*ptr2) && !isquote(*ptr2); ptr2++)
for (ptr2 = ptr1; *ptr2 && !isspace_c(*ptr2) && !isquote(*ptr2); ptr2++)
;
add_name(subckt_w_params, copy_substring(ptr1, ptr2));
@ -2218,7 +2218,7 @@ inp_remove_ws(char *s)
* is this really necessary ?
* or is this an artefact of original inp_remove_ws() implementation ?
*/
if (isspace(*s))
if (isspace_c(*s))
*d++ = *s++;
while (*s != '\0') {
@ -2227,7 +2227,7 @@ inp_remove_ws(char *s)
if (*s == '}')
brace_level--;
if (isspace(*s)) {
if (isspace_c(*s)) {
s = skip_ws(s);
if (!(*s == '\0' || *s == '=' || ((brace_level > 0) && (is_arith_char(*s) || *s == ','))))
*d++ = ' ';
@ -2330,12 +2330,12 @@ expand_section_ref(struct line *c, char *dir_name)
char *s, *t, *y;
s = skip_non_ws(line);
while (isspace(*s) || isquote(*s))
while (isspace_c(*s) || isquote(*s))
s++;
for (t = s; *t && !isspace(*t) && !isquote(*t); t++)
for (t = s; *t && !isspace_c(*t) && !isquote(*t); t++)
;
y = t;
while (isspace(*y) || isquote(*y))
while (isspace_c(*y) || isquote(*y))
y++;
if (*y) {
@ -2346,7 +2346,7 @@ expand_section_ref(struct line *c, char *dir_name)
char *z;
struct library *lib;
for (z = y; *z && !isspace(*z) && !isquote(*z); z++)
for (z = y; *z && !isspace_c(*z) && !isquote(*z); z++)
;
keep_char1 = *t;
keep_char2 = *z;
@ -2489,8 +2489,8 @@ inp_get_params(char *line, char *param_names[], char *param_values[])
*end = '\0';
if (*value == '{' ||
isdigit(*value) ||
(*value == '.' && isdigit(value[1])))
isdigit_c(*value) ||
(*value == '.' && isdigit_c(value[1])))
{
value = copy(value);
} else {
@ -2822,7 +2822,7 @@ inp_strip_braces(char *s)
} else if (*s == '}') {
if (--nesting < 0)
return FALSE;
} else if (!isspace(*s)) {
} else if (!isspace_c(*s)) {
*d++ = *s;
}
@ -2844,7 +2844,7 @@ inp_get_func_from_line(struct function_env *env, char *line)
/* get function name */
end = line;
while (*end && !isspace(*end) && *end != '(')
while (*end && !isspace_c(*end) && *end != '(')
end++;
function = new_function(env, copy_substring(line, end));
@ -2859,7 +2859,7 @@ inp_get_func_from_line(struct function_env *env, char *line)
/* get function parameters */
for (;;) {
char *beg = end;
while (*end && !isspace(*end) && *end != ',' && *end != ')')
while (*end && !isspace_c(*end) && *end != ',' && *end != ')')
end++;
if (end == beg)
break;
@ -2948,13 +2948,13 @@ search_func_arg(char *str, struct function *fcn, int *which, char *str_begin)
else
before = '\0';
if (is_arith_char(before) || isspace(before) || strchr(",=", before)) {
if (is_arith_char(before) || isspace_c(before) || strchr(",=", before)) {
int i;
for (i = 0; i < fcn->num_parameters; i++) {
size_t len = strlen(fcn->params[i]);
if (strncmp(str, fcn->params[i], len) == 0) {
char after = str[len];
if (is_arith_char(after) || isspace(after) || strchr(",=", after)) {
if (is_arith_char(after) || isspace_c(after) || strchr(",=", after)) {
*which = i;
return str;
}
@ -2988,7 +2988,7 @@ inp_do_macro_param_replace(struct function *fcn, char *params[])
for (p = arg_ptr; --p > str; )
if (*p == '(' || *p == ')') {
if ((*p == '(') && strchr("vi", p[-1]) &&
(p - 2 < str || is_arith_char(p[-2]) || isspace(p[-2]) || strchr(",=", p[-2])))
(p - 2 < str || is_arith_char(p[-2]) || isspace_c(p[-2]) || strchr(",=", p[-2])))
is_vi = 1;
break;
}
@ -3052,7 +3052,7 @@ inp_expand_macro_in_str(struct function_env *env, char *str)
fcn_name = open_paren_ptr;
while (--fcn_name >= search_ptr)
/* function name consists of numbers, letters and special characters (VALIDCHARS) */
if (!isalnum(*fcn_name) && !strchr(VALIDCHARS, *fcn_name))
if (!isalnum_c(*fcn_name) && !strchr(VALIDCHARS, *fcn_name))
break;
fcn_name++;
@ -3103,7 +3103,7 @@ inp_expand_macro_in_str(struct function_env *env, char *str)
for (num_params = 0; curr_ptr < close_paren_ptr; curr_ptr++) {
char *beg_parameter;
int num_parens;
if (isspace(*curr_ptr))
if (isspace_c(*curr_ptr))
continue;
beg_parameter = curr_ptr;
num_parens = 0;
@ -3328,12 +3328,12 @@ inp_fix_param_values(struct line *c)
beg_of_str = skip_ws(equal_ptr + 1);
/* all cases where no {} have to be put around selected token */
if (isdigit(*beg_of_str) ||
if (isdigit_c(*beg_of_str) ||
*beg_of_str == '{' ||
*beg_of_str == '.' ||
*beg_of_str == '"' ||
((*beg_of_str == '-' || *beg_of_str == '+') && isdigit(beg_of_str[1])) ||
((*beg_of_str == '-' || *beg_of_str == '+') && beg_of_str[1] == '.' && isdigit(beg_of_str[2])) ||
((*beg_of_str == '-' || *beg_of_str == '+') && isdigit_c(beg_of_str[1])) ||
((*beg_of_str == '-' || *beg_of_str == '+') && beg_of_str[1] == '.' && isdigit_c(beg_of_str[2])) ||
ciprefix("true", beg_of_str) ||
ciprefix("false", beg_of_str))
{
@ -3355,8 +3355,8 @@ inp_fix_param_values(struct line *c)
break;
buffer = TMALLOC(char, strlen(natok) + 4);
if (isdigit(*natok) || *natok == '{' || *natok == '.' ||
*natok == '"' || (*natok == '-' && isdigit(natok[1])) ||
if (isdigit_c(*natok) || *natok == '{' || *natok == '.' ||
*natok == '"' || (*natok == '-' && isdigit_c(natok[1])) ||
ciprefix("true", natok) || ciprefix("false", natok) ||
eq(natok, "<") || eq(natok, ">"))
{
@ -3365,8 +3365,8 @@ inp_fix_param_values(struct line *c)
/* < xx and yy > have been dealt with before */
/* <xx */
} else if (*natok == '<') {
if (isdigit(natok[1]) ||
(natok[1] == '-' && isdigit(natok[2])))
if (isdigit_c(natok[1]) ||
(natok[1] == '-' && isdigit_c(natok[2])))
{
(void) sprintf(buffer, "%s", natok);
} else {
@ -3375,7 +3375,7 @@ inp_fix_param_values(struct line *c)
}
/* yy> */
} else if (strchr(natok, '>')) {
if (isdigit(*natok) || (*natok == '-' && isdigit(natok[1]))) {
if (isdigit_c(*natok) || (*natok == '-' && isdigit_c(natok[1]))) {
(void) sprintf(buffer, "%s", natok);
} else {
whereisgt = strchr(natok, '>');
@ -3421,8 +3421,8 @@ inp_fix_param_values(struct line *c)
break;
buffer = TMALLOC(char, strlen(natok) + 4);
if (isdigit(*natok) || *natok == '{' || *natok == '.' ||
*natok == '"' || (*natok == '-' && isdigit(natok[1])) ||
if (isdigit_c(*natok) || *natok == '{' || *natok == '.' ||
*natok == '"' || (*natok == '-' && isdigit_c(natok[1])) ||
ciprefix("true", natok) || ciprefix("false", natok))
{
(void) sprintf(buffer, "%s", natok);
@ -3451,7 +3451,7 @@ inp_fix_param_values(struct line *c)
end_of_str = beg_of_str;
parens = 0;
while (*end_of_str != '\0' &&
(!isspace(*end_of_str) || (parens > 0)))
(!isspace_c(*end_of_str) || (parens > 0)))
{
if (*end_of_str == '(')
parens++;
@ -3642,7 +3642,7 @@ get_number_terminals(char *c)
if we have a token with only digits, and where the previous token does not
end with a ',' */
while (*nametmp) {
if (isalpha(*nametmp) || (*nametmp == ','))
if (isalpha_c(*nametmp) || (*nametmp == ','))
only_digits = FALSE;
nametmp++;
}
@ -3979,7 +3979,7 @@ inp_split_multi_param_lines(struct line *card, int line_num)
beg_param = skip_back_ws_(equal_ptr, curr_line);
beg_param = skip_back_non_ws_(beg_param, curr_line);
end_param = skip_ws(equal_ptr + 1);
while (*end_param != '\0' && (!isspace(*end_param) || get_expression || get_paren_expression)) {
while (*end_param != '\0' && (!isspace_c(*end_param) || get_expression || get_paren_expression)) {
if (*end_param == '{')
get_expression = TRUE;
if (*end_param == '(')
@ -4031,7 +4031,7 @@ inp_split_multi_param_lines(struct line *card, int line_num)
static int
identifier_char(char c)
{
return (c == '_') || isalnum(c);
return (c == '_') || isalnum_c(c);
}
@ -4068,9 +4068,9 @@ search_identifier(char *str, const char *identifier, char *str_begin)
else
before = '\0';
if (is_arith_char(before) || isspace(before) || strchr("=,{", before)) {
if (is_arith_char(before) || isspace_c(before) || strchr("=,{", before)) {
char after = str[strlen(identifier)];
if (is_arith_char(after) || isspace(after) || strchr(",}", after))
if (is_arith_char(after) || isspace_c(after) || strchr(",}", after))
return str;
}
@ -4092,9 +4092,9 @@ ya_search_identifier(char *str, const char *identifier, char *str_begin)
else
before = '\0';
if (is_arith_char(before) || isspace(before) || (str <= str_begin)) {
if (is_arith_char(before) || isspace_c(before) || (str <= str_begin)) {
char after = str[strlen(identifier)];
if ((is_arith_char(after) || isspace(after) || after == '\0'))
if ((is_arith_char(after) || isspace_c(after) || after == '\0'))
break;
}
@ -4753,7 +4753,7 @@ inp_compat(struct line *card)
str_ptr = strstr(cut_line, "tc1");
if (str_ptr) {
/* We need to have 'tc1=something */
if (str_ptr[3] && (isspace(str_ptr[3]) || (str_ptr[3] == '='))) {
if (str_ptr[3] && (isspace_c(str_ptr[3]) || (str_ptr[3] == '='))) {
tc1_ptr = strchr(str_ptr, '=');
if (tc1_ptr)
tc1 = atof(tc1_ptr+1);
@ -4762,7 +4762,7 @@ inp_compat(struct line *card)
str_ptr = strstr(cut_line, "tc2");
if (str_ptr) {
/* We need to have 'tc2=something */
if (str_ptr[3] && (isspace(str_ptr[3]) || (str_ptr[3] == '='))) {
if (str_ptr[3] && (isspace_c(str_ptr[3]) || (str_ptr[3] == '='))) {
tc2_ptr = strchr(str_ptr, '=');
if (tc2_ptr)
tc2 = atof(tc2_ptr+1);
@ -4828,7 +4828,7 @@ inp_compat(struct line *card)
str_ptr = strstr(cut_line, "tc1");
if (str_ptr) {
/* We need to have 'tc1=something */
if (str_ptr[3] && (isspace(str_ptr[3]) || (str_ptr[3] == '='))) {
if (str_ptr[3] && (isspace_c(str_ptr[3]) || (str_ptr[3] == '='))) {
tc1_ptr = strchr(str_ptr, '=');
if (tc1_ptr)
tc1 = atof(tc1_ptr+1);
@ -4837,7 +4837,7 @@ inp_compat(struct line *card)
str_ptr = strstr(cut_line, "tc2");
if (str_ptr) {
/* We need to have 'tc2=something */
if (str_ptr[3] && (isspace(str_ptr[3]) || (str_ptr[3] == '='))) {
if (str_ptr[3] && (isspace_c(str_ptr[3]) || (str_ptr[3] == '='))) {
tc2_ptr = strchr(str_ptr, '=');
if (tc2_ptr)
tc2 = atof(tc2_ptr+1);
@ -4922,7 +4922,7 @@ inp_compat(struct line *card)
str_ptr = strstr(cut_line, "tc1");
if (str_ptr) {
/* We need to have 'tc1=something */
if (str_ptr[3] && (isspace(str_ptr[3]) || (str_ptr[3] == '='))) {
if (str_ptr[3] && (isspace_c(str_ptr[3]) || (str_ptr[3] == '='))) {
tc1_ptr = strchr(str_ptr, '=');
if (tc1_ptr)
tc1 = atof(tc1_ptr+1);
@ -4931,7 +4931,7 @@ inp_compat(struct line *card)
str_ptr = strstr(cut_line, "tc2");
if (str_ptr) {
/* We need to have 'tc2=something */
if (str_ptr[3] && (isspace(str_ptr[3]) || (str_ptr[3] == '='))) {
if (str_ptr[3] && (isspace_c(str_ptr[3]) || (str_ptr[3] == '='))) {
tc2_ptr = strchr(str_ptr, '=');
if (tc2_ptr)
tc2 = atof(tc2_ptr+1);
@ -5479,7 +5479,7 @@ inp_modify_exp(char* expr)
if ((*s == '|') || (*s == '&'))
s++;
wl->wl_word = copy_substring(beg, s);
} else if (isalpha(c)) {
} else if (isalpha_c(c)) {
char buf[512];
int i = 0;
@ -5491,7 +5491,7 @@ inp_modify_exp(char* expr)
buf[i] = '\0';
wl->wl_word = copy(buf);
} else {
while (isalnum(*s) ||
while (isalnum_c(*s) ||
(*s == '!') || (*s == '#') ||
(*s == '$') || (*s == '%') ||
(*s == '_') || (*s == '[') ||
@ -5528,13 +5528,13 @@ inp_modify_exp(char* expr)
wl->wl_word = tprintf("({%s})", buf);
}
}
} else if (isdigit(c) || (c == '.')) { /* allow .5 format too */
} else if (isdigit_c(c) || (c == '.')) { /* allow .5 format too */
int error1;
/* allow 100p, 5MEG etc. */
double dvalue = INPevaluate(&s, &error1, 0);
wl->wl_word = tprintf("%18.10e", dvalue);
/* skip the `unit', FIXME INPevaluate() should do this */
while (isalpha(*s))
while (isalpha_c(*s))
s++;
} else { /* strange char */
printf("Preparing expression for numparam\nWhat is this?\n%s\n", s);
@ -6129,18 +6129,18 @@ inp_quote_params(struct line *c, struct line *end_c, struct dependency *deps, in
char *rest = s + strlen(deps[i].param_name);
if ((isspace(s[-1]) || s[-1] == '=') &&
(isspace(*rest) || *rest == '\0' || *rest == ')'))
if ((isspace_c(s[-1]) || s[-1] == '=') &&
(isspace_c(*rest) || *rest == '\0' || *rest == ')'))
{
int prefix_len;
if (isspace(s[-1])) {
if (isspace_c(s[-1])) {
s = skip_back_ws(s);
if (s[-1] == '{')
s--;
}
if (isspace(*rest)) {
if (isspace_c(*rest)) {
/* possible case: "{ length }" -> {length} */
rest = skip_ws(rest);
if (*rest == '}')

View File

@ -79,7 +79,7 @@ com_reshape(wordlist *wl)
wlast = wlast->wl_next;
}
while (*p && isspace(*p))
while (*p && isspace_c(*p))
p++;
switch (state) {
@ -89,7 +89,7 @@ com_reshape(wordlist *wl)
if (numdims == MAXDIMS)
printf("Maximum of %d dimensions possible\n", MAXDIMS);
numdims += 1;
} else if (!isdigit(*p)) {
} else if (!isdigit_c(*p)) {
if (empty > -1) {
printf("dimensions underspecified at dimension %d\n",
numdims++);
@ -100,7 +100,7 @@ com_reshape(wordlist *wl)
}
} else {
dims[numdims++] = atoi(p);
while (isdigit(*p))
while (isdigit_c(*p))
p++;
}
state = 1;
@ -113,10 +113,10 @@ com_reshape(wordlist *wl)
} else if (*p == ',') {
p++;
state = 0;
} else if (isdigit(*p)) {
} else if (isdigit_c(*p)) {
state = 0;
break;
} else if (!isspace(*p)) {
} else if (!isspace_c(*p)) {
/* error */
state = 4;
}
@ -131,7 +131,7 @@ com_reshape(wordlist *wl)
}
}
while (*p && isspace(*p))
while (*p && isspace_c(*p))
p++;
} while (state < 3);

View File

@ -56,8 +56,8 @@ bool
ci_prefix(const char *p, const char *s)
{
while (*p) {
if ((isupper(*p) ? tolower(*p) : *p) !=
(isupper(*s) ? tolower(*s) : *s))
if ((isupper_c(*p) ? tolower(*p) : *p) !=
(isupper_c(*s) ? tolower(*s) : *s))
return (0);
p++;
s++;

View File

@ -831,7 +831,7 @@ nupa_eval(char *s, int linenum, int orig_linenum)
} else if (c == 'X') {
/* compute args of subcircuit, if required */
ptr = s;
while (!isspace(*ptr))
while (!isspace_c(*ptr))
ptr++;
keep = *ptr;
*ptr = '\0';

View File

@ -1635,7 +1635,7 @@ nupa_subcktcall(dico_t *dico, char *s, char *x, bool err)
continue;
kptr = jptr;
while (--kptr >= optr && isspace(*kptr))
while (--kptr >= optr && isspace_c(*kptr))
;
hptr = kptr;

View File

@ -93,9 +93,9 @@ inp_nutsource(FILE *fp, bool comfile, char *filename)
continue;
}
(void) strncpy(name, dd->li_line, BSIZE_SP);
for (s = name; *s && isspace(*s); s++)
for (s = name; *s && isspace_c(*s); s++)
;
for (t = s; *t && !isspace(*t); t++)
for (t = s; *t && !isspace_c(*t); t++)
;
*t = '\0';

View File

@ -1039,7 +1039,7 @@ plotInit(runDesc *run)
dataDesc *dd = &run->data[i];
char *name;
if (isdigit(dd->name[0]))
if (isdigit_c(dd->name[0]))
name = tprintf("V(%s)", dd->name);
else
name = copy(dd->name);

View File

@ -607,7 +607,7 @@ PPlex(YYSTYPE *lvalp, struct PPltype *llocp, char **line)
{
/* Workaround, The Frontend makes "<>" into "< >" */
int j = 1;
while (isspace(sbuf[j]))
while (isspace_c(sbuf[j]))
j++;
if (((sbuf[j] == '<') || (sbuf[j] == '>')) && (sbuf[0] != sbuf[j])) {
/* Allow both <> and >< for NE. */

View File

@ -53,19 +53,19 @@ ft_numparse(char **s, bool whole)
}
/* We don't want to recognise "P" as 0P, or .P as 0.0P... */
if ((!isdigit(*string) && *string != '.') ||
((*string == '.') && !isdigit(string[1])))
if ((!isdigit_c(*string) && *string != '.') ||
((*string == '.') && !isdigit_c(string[1])))
return (NULL);
/* Now accumulate a number. Note ascii dependencies here... */
while (isdigit(*string))
while (isdigit_c(*string))
mant = mant * 10.0 + (*string++ - '0');
/* Now maybe a decimal point. */
if (*string == '.') {
string++;
p = 1;
while (isdigit(*string))
while (isdigit_c(*string))
mant += (*string++ - '0') / power10(p++);
}
@ -82,12 +82,12 @@ ft_numparse(char **s, bool whole)
exsign = -1;
string++;
}
while (isdigit(*string))
while (isdigit_c(*string))
expo = expo * 10.0 + (*string++ - '0');
if (*string == '.') {
string++;
p = 1;
while (isdigit(*string))
while (isdigit_c(*string))
expo += (*string++ - '0') / power10(p++);
}
expo *= exsign;
@ -152,14 +152,14 @@ ft_numparse(char **s, bool whole)
if (whole && *string != '\0') {
return (NULL);
} else if (ft_strictnumparse && *string && isdigit(string[-1])) {
} else if (ft_strictnumparse && *string && isdigit_c(string[-1])) {
if (*string == '_')
while (isalpha(*string) || (*string == '_'))
while (isalpha_c(*string) || (*string == '_'))
string++;
else
return (NULL);
} else {
while (isalpha(*string) || (*string == '_'))
while (isalpha_c(*string) || (*string == '_'))
string++;
}
*s = string;

View File

@ -1035,11 +1035,11 @@ readtics(char *string)
for (k = 0; *words && k < MAXTICS; words = worde) {
while (isspace(*words))
while (isspace_c(*words))
words++;
worde = words;
while (isalpha(*worde) || isdigit(*worde))
while (isalpha_c(*worde) || isdigit_c(*worde))
worde++;
if (*worde)

View File

@ -160,7 +160,7 @@ com_print(wordlist *wl)
for (s = buf; *s; s++)
;
s--;
while (isspace(*s)) {
while (isspace_c(*s)) {
*s = '\0';
s--;
}

View File

@ -265,9 +265,9 @@ raw_write(char *name, struct plot *pl, bool app, bool binary)
#define SKIP(s) \
do { \
while (*(s) && !isspace(*(s))) \
while (*(s) && !isspace_c(*(s))) \
(s)++; \
while (isspace(*(s))) \
while (isspace_c(*(s))) \
(s)++; \
} while(0)
@ -499,7 +499,7 @@ raw_read(char *name) {
fprintf(cp_err, "Error: bad var line %s\n", buf);
/* Fix the name... */
if (isdigit(v->v_name[0]) && (r = ft_typabbrev(v ->v_type)) != NULL) {
if (isdigit_c(v->v_name[0]) && (r = ft_typabbrev(v ->v_type)) != NULL) {
char *x = v->v_name;
v->v_name = tprintf("%s(%s)", r, v->v_name);
tfree(x);

View File

@ -152,10 +152,10 @@ collect_global_nodes(struct line *c)
txfree(gettok(&s));
while (*s) {
char *t = s;
for (; *s && !isspace(*s); s++)
for (; *s && !isspace_c(*s); s++)
;
global_nodes[num_global_nodes++] = copy_substring(t, s);
while (isspace(*s))
while (isspace_c(*s))
s++;
}
c->li_line[0] = '*'; /* comment it out */
@ -322,9 +322,9 @@ inp_subcktexpand(struct line *deck) {
} else if (*s == '.') {
continue; /* skip .commands */
} else { /* any other line . . . */
while (*s && !isspace(*s)) /* skip first token */
while (*s && !isspace_c(*s)) /* skip first token */
s++;
while (*s && isspace(*s)) /* skip whitespace */
while (*s && isspace_c(*s)) /* skip whitespace */
s++;
if (*s == '(') {
@ -495,11 +495,11 @@ doit(struct line *deck, wordlist *modnames) {
/* count the number of args in the .subckt line */
sss->su_numargs = 0;
for (;;) {
while (isspace(*s))
while (isspace_c(*s))
s++;
if (*s == '\0')
break;
while (*s && !isspace(*s))
while (*s && !isspace_c(*s))
s++;
sss->su_numargs ++;
}
@ -1310,14 +1310,14 @@ finishLine(struct bxx_buffer *t, char *src, char *scname)
if (((*src != 'v') && (*src != 'V') &&
(*src != 'i') && (*src != 'I')) ||
lastwasalpha) {
lastwasalpha = isalpha(*src);
lastwasalpha = isalpha_c(*src);
bxx_putc(t, *src++);
continue;
}
for (s = src + 1; *s && isspace(*s); s++)
for (s = src + 1; *s && isspace_c(*s); s++)
;
if (!*s || (*s != '(')) {
lastwasalpha = isalpha(*src);
lastwasalpha = isalpha_c(*src);
bxx_putc(t, *src++);
continue;
}
@ -1325,9 +1325,9 @@ finishLine(struct bxx_buffer *t, char *src, char *scname)
bxx_putc(t, which = *src);
src = s;
bxx_putc(t, *src++);
while (isspace(*src))
while (isspace_c(*src))
src++;
for (buf = src; *src && !isspace(*src) && *src != ',' && *src != ')'; )
for (buf = src; *src && !isspace_c(*src) && *src != ',' && *src != ')'; )
src++;
buf_end = src;
@ -1362,11 +1362,11 @@ finishLine(struct bxx_buffer *t, char *src, char *scname)
/* translate the reference node, as in the "2" in "v(4,2)" */
if ((which == 'v') || (which == 'V')) {
while (*src && (isspace(*src) || *src == ',')) {
while (*src && (isspace_c(*src) || *src == ',')) {
src++;
}
if (*src && *src != ')') {
for (buf = src; *src && !isspace(*src) && (*src != ')'); )
for (buf = src; *src && !isspace_c(*src) && (*src != ')'); )
src++;
s = gettrans(buf, buf_end = src);
bxx_putc(t, ',');
@ -1473,11 +1473,11 @@ numnodes(char *name, struct subs *subs, wordlist const *modnames)
const wordlist *wl;
int n, i, gotit;
while (*name && isspace(*name))
while (*name && isspace_c(*name))
name++;
c = *name;
if (isupper(c))
if (isupper_c(c))
c = (char) tolower(c);
(void) strncpy(buf, name, sizeof(buf));
@ -1504,9 +1504,9 @@ numnodes(char *name, struct subs *subs, wordlist const *modnames)
int nodes = -2;
for (s = buf; *s; ) {
nodes++;
while (*s && !isspace(*s))
while (*s && !isspace_c(*s))
s++;
while (isspace(*s))
while (isspace_c(*s))
s++;
}
return (nodes);
@ -1580,7 +1580,7 @@ static int
numdevs(char *s)
{
while (*s && isspace(*s))
while (*s && isspace_c(*s))
s++;
switch (*s) {
case 'K':
@ -1690,10 +1690,10 @@ devmodtranslate(struct line *s, char *subname, wordlist * const orig_modnames)
printf("In devmodtranslate, examining line %s.\n", t);
#endif
while (*t && isspace(*t))
while (*t && isspace_c(*t))
t++;
c = *t; /* set c to first char in line. . . . */
if (isupper(c))
if (isupper_c(c))
c = (char) tolower(c);
buffer = TMALLOC(char, strlen(t) + strlen(subname) + 4);
@ -2049,7 +2049,7 @@ devmodtranslate(struct line *s, char *subname, wordlist * const orig_modnames)
static int
inp_numnodes(char c)
{
if (isupper(c))
if (isupper_c(c))
c = (char) tolower(c);
switch (c) {
case ' ':

View File

@ -678,7 +678,7 @@ span_var_expr(char *t)
int parenthesis = 0;
int brackets = 0;
while (*t && (isalnum(*t) || strchr(VALIDCHARS, *t)))
while (*t && (isalnum_c(*t) || strchr(VALIDCHARS, *t)))
switch (*t++)
{
case '[':
@ -848,7 +848,7 @@ vareval(char *string)
for (v = variables; v; v = v->va_next)
if (eq(v->va_name, string))
break;
if (!v && isdigit(*string)) {
if (!v && isdigit_c(*string)) {
for (v = variables; v; v = v->va_next)
if (eq(v->va_name, "argv"))
break;
@ -879,7 +879,7 @@ vareval(char *string)
char *t = ++range;
if (*t == '&')
t++;
while (isalnum(*t))
while (isalnum_c(*t))
t++;
*t = '\0';
r = vareval(range);
@ -891,10 +891,10 @@ vareval(char *string)
}
range = r->wl_word;
}
for (low = 0; isdigit(*range); range++)
for (low = 0; isdigit_c(*range); range++)
low = low * 10 + *range - '0';
if ((*range == '-') && isdigit(range[1]))
for (up = 0, range++; isdigit(*range); range++)
if ((*range == '-') && isdigit_c(range[1]))
for (up = 0, range++; isdigit_c(*range); range++)
up = up * 10 + *range - '0';
else if (*range == '-')
up = wl_length(wl);

View File

@ -209,18 +209,18 @@ namecmp(const void *a, const void *b)
const char *t = (const char *) b;
for (;;) {
while ((*s == *t) && !isdigit(*s) && *s)
while ((*s == *t) && !isdigit_c(*s) && *s)
s++, t++;
if (!*s)
return (0);
if ((*s != *t) && (!isdigit(*s) || !isdigit(*t)))
if ((*s != *t) && (!isdigit_c(*s) || !isdigit_c(*t)))
return (*s - *t);
/* The beginning of a number... Grab the two numbers and then
* compare them... */
for (i = 0; isdigit(*s); s++)
for (i = 0; isdigit_c(*s); s++)
i = i * 10 + *s - '0';
for (j = 0; isdigit(*t); t++)
for (j = 0; isdigit_c(*t); t++)
j = j * 10 + *t - '0';
if (i != j)
@ -937,12 +937,12 @@ vec_basename(struct dvec *v)
}
strtolower(buf);
for (t = buf; isspace(*t); t++)
for (t = buf; isspace_c(*t); t++)
;
s = t;
for (t = s; *t; t++)
;
while ((t > s) && isspace(t[-1]))
while ((t > s) && isspace_c(t[-1]))
*--t = '\0';
return (copy(s));
}
@ -1148,7 +1148,7 @@ plot_prefix(char *pre, char *str)
str++;
}
if (*pre || (*str && isdigit(pre[-1])))
if (*pre || (*str && isdigit_c(pre[-1])))
return (FALSE);
else
return (TRUE);

View File

@ -157,7 +157,7 @@ char *spice_dstring_append_lower(SPICE_DSTRINGPTR dsPtr, const char *string, int
----------------------------------------------------------------- */
for( dst = dsPtr->string + dsPtr->length, end = string+length;
string < end; string++, dst++) {
if( isupper(*string) ) {
if( isupper_c(*string) ) {
*dst = (char)tolower(*string) ;
} else {
*dst = *string ;

View File

@ -148,7 +148,7 @@ scannum(char *str)
{
int i = 0;
while(isdigit(*str))
while(isdigit_c(*str))
i = i * 10 + *(str++) - '0';
return(i);
}
@ -160,8 +160,8 @@ int
cieq(const char *p, const char *s)
{
while (*p) {
if ((isupper(*p) ? tolower(*p) : *p) !=
(isupper(*s) ? tolower(*s) : *s))
if ((isupper_c(*p) ? tolower(*p) : *p) !=
(isupper_c(*s) ? tolower(*s) : *s))
return(FALSE);
p++;
s++;
@ -175,8 +175,8 @@ int
ciprefix(const char *p, const char *s)
{
while (*p) {
if ((isupper(*p) ? tolower(*p) : *p) !=
(isupper(*s) ? tolower(*s) : *s))
if ((isupper_c(*p) ? tolower(*p) : *p) !=
(isupper_c(*s) ? tolower(*s) : *s))
return(FALSE);
p++;
s++;
@ -189,7 +189,7 @@ strtolower(char *str)
{
if (str)
while (*str) {
if(isupper(*str))
if(isupper_c(*str))
*str = (char) tolower(*str);
str++;
}
@ -200,7 +200,7 @@ strtoupper(char *str)
{
if (str)
while (*str) {
if(islower(*str))
if(islower_c(*str))
*str = (char) toupper(*str);
str++;
}
@ -228,7 +228,7 @@ register int n)
if (!p || !s) return( 0 );
while (*p) {
if ((isupper(*p) ? tolower(*p) : *p) != (isupper(*s) ? tolower(*s) : *s))
if ((isupper_c(*p) ? tolower(*p) : *p) != (isupper_c(*s) ? tolower(*s) : *s))
return( 0 );
p++;
s++;
@ -255,7 +255,7 @@ register char *p, register char *s)
if (!p || !s) return( 0 );
while (*p) {
if ((isupper(*p) ? tolower(*p) : *p) != (isupper(*s) ? tolower(*s) : *s))
if ((isupper_c(*p) ? tolower(*p) : *p) != (isupper_c(*s) ? tolower(*s) : *s))
return( n );
p++;
s++;
@ -282,12 +282,12 @@ gettok(char **s)
char *beg, *token ; /* return token */
paren = 0;
while (isspace(**s))
while (isspace_c(**s))
(*s)++;
if (!**s)
return (NULL);
beg = *s ;
while ((c = **s) != '\0' && !isspace(c)) {
while ((c = **s) != '\0' && !isspace_c(c)) {
if (c == '(')
paren += 1;
else if (c == ')')
@ -297,7 +297,7 @@ gettok(char **s)
(*s)++ ;
}
token = copy_substring(beg, *s) ;
while (isspace(**s) || **s == ',')
while (isspace_c(**s) || **s == ',')
(*s)++;
return ( token ) ;
}
@ -316,7 +316,7 @@ gettok_iv(char **s)
SPICE_DSTRING buf ; /* allow any length string */
paren = 0;
while ((isspace(**s)) || (**s=='='))
while ((isspace_c(**s)) || (**s=='='))
(*s)++;
if ((!**s) || ((**s != 'v') && (**s != 'i') && (**s != 'V') && (**s != 'I')))
return (NULL);
@ -329,14 +329,14 @@ gettok_iv(char **s)
paren += 1;
else if (c == ')')
paren -= 1;
if (isspace(c))
if (isspace_c(c))
(*s)++;
else {
spice_dstring_append_char( &buf, *(*s)++ ) ;
if (paren == 0) break;
}
}
while (isspace(**s) || **s == ',')
while (isspace_c(**s) || **s == ',')
(*s)++;
token = copy( spice_dstring_value(&buf) ) ;
spice_dstring_free(&buf) ;
@ -357,7 +357,7 @@ gettok_noparens(char **s)
char c;
char *beg, *token ; /* return token */
while ( isspace(**s) )
while ( isspace_c(**s) )
(*s)++; /* iterate over whitespace */
if (!**s)
@ -365,7 +365,7 @@ gettok_noparens(char **s)
beg = *s ;
while ((c = **s) != '\0' &&
!isspace(c) &&
!isspace_c(c) &&
( **s != '(' ) &&
( **s != ')' ) &&
( **s != ',')
@ -376,7 +376,7 @@ gettok_noparens(char **s)
token = copy_substring(beg, *s) ;
/* Now iterate up to next non-whitespace char */
while ( isspace(**s) )
while ( isspace_c(**s) )
(*s)++;
return ( token ) ;
@ -388,7 +388,7 @@ gettok_instance(char **s)
char c;
char *beg, *token ; /* return token */
while ( isspace(**s) )
while ( isspace_c(**s) )
(*s)++; /* iterate over whitespace */
if (!**s)
@ -396,7 +396,7 @@ gettok_instance(char **s)
beg = *s ;
while ((c = **s) != '\0' &&
!isspace(c) &&
!isspace_c(c) &&
( **s != '(' ) &&
( **s != ')' )
) {
@ -406,7 +406,7 @@ gettok_instance(char **s)
token = copy_substring(beg, *s) ;
/* Now iterate up to next non-whitespace char */
while ( isspace(**s) )
while ( isspace_c(**s) )
(*s)++;
return ( token ) ;
@ -424,7 +424,7 @@ gettok_char(char **s, char p, bool inc_p, bool nested)
char c;
char *beg, *token ; /* return token */
while ( isspace(**s) )
while ( isspace_c(**s) )
(*s)++; /* iterate over whitespace */
if (!**s)
@ -472,7 +472,7 @@ gettok_char(char **s, char p, bool inc_p, bool nested)
token = copy_substring(beg, *s) ;
/* Now iterate up to next non-whitespace char */
while ( isspace(**s) )
while ( isspace_c(**s) )
(*s)++;
return ( token ) ;
@ -493,7 +493,7 @@ gettok_node(char **s)
if (*s == NULL)
return NULL;
while (isspace(**s) ||
while (isspace_c(**s) ||
( **s == '(' ) ||
( **s == ')' ) ||
( **s == ',')
@ -505,7 +505,7 @@ gettok_node(char **s)
token = *s;
while ((c = **s) != '\0' &&
!isspace(c) &&
!isspace_c(c) &&
( **s != '(' ) &&
( **s != ')' ) &&
( **s != ',')
@ -516,7 +516,7 @@ gettok_node(char **s)
token = copy_substring(token, *s);
/* Now iterate up to next non-whitespace char */
while (isspace(**s) ||
while (isspace_c(**s) ||
( **s == '(' ) ||
( **s == ')' ) ||
( **s == ',')
@ -665,12 +665,12 @@ get_comma_separated_values( char *values[], char *str ) {
while ( ( comma_ptr = strstr( str, "," ) ) != NULL ) {
ptr = comma_ptr - 1;
while ( isspace(*ptr) ) ptr--;
while ( isspace_c(*ptr) ) ptr--;
ptr++; keep = *ptr; *ptr = '\0';
values[count++] = strdup(str);
*ptr = keep;
str = comma_ptr + 1;
while ( isspace(*str) ) str++;
while ( isspace_c(*str) ) str++;
}
values[count++] = strdup(str);
return count;
@ -711,7 +711,7 @@ model_name_match(const char *token, const char *model_name)
// all of them digits
for (; *p; p++)
if (!isdigit(*p))
if (!isdigit_c(*p))
return 0;
return 2;

View File

@ -42,7 +42,7 @@ tildexpand(char *string)
if (!string)
return NULL;
while (*string && isspace(*string))
while (*string && isspace_c(*string))
string++;
if (*string != '~')

View File

@ -85,7 +85,7 @@ void INP2R(CKTcircuit *ckt, INPtables * tab, card * current)
s += 2;
/* skip any white space */
while(isspace(*s))
while(isspace_c(*s))
s++;
/* reject if not '=' */
@ -95,27 +95,27 @@ void INP2R(CKTcircuit *ckt, INPtables * tab, card * current)
s++;
/* skip any white space */
while(isspace(*s))
while(isspace_c(*s))
s++;
/* if we now have +, - or a decimal digit then assume we have a number,
otherwise reject */
if((*s != '+') && (*s != '-') && !isdigit(*s))
if((*s != '+') && (*s != '-') && !isdigit_c(*s))
continue;
/* look for next white space or null */
while(*s && !isspace(*s))
while(*s && !isspace_c(*s))
s++;
left_length = (size_t) (s - current->line);
/* skip any additional white space */
while(isspace(*s))
while(isspace_c(*s))
s++;
/* if we now have +, - or a decimal digit then assume we have the
second number, otherwise reject */
if((*s != '+') && (*s != '-') && !isdigit(*s))
if((*s != '+') && (*s != '-') && !isdigit_c(*s))
continue;
/* if we get this far we have met all are criterea,

View File

@ -16,7 +16,7 @@ void INPcaseFix(register char *string)
{
while (*string) {
if (isupper(*string)) {
if (isupper_c(*string)) {
*string = (char) tolower(*string);
}
string++;

View File

@ -53,7 +53,7 @@ INPevaluate(char **line, int *error, int gobble)
sign = -1;
}
if ((*here == '\0') || ((!(isdigit(*here))) && (*here != '.'))) {
if ((*here == '\0') || ((!(isdigit_c(*here))) && (*here != '.'))) {
/* number looks like just a sign! */
*error = 1;
if (gobble) {
@ -64,7 +64,7 @@ INPevaluate(char **line, int *error, int gobble)
return (0);
}
while (isdigit(*here)) {
while (isdigit_c(*here)) {
/* digit, so accumulate it. */
mantis = 10 * mantis + *here - '0';
here++;
@ -108,7 +108,7 @@ INPevaluate(char **line, int *error, int gobble)
return ((double) mantis * sign);
}
while (isdigit(*here)) {
while (isdigit_c(*here)) {
/* digit, so accumulate it. */
mantis = 10 * mantis + *here - '0';
expo1 = expo1 - 1;
@ -131,7 +131,7 @@ INPevaluate(char **line, int *error, int gobble)
/* now look for the digits of the exponent */
}
while (isdigit(*here)) {
while (isdigit_c(*here)) {
expo2 = 10 * expo2 + *here - '0';
here++;
}

View File

@ -89,7 +89,7 @@ INPgetTok(char **line, char **token, int gobble)
if (*point == '^')
break;
if (isdigit(*point) || *point == '.') {
if (isdigit_c(*point) || *point == '.') {
if (signstate > 1)
signstate = 3;
else
@ -300,7 +300,7 @@ INPgetUTok(char **line, char **token, int gobble)
if (*point == '^')
break;
if (isdigit(*point) || *point == '.') {
if (isdigit_c(*point) || *point == '.') {
if (signstate > 1)
signstate = 3;
else

View File

@ -88,7 +88,7 @@ void INPpas2(CKTcircuit *ckt, card * data, INPtables * tab, TSKtask *task)
#endif
c = *(current->line);
if(islower(c))
if(islower_c(c))
c = (char) toupper(c);
switch (c) {

View File

@ -261,7 +261,7 @@ static Status_t read_modpath(
/* Strip white space including newline */
for(i = 0, j = 0; i < len; ) {
if(isspace(path[i])) {
if(isspace_c(path[i])) {
i++;
}
else {
@ -378,7 +378,7 @@ static Status_t read_udnpath(
/* Strip white space including newline */
for(i = 0, j = 0; i < len; ) {
if(isspace(path[i])) {
if(isspace_c(path[i])) {
i++;
}
else {

View File

@ -85,8 +85,8 @@ void str_to_lower(char *s)
char c;
for(i = 0; (c = s[i]) != '\0'; i++)
if(isalpha(c))
if(isupper(c))
if(isalpha_c(c))
if(isupper_c(c))
s[i] = (char) tolower(c);
}

View File

@ -204,7 +204,7 @@ void cm_filesource(ARGS) /* structure holding parms, inputs, outputs, etc.
}
loc->state->pos = ftell(loc->state->fp);
cpdel = cp = strdup(line);
while (*cp && isspace(*cp))
while (*cp && isspace_c(*cp))
++cp;
if (*cp == '#' || *cp == ';') {
free(cpdel);
@ -227,7 +227,7 @@ void cm_filesource(ARGS) /* structure holding parms, inputs, outputs, etc.
for (i = 0; i < size; ++i)
loc->amplinterval[2 * i] = loc->amplinterval[2 * i + 1];
for (i = 0; i < size; ++i) {
while (*cp && (isspace(*cp) || *cp == ','))
while (*cp && (isspace_c(*cp) || *cp == ','))
++cp;
t = strtod(cp, &cp2);
if (cp2 == cp)

View File

@ -174,7 +174,7 @@ static char *CNVgettok(char **s)
/* skip over any white space */
while(isspace(**s) || (**s == '=') ||
while(isspace_c(**s) || (**s == '=') ||
(**s == '(') || (**s == ')') || (**s == ','))
(*s)++;
@ -192,7 +192,7 @@ static char *CNVgettok(char **s)
/* or a mess o' characters. */
i = 0;
while( (**s != '\0') &&
(! ( isspace(**s) || (**s == '=') ||
(! ( isspace_c(**s) || (**s == '=') ||
(**s == '(') || (**s == ')') ||
(**s == ',')
) ) ) {
@ -206,7 +206,7 @@ static char *CNVgettok(char **s)
/* skip over white space up to next token */
while(isspace(**s) || (**s == '=') ||
while(isspace_c(**s) || (**s == '=') ||
(**s == '(') || (**s == ')') || (**s == ','))
(*s)++;
@ -380,9 +380,9 @@ double *p_value ) /* OUT - The numerical value */
for(i = 0; i < len; i++) {
c = str[i];
if( isalpha(c) && (c != 'E') && (c != 'e') )
if( isalpha_c(c) && (c != 'E') && (c != 'e') )
break;
else if( isspace(c) )
else if( isspace_c(c) )
break;
else
val_str[i] = c;
@ -392,11 +392,11 @@ double *p_value ) /* OUT - The numerical value */
/* Determine the scale factor */
if( (i >= len) || (! isalpha(c)) )
if( (i >= len) || (! isalpha_c(c)) )
scale_factor = 1.0;
else {
if(isupper(c))
if(isupper_c(c))
c = (char) tolower(c);
switch(c) {
@ -436,11 +436,11 @@ double *p_value ) /* OUT - The numerical value */
break;
}
c1 = str[i];
if(! isalpha(c1)) {
if(! isalpha_c(c1)) {
scale_factor = 1.0e-3;
break;
}
if(islower(c1))
if(islower_c(c1))
c1 = (char) toupper(c1);
if(c1 == 'E')
scale_factor = 1.0e6;
@ -725,7 +725,7 @@ static int cm_read_source(FILE *source, Local_Data_t *loc)
/* Test this string to see if it is whitespace... */
base_address = s;
while(isspace(*s) || (*s == '*'))
while(isspace_c(*s) || (*s == '*'))
(s)++;
if ( *s != '\0' ) { /* This is not a blank line, so process... */
s = base_address;
@ -946,7 +946,7 @@ void cm_d_source(ARGS)
s = temp;
while ( fgets(s,MAX_STRING_SIZE,source) != NULL) {
if ( '*' != s[0] ) {
while(isspace(*s) || (*s == '*'))
while(isspace_c(*s) || (*s == '*'))
(s)++;
if ( *s != '\0' ) i++;
}

View File

@ -216,7 +216,7 @@ static char *CNVgettok(char **s)
/* skip over any white space */
while(isspace(**s) || (**s == '=') ||
while(isspace_c(**s) || (**s == '=') ||
(**s == '(') || (**s == ')') || (**s == ','))
(*s)++;
@ -234,7 +234,7 @@ static char *CNVgettok(char **s)
/* or a mess o' characters. */
i = 0;
while( (**s != '\0') &&
(! ( isspace(**s) || (**s == '=') ||
(! ( isspace_c(**s) || (**s == '=') ||
(**s == '(') || (**s == ')') ||
(**s == ',')
) ) ) {
@ -248,7 +248,7 @@ static char *CNVgettok(char **s)
/* skip over white space up to next token */
while(isspace(**s) || (**s == '=') ||
while(isspace_c(**s) || (**s == '=') ||
(**s == '(') || (**s == ')') || (**s == ','))
(*s)++;
@ -422,9 +422,9 @@ double *p_value ) /* OUT - The numerical value */
for(i = 0; i < len; i++) {
c = str[i];
if( isalpha(c) && (c != 'E') && (c != 'e') )
if( isalpha_c(c) && (c != 'E') && (c != 'e') )
break;
else if( isspace(c) )
else if( isspace_c(c) )
break;
else
val_str[i] = c;
@ -434,11 +434,11 @@ double *p_value ) /* OUT - The numerical value */
/* Determine the scale factor */
if( (i >= len) || (! isalpha(c)) )
if( (i >= len) || (! isalpha_c(c)) )
scale_factor = 1.0;
else {
if(islower(c))
if(islower_c(c))
c = (char) tolower(c);
switch(c) {
@ -478,11 +478,11 @@ double *p_value ) /* OUT - The numerical value */
break;
}
c1 = str[i];
if(! isalpha(c1)) {
if(! isalpha_c(c1)) {
scale_factor = 1.0e-3;
break;
}
if(islower(c1))
if(islower_c(c1))
c1 = (char) toupper(c1);
if(c1 == 'E')
scale_factor = 1.0e6;
@ -1398,7 +1398,7 @@ static int cm_read_state_file(FILE *state_file,State_Table_t *states)
/* Test this string to see if it is whitespace... */
base_address = s;
while(isspace(*s) || (*s == '*'))
while(isspace_c(*s) || (*s == '*'))
(s)++;
if ( *s != '\0' ) { /* This is not a blank line, so process... */
s = base_address;
@ -1786,7 +1786,7 @@ void cm_d_state(ARGS)
if (state_file!=NULL)
while ( fgets(s,MAX_STRING_SIZE,state_file) != NULL) {
if ( '*' != s[0] ) {
while(isspace(*s) || (*s == '*'))
while(isspace_c(*s) || (*s == '*'))
(s)++;
if ( *s != '\0' ) i++;
}

View File

@ -316,14 +316,14 @@ ipc_get_line (
tok1 = &str[8];
for (tok2 = tok1; *tok2; tok2++) {
if (isspace(*tok2)) {
if (isspace_c(*tok2)) {
*tok2 = '\0';
tok2++;
break;
}
}
for(tok3 = tok2; *tok3; tok3++) {
if(isspace(*tok3)) {
if(isspace_c(*tok3)) {
*tok3 = '\0';
break;
}

View File

@ -335,7 +335,7 @@ Ipc_Boolean_t ipc_screen_name(char *name, char *mapped_name)
return(IPC_FALSE);
}
else {
if(islower(name[i]))
if(islower_c(name[i]))
mapped_name[i] = (char) toupper(name[i]);
else
mapped_name[i] = name[i];

View File

@ -80,7 +80,7 @@ char *MIFgettok(char **s)
/* skip over any white space */
while(isspace(**s) || (**s == '=') ||
while(isspace_c(**s) || (**s == '=') ||
(**s == '(') || (**s == ')') || (**s == ','))
(*s)++;
@ -120,7 +120,7 @@ char *MIFgettok(char **s)
/* else, read until the next delimiter */
else {
while( (**s != '\0') &&
(! ( isspace(**s) || (**s == '=') || (**s == '%') ||
(! ( isspace_c(**s) || (**s == '=') || (**s == '%') ||
(**s == '(') || (**s == ')') || (**s == ',') ||
(**s == '[') || (**s == ']') ||
(**s == '<') || (**s == '>') || (**s == '~')
@ -137,7 +137,7 @@ char *MIFgettok(char **s)
/* skip over white space up to next token */
while(isspace(**s) || (**s == '=') ||
while(isspace_c(**s) || (**s == '=') ||
(**s == '(') || (**s == ')') || (**s == ','))
(*s)++;