diff --git a/src/frontend/com_let.c b/src/frontend/com_let.c index 903a82c3a..caa9df120 100644 --- a/src/frontend/com_let.c +++ b/src/frontend/com_let.c @@ -113,7 +113,7 @@ com_let(wordlist *wl) free_pnode(names); /* frees also t, if pnode `names' is simple value */ s = q; - s = TEMPORARY_SKIP_WS_X1(s); + s = skip_ws(s); } } /* vector name at p */ diff --git a/src/frontend/cpitf.c b/src/frontend/cpitf.c index 9846ab40e..da99fda49 100644 --- a/src/frontend/cpitf.c +++ b/src/frontend/cpitf.c @@ -246,7 +246,7 @@ ft_cpinit(void) /* jump over leading spaces */ for (copys = s = cp_tildexpand(Lib_Path); copys && *copys; ) { - s = TEMPORARY_SKIP_WS_X1(s); + s = skip_ws(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; diff --git a/src/frontend/dimens.c b/src/frontend/dimens.c index 2f5e7e32d..e5e854d85 100644 --- a/src/frontend/dimens.c +++ b/src/frontend/dimens.c @@ -133,11 +133,11 @@ atodims(char *p, int *data, int *outlength) return 0; } - p = TEMPORARY_SKIP_WS_X1(p); + p = skip_ws(p); if (*p == '[') { p++; - p = TEMPORARY_SKIP_WS_X1(p); + p = skip_ws(p); needbracket = 1; } @@ -184,7 +184,7 @@ atodims(char *p, int *data, int *outlength) break; } - p = TEMPORARY_SKIP_WS_X1(p); + p = skip_ws(p); } *outlength = length; diff --git a/src/frontend/help/textdisp.c b/src/frontend/help/textdisp.c index 8900376db..3db5835cd 100644 --- a/src/frontend/help/textdisp.c +++ b/src/frontend/help/textdisp.c @@ -74,7 +74,7 @@ hlp_thandle(topic **parent) } s = buf; - s = TEMPORARY_SKIP_WS_X1(s); + s = skip_ws(s); switch (*s) { case '?': fprintf(cp_out, diff --git a/src/frontend/inp.c b/src/frontend/inp.c index 4722d45bb..8f99bee52 100644 --- a/src/frontend/inp.c +++ b/src/frontend/inp.c @@ -396,7 +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; - s = TEMPORARY_SKIP_WS_X1(s); + s = skip_ws(s); if (temperature) txfree(temperature); temperature = strdup(s); @@ -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; - s = TEMPORARY_SKIP_WS_X1(s); + s = skip_ws(s); if ((*s == '*') && ((s != dd->li_line) || (s[1] != '#'))) { if (commands) { /* Remove comment lines in control sections, so they don't @@ -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); s = name; - s = TEMPORARY_SKIP_WS_X1(s); + s = skip_ws(s); t = s; - t = TEMPORARY_SKIP_NON_WS_X0(t); + t = skip_non_ws(t); *t = '\0'; if (ciprefix(".control", dd->li_line)) { @@ -566,7 +566,7 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile) s = dd->li_line; *s = '*'; s = dd->li_line + 8; - s = TEMPORARY_SKIP_WS_X1(s); + s = skip_ws(s); cstoken[0] = gettok_char(&s, '=', FALSE, FALSE); cstoken[1] = gettok_char(&s, '=', TRUE, FALSE); cstoken[2] = gettok(&s); @@ -806,7 +806,7 @@ inp_dodeck( struct line *opt_beg = options; for (; options; options = options->li_next) { s = options->li_line; - s = TEMPORARY_SKIP_NON_WS_X0(s); + s = skip_non_ws(s); ii = cp_interactive; cp_interactive = FALSE; @@ -987,7 +987,7 @@ inp_dodeck( /* * for (; options; options = options->li_next) { * s = options->li_line; - * s = TEMPORARY_SKIP_NON_WS_X0(s); + * s = skip_non_ws(s); * ii = cp_interactive; * cp_interactive = FALSE; * wl = cp_lexer(s); diff --git a/src/frontend/newcoms.c b/src/frontend/newcoms.c index 073f9e62f..34ee8370d 100644 --- a/src/frontend/newcoms.c +++ b/src/frontend/newcoms.c @@ -80,7 +80,7 @@ com_reshape(wordlist *wl) wlast = wlast->wl_next; } - p = TEMPORARY_SKIP_WS_X1(p); + p = skip_ws(p); switch (state) { case 0: /* p just at or before a number */ @@ -131,7 +131,7 @@ com_reshape(wordlist *wl) } } - p = TEMPORARY_SKIP_WS_X1(p); + p = skip_ws(p); } while (state < 3); diff --git a/src/frontend/numparam/spicenum.c b/src/frontend/numparam/spicenum.c index ea05e404b..3c2f94da7 100644 --- a/src/frontend/numparam/spicenum.c +++ b/src/frontend/numparam/spicenum.c @@ -832,7 +832,7 @@ nupa_eval(char *s, int linenum, int orig_linenum) } else if (c == 'X') { /* compute args of subcircuit, if required */ ptr = s; - ptr = TEMPORARY_SKIP_NON_WS_X0(ptr); + ptr = skip_non_ws(ptr); keep = *ptr; *ptr = '\0'; nupa_inst_name = strdup(s); diff --git a/src/frontend/nutinp.c b/src/frontend/nutinp.c index b314ea71c..6100e1355 100644 --- a/src/frontend/nutinp.c +++ b/src/frontend/nutinp.c @@ -95,9 +95,9 @@ inp_nutsource(FILE *fp, bool comfile, char *filename) } (void) strncpy(name, dd->li_line, BSIZE_SP); s = name; - s = TEMPORARY_SKIP_WS_X1(s); + s = skip_ws(s); t = s; - t = TEMPORARY_SKIP_NON_WS_X0(t); + t = skip_non_ws(t); *t = '\0'; if (ciprefix(".control", dd->li_line)) { diff --git a/src/frontend/plotting/graf.c b/src/frontend/plotting/graf.c index 0043882e9..71991b1ec 100644 --- a/src/frontend/plotting/graf.c +++ b/src/frontend/plotting/graf.c @@ -1036,7 +1036,7 @@ readtics(char *string) for (k = 0; *words && k < MAXTICS; words = worde) { - words = TEMPORARY_SKIP_WS_X1(words); + words = skip_ws(words); worde = words; while (isalpha_c(*worde) || isdigit_c(*worde)) diff --git a/src/frontend/subckt.c b/src/frontend/subckt.c index 1176e6fce..52672caa1 100644 --- a/src/frontend/subckt.c +++ b/src/frontend/subckt.c @@ -153,9 +153,9 @@ collect_global_nodes(struct line *c) txfree(gettok(&s)); while (*s) { char *t = s; - s = TEMPORARY_SKIP_NON_WS_X0(s); + s = skip_non_ws(s); global_nodes[num_global_nodes++] = copy_substring(t, s); - s = TEMPORARY_SKIP_WS_X1(s); + s = skip_ws(s); } c->li_line[0] = '*'; /* comment it out */ } @@ -321,8 +321,8 @@ inp_subcktexpand(struct line *deck) { } else if (*s == '.') { continue; /* skip .commands */ } else { /* any other line . . . */ - s = TEMPORARY_SKIP_NON_WS_X0(s); - s = TEMPORARY_SKIP_WS_X1(s); + s = skip_non_ws(s); + s = skip_ws(s); if (*s == '(') { int level = 0; @@ -492,10 +492,10 @@ doit(struct line *deck, wordlist *modnames) { /* count the number of args in the .subckt line */ sss->su_numargs = 0; for (;;) { - s = TEMPORARY_SKIP_WS_X1(s); + s = skip_ws(s); if (*s == '\0') break; - s = TEMPORARY_SKIP_NON_WS_X0(s); + s = skip_non_ws(s); sss->su_numargs ++; } } @@ -1310,7 +1310,7 @@ finishLine(struct bxx_buffer *t, char *src, char *scname) continue; } s = src + 1; - s = TEMPORARY_SKIP_WS_X1(s); + s = skip_ws(s); if (!*s || (*s != '(')) { lastwasalpha = isalpha_c(*src); bxx_putc(t, *src++); @@ -1320,7 +1320,7 @@ finishLine(struct bxx_buffer *t, char *src, char *scname) bxx_putc(t, which = *src); src = s; bxx_putc(t, *src++); - src = TEMPORARY_SKIP_WS_X1(src); + src = skip_ws(src); for (buf = src; *src && !isspace_c(*src) && *src != ',' && *src != ')'; ) src++; buf_end = src; @@ -1467,7 +1467,7 @@ numnodes(char *name, struct subs *subs, wordlist const *modnames) const wordlist *wl; int n, i, gotit; - name = TEMPORARY_SKIP_WS_X1(name); + name = skip_ws(name); c = *name; if (isupper_c(c)) @@ -1497,8 +1497,8 @@ numnodes(char *name, struct subs *subs, wordlist const *modnames) int nodes = -2; for (s = buf; *s; ) { nodes++; - s = TEMPORARY_SKIP_NON_WS_X0(s); - s = TEMPORARY_SKIP_WS_X1(s); + s = skip_non_ws(s); + s = skip_ws(s); } return (nodes); } @@ -1571,7 +1571,7 @@ static int numdevs(char *s) { - s = TEMPORARY_SKIP_WS_X1(s); + s = skip_ws(s); switch (*s) { case 'K': case 'k': @@ -1680,7 +1680,7 @@ devmodtranslate(struct line *s, char *subname, wordlist * const orig_modnames) printf("In devmodtranslate, examining line %s.\n", t); #endif - t = TEMPORARY_SKIP_WS_X1(t); + t = skip_ws(t); c = *t; /* set c to first char in line. . . . */ if (isupper_c(c)) c = tolower_c(c); diff --git a/src/frontend/vectors.c b/src/frontend/vectors.c index 0baa328ab..8ba9dc9ca 100644 --- a/src/frontend/vectors.c +++ b/src/frontend/vectors.c @@ -939,7 +939,7 @@ vec_basename(struct dvec *v) strtolower(buf); t = buf; - t = TEMPORARY_SKIP_WS_X1(t); + t = skip_ws(t); s = t; for (t = s; *t; t++) ; diff --git a/src/include/ngspice/stringskip.h b/src/include/ngspice/stringskip.h index 4151718ac..5733e0603 100644 --- a/src/include/ngspice/stringskip.h +++ b/src/include/ngspice/stringskip.h @@ -1,7 +1,7 @@ #ifndef ngspice_STRINGSKIP_H #define ngspice_STRINGSKIP_H -static inline char *TEMPORARY_SKIP_NON_WS_X0(char *s) { while (*s && !isspace_c(*s)) s++; return s; } -static inline char *TEMPORARY_SKIP_WS_X1(char *s) { while ( isspace_c(*s)) s++; return s; } +static inline char *skip_non_ws(char *s) { while (*s && !isspace_c(*s)) s++; return s; } +static inline char *skip_ws(char *s) { while ( isspace_c(*s)) s++; return s; } #endif diff --git a/src/misc/string.c b/src/misc/string.c index 447cf3ed2..4d839c904 100644 --- a/src/misc/string.c +++ b/src/misc/string.c @@ -283,7 +283,7 @@ gettok(char **s) char *beg, *token ; /* return token */ paren = 0; - *s = TEMPORARY_SKIP_WS_X1(*s); + *s = skip_ws(*s); if (!**s) return (NULL); beg = *s ; @@ -357,7 +357,7 @@ gettok_noparens(char **s) char c; char *beg, *token ; /* return token */ - *s = TEMPORARY_SKIP_WS_X1(*s); + *s = skip_ws(*s); if (!**s) return (NULL); /* return NULL if we come to end of line */ @@ -375,7 +375,7 @@ gettok_noparens(char **s) token = copy_substring(beg, *s) ; /* Now iterate up to next non-whitespace char */ - *s = TEMPORARY_SKIP_WS_X1(*s); + *s = skip_ws(*s); return ( token ) ; } @@ -386,7 +386,7 @@ gettok_instance(char **s) char c; char *beg, *token ; /* return token */ - *s = TEMPORARY_SKIP_WS_X1(*s); + *s = skip_ws(*s); if (!**s) return (NULL); /* return NULL if we come to end of line */ @@ -403,7 +403,7 @@ gettok_instance(char **s) token = copy_substring(beg, *s) ; /* Now iterate up to next non-whitespace char */ - *s = TEMPORARY_SKIP_WS_X1(*s); + *s = skip_ws(*s); return ( token ) ; } @@ -420,7 +420,7 @@ gettok_char(char **s, char p, bool inc_p, bool nested) char c; char *beg, *token ; /* return token */ - *s = TEMPORARY_SKIP_WS_X1(*s); + *s = skip_ws(*s); if (!**s) return (NULL); /* return NULL if we come to end of line */ @@ -467,7 +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 */ - *s = TEMPORARY_SKIP_WS_X1(*s); + *s = skip_ws(*s); return ( token ) ; } @@ -664,7 +664,7 @@ get_comma_separated_values( char *values[], char *str ) { values[count++] = strdup(str); *ptr = keep; str = comma_ptr + 1; - str = TEMPORARY_SKIP_WS_X1(str); + str = skip_ws(str); } values[count++] = strdup(str); return count; diff --git a/src/misc/tilde.c b/src/misc/tilde.c index f3d27fb1e..db0ef8bd4 100644 --- a/src/misc/tilde.c +++ b/src/misc/tilde.c @@ -43,7 +43,7 @@ tildexpand(char *string) if (!string) return NULL; - string = TEMPORARY_SKIP_WS_X1(string); + string = skip_ws(string); if (*string != '~') return copy(string); diff --git a/src/spicelib/parser/inp2r.c b/src/spicelib/parser/inp2r.c index e4daaa7bb..3800fa077 100644 --- a/src/spicelib/parser/inp2r.c +++ b/src/spicelib/parser/inp2r.c @@ -86,7 +86,7 @@ void INP2R(CKTcircuit *ckt, INPtables * tab, card * current) s += 2; /* skip any white space */ - s = TEMPORARY_SKIP_WS_X1(s); + s = skip_ws(s); /* reject if not '=' */ if(*s != '=') @@ -95,7 +95,7 @@ void INP2R(CKTcircuit *ckt, INPtables * tab, card * current) s++; /* skip any white space */ - s = TEMPORARY_SKIP_WS_X1(s); + s = skip_ws(s); /* if we now have +, - or a decimal digit then assume we have a number, otherwise reject */ @@ -103,12 +103,12 @@ void INP2R(CKTcircuit *ckt, INPtables * tab, card * current) continue; /* look for next white space or null */ - s = TEMPORARY_SKIP_NON_WS_X0(s); + s = skip_non_ws(s); left_length = (size_t) (s - current->line); /* skip any additional white space */ - s = TEMPORARY_SKIP_WS_X1(s); + s = skip_ws(s); /* if we now have +, - or a decimal digit then assume we have the second number, otherwise reject */