diff libinterp/octave-value/ov-mex-fcn.cc @ 30919:4ed7dfe28584

move eval of anon fcn handles and built-in and mex functions to pt-eval.cc For consistency with the evaluation of user-defined functions and scripts, move the evaluation of anonymous function handles and built-in and mex functions to the tree_evaluator class in pt-eval.cc. * pt-eval.h, pt-eval.cc (tree_evaluator::evaluate_anon_fcn_handle, tree_evaluator::execute_builtin_function, tree_evaluator::execute_mex_function): New functions extracted from tree_anon_fcn_handle::evalueate, octave_builtin::execute and octave_mex_function::execute, respectively. * ov-builtin.cc (octave_builtin::execute): Forward to tree_evaluator::execute_builtin_function. * ov-mex-fcn.cc (octave_mex_function::execute): Forward to tree_evaluator::execute_mex_function. * pt-fcn-handle.cc (tree_anon_fcn_handle::evaluate): Forward to tree_evaluator::evaluate_anon_fcn_handle. * mex.cc: Move call_mex inside octave namespace. * mex-private.h: New file. * libinterp/corefcn/module.mk: Update.
author John W. Eaton <jwe@octave.org>
date Fri, 08 Apr 2022 14:11:05 -0400
parents 796f54d4ddbf
children 670a0d878af1
line wrap: on
line diff
--- a/libinterp/octave-value/ov-mex-fcn.cc	Fri Apr 08 20:08:10 2022 +0200
+++ b/libinterp/octave-value/ov-mex-fcn.cc	Fri Apr 08 14:11:05 2022 -0400
@@ -91,25 +91,9 @@
   return m_sh_lib.time_loaded ();
 }
 
-// FIXME: shouldn't this declaration be a header file somewhere?
-extern octave_value_list
-call_mex (octave_mex_function& curr_mex_fcn, const octave_value_list& args,
-          int nargout);
-
 octave_value_list
 octave_mex_function::execute (octave::tree_evaluator& tw, int nargout,
                               const octave_value_list& args)
 {
-  octave_value_list retval;
-
-  if (args.has_magic_colon ())
-    error ("invalid use of colon in function argument list");
-
-  octave::profiler& profiler = tw.get_profiler ();
-
-  octave::profiler::enter<octave_mex_function> block (profiler, *this);
-
-  retval = call_mex (*this, args, nargout);
-
-  return retval;
+  return tw.execute_mex_function (*this, nargout, args);
 }