bug fix, `#248 Subcircuit call cannot have a node with same name as the subcircuit'

reported by  Henrik Forstén
http://sourceforge.net/p/ngspice/bugs/248/
This commit is contained in:
h_vogt 2013-07-27 09:21:15 +02:00 committed by rlar
parent 4f39648320
commit 49c1385ba6
1 changed files with 4 additions and 3 deletions

View File

@ -1927,7 +1927,7 @@ nupa_subcktcall(tdico *dico, char *s, char *x, bool err)
x= a matching subckt call line, with actual params
*/
{
int n, i, j, k, g, h, narg = 0, ls, nest;
int n, i, j, found_j, k, g, h, narg = 0, ls, nest;
SPICE_DSTRING subname;
SPICE_DSTRING tstr;
SPICE_DSTRING ustr;
@ -2042,18 +2042,19 @@ nupa_subcktcall(tdico *dico, char *s, char *x, bool err)
scopyd(&parsebuf, &tstr);
buf = spice_dstring_value(&parsebuf);
found = 0;
found = found_j = 0;
token = strtok(buf, " "); /* a bit more exact - but not sufficient everytime */
j = j + (int) strlen(token) + 1;
if (strcmp(token, spice_dstring_value(&subname)))
while ((token = strtok(NULL, " ")) != NULL) {
if (!strcmp(token, spice_dstring_value(&subname))) {
found = 1;
break;
found_j = j;
}
j = j + (int) strlen(token) + 1;
}
j = found_j; /* last occurence of subname in buf */
spice_dstring_free(&parsebuf);
/* make sure that subname followed by space */