diff libinterp/octave-value/ov-base.cc @ 23553:14723784b9f2

don't use singleton for call_stack * call-stack.h, call-stack.cc (class call_stack): Don't use singleton pattern. Store reference to parent intepreter object in call stack. * pt-eval.h, pt-eval.cc (tree_evaluator::m_call_stack): New data member. (tree_evaluator::get_call_stack): New function. * interpreter-private.h, interpreter-private.cc (__get_call_stack__): New function. * interpreter.h, interpreter.cc (interpreter::get_call_stack): New function. Change all uses of call_stack to access call_stack object from the interpreter.
author John W. Eaton <jwe@octave.org>
date Wed, 07 Jun 2017 02:13:05 -0400
parents c6714ae1c06c
children 80c42f4cca13
line wrap: on
line diff
--- a/libinterp/octave-value/ov-base.cc	Wed Jun 07 02:08:22 2017 -0400
+++ b/libinterp/octave-value/ov-base.cc	Wed Jun 07 02:13:05 2017 -0400
@@ -34,11 +34,12 @@
 #include "call-stack.h"
 #include "defun.h"
 #include "errwarn.h"
+#include "interpreter-private.h"
+#include "interpreter.h"
 #include "mxarray.h"
-#include "oct-map.h"
-#include "ovl.h"
 #include "oct-hdf5.h"
 #include "oct-lvalue.h"
+#include "oct-map.h"
 #include "oct-stream.h"
 #include "ops.h"
 #include "ov-base.h"
@@ -46,15 +47,15 @@
 #include "ov-ch-mat.h"
 #include "ov-complex.h"
 #include "ov-cx-mat.h"
+#include "ov-fcn-handle.h"
 #include "ov-range.h"
 #include "ov-re-mat.h"
 #include "ov-scalar.h"
 #include "ov-str-mat.h"
-#include "ov-fcn-handle.h"
+#include "ovl.h"
 #include "parse.h"
 #include "pr-output.h"
 #include "utils.h"
-#include "interpreter.h"
 #include "variables.h"
 
 builtin_type_t btyp_mixed_numeric (builtin_type_t x, builtin_type_t y)
@@ -1491,7 +1492,9 @@
 bool
 called_from_builtin (void)
 {
-  octave_function *fcn = octave::call_stack::caller ();
+  octave::call_stack& cs = octave::__get_call_stack__ ("called_from_builtin");
+
+  octave_function *fcn = cs.caller ();
 
   // FIXME: we probably need a better check here, or some other
   // mechanism to avoid overloaded functions when builtin is used.