global nodes and numparams now as default

This commit is contained in:
dwarning 2008-05-12 15:52:59 +00:00
parent a299cdf8b0
commit bce499a9e1
6 changed files with 14 additions and 79 deletions

View File

@ -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
* 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,

View File

@ -154,10 +154,6 @@ dnl --enable-cluster: define CLUSTER in the code. This is for cluster support
AC_ARG_ENABLE(cluster,
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 Xgraph is a plotting package for X11 once very popular.
AC_ARG_ENABLE(xgraph,
@ -714,29 +710,6 @@ if test "$enable_expdevices" = "yes"; then
AC_MSG_RESULT(WARNING: Experimental devices enabled)
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 ---- Default: disabled. ----
dnl ---- Hope to see in the future readline replacement. ----

View File

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

View File

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

View File

@ -48,9 +48,7 @@ $Id$
/* gtri - end - 12/12/90 */
#endif
#ifdef NUMPARAMS
#include "numparam/numpaif.h"
#endif
#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;
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.
If either are found then we evaluate these lines immediately
so they take effect before netlist parsing */
@ -457,7 +454,6 @@ inp_spsource(FILE *fp, bool comfile, char *filename)
cp_evloop(wl->wl_word);
}
}
#endif /* NUMPARAMS */
ld->li_next = dd->li_next;
line_free(dd,FALSE); /* SJB - free this line's memory */
} else if (!*dd->li_line) {

View File

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