changeset 23473:55916f99b8b6

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.
author John W. Eaton <jwe@octave.org>
date Mon, 08 May 2017 13:08:11 -0400
parents c8722519330a
children 70edb5512c6e
files libinterp/corefcn/bsxfun.cc libinterp/corefcn/cellfun.cc libinterp/corefcn/daspk.cc libinterp/corefcn/dasrt.cc libinterp/corefcn/dassl.cc libinterp/corefcn/data.cc libinterp/corefcn/hook-fcn.h libinterp/corefcn/lsode.cc libinterp/corefcn/quad.cc libinterp/dldfcn/__eigs__.cc libinterp/dldfcn/__ode15__.cc libinterp/parse-tree/oct-parse.in.yy libinterp/parse-tree/parse.h
diffstat 13 files changed, 42 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- 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)                                      \
--- 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 ();
--- 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)
         {
--- 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)
         {
--- 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)
         {
--- 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)
         {
--- 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; }
--- 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)
         {
--- 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)
         {
--- 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)
         {
--- 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)
       {
--- 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;
--- 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);