From 52584312c378add64bcda71c8c86ef48f4edc01d Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Sun, 24 Feb 2019 01:00:06 +0100 Subject: [PATCH] delete the plt and data files after writing eps or png (only if gnuplot_terminal is set to eps/quit of png/quit) --- src/frontend/plotting/gnuplot.c | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/frontend/plotting/gnuplot.c b/src/frontend/plotting/gnuplot.c index f6286dbc1..a3bd3ee74 100644 --- a/src/frontend/plotting/gnuplot.c +++ b/src/frontend/plotting/gnuplot.c @@ -16,7 +16,12 @@ #include "ngspice/dvec.h" #include "ngspice/fteparse.h" #include "gnuplot.h" - +#if defined(__MINGW32__) || defined(_MSC_VER) +#undef BOOLEAN +#include +#else +#include +#endif #define GP_MAXVECTORS 64 @@ -338,6 +343,23 @@ ft_gnuplot(double *xlims, double *ylims, char *filename, char *title, char *xlab #endif err = system(buf); + /* delete the plt and data files */ + if ((terminal_type == 3) || (terminal_type == 5)) { + /* wait for gnuplot generating eps or png file */ +#if defined(__MINGW32__) || defined(_MSC_VER) + Sleep(200); +#else + usleep(200000); +#endif + if (remove(filename_data)) { + fprintf(stderr, "Could not remove file %s\n", filename_data); + perror(NULL); + } + if (remove(filename_plt)) { + fprintf(stderr, "Could not remove file %s\n", filename_plt); + perror(NULL); + } + } }