inp.c: do not run all 'save' commands upfront,
but cumulative when they appear in the .control section
This commit is contained in:
parent
79a9fdbcd7
commit
b503ea2d12
|
|
@ -49,7 +49,6 @@ Author: 1985 Wayne A. Christopher
|
|||
static char *upper(register char *string);
|
||||
static bool doedit(char *filename);
|
||||
static struct line *com_options = NULL;
|
||||
static wordlist *consaves(wordlist *wl);
|
||||
static void cktislinear(CKTcircuit *ckt, struct line *deck);
|
||||
|
||||
void line_free_x(struct line *deck, bool recurse);
|
||||
|
|
@ -362,12 +361,8 @@ 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);
|
||||
*/
|
||||
/* set to NULL to allow generation of a new dbs */
|
||||
/* do this here and in the 'else' branch of 'if (comfile)' */
|
||||
dbs = NULL;
|
||||
ft_dotsaves();
|
||||
} /* end if (comfile) */
|
||||
|
|
@ -663,10 +658,6 @@ 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);
|
||||
*/
|
||||
/* set to NULL to allow generation of a new dbs */
|
||||
dbs = NULL;
|
||||
/* .save data stored in dbs.
|
||||
|
|
@ -674,11 +665,6 @@ inp_spsource(FILE *fp, bool comfile, char *filename)
|
|||
.control is used */
|
||||
ft_dotsaves();
|
||||
|
||||
/* run all 'save' commands upfront, allow same syntax as in .save,
|
||||
then remove them from controls, store data in dbs. If controls contains
|
||||
only 'save' commands, NULL is returned. */
|
||||
controls = consaves(controls);
|
||||
|
||||
/* Now that the deck is loaded, do the commands, if there are any */
|
||||
controls = wl_reverse(controls);
|
||||
for (wl = controls; wl; wl = wl->wl_next)
|
||||
|
|
@ -1140,45 +1126,6 @@ inp_source(char *file)
|
|||
}
|
||||
|
||||
|
||||
/* find 'save' commands, retrive node name(s) and store
|
||||
them in dbs (by com_save), like ft_dotsaves does with .save */
|
||||
static wordlist *
|
||||
consaves(wordlist *wl_control)
|
||||
{
|
||||
wordlist *iline, *wl = NULL;
|
||||
char *s;
|
||||
bool onlysave = TRUE;
|
||||
|
||||
iline = wl_control;
|
||||
while (iline) {
|
||||
if (ciprefix("save", iline->wl_word)) {
|
||||
wordlist *tmplist;
|
||||
s = iline->wl_word;
|
||||
(void) gettok(&s);
|
||||
wl = wl_append(wl, gettoks(s));
|
||||
tmplist = iline->wl_next;
|
||||
wl_delete_slice(iline, iline->wl_next);
|
||||
iline = tmplist;
|
||||
}
|
||||
else {
|
||||
if (onlysave)
|
||||
/* first occurence of a non 'save' line */
|
||||
wl_control = iline;
|
||||
iline = iline->wl_next;
|
||||
onlysave = FALSE; /* we have lines other than save... */
|
||||
}
|
||||
}
|
||||
|
||||
com_save(wl);
|
||||
|
||||
/* If controls is eaten up without other than 'save...' lines, return NULL */
|
||||
if (onlysave)
|
||||
return (NULL);
|
||||
|
||||
return (wl_control);
|
||||
}
|
||||
|
||||
|
||||
/* check the input deck (after inpcom and numparam extensions)
|
||||
for linear elements. If only linear elements are found,
|
||||
ckt->CKTisLinear is set to 1. Return immediately if a first
|
||||
|
|
|
|||
Loading…
Reference in New Issue