clear all variables upon 'quit'

This commit is contained in:
Holger Vogt 2020-05-21 19:49:58 +02:00
parent 05f3d21c3e
commit 8be33bb361
3 changed files with 12 additions and 0 deletions

View File

@ -10,6 +10,7 @@
#include "com_unset.h"
#include "variable.h"
/* clear variables (by name or all) */
void
com_unset(wordlist *wl)
{
@ -29,3 +30,12 @@ com_unset(wordlist *wl)
wl = wl->wl_next;
}
}
/* clear all variables (called from com_quit) */
void unset_all(void){
struct variable *var, *nv;
for (var = variables; var; var = nv) {
nv = var->va_next;
cp_remvar(var->va_name);
}
}

View File

@ -8,5 +8,6 @@
#include "ngspice/wordlist.h"
void com_unset(wordlist *wl);
void unset_all(void);
#endif

View File

@ -108,6 +108,7 @@ com_quit(wordlist *wl)
#ifdef SHARED_MODULE
destroy_const_plot();
spice_destroy_devices();
unset_all();
cp_resetcontrol(FALSE);
/* add 1000 to notify that we exit from 'quit' */
controlled_exit(1000 + exitcode);