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