From 55f7d3fcefb47d3f486622991e5cf90742afbc0d Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Mon, 29 Apr 2024 21:50:28 +0200 Subject: [PATCH] Save the wordlist sourceinfo to the current circuit. Remove sourceinfo only upon 'quit'. --- src/frontend/inp.c | 2 ++ src/frontend/misccoms.c | 8 ++++++-- src/include/ngspice/ftedefs.h | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/frontend/inp.c b/src/frontend/inp.c index 4086ef7f4..0df4e6eaa 100644 --- a/src/frontend/inp.c +++ b/src/frontend/inp.c @@ -73,6 +73,7 @@ void eval_opt(struct card *deck); extern bool ft_batchmode; extern int dynmaxline; +extern wordlist* sourceinfo; /* from inpcom.c */ extern struct nscope* inp_add_levels(struct card *deck); @@ -1533,6 +1534,7 @@ inp_dodeck( tfree(ct->ci_filename); #endif ct->ci_filename = copy(filename); + ct->ci_sourceinfo = sourceinfo; /* load the optran data, if provided by .spiceinit or spinit. Return immediately, if optran is not selected.*/ diff --git a/src/frontend/misccoms.c b/src/frontend/misccoms.c index d196c3707..e3501b1d8 100644 --- a/src/frontend/misccoms.c +++ b/src/frontend/misccoms.c @@ -93,8 +93,10 @@ com_quit(wordlist *wl) /* Destroy CKT when quit. */ if (!ft_nutmeg) { - while(ft_curckt) + while (ft_curckt) { + wl_delete(ft_curckt->ci_sourceinfo); com_remcirc(NULL); + } } cp_destroy_keywords(); destroy_ivars(); @@ -102,8 +104,10 @@ com_quit(wordlist *wl) /* remove plotting parameters */ pl_rempar(); - while (ft_curckt) + while (ft_curckt) { + wl_delete(ft_curckt->ci_sourceinfo); com_remcirc(NULL); + } #endif tfree(errMsg); diff --git a/src/include/ngspice/ftedefs.h b/src/include/ngspice/ftedefs.h index 639707250..a8900bb2e 100644 --- a/src/include/ngspice/ftedefs.h +++ b/src/include/ngspice/ftedefs.h @@ -52,6 +52,7 @@ struct circ { struct ccom *ci_nodes; /* ccom structs for the nodes... */ struct ccom *ci_devices; /* and devices in the circuit. */ char *ci_filename; /* Where this circuit came from. */ + wordlist* ci_sourceinfo; /* paths and names of input files */ TSKtask *ci_defTask; /* default task for this circuit */ TSKtask *ci_specTask; /* special task for command line jobs */ TSKtask *ci_curTask; /* most recent task for this circuit */