diff libinterp/corefcn/variables.cc @ 27204:9a3e92d02a03

eliminate direct access to call stack in variables functions * pt-eval.h, pt-eval.cc (tree_evaluator::caller_function, tree_evaluator::curr_fcn_unwind_protect_frame): New functions. * variables.cc (curr_fcn_unwind_protect_frame, Fmlock, Fmunlock, Fmislocked, F__varval__): Eliminate direct access to call stack.
author John W. Eaton <jwe@octave.org>
date Mon, 01 Apr 2019 18:21:27 +0000
parents 6b0c61a5a0f0
children dccdc3b001a2
line wrap: on
line diff
--- a/libinterp/corefcn/variables.cc	Mon Apr 01 18:00:15 2019 +0000
+++ b/libinterp/corefcn/variables.cc	Mon Apr 01 18:21:27 2019 +0000
@@ -40,7 +40,6 @@
 #include "lo-regexp.h"
 #include "str-vec.h"
 
-#include "call-stack.h"
 #include "Cell.h"
 #include "defun.h"
 #include "dirfns.h"
@@ -537,10 +536,10 @@
 static octave::unwind_protect *
 curr_fcn_unwind_protect_frame (void)
 {
-  octave::call_stack& cs
-    = octave::__get_call_stack__ ("curr_fcn_unwind_protect_frame");
+  octave::tree_evaluator& tw
+    = octave::__get_evaluator__ ("curr_fcn_unwind_protect_frame");
 
-  return cs.curr_fcn_unwind_protect_frame ();
+  return tw.curr_fcn_unwind_protect_frame ();
 }
 
 template <typename T>
@@ -835,9 +834,9 @@
   if (args.length () != 0)
     print_usage ();
 
-  octave::call_stack& cs = interp.get_call_stack ();
+  octave::tree_evaluator& tw = interp.get_evaluator ();
 
-  octave_function *fcn = cs.caller ();
+  octave_function *fcn = tw.caller_function ();
 
   if (! fcn)
     error ("mlock: invalid use outside a function");
@@ -871,9 +870,9 @@
     }
   else
     {
-      octave::call_stack& cs = interp.get_call_stack ();
+      octave::tree_evaluator& tw = interp.get_evaluator ();
 
-      octave_function *fcn = cs.caller ();
+      octave_function *fcn = tw.caller_function ();
 
       if (! fcn)
         error ("munlock: invalid use outside a function");
@@ -909,9 +908,9 @@
     }
   else
     {
-      octave::call_stack& cs = interp.get_call_stack ();
+      octave::tree_evaluator& tw = interp.get_evaluator ();
 
-      octave_function *fcn = cs.caller ();
+      octave_function *fcn = tw.caller_function ();
 
       if (! fcn)
         error ("mislocked: invalid use outside a function");
@@ -1441,9 +1440,9 @@
 
   if (nm == ".argn.")
     {
-      octave::call_stack& cs = interp.get_call_stack ();
+      octave::tree_evaluator& tw = interp.get_evaluator ();
 
-      return cs.get_auto_fcn_var (octave::stack_frame::ARG_NAMES);
+      return tw.get_auto_fcn_var (octave::stack_frame::ARG_NAMES);
     }
 
   return interp.varval (nm);