more precise recognition of subckt names

This commit is contained in:
dwarning 2008-01-19 21:35:44 +00:00
parent 8f1b9a96d8
commit 70e9121bbb
1 changed files with 796 additions and 784 deletions

View File

@ -2007,6 +2007,8 @@ nupa_subcktcall (tdico * dico, char *s, char *x, unsigned char err)
Strbig (Llen, v); Strbig (Llen, v);
Strbig (Llen, idlist); Strbig (Llen, idlist);
Str (80, subname); Str (80, subname);
char *buf, *token;
unsigned char found;
/* /*
skip over instance name -- fixes bug where instance 'x1' is skip over instance name -- fixes bug where instance 'x1' is
@ -2084,17 +2086,28 @@ nupa_subcktcall (tdico * dico, char *s, char *x, unsigned char err)
scopy_up (t, x); scopy_up (t, x);
ls = length (t); ls = length (t);
j = spos (subname, t);
buf = (char*) malloc(strlen(t) + 1);
strcpy(buf, t);
found = 0;
token = strtok(buf, " "); /* a bit more exact - but not sufficient everytime */
j = j + strlen(token) + 1;
if (strcmp(token, subname)) {
while ((token = strtok(NULL, " "))) {
if (!strcmp(token, subname)) {
found = 1;
break;
}
j = j + strlen(token) + 1;
}
}
free(buf);
/* make sure that subname followed by space */ /* make sure that subname followed by space */
while (j > 0 && *(t + j + length (subname) - 1) > ' ') if (found)
j =
j + length (subname) - 1 + spos (subname,
t + j + length (subname) - 1);
if (j > 0)
{ {
j = j + length (subname) - 1; /* 1st position of arglist: j */ j = j + length (subname) + 1; /* 1st position of arglist: j */
while ((j < ls) && ((t[j] <= ' ') || (t[j] == ','))) while ((j < ls) && ((t[j] <= ' ') || (t[j] == ',')))
j++; j++;
@ -2144,7 +2157,6 @@ nupa_subcktcall (tdico * dico, char *s, char *x, unsigned char err)
else else
{ {
j++; j++;
if (t[k] > ' ') if (t[k] > ' ')
{ {
scopy (v, "Subckt call, symbol "); scopy (v, "Subckt call, symbol ");