From 47af112683aca48d7d248c829cbfb2a80dbc39a1 Mon Sep 17 00:00:00 2001 From: sjborley Date: Fri, 6 May 2005 07:11:02 +0000 Subject: [PATCH] Added code by H.Tanaka to find global nodes --- src/frontend/subckt.c | 57 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 45 insertions(+), 12 deletions(-) diff --git a/src/frontend/subckt.c b/src/frontend/subckt.c index 62adb85dd..6e7d02b5a 100644 --- a/src/frontend/subckt.c +++ b/src/frontend/subckt.c @@ -71,7 +71,7 @@ Modified: 2000 AlansFixes extern char * nupa_copy(char *s, int linenum); extern int nupa_eval(char *s, int linenum); extern int nupa_signal(int sig, char *info); -extern void nupa_scan(char * s, int linenum); // sjb +extern void nupa_scan(char * s, int linenum); /* SJB added */ #endif /* ----- static declarations ----- */ @@ -121,10 +121,15 @@ static bool nobjthack = FALSE; #ifdef NUMPARAMS /* flag indicating use of the experimental numparams library */ static bool use_numparams = FALSE; -#endif +#endif /* NUMPARAMS */ static char start[32], sbend[32], invoke[32], model[32]; +#ifdef GLOBAL_NODE +static char node[128][128]; +static int numgnode; +#endif /* GLOBAL_NODE */ + /*-------------------------------------------------------------------*/ /* inp_subcktexpand is the top level function which translates */ /* .subckts into mainlined code. Note that there are two things */ @@ -149,6 +154,10 @@ inp_subcktexpand(struct line *deck) #ifdef NUMPARAMS int ok; #endif /* NUMPARAMS */ +#ifdef GLOBAL_NODE + char *t; + int i; +#endif /* GLOBAL_NODE */ wordlist *wl; modnames = NULL; @@ -209,7 +218,7 @@ inp_subcktexpand(struct line *deck) for (c = deck; c; c = c->li_next) if (ciprefix(model, c->li_line)) { s = c->li_line; - txfree(gettok(&s)); // discard the model keyword + txfree(gettok(&s)); /* discard the model keyword */ wl = alloc(struct wordlist); wl->wl_next = modnames; if (modnames) @@ -227,6 +236,32 @@ inp_subcktexpand(struct line *deck) } #endif /* TRACE */ +/* Added by H.Tanaka to find global nodes */ +#ifdef GLOBAL_NODE + for(i=0;i<128;i++) strcpy(node[i],"");/* Clear global node holder */ + for (c = deck; c; c = c->li_next) { + if (ciprefix(".global", c->li_line)) { + s = c->li_line; + txfree(gettok(&s)); + numgnode=0; + while(*s) { + i=0; + t=s; + for (/*s*/; *s && !isspace(*s); s++) i++; + strncpy(node[numgnode],t,i); + while (isspace(*s)) s++; + numgnode++; + } /* node[] holds name of global node */ +#ifdef TRACE + printf("***Global node option has been found.***\n"); + for(i=0;ili_line[0] = '*'; /* comment it out */ + }/* if(ciprefix.. */ + } /* for(c=deck.. */ +#endif /* GLOBAL_NODE */ /* Let's do a few cleanup things... Get rid of ( ) around node * lists... @@ -275,7 +310,7 @@ inp_subcktexpand(struct line *deck) #endif /* TRACE */ ll = doit(deck); - // SJB: free up the modnames linked list now we are done with it + /* SJB: free up the modnames linked list now we are done with it */ if(modnames != NULL) { wl_free(modnames); modnames = NULL; @@ -1268,6 +1303,12 @@ gettrans(char *name) /* gtri - end */ #endif +/* Added by H.Tanaka to translate global nodes */ +#ifdef GLOBAL_NODE + for(i=0;i