diff --git a/ChangeLog b/ChangeLog index 89b45bc67..47157b244 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2011-12-17 Holger Vogt + * src/frontend/inp.c, + src/frontend/options.c + src/include/ngspice/fteext.h : + variable ft_stricterror to exit ngspice with exit code 1 + if any error occurs during circuit parsing. + Usage maybe extended to other errors. + Tradditionally ngspice uses to continue, issue error messages, + deliver wrong results and exit with exit code 0. + 2011-12-16 Holger Vogt * src/frontend/subckt.c: beautify code diff --git a/src/frontend/inp.c b/src/frontend/inp.c index 7c72b702c..3c11c48d5 100644 --- a/src/frontend/inp.c +++ b/src/frontend/inp.c @@ -829,13 +829,16 @@ inp_dodeck( if (q) *q = 0; - if (p == dd->li_error) + if (p == dd->li_error) { if (strstr(dd->li_line, ".model")) out_printf("Model issue on line %d : %.*s ...\n%s\n", dd->li_linenum_orig, 56, dd->li_line, dd->li_error); else out_printf("Error on line %d : %s\n%s\n", dd->li_linenum_orig, dd->li_line, dd->li_error); + if (ft_stricterror) + controlled_exit(EXIT_BAD); + } else out_printf("%s\n", p); diff --git a/src/frontend/options.c b/src/frontend/options.c index 9d7fa9ee9..ee908dd58 100644 --- a/src/frontend/options.c +++ b/src/frontend/options.c @@ -28,7 +28,7 @@ static void setdb(char *str); bool ft_acctprint = FALSE, ft_noacctprint = FALSE, ft_listprint = FALSE; bool ft_nodesprint = FALSE, ft_optsprint = FALSE, ft_noinitprint = FALSE; -bool ft_ngdebug = FALSE; +bool ft_ngdebug = FALSE, ft_stricterror = FALSE; /* The user-supplied routine to query the values of variables. This * recognises the $&varname notation, and also searches the values of @@ -291,6 +291,8 @@ cp_usrset(struct variable *var, bool isset) ft_optsprint = isset; } else if (eq(var->va_name, "strictnumparse")) { ft_strictnumparse = isset; + } else if (eq(var->va_name, "strict_errorhandling")) { + ft_stricterror = isset; } 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 b66939b73..1d84dce2d 100644 --- a/src/include/ngspice/fteext.h +++ b/src/include/ngspice/fteext.h @@ -240,6 +240,7 @@ extern char *ft_setkwords[]; extern struct line *inp_getopts(struct line *deck); extern struct line *inp_getoptsc(char *in_line, struct line *com_options); extern bool ft_ngdebug; +extern bool ft_stricterror; /* parse.c */