diff libinterp/parse-tree/pt-eval.cc @ 25407:ab10403a0b50

new input_system class to manage user input for the interpreter Encapsulate many command-line input functions and data within a new class that is a member of the interpreter object. * input.h, input.cc (input_system): New class. Include data members for former static variables VPS1, VPS2, Vcompletion_append_char, last_debugging_command, Vgud_mode, input_event_hook_functions, and Vmfile_encoding. Change all uses. (is_variable, generate_struct_completions, looks_like_struct): Move here from variables.cc and make static. (set_default_prompts, octave_yes_or_no, do_keyboard, remove_input_event_hook_functions, get_input_from_stdin): Deprecate. (Fadd_input_event_hook, Fremove_input_event_hook, FPS1, FPS2, Fcompletion_append_char, F__request_drawnow__, F__gud_mode__, F__mfile_encoding__, Finput, Fyes_or_no): Define with DEFMETHOD. Change all uses. (input_system::have_input_event_hooks, input_system::add_input_event_hook, input_system::remove_input_event_hook, input_system::clear_input_event_hooks, input_system::run_input_event_hooks): New functions to manage input event hooks. (input_system::yes_or_no, input_system::interactive_input, input_system::get_user_input, input_system::keyboard, input_system::gnu_readline, input_system::get_debug_input): New functions adapted from former file-scope static and global functions. * interpreter.h, interpreter.cc (interpreter::m_input_system): New data member. (interpreter::get_input_system): New function. (interpreter::intepreter): Don't call set_default_prompts. Call input_system::initialize. (interpreter::maximum_braindamage): Call input_system::PS1 and input_system::PS2 directly here. * variables.h, variables.cc (get_struct_elts): Deprecate. * main-window.cc (octave_interpreter::m_app_context): Now pointer to gui_application, not application. (octave_interpreter::octave_interpreter): Arg is now gui_application, not application. Set default prompt strings directly here. * qt-link.h, qt-link.cc (octave_qt_link::do_set_default_prompts): Delete. * octave-link.h, octave-link.cc (octave_link::set_default_prompts, octave_link::do_set_default_prompts): Delete. * hook-fcn.h, hook-fcn.cc (named_hook_function::eval, fcn_handle_hook_function::eval): Move code from .h to .cc file. Make id and is_valid methods const. * interpreter-private.h, interpreter-private.cc (__get_input_system__): New function.
author John W. Eaton <jwe@octave.org>
date Wed, 23 May 2018 17:12:57 -0400
parents df2f3af2c6c5
children cb1606f78f6b
line wrap: on
line diff
--- a/libinterp/parse-tree/pt-eval.cc	Thu May 24 00:35:36 2018 -0400
+++ b/libinterp/parse-tree/pt-eval.cc	Wed May 23 17:12:57 2018 -0400
@@ -3162,8 +3162,11 @@
       }
 
     if (break_on_this_statement)
-      do_keyboard ();
-
+      {
+        input_system& input_sys = m_interpreter.get_input_system ();
+
+        input_sys.keyboard ();
+      }
   }
 
   // ARGS is currently unused, but since the do_keyboard function in
@@ -3173,7 +3176,9 @@
   octave_value
   tree_evaluator::do_keyboard (const octave_value_list& args) const
   {
-    return ::do_keyboard (args);
+    input_system& input_sys = m_interpreter.get_input_system ();
+
+    return input_sys.keyboard (args);
   }
 
   bool