From 344beaad24e78a467196592e8981e8568c9f83ff Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Sun, 9 Jun 2024 17:24:26 +0200 Subject: [PATCH] Add ft_spiniterror, to be set during spinit processing,as ft_stricterror will be set only later, when .spiceinit is executed. --- src/frontend/com_dl.c | 23 ++++++++++++++++------- src/frontend/options.c | 7 ++++++- src/include/ngspice/fteext.h | 1 + 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/frontend/com_dl.c b/src/frontend/com_dl.c index 2cdca00a7..c2d3f4e49 100644 --- a/src/frontend/com_dl.c +++ b/src/frontend/com_dl.c @@ -8,13 +8,21 @@ #ifdef XSPICE void com_codemodel(wordlist *wl) { - wordlist *ww; - for (ww = wl; ww; ww = ww->wl_next) - if (load_opus(wl->wl_word)) { - fprintf(cp_err, "Error: Library %s couldn't be loaded!\n", ww->wl_word); - if (ft_stricterror) - controlled_exit(EXIT_BAD); - } +if (wl && wl->wl_word) +#ifdef CM_TRACE + fprintf(stdout, "Note: loading codemodel %s\n", ww->wl_word); +#endif + if (load_opus(wl->wl_word)) { + fprintf(stderr, "Error: Library %s couldn't be loaded!\n", wl->wl_word); + ft_spiniterror = TRUE; + if (ft_stricterror) /* if set in spinit */ + controlled_exit(EXIT_BAD); + } +#ifdef CM_TRACE + else { + fprintf(stdout, "Codemodel %s is loaded\n", wl->wl_word); + } +#endif } #endif @@ -25,6 +33,7 @@ void com_osdi(wordlist *wl) for (ww = wl; ww; ww = ww->wl_next) if (load_osdi(ww->wl_word)) { fprintf(cp_err, "Error: Library %s couldn't be loaded!\n", ww->wl_word); + ft_spiniterror = TRUE; if (ft_stricterror) controlled_exit(EXIT_BAD); } diff --git a/src/frontend/options.c b/src/frontend/options.c index ac12dc0b3..777f1c5a6 100644 --- a/src/frontend/options.c +++ b/src/frontend/options.c @@ -24,7 +24,7 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group bool ft_acctprint = FALSE, ft_noacctprint = FALSE, ft_listprint = FALSE; bool ft_nodesprint = FALSE, ft_optsprint = FALSE, ft_noinitprint = FALSE; bool ft_norefprint = FALSE, ft_skywaterpdk = FALSE; -bool ft_ngdebug = FALSE, ft_nginfo = FALSE, ft_stricterror = FALSE; +bool ft_ngdebug = FALSE, ft_nginfo = FALSE, ft_stricterror = FALSE, ft_spiniterror = FALSE; static void setdb(char *str); static struct variable *cp_enqvec_as_var(const char *vec_name, @@ -327,6 +327,11 @@ cp_usrset(struct variable *var, bool isset) ft_strictnumparse = isset; } else if (eq(var->va_name, "strict_errorhandling")) { ft_stricterror = isset; + if (ft_ngdebug) + fprintf(stdout, "Note: strict_errorhandling is set\n"); + /* Immediately bail out when spinit error has occured */ + if (ft_spiniterror) + controlled_exit(EXIT_BAD); } else if (eq(var->va_name, "rawfileprec")) { if ((var->va_type == CP_BOOL) && (isset == FALSE)) raw_prec = -1; diff --git a/src/include/ngspice/fteext.h b/src/include/ngspice/fteext.h index b00657efd..202f693c0 100644 --- a/src/include/ngspice/fteext.h +++ b/src/include/ngspice/fteext.h @@ -268,6 +268,7 @@ extern struct card *inp_getoptsc(char *line, struct card *options); extern bool ft_ngdebug; extern bool ft_nginfo; extern bool ft_stricterror; +extern bool ft_spiniterror; extern bool ft_skywaterpdk; /* parse.c */