From 78e30eb3df6ff67e6399afcd382733a320355923 Mon Sep 17 00:00:00 2001 From: h_vogt Date: Wed, 1 Jun 2016 00:10:30 +0200 Subject: [PATCH] inp.c, remove bug with handling of options: options stemming from a command file are kept, options from sourced circuit are removed with ckt --- src/frontend/inp.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/frontend/inp.c b/src/frontend/inp.c index e7e83f57e..20535e24c 100644 --- a/src/frontend/inp.c +++ b/src/frontend/inp.c @@ -319,6 +319,11 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile) double startTime, endTime; +#ifdef HAS_PROGREP + if (!comfile) + SetAnalyse("Source Deck", 0); +#endif + /* read in the deck from a file */ char *dir_name = ngdirname(filename ? filename : "."); @@ -582,25 +587,21 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile) /* handle .if ... .elseif ... .else ... .endif statements. */ dotifeval(deck); - /*merge the two option line structs*/ + /* merge the two option line structs, + keep com_options, options is loaded into circuit and freed + when circuit is removed */ if (!options && com_options) - options = com_options; + options = inp_deckcopy(com_options); else if (options && com_options) { - /* move to end of options - struct line *tmp_options = options; - while (tmp_options) { - if (!tmp_options->li_next) break; - tmp_options = tmp_options->li_next; - } - tmp_options->li_next = com_options;*/ - /* move to end of com_options */ - struct line *tmp_options = com_options; + /* move to end of copy from com_options and add options */ + struct line *tmp_options = inp_deckcopy(com_options); while (tmp_options) { if (!tmp_options->li_next) break; tmp_options = tmp_options->li_next; } tmp_options->li_next = options; + options = tmp_options; } /* prepare parse trees from 'temper' expressions */ @@ -615,6 +616,7 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile) inp_dodeck(deck, tt, wl_first, FALSE, options, filename); /* inp_dodeck did take ownership */ tt = NULL; + options = NULL; } /* if (deck->li_next) */