nest, rewrite

This commit is contained in:
rlar 2012-03-07 20:47:49 +01:00
parent 54d743c87e
commit c86d52aab6
1 changed files with 4 additions and 2 deletions

View File

@ -449,10 +449,12 @@ doit(struct line *deck) {
int nest = 1;
for (c = last->li_next; c; c = c->li_next) {
if (ciprefix(sbend, c->li_line)) { /* found a .ends */
if (!--nest)
break; /* nest = 0 means we have balanced .subckt and .ends */
nest--;
} else if (ciprefix(start, c->li_line)) /* if .subckt, increment nesting */
nest++;
if(!nest)
break;
lcc = c; /* lcc points to current pos of c */
} /* for (nest = 0 . . . */
}