Mercurial > octave
annotate liboctave/util/oct-rl-edit.c @ 21202:f7121e111991
maint: indent #ifdef blocks in liboctave and src directories.
* Array-C.cc, Array-b.cc, Array-ch.cc, Array-d.cc, Array-f.cc, Array-fC.cc,
Array-i.cc, Array-idx-vec.cc, Array-s.cc, Array-str.cc, Array-util.cc,
Array-voidp.cc, Array.cc, CColVector.cc, CDiagMatrix.cc, CMatrix.cc,
CNDArray.cc, CRowVector.cc, CSparse.cc, CSparse.h, DiagArray2.cc, MArray-C.cc,
MArray-d.cc, MArray-f.cc, MArray-fC.cc, MArray-i.cc, MArray-s.cc, MArray.cc,
MDiagArray2.cc, MSparse-C.cc, MSparse-d.cc, MSparse.h, MatrixType.cc,
PermMatrix.cc, Range.cc, Sparse-C.cc, Sparse-b.cc, Sparse-d.cc, Sparse.cc,
boolMatrix.cc, boolNDArray.cc, boolSparse.cc, chMatrix.cc, chNDArray.cc,
dColVector.cc, dDiagMatrix.cc, dMatrix.cc, dNDArray.cc, dRowVector.cc,
dSparse.cc, dSparse.h, dim-vector.cc, fCColVector.cc, fCDiagMatrix.cc,
fCMatrix.cc, fCNDArray.cc, fCRowVector.cc, fColVector.cc, fDiagMatrix.cc,
fMatrix.cc, fNDArray.cc, fRowVector.cc, idx-vector.cc, int16NDArray.cc,
int32NDArray.cc, int64NDArray.cc, int8NDArray.cc, intNDArray.cc,
uint16NDArray.cc, uint32NDArray.cc, uint64NDArray.cc, uint8NDArray.cc,
blaswrap.c, cquit.c, f77-extern.cc, f77-fcn.c, f77-fcn.h, lo-error.c, quit.cc,
quit.h, CmplxAEPBAL.cc, CmplxCHOL.cc, CmplxGEPBAL.cc, CmplxHESS.cc, CmplxLU.cc,
CmplxQR.cc, CmplxQRP.cc, CmplxSCHUR.cc, CmplxSVD.cc, CollocWt.cc, DASPK.cc,
DASRT.cc, DASSL.cc, EIG.cc, LSODE.cc, ODES.cc, Quad.cc, base-lu.cc, base-qr.cc,
dbleAEPBAL.cc, dbleCHOL.cc, dbleGEPBAL.cc, dbleHESS.cc, dbleLU.cc, dbleQR.cc,
dbleQRP.cc, dbleSCHUR.cc, dbleSVD.cc, eigs-base.cc, fCmplxAEPBAL.cc,
fCmplxCHOL.cc, fCmplxGEPBAL.cc, fCmplxHESS.cc, fCmplxLU.cc, fCmplxQR.cc,
fCmplxQRP.cc, fCmplxSCHUR.cc, fCmplxSVD.cc, fEIG.cc, floatAEPBAL.cc,
floatCHOL.cc, floatGEPBAL.cc, floatHESS.cc, floatLU.cc, floatQR.cc,
floatQRP.cc, floatSCHUR.cc, floatSVD.cc, lo-mappers.cc, lo-specfun.cc,
oct-convn.cc, oct-fftw.cc, oct-fftw.h, oct-norm.cc, oct-rand.cc,
oct-spparms.cc, randgamma.c, randmtzig.c, randpoisson.c, sparse-chol.cc,
sparse-dmsolve.cc, sparse-lu.cc, sparse-qr.cc, mx-defs.h, dir-ops.cc,
file-ops.cc, file-stat.cc, lo-sysdep.cc, mach-info.cc, oct-env.cc,
oct-group.cc, oct-openmp.h, oct-passwd.cc, oct-syscalls.cc, oct-time.cc,
oct-uname.cc, pathlen.h, sysdir.h, syswait.h, cmd-edit.cc, cmd-hist.cc,
data-conv.cc, f2c-main.c, glob-match.cc, lo-array-errwarn.cc,
lo-array-gripes.cc, lo-cutils.c, lo-cutils.h, lo-ieee.cc, lo-math.h,
lo-regexp.cc, lo-utils.cc, oct-base64.cc, oct-glob.cc, oct-inttypes.cc,
oct-inttypes.h, oct-locbuf.cc, oct-mutex.cc, oct-refcount.h, oct-rl-edit.c,
oct-rl-hist.c, oct-shlib.cc, oct-sort.cc, pathsearch.cc, singleton-cleanup.cc,
sparse-sort.cc, sparse-util.cc, statdefs.h, str-vec.cc, unwind-prot.cc,
url-transfer.cc, display-available.h, main-cli.cc, main-gui.cc, main.in.cc,
mkoctfile.in.cc, octave-config.in.cc, shared-fcns.h:
indent #ifdef blocks in liboctave and src directories.
author | Rik <rik@octave.org> |
---|---|
date | Sat, 06 Feb 2016 06:40:13 -0800 |
parents | 258c787cd9ce |
children | 40de9f8f23a6 |
rev | line source |
---|---|
3519 | 1 /* |
2 | |
19697
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
19380
diff
changeset
|
3 Copyright (C) 2000-2015 John W. Eaton |
3519 | 4 |
5 This file is part of Octave. | |
6 | |
7 Octave is free software; you can redistribute it and/or modify it | |
8 under the terms of the GNU General Public License as published by the | |
7016 | 9 Free Software Foundation; either version 3 of the License, or (at your |
10 option) any later version. | |
3519 | 11 |
12 Octave is distributed in the hope that it will be useful, but WITHOUT | |
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
15 for more details. | |
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/>. | |
3519 | 20 |
21 */ | |
22 | |
23 #ifdef HAVE_CONFIG_H | |
21202
f7121e111991
maint: indent #ifdef blocks in liboctave and src directories.
Rik <rik@octave.org>
parents:
21066
diff
changeset
|
24 # include <config.h> |
3519 | 25 #endif |
26 | |
27 #if defined (USE_READLINE) | |
28 | |
29 #include <stdio.h> | |
30 #include <stdlib.h> | |
31 | |
32 #include <readline/readline.h> | |
33 | |
34 #include "oct-rl-edit.h" | |
35 | |
3933 | 36 #define OCTAVE_RL_SAVE_STRING(ss, s) \ |
37 static char *ss = 0; \ | |
38 \ | |
39 if (ss) \ | |
40 { \ | |
41 free (ss); \ | |
42 ss = 0; \ | |
43 } \ | |
44 \ | |
45 ss = malloc (strlen (s) + 1); \ | |
46 \ | |
47 strcpy (ss, s) | |
48 | |
6979 | 49 void |
50 octave_rl_redisplay (void) | |
51 { | |
52 rl_redisplay (); | |
53 } | |
54 | |
3519 | 55 int |
56 octave_rl_screen_height (void) | |
57 { | |
3779 | 58 int rows, cols; |
59 rl_get_screen_size (&rows, &cols); | |
60 return rows; | |
3519 | 61 } |
62 | |
63 int | |
64 octave_rl_screen_width (void) | |
65 { | |
3779 | 66 int rows, cols; |
67 rl_get_screen_size (&rows, &cols); | |
68 return cols; | |
3519 | 69 } |
70 | |
71 void | |
3779 | 72 octave_rl_enable_paren_matching (int val) |
3519 | 73 { |
3779 | 74 rl_variable_bind ("blink-matching-paren", val ? "1" : "0"); |
3519 | 75 } |
76 | |
19378
f7ccd02bc060
provide access to the readline variable rl_erase_empty_line
John W. Eaton <jwe@octave.org>
parents:
19309
diff
changeset
|
77 int |
f7ccd02bc060
provide access to the readline variable rl_erase_empty_line
John W. Eaton <jwe@octave.org>
parents:
19309
diff
changeset
|
78 octave_rl_erase_empty_line (int val) |
f7ccd02bc060
provide access to the readline variable rl_erase_empty_line
John W. Eaton <jwe@octave.org>
parents:
19309
diff
changeset
|
79 { |
f7ccd02bc060
provide access to the readline variable rl_erase_empty_line
John W. Eaton <jwe@octave.org>
parents:
19309
diff
changeset
|
80 int retval = rl_erase_empty_line; |
f7ccd02bc060
provide access to the readline variable rl_erase_empty_line
John W. Eaton <jwe@octave.org>
parents:
19309
diff
changeset
|
81 rl_erase_empty_line = val; |
f7ccd02bc060
provide access to the readline variable rl_erase_empty_line
John W. Eaton <jwe@octave.org>
parents:
19309
diff
changeset
|
82 return retval; |
f7ccd02bc060
provide access to the readline variable rl_erase_empty_line
John W. Eaton <jwe@octave.org>
parents:
19309
diff
changeset
|
83 } |
f7ccd02bc060
provide access to the readline variable rl_erase_empty_line
John W. Eaton <jwe@octave.org>
parents:
19309
diff
changeset
|
84 |
3946 | 85 /* It would be much simpler if we could just call _rl_clear_screen to |
86 only clear the screen, but it is not a public function, and on some | |
87 systems, it is not exported from shared library versions of | |
88 readline, so we can't use it. | |
89 | |
90 Instead, temporarily redefine the redisplay function to do nothing. | |
91 | |
21066
258c787cd9ce
maint: Use "FIXME:" consistently in code base.
Rik <rik@octave.org>
parents:
20919
diff
changeset
|
92 FIXME: It would be safer to do this when protected from interrupts... */ |
3856 | 93 |
94 static void | |
5394 | 95 flush_stdout (void) |
3856 | 96 { |
5394 | 97 fflush (stdout); |
3856 | 98 } |
99 | |
3519 | 100 void |
16537
106a38d7b396
optionall disable redisplay in command editor clear screen function
John W. Eaton <jwe@octave.org>
parents:
16536
diff
changeset
|
101 octave_rl_clear_screen (int skip_redisplay) |
3519 | 102 { |
3855 | 103 int ignore1 = 0; |
104 int ignore2 = 0; | |
105 | |
16537
106a38d7b396
optionall disable redisplay in command editor clear screen function
John W. Eaton <jwe@octave.org>
parents:
16536
diff
changeset
|
106 if (skip_redisplay) |
106a38d7b396
optionall disable redisplay in command editor clear screen function
John W. Eaton <jwe@octave.org>
parents:
16536
diff
changeset
|
107 { |
106a38d7b396
optionall disable redisplay in command editor clear screen function
John W. Eaton <jwe@octave.org>
parents:
16536
diff
changeset
|
108 rl_voidfunc_t *saved_redisplay_function = rl_redisplay_function; |
106a38d7b396
optionall disable redisplay in command editor clear screen function
John W. Eaton <jwe@octave.org>
parents:
16536
diff
changeset
|
109 |
106a38d7b396
optionall disable redisplay in command editor clear screen function
John W. Eaton <jwe@octave.org>
parents:
16536
diff
changeset
|
110 rl_redisplay_function = flush_stdout; |
3855 | 111 |
16537
106a38d7b396
optionall disable redisplay in command editor clear screen function
John W. Eaton <jwe@octave.org>
parents:
16536
diff
changeset
|
112 rl_clear_screen (ignore1, ignore2); |
3856 | 113 |
16537
106a38d7b396
optionall disable redisplay in command editor clear screen function
John W. Eaton <jwe@octave.org>
parents:
16536
diff
changeset
|
114 rl_redisplay_function = saved_redisplay_function; |
106a38d7b396
optionall disable redisplay in command editor clear screen function
John W. Eaton <jwe@octave.org>
parents:
16536
diff
changeset
|
115 } |
106a38d7b396
optionall disable redisplay in command editor clear screen function
John W. Eaton <jwe@octave.org>
parents:
16536
diff
changeset
|
116 else |
106a38d7b396
optionall disable redisplay in command editor clear screen function
John W. Eaton <jwe@octave.org>
parents:
16536
diff
changeset
|
117 rl_clear_screen (ignore1, ignore2); |
3519 | 118 } |
119 | |
120 void | |
121 octave_rl_resize_terminal (void) | |
122 { | |
123 rl_resize_terminal (); | |
124 } | |
125 | |
126 void | |
19309
735bc47d18af
command_editor: provide access to rl_set_screen_size
John W. Eaton <jwe@octave.org>
parents:
19304
diff
changeset
|
127 octave_rl_set_screen_size (int ht, int wd) |
735bc47d18af
command_editor: provide access to rl_set_screen_size
John W. Eaton <jwe@octave.org>
parents:
19304
diff
changeset
|
128 { |
735bc47d18af
command_editor: provide access to rl_set_screen_size
John W. Eaton <jwe@octave.org>
parents:
19304
diff
changeset
|
129 rl_set_screen_size (ht, wd); |
735bc47d18af
command_editor: provide access to rl_set_screen_size
John W. Eaton <jwe@octave.org>
parents:
19304
diff
changeset
|
130 } |
735bc47d18af
command_editor: provide access to rl_set_screen_size
John W. Eaton <jwe@octave.org>
parents:
19304
diff
changeset
|
131 |
735bc47d18af
command_editor: provide access to rl_set_screen_size
John W. Eaton <jwe@octave.org>
parents:
19304
diff
changeset
|
132 void |
3519 | 133 octave_rl_restore_terminal_state () |
134 { | |
135 if (rl_deprep_term_function) | |
136 rl_deprep_term_function (); | |
137 } | |
138 | |
16570
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
139 char * |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
140 octave_rl_copy_line (void) |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
141 { |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
142 return rl_copy_text (0, rl_end); |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
143 } |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
144 |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
145 void |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
146 octave_rl_replace_line (const char *s, int clear_undo) |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
147 { |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
148 rl_replace_line (s, clear_undo); |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
149 } |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
150 |
3519 | 151 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
|
152 octave_rl_kill_full_line (void) |
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 { |
c048358da712
also kill pending input line when gui command window is cleared (bug #44015)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
154 rl_kill_full_line (0, 0); |
c048358da712
also kill pending input line when gui command window is cleared (bug #44015)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
155 } |
c048358da712
also kill pending input line when gui command window is cleared (bug #44015)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
156 |
c048358da712
also kill pending input line when gui command window is cleared (bug #44015)
John W. Eaton <jwe@octave.org>
parents:
19697
diff
changeset
|
157 void |
3519 | 158 octave_rl_insert_text (const char *s) |
159 { | |
160 rl_insert_text (s); | |
161 } | |
162 | |
6979 | 163 int |
164 octave_rl_newline (int count, int key) | |
3519 | 165 { |
6979 | 166 return rl_newline (count, key); |
167 } | |
168 | |
169 const char * | |
170 octave_rl_line_buffer (void) | |
171 { | |
172 return rl_line_buffer; | |
3519 | 173 } |
174 | |
16539
8ea8df0747e9
make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents:
16537
diff
changeset
|
175 int |
8ea8df0747e9
make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents:
16537
diff
changeset
|
176 octave_rl_do_undo (void) |
8ea8df0747e9
make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents:
16537
diff
changeset
|
177 { |
8ea8df0747e9
make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents:
16537
diff
changeset
|
178 return rl_do_undo (); |
8ea8df0747e9
make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents:
16537
diff
changeset
|
179 } |
8ea8df0747e9
make undo button and menu item work for command window
John W. Eaton <jwe@octave.org>
parents:
16537
diff
changeset
|
180 |
3519 | 181 void |
182 octave_rl_clear_undo_list (void) | |
183 { | |
184 if (rl_undo_list) | |
185 { | |
3779 | 186 rl_free_undo_list (); |
3519 | 187 |
188 rl_undo_list = 0; | |
189 } | |
190 } | |
191 | |
192 void | |
193 octave_rl_set_name (const char *n) | |
194 { | |
3933 | 195 OCTAVE_RL_SAVE_STRING (nm, n); |
3519 | 196 |
197 rl_readline_name = nm; | |
198 | |
199 /* Since we've already called rl_initialize, we need to re-read the | |
200 init file to take advantage of the conditional parsing feature | |
201 based on rl_readline_name; */ | |
202 | |
3779 | 203 rl_re_read_init_file (0, 0); |
3519 | 204 } |
205 | |
206 char * | |
207 octave_rl_readline (const char *prompt) | |
208 { | |
209 return readline (prompt); | |
210 } | |
211 | |
212 void | |
213 octave_rl_set_input_stream (FILE *f) | |
214 { | |
215 rl_instream = f; | |
216 } | |
217 | |
218 FILE * | |
219 octave_rl_get_input_stream (void) | |
220 { | |
221 return rl_instream; | |
222 } | |
223 | |
224 void | |
225 octave_rl_set_output_stream (FILE *f) | |
226 { | |
227 rl_outstream = f; | |
228 } | |
229 | |
230 FILE * | |
231 octave_rl_get_output_stream (void) | |
232 { | |
233 return rl_outstream; | |
234 } | |
235 | |
236 void | |
237 octave_rl_read_init_file (const char *f) | |
238 { | |
7757
4ff9a6fdde42
Load the default inputrc when calling read_readline_init_file()
Rafael Laboissiere <rafael@debian.org>
parents:
7017
diff
changeset
|
239 rl_read_init_file (f); |
3519 | 240 } |
241 | |
7758
8e14a01ffe9f
input.cc (Fre_read_readline_init_file): new function
John W. Eaton <jwe@octave.org>
parents:
7757
diff
changeset
|
242 void |
8e14a01ffe9f
input.cc (Fre_read_readline_init_file): new function
John W. Eaton <jwe@octave.org>
parents:
7757
diff
changeset
|
243 octave_rl_re_read_init_file (void) |
8e14a01ffe9f
input.cc (Fre_read_readline_init_file): new function
John W. Eaton <jwe@octave.org>
parents:
7757
diff
changeset
|
244 { |
8e14a01ffe9f
input.cc (Fre_read_readline_init_file): new function
John W. Eaton <jwe@octave.org>
parents:
7757
diff
changeset
|
245 rl_re_read_init_file (0, 0); |
8e14a01ffe9f
input.cc (Fre_read_readline_init_file): new function
John W. Eaton <jwe@octave.org>
parents:
7757
diff
changeset
|
246 } |
8e14a01ffe9f
input.cc (Fre_read_readline_init_file): new function
John W. Eaton <jwe@octave.org>
parents:
7757
diff
changeset
|
247 |
4143 | 248 int |
249 octave_rl_filename_completion_desired (int arg) | |
250 { | |
251 int retval = rl_filename_completion_desired; | |
252 rl_filename_completion_desired = arg; | |
253 return retval; | |
254 } | |
255 | |
6979 | 256 int |
257 octave_rl_filename_quoting_desired (int arg) | |
258 { | |
259 int retval = rl_filename_quoting_desired; | |
260 rl_filename_quoting_desired = arg; | |
261 return retval; | |
262 } | |
263 | |
19304
ad93e9be78ee
command_editor: provide access to rl_prefer_env_winsize
John W. Eaton <jwe@octave.org>
parents:
17958
diff
changeset
|
264 int |
ad93e9be78ee
command_editor: provide access to rl_prefer_env_winsize
John W. Eaton <jwe@octave.org>
parents:
17958
diff
changeset
|
265 octave_rl_prefer_env_winsize (int arg) |
ad93e9be78ee
command_editor: provide access to rl_prefer_env_winsize
John W. Eaton <jwe@octave.org>
parents:
17958
diff
changeset
|
266 { |
ad93e9be78ee
command_editor: provide access to rl_prefer_env_winsize
John W. Eaton <jwe@octave.org>
parents:
17958
diff
changeset
|
267 int retval = rl_prefer_env_winsize; |
ad93e9be78ee
command_editor: provide access to rl_prefer_env_winsize
John W. Eaton <jwe@octave.org>
parents:
17958
diff
changeset
|
268 rl_prefer_env_winsize = arg; |
ad93e9be78ee
command_editor: provide access to rl_prefer_env_winsize
John W. Eaton <jwe@octave.org>
parents:
17958
diff
changeset
|
269 return retval; |
ad93e9be78ee
command_editor: provide access to rl_prefer_env_winsize
John W. Eaton <jwe@octave.org>
parents:
17958
diff
changeset
|
270 } |
ad93e9be78ee
command_editor: provide access to rl_prefer_env_winsize
John W. Eaton <jwe@octave.org>
parents:
17958
diff
changeset
|
271 |
16382
389b09a914e2
allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents:
15271
diff
changeset
|
272 void |
389b09a914e2
allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents:
15271
diff
changeset
|
273 octave_rl_done (int arg) |
389b09a914e2
allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents:
15271
diff
changeset
|
274 { |
389b09a914e2
allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents:
15271
diff
changeset
|
275 rl_done = arg; |
389b09a914e2
allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents:
15271
diff
changeset
|
276 } |
389b09a914e2
allow gui to force readline to return from its idle/read loop
John W. Eaton <jwe@octave.org>
parents:
15271
diff
changeset
|
277 |
4604 | 278 char * |
279 octave_rl_filename_completion_function (const char *text, int state) | |
280 { | |
281 return rl_filename_completion_function (text, state); | |
282 } | |
283 | |
3519 | 284 void |
3933 | 285 octave_rl_set_basic_word_break_characters (const char *s) |
286 { | |
287 OCTAVE_RL_SAVE_STRING (ss, s); | |
288 | |
289 rl_basic_word_break_characters = ss; | |
290 } | |
291 | |
292 void | |
293 octave_rl_set_completer_word_break_characters (const char *s) | |
294 { | |
295 OCTAVE_RL_SAVE_STRING (ss, s); | |
296 | |
297 rl_completer_word_break_characters = ss; | |
298 } | |
299 | |
300 void | |
3519 | 301 octave_rl_set_basic_quote_characters (const char *s) |
302 { | |
3933 | 303 OCTAVE_RL_SAVE_STRING (ss, s); |
3519 | 304 |
305 rl_basic_quote_characters = ss; | |
306 } | |
307 | |
308 void | |
6979 | 309 octave_rl_set_filename_quote_characters (const char *s) |
310 { | |
311 OCTAVE_RL_SAVE_STRING (ss, s); | |
312 | |
313 rl_filename_quote_characters = ss; | |
314 } | |
315 | |
316 void | |
317 octave_rl_set_completer_quote_characters (const char *s) | |
318 { | |
319 OCTAVE_RL_SAVE_STRING (ss, s); | |
320 | |
321 rl_completer_quote_characters = ss; | |
322 } | |
323 | |
324 void | |
3519 | 325 octave_rl_set_completion_append_character (char c) |
326 { | |
327 rl_completion_append_character = c; | |
328 } | |
329 | |
330 void | |
331 octave_rl_set_completion_function (rl_attempted_completion_fcn_ptr f) | |
332 { | |
333 rl_attempted_completion_function = f; | |
334 } | |
335 | |
336 void | |
6979 | 337 octave_rl_set_quoting_function (rl_quoting_fcn_ptr f) |
338 { | |
339 rl_filename_quoting_function = f; | |
340 } | |
341 | |
342 void | |
343 octave_rl_set_dequoting_function (rl_dequoting_fcn_ptr f) | |
344 { | |
345 rl_filename_dequoting_function = f; | |
346 } | |
347 | |
348 void | |
349 octave_rl_set_char_is_quoted_function (rl_char_is_quoted_fcn_ptr f) | |
350 { | |
351 rl_char_is_quoted_p = f; | |
352 } | |
353 | |
354 void | |
3519 | 355 octave_rl_set_startup_hook (rl_startup_hook_fcn_ptr f) |
356 { | |
4802 | 357 rl_startup_hook = f; |
3519 | 358 } |
359 | |
360 rl_startup_hook_fcn_ptr | |
361 octave_rl_get_startup_hook (void) | |
362 { | |
4802 | 363 return rl_startup_hook; |
3519 | 364 } |
365 | |
366 void | |
16570
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
367 octave_rl_set_pre_input_hook (rl_pre_input_hook_fcn_ptr f) |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
368 { |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
369 rl_pre_input_hook = f; |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
370 } |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
371 |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
372 rl_pre_input_hook_fcn_ptr |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
373 octave_rl_get_pre_input_hook (void) |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
374 { |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
375 return rl_pre_input_hook; |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
376 } |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
377 |
d5ae5aa80d42
preserve pending command line input when running commands from GUI actions
John W. Eaton <jwe@octave.org>
parents:
16539
diff
changeset
|
378 void |
3519 | 379 octave_rl_set_event_hook (rl_event_hook_fcn_ptr f) |
380 { | |
4802 | 381 rl_event_hook = f; |
3519 | 382 } |
383 | |
384 rl_event_hook_fcn_ptr | |
385 octave_rl_get_event_hook (void) | |
386 { | |
4802 | 387 return rl_event_hook; |
3519 | 388 } |
389 | |
390 char ** | |
391 octave_rl_completion_matches (const char *text, rl_completer_fcn_ptr f) | |
392 { | |
3779 | 393 return rl_completion_matches (text, f); |
3519 | 394 } |
395 | |
396 char | |
397 octave_rl_prompt_start_ignore (void) | |
398 { | |
399 return RL_PROMPT_START_IGNORE; | |
400 } | |
401 | |
402 char | |
403 octave_rl_prompt_end_ignore (void) | |
404 { | |
405 return RL_PROMPT_END_IGNORE; | |
406 } | |
407 | |
408 void | |
20919
cfb58d9805fa
eliminate some type conversion warnings
John W. Eaton <jwe@octave.org>
parents:
19702
diff
changeset
|
409 octave_rl_add_defun (const char *name, rl_fcn_ptr f, int key) |
3519 | 410 { |
411 rl_add_defun (name, f, key); | |
412 } | |
413 | |
414 void | |
415 octave_rl_set_terminal_name (const char *term) | |
416 { | |
10102
8b4e3388a254
oct-rl-edit.c (octave_rl_set_terminal_name): save term string before setting rl_terminal_name
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
417 OCTAVE_RL_SAVE_STRING (saved_term, term); |
8b4e3388a254
oct-rl-edit.c (octave_rl_set_terminal_name): save term string before setting rl_terminal_name
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
418 |
8b4e3388a254
oct-rl-edit.c (octave_rl_set_terminal_name): save term string before setting rl_terminal_name
John W. Eaton <jwe@octave.org>
parents:
8920
diff
changeset
|
419 rl_terminal_name = saved_term; |
3519 | 420 } |
421 | |
422 void | |
423 octave_rl_initialize (void) | |
424 { | |
17958
1adf3710bb68
Working CTRL-C handling implementation for Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
17744
diff
changeset
|
425 #if defined (__WIN32__) && ! defined (__CYGWIN__) |
1adf3710bb68
Working CTRL-C handling implementation for Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
17744
diff
changeset
|
426 rl_catch_signals = 0; |
1adf3710bb68
Working CTRL-C handling implementation for Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
17744
diff
changeset
|
427 #endif |
1adf3710bb68
Working CTRL-C handling implementation for Win32.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
17744
diff
changeset
|
428 |
3519 | 429 rl_initialize (); |
430 } | |
431 | |
432 int | |
433 octave_rl_history_search_forward (int count, int ignore) | |
434 { | |
435 return rl_history_search_forward (count, ignore); | |
436 } | |
437 | |
438 int | |
439 octave_rl_history_search_backward (int count, int ignore) | |
440 { | |
441 return rl_history_search_backward (count, ignore); | |
442 } | |
443 | |
20919
cfb58d9805fa
eliminate some type conversion warnings
John W. Eaton <jwe@octave.org>
parents:
19702
diff
changeset
|
444 int |
3519 | 445 octave_rl_ctrl (char c) |
446 { | |
447 return CTRL (c); | |
448 } | |
449 | |
20919
cfb58d9805fa
eliminate some type conversion warnings
John W. Eaton <jwe@octave.org>
parents:
19702
diff
changeset
|
450 int |
3519 | 451 octave_rl_meta (char c) |
452 { | |
453 return META (c); | |
454 } | |
455 | |
456 #endif |