Browse Source

numparam/*, use `pscopy()'

pre-master-46
rlar 8 years ago
parent
commit
95ef5e79d9
  1. 5
      src/frontend/numparam/spicenum.c
  2. 15
      src/frontend/numparam/xpressn.c

5
src/frontend/numparam/spicenum.c

@ -185,9 +185,10 @@ findsubname(dico_t *dico, SPICE_DSTRINGPTR dstr_p)
char *t; char *t;
entry_t *entry; entry_t *entry;
/* check for known subckt name */ /* check for known subckt name */
spice_dstring_reinit(&name);
for (t = p; alfanum(*t); t++) for (t = p; alfanum(*t); t++)
cadd(&name, *t);
;
spice_dstring_reinit(&name);
pscopy(&name, p, t);
entry = entrynb(dico, spice_dstring_value(&name)); entry = entrynb(dico, spice_dstring_value(&name));
if (entry && (entry->tp == NUPA_SUBCKT)) { if (entry && (entry->tp == NUPA_SUBCKT)) {
spice_dstring_setlength(dstr_p, (int) (p_end - s)); spice_dstring_setlength(dstr_p, (int) (p_end - s));

15
src/frontend/numparam/xpressn.c

@ -954,8 +954,7 @@ formula(dico_t *dico, const char *s, const char *s_end, bool *perror)
state = S_init; /* S_init means: ignore for the moment */ state = S_init; /* S_init means: ignore for the moment */
} else { } else {
spice_dstring_reinit(&tstr); spice_dstring_reinit(&tstr);
while (s < s_next)
cadd(&tstr, *s++);
pscopy(&tstr, s, s_next);
u = fetchnumentry(dico, spice_dstring_value(&tstr), &error); u = fetchnumentry(dico, spice_dstring_value(&tstr), &error);
state = S_atom; state = S_atom;
} }
@ -1206,14 +1205,17 @@ static const char *
getword(const char *s, SPICE_DSTRINGPTR tstr_p) getword(const char *s, SPICE_DSTRINGPTR tstr_p)
{ {
const char *s_end = s + strlen(s); const char *s_end = s + strlen(s);
const char *word;
while ((s < s_end - 1) && !alfa(*s)) while ((s < s_end - 1) && !alfa(*s))
s++; s++;
spice_dstring_reinit(tstr_p);
word = s;
while (alfa(*s) || isdigit_c(*s))
s++;
while ((s < s_end) && (alfa(*s) || isdigit_c(*s)))
cadd(tstr_p, *s++);
spice_dstring_reinit(tstr_p);
pscopy(tstr_p, word, s);
return s; return s;
} }
@ -1431,8 +1433,7 @@ nupa_subcktcall(dico_t *dico, char *s, char * const x, char * const inst_name)
const char *j2 = strstr(spice_dstring_value(&tstr), "subckt"); const char *j2 = strstr(spice_dstring_value(&tstr), "subckt");
if (j2) { if (j2) {
j2 = skip_ws(j2 + 6); /* skip subckt and whitespace */ j2 = skip_ws(j2 + 6); /* skip subckt and whitespace */
while (*j2 && (*j2 != ' '))
cadd(&subname, *j2++);
pscopy(&subname, j2, skip_non_ws(j2));
} else { } else {
err = message(dico, " ! a subckt line!\n"); err = message(dico, " ! a subckt line!\n");
} }

Loading…
Cancel
Save