Browse Source

bug fix, numnodes()

in response to the `ex-41.cir' test case
    distilled from a Dietmar Warning Bug report in
      "Subject: Re: subckt, param"

  translate() is called recursively and depends on
    `num of nodes' provided by numnodes().
  numnodes() depends on availability of `su_numargs'.
  But the processing allows non-processing of subckt instantiations
    in inner recursions (which will be processed later)
    which means `su_numargs' is not always available.
rlar 14 years ago
parent
commit
da06afb895
  1. 22
      src/frontend/subckt.c

22
src/frontend/subckt.c

@ -1502,12 +1502,24 @@ numnodes(char *name)
s++;
for (sss = subs; sss; sss = sss->su_next)
if (eq(sss->su_name, s))
break;
if (!sss) {
fprintf(cp_err, "Error: no such subcircuit: %s\n", s);
return (0);
return (sss->su_numargs);
/*
* number of nodes not known so far.
* lets count the nodes ourselves,
* assuming `buf' looks like this:
* xname n1 n2 ... nn subname
*/
{
int nodes = -2;
for(s = buf; *s; ) {
nodes++;
while(*s && !isspace(*s))
s++;
while(isspace(*s))
s++;
}
return (nodes);
}
return (sss->su_numargs);
}
n = inp_numnodes(c);

Loading…
Cancel
Save