make database dbs local to each circuit

This commit is contained in:
h_vogt 2013-03-05 20:03:25 +01:00
parent cda882f31b
commit 4514742da7
7 changed files with 21 additions and 11 deletions

View File

@ -142,7 +142,7 @@ com_stop(wordlist *wl)
;
d->db_next = thisone;
} else {
dbs = thisone;
ft_curckt->ci_dbs = dbs = thisone;
}
(void) sprintf(buf, "%d", debugnumber);
cp_addkword(CT_DBNUMS, buf);
@ -200,7 +200,7 @@ com_iplot(wordlist *wl)
;
td->db_next = currentdb;
} 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.
*/
#undef isatty
#define isatty(xxxx) 1
@ -319,7 +320,7 @@ com_delete(wordlist *wl)
d = dt->db_next;
dbfree(dt);
}
dbs = NULL;
ft_curckt->ci_dbs = dbs = NULL;
return;
} else if (!wl) {
if (!dbs) {
@ -352,7 +353,7 @@ com_delete(wordlist *wl)
if (dt)
dt->db_next = d->db_next;
else
dbs = d->db_next;
ft_curckt->ci_dbs = dbs = d->db_next;
dbfree(d);
(void) sprintf(buf, "%d", i);
cp_remkword(CT_DBNUMS, buf);

View File

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

View File

@ -363,8 +363,9 @@ inp_spsource(FILE *fp, bool comfile, char *filename)
/* free the control deck */
line_free(deck, TRUE);
/* do this here and in the 'else' branch of 'if (comfile)' */
if (dbs)
dbfree(dbs);
/* if (dbs)
dbfree(dbs); */
/* set to NULL to allow generation of a new dbs */
dbs = NULL;
ft_dotsaves();
} /* end if (comfile) */
@ -660,8 +661,9 @@ inp_spsource(FILE *fp, bool comfile, char *filename)
/* 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) */
if (dbs)
dbfree(dbs);
/* if (dbs)
dbfree(dbs); */
/* set to NULL to allow generation of a new dbs */
dbs = NULL;
/* .save data stored in dbs.
Do this here before controls are run: .save is thus recognized even if

View File

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

View File

@ -30,7 +30,8 @@ Modified: 2000 AlansFixes
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,
* resume, stop, trace, run, end. Op, tran, ac, and dc cause the action
@ -106,6 +107,8 @@ com_scirc(wordlist *wl)
ft_curckt = p;
/* get the model table for the current circuit, store it in the global variable modtab */
modtab = ft_curckt->ci_modtab;
/* get the database for save, iplot, stop */
dbs = ft_curckt->ci_dbs;
}

View File

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

View File

@ -32,6 +32,7 @@ struct circ {
CKTcircuit *ci_ckt; /* The CKTcircuit structure. */
INPtables *ci_symtab; /* The INP symbol 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_origdeck;/* The input deck, before subckt expansion. */
struct line *ci_options;/* The .option cards from the deck... */