Browse Source

unique modtab for each circuit, store in ckt structure

pre-master-46
h_vogt 13 years ago
committed by rlar
parent
commit
c15608c903
  1. 2
      src/frontend/inp.c
  2. 3
      src/frontend/runcoms.c
  3. 3
      src/frontend/runcoms2.c
  4. 11
      src/frontend/spiceif.c
  5. 1
      src/include/ngspice/ftedefs.h
  6. 2
      src/spicelib/parser/inpkmods.c

2
src/frontend/inp.c

@ -680,8 +680,6 @@ inp_spsource(FILE *fp, bool comfile, char *filename)
wl_free(controls);
}
INPkillMods(); /* remove the modtab after the job is done */
/* Now reset everything. Pop the control stack, and fix up the IO
* as it was before the source. */
cp_popcontrol();

3
src/frontend/runcoms.c

@ -30,6 +30,7 @@ Modified: 2000 AlansFixes
static int dosim(char *what, wordlist *wl);
extern INPmodel *modtab;
/* Routines for the commands op, tran, ac, dc, listing, device, state,
* resume, stop, trace, run, end. Op, tran, ac, and dc cause the action
@ -103,6 +104,8 @@ com_scirc(wordlist *wl)
ft_curckt->ci_nodes = cp_kwswitch(CT_NODENAMES, p->ci_nodes);
}
ft_curckt = p;
/* get the model table for the current circuit, store it in the global variable modtab */
modtab = ft_curckt->ci_modtab;
}

3
src/frontend/runcoms2.c

@ -27,6 +27,7 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group
#define RAWBUF_SIZE 32768
extern char rawfileBuf[RAWBUF_SIZE];
extern void line_free_x(struct line * deck, bool recurse);
extern INPmodel *modtab;
#define line_free(line, flag) \
do { \
@ -246,4 +247,6 @@ com_remcirc(wordlist *wl)
/* make first entry in ft_circuits the actual circuit (or NULL) */
ft_curckt = ft_circuits;
if (ft_curckt)
modtab = ft_curckt->ci_modtab;
}

11
src/frontend/spiceif.c

@ -72,6 +72,7 @@ CDHW*/
#include "ngspice/mif.h"
#endif
extern INPmodel *modtab;
static struct variable *parmtovar(IFvalue *pv, IFparm *opt);
static IFparm *parmlookup(IFdevice *dev, GENinstance **inptr, char *param,
@ -159,13 +160,13 @@ if_inpdeck(struct line *deck, INPtables **tab)
ft_curckt->ci_curTask = ft_curckt->ci_defTask;
/* reset the model table, will be filled in anew in INPpas1() */
modtab = NULL;
INPpas1(ckt, (card *) deck->li_next, *tab);
/* store the new model table in the current circuit */
ft_curckt->ci_modtab = modtab;
INPpas2(ckt, (card *) deck->li_next, *tab, ft_curckt->ci_defTask);
/* INPkillMods(); modtab removed later on the end of inp_spsource
because needed for alter geometry of binned MOS models,
see below if_setparam_model */
/* INPpas2 has been modified to ignore .NODESET and .IC
* cards. These are left till INPpas3 so that we can check for
* nodeset/ic of non-existant nodes. */
@ -876,7 +877,7 @@ if_setparam_model(CKTcircuit *ckt, char **name, char *val)
INPgetModBin(ckt, modname, &inpmod, ft_curckt->ci_symtab, val);
tfree(modname);
if (inpmod == NULL) {
fprintf(cp_err, "Error: no such model %s.\n", val);
fprintf(cp_err, "Error: no model available for %s.\n", val);
return;
}
newMod = inpmod->INPmodfast;

1
src/include/ngspice/ftedefs.h

@ -31,6 +31,7 @@ struct circ {
char *ci_name; /* What the circuit can be called. */
CKTcircuit *ci_ckt; /* The CKTcircuit structure. */
INPtables *ci_symtab; /* The INP symbol table. */
INPmodel *ci_modtab; /* The INP model table. */
struct line *ci_deck; /* The input deck. */
struct line *ci_origdeck;/* The input deck, before subckt expansion. */
struct line *ci_options;/* The .option cards from the deck... */

2
src/spicelib/parser/inpkmods.c

@ -8,6 +8,7 @@ Author: 1985 Thomas L. Quarles
#include "ngspice/ngspice.h"
#include <stdio.h>
#include "ngspice/inpdefs.h"
#include "ngspice/ftedefs.h"
#include "inpxx.h"
@ -26,4 +27,5 @@ void INPkillMods(void)
if (prev)
FREE(prev);
modtab = NULL;
ft_curckt->ci_modtab = NULL;
}
Loading…
Cancel
Save