subckt.c, translate(), #3/8 simplify
This commit is contained in:
parent
c8413a1947
commit
effa37e944
|
|
@ -1104,7 +1104,7 @@ translate(struct line *deck, char *formal, char *actual, char *scname, const cha
|
||||||
case 'g':
|
case 'g':
|
||||||
case 'h':
|
case 'h':
|
||||||
|
|
||||||
t = name = gettok(&s); /* name points to the refdes */
|
name = gettok(&s); /* name points to the refdes */
|
||||||
if (!name)
|
if (!name)
|
||||||
continue;
|
continue;
|
||||||
if (!*name) {
|
if (!*name) {
|
||||||
|
|
@ -1116,7 +1116,7 @@ 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.
|
||||||
*/
|
*/
|
||||||
translate_inst_name(&buffer, scname, name, NULL);
|
translate_inst_name(&buffer, scname, name, NULL);
|
||||||
tfree(t);
|
tfree(name);
|
||||||
bxx_putc(&buffer, ' ');
|
bxx_putc(&buffer, ' ');
|
||||||
|
|
||||||
/* Next iterate over all nodes (netnames) found and translate them. */
|
/* Next iterate over all nodes (netnames) found and translate them. */
|
||||||
|
|
@ -1179,7 +1179,7 @@ translate(struct line *deck, char *formal, char *actual, char *scname, const cha
|
||||||
/* Now translate the controlling source/nodes */
|
/* Now translate the controlling source/nodes */
|
||||||
nnodes = dim * numdevs(c->li_line);
|
nnodes = dim * numdevs(c->li_line);
|
||||||
while (--nnodes >= 0) {
|
while (--nnodes >= 0) {
|
||||||
nametofree = name = gettok_node(&s); /* name points to the returned token */
|
name = gettok_node(&s); /* name points to the returned token */
|
||||||
if (name == NULL) {
|
if (name == NULL) {
|
||||||
fprintf(cp_err, "Error: too few devs: %s\n", c->li_line);
|
fprintf(cp_err, "Error: too few devs: %s\n", c->li_line);
|
||||||
goto quit;
|
goto quit;
|
||||||
|
|
@ -1205,7 +1205,7 @@ translate(struct line *deck, char *formal, char *actual, char *scname, const cha
|
||||||
|
|
||||||
translate_node_name(&buffer, scname, name, NULL);
|
translate_node_name(&buffer, scname, name, NULL);
|
||||||
}
|
}
|
||||||
tfree(nametofree);
|
tfree(name);
|
||||||
bxx_putc(&buffer, ' ');
|
bxx_putc(&buffer, ' ');
|
||||||
} /* while (nnodes--. . . . */
|
} /* while (nnodes--. . . . */
|
||||||
|
|
||||||
|
|
@ -1217,7 +1217,7 @@ 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 */
|
||||||
nametofree = name = gettok_node(&s); /* changed to gettok_node to handle netlists with ( , ) */
|
name = gettok_node(&s); /* changed to gettok_node to handle netlists with ( , ) */
|
||||||
if (!name)
|
if (!name)
|
||||||
continue;
|
continue;
|
||||||
if (!*name) {
|
if (!*name) {
|
||||||
|
|
@ -1231,7 +1231,7 @@ translate(struct line *deck, char *formal, char *actual, char *scname, const cha
|
||||||
|
|
||||||
|
|
||||||
translate_inst_name(&buffer, scname, name, NULL);
|
translate_inst_name(&buffer, scname, name, NULL);
|
||||||
tfree(nametofree);
|
tfree(name);
|
||||||
bxx_putc(&buffer, ' ');
|
bxx_putc(&buffer, ' ');
|
||||||
|
|
||||||
/* Next iterate over all nodes (netnames) found and translate them. */
|
/* Next iterate over all nodes (netnames) found and translate them. */
|
||||||
|
|
@ -1254,14 +1254,14 @@ translate(struct line *deck, char *formal, char *actual, char *scname, const cha
|
||||||
*/
|
*/
|
||||||
nnodes = numdevs(c->li_line);
|
nnodes = numdevs(c->li_line);
|
||||||
while (--nnodes >= 0) {
|
while (--nnodes >= 0) {
|
||||||
t = name = gettok_node(&s);
|
name = gettok_node(&s);
|
||||||
if (name == NULL) {
|
if (name == NULL) {
|
||||||
fprintf(cp_err, "Error: too few devs: %s\n", c->li_line);
|
fprintf(cp_err, "Error: too few devs: %s\n", c->li_line);
|
||||||
goto quit;
|
goto quit;
|
||||||
}
|
}
|
||||||
|
|
||||||
translate_inst_name(&buffer, scname, name, NULL);
|
translate_inst_name(&buffer, scname, name, NULL);
|
||||||
tfree(t);
|
tfree(name);
|
||||||
bxx_putc(&buffer, ' ');
|
bxx_putc(&buffer, ' ');
|
||||||
} /* while (nnodes--. . . . */
|
} /* while (nnodes--. . . . */
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue