Browse Source

numparam, drop `cpos()'

pre-master-46
rlar 10 years ago
parent
commit
15dd80c0e7
  1. 1
      src/frontend/numparam/general.h
  2. 18
      src/frontend/numparam/mystring.c
  3. 2
      src/frontend/numparam/spicenum.c
  4. 9
      src/frontend/numparam/xpressn.c

1
src/frontend/numparam/general.h

@ -25,7 +25,6 @@ void cadd(SPICE_DSTRINGPTR s, char c);
void naddll(SPICE_DSTRINGPTR s, long long n);
void cins(SPICE_DSTRINGPTR s, char c);
void sins(SPICE_DSTRINGPTR s, const char *t);
int cpos(char c, char *s);
int spos_(char *sub, const char *s);
bool ci_prefix(const char *p, const char *s);
int length(const char *s);

18
src/frontend/numparam/mystring.c

@ -154,24 +154,6 @@ sins(SPICE_DSTRINGPTR dstr_p, const char *t)
}
int
cpos(char c, char *s)
/* return position of c in s, or 0 if not found.
* BUG, Pascal inherited: first char is at 1, not 0 !
* No longer! Now position is C-based to make life easier.
*/
{
int i = 0;
while ((s[i] != c) && (s[i] != '\0'))
i++;
if (s[i] == c)
return i;
else
return -1;
}
char
upcase(char c)
{

2
src/frontend/numparam/spicenum.c

@ -371,7 +371,7 @@ transform(dico_t *dico, SPICE_DSTRINGPTR dstr_p, bool incontrol,
category = 'X';
} else if (s[0] == '+') { /* continuation line */
category = '+';
} else if (cpos(s[0], "*$#") < 0) {
} else if (!strchr("*$#", s[0])) {
/* not a comment line! */
n = stripbraces(dstr_p);
if (n > 0)

9
src/frontend/numparam/xpressn.c

@ -732,7 +732,7 @@ fetchoperator(dico_t *dico,
} else if (c == '^') {
state = S_binop;
level = 2;
} else if (cpos(c, "=<>#GL") >= 0) {
} else if (strchr("=<>#GL", c)) {
state = S_binop;
level = 5;
} else if (c == 'A') {
@ -1419,7 +1419,7 @@ getexpress(char *s, SPICE_DSTRINGPTR tstr_p, int *pi)
} while ((i <= ls) && !((d == ')') && (level <= 0)));
}
} while (!(cpos (c, ",;)}") >= 0)); /* legal separators */
} while (!strchr(",;)}", c)); /* legal separators */
tpe = NUPA_REAL;
}
@ -1703,9 +1703,10 @@ nupa_subcktcall(dico_t *dico, char *s, char *x, char *inst_name)
u_p = spice_dstring_value(&ustr);
if (u_p[0]) {
char *dollar = strchr(spice_dstring_value(&idlist), '$');
narg++;
k = cpos('$', spice_dstring_value(&idlist));
if (k >= 0) {
if (dollar) {
k = (int) (dollar - spice_dstring_value(&idlist));
/* replace dollar with expression string u */
pscopy(&vstr, spice_dstring_value(&idlist), 0, k);
sadd(&vstr, spice_dstring_value(&ustr));

Loading…
Cancel
Save