exit on all circuit parsing errors if var strict_errorhandling is set

This commit is contained in:
h_vogt 2011-12-17 11:33:30 +00:00
parent 54501d90e0
commit bcc23c1f78
4 changed files with 18 additions and 2 deletions

View File

@ -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

View File

@ -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);

View File

@ -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;

View File

@ -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 */