Mercurial > octave
changeset 20687:5f04bfc7c17a
backout changeset 18f38ed43962
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Sun, 08 Nov 2015 16:14:27 -0500 |
parents | e468e4211df9 |
children | 8b9da91cde32 |
files | libinterp/corefcn/daspk.cc libinterp/corefcn/dasrt.cc libinterp/corefcn/dassl.cc libinterp/corefcn/file-io.cc libinterp/corefcn/filter.cc libinterp/corefcn/graphics.cc libinterp/corefcn/lsode.cc libinterp/corefcn/matrix_type.cc libinterp/corefcn/quad.cc libinterp/corefcn/rand.cc libinterp/dldfcn/__eigs__.cc libinterp/dldfcn/__magick_read__.cc libinterp/octave-value/ov.cc libinterp/octave-value/ov.h |
diffstat | 14 files changed, 483 insertions(+), 496 deletions(-) [+] |
line wrap: on
line diff
--- a/libinterp/corefcn/daspk.cc Sun Nov 08 12:00:06 2015 +0100 +++ b/libinterp/corefcn/daspk.cc Sun Nov 08 16:14:27 2015 -0500 @@ -90,7 +90,7 @@ warned_fcn_imaginary = true; } - retval = tmp(0).vector_value (); + retval = ColumnVector (tmp(0).vector_value ()); if (tlen > 1) ires = tmp(1).int_value (); @@ -393,20 +393,32 @@ } } - if (! daspk_fcn) + if (error_state || ! daspk_fcn) DASPK_ABORT (); - ColumnVector state = args(1).vector_value ("expecting state vector as second argument"); + ColumnVector state = ColumnVector (args(1).vector_value ()); + + if (error_state) + DASPK_ABORT1 ("expecting state vector as second argument"); + + ColumnVector deriv (args(2).vector_value ()); - ColumnVector deriv = args(2).vector_value ("expecting derivative vector as third argument"); + if (error_state) + DASPK_ABORT1 ("expecting derivative vector as third argument"); - ColumnVector out_times = args(3).vector_value ("expecting output time vector as fourth argument"); + ColumnVector out_times (args(3).vector_value ()); + + if (error_state) + DASPK_ABORT1 ("expecting output time vector as fourth argument"); ColumnVector crit_times; int crit_times_set = 0; if (nargin > 4) { - crit_times = args(4).vector_value ("expecting critical time vector as fifth argument"); + crit_times = ColumnVector (args(4).vector_value ()); + + if (error_state) + DASPK_ABORT1 ("expecting critical time vector as fifth argument"); crit_times_set = 1; }
--- a/libinterp/corefcn/dasrt.cc Sun Nov 08 12:00:06 2015 +0100 +++ b/libinterp/corefcn/dasrt.cc Sun Nov 08 16:14:27 2015 -0500 @@ -89,9 +89,9 @@ warned_fcn_imaginary = true; } - retval = tmp(0).vector_value ("dasrt: evaluation of user-supplied function failed"); + retval = ColumnVector (tmp(0).vector_value ()); - if (retval.numel () == 0) + if (error_state || retval.numel () == 0) gripe_user_supplied_eval ("dasrt"); } else @@ -129,9 +129,9 @@ warned_cf_imaginary = true; } - retval = tmp(0).vector_value ("dasrt: evaluation of user-supplied function failed"); + retval = ColumnVector (tmp(0).vector_value ()); - if (retval.numel () == 0) + if (error_state || retval.numel () == 0) gripe_user_supplied_eval ("dasrt"); } else @@ -477,7 +477,7 @@ } } - if (! dasrt_f) + if (error_state || (! dasrt_f)) DASRT_ABORT; DAERTFunc func (dasrt_user_f); @@ -506,13 +506,21 @@ func.set_constraint_function (dasrt_user_cf); } - ColumnVector state = args(argp).vector_value ("expecting state vector as argument %d", ++argp); + ColumnVector state (args(argp++).vector_value ()); + + if (error_state) + DASRT_ABORT2 ("expecting state vector as argument %d", argp); + + ColumnVector stateprime (args(argp++).vector_value ()); - ColumnVector stateprime = args(argp).vector_value ("expecting time derivative of state vector as argument %d", argp); - argp++; + if (error_state) + DASRT_ABORT2 ("expecting time derivative of state vector as argument %d", + argp); - ColumnVector out_times = args(argp).vector_value ("expecting output time vector as %s argument %d", argp); - argp++; + ColumnVector out_times (args(argp++).vector_value ()); + + if (error_state) + DASRT_ABORT2 ("expecting output time vector as %s argument %d", argp); double tzero = out_times (0); @@ -522,8 +530,10 @@ if (argp < nargin) { - crit_times = args(argp).vector_value ("expecting critical time vector as argument %d", argp); - argp++; + crit_times = ColumnVector (args(argp++).vector_value ()); + + if (error_state) + DASRT_ABORT2 ("expecting critical time vector as argument %d", argp); crit_times_set = true; }
--- a/libinterp/corefcn/dassl.cc Sun Nov 08 12:00:06 2015 +0100 +++ b/libinterp/corefcn/dassl.cc Sun Nov 08 16:14:27 2015 -0500 @@ -90,12 +90,12 @@ warned_fcn_imaginary = true; } - retval = tmp(0).vector_value (); + retval = ColumnVector (tmp(0).vector_value ()); if (tlen > 1) ires = tmp(1).int_value (); - if (retval.numel () == 0) + if (error_state || retval.numel () == 0) gripe_user_supplied_eval ("dassl"); } else @@ -141,7 +141,7 @@ retval = tmp(0).matrix_value (); - if (retval.numel () == 0) + if (error_state || retval.numel () == 0) gripe_user_supplied_eval ("dassl"); } else @@ -394,20 +394,32 @@ } } - if (! dassl_fcn) + if (error_state || ! dassl_fcn) DASSL_ABORT (); - ColumnVector state = args(1).vector_value ("expecting state vector as second argument"); + ColumnVector state = ColumnVector (args(1).vector_value ()); + + if (error_state) + DASSL_ABORT1 ("expecting state vector as second argument"); + + ColumnVector deriv (args(2).vector_value ()); - ColumnVector deriv = args(2).vector_value ("expecting derivative vector as third argument"); + if (error_state) + DASSL_ABORT1 ("expecting derivative vector as third argument"); - ColumnVector out_times = args(3).vector_value ("expecting output time vector as fourth argument"); + ColumnVector out_times (args(3).vector_value ()); + + if (error_state) + DASSL_ABORT1 ("expecting output time vector as fourth argument"); ColumnVector crit_times; int crit_times_set = 0; if (nargin > 4) { - crit_times = args(4).vector_value ("expecting critical time vector as fifth argument"); + crit_times = ColumnVector (args(4).vector_value ()); + + if (error_state) + DASSL_ABORT1 ("expecting critical time vector as fifth argument"); crit_times_set = 1; }
--- a/libinterp/corefcn/file-io.cc Sun Nov 08 12:00:06 2015 +0100 +++ b/libinterp/corefcn/file-io.cc Sun Nov 08 16:14:27 2015 -0500 @@ -1321,36 +1321,41 @@ count = -1; - Array<double> size = size_arg.vector_value ("fread: invalid SIZE specified"); - - std::string prec = prec_arg.string_value ("fread: PRECISION must be a string"); - - int block_size = 1; - oct_data_conv::data_type input_type; - oct_data_conv::data_type output_type; - - oct_data_conv::string_to_data_type (prec, block_size, - input_type, output_type); + Array<double> size = size_arg.vector_value (); if (! error_state) { - int skip = skip_arg.int_value (true); + std::string prec = prec_arg.string_value ("fread: PRECISION must be a string"); + + int block_size = 1; + oct_data_conv::data_type input_type; + oct_data_conv::data_type output_type; + + oct_data_conv::string_to_data_type (prec, block_size, + input_type, output_type); if (! error_state) { - std::string arch = arch_arg.string_value ("fread: ARCH architecture type must be a string"); + int skip = skip_arg.int_value (true); + + if (! error_state) + { + std::string arch = arch_arg.string_value ("fread: ARCH architecture type must be a string"); - oct_mach_info::float_format flt_fmt - = oct_mach_info::string_to_float_format (arch); + oct_mach_info::float_format flt_fmt + = oct_mach_info::string_to_float_format (arch); - retval = os.read (size, block_size, input_type, - output_type, skip, flt_fmt, count); + retval = os.read (size, block_size, input_type, + output_type, skip, flt_fmt, count); + } + else + error ("fread: SKIP must be an integer"); } else - error ("fread: SKIP must be an integer"); + error ("fread: invalid PRECISION specified"); } else - error ("fread: invalid PRECISION specified"); + error ("fread: invalid SIZE specified"); return retval; }
--- a/libinterp/corefcn/filter.cc Sun Nov 08 12:00:06 2015 +0100 +++ b/libinterp/corefcn/filter.cc Sun Nov 08 16:14:27 2015 -0500 @@ -440,86 +440,96 @@ { if (isfloat) { - FloatComplexColumnVector b (args(0).float_complex_vector_value (errmsg)); - FloatComplexColumnVector a (args(1).float_complex_vector_value (errmsg)); + FloatComplexColumnVector b (args(0).float_complex_vector_value ()); + FloatComplexColumnVector a (args(1).float_complex_vector_value ()); FloatComplexNDArray x (args(2).float_complex_array_value ()); - FloatComplexNDArray si; - - if (nargin == 3 || args(3).is_empty ()) - { - octave_idx_type a_len = a.numel (); - octave_idx_type b_len = b.numel (); - - octave_idx_type si_len = (a_len > b_len ? a_len : b_len) - 1; - - dim_vector si_dims = x.dims (); - for (int i = dim; i > 0; i--) - si_dims(i) = si_dims(i-1); - si_dims(0) = si_len; - - si.resize (si_dims, 0.0); - } - else - { - si = args(3).float_complex_array_value (); - - if (si.is_vector () && x.is_vector ()) - si = si.reshape (dim_vector (si.numel (), 1)); - } - if (! error_state) { - FloatComplexNDArray y (filter (b, a, x, si, dim)); + FloatComplexNDArray si; + + if (nargin == 3 || args(3).is_empty ()) + { + octave_idx_type a_len = a.numel (); + octave_idx_type b_len = b.numel (); + + octave_idx_type si_len = (a_len > b_len ? a_len : b_len) - 1; + + dim_vector si_dims = x.dims (); + for (int i = dim; i > 0; i--) + si_dims(i) = si_dims(i-1); + si_dims(0) = si_len; - if (nargout == 2) - retval(1) = si; + si.resize (si_dims, 0.0); + } + else + { + si = args(3).float_complex_array_value (); + + if (si.is_vector () && x.is_vector ()) + si = si.reshape (dim_vector (si.numel (), 1)); + } - retval(0) = y; + if (! error_state) + { + FloatComplexNDArray y (filter (b, a, x, si, dim)); + + if (nargout == 2) + retval(1) = si; + + retval(0) = y; + } + else + error (errmsg); } else error (errmsg); } else { - ComplexColumnVector b (args(0).complex_vector_value (errmsg)); - ComplexColumnVector a (args(1).complex_vector_value (errmsg)); + ComplexColumnVector b (args(0).complex_vector_value ()); + ComplexColumnVector a (args(1).complex_vector_value ()); ComplexNDArray x (args(2).complex_array_value ()); - ComplexNDArray si; - - if (nargin == 3 || args(3).is_empty ()) - { - octave_idx_type a_len = a.numel (); - octave_idx_type b_len = b.numel (); - - octave_idx_type si_len = (a_len > b_len ? a_len : b_len) - 1; - - dim_vector si_dims = x.dims (); - for (int i = dim; i > 0; i--) - si_dims(i) = si_dims(i-1); - si_dims(0) = si_len; - - si.resize (si_dims, 0.0); - } - else - { - si = args(3).complex_array_value (); - - if (si.is_vector () && x.is_vector ()) - si = si.reshape (dim_vector (si.numel (), 1)); - } - if (! error_state) { - ComplexNDArray y (filter (b, a, x, si, dim)); + ComplexNDArray si; + + if (nargin == 3 || args(3).is_empty ()) + { + octave_idx_type a_len = a.numel (); + octave_idx_type b_len = b.numel (); + + octave_idx_type si_len = (a_len > b_len ? a_len : b_len) - 1; + + dim_vector si_dims = x.dims (); + for (int i = dim; i > 0; i--) + si_dims(i) = si_dims(i-1); + si_dims(0) = si_len; - if (nargout == 2) - retval(1) = si; + si.resize (si_dims, 0.0); + } + else + { + si = args(3).complex_array_value (); + + if (si.is_vector () && x.is_vector ()) + si = si.reshape (dim_vector (si.numel (), 1)); + } - retval(0) = y; + if (! error_state) + { + ComplexNDArray y (filter (b, a, x, si, dim)); + + if (nargout == 2) + retval(1) = si; + + retval(0) = y; + } + else + error (errmsg); } else error (errmsg); @@ -529,86 +539,96 @@ { if (isfloat) { - FloatColumnVector b (args(0).float_vector_value (errmsg)); - FloatColumnVector a (args(1).float_vector_value (errmsg)); + FloatColumnVector b (args(0).float_vector_value ()); + FloatColumnVector a (args(1).float_vector_value ()); FloatNDArray x (args(2).float_array_value ()); - FloatNDArray si; - - if (nargin == 3 || args(3).is_empty ()) - { - octave_idx_type a_len = a.numel (); - octave_idx_type b_len = b.numel (); - - octave_idx_type si_len = (a_len > b_len ? a_len : b_len) - 1; - - dim_vector si_dims = x.dims (); - for (int i = dim; i > 0; i--) - si_dims(i) = si_dims(i-1); - si_dims(0) = si_len; - - si.resize (si_dims, 0.0); - } - else - { - si = args(3).float_array_value (); - - if (si.is_vector () && x.is_vector ()) - si = si.reshape (dim_vector (si.numel (), 1)); - } - if (! error_state) { - FloatNDArray y (filter (b, a, x, si, dim)); + FloatNDArray si; + + if (nargin == 3 || args(3).is_empty ()) + { + octave_idx_type a_len = a.numel (); + octave_idx_type b_len = b.numel (); + + octave_idx_type si_len = (a_len > b_len ? a_len : b_len) - 1; + + dim_vector si_dims = x.dims (); + for (int i = dim; i > 0; i--) + si_dims(i) = si_dims(i-1); + si_dims(0) = si_len; - if (nargout == 2) - retval(1) = si; + si.resize (si_dims, 0.0); + } + else + { + si = args(3).float_array_value (); + + if (si.is_vector () && x.is_vector ()) + si = si.reshape (dim_vector (si.numel (), 1)); + } - retval(0) = y; + if (! error_state) + { + FloatNDArray y (filter (b, a, x, si, dim)); + + if (nargout == 2) + retval(1) = si; + + retval(0) = y; + } + else + error (errmsg); } else error (errmsg); } else { - ColumnVector b (args(0).vector_value (errmsg)); - ColumnVector a (args(1).vector_value (errmsg)); + ColumnVector b (args(0).vector_value ()); + ColumnVector a (args(1).vector_value ()); NDArray x (args(2).array_value ()); - NDArray si; - - if (nargin == 3 || args(3).is_empty ()) - { - octave_idx_type a_len = a.numel (); - octave_idx_type b_len = b.numel (); - - octave_idx_type si_len = (a_len > b_len ? a_len : b_len) - 1; - - dim_vector si_dims = x.dims (); - for (int i = dim; i > 0; i--) - si_dims(i) = si_dims(i-1); - si_dims(0) = si_len; - - si.resize (si_dims, 0.0); - } - else - { - si = args(3).array_value (); - - if (si.is_vector () && x.is_vector ()) - si = si.reshape (dim_vector (si.numel (), 1)); - } - if (! error_state) { - NDArray y (filter (b, a, x, si, dim)); + NDArray si; + + if (nargin == 3 || args(3).is_empty ()) + { + octave_idx_type a_len = a.numel (); + octave_idx_type b_len = b.numel (); + + octave_idx_type si_len = (a_len > b_len ? a_len : b_len) - 1; + + dim_vector si_dims = x.dims (); + for (int i = dim; i > 0; i--) + si_dims(i) = si_dims(i-1); + si_dims(0) = si_len; - if (nargout == 2) - retval(1) = si; + si.resize (si_dims, 0.0); + } + else + { + si = args(3).array_value (); + + if (si.is_vector () && x.is_vector ()) + si = si.reshape (dim_vector (si.numel (), 1)); + } - retval(0) = y; + if (! error_state) + { + NDArray y (filter (b, a, x, si, dim)); + + if (nargout == 2) + retval(1) = si; + + retval(0) = y; + } + else + error (errmsg); } else error (errmsg);
--- a/libinterp/corefcn/graphics.cc Sun Nov 08 12:00:06 2015 +0100 +++ b/libinterp/corefcn/graphics.cc Sun Nov 08 16:14:27 2015 -0500 @@ -9848,99 +9848,104 @@ if (nargin > 0) { // get vector of graphics handles - ColumnVector hcv (args(0).vector_value ("set: expecting graphics handle as first argument")); - - bool request_drawnow = false; - - // loop over graphics objects - for (octave_idx_type n = 0; n < hcv.numel (); n++) - { - graphics_object go = gh_manager::get_object (hcv(n)); - - if (go) - { - if (nargin == 3 - && args(1).is_cellstr () && args(2).is_cell ()) + ColumnVector hcv (args(0).vector_value ()); + + if (! error_state) + { + bool request_drawnow = false; + + // loop over graphics objects + for (octave_idx_type n = 0; n < hcv.numel (); n++) + { + graphics_object go = gh_manager::get_object (hcv(n)); + + if (go) { - if (args(2).cell_value ().rows () == 1) + if (nargin == 3 + && args(1).is_cellstr () && args(2).is_cell ()) { - go.set (args(1).cellstr_value (), - args(2).cell_value (), 0); - } - else if (hcv.numel () == args(2).cell_value ().rows ()) - { - go.set (args(1).cellstr_value (), - args(2).cell_value (), n); + if (args(2).cell_value ().rows () == 1) + { + go.set (args(1).cellstr_value (), + args(2).cell_value (), 0); + } + else if (hcv.numel () == args(2).cell_value ().rows ()) + { + go.set (args(1).cellstr_value (), + args(2).cell_value (), n); + } + else + { + error ("set: number of graphics handles must match number of value rows (%d != %d)", + hcv.numel (), args(2).cell_value ().rows ()); + break; + + } } - else + else if (nargin == 2 && args(1).is_map ()) { - error ("set: number of graphics handles must match number of value rows (%d != %d)", - hcv.numel (), args(2).cell_value ().rows ()); - break; - + go.set (args(1).map_value ()); } - } - else if (nargin == 2 && args(1).is_map ()) - { - go.set (args(1).map_value ()); - } - else if (nargin == 2 && args(1).is_string ()) - { - std::string property = args(1).string_value (); - - octave_map pmap = go.values_as_struct (); - - if (go.has_readonly_property (property)) - if (nargout != 0) - retval = Matrix (); - else - octave_stdout << "set: " << property - <<" is read-only" << std::endl; - else if (pmap.isfield (property)) + else if (nargin == 2 && args(1).is_string ()) + { + std::string property = args(1).string_value (); + + octave_map pmap = go.values_as_struct (); + + if (go.has_readonly_property (property)) + if (nargout != 0) + retval = Matrix (); + else + octave_stdout << "set: " << property + <<" is read-only" << std::endl; + else if (pmap.isfield (property)) + { + if (nargout != 0) + retval = pmap.getfield (property)(0); + else + { + std::string s = go.value_as_string (property); + + octave_stdout << s; + } + } + else + { + error ("set: unknown property"); + break; + } + } + else if (nargin == 1) { if (nargout != 0) - retval = pmap.getfield (property)(0); + retval = go.values_as_struct (); else { - std::string s = go.value_as_string (property); + std::string s = go.values_as_string (); octave_stdout << s; } } else { - error ("set: unknown property"); - break; - } - } - else if (nargin == 1) - { - if (nargout != 0) - retval = go.values_as_struct (); - else - { - std::string s = go.values_as_string (); - - octave_stdout << s; + go.set (args.splice (0, 1)); + request_drawnow = true; } } else { - go.set (args.splice (0, 1)); - request_drawnow = true; + error ("set: invalid handle (= %g)", hcv(n)); + break; } - } - else - { - error ("set: invalid handle (= %g)", hcv(n)); - break; - } - - request_drawnow = true; - } - - if (request_drawnow) - Vdrawnow_requested = true; + + request_drawnow = true; + } + + if (request_drawnow) + Vdrawnow_requested = true; + } + else + error ("set: expecting graphics handle as first argument"); } else print_usage (); @@ -9995,83 +10000,88 @@ return retval; } - ColumnVector hcv (args(0).vector_value ("get: expecting graphics handle as first argument")); - - octave_idx_type len = hcv.numel (); - - if (nargin == 1 && len > 1) - { - std::string typ0 = get_graphics_object_type (hcv(0)); - - for (octave_idx_type n = 1; n < len; n++) - { - std::string typ = get_graphics_object_type (hcv(n)); - - if (typ != typ0) + ColumnVector hcv (args(0).vector_value ()); + + if (! error_state) + { + octave_idx_type len = hcv.numel (); + + if (nargin == 1 && len > 1) + { + std::string typ0 = get_graphics_object_type (hcv(0)); + + for (octave_idx_type n = 1; n < len; n++) { - error ("get: vector of handles must all have same type"); - break; - } - } - } - - if (nargin > 1 && args(1).is_cellstr ()) - { - Array<std::string> plist = args(1).cellstr_value ("get: expecting property name or cell array of property names as second argument"); - - octave_idx_type plen = plist.numel (); - - use_cell_format = true; - - vals.resize (dim_vector (len, plen)); - - for (octave_idx_type n = 0; n < len; n++) - { - graphics_object go = gh_manager::get_object (hcv(n)); - - if (go) - { - for (octave_idx_type m = 0; m < plen; m++) + std::string typ = get_graphics_object_type (hcv(n)); + + if (typ != typ0) { - caseless_str property = plist(m); - - vals(n, m) = go.get (property); + error ("get: vector of handles must all have same type"); + break; } } - else + } + + if (nargin > 1 && args(1).is_cellstr ()) + { + Array<std::string> plist = args(1).cellstr_value ("get: expecting property name or cell array of property names as second argument"); + + octave_idx_type plen = plist.numel (); + + use_cell_format = true; + + vals.resize (dim_vector (len, plen)); + + for (octave_idx_type n = 0; n < len; n++) { - error ("get: invalid handle (= %g)", hcv(n)); - break; + graphics_object go = gh_manager::get_object (hcv(n)); + + if (go) + { + for (octave_idx_type m = 0; m < plen; m++) + { + caseless_str property = plist(m); + + vals(n, m) = go.get (property); + } + } + else + { + error ("get: invalid handle (= %g)", hcv(n)); + break; + } + } + } + else + { + caseless_str property; + + if (nargin > 1) + property = args(1).string_value ("get: expecting property name or cell array of property names as second argument"); + + vals.resize (dim_vector (len, 1)); + + for (octave_idx_type n = 0; n < len; n++) + { + graphics_object go = gh_manager::get_object (hcv(n)); + + if (go) + { + if (nargin == 1) + vals(n) = go.get (); + else + vals(n) = go.get (property); + } + else + { + error ("get: invalid handle (= %g)", hcv(n)); + break; + } } } } else - { - caseless_str property; - - if (nargin > 1) - property = args(1).string_value ("get: expecting property name or cell array of property names as second argument"); - - vals.resize (dim_vector (len, 1)); - - for (octave_idx_type n = 0; n < len; n++) - { - graphics_object go = gh_manager::get_object (hcv(n)); - - if (go) - { - if (nargin == 1) - vals(n) = go.get (); - else - vals(n) = go.get (property); - } - else - { - error ("get: invalid handle (= %g)", hcv(n)); - break; - } - } - } + error ("get: expecting graphics handle as first argument"); } else print_usage (); @@ -10126,24 +10136,29 @@ if (nargin == 1) { - ColumnVector hcv (args(0).vector_value ("get: expecting graphics handle as first argument")); - - octave_idx_type len = hcv.numel (); - - vals.resize (dim_vector (len, 1)); - - for (octave_idx_type n = 0; n < len; n++) - { - graphics_object go = gh_manager::get_object (hcv(n)); - - if (go) - vals(n) = go.get (true); - else - { - error ("get: invalid handle (= %g)", hcv(n)); - break; - } - } + ColumnVector hcv (args(0).vector_value ()); + + if (! error_state) + { + octave_idx_type len = hcv.numel (); + + vals.resize (dim_vector (len, 1)); + + for (octave_idx_type n = 0; n < len; n++) + { + graphics_object go = gh_manager::get_object (hcv(n)); + + if (go) + vals(n) = go.get (true); + else + { + error ("get: invalid handle (= %g)", hcv(n)); + break; + } + } + } + else + error ("get: expecting graphics handle as first argument"); } else print_usage ();
--- a/libinterp/corefcn/lsode.cc Sun Nov 08 12:00:06 2015 +0100 +++ b/libinterp/corefcn/lsode.cc Sun Nov 08 16:14:27 2015 -0500 @@ -86,9 +86,9 @@ warned_fcn_imaginary = true; } - retval = tmp(0).vector_value ("lsode: evaluation of user-supplied function failed"); + retval = ColumnVector (tmp(0).vector_value ()); - if (retval.numel () == 0) + if (error_state || retval.numel () == 0) gripe_user_supplied_eval ("lsode"); } else @@ -404,16 +404,25 @@ if (error_state || ! lsode_fcn) LSODE_ABORT (); - ColumnVector state = args(1).vector_value ("lsode: expecting state vector as second argument"); + ColumnVector state (args(1).vector_value ()); + + if (error_state) + LSODE_ABORT1 ("expecting state vector as second argument"); - ColumnVector out_times = args(2).vector_value ("lsode: expecting output time vector as third argument"); + ColumnVector out_times (args(2).vector_value ()); + + if (error_state) + LSODE_ABORT1 ("expecting output time vector as third argument"); ColumnVector crit_times; int crit_times_set = 0; if (nargin > 3) { - crit_times = args(3).vector_value ("lsode: expecting critical time vector as fourth argument"); + crit_times = ColumnVector (args(3).vector_value ()); + + if (error_state) + LSODE_ABORT1 ("expecting critical time vector as fourth argument"); crit_times_set = 1; }
--- a/libinterp/corefcn/matrix_type.cc Sun Nov 08 12:00:06 2015 +0100 +++ b/libinterp/corefcn/matrix_type.cc Sun Nov 08 16:14:27 2015 -0500 @@ -276,21 +276,27 @@ if (nargin == 3 && (str_typ == "upper" || str_typ == "lower")) { - const ColumnVector perm (args(2).vector_value ("matrix_type: invalid permutation vector PERM")); + const ColumnVector perm = + ColumnVector (args(2).vector_value ()); - octave_idx_type len = perm.numel (); - dim_vector dv = args(0).dims (); - - if (len != dv(0)) + if (error_state) error ("matrix_type: Invalid permutation vector PERM"); else { - OCTAVE_LOCAL_BUFFER (octave_idx_type, p, len); + octave_idx_type len = perm.numel (); + dim_vector dv = args(0).dims (); - for (octave_idx_type i = 0; i < len; i++) - p[i] = static_cast<octave_idx_type> (perm (i)) - 1; + if (len != dv(0)) + error ("matrix_type: Invalid permutation vector PERM"); + else + { + OCTAVE_LOCAL_BUFFER (octave_idx_type, p, len); - mattyp.mark_as_permuted (len, p); + for (octave_idx_type i = 0; i < len; i++) + p[i] = static_cast<octave_idx_type> (perm (i)) - 1; + + mattyp.mark_as_permuted (len, p); + } } } else if (nargin != 2 @@ -416,21 +422,27 @@ if (nargin == 3 && (str_typ == "upper" || str_typ == "lower")) { - const ColumnVector perm (args(2).vector_value ("matrix_type: invalid permutation vector PERM")); + const ColumnVector perm = + ColumnVector (args(2).vector_value ()); - octave_idx_type len = perm.numel (); - dim_vector dv = args(0).dims (); - - if (len != dv(0)) + if (error_state) error ("matrix_type: Invalid permutation vector PERM"); else { - OCTAVE_LOCAL_BUFFER (octave_idx_type, p, len); + octave_idx_type len = perm.numel (); + dim_vector dv = args(0).dims (); - for (octave_idx_type i = 0; i < len; i++) - p[i] = static_cast<octave_idx_type> (perm (i)) - 1; + if (len != dv(0)) + error ("matrix_type: Invalid permutation vector PERM"); + else + { + OCTAVE_LOCAL_BUFFER (octave_idx_type, p, len); - mattyp.mark_as_permuted (len, p); + for (octave_idx_type i = 0; i < len; i++) + p[i] = static_cast<octave_idx_type> (perm (i)) - 1; + + mattyp.mark_as_permuted (len, p); + } } } else if (nargin != 2)
--- a/libinterp/corefcn/quad.cc Sun Nov 08 12:00:06 2015 +0100 +++ b/libinterp/corefcn/quad.cc Sun Nov 08 16:14:27 2015 -0500 @@ -151,7 +151,7 @@ do \ { \ if (fcn_name.length ()) \ - clear_function (fcn_name); \ + clear_function (fcn_name); \ return retval; \ } \ while (0) @@ -301,10 +301,16 @@ have_sing = true; - sing = args(4).float_vector_value ("quad: expecting vector of singularities as fourth argument"); + sing = FloatColumnVector (args(4).float_vector_value ()); + + if (error_state) + QUAD_ABORT1 ("expecting vector of singularities as fourth argument"); case 4: - tol = args(3).float_vector_value ("quad: expecting vector of tolerances as fifth argument"); + tol = FloatColumnVector (args(3).float_vector_value ()); + + if (error_state) + QUAD_ABORT1 ("expecting vector of tolerances as fifth argument"); switch (tol.numel ()) { @@ -404,10 +410,16 @@ have_sing = true; - sing = args(4).vector_value ("quad: expecting vector of singularities as fourth argument"); + sing = ColumnVector (args(4).vector_value ()); + + if (error_state) + QUAD_ABORT1 ("expecting vector of singularities as fourth argument"); case 4: - tol = args(3).vector_value ("quad: expecting vector of tolerances as fifth argument"); + tol = ColumnVector (args(3).vector_value ()); + + if (error_state) + QUAD_ABORT1 ("expecting vector of tolerances as fifth argument"); switch (tol.numel ()) {
--- a/libinterp/corefcn/rand.cc Sun Nov 08 12:00:06 2015 +0100 +++ b/libinterp/corefcn/rand.cc Sun Nov 08 16:14:27 2015 -0500 @@ -271,9 +271,8 @@ octave_rand::reset (fcn); else { - Array<double> tmp = args(idx+1).array_value (); - - ColumnVector s = tmp.reshape (tmp.numel (), 1); + ColumnVector s = + ColumnVector (args(idx+1).vector_value(false, true)); octave_rand::state (s, fcn); }
--- a/libinterp/dldfcn/__eigs__.cc Sun Nov 08 12:00:06 2015 +0100 +++ b/libinterp/dldfcn/__eigs__.cc Sun Nov 08 16:14:27 2015 -0500 @@ -73,7 +73,13 @@ warned_imaginary = true; } - retval = tmp(0).vector_value ("eigs: evaluation of user-supplied function failed"); + retval = ColumnVector (tmp(0).vector_value ()); + + if (error_state) + { + eigs_error = 1; + gripe_user_supplied_eval ("eigs"); + } } else { @@ -105,7 +111,13 @@ if (tmp.length () && tmp(0).is_defined ()) { - retval = tmp(0).complex_vector_value ("eigs: evaluation of user-supplied function failed"); + retval = ComplexColumnVector (tmp(0).complex_vector_value ()); + + if (error_state) + { + eigs_error = 1; + gripe_user_supplied_eval ("eigs"); + } } else {
--- a/libinterp/dldfcn/__magick_read__.cc Sun Nov 08 12:00:06 2015 +0100 +++ b/libinterp/dldfcn/__magick_read__.cc Sun Nov 08 16:14:27 2015 -0500 @@ -770,8 +770,12 @@ } else { - frameidx = indexes.int_vector_value ("__magick_read__: invalid value for Index/Frame"); - + frameidx = indexes.int_vector_value (); + if (error_state) + { + error ("__magick_read__: invalid value for Index/Frame"); + return output; + } // Fix indexes from base 1 to base 0, and at the same time, make // sure none of the indexes is outside the range of image number. const octave_idx_type n = frameidx.numel ();
--- a/libinterp/octave-value/ov.cc Sun Nov 08 12:00:06 2015 +0100 +++ b/libinterp/octave-value/ov.cc Sun Nov 08 16:14:27 2015 -0500 @@ -1555,7 +1555,7 @@ { Cell retval; va_list args; - va_start (args, fmt); + va_start (args,fmt); retval = rep->cell_value (fmt, args); va_end (args); return retval; @@ -1690,31 +1690,6 @@ type_name (), "real vector")); } -Array<double> -octave_value::vector_value (const char *fmt, ...) const -{ - Array<double> retval; - - try - { - retval = vector_value (); - } - catch (const octave_execution_exception&) - { - if (fmt) - { - va_list args; - va_start (args, fmt); - verror (fmt, args); - va_end (args); - } - - throw; - } - - return retval; -} - template <class T> static Array<int> convert_to_int_array (const Array<octave_int<T> >& A) @@ -1784,31 +1759,6 @@ type_name (), "integer vector")); } -Array<int> -octave_value::int_vector_value (const char *fmt, ...) const -{ - Array<int> retval; - - try - { - retval = int_vector_value (); - } - catch (const octave_execution_exception&) - { - if (fmt) - { - va_list args; - va_start (args, fmt); - verror (fmt, args); - va_end (args); - } - - throw; - } - - return retval; -} - template <class T> static Array<octave_idx_type> convert_to_octave_idx_type_array (const Array<octave_int<T> >& A) @@ -1890,31 +1840,6 @@ type_name (), "complex vector")); } -Array<Complex> -octave_value::complex_vector_value (const char *fmt, ...) const -{ - Array<Complex> retval; - - try - { - retval = complex_vector_value (); - } - catch (const octave_execution_exception&) - { - if (fmt) - { - va_list args; - va_start (args, fmt); - verror (fmt, args); - va_end (args); - } - - throw; - } - - return retval; -} - FloatColumnVector octave_value::float_column_vector_value (bool force_string_conv, bool frc_vec_conv) const @@ -1959,31 +1884,6 @@ type_name (), "real vector")); } -Array<float> -octave_value::float_vector_value (const char *fmt, ...) const -{ - Array<float> retval; - - try - { - retval = float_vector_value (); - } - catch (const octave_execution_exception&) - { - if (fmt) - { - va_list args; - va_start (args, fmt); - verror (fmt, args); - va_end (args); - } - - throw; - } - - return retval; -} - Array<FloatComplex> octave_value::float_complex_vector_value (bool force_string_conv, bool force_vector_conversion) const @@ -1995,31 +1895,6 @@ type_name (), "complex vector")); } -Array<FloatComplex> -octave_value::float_complex_vector_value (const char *fmt, ...) const -{ - Array<FloatComplex> retval; - - try - { - retval = float_complex_vector_value (); - } - catch (const octave_execution_exception&) - { - if (fmt) - { - va_list args; - va_start (args, fmt); - verror (fmt, args); - va_end (args); - } - - throw; - } - - return retval; -} - octave_value octave_value::storable_value (void) const {
--- a/libinterp/octave-value/ov.h Sun Nov 08 12:00:06 2015 +0100 +++ b/libinterp/octave-value/ov.h Sun Nov 08 16:14:27 2015 -0500 @@ -903,7 +903,7 @@ { std::string retval; va_list args; - va_start (args, fmt); + va_start (args,fmt); retval = rep->string_value (fmt, args); va_end (args); return retval; @@ -916,7 +916,7 @@ { Array<std::string> retval; va_list args; - va_start (args, fmt); + va_start (args,fmt); retval = rep->cellstr_value (fmt, args); va_end (args); return retval; @@ -998,8 +998,6 @@ bool frc_str_conv = false, bool frc_vec_conv = false) const; - Array<int> int_vector_value (const char *fmt, ...) const; - Array<octave_idx_type> octave_idx_type_vector_value (bool req_int = false, bool frc_str_conv = false, @@ -1008,24 +1006,16 @@ Array<double> vector_value (bool frc_str_conv = false, bool frc_vec_conv = false) const; - Array<double> vector_value (const char *fmt, ...) const; - Array<Complex> complex_vector_value (bool frc_str_conv = false, bool frc_vec_conv = false) const; - Array<Complex> complex_vector_value (const char *fmt, ...) const; - Array<float> float_vector_value (bool frc_str_conv = false, bool frc_vec_conv = false) const; - Array<float> float_vector_value (const char *fmt, ...) const; - Array<FloatComplex> float_complex_vector_value (bool frc_str_conv = false, bool frc_vec_conv = false) const; - Array<FloatComplex> float_complex_vector_value (const char *fmt, ...) const; - // Possibly economize a lazy-indexed value. void maybe_economize (void)