skip-ws, #3/6, use TEMPORARY macros, obj-invariant
This commit is contained in:
parent
6d1171ad6f
commit
a86f2068c8
|
|
@ -113,8 +113,7 @@ com_let(wordlist *wl)
|
|||
free_pnode(names); /* frees also t, if pnode `names' is simple value */
|
||||
|
||||
s = q;
|
||||
for (; *s && isspace_c(*s); s++)
|
||||
;
|
||||
TEMPORARY_SKIP_WS_X0(s);
|
||||
}
|
||||
}
|
||||
/* vector name at p */
|
||||
|
|
|
|||
|
|
@ -246,8 +246,7 @@ ft_cpinit(void)
|
|||
|
||||
/* jump over leading spaces */
|
||||
for (copys = s = cp_tildexpand(Lib_Path); copys && *copys; ) {
|
||||
while (isspace_c(*s))
|
||||
s++;
|
||||
TEMPORARY_SKIP_WS_X1(s);
|
||||
/* copy s into buf until space is seen, r is the actual position */
|
||||
for (r = buf; *s && !isspace_c(*s); r++, s++)
|
||||
*r = *s;
|
||||
|
|
|
|||
|
|
@ -133,13 +133,11 @@ atodims(char *p, int *data, int *outlength)
|
|||
return 0;
|
||||
}
|
||||
|
||||
while (*p && isspace_c(*p))
|
||||
p++;
|
||||
TEMPORARY_SKIP_WS_X0(p);
|
||||
|
||||
if (*p == '[') {
|
||||
p++;
|
||||
while (*p && isspace_c(*p))
|
||||
p++;
|
||||
TEMPORARY_SKIP_WS_X0(p);
|
||||
needbracket = 1;
|
||||
}
|
||||
|
||||
|
|
@ -186,8 +184,7 @@ atodims(char *p, int *data, int *outlength)
|
|||
break;
|
||||
}
|
||||
|
||||
while (*p && isspace_c(*p))
|
||||
p++;
|
||||
TEMPORARY_SKIP_WS_X0(p);
|
||||
}
|
||||
|
||||
*outlength = length;
|
||||
|
|
|
|||
|
|
@ -74,8 +74,7 @@ hlp_thandle(topic **parent)
|
|||
}
|
||||
|
||||
s = buf;
|
||||
for (; *s && isspace_c(*s); s++)
|
||||
;
|
||||
TEMPORARY_SKIP_WS_X0(s);
|
||||
switch (*s) {
|
||||
case '?':
|
||||
fprintf(cp_out,
|
||||
|
|
|
|||
|
|
@ -396,8 +396,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_c(*s))
|
||||
s++;
|
||||
TEMPORARY_SKIP_WS_X1(s);
|
||||
if (temperature)
|
||||
txfree(temperature);
|
||||
temperature = strdup(s);
|
||||
|
|
@ -405,8 +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_c(*s))
|
||||
s++;
|
||||
TEMPORARY_SKIP_WS_X1(s);
|
||||
if ((*s == '*') && ((s != dd->li_line) || (s[1] != '#'))) {
|
||||
if (commands) {
|
||||
/* Remove comment lines in control sections, so they don't
|
||||
|
|
@ -422,11 +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);
|
||||
s = name;
|
||||
for (; *s && isspace_c(*s); s++)
|
||||
;
|
||||
TEMPORARY_SKIP_WS_X0(s);
|
||||
t = s;
|
||||
for (; *t && !isspace_c(*t); t++)
|
||||
;
|
||||
TEMPORARY_SKIP_NON_WS_X0(t);
|
||||
*t = '\0';
|
||||
|
||||
if (ciprefix(".control", dd->li_line)) {
|
||||
|
|
@ -570,8 +566,7 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile)
|
|||
s = dd->li_line;
|
||||
*s = '*';
|
||||
s = dd->li_line + 8;
|
||||
while (isspace_c(*s))
|
||||
s++;
|
||||
TEMPORARY_SKIP_WS_X1(s);
|
||||
cstoken[0] = gettok_char(&s, '=', FALSE, FALSE);
|
||||
cstoken[1] = gettok_char(&s, '=', TRUE, FALSE);
|
||||
cstoken[2] = gettok(&s);
|
||||
|
|
@ -811,8 +806,7 @@ inp_dodeck(
|
|||
struct line *opt_beg = options;
|
||||
for (; options; options = options->li_next) {
|
||||
s = options->li_line;
|
||||
for (; *s && !isspace_c(*s); s++)
|
||||
;
|
||||
TEMPORARY_SKIP_NON_WS_X0(s);
|
||||
|
||||
ii = cp_interactive;
|
||||
cp_interactive = FALSE;
|
||||
|
|
@ -993,8 +987,7 @@ inp_dodeck(
|
|||
/*
|
||||
* for (; options; options = options->li_next) {
|
||||
* s = options->li_line;
|
||||
* for (; *s && !isspace_c(*s); s++)
|
||||
* ;
|
||||
* TEMPORARY_SKIP_NON_WS_X0(s);
|
||||
* ii = cp_interactive;
|
||||
* cp_interactive = FALSE;
|
||||
* wl = cp_lexer(s);
|
||||
|
|
|
|||
|
|
@ -80,8 +80,7 @@ com_reshape(wordlist *wl)
|
|||
wlast = wlast->wl_next;
|
||||
}
|
||||
|
||||
while (*p && isspace_c(*p))
|
||||
p++;
|
||||
TEMPORARY_SKIP_WS_X0(p);
|
||||
|
||||
switch (state) {
|
||||
case 0: /* p just at or before a number */
|
||||
|
|
@ -132,8 +131,7 @@ com_reshape(wordlist *wl)
|
|||
}
|
||||
}
|
||||
|
||||
while (*p && isspace_c(*p))
|
||||
p++;
|
||||
TEMPORARY_SKIP_WS_X0(p);
|
||||
|
||||
} while (state < 3);
|
||||
|
||||
|
|
|
|||
|
|
@ -832,8 +832,7 @@ nupa_eval(char *s, int linenum, int orig_linenum)
|
|||
} else if (c == 'X') {
|
||||
/* compute args of subcircuit, if required */
|
||||
ptr = s;
|
||||
while (*ptr && !isspace_c(*ptr))
|
||||
ptr++;
|
||||
TEMPORARY_SKIP_NON_WS_X0(ptr);
|
||||
keep = *ptr;
|
||||
*ptr = '\0';
|
||||
nupa_inst_name = strdup(s);
|
||||
|
|
|
|||
|
|
@ -95,11 +95,9 @@ inp_nutsource(FILE *fp, bool comfile, char *filename)
|
|||
}
|
||||
(void) strncpy(name, dd->li_line, BSIZE_SP);
|
||||
s = name;
|
||||
for (; *s && isspace_c(*s); s++)
|
||||
;
|
||||
TEMPORARY_SKIP_WS_X0(s);
|
||||
t = s;
|
||||
for (; *t && !isspace_c(*t); t++)
|
||||
;
|
||||
TEMPORARY_SKIP_NON_WS_X0(t);
|
||||
*t = '\0';
|
||||
|
||||
if (ciprefix(".control", dd->li_line)) {
|
||||
|
|
|
|||
|
|
@ -1036,8 +1036,7 @@ readtics(char *string)
|
|||
|
||||
for (k = 0; *words && k < MAXTICS; words = worde) {
|
||||
|
||||
while (isspace_c(*words))
|
||||
words++;
|
||||
TEMPORARY_SKIP_WS_X1(words);
|
||||
|
||||
worde = words;
|
||||
while (isalpha_c(*worde) || isdigit_c(*worde))
|
||||
|
|
|
|||
|
|
@ -153,11 +153,9 @@ collect_global_nodes(struct line *c)
|
|||
txfree(gettok(&s));
|
||||
while (*s) {
|
||||
char *t = s;
|
||||
for (; *s && !isspace_c(*s); s++)
|
||||
;
|
||||
TEMPORARY_SKIP_NON_WS_X0(s);
|
||||
global_nodes[num_global_nodes++] = copy_substring(t, s);
|
||||
while (isspace_c(*s))
|
||||
s++;
|
||||
TEMPORARY_SKIP_WS_X1(s);
|
||||
}
|
||||
c->li_line[0] = '*'; /* comment it out */
|
||||
}
|
||||
|
|
@ -323,10 +321,8 @@ inp_subcktexpand(struct line *deck) {
|
|||
} else if (*s == '.') {
|
||||
continue; /* skip .commands */
|
||||
} else { /* any other line . . . */
|
||||
while (*s && !isspace_c(*s)) /* skip first token */
|
||||
s++;
|
||||
while (*s && isspace_c(*s)) /* skip whitespace */
|
||||
s++;
|
||||
TEMPORARY_SKIP_NON_WS_X0(s);
|
||||
TEMPORARY_SKIP_WS_X0(s);
|
||||
|
||||
if (*s == '(') {
|
||||
int level = 0;
|
||||
|
|
@ -496,12 +492,10 @@ doit(struct line *deck, wordlist *modnames) {
|
|||
/* count the number of args in the .subckt line */
|
||||
sss->su_numargs = 0;
|
||||
for (;;) {
|
||||
while (isspace_c(*s))
|
||||
s++;
|
||||
TEMPORARY_SKIP_WS_X1(s);
|
||||
if (*s == '\0')
|
||||
break;
|
||||
while (*s && !isspace_c(*s))
|
||||
s++;
|
||||
TEMPORARY_SKIP_NON_WS_X0(s);
|
||||
sss->su_numargs ++;
|
||||
}
|
||||
}
|
||||
|
|
@ -1316,8 +1310,7 @@ finishLine(struct bxx_buffer *t, char *src, char *scname)
|
|||
continue;
|
||||
}
|
||||
s = src + 1;
|
||||
for (; *s && isspace_c(*s); s++)
|
||||
;
|
||||
TEMPORARY_SKIP_WS_X0(s);
|
||||
if (!*s || (*s != '(')) {
|
||||
lastwasalpha = isalpha_c(*src);
|
||||
bxx_putc(t, *src++);
|
||||
|
|
@ -1327,8 +1320,7 @@ finishLine(struct bxx_buffer *t, char *src, char *scname)
|
|||
bxx_putc(t, which = *src);
|
||||
src = s;
|
||||
bxx_putc(t, *src++);
|
||||
while (isspace_c(*src))
|
||||
src++;
|
||||
TEMPORARY_SKIP_WS_X1(src);
|
||||
for (buf = src; *src && !isspace_c(*src) && *src != ',' && *src != ')'; )
|
||||
src++;
|
||||
buf_end = src;
|
||||
|
|
@ -1475,8 +1467,7 @@ numnodes(char *name, struct subs *subs, wordlist const *modnames)
|
|||
const wordlist *wl;
|
||||
int n, i, gotit;
|
||||
|
||||
while (*name && isspace_c(*name))
|
||||
name++;
|
||||
TEMPORARY_SKIP_WS_X0(name);
|
||||
|
||||
c = *name;
|
||||
if (isupper_c(c))
|
||||
|
|
@ -1506,10 +1497,8 @@ numnodes(char *name, struct subs *subs, wordlist const *modnames)
|
|||
int nodes = -2;
|
||||
for (s = buf; *s; ) {
|
||||
nodes++;
|
||||
while (*s && !isspace_c(*s))
|
||||
s++;
|
||||
while (isspace_c(*s))
|
||||
s++;
|
||||
TEMPORARY_SKIP_NON_WS_X0(s);
|
||||
TEMPORARY_SKIP_WS_X1(s);
|
||||
}
|
||||
return (nodes);
|
||||
}
|
||||
|
|
@ -1582,8 +1571,7 @@ static int
|
|||
numdevs(char *s)
|
||||
{
|
||||
|
||||
while (*s && isspace_c(*s))
|
||||
s++;
|
||||
TEMPORARY_SKIP_WS_X0(s);
|
||||
switch (*s) {
|
||||
case 'K':
|
||||
case 'k':
|
||||
|
|
@ -1692,8 +1680,7 @@ devmodtranslate(struct line *s, char *subname, wordlist * const orig_modnames)
|
|||
printf("In devmodtranslate, examining line %s.\n", t);
|
||||
#endif
|
||||
|
||||
while (*t && isspace_c(*t))
|
||||
t++;
|
||||
TEMPORARY_SKIP_WS_X0(t);
|
||||
c = *t; /* set c to first char in line. . . . */
|
||||
if (isupper_c(c))
|
||||
c = tolower_c(c);
|
||||
|
|
|
|||
|
|
@ -939,8 +939,7 @@ vec_basename(struct dvec *v)
|
|||
|
||||
strtolower(buf);
|
||||
t = buf;
|
||||
for (; isspace_c(*t); t++)
|
||||
;
|
||||
TEMPORARY_SKIP_WS_X1(t);
|
||||
s = t;
|
||||
for (t = s; *t; t++)
|
||||
;
|
||||
|
|
|
|||
|
|
@ -283,8 +283,7 @@ gettok(char **s)
|
|||
char *beg, *token ; /* return token */
|
||||
|
||||
paren = 0;
|
||||
while (isspace_c(**s))
|
||||
(*s)++;
|
||||
TEMPORARY_SKIP_WS_X1(*s);
|
||||
if (!**s)
|
||||
return (NULL);
|
||||
beg = *s ;
|
||||
|
|
@ -358,8 +357,7 @@ gettok_noparens(char **s)
|
|||
char c;
|
||||
char *beg, *token ; /* return token */
|
||||
|
||||
while ( isspace_c(**s) )
|
||||
(*s)++; /* iterate over whitespace */
|
||||
TEMPORARY_SKIP_WS_X1(*s);
|
||||
|
||||
if (!**s)
|
||||
return (NULL); /* return NULL if we come to end of line */
|
||||
|
|
@ -377,8 +375,7 @@ gettok_noparens(char **s)
|
|||
token = copy_substring(beg, *s) ;
|
||||
|
||||
/* Now iterate up to next non-whitespace char */
|
||||
while ( isspace_c(**s) )
|
||||
(*s)++;
|
||||
TEMPORARY_SKIP_WS_X1(*s);
|
||||
|
||||
return ( token ) ;
|
||||
}
|
||||
|
|
@ -389,8 +386,7 @@ gettok_instance(char **s)
|
|||
char c;
|
||||
char *beg, *token ; /* return token */
|
||||
|
||||
while ( isspace_c(**s) )
|
||||
(*s)++; /* iterate over whitespace */
|
||||
TEMPORARY_SKIP_WS_X1(*s);
|
||||
|
||||
if (!**s)
|
||||
return (NULL); /* return NULL if we come to end of line */
|
||||
|
|
@ -407,8 +403,7 @@ gettok_instance(char **s)
|
|||
token = copy_substring(beg, *s) ;
|
||||
|
||||
/* Now iterate up to next non-whitespace char */
|
||||
while ( isspace_c(**s) )
|
||||
(*s)++;
|
||||
TEMPORARY_SKIP_WS_X1(*s);
|
||||
|
||||
return ( token ) ;
|
||||
}
|
||||
|
|
@ -425,8 +420,7 @@ gettok_char(char **s, char p, bool inc_p, bool nested)
|
|||
char c;
|
||||
char *beg, *token ; /* return token */
|
||||
|
||||
while ( isspace_c(**s) )
|
||||
(*s)++; /* iterate over whitespace */
|
||||
TEMPORARY_SKIP_WS_X1(*s);
|
||||
|
||||
if (!**s)
|
||||
return (NULL); /* return NULL if we come to end of line */
|
||||
|
|
@ -473,8 +467,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_c(**s) )
|
||||
(*s)++;
|
||||
TEMPORARY_SKIP_WS_X1(*s);
|
||||
|
||||
return ( token ) ;
|
||||
}
|
||||
|
|
@ -671,7 +664,7 @@ get_comma_separated_values( char *values[], char *str ) {
|
|||
values[count++] = strdup(str);
|
||||
*ptr = keep;
|
||||
str = comma_ptr + 1;
|
||||
while ( isspace_c(*str) ) str++;
|
||||
TEMPORARY_SKIP_WS_X1(str);
|
||||
}
|
||||
values[count++] = strdup(str);
|
||||
return count;
|
||||
|
|
|
|||
|
|
@ -43,8 +43,7 @@ tildexpand(char *string)
|
|||
if (!string)
|
||||
return NULL;
|
||||
|
||||
while (*string && isspace_c(*string))
|
||||
string++;
|
||||
TEMPORARY_SKIP_WS_X0(string);
|
||||
|
||||
if (*string != '~')
|
||||
return copy(string);
|
||||
|
|
|
|||
|
|
@ -86,8 +86,7 @@ void INP2R(CKTcircuit *ckt, INPtables * tab, card * current)
|
|||
s += 2;
|
||||
|
||||
/* skip any white space */
|
||||
while(isspace_c(*s))
|
||||
s++;
|
||||
TEMPORARY_SKIP_WS_X1(s);
|
||||
|
||||
/* reject if not '=' */
|
||||
if(*s != '=')
|
||||
|
|
@ -96,8 +95,7 @@ void INP2R(CKTcircuit *ckt, INPtables * tab, card * current)
|
|||
s++;
|
||||
|
||||
/* skip any white space */
|
||||
while(isspace_c(*s))
|
||||
s++;
|
||||
TEMPORARY_SKIP_WS_X1(s);
|
||||
|
||||
/* if we now have +, - or a decimal digit then assume we have a number,
|
||||
otherwise reject */
|
||||
|
|
@ -105,14 +103,12 @@ void INP2R(CKTcircuit *ckt, INPtables * tab, card * current)
|
|||
continue;
|
||||
|
||||
/* look for next white space or null */
|
||||
while(*s && !isspace_c(*s))
|
||||
s++;
|
||||
TEMPORARY_SKIP_NON_WS_X0(s);
|
||||
|
||||
left_length = (size_t) (s - current->line);
|
||||
|
||||
/* skip any additional white space */
|
||||
while(isspace_c(*s))
|
||||
s++;
|
||||
TEMPORARY_SKIP_WS_X1(s);
|
||||
|
||||
/* if we now have +, - or a decimal digit then assume we have the
|
||||
second number, otherwise reject */
|
||||
|
|
|
|||
Loading…
Reference in New Issue