Mercurial > octave
annotate liboctave/util/cmd-edit.h @ 24520:c5c11b07598a
refactor signal handling (bug #52757)
Given that any library code may now be multi-threaded it is not likely
to be save to jump out of a signal handler when executing a call to a
library function. We are almost assured to fail if the call to
siglongjmp occurs in a different thread from the corresponding call to
sigsetjmp.
Similarly, we should avoid calling the interrupt signal handler
function in an arbitrary thread. This is already done by default on
Windows systems. On Posix systems, we now set up a separate thread to
handle asynchronous signals (not just SIGINT). We no longer attempt
to jump out of the signal handler. Instead, we only set global status
variables and respond to them in octave_quit. This means that some
external library functions are no longer interruptible. If that
becomes important, then we will need to look for other alternatives
such as setting up worker threads that can be canceled when a SIGINT
is detected.
* sighandlers.cc (interrupt_manager, base_interrupt_manager,
w32_interrupt_manager, posix_interrupt_manager): Delete classes and
all uses.
(respond_to_pending_signals): Rename from signal_handler. Change all
uses. Take action on more signals.
(generic_sig_handler): Simply record that a signal was caught and add
it to the list of caught signals.
(deadly_sig_handler): New function.
(fpe_sig_handler): Rename from sigfpe_handler. Don't make specific to
Alpha systems. Simply warn that an exception has occurred.
(sigint_handler): Simply record that an interrupt signal was caught.
(sigterm_handler, sigpipe_handler): Delete.
(install_signal_handlers): Rework actions for various signals.
(Vsigquit_dumps_octave_core): New static variable.
(Fsigquit_dumps_octave_core): New function.
* io.txi: Document sigquit_dumps_octave_core.
* f77-fcn.h, f77-fcn.c (xSTRINGIZE, STRINGIZE, F77_XFCN_ERROR):
Delete macros.
(F77_XFCN): Don't do setjmp/longjmp exception handling.
(f77_exception_encountered): Delete global variable.
(XSTOPX): Don't set f77_exception_encountered. If message is empty,
report "unknown error in fortran subroutine".
* eigs-base.cc, gsvd.cc: Delete all direct uses of
f77_exception_encountered.
* liboctave/util/f77-extern.cc: Delete file.
* liboctave/util/module.mk: Update.
* cmd-edit.h, cmd-edit.cc (command_editor::interrupt_exception): New class.
(command_editor::handle_interrupt_signal): New static function.
(command_editor::do_handle_interrupt_signal): New virtual function.
(command_editor::event_hanlder): Call handle_interrupt_signal if
octave_interrupt_state is not zero.
(command_editor::instance_ok): Set event hook here.
(command_editor::add_event_hook): Not here.
(command_editor::remove_event_hook): Never remove event hook.
(gnu_readline::do_handle_interrupt_signal): New function.
(gnu_readline::do_readline): Retry if an interrupt exception occurs
inside readline.
* oct-rl-edit.h, oct-rl-edit.c (octave_rl_recover_from_interrupt):
New function.
* quit.h, cquit.c (current_context, octave_save_current_context,
octave_restore_current_context, octave_jump_to_enclosing_context,
octave_interrupt_immediately, octave_jmp_buf): Delete.
* quit.h: Don't include <setjmp.h>
(octave_set_current_context): Delete macro.
(octave_exit_exception_status, octave_exit_exception_safe_to_return):
Mark as deprecated.
(BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE_1): Delete.
(BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE_2): Delete.
(BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE,
END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE): Define to only create a
dummy do-while scope.
(BEGIN_INTERRUPT_WITH_EXCEPTIONS, END_INTERRUPT_WITH_EXCEPTIONS):
Define to only create a dummy scope.
* interpreter.cc (interpreter::recover_from_exception):
Don't reset octave_interrupt_immediately.
* main-cli.cc (main): Call octave_block_async_signals.
* main.in.cc (main): Call octave_block_async_signals initially.
Only in install signal handlers and unblock signals if starting
managed subprocess.
* main-window.cc (octave_interpreter::executed):
Don't unblock interrupt signals.
* signal-wrappers.h, signal-wrappers.c
(signal_watcher, octave_async_signals, block_or_unblock_signal_by_name): New static functions.
(octave_set_default_signal_handler,
octave_set_default_signal_handler_by_name,
octave_block_signal_by_name, octave_unblock_signal_by_name,
octave_create_interrupt_watcher_thread, octave_block_async_signals,
octave_unblock_async_signals): New functions.
(octave_block_interrupt_signal, octave_unblock_interrupt_signal):
Treat SIGBREAK as an interrupt signal.
(octave_block_child): Also handle SIGCLD the same as SIGCHLD.
(print_sigset, print_sigmask): New static functions.
(octave_show_sigmask): New function.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Wed, 03 Jan 2018 07:52:11 -0500 |
parents | 980f39c3ab90 |
children | 194eb4bd202b |
rev | line source |
---|---|
2926 | 1 /* |
2 | |
23219
3ac9f9ecfae5
maint: Update copyright dates.
John W. Eaton <jwe@octave.org>
parents:
23083
diff
changeset
|
3 Copyright (C) 1996-2017 John W. Eaton |
2926 | 4 |
5 This file is part of Octave. | |
6 | |
7 Octave is free software; you can redistribute it and/or modify it | |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22402
diff
changeset
|
8 under the terms of the GNU General Public License as published by |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22402
diff
changeset
|
9 the Free Software Foundation; either version 3 of the License, or |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22402
diff
changeset
|
10 (at your option) any later version. |
2926 | 11 |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22402
diff
changeset
|
12 Octave is distributed in the hope that it will be useful, but |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22402
diff
changeset
|
13 WITHOUT ANY WARRANTY; without even the implied warranty of |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22402
diff
changeset
|
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22402
diff
changeset
|
15 GNU General Public License for more details. |
2926 | 16 |
17 You should have received a copy of the GNU General Public License | |
7016 | 18 along with Octave; see the file COPYING. If not, see |
19 <http://www.gnu.org/licenses/>. | |
2926 | 20 |
21 */ | |
22 | |
20791
f7084eae3318
maint: Use Octave coding conventions for #if statements.
Rik <rik@octave.org>
parents:
19702
diff
changeset
|
23 #if ! defined (octave_cmd_edit_h) |
2926 | 24 #define octave_cmd_edit_h 1 |
25 | |
21244
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
21017
diff
changeset
|
26 #include "octave-config.h" |
1473547f50f5
include octave-config.h in public header files
John W. Eaton <jwe@octave.org>
parents:
21017
diff
changeset
|
27 |
2926 | 28 #include <cstdio> |
29 | |
6913 | 30 #include <set> |
2926 | 31 #include <string> |
32 | |
4604 | 33 #include "str-vec.h" |
34 | |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
35 namespace octave |
2926 | 36 { |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
37 class |
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
38 OCTAVE_API |
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
39 command_editor |
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
40 { |
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
41 protected: |
2926 | 42 |
24520
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
23795
diff
changeset
|
43 class interrupt_exception { }; |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
23795
diff
changeset
|
44 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
45 command_editor (void) |
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
46 : command_number (0), interrupted (false), initial_input () { } |
2926 | 47 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
48 public: |
3519 | 49 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
50 typedef int (*startup_hook_fcn) (void); |
16570
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
51 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
52 typedef int (*pre_input_hook_fcn) (void); |
2926 | 53 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
54 typedef int (*event_hook_fcn) (void); |
2941 | 55 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
56 typedef std::string (*completion_fcn) (const std::string&, int); |
6979 | 57 |
21798
12e7456f7619
Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21752
diff
changeset
|
58 typedef char * (*completion_hook_fcn) (); |
12e7456f7619
Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21752
diff
changeset
|
59 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
60 typedef std::string (*quoting_fcn) (const std::string&, int, char); |
6979 | 61 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
62 typedef std::string (*dequoting_fcn) (const std::string&, int); |
6979 | 63 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
64 typedef int (*char_is_quoted_fcn) (const std::string&, int); |
6979 | 65 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
66 typedef void (*user_accept_line_fcn) (const std::string&); |
2926 | 67 |
22869
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
68 // No copying! |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
69 |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
70 command_editor (const command_editor&) = delete; |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
71 |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
72 command_editor& operator = (const command_editor&) = delete; |
f75d289645ec
make deleted functions public
John W. Eaton <jwe@octave.org>
parents:
22868
diff
changeset
|
73 |
22868
87e3163f6c87
use c++11 "= default" syntax for declaration of trivial destructors
John W. Eaton <jwe@octave.org>
parents:
22865
diff
changeset
|
74 virtual ~command_editor (void) = default; |
2926 | 75 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
76 static void set_name (const std::string& n); |
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
77 |
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
78 static std::string readline (const std::string& prompt); |
2926 | 79 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
80 static std::string readline (const std::string& prompt, bool& eof); |
3219 | 81 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
82 static void set_input_stream (FILE *f); |
2926 | 83 |
23446
cd4e1ee28716
maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
84 static FILE * get_input_stream (void); |
2926 | 85 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
86 static void set_output_stream (FILE *f); |
2926 | 87 |
23446
cd4e1ee28716
maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
88 static FILE * get_output_stream (void); |
2926 | 89 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
90 static void redisplay (void); |
16539
8ea8df0747e9
make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents:
16537
diff
changeset
|
91 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
92 static int terminal_rows (void); |
2926 | 93 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
94 static int terminal_cols (void); |
2926 | 95 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
96 static void clear_screen (bool skip_redisplay = false); |
2926 | 97 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
98 static void resize_terminal (void); |
3281 | 99 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
100 static void set_screen_size (int ht, int wd); |
19309
735bc47d18af
command_editor: provide access to rl_set_screen_size
John W. Eaton <jwe@octave.org>
parents:
19304
diff
changeset
|
101 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
102 static std::string decode_prompt_string (const std::string& s); |
2926 | 103 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
104 static void restore_terminal_state (void); |
2926 | 105 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
106 static void blink_matching_paren (bool flag); |
2926 | 107 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
108 static bool erase_empty_line (bool flag); |
19378
f7ccd02bc060
provide access to the readline variable rl_erase_empty_line
John W. Eaton <jwe@octave.org>
parents:
19309
diff
changeset
|
109 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
110 static void set_basic_word_break_characters (const std::string& s); |
3933 | 111 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
112 static void set_completer_word_break_characters (const std::string& s); |
3933 | 113 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
114 static void set_basic_quote_characters (const std::string& s); |
2926 | 115 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
116 static void set_filename_quote_characters (const std::string& s); |
6979 | 117 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
118 static void set_completer_quote_characters (const std::string& s); |
6979 | 119 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
120 static void set_completion_append_character (char c); |
2926 | 121 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
122 static void set_completion_function (completion_fcn f); |
2941 | 123 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
124 static void set_quoting_function (quoting_fcn f); |
6979 | 125 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
126 static void set_dequoting_function (dequoting_fcn f); |
6979 | 127 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
128 static void set_char_is_quoted_function (char_is_quoted_fcn f); |
6979 | 129 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
130 static void set_user_accept_line_function (user_accept_line_fcn f); |
6979 | 131 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
132 static completion_fcn get_completion_function (void); |
2926 | 133 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
134 static quoting_fcn get_quoting_function (void); |
6979 | 135 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
136 static dequoting_fcn get_dequoting_function (void); |
6979 | 137 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
138 static char_is_quoted_fcn get_char_is_quoted_function (void); |
6979 | 139 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
140 static user_accept_line_fcn get_user_accept_line_function (void); |
6979 | 141 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
142 static string_vector generate_filename_completions (const std::string& text); |
4604 | 143 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
144 static std::string get_line_buffer (void); |
9485
3cee58bf4acf
selectively complete filenames in some cases
John W. Eaton <jwe@octave.org>
parents:
9321
diff
changeset
|
145 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
146 static std::string get_current_line (void); |
16570
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
147 |
22171
0a4c5a90f286
Allow tab completion of arrays of structures.
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21862
diff
changeset
|
148 static char get_prev_char (int); |
0a4c5a90f286
Allow tab completion of arrays of structures.
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21862
diff
changeset
|
149 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
150 static void replace_line (const std::string& text, bool clear_undo = true); |
16570
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
151 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
152 static void kill_full_line (void); |
19702
c048358da712
also kill pending input line when gui command window is cleared (bug #44015)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
153 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
154 static void insert_text (const std::string& text); |
2926 | 155 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
156 static void newline (void); |
2926 | 157 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
158 static void accept_line (void); |
6979 | 159 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
160 static bool undo (void); |
16539
8ea8df0747e9
make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents:
16537
diff
changeset
|
161 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
162 static void clear_undo_list (void); |
2926 | 163 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
164 static void add_startup_hook (startup_hook_fcn f); |
2926 | 165 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
166 static void remove_startup_hook (startup_hook_fcn f); |
2926 | 167 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
168 static void add_pre_input_hook (pre_input_hook_fcn f); |
16570
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
169 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
170 static void remove_pre_input_hook (pre_input_hook_fcn f); |
16570
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
171 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
172 static void add_event_hook (event_hook_fcn f); |
3215 | 173 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
174 static void remove_event_hook (event_hook_fcn f); |
3215 | 175 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
176 static void run_event_hooks (void); |
13924
3b654a0753b1
Implement waitfor, uiwait and uiresume.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
11586
diff
changeset
|
177 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
178 static void read_init_file (const std::string& file = ""); |
3189 | 179 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
180 static void re_read_init_file (void); |
7758
8e14a01ffe9f
input.cc (Fre_read_readline_init_file): new function
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
181 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
182 static bool filename_completion_desired (bool); |
4143 | 183 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
184 static bool filename_quoting_desired (bool); |
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
185 |
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
186 static bool prefer_env_winsize (bool); |
6979 | 187 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
188 static bool interrupt (bool = true); |
19304
ad93e9be78ee
command_editor: provide access to rl_prefer_env_winsize
John W. Eaton <jwe@octave.org>
parents:
17769
diff
changeset
|
189 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
190 static int current_command_number (void); |
16382
389b09a914e2
allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents:
15271
diff
changeset
|
191 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
192 static void reset_current_command_number (int n); |
2926 | 193 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
194 static void increment_current_command_number (void); |
2926 | 195 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
196 static void force_default_editor (void); |
2967 | 197 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
198 static void set_initial_input (const std::string& text); |
9321
9b87aeb24ea9
avoid using readline at all when line editing suppressed or interpreter embedded
Jaroslav Hajek <highegg@gmail.com>
parents:
8920
diff
changeset
|
199 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
200 static int insert_initial_input (void); |
16570
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
201 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
202 private: |
16570
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
203 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
204 static bool instance_ok (void); |
2926 | 205 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
206 static void make_command_editor (void); |
2926 | 207 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
208 static int startup_handler (void); |
2926 | 209 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
210 static int pre_input_handler (void); |
6913 | 211 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
212 static int event_handler (void); |
16570
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
213 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
214 static std::set<startup_hook_fcn> startup_hook_set; |
6913 | 215 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
216 static std::set<pre_input_hook_fcn> pre_input_hook_set; |
6913 | 217 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
218 static std::set<event_hook_fcn> event_hook_set; |
16570
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
219 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
220 // The real thing. |
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
221 static command_editor *instance; |
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
222 |
23795
980f39c3ab90
Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents:
23615
diff
changeset
|
223 static void cleanup_instance (void) { delete instance; instance = nullptr; } |
6913 | 224 |
24520
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
23795
diff
changeset
|
225 static void handle_interrupt_signal (void); |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
23795
diff
changeset
|
226 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
227 protected: |
2926 | 228 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
229 // To use something other than the GNU readline library, derive a new |
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
230 // class from command_editor, overload these functions as |
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
231 // necessary, and make instance point to the new class. |
2926 | 232 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
233 virtual void do_set_name (const std::string&) { } |
2926 | 234 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
235 std::string do_readline (const std::string& prompt) |
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
236 { |
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
237 bool eof; |
3219 | 238 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
239 return do_readline (prompt, eof); |
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
240 } |
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
241 |
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
242 virtual std::string do_readline (const std::string&, bool&) = 0; |
3219 | 243 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
244 virtual void do_set_input_stream (FILE *) = 0; |
2926 | 245 |
23446
cd4e1ee28716
maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
246 virtual FILE * do_get_input_stream (void) = 0; |
2926 | 247 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
248 virtual void do_set_output_stream (FILE *) = 0; |
2926 | 249 |
23446
cd4e1ee28716
maint: Use convention 'void * fcn ()' for functions which return pointers.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
250 virtual FILE * do_get_output_stream (void) = 0; |
2926 | 251 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
252 virtual void do_redisplay (void) { } |
2926 | 253 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
254 virtual int do_terminal_rows (void) { return 24; } |
16539
8ea8df0747e9
make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents:
16537
diff
changeset
|
255 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
256 virtual int do_terminal_cols (void) { return 80; } |
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
257 |
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
258 virtual void do_clear_screen (bool) { } |
2926 | 259 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
260 virtual void do_resize_terminal (void) { } |
2926 | 261 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
262 virtual void do_set_screen_size (int, int) { } |
2926 | 263 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
264 virtual std::string do_decode_prompt_string (const std::string&); |
3281 | 265 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
266 virtual std::string newline_chars (void) { return "\n"; } |
19309
735bc47d18af
command_editor: provide access to rl_set_screen_size
John W. Eaton <jwe@octave.org>
parents:
19304
diff
changeset
|
267 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
268 virtual void do_restore_terminal_state (void) { } |
2926 | 269 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
270 virtual void do_blink_matching_paren (bool) { } |
2926 | 271 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
272 virtual bool do_erase_empty_line (bool) { return false; } |
2926 | 273 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
274 virtual void do_set_basic_word_break_characters (const std::string&) { } |
2926 | 275 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
276 virtual void do_set_completer_word_break_characters (const std::string&) { } |
19378
f7ccd02bc060
provide access to the readline variable rl_erase_empty_line
John W. Eaton <jwe@octave.org>
parents:
19309
diff
changeset
|
277 |
21798
12e7456f7619
Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21752
diff
changeset
|
278 virtual void do_set_completer_word_break_hook (completion_hook_fcn) { } |
12e7456f7619
Tab completion of multiple directory levels. (bug #44095)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21752
diff
changeset
|
279 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
280 virtual void do_set_basic_quote_characters (const std::string&) { } |
3933 | 281 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
282 virtual void do_set_filename_quote_characters (const std::string&) { } |
3933 | 283 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
284 virtual void do_set_completer_quote_characters (const std::string&) { } |
2926 | 285 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
286 virtual void do_set_completion_append_character (char) { } |
6979 | 287 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
288 virtual void do_set_completion_function (completion_fcn) { } |
6979 | 289 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
290 virtual void do_set_quoting_function (quoting_fcn) { } |
2926 | 291 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
292 virtual void do_set_dequoting_function (dequoting_fcn) { } |
2941 | 293 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
294 virtual void do_set_char_is_quoted_function (char_is_quoted_fcn) { } |
6979 | 295 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
296 virtual void do_set_user_accept_line_function (user_accept_line_fcn) { } |
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
297 |
23795
980f39c3ab90
Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents:
23615
diff
changeset
|
298 virtual completion_fcn do_get_completion_function (void) const { return nullptr; } |
6979 | 299 |
23795
980f39c3ab90
Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents:
23615
diff
changeset
|
300 virtual quoting_fcn do_get_quoting_function (void) const { return nullptr; } |
6979 | 301 |
23795
980f39c3ab90
Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents:
23615
diff
changeset
|
302 virtual dequoting_fcn do_get_dequoting_function (void) const { return nullptr; } |
6979 | 303 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
304 virtual char_is_quoted_fcn do_get_char_is_quoted_function (void) const |
23795
980f39c3ab90
Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents:
23615
diff
changeset
|
305 { return nullptr; } |
2926 | 306 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
307 virtual user_accept_line_fcn do_get_user_accept_line_function (void) const |
23795
980f39c3ab90
Use C++11 nullptr rather than 0 in code (bug #51565).
Rik <rik@octave.org>
parents:
23615
diff
changeset
|
308 { return nullptr; } |
6979 | 309 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
310 virtual string_vector |
22402
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
311 do_generate_filename_completions (const std::string& text) = 0; |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
312 |
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
313 virtual std::string do_get_line_buffer (void) const = 0; |
6979 | 314 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
315 virtual std::string do_get_current_line (void) const = 0; |
6979 | 316 |
22171
0a4c5a90f286
Allow tab completion of arrays of structures.
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21862
diff
changeset
|
317 virtual char do_get_prev_char (int) const = 0; |
0a4c5a90f286
Allow tab completion of arrays of structures.
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21862
diff
changeset
|
318 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
319 virtual void do_replace_line (const std::string& text, bool clear_undo) = 0; |
4604 | 320 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
321 virtual void do_kill_full_line (void) = 0; |
9485
3cee58bf4acf
selectively complete filenames in some cases
John W. Eaton <jwe@octave.org>
parents:
9321
diff
changeset
|
322 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
323 virtual void do_insert_text (const std::string& text) = 0; |
16570
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
324 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
325 virtual void do_newline (void) = 0; |
16570
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
326 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
327 virtual void do_accept_line (void) = 0; |
19702
c048358da712
also kill pending input line when gui command window is cleared (bug #44015)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
328 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
329 virtual bool do_undo (void) { return false; } |
2926 | 330 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
331 virtual void do_clear_undo_list (void) { } |
2926 | 332 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
333 virtual void set_startup_hook (startup_hook_fcn) { } |
6979 | 334 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
335 virtual void restore_startup_hook (void) { } |
16539
8ea8df0747e9
make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents:
16537
diff
changeset
|
336 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
337 virtual void set_pre_input_hook (pre_input_hook_fcn) { } |
2926 | 338 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
339 virtual void restore_pre_input_hook (void) { } |
2926 | 340 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
341 virtual void set_event_hook (event_hook_fcn) { } |
2926 | 342 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
343 virtual void restore_event_hook (void) { } |
16570
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
344 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
345 virtual void do_read_init_file (const std::string&) { } |
16570
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
346 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
347 virtual void do_re_read_init_file (void) { } |
3215 | 348 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
349 virtual bool do_filename_completion_desired (bool) { return false; } |
3215 | 350 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
351 virtual bool do_filename_quoting_desired (bool) { return false; } |
3189 | 352 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
353 virtual bool do_prefer_env_winsize (bool) { return false; } |
7758
8e14a01ffe9f
input.cc (Fre_read_readline_init_file): new function
John W. Eaton <jwe@octave.org>
parents:
7017
diff
changeset
|
354 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
355 virtual void do_interrupt (bool) { } |
4143 | 356 |
24520
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
23795
diff
changeset
|
357 virtual void do_handle_interrupt_signal (void) { } |
c5c11b07598a
refactor signal handling (bug #52757)
John W. Eaton <jwe@octave.org>
parents:
23795
diff
changeset
|
358 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
359 int do_insert_initial_input (void); |
6979 | 360 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
361 int read_octal (const std::string& s); |
19304
ad93e9be78ee
command_editor: provide access to rl_prefer_env_winsize
John W. Eaton <jwe@octave.org>
parents:
17769
diff
changeset
|
362 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
363 void error (int); |
16382
389b09a914e2
allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents:
15271
diff
changeset
|
364 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
365 void error (const std::string&); |
16570
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
366 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
367 // The current command number. |
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
368 int command_number; |
2926 | 369 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
370 bool interrupted; |
2926 | 371 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
372 std::string initial_input; |
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
373 }; |
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
374 } |
16382
389b09a914e2
allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents:
15271
diff
changeset
|
375 |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
376 #if defined (OCTAVE_USE_DEPRECATED_FUNCTIONS) |
16570
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
377 |
23615
be7b884ac589
use version number in OCTAVE_DEPRECATED macro
John W. Eaton <jwe@octave.org>
parents:
23446
diff
changeset
|
378 OCTAVE_DEPRECATED (4.2, "use 'octave::command_editor' instead") |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
379 typedef octave::command_editor command_editor; |
2926 | 380 |
381 #endif | |
21748
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
382 |
176536b15d68
use namespace for command_editor and command_history classes
John W. Eaton <jwe@octave.org>
parents:
21244
diff
changeset
|
383 #endif |