# HG changeset patch # User John W. Eaton # Date 1366139501 14400 # Node ID 6a8e63dadfadb5e9e95cf07db9317128868b31a6 # Parent 62d8aaf6ba8fa9c8299def12fe0c6a5cfb998116 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. diff --git a/libinterp/interpfcn/input.cc b/libinterp/interpfcn/input.cc --- a/libinterp/interpfcn/input.cc +++ b/libinterp/interpfcn/input.cc @@ -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 (nm, curr_debug_line)); diff --git a/libinterp/interpfcn/octave-link.cc b/libinterp/interpfcn/octave-link.cc --- a/libinterp/interpfcn/octave-link.cc +++ b/libinterp/interpfcn/octave-link.cc @@ -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. diff --git a/libinterp/interpfcn/octave-link.h b/libinterp/interpfcn/octave-link.h --- a/libinterp/interpfcn/octave-link.h +++ b/libinterp/interpfcn/octave-link.h @@ -176,6 +176,8 @@ instance->do_change_directory (dir); } + static void set_workspace (void); + static void set_workspace (bool top_level, const std::list& ws) { diff --git a/libinterp/interpfcn/variables.cc b/libinterp/interpfcn/variables.cc --- a/libinterp/interpfcn/variables.cc +++ b/libinterp/interpfcn/variables.cc @@ -2457,9 +2457,7 @@ } } - octave_link::set_workspace ((symbol_table::current_scope () - == symbol_table::top_scope ()), - symbol_table::workspace_info ()); + octave_link::set_workspace (); } } }