annotate CSP2/CSP2_env/env-d9b9114564458d9d-741b3de822f2aaca6c6caa4325c4afce/include/readline/readline.h @ 69:33d812a61356

planemo upload commit 2e9511a184a1ca667c7be0c6321a36dc4e3d116d
author jpayne
date Tue, 18 Mar 2025 17:55:14 -0400
parents
children
rev   line source
jpayne@69 1 /* Readline.h -- the names of functions callable from within readline. */
jpayne@69 2
jpayne@69 3 /* Copyright (C) 1987-2022 Free Software Foundation, Inc.
jpayne@69 4
jpayne@69 5 This file is part of the GNU Readline Library (Readline), a library
jpayne@69 6 for reading lines of text with interactive input and history editing.
jpayne@69 7
jpayne@69 8 Readline is free software: you can redistribute it and/or modify
jpayne@69 9 it under the terms of the GNU General Public License as published by
jpayne@69 10 the Free Software Foundation, either version 3 of the License, or
jpayne@69 11 (at your option) any later version.
jpayne@69 12
jpayne@69 13 Readline is distributed in the hope that it will be useful,
jpayne@69 14 but WITHOUT ANY WARRANTY; without even the implied warranty of
jpayne@69 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
jpayne@69 16 GNU General Public License for more details.
jpayne@69 17
jpayne@69 18 You should have received a copy of the GNU General Public License
jpayne@69 19 along with Readline. If not, see <http://www.gnu.org/licenses/>.
jpayne@69 20 */
jpayne@69 21
jpayne@69 22 #if !defined (_READLINE_H_)
jpayne@69 23 #define _READLINE_H_
jpayne@69 24
jpayne@69 25 #ifdef __cplusplus
jpayne@69 26 extern "C" {
jpayne@69 27 #endif
jpayne@69 28
jpayne@69 29 #if defined (READLINE_LIBRARY)
jpayne@69 30 # include "rlstdc.h"
jpayne@69 31 # include "rltypedefs.h"
jpayne@69 32 # include "keymaps.h"
jpayne@69 33 # include "tilde.h"
jpayne@69 34 #else
jpayne@69 35 # include <readline/rlstdc.h>
jpayne@69 36 # include <readline/rltypedefs.h>
jpayne@69 37 # include <readline/keymaps.h>
jpayne@69 38 # include <readline/tilde.h>
jpayne@69 39 #endif
jpayne@69 40
jpayne@69 41 /* Hex-encoded Readline version number. */
jpayne@69 42 #define RL_READLINE_VERSION 0x0802 /* Readline 8.2 */
jpayne@69 43 #define RL_VERSION_MAJOR 8
jpayne@69 44 #define RL_VERSION_MINOR 2
jpayne@69 45
jpayne@69 46 /* Readline data structures. */
jpayne@69 47
jpayne@69 48 /* Maintaining the state of undo. We remember individual deletes and inserts
jpayne@69 49 on a chain of things to do. */
jpayne@69 50
jpayne@69 51 /* The actions that undo knows how to undo. Notice that UNDO_DELETE means
jpayne@69 52 to insert some text, and UNDO_INSERT means to delete some text. I.e.,
jpayne@69 53 the code tells undo what to undo, not how to undo it. */
jpayne@69 54 enum undo_code { UNDO_DELETE, UNDO_INSERT, UNDO_BEGIN, UNDO_END };
jpayne@69 55
jpayne@69 56 /* What an element of THE_UNDO_LIST looks like. */
jpayne@69 57 typedef struct undo_list {
jpayne@69 58 struct undo_list *next;
jpayne@69 59 int start, end; /* Where the change took place. */
jpayne@69 60 char *text; /* The text to insert, if undoing a delete. */
jpayne@69 61 enum undo_code what; /* Delete, Insert, Begin, End. */
jpayne@69 62 } UNDO_LIST;
jpayne@69 63
jpayne@69 64 /* The current undo list for RL_LINE_BUFFER. */
jpayne@69 65 extern UNDO_LIST *rl_undo_list;
jpayne@69 66
jpayne@69 67 /* The data structure for mapping textual names to code addresses. */
jpayne@69 68 typedef struct _funmap {
jpayne@69 69 const char *name;
jpayne@69 70 rl_command_func_t *function;
jpayne@69 71 } FUNMAP;
jpayne@69 72
jpayne@69 73 extern FUNMAP **funmap;
jpayne@69 74
jpayne@69 75 /* **************************************************************** */
jpayne@69 76 /* */
jpayne@69 77 /* Functions available to bind to key sequences */
jpayne@69 78 /* */
jpayne@69 79 /* **************************************************************** */
jpayne@69 80
jpayne@69 81 /* Bindable commands for numeric arguments. */
jpayne@69 82 extern int rl_digit_argument (int, int);
jpayne@69 83 extern int rl_universal_argument (int, int);
jpayne@69 84
jpayne@69 85 /* Bindable commands for moving the cursor. */
jpayne@69 86 extern int rl_forward_byte (int, int);
jpayne@69 87 extern int rl_forward_char (int, int);
jpayne@69 88 extern int rl_forward (int, int);
jpayne@69 89 extern int rl_backward_byte (int, int);
jpayne@69 90 extern int rl_backward_char (int, int);
jpayne@69 91 extern int rl_backward (int, int);
jpayne@69 92 extern int rl_beg_of_line (int, int);
jpayne@69 93 extern int rl_end_of_line (int, int);
jpayne@69 94 extern int rl_forward_word (int, int);
jpayne@69 95 extern int rl_backward_word (int, int);
jpayne@69 96 extern int rl_refresh_line (int, int);
jpayne@69 97 extern int rl_clear_screen (int, int);
jpayne@69 98 extern int rl_clear_display (int, int);
jpayne@69 99 extern int rl_skip_csi_sequence (int, int);
jpayne@69 100 extern int rl_arrow_keys (int, int);
jpayne@69 101
jpayne@69 102 extern int rl_previous_screen_line (int, int);
jpayne@69 103 extern int rl_next_screen_line (int, int);
jpayne@69 104
jpayne@69 105 /* Bindable commands for inserting and deleting text. */
jpayne@69 106 extern int rl_insert (int, int);
jpayne@69 107 extern int rl_quoted_insert (int, int);
jpayne@69 108 extern int rl_tab_insert (int, int);
jpayne@69 109 extern int rl_newline (int, int);
jpayne@69 110 extern int rl_do_lowercase_version (int, int);
jpayne@69 111 extern int rl_rubout (int, int);
jpayne@69 112 extern int rl_delete (int, int);
jpayne@69 113 extern int rl_rubout_or_delete (int, int);
jpayne@69 114 extern int rl_delete_horizontal_space (int, int);
jpayne@69 115 extern int rl_delete_or_show_completions (int, int);
jpayne@69 116 extern int rl_insert_comment (int, int);
jpayne@69 117
jpayne@69 118 /* Bindable commands for changing case. */
jpayne@69 119 extern int rl_upcase_word (int, int);
jpayne@69 120 extern int rl_downcase_word (int, int);
jpayne@69 121 extern int rl_capitalize_word (int, int);
jpayne@69 122
jpayne@69 123 /* Bindable commands for transposing characters and words. */
jpayne@69 124 extern int rl_transpose_words (int, int);
jpayne@69 125 extern int rl_transpose_chars (int, int);
jpayne@69 126
jpayne@69 127 /* Bindable commands for searching within a line. */
jpayne@69 128 extern int rl_char_search (int, int);
jpayne@69 129 extern int rl_backward_char_search (int, int);
jpayne@69 130
jpayne@69 131 /* Bindable commands for readline's interface to the command history. */
jpayne@69 132 extern int rl_beginning_of_history (int, int);
jpayne@69 133 extern int rl_end_of_history (int, int);
jpayne@69 134 extern int rl_get_next_history (int, int);
jpayne@69 135 extern int rl_get_previous_history (int, int);
jpayne@69 136 extern int rl_operate_and_get_next (int, int);
jpayne@69 137 extern int rl_fetch_history (int, int);
jpayne@69 138
jpayne@69 139 /* Bindable commands for managing the mark and region. */
jpayne@69 140 extern int rl_set_mark (int, int);
jpayne@69 141 extern int rl_exchange_point_and_mark (int, int);
jpayne@69 142
jpayne@69 143 /* Bindable commands to set the editing mode (emacs or vi). */
jpayne@69 144 extern int rl_vi_editing_mode (int, int);
jpayne@69 145 extern int rl_emacs_editing_mode (int, int);
jpayne@69 146
jpayne@69 147 /* Bindable commands to change the insert mode (insert or overwrite) */
jpayne@69 148 extern int rl_overwrite_mode (int, int);
jpayne@69 149
jpayne@69 150 /* Bindable commands for managing key bindings. */
jpayne@69 151 extern int rl_re_read_init_file (int, int);
jpayne@69 152 extern int rl_dump_functions (int, int);
jpayne@69 153 extern int rl_dump_macros (int, int);
jpayne@69 154 extern int rl_dump_variables (int, int);
jpayne@69 155
jpayne@69 156 /* Bindable commands for word completion. */
jpayne@69 157 extern int rl_complete (int, int);
jpayne@69 158 extern int rl_possible_completions (int, int);
jpayne@69 159 extern int rl_insert_completions (int, int);
jpayne@69 160 extern int rl_old_menu_complete (int, int);
jpayne@69 161 extern int rl_menu_complete (int, int);
jpayne@69 162 extern int rl_backward_menu_complete (int, int);
jpayne@69 163
jpayne@69 164 /* Bindable commands for killing and yanking text, and managing the kill ring. */
jpayne@69 165 extern int rl_kill_word (int, int);
jpayne@69 166 extern int rl_backward_kill_word (int, int);
jpayne@69 167 extern int rl_kill_line (int, int);
jpayne@69 168 extern int rl_backward_kill_line (int, int);
jpayne@69 169 extern int rl_kill_full_line (int, int);
jpayne@69 170 extern int rl_unix_word_rubout (int, int);
jpayne@69 171 extern int rl_unix_filename_rubout (int, int);
jpayne@69 172 extern int rl_unix_line_discard (int, int);
jpayne@69 173 extern int rl_copy_region_to_kill (int, int);
jpayne@69 174 extern int rl_kill_region (int, int);
jpayne@69 175 extern int rl_copy_forward_word (int, int);
jpayne@69 176 extern int rl_copy_backward_word (int, int);
jpayne@69 177 extern int rl_yank (int, int);
jpayne@69 178 extern int rl_yank_pop (int, int);
jpayne@69 179 extern int rl_yank_nth_arg (int, int);
jpayne@69 180 extern int rl_yank_last_arg (int, int);
jpayne@69 181 extern int rl_bracketed_paste_begin (int, int);
jpayne@69 182 /* Not available unless _WIN32 is defined. */
jpayne@69 183 #if defined (_WIN32)
jpayne@69 184 extern int rl_paste_from_clipboard (int, int);
jpayne@69 185 #endif
jpayne@69 186
jpayne@69 187 /* Bindable commands for incremental searching. */
jpayne@69 188 extern int rl_reverse_search_history (int, int);
jpayne@69 189 extern int rl_forward_search_history (int, int);
jpayne@69 190
jpayne@69 191 /* Bindable keyboard macro commands. */
jpayne@69 192 extern int rl_start_kbd_macro (int, int);
jpayne@69 193 extern int rl_end_kbd_macro (int, int);
jpayne@69 194 extern int rl_call_last_kbd_macro (int, int);
jpayne@69 195 extern int rl_print_last_kbd_macro (int, int);
jpayne@69 196
jpayne@69 197 /* Bindable undo commands. */
jpayne@69 198 extern int rl_revert_line (int, int);
jpayne@69 199 extern int rl_undo_command (int, int);
jpayne@69 200
jpayne@69 201 /* Bindable tilde expansion commands. */
jpayne@69 202 extern int rl_tilde_expand (int, int);
jpayne@69 203
jpayne@69 204 /* Bindable terminal control commands. */
jpayne@69 205 extern int rl_restart_output (int, int);
jpayne@69 206 extern int rl_stop_output (int, int);
jpayne@69 207
jpayne@69 208 /* Miscellaneous bindable commands. */
jpayne@69 209 extern int rl_abort (int, int);
jpayne@69 210 extern int rl_tty_status (int, int);
jpayne@69 211
jpayne@69 212 /* Bindable commands for incremental and non-incremental history searching. */
jpayne@69 213 extern int rl_history_search_forward (int, int);
jpayne@69 214 extern int rl_history_search_backward (int, int);
jpayne@69 215 extern int rl_history_substr_search_forward (int, int);
jpayne@69 216 extern int rl_history_substr_search_backward (int, int);
jpayne@69 217 extern int rl_noninc_forward_search (int, int);
jpayne@69 218 extern int rl_noninc_reverse_search (int, int);
jpayne@69 219 extern int rl_noninc_forward_search_again (int, int);
jpayne@69 220 extern int rl_noninc_reverse_search_again (int, int);
jpayne@69 221
jpayne@69 222 /* Bindable command used when inserting a matching close character. */
jpayne@69 223 extern int rl_insert_close (int, int);
jpayne@69 224
jpayne@69 225 /* Not available unless READLINE_CALLBACKS is defined. */
jpayne@69 226 extern void rl_callback_handler_install (const char *, rl_vcpfunc_t *);
jpayne@69 227 extern void rl_callback_read_char (void);
jpayne@69 228 extern void rl_callback_handler_remove (void);
jpayne@69 229 extern void rl_callback_sigcleanup (void);
jpayne@69 230
jpayne@69 231 /* Things for vi mode. Not available unless readline is compiled -DVI_MODE. */
jpayne@69 232 /* VI-mode bindable commands. */
jpayne@69 233 extern int rl_vi_redo (int, int);
jpayne@69 234 extern int rl_vi_undo (int, int);
jpayne@69 235 extern int rl_vi_yank_arg (int, int);
jpayne@69 236 extern int rl_vi_fetch_history (int, int);
jpayne@69 237 extern int rl_vi_search_again (int, int);
jpayne@69 238 extern int rl_vi_search (int, int);
jpayne@69 239 extern int rl_vi_complete (int, int);
jpayne@69 240 extern int rl_vi_tilde_expand (int, int);
jpayne@69 241 extern int rl_vi_prev_word (int, int);
jpayne@69 242 extern int rl_vi_next_word (int, int);
jpayne@69 243 extern int rl_vi_end_word (int, int);
jpayne@69 244 extern int rl_vi_insert_beg (int, int);
jpayne@69 245 extern int rl_vi_append_mode (int, int);
jpayne@69 246 extern int rl_vi_append_eol (int, int);
jpayne@69 247 extern int rl_vi_eof_maybe (int, int);
jpayne@69 248 extern int rl_vi_insertion_mode (int, int);
jpayne@69 249 extern int rl_vi_insert_mode (int, int);
jpayne@69 250 extern int rl_vi_movement_mode (int, int);
jpayne@69 251 extern int rl_vi_arg_digit (int, int);
jpayne@69 252 extern int rl_vi_change_case (int, int);
jpayne@69 253 extern int rl_vi_put (int, int);
jpayne@69 254 extern int rl_vi_column (int, int);
jpayne@69 255 extern int rl_vi_delete_to (int, int);
jpayne@69 256 extern int rl_vi_change_to (int, int);
jpayne@69 257 extern int rl_vi_yank_to (int, int);
jpayne@69 258 extern int rl_vi_yank_pop (int, int);
jpayne@69 259 extern int rl_vi_rubout (int, int);
jpayne@69 260 extern int rl_vi_delete (int, int);
jpayne@69 261 extern int rl_vi_back_to_indent (int, int);
jpayne@69 262 extern int rl_vi_unix_word_rubout (int, int);
jpayne@69 263 extern int rl_vi_first_print (int, int);
jpayne@69 264 extern int rl_vi_char_search (int, int);
jpayne@69 265 extern int rl_vi_match (int, int);
jpayne@69 266 extern int rl_vi_change_char (int, int);
jpayne@69 267 extern int rl_vi_subst (int, int);
jpayne@69 268 extern int rl_vi_overstrike (int, int);
jpayne@69 269 extern int rl_vi_overstrike_delete (int, int);
jpayne@69 270 extern int rl_vi_replace (int, int);
jpayne@69 271 extern int rl_vi_set_mark (int, int);
jpayne@69 272 extern int rl_vi_goto_mark (int, int);
jpayne@69 273
jpayne@69 274 /* VI-mode utility functions. */
jpayne@69 275 extern int rl_vi_check (void);
jpayne@69 276 extern int rl_vi_domove (int, int *);
jpayne@69 277 extern int rl_vi_bracktype (int);
jpayne@69 278
jpayne@69 279 extern void rl_vi_start_inserting (int, int, int);
jpayne@69 280
jpayne@69 281 /* VI-mode pseudo-bindable commands, used as utility functions. */
jpayne@69 282 extern int rl_vi_fWord (int, int);
jpayne@69 283 extern int rl_vi_bWord (int, int);
jpayne@69 284 extern int rl_vi_eWord (int, int);
jpayne@69 285 extern int rl_vi_fword (int, int);
jpayne@69 286 extern int rl_vi_bword (int, int);
jpayne@69 287 extern int rl_vi_eword (int, int);
jpayne@69 288
jpayne@69 289 /* **************************************************************** */
jpayne@69 290 /* */
jpayne@69 291 /* Well Published Functions */
jpayne@69 292 /* */
jpayne@69 293 /* **************************************************************** */
jpayne@69 294
jpayne@69 295 /* Readline functions. */
jpayne@69 296 /* Read a line of input. Prompt with PROMPT. A NULL PROMPT means none. */
jpayne@69 297 extern char *readline (const char *);
jpayne@69 298
jpayne@69 299 extern int rl_set_prompt (const char *);
jpayne@69 300 extern int rl_expand_prompt (char *);
jpayne@69 301
jpayne@69 302 extern int rl_initialize (void);
jpayne@69 303
jpayne@69 304 /* Undocumented; unused by readline */
jpayne@69 305 extern int rl_discard_argument (void);
jpayne@69 306
jpayne@69 307 /* Utility functions to bind keys to readline commands. */
jpayne@69 308 extern int rl_add_defun (const char *, rl_command_func_t *, int);
jpayne@69 309 extern int rl_bind_key (int, rl_command_func_t *);
jpayne@69 310 extern int rl_bind_key_in_map (int, rl_command_func_t *, Keymap);
jpayne@69 311 extern int rl_unbind_key (int);
jpayne@69 312 extern int rl_unbind_key_in_map (int, Keymap);
jpayne@69 313 extern int rl_bind_key_if_unbound (int, rl_command_func_t *);
jpayne@69 314 extern int rl_bind_key_if_unbound_in_map (int, rl_command_func_t *, Keymap);
jpayne@69 315 extern int rl_unbind_function_in_map (rl_command_func_t *, Keymap);
jpayne@69 316 extern int rl_unbind_command_in_map (const char *, Keymap);
jpayne@69 317 extern int rl_bind_keyseq (const char *, rl_command_func_t *);
jpayne@69 318 extern int rl_bind_keyseq_in_map (const char *, rl_command_func_t *, Keymap);
jpayne@69 319 extern int rl_bind_keyseq_if_unbound (const char *, rl_command_func_t *);
jpayne@69 320 extern int rl_bind_keyseq_if_unbound_in_map (const char *, rl_command_func_t *, Keymap);
jpayne@69 321 extern int rl_generic_bind (int, const char *, char *, Keymap);
jpayne@69 322
jpayne@69 323 extern char *rl_variable_value (const char *);
jpayne@69 324 extern int rl_variable_bind (const char *, const char *);
jpayne@69 325
jpayne@69 326 /* Backwards compatibility, use rl_bind_keyseq_in_map instead. */
jpayne@69 327 extern int rl_set_key (const char *, rl_command_func_t *, Keymap);
jpayne@69 328
jpayne@69 329 /* Backwards compatibility, use rl_generic_bind instead. */
jpayne@69 330 extern int rl_macro_bind (const char *, const char *, Keymap);
jpayne@69 331
jpayne@69 332 /* Undocumented in the texinfo manual; not really useful to programs. */
jpayne@69 333 extern int rl_translate_keyseq (const char *, char *, int *);
jpayne@69 334 extern char *rl_untranslate_keyseq (int);
jpayne@69 335
jpayne@69 336 extern rl_command_func_t *rl_named_function (const char *);
jpayne@69 337 extern rl_command_func_t *rl_function_of_keyseq (const char *, Keymap, int *);
jpayne@69 338 extern rl_command_func_t *rl_function_of_keyseq_len (const char *, size_t, Keymap, int *);
jpayne@69 339 extern int rl_trim_arg_from_keyseq (const char *, size_t, Keymap);
jpayne@69 340
jpayne@69 341 extern void rl_list_funmap_names (void);
jpayne@69 342 extern char **rl_invoking_keyseqs_in_map (rl_command_func_t *, Keymap);
jpayne@69 343 extern char **rl_invoking_keyseqs (rl_command_func_t *);
jpayne@69 344
jpayne@69 345 extern void rl_function_dumper (int);
jpayne@69 346 extern void rl_macro_dumper (int);
jpayne@69 347 extern void rl_variable_dumper (int);
jpayne@69 348
jpayne@69 349 extern int rl_read_init_file (const char *);
jpayne@69 350 extern int rl_parse_and_bind (char *);
jpayne@69 351
jpayne@69 352 /* Functions for manipulating keymaps. */
jpayne@69 353 extern Keymap rl_make_bare_keymap (void);
jpayne@69 354 extern int rl_empty_keymap (Keymap);
jpayne@69 355 extern Keymap rl_copy_keymap (Keymap);
jpayne@69 356 extern Keymap rl_make_keymap (void);
jpayne@69 357 extern void rl_discard_keymap (Keymap);
jpayne@69 358 extern void rl_free_keymap (Keymap);
jpayne@69 359
jpayne@69 360 extern Keymap rl_get_keymap_by_name (const char *);
jpayne@69 361 extern char *rl_get_keymap_name (Keymap);
jpayne@69 362 extern void rl_set_keymap (Keymap);
jpayne@69 363 extern Keymap rl_get_keymap (void);
jpayne@69 364
jpayne@69 365 extern int rl_set_keymap_name (const char *, Keymap);
jpayne@69 366
jpayne@69 367 /* Undocumented; used internally only. */
jpayne@69 368 extern void rl_set_keymap_from_edit_mode (void);
jpayne@69 369 extern char *rl_get_keymap_name_from_edit_mode (void);
jpayne@69 370
jpayne@69 371 /* Functions for manipulating the funmap, which maps command names to functions. */
jpayne@69 372 extern int rl_add_funmap_entry (const char *, rl_command_func_t *);
jpayne@69 373 extern const char **rl_funmap_names (void);
jpayne@69 374 /* Undocumented, only used internally -- there is only one funmap, and this
jpayne@69 375 function may be called only once. */
jpayne@69 376 extern void rl_initialize_funmap (void);
jpayne@69 377
jpayne@69 378 /* Utility functions for managing keyboard macros. */
jpayne@69 379 extern void rl_push_macro_input (char *);
jpayne@69 380
jpayne@69 381 /* Functions for undoing, from undo.c */
jpayne@69 382 extern void rl_add_undo (enum undo_code, int, int, char *);
jpayne@69 383 extern void rl_free_undo_list (void);
jpayne@69 384 extern int rl_do_undo (void);
jpayne@69 385 extern int rl_begin_undo_group (void);
jpayne@69 386 extern int rl_end_undo_group (void);
jpayne@69 387 extern int rl_modifying (int, int);
jpayne@69 388
jpayne@69 389 /* Functions for redisplay. */
jpayne@69 390 extern void rl_redisplay (void);
jpayne@69 391 extern int rl_on_new_line (void);
jpayne@69 392 extern int rl_on_new_line_with_prompt (void);
jpayne@69 393 extern int rl_forced_update_display (void);
jpayne@69 394 extern int rl_clear_visible_line (void);
jpayne@69 395 extern int rl_clear_message (void);
jpayne@69 396 extern int rl_reset_line_state (void);
jpayne@69 397 extern int rl_crlf (void);
jpayne@69 398
jpayne@69 399 /* Functions to manage the mark and region, especially the notion of an
jpayne@69 400 active mark and an active region. */
jpayne@69 401 extern void rl_keep_mark_active (void);
jpayne@69 402
jpayne@69 403 extern void rl_activate_mark (void);
jpayne@69 404 extern void rl_deactivate_mark (void);
jpayne@69 405 extern int rl_mark_active_p (void);
jpayne@69 406
jpayne@69 407 #if defined (USE_VARARGS) && defined (PREFER_STDARG)
jpayne@69 408 extern int rl_message (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
jpayne@69 409 #else
jpayne@69 410 extern int rl_message ();
jpayne@69 411 #endif
jpayne@69 412
jpayne@69 413 extern int rl_show_char (int);
jpayne@69 414
jpayne@69 415 /* Undocumented in texinfo manual. */
jpayne@69 416 extern int rl_character_len (int, int);
jpayne@69 417 extern void rl_redraw_prompt_last_line (void);
jpayne@69 418
jpayne@69 419 /* Save and restore internal prompt redisplay information. */
jpayne@69 420 extern void rl_save_prompt (void);
jpayne@69 421 extern void rl_restore_prompt (void);
jpayne@69 422
jpayne@69 423 /* Modifying text. */
jpayne@69 424 extern void rl_replace_line (const char *, int);
jpayne@69 425 extern int rl_insert_text (const char *);
jpayne@69 426 extern int rl_delete_text (int, int);
jpayne@69 427 extern int rl_kill_text (int, int);
jpayne@69 428 extern char *rl_copy_text (int, int);
jpayne@69 429
jpayne@69 430 /* Terminal and tty mode management. */
jpayne@69 431 extern void rl_prep_terminal (int);
jpayne@69 432 extern void rl_deprep_terminal (void);
jpayne@69 433 extern void rl_tty_set_default_bindings (Keymap);
jpayne@69 434 extern void rl_tty_unset_default_bindings (Keymap);
jpayne@69 435
jpayne@69 436 extern int rl_tty_set_echoing (int);
jpayne@69 437 extern int rl_reset_terminal (const char *);
jpayne@69 438 extern void rl_resize_terminal (void);
jpayne@69 439 extern void rl_set_screen_size (int, int);
jpayne@69 440 extern void rl_get_screen_size (int *, int *);
jpayne@69 441 extern void rl_reset_screen_size (void);
jpayne@69 442
jpayne@69 443 extern char *rl_get_termcap (const char *);
jpayne@69 444
jpayne@69 445 /* Functions for character input. */
jpayne@69 446 extern int rl_stuff_char (int);
jpayne@69 447 extern int rl_execute_next (int);
jpayne@69 448 extern int rl_clear_pending_input (void);
jpayne@69 449 extern int rl_read_key (void);
jpayne@69 450 extern int rl_getc (FILE *);
jpayne@69 451 extern int rl_set_keyboard_input_timeout (int);
jpayne@69 452
jpayne@69 453 /* Functions to set and reset timeouts. */
jpayne@69 454 extern int rl_set_timeout (unsigned int, unsigned int);
jpayne@69 455 extern int rl_timeout_remaining (unsigned int *, unsigned int *);
jpayne@69 456
jpayne@69 457 #undef rl_clear_timeout
jpayne@69 458 #define rl_clear_timeout() rl_set_timeout (0, 0)
jpayne@69 459
jpayne@69 460 /* `Public' utility functions . */
jpayne@69 461 extern void rl_extend_line_buffer (int);
jpayne@69 462 extern int rl_ding (void);
jpayne@69 463 extern int rl_alphabetic (int);
jpayne@69 464 extern void rl_free (void *);
jpayne@69 465
jpayne@69 466 /* Readline signal handling, from signals.c */
jpayne@69 467 extern int rl_set_signals (void);
jpayne@69 468 extern int rl_clear_signals (void);
jpayne@69 469 extern void rl_cleanup_after_signal (void);
jpayne@69 470 extern void rl_reset_after_signal (void);
jpayne@69 471 extern void rl_free_line_state (void);
jpayne@69 472
jpayne@69 473 extern int rl_pending_signal (void);
jpayne@69 474 extern void rl_check_signals (void);
jpayne@69 475
jpayne@69 476 extern void rl_echo_signal_char (int);
jpayne@69 477
jpayne@69 478 extern int rl_set_paren_blink_timeout (int);
jpayne@69 479
jpayne@69 480 /* History management functions. */
jpayne@69 481
jpayne@69 482 extern void rl_clear_history (void);
jpayne@69 483
jpayne@69 484 /* Undocumented. */
jpayne@69 485 extern int rl_maybe_save_line (void);
jpayne@69 486 extern int rl_maybe_unsave_line (void);
jpayne@69 487 extern int rl_maybe_replace_line (void);
jpayne@69 488
jpayne@69 489 /* Completion functions. */
jpayne@69 490 extern int rl_complete_internal (int);
jpayne@69 491 extern void rl_display_match_list (char **, int, int);
jpayne@69 492
jpayne@69 493 extern char **rl_completion_matches (const char *, rl_compentry_func_t *);
jpayne@69 494 extern char *rl_username_completion_function (const char *, int);
jpayne@69 495 extern char *rl_filename_completion_function (const char *, int);
jpayne@69 496
jpayne@69 497 extern int rl_completion_mode (rl_command_func_t *);
jpayne@69 498
jpayne@69 499 #if 0
jpayne@69 500 /* Backwards compatibility (compat.c). These will go away sometime. */
jpayne@69 501 extern void free_undo_list (void);
jpayne@69 502 extern int maybe_save_line (void);
jpayne@69 503 extern int maybe_unsave_line (void);
jpayne@69 504 extern int maybe_replace_line (void);
jpayne@69 505
jpayne@69 506 extern int ding (void);
jpayne@69 507 extern int alphabetic (int);
jpayne@69 508 extern int crlf (void);
jpayne@69 509
jpayne@69 510 extern char **completion_matches (char *, rl_compentry_func_t *);
jpayne@69 511 extern char *username_completion_function (const char *, int);
jpayne@69 512 extern char *filename_completion_function (const char *, int);
jpayne@69 513 #endif
jpayne@69 514
jpayne@69 515 /* **************************************************************** */
jpayne@69 516 /* */
jpayne@69 517 /* Well Published Variables */
jpayne@69 518 /* */
jpayne@69 519 /* **************************************************************** */
jpayne@69 520
jpayne@69 521 /* The version of this incarnation of the readline library. */
jpayne@69 522 extern const char *rl_library_version; /* e.g., "4.2" */
jpayne@69 523 extern int rl_readline_version; /* e.g., 0x0402 */
jpayne@69 524
jpayne@69 525 /* True if this is real GNU readline. */
jpayne@69 526 extern int rl_gnu_readline_p;
jpayne@69 527
jpayne@69 528 /* Flags word encapsulating the current readline state. */
jpayne@69 529 extern unsigned long rl_readline_state;
jpayne@69 530
jpayne@69 531 /* Says which editing mode readline is currently using. 1 means emacs mode;
jpayne@69 532 0 means vi mode. */
jpayne@69 533 extern int rl_editing_mode;
jpayne@69 534
jpayne@69 535 /* Insert or overwrite mode for emacs mode. 1 means insert mode; 0 means
jpayne@69 536 overwrite mode. Reset to insert mode on each input line. */
jpayne@69 537 extern int rl_insert_mode;
jpayne@69 538
jpayne@69 539 /* The name of the calling program. You should initialize this to
jpayne@69 540 whatever was in argv[0]. It is used when parsing conditionals. */
jpayne@69 541 extern const char *rl_readline_name;
jpayne@69 542
jpayne@69 543 /* The prompt readline uses. This is set from the argument to
jpayne@69 544 readline (), and should not be assigned to directly. */
jpayne@69 545 extern char *rl_prompt;
jpayne@69 546
jpayne@69 547 /* The prompt string that is actually displayed by rl_redisplay. Public so
jpayne@69 548 applications can more easily supply their own redisplay functions. */
jpayne@69 549 extern char *rl_display_prompt;
jpayne@69 550
jpayne@69 551 /* The line buffer that is in use. */
jpayne@69 552 extern char *rl_line_buffer;
jpayne@69 553
jpayne@69 554 /* The location of point, and end. */
jpayne@69 555 extern int rl_point;
jpayne@69 556 extern int rl_end;
jpayne@69 557
jpayne@69 558 /* The mark, or saved cursor position. */
jpayne@69 559 extern int rl_mark;
jpayne@69 560
jpayne@69 561 /* Flag to indicate that readline has finished with the current input
jpayne@69 562 line and should return it. */
jpayne@69 563 extern int rl_done;
jpayne@69 564
jpayne@69 565 /* Flag to indicate that readline has read an EOF character or read has
jpayne@69 566 returned 0 or error, and is returning a NULL line as a result. */
jpayne@69 567 extern int rl_eof_found;
jpayne@69 568
jpayne@69 569 /* If set to a character value, that will be the next keystroke read. */
jpayne@69 570 extern int rl_pending_input;
jpayne@69 571
jpayne@69 572 /* Non-zero if we called this function from _rl_dispatch(). It's present
jpayne@69 573 so functions can find out whether they were called from a key binding
jpayne@69 574 or directly from an application. */
jpayne@69 575 extern int rl_dispatching;
jpayne@69 576
jpayne@69 577 /* Non-zero if the user typed a numeric argument before executing the
jpayne@69 578 current function. */
jpayne@69 579 extern int rl_explicit_arg;
jpayne@69 580
jpayne@69 581 /* The current value of the numeric argument specified by the user. */
jpayne@69 582 extern int rl_numeric_arg;
jpayne@69 583
jpayne@69 584 /* The address of the last command function Readline executed. */
jpayne@69 585 extern rl_command_func_t *rl_last_func;
jpayne@69 586
jpayne@69 587 /* The name of the terminal to use. */
jpayne@69 588 extern const char *rl_terminal_name;
jpayne@69 589
jpayne@69 590 /* The input and output streams. */
jpayne@69 591 extern FILE *rl_instream;
jpayne@69 592 extern FILE *rl_outstream;
jpayne@69 593
jpayne@69 594 /* If non-zero, Readline gives values of LINES and COLUMNS from the environment
jpayne@69 595 greater precedence than values fetched from the kernel when computing the
jpayne@69 596 screen dimensions. */
jpayne@69 597 extern int rl_prefer_env_winsize;
jpayne@69 598
jpayne@69 599 /* If non-zero, then this is the address of a function to call just
jpayne@69 600 before readline_internal () prints the first prompt. */
jpayne@69 601 extern rl_hook_func_t *rl_startup_hook;
jpayne@69 602
jpayne@69 603 /* If non-zero, this is the address of a function to call just before
jpayne@69 604 readline_internal_setup () returns and readline_internal starts
jpayne@69 605 reading input characters. */
jpayne@69 606 extern rl_hook_func_t *rl_pre_input_hook;
jpayne@69 607
jpayne@69 608 /* The address of a function to call periodically while Readline is
jpayne@69 609 awaiting character input, or NULL, for no event handling. */
jpayne@69 610 extern rl_hook_func_t *rl_event_hook;
jpayne@69 611
jpayne@69 612 /* The address of a function to call if a read is interrupted by a signal. */
jpayne@69 613 extern rl_hook_func_t *rl_signal_event_hook;
jpayne@69 614
jpayne@69 615 extern rl_hook_func_t *rl_timeout_event_hook;
jpayne@69 616
jpayne@69 617 /* The address of a function to call if Readline needs to know whether or not
jpayne@69 618 there is data available from the current input source. */
jpayne@69 619 extern rl_hook_func_t *rl_input_available_hook;
jpayne@69 620
jpayne@69 621 /* The address of the function to call to fetch a character from the current
jpayne@69 622 Readline input stream */
jpayne@69 623 extern rl_getc_func_t *rl_getc_function;
jpayne@69 624
jpayne@69 625 extern rl_voidfunc_t *rl_redisplay_function;
jpayne@69 626
jpayne@69 627 extern rl_vintfunc_t *rl_prep_term_function;
jpayne@69 628 extern rl_voidfunc_t *rl_deprep_term_function;
jpayne@69 629
jpayne@69 630 /* Dispatch variables. */
jpayne@69 631 extern Keymap rl_executing_keymap;
jpayne@69 632 extern Keymap rl_binding_keymap;
jpayne@69 633
jpayne@69 634 extern int rl_executing_key;
jpayne@69 635 extern char *rl_executing_keyseq;
jpayne@69 636 extern int rl_key_sequence_length;
jpayne@69 637
jpayne@69 638 /* Display variables. */
jpayne@69 639 /* If non-zero, readline will erase the entire line, including any prompt,
jpayne@69 640 if the only thing typed on an otherwise-blank line is something bound to
jpayne@69 641 rl_newline. */
jpayne@69 642 extern int rl_erase_empty_line;
jpayne@69 643
jpayne@69 644 /* If non-zero, the application has already printed the prompt (rl_prompt)
jpayne@69 645 before calling readline, so readline should not output it the first time
jpayne@69 646 redisplay is done. */
jpayne@69 647 extern int rl_already_prompted;
jpayne@69 648
jpayne@69 649 /* A non-zero value means to read only this many characters rather than
jpayne@69 650 up to a character bound to accept-line. */
jpayne@69 651 extern int rl_num_chars_to_read;
jpayne@69 652
jpayne@69 653 /* The text of a currently-executing keyboard macro. */
jpayne@69 654 extern char *rl_executing_macro;
jpayne@69 655
jpayne@69 656 /* Variables to control readline signal handling. */
jpayne@69 657 /* If non-zero, readline will install its own signal handlers for
jpayne@69 658 SIGINT, SIGTERM, SIGQUIT, SIGALRM, SIGTSTP, SIGTTIN, and SIGTTOU. */
jpayne@69 659 extern int rl_catch_signals;
jpayne@69 660
jpayne@69 661 /* If non-zero, readline will install a signal handler for SIGWINCH
jpayne@69 662 that also attempts to call any calling application's SIGWINCH signal
jpayne@69 663 handler. Note that the terminal is not cleaned up before the
jpayne@69 664 application's signal handler is called; use rl_cleanup_after_signal()
jpayne@69 665 to do that. */
jpayne@69 666 extern int rl_catch_sigwinch;
jpayne@69 667
jpayne@69 668 /* If non-zero, the readline SIGWINCH handler will modify LINES and
jpayne@69 669 COLUMNS in the environment. */
jpayne@69 670 extern int rl_change_environment;
jpayne@69 671
jpayne@69 672 /* Completion variables. */
jpayne@69 673 /* Pointer to the generator function for completion_matches ().
jpayne@69 674 NULL means to use rl_filename_completion_function (), the default
jpayne@69 675 filename completer. */
jpayne@69 676 extern rl_compentry_func_t *rl_completion_entry_function;
jpayne@69 677
jpayne@69 678 /* Optional generator for menu completion. Default is
jpayne@69 679 rl_completion_entry_function (rl_filename_completion_function). */
jpayne@69 680 extern rl_compentry_func_t *rl_menu_completion_entry_function;
jpayne@69 681
jpayne@69 682 /* If rl_ignore_some_completions_function is non-NULL it is the address
jpayne@69 683 of a function to call after all of the possible matches have been
jpayne@69 684 generated, but before the actual completion is done to the input line.
jpayne@69 685 The function is called with one argument; a NULL terminated array
jpayne@69 686 of (char *). If your function removes any of the elements, they
jpayne@69 687 must be free()'ed. */
jpayne@69 688 extern rl_compignore_func_t *rl_ignore_some_completions_function;
jpayne@69 689
jpayne@69 690 /* Pointer to alternative function to create matches.
jpayne@69 691 Function is called with TEXT, START, and END.
jpayne@69 692 START and END are indices in RL_LINE_BUFFER saying what the boundaries
jpayne@69 693 of TEXT are.
jpayne@69 694 If this function exists and returns NULL then call the value of
jpayne@69 695 rl_completion_entry_function to try to match, otherwise use the
jpayne@69 696 array of strings returned. */
jpayne@69 697 extern rl_completion_func_t *rl_attempted_completion_function;
jpayne@69 698
jpayne@69 699 /* The basic list of characters that signal a break between words for the
jpayne@69 700 completer routine. The initial contents of this variable is what
jpayne@69 701 breaks words in the shell, i.e. "n\"\\'`@$>". */
jpayne@69 702 extern const char *rl_basic_word_break_characters;
jpayne@69 703
jpayne@69 704 /* The list of characters that signal a break between words for
jpayne@69 705 rl_complete_internal. The default list is the contents of
jpayne@69 706 rl_basic_word_break_characters. */
jpayne@69 707 extern const char *rl_completer_word_break_characters;
jpayne@69 708
jpayne@69 709 /* Hook function to allow an application to set the completion word
jpayne@69 710 break characters before readline breaks up the line. Allows
jpayne@69 711 position-dependent word break characters. */
jpayne@69 712 extern rl_cpvfunc_t *rl_completion_word_break_hook;
jpayne@69 713
jpayne@69 714 /* List of characters which can be used to quote a substring of the line.
jpayne@69 715 Completion occurs on the entire substring, and within the substring
jpayne@69 716 rl_completer_word_break_characters are treated as any other character,
jpayne@69 717 unless they also appear within this list. */
jpayne@69 718 extern const char *rl_completer_quote_characters;
jpayne@69 719
jpayne@69 720 /* List of quote characters which cause a word break. */
jpayne@69 721 extern const char *rl_basic_quote_characters;
jpayne@69 722
jpayne@69 723 /* List of characters that need to be quoted in filenames by the completer. */
jpayne@69 724 extern const char *rl_filename_quote_characters;
jpayne@69 725
jpayne@69 726 /* List of characters that are word break characters, but should be left
jpayne@69 727 in TEXT when it is passed to the completion function. The shell uses
jpayne@69 728 this to help determine what kind of completing to do. */
jpayne@69 729 extern const char *rl_special_prefixes;
jpayne@69 730
jpayne@69 731 /* If non-zero, then this is the address of a function to call when
jpayne@69 732 completing on a directory name. The function is called with
jpayne@69 733 the address of a string (the current directory name) as an arg. It
jpayne@69 734 changes what is displayed when the possible completions are printed
jpayne@69 735 or inserted. The directory completion hook should perform
jpayne@69 736 any necessary dequoting. This function should return 1 if it modifies
jpayne@69 737 the directory name pointer passed as an argument. If the directory
jpayne@69 738 completion hook returns 0, it should not modify the directory name
jpayne@69 739 pointer passed as an argument. */
jpayne@69 740 extern rl_icppfunc_t *rl_directory_completion_hook;
jpayne@69 741
jpayne@69 742 /* If non-zero, this is the address of a function to call when completing
jpayne@69 743 a directory name. This function takes the address of the directory name
jpayne@69 744 to be modified as an argument. Unlike rl_directory_completion_hook, it
jpayne@69 745 only modifies the directory name used in opendir(2), not what is displayed
jpayne@69 746 when the possible completions are printed or inserted. If set, it takes
jpayne@69 747 precedence over rl_directory_completion_hook. The directory rewrite
jpayne@69 748 hook should perform any necessary dequoting. This function has the same
jpayne@69 749 return value properties as the directory_completion_hook.
jpayne@69 750
jpayne@69 751 I'm not happy with how this works yet, so it's undocumented. I'm trying
jpayne@69 752 it in bash to see how well it goes. */
jpayne@69 753 extern rl_icppfunc_t *rl_directory_rewrite_hook;
jpayne@69 754
jpayne@69 755 /* If non-zero, this is the address of a function for the completer to call
jpayne@69 756 before deciding which character to append to a completed name. It should
jpayne@69 757 modify the directory name passed as an argument if appropriate, and return
jpayne@69 758 non-zero if it modifies the name. This should not worry about dequoting
jpayne@69 759 the filename; that has already happened by the time it gets here. */
jpayne@69 760 extern rl_icppfunc_t *rl_filename_stat_hook;
jpayne@69 761
jpayne@69 762 /* If non-zero, this is the address of a function to call when reading
jpayne@69 763 directory entries from the filesystem for completion and comparing
jpayne@69 764 them to the partial word to be completed. The function should
jpayne@69 765 either return its first argument (if no conversion takes place) or
jpayne@69 766 newly-allocated memory. This can, for instance, convert filenames
jpayne@69 767 between character sets for comparison against what's typed at the
jpayne@69 768 keyboard. The returned value is what is added to the list of
jpayne@69 769 matches. The second argument is the length of the filename to be
jpayne@69 770 converted. */
jpayne@69 771 extern rl_dequote_func_t *rl_filename_rewrite_hook;
jpayne@69 772
jpayne@69 773 /* Backwards compatibility with previous versions of readline. */
jpayne@69 774 #define rl_symbolic_link_hook rl_directory_completion_hook
jpayne@69 775
jpayne@69 776 /* If non-zero, then this is the address of a function to call when
jpayne@69 777 completing a word would normally display the list of possible matches.
jpayne@69 778 This function is called instead of actually doing the display.
jpayne@69 779 It takes three arguments: (char **matches, int num_matches, int max_length)
jpayne@69 780 where MATCHES is the array of strings that matched, NUM_MATCHES is the
jpayne@69 781 number of strings in that array, and MAX_LENGTH is the length of the
jpayne@69 782 longest string in that array. */
jpayne@69 783 extern rl_compdisp_func_t *rl_completion_display_matches_hook;
jpayne@69 784
jpayne@69 785 /* Non-zero means that the results of the matches are to be treated
jpayne@69 786 as filenames. This is ALWAYS zero on entry, and can only be changed
jpayne@69 787 within a completion entry finder function. */
jpayne@69 788 extern int rl_filename_completion_desired;
jpayne@69 789
jpayne@69 790 /* Non-zero means that the results of the matches are to be quoted using
jpayne@69 791 double quotes (or an application-specific quoting mechanism) if the
jpayne@69 792 filename contains any characters in rl_word_break_chars. This is
jpayne@69 793 ALWAYS non-zero on entry, and can only be changed within a completion
jpayne@69 794 entry finder function. */
jpayne@69 795 extern int rl_filename_quoting_desired;
jpayne@69 796
jpayne@69 797 /* Set to a function to quote a filename in an application-specific fashion.
jpayne@69 798 Called with the text to quote, the type of match found (single or multiple)
jpayne@69 799 and a pointer to the quoting character to be used, which the function can
jpayne@69 800 reset if desired. */
jpayne@69 801 extern rl_quote_func_t *rl_filename_quoting_function;
jpayne@69 802
jpayne@69 803 /* Function to call to remove quoting characters from a filename. Called
jpayne@69 804 before completion is attempted, so the embedded quotes do not interfere
jpayne@69 805 with matching names in the file system. */
jpayne@69 806 extern rl_dequote_func_t *rl_filename_dequoting_function;
jpayne@69 807
jpayne@69 808 /* Function to call to decide whether or not a word break character is
jpayne@69 809 quoted. If a character is quoted, it does not break words for the
jpayne@69 810 completer. */
jpayne@69 811 extern rl_linebuf_func_t *rl_char_is_quoted_p;
jpayne@69 812
jpayne@69 813 /* Non-zero means to suppress normal filename completion after the
jpayne@69 814 user-specified completion function has been called. */
jpayne@69 815 extern int rl_attempted_completion_over;
jpayne@69 816
jpayne@69 817 /* Set to a character describing the type of completion being attempted by
jpayne@69 818 rl_complete_internal; available for use by application completion
jpayne@69 819 functions. */
jpayne@69 820 extern int rl_completion_type;
jpayne@69 821
jpayne@69 822 /* Set to the last key used to invoke one of the completion functions */
jpayne@69 823 extern int rl_completion_invoking_key;
jpayne@69 824
jpayne@69 825 /* Up to this many items will be displayed in response to a
jpayne@69 826 possible-completions call. After that, we ask the user if she
jpayne@69 827 is sure she wants to see them all. The default value is 100. */
jpayne@69 828 extern int rl_completion_query_items;
jpayne@69 829
jpayne@69 830 /* Character appended to completed words when at the end of the line. The
jpayne@69 831 default is a space. Nothing is added if this is '\0'. */
jpayne@69 832 extern int rl_completion_append_character;
jpayne@69 833
jpayne@69 834 /* If set to non-zero by an application completion function,
jpayne@69 835 rl_completion_append_character will not be appended. */
jpayne@69 836 extern int rl_completion_suppress_append;
jpayne@69 837
jpayne@69 838 /* Set to any quote character readline thinks it finds before any application
jpayne@69 839 completion function is called. */
jpayne@69 840 extern int rl_completion_quote_character;
jpayne@69 841
jpayne@69 842 /* Set to a non-zero value if readline found quoting anywhere in the word to
jpayne@69 843 be completed; set before any application completion function is called. */
jpayne@69 844 extern int rl_completion_found_quote;
jpayne@69 845
jpayne@69 846 /* If non-zero, the completion functions don't append any closing quote.
jpayne@69 847 This is set to 0 by rl_complete_internal and may be changed by an
jpayne@69 848 application-specific completion function. */
jpayne@69 849 extern int rl_completion_suppress_quote;
jpayne@69 850
jpayne@69 851 /* If non-zero, readline will sort the completion matches. On by default. */
jpayne@69 852 extern int rl_sort_completion_matches;
jpayne@69 853
jpayne@69 854 /* If non-zero, a slash will be appended to completed filenames that are
jpayne@69 855 symbolic links to directory names, subject to the value of the
jpayne@69 856 mark-directories variable (which is user-settable). This exists so
jpayne@69 857 that application completion functions can override the user's preference
jpayne@69 858 (set via the mark-symlinked-directories variable) if appropriate.
jpayne@69 859 It's set to the value of _rl_complete_mark_symlink_dirs in
jpayne@69 860 rl_complete_internal before any application-specific completion
jpayne@69 861 function is called, so without that function doing anything, the user's
jpayne@69 862 preferences are honored. */
jpayne@69 863 extern int rl_completion_mark_symlink_dirs;
jpayne@69 864
jpayne@69 865 /* If non-zero, then disallow duplicates in the matches. */
jpayne@69 866 extern int rl_ignore_completion_duplicates;
jpayne@69 867
jpayne@69 868 /* If this is non-zero, completion is (temporarily) inhibited, and the
jpayne@69 869 completion character will be inserted as any other. */
jpayne@69 870 extern int rl_inhibit_completion;
jpayne@69 871
jpayne@69 872 /* Applications can set this to non-zero to have readline's signal handlers
jpayne@69 873 installed during the entire duration of reading a complete line, as in
jpayne@69 874 readline-6.2. This should be used with care, because it can result in
jpayne@69 875 readline receiving signals and not handling them until it's called again
jpayne@69 876 via rl_callback_read_char, thereby stealing them from the application.
jpayne@69 877 By default, signal handlers are only active while readline is active. */
jpayne@69 878 extern int rl_persistent_signal_handlers;
jpayne@69 879
jpayne@69 880 /* Input error; can be returned by (*rl_getc_function) if readline is reading
jpayne@69 881 a top-level command (RL_ISSTATE (RL_STATE_READCMD)). */
jpayne@69 882 #define READERR (-2)
jpayne@69 883
jpayne@69 884 /* Definitions available for use by readline clients. */
jpayne@69 885 #define RL_PROMPT_START_IGNORE '\001'
jpayne@69 886 #define RL_PROMPT_END_IGNORE '\002'
jpayne@69 887
jpayne@69 888 /* Possible values for do_replace argument to rl_filename_quoting_function,
jpayne@69 889 called by rl_complete_internal. */
jpayne@69 890 #define NO_MATCH 0
jpayne@69 891 #define SINGLE_MATCH 1
jpayne@69 892 #define MULT_MATCH 2
jpayne@69 893
jpayne@69 894 /* Possible state values for rl_readline_state */
jpayne@69 895 #define RL_STATE_NONE 0x000000 /* no state; before first call */
jpayne@69 896
jpayne@69 897 #define RL_STATE_INITIALIZING 0x0000001 /* initializing */
jpayne@69 898 #define RL_STATE_INITIALIZED 0x0000002 /* initialization done */
jpayne@69 899 #define RL_STATE_TERMPREPPED 0x0000004 /* terminal is prepped */
jpayne@69 900 #define RL_STATE_READCMD 0x0000008 /* reading a command key */
jpayne@69 901 #define RL_STATE_METANEXT 0x0000010 /* reading input after ESC */
jpayne@69 902 #define RL_STATE_DISPATCHING 0x0000020 /* dispatching to a command */
jpayne@69 903 #define RL_STATE_MOREINPUT 0x0000040 /* reading more input in a command function */
jpayne@69 904 #define RL_STATE_ISEARCH 0x0000080 /* doing incremental search */
jpayne@69 905 #define RL_STATE_NSEARCH 0x0000100 /* doing non-inc search */
jpayne@69 906 #define RL_STATE_SEARCH 0x0000200 /* doing a history search */
jpayne@69 907 #define RL_STATE_NUMERICARG 0x0000400 /* reading numeric argument */
jpayne@69 908 #define RL_STATE_MACROINPUT 0x0000800 /* getting input from a macro */
jpayne@69 909 #define RL_STATE_MACRODEF 0x0001000 /* defining keyboard macro */
jpayne@69 910 #define RL_STATE_OVERWRITE 0x0002000 /* overwrite mode */
jpayne@69 911 #define RL_STATE_COMPLETING 0x0004000 /* doing completion */
jpayne@69 912 #define RL_STATE_SIGHANDLER 0x0008000 /* in readline sighandler */
jpayne@69 913 #define RL_STATE_UNDOING 0x0010000 /* doing an undo */
jpayne@69 914 #define RL_STATE_INPUTPENDING 0x0020000 /* rl_execute_next called */
jpayne@69 915 #define RL_STATE_TTYCSAVED 0x0040000 /* tty special chars saved */
jpayne@69 916 #define RL_STATE_CALLBACK 0x0080000 /* using the callback interface */
jpayne@69 917 #define RL_STATE_VIMOTION 0x0100000 /* reading vi motion arg */
jpayne@69 918 #define RL_STATE_MULTIKEY 0x0200000 /* reading multiple-key command */
jpayne@69 919 #define RL_STATE_VICMDONCE 0x0400000 /* entered vi command mode at least once */
jpayne@69 920 #define RL_STATE_CHARSEARCH 0x0800000 /* vi mode char search */
jpayne@69 921 #define RL_STATE_REDISPLAYING 0x1000000 /* updating terminal display */
jpayne@69 922
jpayne@69 923 #define RL_STATE_DONE 0x2000000 /* done; accepted line */
jpayne@69 924 #define RL_STATE_TIMEOUT 0x4000000 /* done; timed out */
jpayne@69 925 #define RL_STATE_EOF 0x8000000 /* done; got eof on read */
jpayne@69 926
jpayne@69 927 #define RL_SETSTATE(x) (rl_readline_state |= (x))
jpayne@69 928 #define RL_UNSETSTATE(x) (rl_readline_state &= ~(x))
jpayne@69 929 #define RL_ISSTATE(x) (rl_readline_state & (x))
jpayne@69 930
jpayne@69 931 struct readline_state {
jpayne@69 932 /* line state */
jpayne@69 933 int point;
jpayne@69 934 int end;
jpayne@69 935 int mark;
jpayne@69 936 int buflen;
jpayne@69 937 char *buffer;
jpayne@69 938 UNDO_LIST *ul;
jpayne@69 939 char *prompt;
jpayne@69 940
jpayne@69 941 /* global state */
jpayne@69 942 int rlstate;
jpayne@69 943 int done;
jpayne@69 944 Keymap kmap;
jpayne@69 945
jpayne@69 946 /* input state */
jpayne@69 947 rl_command_func_t *lastfunc;
jpayne@69 948 int insmode;
jpayne@69 949 int edmode;
jpayne@69 950 char *kseq;
jpayne@69 951 int kseqlen;
jpayne@69 952
jpayne@69 953 int pendingin;
jpayne@69 954 FILE *inf;
jpayne@69 955 FILE *outf;
jpayne@69 956 char *macro;
jpayne@69 957
jpayne@69 958 /* signal state */
jpayne@69 959 int catchsigs;
jpayne@69 960 int catchsigwinch;
jpayne@69 961
jpayne@69 962 /* search state */
jpayne@69 963
jpayne@69 964 /* completion state */
jpayne@69 965 rl_compentry_func_t *entryfunc;
jpayne@69 966 rl_compentry_func_t *menuentryfunc;
jpayne@69 967 rl_compignore_func_t *ignorefunc;
jpayne@69 968 rl_completion_func_t *attemptfunc;
jpayne@69 969 const char *wordbreakchars;
jpayne@69 970
jpayne@69 971 /* options state */
jpayne@69 972
jpayne@69 973 /* hook state */
jpayne@69 974
jpayne@69 975 /* reserved for future expansion, so the struct size doesn't change */
jpayne@69 976 char reserved[64];
jpayne@69 977 };
jpayne@69 978
jpayne@69 979 extern int rl_save_state (struct readline_state *);
jpayne@69 980 extern int rl_restore_state (struct readline_state *);
jpayne@69 981
jpayne@69 982 #ifdef __cplusplus
jpayne@69 983 }
jpayne@69 984 #endif
jpayne@69 985
jpayne@69 986 #endif /* _READLINE_H_ */