subckt.c, translate(), rewrite using bxx facility
This commit is contained in:
parent
78c611aa64
commit
b633362973
|
|
@ -923,7 +923,7 @@ translate(struct line *deck, char *formal, char *actual, char *scname, const cha
|
||||||
{
|
{
|
||||||
struct line *c;
|
struct line *c;
|
||||||
struct bxx_buffer buffer;
|
struct bxx_buffer buffer;
|
||||||
char *next_name, dev_type, *name, *s, *t, ch, *nametofree, *paren_ptr, *new_str;
|
char *next_name, dev_type, *name, *s, *t, ch, *nametofree, *paren_ptr;
|
||||||
int nnodes, i, dim;
|
int nnodes, i, dim;
|
||||||
int rtn = 0;
|
int rtn = 0;
|
||||||
|
|
||||||
|
|
@ -953,32 +953,31 @@ 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)) {
|
||||||
paren_ptr = s = c->li_line;
|
bxx_rewind(&buffer);
|
||||||
while ((paren_ptr = strchr(paren_ptr, '(')) != NULL) {
|
s = c->li_line;
|
||||||
*paren_ptr = '\0';
|
while ((paren_ptr = strchr(s, '(')) != NULL) {
|
||||||
paren_ptr++;
|
name = paren_ptr + 1;
|
||||||
name = paren_ptr;
|
|
||||||
|
|
||||||
if ((paren_ptr = strchr(paren_ptr, ')')) == NULL) {
|
if ((paren_ptr = strchr(name, ')')) == NULL) {
|
||||||
*(name-1) = '(';
|
|
||||||
fprintf(cp_err, "Error: missing closing ')' for .ic|.nodeset statement %s\n", c->li_line);
|
fprintf(cp_err, "Error: missing closing ')' for .ic|.nodeset statement %s\n", c->li_line);
|
||||||
goto quit;
|
goto quit;
|
||||||
}
|
}
|
||||||
*paren_ptr = '\0';
|
|
||||||
t = gettrans(name, NULL);
|
|
||||||
|
|
||||||
|
bxx_put_substring(&buffer, s, name);
|
||||||
|
|
||||||
|
t = gettrans(name, paren_ptr);
|
||||||
if (t) {
|
if (t) {
|
||||||
new_str = tprintf("%s(%s)%s", s, t, paren_ptr+1);
|
bxx_put_cstring(&buffer, t);
|
||||||
} else {
|
} else {
|
||||||
new_str = tprintf("%s(%s.%s)%s", s, scname, name, paren_ptr+1);
|
bxx_printf(&buffer, "%s.%.*s", scname, (int) (paren_ptr - name), name);
|
||||||
}
|
}
|
||||||
|
|
||||||
paren_ptr = new_str + strlen(s) + 1;
|
s = paren_ptr;
|
||||||
|
|
||||||
tfree(s);
|
|
||||||
s = new_str;
|
|
||||||
}
|
}
|
||||||
c->li_line = s;
|
bxx_put_cstring(&buffer, s); /* rest of line */
|
||||||
|
|
||||||
|
tfree(c->li_line);
|
||||||
|
c->li_line = copy(bxx_buffer(&buffer));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue