From 932ef50cc3629ac4e279e33dcec0bff27ee44fab Mon Sep 17 00:00:00 2001 From: Giles Atkinson <“gatk555@gmail.com”> Date: Sat, 30 Nov 2024 12:37:36 +0000 Subject: [PATCH] Improve two error messages: in d_cosim, report the filename given, not the last one tried; and report attempted use of iplot or tclplot in batch mode only once. --- src/frontend/breakp.c | 4 ++++ src/frontend/com_plot.c | 22 ++++++++++++++++++---- src/frontend/com_plot.h | 1 + src/xspice/icm/digital/d_cosim/cfunc.mod | 2 +- 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/frontend/breakp.c b/src/frontend/breakp.c index c35549384..83eab7771 100644 --- a/src/frontend/breakp.c +++ b/src/frontend/breakp.c @@ -15,6 +15,7 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group #include "breakp.h" #include "breakp2.h" #include "runcoms2.h" +#include "com_plot.h" #include "completion.h" @@ -213,6 +214,9 @@ com_trce(wordlist *wl) void com_iplot(wordlist *wl) { + if (check_batch("iplot")) + return; + /* Check for an active circuit */ if (ft_curckt == (struct circ *) NULL) { fprintf(cp_err, "No circuit loaded. " diff --git a/src/frontend/com_plot.c b/src/frontend/com_plot.c index b151849bb..80046d966 100644 --- a/src/frontend/com_plot.c +++ b/src/frontend/com_plot.c @@ -9,15 +9,27 @@ extern bool ft_batchmode; +/* Utility function to check for batch mode. */ + +int check_batch(const char *cmd) +{ + if (ft_batchmode) { + fprintf(stderr, + "\nWarning: command '%s' is not available during " + "batch simulation, ignored!\n", + cmd); + fprintf(stderr, " You may use Gnuplot instead.\n\n"); + return 1; + } + return 0; +} + /* plot name ... [xl[imit]] xlo xhi] [yl[imit ylo yhi] [vs xname] */ void com_plot(wordlist *wl) { - if (ft_batchmode) { - fprintf(stderr, "\nWarning: command 'plot' is not available during batch simulation, ignored!\n"); - fprintf(stderr, " You may use Gnuplot instead.\n\n"); + if (check_batch("plot")) return; - } plotit(wl, NULL, NULL); } @@ -25,6 +37,8 @@ com_plot(wordlist *wl) void com_bltplot(wordlist *wl) { + if (check_batch("bltplot")) + return; plotit(wl, NULL, "blt"); } diff --git a/src/frontend/com_plot.h b/src/frontend/com_plot.h index e8ef7c22a..a7fecb0c9 100644 --- a/src/frontend/com_plot.h +++ b/src/frontend/com_plot.h @@ -5,4 +5,5 @@ void com_plot(wordlist *wl); #ifdef TCL_MODULE void com_bltplot(wordlist *wl); #endif +extern int check_batch(const char *cmd); // Also used by iplot etc. #endif diff --git a/src/xspice/icm/digital/d_cosim/cfunc.mod b/src/xspice/icm/digital/d_cosim/cfunc.mod index a3755731d..f2ce19def 100644 --- a/src/xspice/icm/digital/d_cosim/cfunc.mod +++ b/src/xspice/icm/digital/d_cosim/cfunc.mod @@ -166,7 +166,7 @@ static void *cosim_dlopen(const char *fn) break; } - fprintf(stderr, "Cannot open " SLIBFILE " %s: %s\n", path, dlerror()); + fprintf(stderr, "Cannot open " SLIBFILE " %s: %s\n", fn, dlerror()); return NULL; }