diff libinterp/corefcn/interpreter-private.cc @ 28427:7a8c69c4eb55 stable

convert obsolete octave_fcn_inline object to @inline class Use a legacy @class object to provide inline function objects instead of using a built-in class derived from the octave_function_handle class. * scripts/legacy/@inline: New directory containing the following files: argnames.m, char.m, feval.m, formula.m, inline.m, subsref.m, vectorize.m. * scripts/legacy/@inline/module.mk: New file. * scripts/legacy/module.mk, scripts/module.mk: Update. * test/inline-fcn.tst: New tests. * test/module.mk: Update. * ov-fcn-inline.h, ov-fcn-inline.cc: Delete. Remove all uses. * libinterp/octave-value/module.mk: Update. * external.txi, func.txi, octave.texi, plot.txi, quad.txi: Eliminate discusion of inline function objects. * fplot.m, __ezplot__.m: Use isa to identify inline objects instead of instead of checking typeinfo. * ov-fcn-handle.cc, ov-typeinfo.cc: Fix tests. * ov-base.h, ov-base.cc (octave_base_value::fcn_inline_value): Delete. * ov.h, ov.cc (octave_value::fcn_inline_value): Delete. (octave_value::xfcn_inline_value): Delete value extractor. * ov-class.cc, ov-class.h (octave_inline, octave_inline_fcn): New classes that allow us to preserve the is_inline_function and function_value methods that were previously available in the octave_fcn_inline class. (F__inline_ctor__): New function for final construction of inline objects. * ls-hdf5.cc, ls-mat5.cc, ls-oct-binary.cc, ls-oct-text.cc: Handle loading of inline function objects from old files as special cases. New inline function objects will be saved and loaded as ordinary @class objects.
author John W. Eaton <jwe@octave.org>
date Mon, 23 Mar 2020 15:29:49 -0400
parents bd51beb6205e
children 0a5b15007766
line wrap: on
line diff
--- a/libinterp/corefcn/interpreter-private.cc	Sat Apr 25 13:17:11 2020 -0400
+++ b/libinterp/corefcn/interpreter-private.cc	Mon Mar 23 15:29:49 2020 -0400
@@ -44,7 +44,7 @@
 #include "load-path.h"
 #include "load-save.h"
 #include "ov.h"
-#include "ov-fcn-inline.h"
+#include "ovl.h"
 #include "pager.h"
 #include "symtab.h"
 
@@ -208,6 +208,9 @@
     return get_function_handle (interp, arg, parameter_names);
   }
 
+  // May return a function handle object, inline function object, or
+  // function object.
+
   octave_value
   get_function_handle (interpreter& interp, const octave_value& arg,
                        const std::list<std::string>& parameter_names)
@@ -228,12 +231,19 @@
         if (fcn.is_defined ())
           return fcn;
 
-        fcn = octave_value (new octave_fcn_inline (fstr, parameter_names));
-
         // Possibly warn here that passing the function body in a
         // character string is discouraged.
 
-        return fcn;
+        octave_value_list args (parameter_names.size () + 1);
+        octave_idx_type i = 0;
+        args(i++) = fstr;
+        for (const auto& pname : parameter_names)
+          args(i++) = pname;
+
+        octave_value_list tmp = interp.feval ("inline", args, 1);
+
+        if (tmp.length () > 0)
+          return tmp(0);
       }
 
     return octave_value ();