subckt.c, numnodes(), cleanup
This commit is contained in:
parent
0caf879ea6
commit
4bd446096e
|
|
@ -1503,31 +1503,20 @@ numnodes(char *name, struct subs *subs, wordlist const *modnames)
|
||||||
/* instead. */
|
/* instead. */
|
||||||
/* gtri - end - wbk - 10/23/90 */
|
/* gtri - end - wbk - 10/23/90 */
|
||||||
char c;
|
char c;
|
||||||
struct subs *sss;
|
|
||||||
char *s, *t, buf[4 * BSIZE_SP];
|
char *s, *t, buf[4 * BSIZE_SP];
|
||||||
const wordlist *wl;
|
const wordlist *wl;
|
||||||
int n, i, gotit;
|
int n, i, gotit;
|
||||||
|
|
||||||
name = skip_ws(name);
|
name = skip_ws(name);
|
||||||
|
|
||||||
c = *name;
|
c = tolower_c(*name);
|
||||||
if (isupper_c(c))
|
|
||||||
c = tolower_c(c);
|
|
||||||
|
|
||||||
(void) strncpy(buf, name, sizeof(buf));
|
|
||||||
s = buf;
|
|
||||||
if (c == 'x') { /* Handle this ourselves. */
|
if (c == 'x') { /* Handle this ourselves. */
|
||||||
while (*s)
|
const char *xname_e = skip_back_ws(strchr(name, '\0'), name);
|
||||||
s++;
|
const char *xname = skip_back_non_ws(xname_e, name);
|
||||||
s--;
|
for (; subs; subs = subs->su_next)
|
||||||
while ((*s == ' ') || (*s == '\t'))
|
if (eq_substr(xname, xname_e, subs->su_name))
|
||||||
*s-- = '\0';
|
return subs->su_numargs;
|
||||||
while ((*s != ' ') && (*s != '\t'))
|
|
||||||
s--;
|
|
||||||
s++;
|
|
||||||
for (sss = subs; sss; sss = sss->su_next)
|
|
||||||
if (eq(sss->su_name, s))
|
|
||||||
return (sss->su_numargs);
|
|
||||||
/*
|
/*
|
||||||
* number of nodes not known so far.
|
* number of nodes not known so far.
|
||||||
* lets count the nodes ourselves,
|
* lets count the nodes ourselves,
|
||||||
|
|
@ -1536,10 +1525,9 @@ numnodes(char *name, struct subs *subs, wordlist const *modnames)
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
int nodes = -2;
|
int nodes = -2;
|
||||||
for (s = buf; *s; ) {
|
while (*name) {
|
||||||
nodes++;
|
nodes++;
|
||||||
s = skip_non_ws(s);
|
name = skip_ws(skip_non_ws(name));
|
||||||
s = skip_ws(s);
|
|
||||||
}
|
}
|
||||||
return (nodes);
|
return (nodes);
|
||||||
}
|
}
|
||||||
|
|
@ -1554,6 +1542,8 @@ numnodes(char *name, struct subs *subs, wordlist const *modnames)
|
||||||
/* Paolo Nenzi Jan-2001 */
|
/* Paolo Nenzi Jan-2001 */
|
||||||
|
|
||||||
if ((c == 'm') || (c == 'p') || (c == 'q')) { /* IF this is a mos, cpl or bjt*/
|
if ((c == 'm') || (c == 'p') || (c == 'q')) { /* IF this is a mos, cpl or bjt*/
|
||||||
|
(void) strncpy(buf, name, sizeof(buf));
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
s = buf;
|
s = buf;
|
||||||
gotit = 0;
|
gotit = 0;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue