Browse Source

global nodes and numparams now as default

pre-master-46
dwarning 18 years ago
parent
commit
bce499a9e1
  1. 5
      ChangeLog
  2. 27
      configure.in
  3. 4
      src/Makefile.am
  4. 2
      src/frontend/Makefile.am
  5. 4
      src/frontend/inp.c
  6. 51
      src/frontend/subckt.c

5
ChangeLog

@ -1,3 +1,8 @@
2008-05-12 Dietmar Warning
* src/frontend/inp.c, src/frontend/inp.c, src/frontend/Makefile.am, src/Makefile.am,
configure.in: global nodes and numparams now as default - configure switches not needed
tested so far - but sure that some problems will raise.
2008-05-11 Dietmar Warning 2008-05-11 Dietmar Warning
* src/misc/missing_math.c,h, src/math/misc/*.*: move math function to one place * src/misc/missing_math.c,h, src/math/misc/*.*: move math function to one place
* src/include/ngspice.h, src/main.c, src/Makefile.am, src/maths/Makefile.am, * src/include/ngspice.h, src/main.c, src/Makefile.am, src/maths/Makefile.am,

27
configure.in

@ -154,10 +154,6 @@ dnl --enable-cluster: define CLUSTER in the code. This is for cluster support
AC_ARG_ENABLE(cluster, AC_ARG_ENABLE(cluster,
AS_HELP_STRING([--enable-cluster],[Enable cluster support, (experimental) ])) AS_HELP_STRING([--enable-cluster],[Enable cluster support, (experimental) ]))
dnl --enable-numparam: define NUMPARAMS in the code. This is for .param support
AC_ARG_ENABLE(numparam,
AS_HELP_STRING([--enable-numparam],[Enable numparam library support, (experimental) ]))
dnl --enable-xgraph: Compile the xgraph plotting program. Default is "no". dnl --enable-xgraph: Compile the xgraph plotting program. Default is "no".
dnl Xgraph is a plotting package for X11 once very popular. dnl Xgraph is a plotting package for X11 once very popular.
AC_ARG_ENABLE(xgraph, AC_ARG_ENABLE(xgraph,
@ -714,29 +710,6 @@ if test "$enable_expdevices" = "yes"; then
AC_MSG_RESULT(WARNING: Experimental devices enabled) AC_MSG_RESULT(WARNING: Experimental devices enabled)
fi fi
dnl --enable-dot-global: Enable use of the .global keyword (experimental)
AC_MSG_CHECKING([whether .gobal keyword has been enabled])
AC_ARG_ENABLE(dot-global,
AS_HELP_STRING([--enable-dot-global],[Enable use of the .global keyword (experimental)]),
[if test "$enable_dot_global" = "yes"; then
AC_DEFINE([GLOBAL_NODE],[1],[Define to enable the .global keyword])
fi],
[enable_dot_global="no"])
AC_MSG_RESULT($enable_dot_global)
if test "$enable_numparam" = "yes"; then
AC_MSG_RESULT(Numparam library is enabled)
AC_DEFINE(NUMPARAMS,[1],[Spice .param support])
NUMPARAMDIR="numparam"
NUMPARAMLIB="frontend/numparam/libnumparam.a"
else
NUMPARAMDIR=""
NUMPARAMLIB=""
fi
AC_SUBST(NUMPARAMDIR)
AC_SUBST(NUMPARAMLIB)
dnl ---- Option to include GNU readline support in ngspice CLI ---- dnl ---- Option to include GNU readline support in ngspice CLI ----
dnl ---- Default: disabled. ---- dnl ---- Default: disabled. ----
dnl ---- Hope to see in the future readline replacement. ---- dnl ---- Hope to see in the future readline replacement. ----

4
src/Makefile.am

@ -103,7 +103,7 @@ ngspice_LDADD = \
spicelib/devices/libdev.a \ spicelib/devices/libdev.a \
@XSPICELIB2@ \ @XSPICELIB2@ \
frontend/parser/libparser.a \ frontend/parser/libparser.a \
@NUMPARAMLIB@ \
frontend/numparam/libnumparam.a \
frontend/help/libhlp.a \ frontend/help/libhlp.a \
spicelib/parser/libinp.a \ spicelib/parser/libinp.a \
@CIDERSIM@ \ @CIDERSIM@ \
@ -139,7 +139,7 @@ ngnutmeg_LDADD = \
@WINDISPLIB@ \ @WINDISPLIB@ \
frontend/plotting/libplotting.a \ frontend/plotting/libplotting.a \
frontend/parser/libparser.a \ frontend/parser/libparser.a \
@NUMPARAMLIB@ \
frontend/numparam/libnumparam.a \
frontend/help/libhlp.a \ frontend/help/libhlp.a \
maths/cmaths/libcmaths.a \ maths/cmaths/libcmaths.a \
maths/misc/libmathmisc.a \ maths/misc/libmathmisc.a \

2
src/frontend/Makefile.am

@ -1,7 +1,7 @@
## Process this file with automake to produce Makefile.in ## Process this file with automake to produce Makefile.in
## $Id$ ## $Id$
SUBDIRS = plotting help parser wdisp @NUMPARAMDIR@
SUBDIRS = plotting help parser wdisp numparam
DIST_SUBDIRS = plotting help parser wdisp numparam DIST_SUBDIRS = plotting help parser wdisp numparam
noinst_LIBRARIES = libfte.a noinst_LIBRARIES = libfte.a

4
src/frontend/inp.c

@ -48,9 +48,7 @@ $Id$
/* gtri - end - 12/12/90 */ /* gtri - end - 12/12/90 */
#endif #endif
#ifdef NUMPARAMS
#include "numparam/numpaif.h" #include "numparam/numpaif.h"
#endif
#define line_free(line,flag) { line_free_x(line,flag); line = NULL; } #define line_free(line,flag) { line_free_x(line,flag); line = NULL; }
@ -440,7 +438,6 @@ inp_spsource(FILE *fp, bool comfile, char *filename)
wl->wl_word = dd->li_line; wl->wl_word = dd->li_line;
dd->li_line = 0; /* SJB - prevent line_free() freeing the string (now pointed at by wl->wl_word) */ dd->li_line = 0; /* SJB - prevent line_free() freeing the string (now pointed at by wl->wl_word) */
} }
#ifdef NUMPARAMS
/* Look for set or unset numparams. /* Look for set or unset numparams.
If either are found then we evaluate these lines immediately If either are found then we evaluate these lines immediately
so they take effect before netlist parsing */ so they take effect before netlist parsing */
@ -457,7 +454,6 @@ inp_spsource(FILE *fp, bool comfile, char *filename)
cp_evloop(wl->wl_word); cp_evloop(wl->wl_word);
} }
} }
#endif /* NUMPARAMS */
ld->li_next = dd->li_next; ld->li_next = dd->li_next;
line_free(dd,FALSE); /* SJB - free this line's memory */ line_free(dd,FALSE); /* SJB - free this line's memory */
} else if (!*dd->li_line) { } else if (!*dd->li_line) {

51
src/frontend/subckt.c

@ -61,13 +61,7 @@ $Id$
#include "subckt.h" #include "subckt.h"
#include "variable.h" #include "variable.h"
#ifdef NUMPARAMS
/* Uncomment to turn on tracing for the Numparam */
/*#define TRACE_NUMPARAMS*/
/*#define TRACE*/
#include "numparam/numpaif.h" #include "numparam/numpaif.h"
#endif
/* ----- static declarations ----- */ /* ----- static declarations ----- */
static struct line * doit(struct line *deck); static struct line * doit(struct line *deck);
@ -113,17 +107,13 @@ struct subs {
static wordlist *modnames, *submod; static wordlist *modnames, *submod;
static struct subs *subs = NULL; static struct subs *subs = NULL;
static bool nobjthack = FALSE; static bool nobjthack = FALSE;
#ifdef NUMPARAMS
/* 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;
#endif /* NUMPARAMS */
static char start[32], sbend[32], invoke[32], model[32]; static char start[32], sbend[32], invoke[32], model[32];
#ifdef GLOBAL_NODE
static char node[128][128]; static char node[128][128];
static int numgnode; static int numgnode;
#endif /* GLOBAL_NODE */
/*-------------------------------------------------------------------*/ /*-------------------------------------------------------------------*/
/* inp_subcktexpand is the top level function which translates */ /* inp_subcktexpand is the top level function which translates */
@ -146,13 +136,9 @@ inp_subcktexpand(struct line *deck)
{ {
struct line *ll, *c; struct line *ll, *c;
char *s; char *s;
#ifdef NUMPARAMS
int ok; int ok;
#endif /* NUMPARAMS */
#ifdef GLOBAL_NODE
char *t; char *t;
int i; int i;
#endif /* GLOBAL_NODE */
wordlist *wl; wordlist *wl;
modnames = NULL; modnames = NULL;
@ -168,7 +154,6 @@ inp_subcktexpand(struct line *deck)
(void) strcpy(model, ".model"); (void) strcpy(model, ".model");
(void) cp_getvar("nobjthack", VT_BOOL, (char *) &nobjthack); (void) cp_getvar("nobjthack", VT_BOOL, (char *) &nobjthack);
#ifdef NUMPARAMS
(void) cp_getvar("numparams", VT_BOOL, (char *) &use_numparams); (void) cp_getvar("numparams", VT_BOOL, (char *) &use_numparams);
use_numparams = TRUE; use_numparams = TRUE;
@ -176,14 +161,14 @@ inp_subcktexpand(struct line *deck)
/* deck has .control sections already removed, but not comments */ /* deck has .control sections already removed, but not comments */
if ( use_numparams ) { if ( use_numparams ) {
#ifdef TRACE_NUMPARAMS
#ifdef TRACE
fprintf(stderr,"Numparams is processing this deck:\n"); fprintf(stderr,"Numparams is processing this deck:\n");
c=deck; c=deck;
while( c!=NULL) { while( c!=NULL) {
fprintf(stderr,"%3d:%s\n",c->li_linenum, c->li_line); fprintf(stderr,"%3d:%s\n",c->li_linenum, c->li_line);
c= c->li_next; c= c->li_next;
} }
#endif /* TRACE_NUMPARAMS */
#endif /* TRACE */
ok = nupa_signal( NUPADECKCOPY, NULL); ok = nupa_signal( NUPADECKCOPY, NULL);
/* get the subckt/model names from the deck */ /* get the subckt/model names from the deck */
@ -202,17 +187,16 @@ inp_subcktexpand(struct line *deck)
} }
/* now copy instances */ /* now copy instances */
#ifdef TRACE_NUMPARAMS
#ifdef TRACE
fprintf(stderr,"Numparams transformed deck:\n"); fprintf(stderr,"Numparams transformed deck:\n");
c=deck; c=deck;
while( c!=NULL) { while( c!=NULL) {
fprintf(stderr,"%3d:%s\n",c->li_linenum, c->li_line); fprintf(stderr,"%3d:%s\n",c->li_linenum, c->li_line);
c= c->li_next; c= c->li_next;
} }
#endif /* TRACE_NUMPARAMS */
#endif /* TRACE */
} }
#endif /* NUMPARAMS */
/* Get all the model names so we can deal with BJTs, etc. /* Get all the model names so we can deal with BJTs, etc.
* Stick all the model names into the doubly-linked wordlist modnames. * Stick all the model names into the doubly-linked wordlist modnames.
@ -239,7 +223,6 @@ inp_subcktexpand(struct line *deck)
#endif /* TRACE */ #endif /* TRACE */
/* Added by H.Tanaka to find global nodes */ /* 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(i=0;i<128;i++) strcpy(node[i],"");/* Clear global node holder */
for (c = deck; c; c = c->li_next) { for (c = deck; c; c = c->li_next) {
if (ciprefix(".global", c->li_line)) { if (ciprefix(".global", c->li_line)) {
@ -263,7 +246,6 @@ inp_subcktexpand(struct line *deck)
c->li_line[0] = '*'; /* comment it out */ c->li_line[0] = '*'; /* comment it out */
}/* if(ciprefix.. */ }/* if(ciprefix.. */
} /* for(c=deck.. */ } /* for(c=deck.. */
#endif /* GLOBAL_NODE */
/* Let's do a few cleanup things... Get rid of ( ) around node /* Let's do a few cleanup things... Get rid of ( ) around node
* lists... * lists...
@ -322,15 +304,12 @@ inp_subcktexpand(struct line *deck)
if (ll!=NULL) for (c = ll; c; c = c->li_next) if (ll!=NULL) for (c = ll; c; c = c->li_next)
if (ciprefix(invoke, c->li_line)) { if (ciprefix(invoke, c->li_line)) {
fprintf(cp_err, "Error: unknown subckt: %s\n", c->li_line); fprintf(cp_err, "Error: unknown subckt: %s\n", c->li_line);
#ifdef NUMPARAMS
if ( use_numparams ) { if ( use_numparams ) {
ok= ok && nupa_signal(NUPAEVALDONE, NULL); ok= ok && nupa_signal(NUPAEVALDONE, NULL);
} }
#endif /* NUMPARAMS */
return NULL; return NULL;
} }
#ifdef NUMPARAMS
if ( use_numparams ) { if ( use_numparams ) {
/* the NUMPARAM final line translation pass */ /* the NUMPARAM final line translation pass */
ok= ok && nupa_signal(NUPASUBDONE, NULL); ok= ok && nupa_signal(NUPASUBDONE, NULL);
@ -346,19 +325,18 @@ inp_subcktexpand(struct line *deck)
} }
c= c->li_next; c= c->li_next;
} }
#ifdef TRACE_NUMPARAMS
#ifdef TRACE
fprintf(stderr,"Numparams converted deck:\n"); fprintf(stderr,"Numparams converted deck:\n");
c=ll; c=ll;
while( c!=NULL) { while( c!=NULL) {
fprintf(stderr,"%3d:%s\n",c->li_linenum, c->li_line); fprintf(stderr,"%3d:%s\n",c->li_linenum, c->li_line);
c= c->li_next; c= c->li_next;
} }
#endif /* TRACE_NUMPARAMS */
#endif /* TRACE */
//ok= ok && nupa_signal(NUPAEVALDONE, NULL); //ok= ok && nupa_signal(NUPAEVALDONE, NULL);
//nupa_list_params(stdout); //nupa_list_params(stdout);
nupa_copy_inst_dico(); nupa_copy_inst_dico();
} }
#endif /* NUMPARAMS */
return (ll); /* return the spliced deck. */ return (ll); /* return the spliced deck. */
} }
@ -378,9 +356,7 @@ static struct line *
doit(struct line *deck) doit(struct line *deck)
{ {
struct line *c, *last, *lc, *lcc; struct line *c, *last, *lc, *lcc;
#ifdef NUMPARAMS
struct line *savenext; struct line *savenext;
#endif /* NUMPARAMS */
struct subs *sss = (struct subs *) NULL, *ks; /* *sss and *ks temporarily hold decks to substitute */ struct subs *sss = (struct subs *) NULL, *ks; /* *sss and *ks temporarily hold decks to substitute */
char *s, *t, *scname, *subname; char *s, *t, *scname, *subname;
int nest, numpasses = MAXNEST, i; int nest, numpasses = MAXNEST, i;
@ -446,9 +422,7 @@ doit(struct line *deck)
sss = alloc(struct subs); sss = alloc(struct subs);
if (!lcc) /* if lcc is null, then no .ends was found. */ if (!lcc) /* if lcc is null, then no .ends was found. */
lcc = last; lcc = last;
#ifdef NUMPARAMS
if ( use_numparams==FALSE ) if ( use_numparams==FALSE )
#endif /* NUMPARAMS */
lcc->li_next = NULL; /* shouldn't we free some memory here????? */ lcc->li_next = NULL; /* shouldn't we free some memory here????? */
/* At this point, last points to the .subckt card, and lcc points to the .ends card */ /* At this point, last points to the .subckt card, and lcc points to the .ends card */
@ -480,10 +454,8 @@ doit(struct line *deck)
last = c->li_next; last = c->li_next;
lcc = subs->su_def; lcc = subs->su_def;
#ifdef NUMPARAMS
/*gp */ c->li_next = NULL; /* Numparam needs line c */ /*gp */ c->li_next = NULL; /* Numparam needs line c */
c->li_line[0] = '*'; /* comment it out */ c->li_line[0] = '*'; /* comment it out */
#endif /* NUMPARAMS */
} }
else { /* line is neither .ends nor .subckt. */ else { /* line is neither .ends nor .subckt. */
/* make lc point to this card, and advance last to next card. */ /* make lc point to this card, and advance last to next card. */
@ -592,7 +564,6 @@ doit(struct line *deck)
tfree(subname); tfree(subname);
/* Now splice the decks together. */ /* Now splice the decks together. */
#ifdef NUMPARAMS
savenext = c->li_next; savenext = c->li_next;
if ( use_numparams==FALSE ) { if ( use_numparams==FALSE ) {
/* old style: c will drop a dangling pointer: memory leak */ /* old style: c will drop a dangling pointer: memory leak */
@ -605,18 +576,10 @@ doit(struct line *deck)
c->li_next = lcc; c->li_next = lcc;
c->li_line[0] = '*'; /* comment it out */ c->li_line[0] = '*'; /* comment it out */
} }
#else
if (lc)
lc->li_next = lcc;
else
deck = lcc;
#endif /* NUMPARAMS */
while (lcc->li_next != NULL) while (lcc->li_next != NULL)
lcc = lcc->li_next; lcc = lcc->li_next;
lcc->li_next = c->li_next; lcc->li_next = c->li_next;
#ifdef NUMPARAMS
lcc->li_next = savenext; lcc->li_next = savenext;
#endif /* NUMPARAMS */
c = lcc->li_next; c = lcc->li_next;
lc = lcc; lc = lcc;
tfree(tofree); tfree(tofree);
@ -1331,10 +1294,8 @@ gettrans(char *name)
#endif #endif
/* Added by H.Tanaka to translate global nodes */ /* Added by H.Tanaka to translate global nodes */
#ifdef GLOBAL_NODE
for(i=0;i<numgnode;i++) for(i=0;i<numgnode;i++)
if(eq(node[i],name)) return (name); if(eq(node[i],name)) return (name);
#endif /* GLOBAL_NODE */
if (eq(name, "0")) if (eq(name, "0"))
return (name); return (name);

Loading…
Cancel
Save