subs, pass global `subs' by reference, EXACT
global subs0
used and modified in doit()
passed to translate()
translate()
pass only to nunmodes()
numnodes()
doesn't modify
This commit is contained in:
parent
56618c91f6
commit
ca4cd48786
|
|
@ -77,14 +77,15 @@ extern void line_free_x(struct line * deck, bool recurse);
|
||||||
#define line_free(line,flag) { line_free_x(line,flag); line = NULL; }
|
#define line_free(line,flag) { line_free_x(line,flag); line = NULL; }
|
||||||
|
|
||||||
/* ----- static declarations ----- */
|
/* ----- static declarations ----- */
|
||||||
|
struct subs;
|
||||||
static struct line * doit(struct line *deck);
|
static struct line * doit(struct line *deck);
|
||||||
static int translate(struct line *deck, char *formal, char *actual, char *scname,
|
static int translate(struct line *deck, char *formal, char *actual, char *scname,
|
||||||
char *subname);
|
char *subname, struct subs * const * const subs2);
|
||||||
struct bxx_buffer;
|
struct bxx_buffer;
|
||||||
static void finishLine(struct bxx_buffer *dst, char *src, char *scname);
|
static void finishLine(struct bxx_buffer *dst, char *src, char *scname);
|
||||||
static int settrans(char *formal, char *actual, char *subname);
|
static int settrans(char *formal, char *actual, char *subname);
|
||||||
static char * gettrans(const char *name, const char *name_end);
|
static char * gettrans(const char *name, const char *name_end);
|
||||||
static int numnodes(char *name);
|
static int numnodes(char *name, struct subs * const * const subs3);
|
||||||
static int numdevs(char *s);
|
static int numdevs(char *s);
|
||||||
static bool modtranslate(struct line *deck, char *subname);
|
static bool modtranslate(struct line *deck, char *subname);
|
||||||
static void devmodtranslate(struct line *deck, char *subname);
|
static void devmodtranslate(struct line *deck, char *subname);
|
||||||
|
|
@ -119,7 +120,7 @@ struct subs {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static wordlist *modnames, *submod;
|
static wordlist *modnames, *submod;
|
||||||
static struct subs *subs = NULL;
|
static struct subs *subs0 = NULL;
|
||||||
static bool nobjthack = FALSE;
|
static bool nobjthack = FALSE;
|
||||||
/* flag indicating use of the experimental numparams library */
|
/* flag indicating use of the experimental numparams library */
|
||||||
static bool use_numparams = FALSE;
|
static bool use_numparams = FALSE;
|
||||||
|
|
@ -401,11 +402,11 @@ doit(struct line *deck) {
|
||||||
bool gotone;
|
bool gotone;
|
||||||
wordlist *tmodnames = modnames;
|
wordlist *tmodnames = modnames;
|
||||||
wordlist *tsubmod = submod;
|
wordlist *tsubmod = submod;
|
||||||
struct subs *ts = subs;
|
struct subs *ts = subs0;
|
||||||
int error;
|
int error;
|
||||||
|
|
||||||
/* Save all the old stuff... */
|
/* Save all the old stuff... */
|
||||||
subs = NULL;
|
subs0 = NULL;
|
||||||
submod = NULL;
|
submod = NULL;
|
||||||
|
|
||||||
#ifdef TRACE
|
#ifdef TRACE
|
||||||
|
|
@ -509,8 +510,8 @@ doit(struct line *deck) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sss->su_next = subs;
|
sss->su_next = subs0;
|
||||||
subs = sss; /* Now that sss is built, assign it to subs */
|
subs0 = sss; /* Now that sss is built, assign it to subs */
|
||||||
|
|
||||||
last = c->li_next;
|
last = c->li_next;
|
||||||
|
|
||||||
|
|
@ -536,10 +537,10 @@ doit(struct line *deck) {
|
||||||
/* Otherwise, expand sub-subcircuits recursively. */
|
/* Otherwise, expand sub-subcircuits recursively. */
|
||||||
{
|
{
|
||||||
struct subs *ks;
|
struct subs *ks;
|
||||||
for (ks = sss = subs; sss; sss = sss->su_next) /* iterate through the list of subcircuits */
|
for (ks = sss = subs0; sss; sss = sss->su_next) /* iterate through the list of subcircuits */
|
||||||
if ((sss->su_def = doit(sss->su_def)) == NULL)
|
if ((sss->su_def = doit(sss->su_def)) == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
subs = ks; /* ks has held pointer to start of subcircuits list. */
|
subs0 = ks; /* ks has held pointer to start of subcircuits list. */
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TRACE
|
#ifdef TRACE
|
||||||
|
|
@ -590,7 +591,7 @@ doit(struct line *deck) {
|
||||||
s++;
|
s++;
|
||||||
|
|
||||||
/* iterate through .subckt list and look for .subckt name invoked */
|
/* iterate through .subckt list and look for .subckt name invoked */
|
||||||
for (sss = subs; sss; sss = sss->su_next)
|
for (sss = subs0; sss; sss = sss->su_next)
|
||||||
if (eq(sss->su_name, s))
|
if (eq(sss->su_name, s))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -629,7 +630,7 @@ doit(struct line *deck) {
|
||||||
/* now invoke translate, which handles the remainder of the
|
/* now invoke translate, which handles the remainder of the
|
||||||
* translation.
|
* translation.
|
||||||
*/
|
*/
|
||||||
if (!translate(lcc, s, t, scname, subname))
|
if (!translate(lcc, s, t, scname, subname, &subs0))
|
||||||
error = 1;
|
error = 1;
|
||||||
tfree(subname);
|
tfree(subname);
|
||||||
}
|
}
|
||||||
|
|
@ -690,7 +691,7 @@ doit(struct line *deck) {
|
||||||
if (error)
|
if (error)
|
||||||
return NULL; /* error message already reported; should free( ) */
|
return NULL; /* error message already reported; should free( ) */
|
||||||
|
|
||||||
subs = ts;
|
subs0 = ts;
|
||||||
modnames = tmodnames;
|
modnames = tmodnames;
|
||||||
submod = tsubmod;
|
submod = tsubmod;
|
||||||
/*
|
/*
|
||||||
|
|
@ -891,7 +892,7 @@ bxx_buffer(struct bxx_buffer *t)
|
||||||
* subname = copy of the subcircuit name
|
* subname = copy of the subcircuit name
|
||||||
*-------------------------------------------------------------------------------------------*/
|
*-------------------------------------------------------------------------------------------*/
|
||||||
static int
|
static int
|
||||||
translate(struct line *deck, char *formal, char *actual, char *scname, char *subname)
|
translate(struct line *deck, char *formal, char *actual, char *scname, char *subname, struct subs * const * const subs2)
|
||||||
{
|
{
|
||||||
struct line *c;
|
struct line *c;
|
||||||
struct bxx_buffer buffer;
|
struct bxx_buffer buffer;
|
||||||
|
|
@ -1079,7 +1080,7 @@ translate(struct line *deck, char *formal, char *actual, char *scname, char *sub
|
||||||
tfree(t);
|
tfree(t);
|
||||||
|
|
||||||
/* Next iterate over all nodes (netnames) found and translate them. */
|
/* Next iterate over all nodes (netnames) found and translate them. */
|
||||||
nnodes = numnodes(c->li_line);
|
nnodes = numnodes(c->li_line, subs2);
|
||||||
|
|
||||||
while (nnodes-- > 0) {
|
while (nnodes-- > 0) {
|
||||||
name = gettok_node(&s);
|
name = gettok_node(&s);
|
||||||
|
|
@ -1224,7 +1225,7 @@ translate(struct line *deck, char *formal, char *actual, char *scname, char *sub
|
||||||
tfree(nametofree);
|
tfree(nametofree);
|
||||||
|
|
||||||
/* Next iterate over all nodes (netnames) found and translate them. */
|
/* Next iterate over all nodes (netnames) found and translate them. */
|
||||||
nnodes = numnodes(c->li_line);
|
nnodes = numnodes(c->li_line, subs2);
|
||||||
while (nnodes-- > 0) {
|
while (nnodes-- > 0) {
|
||||||
name = gettok_node(&s);
|
name = gettok_node(&s);
|
||||||
if (name == NULL ) {
|
if (name == NULL ) {
|
||||||
|
|
@ -1504,7 +1505,7 @@ model_bin_match( char* token, char* model_name )
|
||||||
/*-------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------*/
|
||||||
/*-------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------*/
|
||||||
static int
|
static int
|
||||||
numnodes(char *name)
|
numnodes(char *name, struct subs * const * const subs3)
|
||||||
{
|
{
|
||||||
/* gtri - comment - wbk - 10/23/90 - Do not modify this routine for */
|
/* gtri - comment - wbk - 10/23/90 - Do not modify this routine for */
|
||||||
/* 'A' type devices since the callers will not know how to find the */
|
/* 'A' type devices since the callers will not know how to find the */
|
||||||
|
|
@ -1535,7 +1536,7 @@ numnodes(char *name)
|
||||||
while ((*s != ' ') && (*s != '\t'))
|
while ((*s != ' ') && (*s != '\t'))
|
||||||
s--;
|
s--;
|
||||||
s++;
|
s++;
|
||||||
for (sss = subs; sss; sss = sss->su_next)
|
for (sss = *subs3; sss; sss = sss->su_next)
|
||||||
if (eq(sss->su_name, s))
|
if (eq(sss->su_name, s))
|
||||||
return (sss->su_numargs);
|
return (sss->su_numargs);
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue