Browse Source

make database dbs local to each circuit

pre-master-46
h_vogt 13 years ago
committed by rlar
parent
commit
7bc879726d
  1. 9
      src/frontend/breakp.c
  2. 2
      src/frontend/breakp2.c
  3. 6
      src/frontend/inp.c
  4. 2
      src/frontend/plotting/graf.c
  5. 5
      src/frontend/runcoms.c
  6. 3
      src/frontend/runcoms2.c
  7. 1
      src/include/ngspice/ftedefs.h

9
src/frontend/breakp.c

@ -142,7 +142,7 @@ com_stop(wordlist *wl)
; ;
d->db_next = thisone; d->db_next = thisone;
} else { } else {
dbs = thisone;
ft_curckt->ci_dbs = dbs = thisone;
} }
(void) sprintf(buf, "%d", debugnumber); (void) sprintf(buf, "%d", debugnumber);
cp_addkword(CT_DBNUMS, buf); cp_addkword(CT_DBNUMS, buf);
@ -200,7 +200,7 @@ com_iplot(wordlist *wl)
; ;
td->db_next = currentdb; td->db_next = currentdb;
} else { } else {
dbs = currentdb;
ft_curckt->ci_dbs = dbs = currentdb;
} }
} }
@ -224,6 +224,7 @@ com_step(wordlist *wl)
* off the event numbers (with UNIX, that is). -- I don't like this. * off the event numbers (with UNIX, that is). -- I don't like this.
*/ */
#undef isatty
#define isatty(xxxx) 1 #define isatty(xxxx) 1
@ -319,7 +320,7 @@ com_delete(wordlist *wl)
d = dt->db_next; d = dt->db_next;
dbfree(dt); dbfree(dt);
} }
dbs = NULL;
ft_curckt->ci_dbs = dbs = NULL;
return; return;
} else if (!wl) { } else if (!wl) {
if (!dbs) { if (!dbs) {
@ -352,7 +353,7 @@ com_delete(wordlist *wl)
if (dt) if (dt)
dt->db_next = d->db_next; dt->db_next = d->db_next;
else else
dbs = d->db_next;
ft_curckt->ci_dbs = dbs = d->db_next;
dbfree(d); dbfree(d);
(void) sprintf(buf, "%d", i); (void) sprintf(buf, "%d", i);
cp_remkword(CT_DBNUMS, buf); cp_remkword(CT_DBNUMS, buf);

2
src/frontend/breakp2.c

@ -93,7 +93,7 @@ settrace(wordlist *wl, int what, char *name)
; ;
td->db_next = d; td->db_next = d;
} else { } else {
dbs = d;
ft_curckt->ci_dbs = dbs = d;
} }
wl = wl->wl_next; wl = wl->wl_next;

6
src/frontend/inp.c

@ -363,8 +363,11 @@ inp_spsource(FILE *fp, bool comfile, char *filename)
/* free the control deck */ /* free the control deck */
line_free(deck, TRUE); line_free(deck, TRUE);
/* do this here and in the 'else' branch of 'if (comfile)' */ /* do this here and in the 'else' branch of 'if (comfile)' */
/*
if (dbs) if (dbs)
dbfree(dbs); dbfree(dbs);
*/
/* set to NULL to allow generation of a new dbs */
dbs = NULL; dbs = NULL;
ft_dotsaves(); ft_dotsaves();
} /* end if (comfile) */ } /* end if (comfile) */
@ -660,8 +663,11 @@ inp_spsource(FILE *fp, bool comfile, char *filename)
/* linked list dbs is used to store the "save" or .save data (defined in breakp2.c), /* linked list dbs is used to store the "save" or .save data (defined in breakp2.c),
(When controls are executed later on, also stores TRACE, IPLOT, and STOP data) */ (When controls are executed later on, also stores TRACE, IPLOT, and STOP data) */
/*
if (dbs) if (dbs)
dbfree(dbs); dbfree(dbs);
*/
/* set to NULL to allow generation of a new dbs */
dbs = NULL; dbs = NULL;
/* .save data stored in dbs. /* .save data stored in dbs.
Do this here before controls are run: .save is thus recognized even if Do this here before controls are run: .save is thus recognized even if

2
src/frontend/plotting/graf.c

@ -988,7 +988,7 @@ gr_end_iplot(void)
if (prev) if (prev)
prev->db_next = next; prev->db_next = next;
else else
dbs = next;
ft_curckt->ci_dbs = dbs = next;
dbfree(db); dbfree(db);
} }
} else if (db->db_type == DB_IPLOT || db->db_type == DB_IPLOTALL) { } else if (db->db_type == DB_IPLOT || db->db_type == DB_IPLOTALL) {

5
src/frontend/runcoms.c

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

3
src/frontend/runcoms2.c

@ -204,6 +204,9 @@ com_remcirc(wordlist *wl)
fprintf(cp_err, "Error: there is no circuit loaded.\n"); fprintf(cp_err, "Error: there is no circuit loaded.\n");
return; return;
} }
dbfree(ft_curckt->ci_dbs);
/* The next lines stem from com_rset */ /* The next lines stem from com_rset */
INPkillMods(); INPkillMods();

1
src/include/ngspice/ftedefs.h

@ -32,6 +32,7 @@ struct circ {
CKTcircuit *ci_ckt; /* The CKTcircuit structure. */ CKTcircuit *ci_ckt; /* The CKTcircuit structure. */
INPtables *ci_symtab; /* The INP symbol table. */ INPtables *ci_symtab; /* The INP symbol table. */
INPmodel *ci_modtab; /* The INP model table. */ INPmodel *ci_modtab; /* The INP model table. */
struct dbcomm *ci_dbs; /* The database storing save, iplot, stop data */
struct line *ci_deck; /* The input deck. */ struct line *ci_deck; /* The input deck. */
struct line *ci_origdeck;/* The input deck, before subckt expansion. */ struct line *ci_origdeck;/* The input deck, before subckt expansion. */
struct line *ci_options;/* The .option cards from the deck... */ struct line *ci_options;/* The .option cards from the deck... */

Loading…
Cancel
Save