From 0fb210a821abbf615532a365814f32a8fd36a164 Mon Sep 17 00:00:00 2001 From: h_vogt Date: Sun, 29 May 2016 01:15:05 +0200 Subject: [PATCH] commands.c, inp.c, new command 'mc_source' to internally reload circuit for Monte Carlo simulation --- src/frontend/commands.c | 4 ++++ src/frontend/inp.c | 10 +++++++++- src/frontend/inp.h | 1 + 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/frontend/commands.c b/src/frontend/commands.c index 16b1b0ec6..03f24fc41 100644 --- a/src/frontend/commands.c +++ b/src/frontend/commands.c @@ -325,6 +325,10 @@ struct comm spcp_coms[] = { { 1, 0, 0, 0 }, E_DEFHMASK, 0, 1, NULL, "[filename] : Edit a spice deck and then load it in." } , + { "mc_source", com_mc_source, TRUE, FALSE, + { 0, 0, 0, 0 }, E_DEFHMASK, 0, 0, + NULL, + ": Re-source the actual circuit deck for MC simulation." }, { "dump", com_dump, TRUE, FALSE, { 0, 0, 0, 0 }, E_DEFHMASK, 0, 0, NULL, diff --git a/src/frontend/inp.c b/src/frontend/inp.c index f923e6516..39e19ec07 100644 --- a/src/frontend/inp.c +++ b/src/frontend/inp.c @@ -382,7 +382,7 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile) if (!deck->li_next) fprintf(cp_err, "Warning: no lines in input\n"); } - if (!intfile) + if (fp && !intfile) fclose(fp); /* Now save the IO context and start a new control set. After we @@ -1070,6 +1070,14 @@ inp_dodeck( } +void +com_mc_source(wordlist *wl) +{ + NG_IGNORE(wl); + inp_spsource(NULL, FALSE, NULL, FALSE); +} + + /* Edit and re-load the current input deck. Note that if these * commands are used on a non-unix machine, they will leave spice.tmp * junk files lying around. */ diff --git a/src/frontend/inp.h b/src/frontend/inp.h index f6c94af53..2c929a05c 100644 --- a/src/frontend/inp.h +++ b/src/frontend/inp.h @@ -9,6 +9,7 @@ void com_listing(wordlist *wl); void com_edit(wordlist *wl); void com_source(wordlist *wl); +void com_mc_source(wordlist *wl); void com_circbyline(wordlist *wl);