1 |
330 |
jeremybenn |
/* rlprivate.h -- functions and variables global to the readline library,
|
2 |
|
|
but not intended for use by applications. */
|
3 |
|
|
|
4 |
|
|
/* Copyright (C) 1999-2005 Free Software Foundation, Inc.
|
5 |
|
|
|
6 |
|
|
This file is part of the GNU Readline Library, a library for
|
7 |
|
|
reading lines of text with interactive input and history editing.
|
8 |
|
|
|
9 |
|
|
The GNU Readline Library is free software; you can redistribute it
|
10 |
|
|
and/or modify it under the terms of the GNU General Public License
|
11 |
|
|
as published by the Free Software Foundation; either version 2, or
|
12 |
|
|
(at your option) any later version.
|
13 |
|
|
|
14 |
|
|
The GNU Readline Library is distributed in the hope that it will be
|
15 |
|
|
useful, but WITHOUT ANY WARRANTY; without even the implied warranty
|
16 |
|
|
of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17 |
|
|
GNU General Public License for more details.
|
18 |
|
|
|
19 |
|
|
The GNU General Public License is often shipped with GNU software, and
|
20 |
|
|
is generally kept in a file called COPYING or LICENSE. If you do not
|
21 |
|
|
have a copy of the license, write to the Free Software Foundation,
|
22 |
|
|
59 Temple Place, Suite 330, Boston, MA 02111 USA. */
|
23 |
|
|
|
24 |
|
|
#if !defined (_RL_PRIVATE_H_)
|
25 |
|
|
#define _RL_PRIVATE_H_
|
26 |
|
|
|
27 |
|
|
#include "rlconf.h" /* for VISIBLE_STATS */
|
28 |
|
|
#include "rlstdc.h"
|
29 |
|
|
#include "posixjmp.h" /* defines procenv_t */
|
30 |
|
|
|
31 |
|
|
/*************************************************************************
|
32 |
|
|
* *
|
33 |
|
|
* Global structs undocumented in texinfo manual and not in readline.h *
|
34 |
|
|
* *
|
35 |
|
|
*************************************************************************/
|
36 |
|
|
/* search types */
|
37 |
|
|
#define RL_SEARCH_ISEARCH 0x01 /* incremental search */
|
38 |
|
|
#define RL_SEARCH_NSEARCH 0x02 /* non-incremental search */
|
39 |
|
|
#define RL_SEARCH_CSEARCH 0x04 /* intra-line char search */
|
40 |
|
|
|
41 |
|
|
/* search flags */
|
42 |
|
|
#define SF_REVERSE 0x01
|
43 |
|
|
#define SF_FOUND 0x02
|
44 |
|
|
#define SF_FAILED 0x04
|
45 |
|
|
|
46 |
|
|
typedef struct __rl_search_context
|
47 |
|
|
{
|
48 |
|
|
int type;
|
49 |
|
|
int sflags;
|
50 |
|
|
|
51 |
|
|
char *search_string;
|
52 |
|
|
int search_string_index;
|
53 |
|
|
int search_string_size;
|
54 |
|
|
|
55 |
|
|
char **lines;
|
56 |
|
|
char *allocated_line;
|
57 |
|
|
int hlen;
|
58 |
|
|
int hindex;
|
59 |
|
|
|
60 |
|
|
int save_point;
|
61 |
|
|
int save_mark;
|
62 |
|
|
int save_line;
|
63 |
|
|
int last_found_line;
|
64 |
|
|
char *prev_line_found;
|
65 |
|
|
|
66 |
|
|
UNDO_LIST *save_undo_list;
|
67 |
|
|
|
68 |
|
|
int history_pos;
|
69 |
|
|
int direction;
|
70 |
|
|
|
71 |
|
|
int lastc;
|
72 |
|
|
#if defined (HANDLE_MULTIBYTE)
|
73 |
|
|
char mb[MB_LEN_MAX];
|
74 |
|
|
#endif
|
75 |
|
|
|
76 |
|
|
char *sline;
|
77 |
|
|
int sline_len;
|
78 |
|
|
int sline_index;
|
79 |
|
|
|
80 |
|
|
char *search_terminators;
|
81 |
|
|
} _rl_search_cxt;
|
82 |
|
|
|
83 |
|
|
/* Callback data for reading numeric arguments */
|
84 |
|
|
#define NUM_SAWMINUS 0x01
|
85 |
|
|
#define NUM_SAWDIGITS 0x02
|
86 |
|
|
#define NUM_READONE 0x04
|
87 |
|
|
|
88 |
|
|
typedef int _rl_arg_cxt;
|
89 |
|
|
|
90 |
|
|
/* A context for reading key sequences longer than a single character when
|
91 |
|
|
using the callback interface. */
|
92 |
|
|
#define KSEQ_DISPATCHED 0x01
|
93 |
|
|
#define KSEQ_SUBSEQ 0x02
|
94 |
|
|
#define KSEQ_RECURSIVE 0x04
|
95 |
|
|
|
96 |
|
|
typedef struct __rl_keyseq_context
|
97 |
|
|
{
|
98 |
|
|
int flags;
|
99 |
|
|
int subseq_arg;
|
100 |
|
|
int subseq_retval; /* XXX */
|
101 |
|
|
Keymap dmap;
|
102 |
|
|
|
103 |
|
|
Keymap oldmap;
|
104 |
|
|
int okey;
|
105 |
|
|
struct __rl_keyseq_context *ocxt;
|
106 |
|
|
int childval;
|
107 |
|
|
} _rl_keyseq_cxt;
|
108 |
|
|
|
109 |
|
|
/* fill in more as needed */
|
110 |
|
|
/* `Generic' callback data and functions */
|
111 |
|
|
typedef struct __rl_callback_generic_arg
|
112 |
|
|
{
|
113 |
|
|
int count;
|
114 |
|
|
int i1, i2;
|
115 |
|
|
/* add here as needed */
|
116 |
|
|
} _rl_callback_generic_arg;
|
117 |
|
|
|
118 |
|
|
typedef int _rl_callback_func_t PARAMS((_rl_callback_generic_arg *));
|
119 |
|
|
|
120 |
|
|
/*************************************************************************
|
121 |
|
|
* *
|
122 |
|
|
* Global functions undocumented in texinfo manual and not in readline.h *
|
123 |
|
|
* *
|
124 |
|
|
*************************************************************************/
|
125 |
|
|
|
126 |
|
|
/*************************************************************************
|
127 |
|
|
* *
|
128 |
|
|
* Global variables undocumented in texinfo manual and not in readline.h *
|
129 |
|
|
* *
|
130 |
|
|
*************************************************************************/
|
131 |
|
|
|
132 |
|
|
/* complete.c */
|
133 |
|
|
extern int rl_complete_with_tilde_expansion;
|
134 |
|
|
#if defined (VISIBLE_STATS)
|
135 |
|
|
extern int rl_visible_stats;
|
136 |
|
|
#endif /* VISIBLE_STATS */
|
137 |
|
|
|
138 |
|
|
/* readline.c */
|
139 |
|
|
extern int rl_line_buffer_len;
|
140 |
|
|
extern int rl_arg_sign;
|
141 |
|
|
extern int rl_visible_prompt_length;
|
142 |
|
|
extern int readline_echoing_p;
|
143 |
|
|
extern int rl_key_sequence_length;
|
144 |
|
|
extern int rl_byte_oriented;
|
145 |
|
|
|
146 |
|
|
extern _rl_keyseq_cxt *_rl_kscxt;
|
147 |
|
|
|
148 |
|
|
/* display.c */
|
149 |
|
|
extern int rl_display_fixed;
|
150 |
|
|
|
151 |
|
|
/* parens.c */
|
152 |
|
|
extern int rl_blink_matching_paren;
|
153 |
|
|
|
154 |
|
|
/*************************************************************************
|
155 |
|
|
* *
|
156 |
|
|
* Global functions and variables unsed and undocumented *
|
157 |
|
|
* *
|
158 |
|
|
*************************************************************************/
|
159 |
|
|
|
160 |
|
|
/* kill.c */
|
161 |
|
|
extern int rl_set_retained_kills PARAMS((int));
|
162 |
|
|
|
163 |
|
|
/* terminal.c */
|
164 |
|
|
extern void _rl_set_screen_size PARAMS((int, int));
|
165 |
|
|
|
166 |
|
|
/* undo.c */
|
167 |
|
|
extern int _rl_fix_last_undo_of_type PARAMS((int, int, int));
|
168 |
|
|
|
169 |
|
|
/* util.c */
|
170 |
|
|
extern char *_rl_savestring PARAMS((const char *));
|
171 |
|
|
|
172 |
|
|
/*************************************************************************
|
173 |
|
|
* *
|
174 |
|
|
* Functions and variables private to the readline library *
|
175 |
|
|
* *
|
176 |
|
|
*************************************************************************/
|
177 |
|
|
|
178 |
|
|
/* NOTE: Functions and variables prefixed with `_rl_' are
|
179 |
|
|
pseudo-global: they are global so they can be shared
|
180 |
|
|
between files in the readline library, but are not intended
|
181 |
|
|
to be visible to readline callers. */
|
182 |
|
|
|
183 |
|
|
/*************************************************************************
|
184 |
|
|
* Undocumented private functions *
|
185 |
|
|
*************************************************************************/
|
186 |
|
|
|
187 |
|
|
#if defined(READLINE_CALLBACKS)
|
188 |
|
|
|
189 |
|
|
/* readline.c */
|
190 |
|
|
extern void readline_internal_setup PARAMS((void));
|
191 |
|
|
extern char *readline_internal_teardown PARAMS((int));
|
192 |
|
|
extern int readline_internal_char PARAMS((void));
|
193 |
|
|
|
194 |
|
|
extern _rl_keyseq_cxt *_rl_keyseq_cxt_alloc PARAMS((void));
|
195 |
|
|
extern void _rl_keyseq_cxt_dispose PARAMS((_rl_keyseq_cxt *));
|
196 |
|
|
extern void _rl_keyseq_chain_dispose PARAMS((void));
|
197 |
|
|
|
198 |
|
|
extern int _rl_dispatch_callback PARAMS((_rl_keyseq_cxt *));
|
199 |
|
|
|
200 |
|
|
/* callback.c */
|
201 |
|
|
extern _rl_callback_generic_arg *_rl_callback_data_alloc PARAMS((int));
|
202 |
|
|
extern void _rl_callback_data_dispose PARAMS((_rl_callback_generic_arg *));
|
203 |
|
|
|
204 |
|
|
#endif /* READLINE_CALLBACKS */
|
205 |
|
|
|
206 |
|
|
/* bind.c */
|
207 |
|
|
|
208 |
|
|
/* complete.c */
|
209 |
|
|
extern char _rl_find_completion_word PARAMS((int *, int *));
|
210 |
|
|
extern void _rl_free_match_list PARAMS((char **));
|
211 |
|
|
|
212 |
|
|
/* display.c */
|
213 |
|
|
extern char *_rl_strip_prompt PARAMS((char *));
|
214 |
|
|
extern void _rl_move_cursor_relative PARAMS((int, const char *));
|
215 |
|
|
extern void _rl_move_vert PARAMS((int));
|
216 |
|
|
extern void _rl_save_prompt PARAMS((void));
|
217 |
|
|
extern void _rl_restore_prompt PARAMS((void));
|
218 |
|
|
extern char *_rl_make_prompt_for_search PARAMS((int));
|
219 |
|
|
extern void _rl_erase_at_end_of_line PARAMS((int));
|
220 |
|
|
extern void _rl_clear_to_eol PARAMS((int));
|
221 |
|
|
extern void _rl_clear_screen PARAMS((void));
|
222 |
|
|
extern void _rl_update_final PARAMS((void));
|
223 |
|
|
extern void _rl_redisplay_after_sigwinch PARAMS((void));
|
224 |
|
|
extern void _rl_clean_up_for_exit PARAMS((void));
|
225 |
|
|
extern void _rl_erase_entire_line PARAMS((void));
|
226 |
|
|
extern int _rl_current_display_line PARAMS((void));
|
227 |
|
|
|
228 |
|
|
/* input.c */
|
229 |
|
|
extern int _rl_any_typein PARAMS((void));
|
230 |
|
|
extern int _rl_input_available PARAMS((void));
|
231 |
|
|
extern int _rl_input_queued PARAMS((int));
|
232 |
|
|
extern void _rl_insert_typein PARAMS((int));
|
233 |
|
|
extern int _rl_unget_char PARAMS((int));
|
234 |
|
|
extern int _rl_pushed_input_available PARAMS((void));
|
235 |
|
|
|
236 |
|
|
/* isearch.c */
|
237 |
|
|
extern _rl_search_cxt *_rl_scxt_alloc PARAMS((int, int));
|
238 |
|
|
extern void _rl_scxt_dispose PARAMS((_rl_search_cxt *, int));
|
239 |
|
|
|
240 |
|
|
extern int _rl_isearch_dispatch PARAMS((_rl_search_cxt *, int));
|
241 |
|
|
extern int _rl_isearch_callback PARAMS((_rl_search_cxt *));
|
242 |
|
|
|
243 |
|
|
extern int _rl_search_getchar PARAMS((_rl_search_cxt *));
|
244 |
|
|
|
245 |
|
|
/* macro.c */
|
246 |
|
|
extern void _rl_with_macro_input PARAMS((char *));
|
247 |
|
|
extern int _rl_next_macro_key PARAMS((void));
|
248 |
|
|
extern void _rl_push_executing_macro PARAMS((void));
|
249 |
|
|
extern void _rl_pop_executing_macro PARAMS((void));
|
250 |
|
|
extern void _rl_add_macro_char PARAMS((int));
|
251 |
|
|
extern void _rl_kill_kbd_macro PARAMS((void));
|
252 |
|
|
|
253 |
|
|
/* misc.c */
|
254 |
|
|
extern int _rl_arg_overflow PARAMS((void));
|
255 |
|
|
extern void _rl_arg_init PARAMS((void));
|
256 |
|
|
extern int _rl_arg_getchar PARAMS((void));
|
257 |
|
|
extern int _rl_arg_callback PARAMS((_rl_arg_cxt));
|
258 |
|
|
extern void _rl_reset_argument PARAMS((void));
|
259 |
|
|
|
260 |
|
|
extern void _rl_start_using_history PARAMS((void));
|
261 |
|
|
extern int _rl_free_saved_history_line PARAMS((void));
|
262 |
|
|
extern void _rl_set_insert_mode PARAMS((int, int));
|
263 |
|
|
|
264 |
|
|
/* nls.c */
|
265 |
|
|
extern int _rl_init_eightbit PARAMS((void));
|
266 |
|
|
|
267 |
|
|
/* parens.c */
|
268 |
|
|
extern void _rl_enable_paren_matching PARAMS((int));
|
269 |
|
|
|
270 |
|
|
/* readline.c */
|
271 |
|
|
extern void _rl_init_line_state PARAMS((void));
|
272 |
|
|
extern void _rl_set_the_line PARAMS((void));
|
273 |
|
|
extern int _rl_dispatch PARAMS((int, Keymap));
|
274 |
|
|
extern int _rl_dispatch_subseq PARAMS((int, Keymap, int));
|
275 |
|
|
extern void _rl_internal_char_cleanup PARAMS((void));
|
276 |
|
|
|
277 |
|
|
/* rltty.c */
|
278 |
|
|
extern int _rl_disable_tty_signals PARAMS((void));
|
279 |
|
|
extern int _rl_restore_tty_signals PARAMS((void));
|
280 |
|
|
|
281 |
|
|
/* search.c */
|
282 |
|
|
extern int _rl_nsearch_callback PARAMS((_rl_search_cxt *));
|
283 |
|
|
|
284 |
|
|
/* terminal.c */
|
285 |
|
|
extern void _rl_get_screen_size PARAMS((int, int));
|
286 |
|
|
extern int _rl_init_terminal_io PARAMS((const char *));
|
287 |
|
|
#ifdef _MINIX
|
288 |
|
|
extern void _rl_output_character_function PARAMS((int));
|
289 |
|
|
#else
|
290 |
|
|
extern int _rl_output_character_function PARAMS((int));
|
291 |
|
|
#endif
|
292 |
|
|
extern void _rl_output_some_chars PARAMS((const char *, int));
|
293 |
|
|
extern int _rl_backspace PARAMS((int));
|
294 |
|
|
extern void _rl_enable_meta_key PARAMS((void));
|
295 |
|
|
extern void _rl_control_keypad PARAMS((int));
|
296 |
|
|
extern void _rl_set_cursor PARAMS((int, int));
|
297 |
|
|
|
298 |
|
|
/* text.c */
|
299 |
|
|
extern void _rl_fix_point PARAMS((int));
|
300 |
|
|
extern int _rl_replace_text PARAMS((const char *, int, int));
|
301 |
|
|
extern int _rl_insert_char PARAMS((int, int));
|
302 |
|
|
extern int _rl_overwrite_char PARAMS((int, int));
|
303 |
|
|
extern int _rl_overwrite_rubout PARAMS((int, int));
|
304 |
|
|
extern int _rl_rubout_char PARAMS((int, int));
|
305 |
|
|
#if defined (HANDLE_MULTIBYTE)
|
306 |
|
|
extern int _rl_char_search_internal PARAMS((int, int, char *, int));
|
307 |
|
|
#else
|
308 |
|
|
extern int _rl_char_search_internal PARAMS((int, int, int));
|
309 |
|
|
#endif
|
310 |
|
|
extern int _rl_set_mark_at_pos PARAMS((int));
|
311 |
|
|
|
312 |
|
|
/* util.c */
|
313 |
|
|
extern int _rl_abort_internal PARAMS((void));
|
314 |
|
|
extern char *_rl_strindex PARAMS((const char *, const char *));
|
315 |
|
|
extern int _rl_qsort_string_compare PARAMS((char **, char **));
|
316 |
|
|
extern int (_rl_uppercase_p) PARAMS((int));
|
317 |
|
|
extern int (_rl_lowercase_p) PARAMS((int));
|
318 |
|
|
extern int (_rl_pure_alphabetic) PARAMS((int));
|
319 |
|
|
extern int (_rl_digit_p) PARAMS((int));
|
320 |
|
|
extern int (_rl_to_lower) PARAMS((int));
|
321 |
|
|
extern int (_rl_to_upper) PARAMS((int));
|
322 |
|
|
extern int (_rl_digit_value) PARAMS((int));
|
323 |
|
|
|
324 |
|
|
/* vi_mode.c */
|
325 |
|
|
extern void _rl_vi_initialize_line PARAMS((void));
|
326 |
|
|
extern void _rl_vi_reset_last PARAMS((void));
|
327 |
|
|
extern void _rl_vi_set_last PARAMS((int, int, int));
|
328 |
|
|
extern int _rl_vi_textmod_command PARAMS((int));
|
329 |
|
|
extern void _rl_vi_done_inserting PARAMS((void));
|
330 |
|
|
|
331 |
|
|
/*************************************************************************
|
332 |
|
|
* Undocumented private variables *
|
333 |
|
|
*************************************************************************/
|
334 |
|
|
|
335 |
|
|
/* bind.c */
|
336 |
|
|
extern const char *_rl_possible_control_prefixes[];
|
337 |
|
|
extern const char *_rl_possible_meta_prefixes[];
|
338 |
|
|
|
339 |
|
|
/* callback.c */
|
340 |
|
|
extern _rl_callback_func_t *_rl_callback_func;
|
341 |
|
|
extern _rl_callback_generic_arg *_rl_callback_data;
|
342 |
|
|
|
343 |
|
|
/* complete.c */
|
344 |
|
|
extern int _rl_complete_show_all;
|
345 |
|
|
extern int _rl_complete_show_unmodified;
|
346 |
|
|
extern int _rl_complete_mark_directories;
|
347 |
|
|
extern int _rl_complete_mark_symlink_dirs;
|
348 |
|
|
extern int _rl_print_completions_horizontally;
|
349 |
|
|
extern int _rl_completion_case_fold;
|
350 |
|
|
extern int _rl_match_hidden_files;
|
351 |
|
|
extern int _rl_page_completions;
|
352 |
|
|
|
353 |
|
|
/* display.c */
|
354 |
|
|
extern int _rl_vis_botlin;
|
355 |
|
|
extern int _rl_last_c_pos;
|
356 |
|
|
extern int _rl_suppress_redisplay;
|
357 |
|
|
extern int _rl_want_redisplay;
|
358 |
|
|
extern char *rl_display_prompt;
|
359 |
|
|
|
360 |
|
|
/* isearch.c */
|
361 |
|
|
extern char *_rl_isearch_terminators;
|
362 |
|
|
|
363 |
|
|
extern _rl_search_cxt *_rl_iscxt;
|
364 |
|
|
|
365 |
|
|
/* macro.c */
|
366 |
|
|
extern char *_rl_executing_macro;
|
367 |
|
|
|
368 |
|
|
/* misc.c */
|
369 |
|
|
extern int _rl_history_preserve_point;
|
370 |
|
|
extern int _rl_history_saved_point;
|
371 |
|
|
|
372 |
|
|
extern _rl_arg_cxt _rl_argcxt;
|
373 |
|
|
|
374 |
|
|
/* readline.c */
|
375 |
|
|
extern int _rl_horizontal_scroll_mode;
|
376 |
|
|
extern int _rl_mark_modified_lines;
|
377 |
|
|
extern int _rl_bell_preference;
|
378 |
|
|
extern int _rl_meta_flag;
|
379 |
|
|
extern int _rl_convert_meta_chars_to_ascii;
|
380 |
|
|
extern int _rl_output_meta_chars;
|
381 |
|
|
extern int _rl_bind_stty_chars;
|
382 |
|
|
extern char *_rl_comment_begin;
|
383 |
|
|
extern unsigned char _rl_parsing_conditionalized_out;
|
384 |
|
|
extern Keymap _rl_keymap;
|
385 |
|
|
extern FILE *_rl_in_stream;
|
386 |
|
|
extern FILE *_rl_out_stream;
|
387 |
|
|
extern int _rl_last_command_was_kill;
|
388 |
|
|
extern int _rl_eof_char;
|
389 |
|
|
extern procenv_t readline_top_level;
|
390 |
|
|
|
391 |
|
|
/* search.c */
|
392 |
|
|
extern _rl_search_cxt *_rl_nscxt;
|
393 |
|
|
|
394 |
|
|
/* terminal.c */
|
395 |
|
|
extern int _rl_enable_keypad;
|
396 |
|
|
extern int _rl_enable_meta;
|
397 |
|
|
extern char *_rl_term_clreol;
|
398 |
|
|
extern char *_rl_term_clrpag;
|
399 |
|
|
extern char *_rl_term_im;
|
400 |
|
|
extern char *_rl_term_ic;
|
401 |
|
|
extern char *_rl_term_ei;
|
402 |
|
|
extern char *_rl_term_DC;
|
403 |
|
|
extern char *_rl_term_up;
|
404 |
|
|
extern char *_rl_term_dc;
|
405 |
|
|
extern char *_rl_term_cr;
|
406 |
|
|
extern char *_rl_term_IC;
|
407 |
|
|
extern int _rl_screenheight;
|
408 |
|
|
extern int _rl_screenwidth;
|
409 |
|
|
extern int _rl_screenchars;
|
410 |
|
|
extern int _rl_terminal_can_insert;
|
411 |
|
|
extern int _rl_term_autowrap;
|
412 |
|
|
|
413 |
|
|
/* undo.c */
|
414 |
|
|
extern int _rl_doing_an_undo;
|
415 |
|
|
extern int _rl_undo_group_level;
|
416 |
|
|
|
417 |
|
|
/* vi_mode.c */
|
418 |
|
|
extern int _rl_vi_last_command;
|
419 |
|
|
|
420 |
|
|
#endif /* _RL_PRIVATE_H_ */
|