diff libinterp/dldfcn/__init_fltk__.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 078b795c5219
children 0e30f072d009
line wrap: on
line diff
--- a/libinterp/dldfcn/__init_fltk__.cc	Thu May 24 00:35:36 2018 -0400
+++ b/libinterp/dldfcn/__init_fltk__.cc	Wed May 23 17:12:57 2018 -0400
@@ -2441,7 +2441,7 @@
 
         octave_value_list args = input_event_hook_fcn_id;
         args.append (false);
-        Fremove_input_event_hook (args, 0);
+        Fremove_input_event_hook (m_interpreter, args, 0);
         input_event_hook_fcn_id = octave_value_list ();
 
         figure_manager::close_all ();
@@ -2504,7 +2504,7 @@
 
       octave_value fcn (new octave_builtin (F__fltk_check__));
       octave_value fcn_handle (new octave_fcn_handle (fcn, "@__fltk_check__"));
-      octave_value_list id = Fadd_input_event_hook (fcn_handle, 1);
+      octave_value_list id = Fadd_input_event_hook (interp, fcn_handle, 1);
 
       fltk->set_input_event_hook_id (id);
     }