Browse Source

subckt.c, translate(), #1/8 cleanup

pre-master-46
rlar 9 years ago
parent
commit
476c41f436
  1. 12
      src/frontend/subckt.c

12
src/frontend/subckt.c

@ -937,6 +937,8 @@ translate(struct line *deck, char *formal, char *actual, char *scname, const cha
/* now iterate through the .subckt deck and translate the cards. */ /* now iterate through the .subckt deck and translate the cards. */
for (c = deck; c; c = c->li_next) { for (c = deck; c; c = c->li_next) {
dev_type = *(c->li_line); dev_type = *(c->li_line);
s = c->li_line;
bxx_rewind(&buffer);
#ifdef TRACE #ifdef TRACE
/* SDB debug statement */ /* SDB debug statement */
@ -944,8 +946,6 @@ translate(struct line *deck, char *formal, char *actual, char *scname, const cha
#endif #endif
if (ciprefix(".ic", c->li_line) || ciprefix(".nodeset", c->li_line)) { if (ciprefix(".ic", c->li_line) || ciprefix(".nodeset", c->li_line)) {
bxx_rewind(&buffer);
s = c->li_line;
while ((paren_ptr = strchr(s, '(')) != NULL) { while ((paren_ptr = strchr(s, '(')) != NULL) {
name = paren_ptr + 1; name = paren_ptr + 1;
@ -973,8 +973,6 @@ translate(struct line *deck, char *formal, char *actual, char *scname, const cha
case '$': case '$':
case '.': case '.':
/* Just a pointer to the line into s and then break */ /* Just a pointer to the line into s and then break */
bxx_rewind(&buffer);
s = c->li_line;
break; break;
#ifdef XSPICE #ifdef XSPICE
@ -986,10 +984,8 @@ translate(struct line *deck, char *formal, char *actual, char *scname, const cha
case 'A': case 'A':
/* translate the instance name according to normal rules */ /* translate the instance name according to normal rules */
s = c->li_line;
name = MIFgettok(&s); name = MIFgettok(&s);
bxx_rewind(&buffer);
translate_inst_name(&buffer, scname, name, NULL); translate_inst_name(&buffer, scname, name, NULL);
bxx_putc(&buffer, ' '); bxx_putc(&buffer, ' ');
@ -1069,7 +1065,6 @@ translate(struct line *deck, char *formal, char *actual, char *scname, const cha
case 'H': case 'H':
case 'h': case 'h':
s = c->li_line; /* s now holds the SPICE line */
t = name = gettok(&s); /* name points to the refdes */ t = name = gettok(&s); /* name points to the refdes */
if (!name) if (!name)
continue; continue;
@ -1081,7 +1076,6 @@ translate(struct line *deck, char *formal, char *actual, char *scname, const cha
/* Here's where we translate the refdes to e.g. F:subcircuitname:57 /* Here's where we translate the refdes to e.g. F:subcircuitname:57
* and stick the translated name into buffer. * and stick the translated name into buffer.
*/ */
bxx_rewind(&buffer);
translate_inst_name(&buffer, scname, name, NULL); translate_inst_name(&buffer, scname, name, NULL);
tfree(t); tfree(t);
bxx_putc(&buffer, ' '); bxx_putc(&buffer, ' ');
@ -1187,7 +1181,6 @@ translate(struct line *deck, char *formal, char *actual, char *scname, const cha
/*================= Default case ===================*/ /*================= Default case ===================*/
default: /* this section handles ordinary components */ default: /* this section handles ordinary components */
s = c->li_line;
nametofree = name = gettok_node(&s); /* changed to gettok_node to handle netlists with ( , ) */ nametofree = name = gettok_node(&s); /* changed to gettok_node to handle netlists with ( , ) */
if (!name) if (!name)
continue; continue;
@ -1200,7 +1193,6 @@ translate(struct line *deck, char *formal, char *actual, char *scname, const cha
* and stick the translated name into buffer. * and stick the translated name into buffer.
*/ */
bxx_rewind(&buffer);
translate_inst_name(&buffer, scname, name, NULL); translate_inst_name(&buffer, scname, name, NULL);
tfree(nametofree); tfree(nametofree);

Loading…
Cancel
Save