Mercurial > octave
diff libinterp/corefcn/variables.cc @ 20704:571508c1ed06
eliminate more uses of error_state
* ov.h, ov.cc (octave_value::xall_strings): New extractor.
* bitfcns.cc, data.cc, ellipj.cc, fftn.cc, file-io.cc, filter.cc,
find.cc, graphics.cc, input.cc, load-path.cc, luinc.cc,
matrix_type.cc, oct-stream.cc, ordschur.cc, psi.cc, rand.cc,
spparms.cc, strfns.cc, symtab.cc, syscalls.cc, sysdep.cc, time.cc,
utils.cc, variables.cc, __glpk__.cc, __magick_read__.cc, amd.cc,
ov-cell.cc, ov-fcn-inline.cc, ov-struct.cc:
Eliminate more uses of error_state.
* system.tst: Update tests.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sat, 14 Nov 2015 15:18:05 -0500 |
parents | 68e3a747ca02 |
children | 7b608fadc663 |
line wrap: on
line diff
--- a/libinterp/corefcn/variables.cc Sat Nov 14 12:07:38 2015 -0500 +++ b/libinterp/corefcn/variables.cc Sat Nov 14 15:18:05 2015 -0500 @@ -779,12 +779,9 @@ if (nargin == 1) { - bool bval = args(0).bool_value (); - - if (! error_state) - var = bval; - else - error ("%s: expecting arg to be a logical value", nm); + bool bval = args(0).xbool_value ("%s: expecting arg to be a logical value", nm); + + var = bval; } else if (nargin > 1) print_usage (); @@ -854,20 +851,15 @@ if (nargin == 1) { - int ival = args(0).int_value (); - - if (! error_state) - { - if (ival < minval) - error ("%s: expecting arg to be greater than %d", nm, minval); - else if (ival > maxval) - error ("%s: expecting arg to be less than or equal to %d", - nm, maxval); - else - var = ival; - } + int ival = args(0).xint_value ("%s: expecting arg to be an integer value", nm); + + if (ival < minval) + error ("%s: expecting arg to be greater than %d", nm, minval); + else if (ival > maxval) + error ("%s: expecting arg to be less than or equal to %d", + nm, maxval); else - error ("%s: expecting arg to be an integer value", nm); + var = ival; } else if (nargin > 1) print_usage (); @@ -895,19 +887,14 @@ if (nargin == 1) { - double dval = args(0).scalar_value (); - - if (! error_state) - { - if (dval < minval) - error ("%s: expecting arg to be greater than %g", minval); - else if (dval > maxval) - error ("%s: expecting arg to be less than or equal to %g", maxval); - else - var = dval; - } + double dval = args(0).xscalar_value ("%s: expecting arg to be a scalar value", nm); + + if (dval < minval) + error ("%s: expecting arg to be greater than %g", minval); + else if (dval > maxval) + error ("%s: expecting arg to be less than or equal to %g", maxval); else - error ("%s: expecting arg to be a scalar value", nm); + var = dval; } else if (nargin > 1) print_usage ();