changeset 27209:ac92aa74fa1a

eliminate some direct access to call stack in gui and octave_base_value * file-editor-tab.cc (file_editor_tab::exit_debug_and_clear): Eliminate direct access to call stack. * main-window.cc (main_window::rename_variable_callback, main_window::open_any_callback, main_window::force_refresh_workspace): Likewise. * octave-cmd.cc (octave_cmd_builtin::execute): Likewise. * octave-link.cc (octave_link::set_workspace): Likewise. * ov-base.cc (called_from_builtin): Likewise.
author John W. Eaton <jwe@octave.org>
date Mon, 01 Apr 2019 20:53:00 +0000
parents 5b40cf4896f0
children bd684aad1821
files libgui/src/m-editor/file-editor-tab.cc libgui/src/main-window.cc libgui/src/octave-cmd.cc libinterp/corefcn/octave-link.cc libinterp/octave-value/ov-base.cc
diffstat 5 files changed, 28 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/src/m-editor/file-editor-tab.cc	Mon Apr 01 20:38:44 2019 +0000
+++ b/libgui/src/m-editor/file-editor-tab.cc	Mon Apr 01 20:53:00 2019 +0000
@@ -72,7 +72,6 @@
 #include "uniconv-wrappers.h"
 
 #include "bp-table.h"
-#include "call-stack.h"
 #include "interpreter-private.h"
 #include "interpreter.h"
 #include "oct-map.h"
@@ -2131,10 +2130,12 @@
 
     // If this file is loaded, check that we aren't currently running it
     bool retval = true;
+
     octave_idx_type curr_frame = -1;
-    call_stack& cs
-      = __get_call_stack__ ("file_editor_tab::exit_debug_and_clear");
-    octave_map stk = cs.backtrace (curr_frame, false);
+    tree_evaluator& tw
+      = __get_evaluator__ ("file_editor_tab::exit_debug_and_clear");
+    octave_map stk = tw.backtrace (curr_frame, false);
+
     Cell names = stk.contents ("name");
     for (octave_idx_type i = names.numel () - 1; i >= 0; i--)
       {
@@ -2155,7 +2156,7 @@
                 while (names.numel () > i)
                   {
                     sleep (0.01);
-                    stk = cs.backtrace (curr_frame, false);
+                    stk = tw.backtrace (curr_frame, false);
                     names = stk.contents ("name");
                   }
               }
--- a/libgui/src/main-window.cc	Mon Apr 01 20:38:44 2019 +0000
+++ b/libgui/src/main-window.cc	Mon Apr 01 20:53:00 2019 +0000
@@ -70,7 +70,6 @@
 #include "url-transfer.h"
 
 #include "builtin-defun-decls.h"
-#include "call-stack.h"
 #include "defaults.h"
 #include "defun.h"
 #include "interpreter-private.h"
@@ -2458,10 +2457,10 @@
       {
         scope.rename (names.first, names.second);
 
-        call_stack& cs
-          = __get_call_stack__ ("main_window::rename_variable_callback");
-
-        octave_link::set_workspace (true, cs.get_symbol_info ());
+        tree_evaluator& tw
+          = __get_evaluator__ ("main_window::rename_variable_callback");
+
+        octave_link::set_workspace (true, tw.get_symbol_info ());
       }
 
     // FIXME: if this action fails, do we need a way to display that info
@@ -2505,10 +2504,10 @@
     feval ("open", ovl (file));
 
     // Update the workspace since open.m may have loaded new variables.
-    call_stack& cs
-      = __get_call_stack__ ("main_window::open_any_callback");
-
-    octave_link::set_workspace (true, cs.get_symbol_info ());
+    tree_evaluator& tw
+      = __get_evaluator__ ("main_window::open_any_callback");
+
+    octave_link::set_workspace (true, tw.get_symbol_info ());
   }
 
   void main_window::clear_history_callback (void)
@@ -2525,10 +2524,10 @@
   {
     // INTERPRETER THREAD
 
-    call_stack& cs
-      = __get_call_stack__ ("main_window::force_refresh_workspace");
-
-    octave_link::set_workspace (true, cs.get_symbol_info (), false);
+    tree_evaluator& tw
+      = __get_evaluator__ ("main_window::force_refresh_workspace");
+
+    octave_link::set_workspace (true, tw.get_symbol_info (), false);
   }
 
   bool main_window::focus_console_after_command (void)
--- a/libgui/src/octave-cmd.cc	Mon Apr 01 20:38:44 2019 +0000
+++ b/libgui/src/octave-cmd.cc	Mon Apr 01 20:53:00 2019 +0000
@@ -89,10 +89,10 @@
       {
         case CMD_UPD_WORKSPACE:
           {
-            call_stack& cs
-              = __get_call_stack__ ("octave_cmd_builtin::execute");
+            tree_evaluator& tw
+              = __get_evaluator__ ("octave_cmd_builtin::execute");
 
-            octave_link::set_workspace (true, cs.get_symbol_info ());
+            octave_link::set_workspace (true, tw.get_symbol_info ());
           }
           break;
 
--- a/libinterp/corefcn/octave-link.cc	Mon Apr 01 20:38:44 2019 +0000
+++ b/libinterp/corefcn/octave-link.cc	Mon Apr 01 20:53:00 2019 +0000
@@ -68,12 +68,12 @@
 {
   if (enabled ())
     {
-      octave::call_stack& cs
-        = octave::__get_call_stack__ ("octave_link::set_workspace");
+      octave::tree_evaluator& tw
+        = octave::__get_evaluator__ ("octave_link::set_workspace");
 
-      instance->do_set_workspace (cs.at_top_level (),
+      instance->do_set_workspace (tw.at_top_level (),
                                   instance->debugging,
-                                  cs.get_symbol_info (), true);
+                                  tw.get_symbol_info (), true);
     }
 }
 
--- a/libinterp/octave-value/ov-base.cc	Mon Apr 01 20:38:44 2019 +0000
+++ b/libinterp/octave-value/ov-base.cc	Mon Apr 01 20:53:00 2019 +0000
@@ -32,7 +32,6 @@
 #include "lo-ieee.h"
 #include "lo-mappers.h"
 
-#include "call-stack.h"
 #include "defun.h"
 #include "errwarn.h"
 #include "interpreter-private.h"
@@ -1464,9 +1463,10 @@
 bool
 called_from_builtin (void)
 {
-  octave::call_stack& cs = octave::__get_call_stack__ ("called_from_builtin");
+  octave::tree_evaluator& tw
+    = octave::__get_evaluator__ ("called_from_builtin");
 
-  octave_function *fcn = cs.caller ();
+  octave_function *fcn = tw.caller_function ();
 
   // FIXME: we probably need a better check here, or some other
   // mechanism to avoid overloaded functions when builtin is used.