changeset 16524:6a8e63dadfad

provide octave_link::set_workspace function with default values * octave-link.h, octave-link.cc (octave_link::set_workspace): Provide version with default values for top_level and workspace. * variables.cc (Fclear): Use it. * input.cc (octave_base_reader::octave_gets, get_debug_input): Use it.
author John W. Eaton <jwe@octave.org>
date Tue, 16 Apr 2013 15:11:41 -0400
parents 62d8aaf6ba8f
children e192525236ad
files libinterp/interpfcn/input.cc libinterp/interpfcn/octave-link.cc libinterp/interpfcn/octave-link.h libinterp/interpfcn/variables.cc
diffstat 4 files changed, 14 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/interpfcn/input.cc	Tue Apr 16 15:05:17 2013 -0400
+++ b/libinterp/interpfcn/input.cc	Tue Apr 16 15:11:41 2013 -0400
@@ -219,9 +219,7 @@
 
       octave_link::pre_input_event ();
 
-      octave_link::set_workspace ((symbol_table::current_scope ()
-                                   == symbol_table::top_scope ()),
-                                  symbol_table::workspace_info ());
+      octave_link::set_workspace ();
 
       // FIXME -- this call should happen any time the terminal window
       // size changes, not just prior to prompting for input.
@@ -528,9 +526,7 @@
             {
               octave_link::enter_debugger_event (nm, curr_debug_line);
 
-              octave_link::set_workspace ((symbol_table::current_scope ()
-                                           == symbol_table::top_scope ()),
-                                          symbol_table::workspace_info ());
+              octave_link::set_workspace ();
 
               frame.add_fcn (execute_in_debugger_handler,
                              std::pair<std::string, int> (nm, curr_debug_line));
--- a/libinterp/interpfcn/octave-link.cc	Tue Apr 16 15:05:17 2013 -0400
+++ b/libinterp/interpfcn/octave-link.cc	Tue Apr 16 15:11:41 2013 -0400
@@ -55,6 +55,15 @@
   command_editor::add_event_hook (octave_readline_hook);
 }
 
+void
+octave_link::set_workspace (void)
+{
+  if (enabled ())
+    instance->do_set_workspace ((symbol_table::current_scope ()
+                                 == symbol_table::top_scope ()),
+                                symbol_table::workspace_info ());
+}
+
 // OBJ should be an object of a class that is derived from the base
 // class octave_link, or 0 to disconnect the link.  It is the
 // responsibility of the caller to delete obj.
--- a/libinterp/interpfcn/octave-link.h	Tue Apr 16 15:05:17 2013 -0400
+++ b/libinterp/interpfcn/octave-link.h	Tue Apr 16 15:11:41 2013 -0400
@@ -176,6 +176,8 @@
       instance->do_change_directory (dir);
   }
 
+  static void set_workspace (void);
+
   static void set_workspace (bool top_level,
                              const std::list<workspace_element>& ws)
   {
--- a/libinterp/interpfcn/variables.cc	Tue Apr 16 15:05:17 2013 -0400
+++ b/libinterp/interpfcn/variables.cc	Tue Apr 16 15:11:41 2013 -0400
@@ -2457,9 +2457,7 @@
                     }
                 }
 
-              octave_link::set_workspace ((symbol_table::current_scope ()
-                                           == symbol_table::top_scope ()),
-                                          symbol_table::workspace_info ());
+              octave_link::set_workspace ();
             }
         }
     }