# HG changeset patch # User John W. Eaton # Date 1494263291 14400 # Node ID 55916f99b8b6de38d30249e2e0aefcca46f55ca8 # Parent c8722519330af17b7c6f7c109fe1572d38ac7475 prefer feval over do_multi_index_op * parse.h, oct-parse.in.yy (feval (octave_function *, const octave_value_list& args, int)): New function. * bsxfun.cc, cellfun.cc, daspk.cc, dasrt.cc, dassl.cc, data.cc, hook-fcn.h, lsode.cc, quad.cc, __eigs__.cc, __ode15__.cc: Use feval for function evaluations instead of do_multi_index_op. diff -r c8722519330a -r 55916f99b8b6 libinterp/corefcn/bsxfun.cc --- a/libinterp/corefcn/bsxfun.cc Sun May 07 14:00:50 2017 +0200 +++ b/libinterp/corefcn/bsxfun.cc Mon May 08 13:08:11 2017 -0400 @@ -405,14 +405,14 @@ octave_value_list inputs (2); inputs(0) = A; inputs(1) = B; - retval = func.do_multi_index_op (1, inputs); + retval = octave::feval (func, inputs, 1); } else if (dvc.numel () < 1) { octave_value_list inputs (2); inputs(0) = A.resize (dvc); inputs(1) = B.resize (dvc); - retval = func.do_multi_index_op (1, inputs); + retval = octave::feval (func, inputs, 1); } else { @@ -454,7 +454,7 @@ if (maybe_update_column (Bc, B, dvb, dvc, i, idxB)) inputs(1) = Bc; - octave_value_list tmp = func.do_multi_index_op (1, inputs); + octave_value_list tmp = octave::feval (func, inputs, 1); #define BSXINIT(T, CLS, EXTRACTOR) \ (result_type == CLS) \ diff -r c8722519330a -r 55916f99b8b6 libinterp/corefcn/cellfun.cc --- a/libinterp/corefcn/cellfun.cc Sun May 07 14:00:50 2017 +0200 +++ b/libinterp/corefcn/cellfun.cc Mon May 08 13:08:11 2017 -0400 @@ -76,7 +76,7 @@ try { - tmp = func.do_multi_index_op (nargout, inputlist); + tmp = octave::feval (func, inputlist, nargout); } catch (const octave::execution_exception& e) { @@ -106,7 +106,7 @@ buffer_error_messages--; - tmp = error_handler.do_multi_index_op (nargout, errlist); + tmp = octave::feval (error_handler, errlist, nargout); } else tmp.clear (); diff -r c8722519330a -r 55916f99b8b6 libinterp/corefcn/daspk.cc --- a/libinterp/corefcn/daspk.cc Sun May 07 14:00:50 2017 +0200 +++ b/libinterp/corefcn/daspk.cc Mon May 08 13:08:11 2017 -0400 @@ -38,6 +38,7 @@ #include "ov-fcn.h" #include "ov-cell.h" #include "pager.h" +#include "parse.h" #include "unwind-prot.h" #include "utils.h" #include "variables.h" @@ -77,7 +78,7 @@ try { - tmp = daspk_fcn->do_multi_index_op (1, args); + tmp = octave::feval (daspk_fcn, args, 1); } catch (octave::execution_exception& e) { @@ -127,7 +128,7 @@ try { - tmp = daspk_jac->do_multi_index_op (1, args); + tmp = octave::feval (daspk_jac, args, 1); } catch (octave::execution_exception& e) { diff -r c8722519330a -r 55916f99b8b6 libinterp/corefcn/dasrt.cc --- a/libinterp/corefcn/dasrt.cc Sun May 07 14:00:50 2017 +0200 +++ b/libinterp/corefcn/dasrt.cc Mon May 08 13:08:11 2017 -0400 @@ -77,7 +77,7 @@ try { - tmp = dasrt_f->do_multi_index_op (1, args); + tmp = octave::feval (dasrt_f, args, 1); } catch (octave::execution_exception& e) { @@ -118,7 +118,7 @@ try { - tmp = dasrt_cf->do_multi_index_op (1, args); + tmp = octave::feval (dasrt_cf, args, 1); } catch (octave::execution_exception& e) { @@ -164,7 +164,7 @@ try { - tmp = dasrt_j->do_multi_index_op (1, args); + tmp = octave::feval (dasrt_j, args, 1); } catch (octave::execution_exception& e) { diff -r c8722519330a -r 55916f99b8b6 libinterp/corefcn/dassl.cc --- a/libinterp/corefcn/dassl.cc Sun May 07 14:00:50 2017 +0200 +++ b/libinterp/corefcn/dassl.cc Mon May 08 13:08:11 2017 -0400 @@ -38,6 +38,7 @@ #include "ov-fcn.h" #include "ov-cell.h" #include "pager.h" +#include "parse.h" #include "unwind-prot.h" #include "utils.h" #include "variables.h" @@ -77,7 +78,7 @@ try { - tmp = dassl_fcn->do_multi_index_op (1, args); + tmp = octave::feval (dassl_fcn, args, 1); } catch (octave::execution_exception& e) { @@ -127,7 +128,7 @@ try { - tmp = dassl_jac->do_multi_index_op (1, args); + tmp = octave::feval (dassl_jac, args, 1); } catch (octave::execution_exception& e) { diff -r c8722519330a -r 55916f99b8b6 libinterp/corefcn/data.cc --- a/libinterp/corefcn/data.cc Sun May 07 14:00:50 2017 +0200 +++ b/libinterp/corefcn/data.cc Mon May 08 13:08:11 2017 -0400 @@ -59,6 +59,7 @@ #include "ov.h" #include "ovl.h" #include "pager.h" +#include "parse.h" #include "pt-mat.h" #include "utils.h" #include "variables.h" @@ -1637,7 +1638,7 @@ try { - result = fcn.do_multi_index_op (1, octave_value_list (1, ov)); + result = octave::feval (fcn, ovl (ov), 1); } catch (octave::execution_exception& e) { @@ -1665,7 +1666,7 @@ try { - result = fcn.do_multi_index_op (1, octave_value_list (1, ov)); + result = octave::feval (fcn, ovl (ov), 1); } catch (octave::execution_exception& e) { @@ -1702,7 +1703,7 @@ try { - tmp2 = fcn.do_multi_index_op (1, ovl); + tmp2 = octave::feval (fcn, ovl, 1); } catch (octave::execution_exception& e) { diff -r c8722519330a -r 55916f99b8b6 libinterp/corefcn/hook-fcn.h --- a/libinterp/corefcn/hook-fcn.h Sun May 07 14:00:50 2017 +0200 +++ b/libinterp/corefcn/hook-fcn.h Mon May 08 13:08:11 2017 -0400 @@ -169,7 +169,7 @@ if (data.is_defined ()) args.append (data); - fcn_handle.do_multi_index_op (0, args); + octave::feval (fcn_handle, args, 0); } std::string id (void) { return ident; } diff -r c8722519330a -r 55916f99b8b6 libinterp/corefcn/lsode.cc --- a/libinterp/corefcn/lsode.cc Sun May 07 14:00:50 2017 +0200 +++ b/libinterp/corefcn/lsode.cc Mon May 08 13:08:11 2017 -0400 @@ -39,6 +39,7 @@ #include "ov-fcn.h" #include "ov-cell.h" #include "pager.h" +#include "parse.h" #include "pr-output.h" #include "unwind-prot.h" #include "utils.h" @@ -74,7 +75,7 @@ try { - tmp = lsode_fcn->do_multi_index_op (1, args); + tmp = octave::feval (lsode_fcn, args, 1); } catch (octave::execution_exception& e) { @@ -114,7 +115,7 @@ try { - tmp = lsode_jac->do_multi_index_op (1, args); + tmp = octave::feval (lsode_jac, args, 1); } catch (octave::execution_exception& e) { diff -r c8722519330a -r 55916f99b8b6 libinterp/corefcn/quad.cc --- a/libinterp/corefcn/quad.cc Sun May 07 14:00:50 2017 +0200 +++ b/libinterp/corefcn/quad.cc Mon May 08 13:08:11 2017 -0400 @@ -36,6 +36,7 @@ #include "error.h" #include "errwarn.h" #include "pager.h" +#include "parse.h" #include "ovl.h" #include "ov-fcn.h" #include "unwind-prot.h" @@ -71,7 +72,7 @@ try { - tmp = quad_fcn->do_multi_index_op (1, args); + tmp = octave::feval (quad_fcn, args, 1); } catch (octave::execution_exception& e) { @@ -107,7 +108,7 @@ try { - tmp = quad_fcn->do_multi_index_op (1, args); + tmp = octave::feval (quad_fcn, args, 1); } catch (octave::execution_exception& e) { diff -r c8722519330a -r 55916f99b8b6 libinterp/dldfcn/__eigs__.cc --- a/libinterp/dldfcn/__eigs__.cc Sun May 07 14:00:50 2017 +0200 +++ b/libinterp/dldfcn/__eigs__.cc Mon May 08 13:08:11 2017 -0400 @@ -38,6 +38,7 @@ #include "ov.h" #include "ovl.h" #include "pager.h" +#include "parse.h" #include "variables.h" #if defined (HAVE_ARPACK) @@ -64,7 +65,7 @@ try { - tmp = eigs_fcn->do_multi_index_op (1, args); + tmp = feval (eigs_fcn, args, 1); } catch (octave::execution_exception& e) { @@ -104,7 +105,7 @@ try { - tmp = eigs_fcn->do_multi_index_op (1, args); + tmp = feval (eigs_fcn, args, 1); } catch (octave::execution_exception& e) { diff -r c8722519330a -r 55916f99b8b6 libinterp/dldfcn/__ode15__.cc --- a/libinterp/dldfcn/__ode15__.cc Sun May 07 14:00:50 2017 +0200 +++ b/libinterp/dldfcn/__ode15__.cc Mon May 08 13:08:11 2017 -0400 @@ -902,7 +902,7 @@ try { - tmp = ida_fc->do_multi_index_op (1, ovl (t, x, xdot)); + tmp = feval (ida_fc, ovl (t, x, xdot), 1); } catch (octave::execution_exception& e) { @@ -920,7 +920,7 @@ try { - tmp = ida_jc->do_multi_index_op (2, ovl (t, x, xdot)); + tmp = feval (ida_jc, ovl (t, x, xdot), 2); } catch (octave::execution_exception& e) { @@ -938,7 +938,7 @@ try { - tmp = ida_jc->do_multi_index_op (2, ovl (t, x, xdot)); + tmp = feval (ida_jc, ovl (t, x, xdot), 2); } catch (octave::execution_exception& e) { diff -r c8722519330a -r 55916f99b8b6 libinterp/parse-tree/oct-parse.in.yy --- a/libinterp/parse-tree/oct-parse.in.yy Sun May 07 14:00:50 2017 +0200 +++ b/libinterp/parse-tree/oct-parse.in.yy Mon May 08 13:08:11 2017 -0400 @@ -4947,6 +4947,12 @@ } octave_value_list + feval (octave_value& fcn, const octave_value_list& args, int nargout) + { + return fcn.do_multi_index_op (nargout, args); + } + + octave_value_list feval (octave_function *fcn, const octave_value_list& args, int nargout) { octave_value_list retval; diff -r c8722519330a -r 55916f99b8b6 libinterp/parse-tree/parse.h --- a/libinterp/parse-tree/parse.h Sun May 07 14:00:50 2017 +0200 +++ b/libinterp/parse-tree/parse.h Mon May 08 13:08:11 2017 -0400 @@ -553,6 +553,11 @@ int nargout = 0); extern OCTINTERP_API octave_value_list + feval (octave_value& fcn, + const octave_value_list& args = octave_value_list (), + int nargout = 0); + + extern OCTINTERP_API octave_value_list feval (octave_function *fcn, const octave_value_list& args = octave_value_list (), int nargout = 0);