view libinterp/corefcn/interpreter-private.h @ 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 6652d3823428
children a52e6fb674b1
line wrap: on
line source

/*

Copyright (C) 2017-2018 John W. Eaton

This file is part of Octave.

Octave is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

Octave is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with Octave; see the file COPYING.  If not, see
<https://www.gnu.org/licenses/>.

*/

#if ! defined (octave_interpreter_private_h)
#define octave_interpreter_private_h 1

#include "octave-config.h"

#include <string>

#include "symtab.h"

class cdef_manager;

namespace octave
{
  class bp_table;
  class call_stack;
  class child_list;
  class dynamic_loader;
  class gtk_manager;
  class help_system;
  class input_system;
  class interpreter;
  class load_path;
  class tree_evaluator;
  class type_info;

  extern interpreter& __get_interpreter__ (const std::string& who);

  extern dynamic_loader& __get_dynamic_loader__ (const std::string& who);

  extern help_system& __get_help_system__ (const std::string& who);

  extern input_system& __get_input_system__ (const std::string& who);

  extern load_path& __get_load_path__ (const std::string& who);

  extern type_info& __get_type_info__ (const std::string& who);

  extern symbol_table& __get_symbol_table__ (const std::string& who);

  extern symbol_scope __get_current_scope__ (const std::string& who);

  extern symbol_scope __require_current_scope__ (const std::string& who);

  extern tree_evaluator& __get_evaluator__ (const std::string& who);

  extern bp_table& __get_bp_table__ (const std::string& who);

  extern call_stack& __get_call_stack__ (const std::string& who);

  extern child_list& __get_child_list__ (const std::string& who);

  extern cdef_manager& __get_cdef_manager__ (const std::string& who);

  extern gtk_manager& __get_gtk_manager__ (const std::string& who);
}

#endif