jpayne@69: /* Readline.h -- the names of functions callable from within readline. */
jpayne@69:
jpayne@69: /* Copyright (C) 1987-2022 Free Software Foundation, Inc.
jpayne@69:
jpayne@69: This file is part of the GNU Readline Library (Readline), a library
jpayne@69: for reading lines of text with interactive input and history editing.
jpayne@69:
jpayne@69: Readline is free software: you can redistribute it and/or modify
jpayne@69: it under the terms of the GNU General Public License as published by
jpayne@69: the Free Software Foundation, either version 3 of the License, or
jpayne@69: (at your option) any later version.
jpayne@69:
jpayne@69: Readline is distributed in the hope that it will be useful,
jpayne@69: but WITHOUT ANY WARRANTY; without even the implied warranty of
jpayne@69: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
jpayne@69: GNU General Public License for more details.
jpayne@69:
jpayne@69: You should have received a copy of the GNU General Public License
jpayne@69: along with Readline. If not, see .
jpayne@69: */
jpayne@69:
jpayne@69: #if !defined (_READLINE_H_)
jpayne@69: #define _READLINE_H_
jpayne@69:
jpayne@69: #ifdef __cplusplus
jpayne@69: extern "C" {
jpayne@69: #endif
jpayne@69:
jpayne@69: #if defined (READLINE_LIBRARY)
jpayne@69: # include "rlstdc.h"
jpayne@69: # include "rltypedefs.h"
jpayne@69: # include "keymaps.h"
jpayne@69: # include "tilde.h"
jpayne@69: #else
jpayne@69: # include
jpayne@69: # include
jpayne@69: # include
jpayne@69: # include
jpayne@69: #endif
jpayne@69:
jpayne@69: /* Hex-encoded Readline version number. */
jpayne@69: #define RL_READLINE_VERSION 0x0802 /* Readline 8.2 */
jpayne@69: #define RL_VERSION_MAJOR 8
jpayne@69: #define RL_VERSION_MINOR 2
jpayne@69:
jpayne@69: /* Readline data structures. */
jpayne@69:
jpayne@69: /* Maintaining the state of undo. We remember individual deletes and inserts
jpayne@69: on a chain of things to do. */
jpayne@69:
jpayne@69: /* The actions that undo knows how to undo. Notice that UNDO_DELETE means
jpayne@69: to insert some text, and UNDO_INSERT means to delete some text. I.e.,
jpayne@69: the code tells undo what to undo, not how to undo it. */
jpayne@69: enum undo_code { UNDO_DELETE, UNDO_INSERT, UNDO_BEGIN, UNDO_END };
jpayne@69:
jpayne@69: /* What an element of THE_UNDO_LIST looks like. */
jpayne@69: typedef struct undo_list {
jpayne@69: struct undo_list *next;
jpayne@69: int start, end; /* Where the change took place. */
jpayne@69: char *text; /* The text to insert, if undoing a delete. */
jpayne@69: enum undo_code what; /* Delete, Insert, Begin, End. */
jpayne@69: } UNDO_LIST;
jpayne@69:
jpayne@69: /* The current undo list for RL_LINE_BUFFER. */
jpayne@69: extern UNDO_LIST *rl_undo_list;
jpayne@69:
jpayne@69: /* The data structure for mapping textual names to code addresses. */
jpayne@69: typedef struct _funmap {
jpayne@69: const char *name;
jpayne@69: rl_command_func_t *function;
jpayne@69: } FUNMAP;
jpayne@69:
jpayne@69: extern FUNMAP **funmap;
jpayne@69:
jpayne@69: /* **************************************************************** */
jpayne@69: /* */
jpayne@69: /* Functions available to bind to key sequences */
jpayne@69: /* */
jpayne@69: /* **************************************************************** */
jpayne@69:
jpayne@69: /* Bindable commands for numeric arguments. */
jpayne@69: extern int rl_digit_argument (int, int);
jpayne@69: extern int rl_universal_argument (int, int);
jpayne@69:
jpayne@69: /* Bindable commands for moving the cursor. */
jpayne@69: extern int rl_forward_byte (int, int);
jpayne@69: extern int rl_forward_char (int, int);
jpayne@69: extern int rl_forward (int, int);
jpayne@69: extern int rl_backward_byte (int, int);
jpayne@69: extern int rl_backward_char (int, int);
jpayne@69: extern int rl_backward (int, int);
jpayne@69: extern int rl_beg_of_line (int, int);
jpayne@69: extern int rl_end_of_line (int, int);
jpayne@69: extern int rl_forward_word (int, int);
jpayne@69: extern int rl_backward_word (int, int);
jpayne@69: extern int rl_refresh_line (int, int);
jpayne@69: extern int rl_clear_screen (int, int);
jpayne@69: extern int rl_clear_display (int, int);
jpayne@69: extern int rl_skip_csi_sequence (int, int);
jpayne@69: extern int rl_arrow_keys (int, int);
jpayne@69:
jpayne@69: extern int rl_previous_screen_line (int, int);
jpayne@69: extern int rl_next_screen_line (int, int);
jpayne@69:
jpayne@69: /* Bindable commands for inserting and deleting text. */
jpayne@69: extern int rl_insert (int, int);
jpayne@69: extern int rl_quoted_insert (int, int);
jpayne@69: extern int rl_tab_insert (int, int);
jpayne@69: extern int rl_newline (int, int);
jpayne@69: extern int rl_do_lowercase_version (int, int);
jpayne@69: extern int rl_rubout (int, int);
jpayne@69: extern int rl_delete (int, int);
jpayne@69: extern int rl_rubout_or_delete (int, int);
jpayne@69: extern int rl_delete_horizontal_space (int, int);
jpayne@69: extern int rl_delete_or_show_completions (int, int);
jpayne@69: extern int rl_insert_comment (int, int);
jpayne@69:
jpayne@69: /* Bindable commands for changing case. */
jpayne@69: extern int rl_upcase_word (int, int);
jpayne@69: extern int rl_downcase_word (int, int);
jpayne@69: extern int rl_capitalize_word (int, int);
jpayne@69:
jpayne@69: /* Bindable commands for transposing characters and words. */
jpayne@69: extern int rl_transpose_words (int, int);
jpayne@69: extern int rl_transpose_chars (int, int);
jpayne@69:
jpayne@69: /* Bindable commands for searching within a line. */
jpayne@69: extern int rl_char_search (int, int);
jpayne@69: extern int rl_backward_char_search (int, int);
jpayne@69:
jpayne@69: /* Bindable commands for readline's interface to the command history. */
jpayne@69: extern int rl_beginning_of_history (int, int);
jpayne@69: extern int rl_end_of_history (int, int);
jpayne@69: extern int rl_get_next_history (int, int);
jpayne@69: extern int rl_get_previous_history (int, int);
jpayne@69: extern int rl_operate_and_get_next (int, int);
jpayne@69: extern int rl_fetch_history (int, int);
jpayne@69:
jpayne@69: /* Bindable commands for managing the mark and region. */
jpayne@69: extern int rl_set_mark (int, int);
jpayne@69: extern int rl_exchange_point_and_mark (int, int);
jpayne@69:
jpayne@69: /* Bindable commands to set the editing mode (emacs or vi). */
jpayne@69: extern int rl_vi_editing_mode (int, int);
jpayne@69: extern int rl_emacs_editing_mode (int, int);
jpayne@69:
jpayne@69: /* Bindable commands to change the insert mode (insert or overwrite) */
jpayne@69: extern int rl_overwrite_mode (int, int);
jpayne@69:
jpayne@69: /* Bindable commands for managing key bindings. */
jpayne@69: extern int rl_re_read_init_file (int, int);
jpayne@69: extern int rl_dump_functions (int, int);
jpayne@69: extern int rl_dump_macros (int, int);
jpayne@69: extern int rl_dump_variables (int, int);
jpayne@69:
jpayne@69: /* Bindable commands for word completion. */
jpayne@69: extern int rl_complete (int, int);
jpayne@69: extern int rl_possible_completions (int, int);
jpayne@69: extern int rl_insert_completions (int, int);
jpayne@69: extern int rl_old_menu_complete (int, int);
jpayne@69: extern int rl_menu_complete (int, int);
jpayne@69: extern int rl_backward_menu_complete (int, int);
jpayne@69:
jpayne@69: /* Bindable commands for killing and yanking text, and managing the kill ring. */
jpayne@69: extern int rl_kill_word (int, int);
jpayne@69: extern int rl_backward_kill_word (int, int);
jpayne@69: extern int rl_kill_line (int, int);
jpayne@69: extern int rl_backward_kill_line (int, int);
jpayne@69: extern int rl_kill_full_line (int, int);
jpayne@69: extern int rl_unix_word_rubout (int, int);
jpayne@69: extern int rl_unix_filename_rubout (int, int);
jpayne@69: extern int rl_unix_line_discard (int, int);
jpayne@69: extern int rl_copy_region_to_kill (int, int);
jpayne@69: extern int rl_kill_region (int, int);
jpayne@69: extern int rl_copy_forward_word (int, int);
jpayne@69: extern int rl_copy_backward_word (int, int);
jpayne@69: extern int rl_yank (int, int);
jpayne@69: extern int rl_yank_pop (int, int);
jpayne@69: extern int rl_yank_nth_arg (int, int);
jpayne@69: extern int rl_yank_last_arg (int, int);
jpayne@69: extern int rl_bracketed_paste_begin (int, int);
jpayne@69: /* Not available unless _WIN32 is defined. */
jpayne@69: #if defined (_WIN32)
jpayne@69: extern int rl_paste_from_clipboard (int, int);
jpayne@69: #endif
jpayne@69:
jpayne@69: /* Bindable commands for incremental searching. */
jpayne@69: extern int rl_reverse_search_history (int, int);
jpayne@69: extern int rl_forward_search_history (int, int);
jpayne@69:
jpayne@69: /* Bindable keyboard macro commands. */
jpayne@69: extern int rl_start_kbd_macro (int, int);
jpayne@69: extern int rl_end_kbd_macro (int, int);
jpayne@69: extern int rl_call_last_kbd_macro (int, int);
jpayne@69: extern int rl_print_last_kbd_macro (int, int);
jpayne@69:
jpayne@69: /* Bindable undo commands. */
jpayne@69: extern int rl_revert_line (int, int);
jpayne@69: extern int rl_undo_command (int, int);
jpayne@69:
jpayne@69: /* Bindable tilde expansion commands. */
jpayne@69: extern int rl_tilde_expand (int, int);
jpayne@69:
jpayne@69: /* Bindable terminal control commands. */
jpayne@69: extern int rl_restart_output (int, int);
jpayne@69: extern int rl_stop_output (int, int);
jpayne@69:
jpayne@69: /* Miscellaneous bindable commands. */
jpayne@69: extern int rl_abort (int, int);
jpayne@69: extern int rl_tty_status (int, int);
jpayne@69:
jpayne@69: /* Bindable commands for incremental and non-incremental history searching. */
jpayne@69: extern int rl_history_search_forward (int, int);
jpayne@69: extern int rl_history_search_backward (int, int);
jpayne@69: extern int rl_history_substr_search_forward (int, int);
jpayne@69: extern int rl_history_substr_search_backward (int, int);
jpayne@69: extern int rl_noninc_forward_search (int, int);
jpayne@69: extern int rl_noninc_reverse_search (int, int);
jpayne@69: extern int rl_noninc_forward_search_again (int, int);
jpayne@69: extern int rl_noninc_reverse_search_again (int, int);
jpayne@69:
jpayne@69: /* Bindable command used when inserting a matching close character. */
jpayne@69: extern int rl_insert_close (int, int);
jpayne@69:
jpayne@69: /* Not available unless READLINE_CALLBACKS is defined. */
jpayne@69: extern void rl_callback_handler_install (const char *, rl_vcpfunc_t *);
jpayne@69: extern void rl_callback_read_char (void);
jpayne@69: extern void rl_callback_handler_remove (void);
jpayne@69: extern void rl_callback_sigcleanup (void);
jpayne@69:
jpayne@69: /* Things for vi mode. Not available unless readline is compiled -DVI_MODE. */
jpayne@69: /* VI-mode bindable commands. */
jpayne@69: extern int rl_vi_redo (int, int);
jpayne@69: extern int rl_vi_undo (int, int);
jpayne@69: extern int rl_vi_yank_arg (int, int);
jpayne@69: extern int rl_vi_fetch_history (int, int);
jpayne@69: extern int rl_vi_search_again (int, int);
jpayne@69: extern int rl_vi_search (int, int);
jpayne@69: extern int rl_vi_complete (int, int);
jpayne@69: extern int rl_vi_tilde_expand (int, int);
jpayne@69: extern int rl_vi_prev_word (int, int);
jpayne@69: extern int rl_vi_next_word (int, int);
jpayne@69: extern int rl_vi_end_word (int, int);
jpayne@69: extern int rl_vi_insert_beg (int, int);
jpayne@69: extern int rl_vi_append_mode (int, int);
jpayne@69: extern int rl_vi_append_eol (int, int);
jpayne@69: extern int rl_vi_eof_maybe (int, int);
jpayne@69: extern int rl_vi_insertion_mode (int, int);
jpayne@69: extern int rl_vi_insert_mode (int, int);
jpayne@69: extern int rl_vi_movement_mode (int, int);
jpayne@69: extern int rl_vi_arg_digit (int, int);
jpayne@69: extern int rl_vi_change_case (int, int);
jpayne@69: extern int rl_vi_put (int, int);
jpayne@69: extern int rl_vi_column (int, int);
jpayne@69: extern int rl_vi_delete_to (int, int);
jpayne@69: extern int rl_vi_change_to (int, int);
jpayne@69: extern int rl_vi_yank_to (int, int);
jpayne@69: extern int rl_vi_yank_pop (int, int);
jpayne@69: extern int rl_vi_rubout (int, int);
jpayne@69: extern int rl_vi_delete (int, int);
jpayne@69: extern int rl_vi_back_to_indent (int, int);
jpayne@69: extern int rl_vi_unix_word_rubout (int, int);
jpayne@69: extern int rl_vi_first_print (int, int);
jpayne@69: extern int rl_vi_char_search (int, int);
jpayne@69: extern int rl_vi_match (int, int);
jpayne@69: extern int rl_vi_change_char (int, int);
jpayne@69: extern int rl_vi_subst (int, int);
jpayne@69: extern int rl_vi_overstrike (int, int);
jpayne@69: extern int rl_vi_overstrike_delete (int, int);
jpayne@69: extern int rl_vi_replace (int, int);
jpayne@69: extern int rl_vi_set_mark (int, int);
jpayne@69: extern int rl_vi_goto_mark (int, int);
jpayne@69:
jpayne@69: /* VI-mode utility functions. */
jpayne@69: extern int rl_vi_check (void);
jpayne@69: extern int rl_vi_domove (int, int *);
jpayne@69: extern int rl_vi_bracktype (int);
jpayne@69:
jpayne@69: extern void rl_vi_start_inserting (int, int, int);
jpayne@69:
jpayne@69: /* VI-mode pseudo-bindable commands, used as utility functions. */
jpayne@69: extern int rl_vi_fWord (int, int);
jpayne@69: extern int rl_vi_bWord (int, int);
jpayne@69: extern int rl_vi_eWord (int, int);
jpayne@69: extern int rl_vi_fword (int, int);
jpayne@69: extern int rl_vi_bword (int, int);
jpayne@69: extern int rl_vi_eword (int, int);
jpayne@69:
jpayne@69: /* **************************************************************** */
jpayne@69: /* */
jpayne@69: /* Well Published Functions */
jpayne@69: /* */
jpayne@69: /* **************************************************************** */
jpayne@69:
jpayne@69: /* Readline functions. */
jpayne@69: /* Read a line of input. Prompt with PROMPT. A NULL PROMPT means none. */
jpayne@69: extern char *readline (const char *);
jpayne@69:
jpayne@69: extern int rl_set_prompt (const char *);
jpayne@69: extern int rl_expand_prompt (char *);
jpayne@69:
jpayne@69: extern int rl_initialize (void);
jpayne@69:
jpayne@69: /* Undocumented; unused by readline */
jpayne@69: extern int rl_discard_argument (void);
jpayne@69:
jpayne@69: /* Utility functions to bind keys to readline commands. */
jpayne@69: extern int rl_add_defun (const char *, rl_command_func_t *, int);
jpayne@69: extern int rl_bind_key (int, rl_command_func_t *);
jpayne@69: extern int rl_bind_key_in_map (int, rl_command_func_t *, Keymap);
jpayne@69: extern int rl_unbind_key (int);
jpayne@69: extern int rl_unbind_key_in_map (int, Keymap);
jpayne@69: extern int rl_bind_key_if_unbound (int, rl_command_func_t *);
jpayne@69: extern int rl_bind_key_if_unbound_in_map (int, rl_command_func_t *, Keymap);
jpayne@69: extern int rl_unbind_function_in_map (rl_command_func_t *, Keymap);
jpayne@69: extern int rl_unbind_command_in_map (const char *, Keymap);
jpayne@69: extern int rl_bind_keyseq (const char *, rl_command_func_t *);
jpayne@69: extern int rl_bind_keyseq_in_map (const char *, rl_command_func_t *, Keymap);
jpayne@69: extern int rl_bind_keyseq_if_unbound (const char *, rl_command_func_t *);
jpayne@69: extern int rl_bind_keyseq_if_unbound_in_map (const char *, rl_command_func_t *, Keymap);
jpayne@69: extern int rl_generic_bind (int, const char *, char *, Keymap);
jpayne@69:
jpayne@69: extern char *rl_variable_value (const char *);
jpayne@69: extern int rl_variable_bind (const char *, const char *);
jpayne@69:
jpayne@69: /* Backwards compatibility, use rl_bind_keyseq_in_map instead. */
jpayne@69: extern int rl_set_key (const char *, rl_command_func_t *, Keymap);
jpayne@69:
jpayne@69: /* Backwards compatibility, use rl_generic_bind instead. */
jpayne@69: extern int rl_macro_bind (const char *, const char *, Keymap);
jpayne@69:
jpayne@69: /* Undocumented in the texinfo manual; not really useful to programs. */
jpayne@69: extern int rl_translate_keyseq (const char *, char *, int *);
jpayne@69: extern char *rl_untranslate_keyseq (int);
jpayne@69:
jpayne@69: extern rl_command_func_t *rl_named_function (const char *);
jpayne@69: extern rl_command_func_t *rl_function_of_keyseq (const char *, Keymap, int *);
jpayne@69: extern rl_command_func_t *rl_function_of_keyseq_len (const char *, size_t, Keymap, int *);
jpayne@69: extern int rl_trim_arg_from_keyseq (const char *, size_t, Keymap);
jpayne@69:
jpayne@69: extern void rl_list_funmap_names (void);
jpayne@69: extern char **rl_invoking_keyseqs_in_map (rl_command_func_t *, Keymap);
jpayne@69: extern char **rl_invoking_keyseqs (rl_command_func_t *);
jpayne@69:
jpayne@69: extern void rl_function_dumper (int);
jpayne@69: extern void rl_macro_dumper (int);
jpayne@69: extern void rl_variable_dumper (int);
jpayne@69:
jpayne@69: extern int rl_read_init_file (const char *);
jpayne@69: extern int rl_parse_and_bind (char *);
jpayne@69:
jpayne@69: /* Functions for manipulating keymaps. */
jpayne@69: extern Keymap rl_make_bare_keymap (void);
jpayne@69: extern int rl_empty_keymap (Keymap);
jpayne@69: extern Keymap rl_copy_keymap (Keymap);
jpayne@69: extern Keymap rl_make_keymap (void);
jpayne@69: extern void rl_discard_keymap (Keymap);
jpayne@69: extern void rl_free_keymap (Keymap);
jpayne@69:
jpayne@69: extern Keymap rl_get_keymap_by_name (const char *);
jpayne@69: extern char *rl_get_keymap_name (Keymap);
jpayne@69: extern void rl_set_keymap (Keymap);
jpayne@69: extern Keymap rl_get_keymap (void);
jpayne@69:
jpayne@69: extern int rl_set_keymap_name (const char *, Keymap);
jpayne@69:
jpayne@69: /* Undocumented; used internally only. */
jpayne@69: extern void rl_set_keymap_from_edit_mode (void);
jpayne@69: extern char *rl_get_keymap_name_from_edit_mode (void);
jpayne@69:
jpayne@69: /* Functions for manipulating the funmap, which maps command names to functions. */
jpayne@69: extern int rl_add_funmap_entry (const char *, rl_command_func_t *);
jpayne@69: extern const char **rl_funmap_names (void);
jpayne@69: /* Undocumented, only used internally -- there is only one funmap, and this
jpayne@69: function may be called only once. */
jpayne@69: extern void rl_initialize_funmap (void);
jpayne@69:
jpayne@69: /* Utility functions for managing keyboard macros. */
jpayne@69: extern void rl_push_macro_input (char *);
jpayne@69:
jpayne@69: /* Functions for undoing, from undo.c */
jpayne@69: extern void rl_add_undo (enum undo_code, int, int, char *);
jpayne@69: extern void rl_free_undo_list (void);
jpayne@69: extern int rl_do_undo (void);
jpayne@69: extern int rl_begin_undo_group (void);
jpayne@69: extern int rl_end_undo_group (void);
jpayne@69: extern int rl_modifying (int, int);
jpayne@69:
jpayne@69: /* Functions for redisplay. */
jpayne@69: extern void rl_redisplay (void);
jpayne@69: extern int rl_on_new_line (void);
jpayne@69: extern int rl_on_new_line_with_prompt (void);
jpayne@69: extern int rl_forced_update_display (void);
jpayne@69: extern int rl_clear_visible_line (void);
jpayne@69: extern int rl_clear_message (void);
jpayne@69: extern int rl_reset_line_state (void);
jpayne@69: extern int rl_crlf (void);
jpayne@69:
jpayne@69: /* Functions to manage the mark and region, especially the notion of an
jpayne@69: active mark and an active region. */
jpayne@69: extern void rl_keep_mark_active (void);
jpayne@69:
jpayne@69: extern void rl_activate_mark (void);
jpayne@69: extern void rl_deactivate_mark (void);
jpayne@69: extern int rl_mark_active_p (void);
jpayne@69:
jpayne@69: #if defined (USE_VARARGS) && defined (PREFER_STDARG)
jpayne@69: extern int rl_message (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
jpayne@69: #else
jpayne@69: extern int rl_message ();
jpayne@69: #endif
jpayne@69:
jpayne@69: extern int rl_show_char (int);
jpayne@69:
jpayne@69: /* Undocumented in texinfo manual. */
jpayne@69: extern int rl_character_len (int, int);
jpayne@69: extern void rl_redraw_prompt_last_line (void);
jpayne@69:
jpayne@69: /* Save and restore internal prompt redisplay information. */
jpayne@69: extern void rl_save_prompt (void);
jpayne@69: extern void rl_restore_prompt (void);
jpayne@69:
jpayne@69: /* Modifying text. */
jpayne@69: extern void rl_replace_line (const char *, int);
jpayne@69: extern int rl_insert_text (const char *);
jpayne@69: extern int rl_delete_text (int, int);
jpayne@69: extern int rl_kill_text (int, int);
jpayne@69: extern char *rl_copy_text (int, int);
jpayne@69:
jpayne@69: /* Terminal and tty mode management. */
jpayne@69: extern void rl_prep_terminal (int);
jpayne@69: extern void rl_deprep_terminal (void);
jpayne@69: extern void rl_tty_set_default_bindings (Keymap);
jpayne@69: extern void rl_tty_unset_default_bindings (Keymap);
jpayne@69:
jpayne@69: extern int rl_tty_set_echoing (int);
jpayne@69: extern int rl_reset_terminal (const char *);
jpayne@69: extern void rl_resize_terminal (void);
jpayne@69: extern void rl_set_screen_size (int, int);
jpayne@69: extern void rl_get_screen_size (int *, int *);
jpayne@69: extern void rl_reset_screen_size (void);
jpayne@69:
jpayne@69: extern char *rl_get_termcap (const char *);
jpayne@69:
jpayne@69: /* Functions for character input. */
jpayne@69: extern int rl_stuff_char (int);
jpayne@69: extern int rl_execute_next (int);
jpayne@69: extern int rl_clear_pending_input (void);
jpayne@69: extern int rl_read_key (void);
jpayne@69: extern int rl_getc (FILE *);
jpayne@69: extern int rl_set_keyboard_input_timeout (int);
jpayne@69:
jpayne@69: /* Functions to set and reset timeouts. */
jpayne@69: extern int rl_set_timeout (unsigned int, unsigned int);
jpayne@69: extern int rl_timeout_remaining (unsigned int *, unsigned int *);
jpayne@69:
jpayne@69: #undef rl_clear_timeout
jpayne@69: #define rl_clear_timeout() rl_set_timeout (0, 0)
jpayne@69:
jpayne@69: /* `Public' utility functions . */
jpayne@69: extern void rl_extend_line_buffer (int);
jpayne@69: extern int rl_ding (void);
jpayne@69: extern int rl_alphabetic (int);
jpayne@69: extern void rl_free (void *);
jpayne@69:
jpayne@69: /* Readline signal handling, from signals.c */
jpayne@69: extern int rl_set_signals (void);
jpayne@69: extern int rl_clear_signals (void);
jpayne@69: extern void rl_cleanup_after_signal (void);
jpayne@69: extern void rl_reset_after_signal (void);
jpayne@69: extern void rl_free_line_state (void);
jpayne@69:
jpayne@69: extern int rl_pending_signal (void);
jpayne@69: extern void rl_check_signals (void);
jpayne@69:
jpayne@69: extern void rl_echo_signal_char (int);
jpayne@69:
jpayne@69: extern int rl_set_paren_blink_timeout (int);
jpayne@69:
jpayne@69: /* History management functions. */
jpayne@69:
jpayne@69: extern void rl_clear_history (void);
jpayne@69:
jpayne@69: /* Undocumented. */
jpayne@69: extern int rl_maybe_save_line (void);
jpayne@69: extern int rl_maybe_unsave_line (void);
jpayne@69: extern int rl_maybe_replace_line (void);
jpayne@69:
jpayne@69: /* Completion functions. */
jpayne@69: extern int rl_complete_internal (int);
jpayne@69: extern void rl_display_match_list (char **, int, int);
jpayne@69:
jpayne@69: extern char **rl_completion_matches (const char *, rl_compentry_func_t *);
jpayne@69: extern char *rl_username_completion_function (const char *, int);
jpayne@69: extern char *rl_filename_completion_function (const char *, int);
jpayne@69:
jpayne@69: extern int rl_completion_mode (rl_command_func_t *);
jpayne@69:
jpayne@69: #if 0
jpayne@69: /* Backwards compatibility (compat.c). These will go away sometime. */
jpayne@69: extern void free_undo_list (void);
jpayne@69: extern int maybe_save_line (void);
jpayne@69: extern int maybe_unsave_line (void);
jpayne@69: extern int maybe_replace_line (void);
jpayne@69:
jpayne@69: extern int ding (void);
jpayne@69: extern int alphabetic (int);
jpayne@69: extern int crlf (void);
jpayne@69:
jpayne@69: extern char **completion_matches (char *, rl_compentry_func_t *);
jpayne@69: extern char *username_completion_function (const char *, int);
jpayne@69: extern char *filename_completion_function (const char *, int);
jpayne@69: #endif
jpayne@69:
jpayne@69: /* **************************************************************** */
jpayne@69: /* */
jpayne@69: /* Well Published Variables */
jpayne@69: /* */
jpayne@69: /* **************************************************************** */
jpayne@69:
jpayne@69: /* The version of this incarnation of the readline library. */
jpayne@69: extern const char *rl_library_version; /* e.g., "4.2" */
jpayne@69: extern int rl_readline_version; /* e.g., 0x0402 */
jpayne@69:
jpayne@69: /* True if this is real GNU readline. */
jpayne@69: extern int rl_gnu_readline_p;
jpayne@69:
jpayne@69: /* Flags word encapsulating the current readline state. */
jpayne@69: extern unsigned long rl_readline_state;
jpayne@69:
jpayne@69: /* Says which editing mode readline is currently using. 1 means emacs mode;
jpayne@69: 0 means vi mode. */
jpayne@69: extern int rl_editing_mode;
jpayne@69:
jpayne@69: /* Insert or overwrite mode for emacs mode. 1 means insert mode; 0 means
jpayne@69: overwrite mode. Reset to insert mode on each input line. */
jpayne@69: extern int rl_insert_mode;
jpayne@69:
jpayne@69: /* The name of the calling program. You should initialize this to
jpayne@69: whatever was in argv[0]. It is used when parsing conditionals. */
jpayne@69: extern const char *rl_readline_name;
jpayne@69:
jpayne@69: /* The prompt readline uses. This is set from the argument to
jpayne@69: readline (), and should not be assigned to directly. */
jpayne@69: extern char *rl_prompt;
jpayne@69:
jpayne@69: /* The prompt string that is actually displayed by rl_redisplay. Public so
jpayne@69: applications can more easily supply their own redisplay functions. */
jpayne@69: extern char *rl_display_prompt;
jpayne@69:
jpayne@69: /* The line buffer that is in use. */
jpayne@69: extern char *rl_line_buffer;
jpayne@69:
jpayne@69: /* The location of point, and end. */
jpayne@69: extern int rl_point;
jpayne@69: extern int rl_end;
jpayne@69:
jpayne@69: /* The mark, or saved cursor position. */
jpayne@69: extern int rl_mark;
jpayne@69:
jpayne@69: /* Flag to indicate that readline has finished with the current input
jpayne@69: line and should return it. */
jpayne@69: extern int rl_done;
jpayne@69:
jpayne@69: /* Flag to indicate that readline has read an EOF character or read has
jpayne@69: returned 0 or error, and is returning a NULL line as a result. */
jpayne@69: extern int rl_eof_found;
jpayne@69:
jpayne@69: /* If set to a character value, that will be the next keystroke read. */
jpayne@69: extern int rl_pending_input;
jpayne@69:
jpayne@69: /* Non-zero if we called this function from _rl_dispatch(). It's present
jpayne@69: so functions can find out whether they were called from a key binding
jpayne@69: or directly from an application. */
jpayne@69: extern int rl_dispatching;
jpayne@69:
jpayne@69: /* Non-zero if the user typed a numeric argument before executing the
jpayne@69: current function. */
jpayne@69: extern int rl_explicit_arg;
jpayne@69:
jpayne@69: /* The current value of the numeric argument specified by the user. */
jpayne@69: extern int rl_numeric_arg;
jpayne@69:
jpayne@69: /* The address of the last command function Readline executed. */
jpayne@69: extern rl_command_func_t *rl_last_func;
jpayne@69:
jpayne@69: /* The name of the terminal to use. */
jpayne@69: extern const char *rl_terminal_name;
jpayne@69:
jpayne@69: /* The input and output streams. */
jpayne@69: extern FILE *rl_instream;
jpayne@69: extern FILE *rl_outstream;
jpayne@69:
jpayne@69: /* If non-zero, Readline gives values of LINES and COLUMNS from the environment
jpayne@69: greater precedence than values fetched from the kernel when computing the
jpayne@69: screen dimensions. */
jpayne@69: extern int rl_prefer_env_winsize;
jpayne@69:
jpayne@69: /* If non-zero, then this is the address of a function to call just
jpayne@69: before readline_internal () prints the first prompt. */
jpayne@69: extern rl_hook_func_t *rl_startup_hook;
jpayne@69:
jpayne@69: /* If non-zero, this is the address of a function to call just before
jpayne@69: readline_internal_setup () returns and readline_internal starts
jpayne@69: reading input characters. */
jpayne@69: extern rl_hook_func_t *rl_pre_input_hook;
jpayne@69:
jpayne@69: /* The address of a function to call periodically while Readline is
jpayne@69: awaiting character input, or NULL, for no event handling. */
jpayne@69: extern rl_hook_func_t *rl_event_hook;
jpayne@69:
jpayne@69: /* The address of a function to call if a read is interrupted by a signal. */
jpayne@69: extern rl_hook_func_t *rl_signal_event_hook;
jpayne@69:
jpayne@69: extern rl_hook_func_t *rl_timeout_event_hook;
jpayne@69:
jpayne@69: /* The address of a function to call if Readline needs to know whether or not
jpayne@69: there is data available from the current input source. */
jpayne@69: extern rl_hook_func_t *rl_input_available_hook;
jpayne@69:
jpayne@69: /* The address of the function to call to fetch a character from the current
jpayne@69: Readline input stream */
jpayne@69: extern rl_getc_func_t *rl_getc_function;
jpayne@69:
jpayne@69: extern rl_voidfunc_t *rl_redisplay_function;
jpayne@69:
jpayne@69: extern rl_vintfunc_t *rl_prep_term_function;
jpayne@69: extern rl_voidfunc_t *rl_deprep_term_function;
jpayne@69:
jpayne@69: /* Dispatch variables. */
jpayne@69: extern Keymap rl_executing_keymap;
jpayne@69: extern Keymap rl_binding_keymap;
jpayne@69:
jpayne@69: extern int rl_executing_key;
jpayne@69: extern char *rl_executing_keyseq;
jpayne@69: extern int rl_key_sequence_length;
jpayne@69:
jpayne@69: /* Display variables. */
jpayne@69: /* If non-zero, readline will erase the entire line, including any prompt,
jpayne@69: if the only thing typed on an otherwise-blank line is something bound to
jpayne@69: rl_newline. */
jpayne@69: extern int rl_erase_empty_line;
jpayne@69:
jpayne@69: /* If non-zero, the application has already printed the prompt (rl_prompt)
jpayne@69: before calling readline, so readline should not output it the first time
jpayne@69: redisplay is done. */
jpayne@69: extern int rl_already_prompted;
jpayne@69:
jpayne@69: /* A non-zero value means to read only this many characters rather than
jpayne@69: up to a character bound to accept-line. */
jpayne@69: extern int rl_num_chars_to_read;
jpayne@69:
jpayne@69: /* The text of a currently-executing keyboard macro. */
jpayne@69: extern char *rl_executing_macro;
jpayne@69:
jpayne@69: /* Variables to control readline signal handling. */
jpayne@69: /* If non-zero, readline will install its own signal handlers for
jpayne@69: SIGINT, SIGTERM, SIGQUIT, SIGALRM, SIGTSTP, SIGTTIN, and SIGTTOU. */
jpayne@69: extern int rl_catch_signals;
jpayne@69:
jpayne@69: /* If non-zero, readline will install a signal handler for SIGWINCH
jpayne@69: that also attempts to call any calling application's SIGWINCH signal
jpayne@69: handler. Note that the terminal is not cleaned up before the
jpayne@69: application's signal handler is called; use rl_cleanup_after_signal()
jpayne@69: to do that. */
jpayne@69: extern int rl_catch_sigwinch;
jpayne@69:
jpayne@69: /* If non-zero, the readline SIGWINCH handler will modify LINES and
jpayne@69: COLUMNS in the environment. */
jpayne@69: extern int rl_change_environment;
jpayne@69:
jpayne@69: /* Completion variables. */
jpayne@69: /* Pointer to the generator function for completion_matches ().
jpayne@69: NULL means to use rl_filename_completion_function (), the default
jpayne@69: filename completer. */
jpayne@69: extern rl_compentry_func_t *rl_completion_entry_function;
jpayne@69:
jpayne@69: /* Optional generator for menu completion. Default is
jpayne@69: rl_completion_entry_function (rl_filename_completion_function). */
jpayne@69: extern rl_compentry_func_t *rl_menu_completion_entry_function;
jpayne@69:
jpayne@69: /* If rl_ignore_some_completions_function is non-NULL it is the address
jpayne@69: of a function to call after all of the possible matches have been
jpayne@69: generated, but before the actual completion is done to the input line.
jpayne@69: The function is called with one argument; a NULL terminated array
jpayne@69: of (char *). If your function removes any of the elements, they
jpayne@69: must be free()'ed. */
jpayne@69: extern rl_compignore_func_t *rl_ignore_some_completions_function;
jpayne@69:
jpayne@69: /* Pointer to alternative function to create matches.
jpayne@69: Function is called with TEXT, START, and END.
jpayne@69: START and END are indices in RL_LINE_BUFFER saying what the boundaries
jpayne@69: of TEXT are.
jpayne@69: If this function exists and returns NULL then call the value of
jpayne@69: rl_completion_entry_function to try to match, otherwise use the
jpayne@69: array of strings returned. */
jpayne@69: extern rl_completion_func_t *rl_attempted_completion_function;
jpayne@69:
jpayne@69: /* The basic list of characters that signal a break between words for the
jpayne@69: completer routine. The initial contents of this variable is what
jpayne@69: breaks words in the shell, i.e. "n\"\\'`@$>". */
jpayne@69: extern const char *rl_basic_word_break_characters;
jpayne@69:
jpayne@69: /* The list of characters that signal a break between words for
jpayne@69: rl_complete_internal. The default list is the contents of
jpayne@69: rl_basic_word_break_characters. */
jpayne@69: extern const char *rl_completer_word_break_characters;
jpayne@69:
jpayne@69: /* Hook function to allow an application to set the completion word
jpayne@69: break characters before readline breaks up the line. Allows
jpayne@69: position-dependent word break characters. */
jpayne@69: extern rl_cpvfunc_t *rl_completion_word_break_hook;
jpayne@69:
jpayne@69: /* List of characters which can be used to quote a substring of the line.
jpayne@69: Completion occurs on the entire substring, and within the substring
jpayne@69: rl_completer_word_break_characters are treated as any other character,
jpayne@69: unless they also appear within this list. */
jpayne@69: extern const char *rl_completer_quote_characters;
jpayne@69:
jpayne@69: /* List of quote characters which cause a word break. */
jpayne@69: extern const char *rl_basic_quote_characters;
jpayne@69:
jpayne@69: /* List of characters that need to be quoted in filenames by the completer. */
jpayne@69: extern const char *rl_filename_quote_characters;
jpayne@69:
jpayne@69: /* List of characters that are word break characters, but should be left
jpayne@69: in TEXT when it is passed to the completion function. The shell uses
jpayne@69: this to help determine what kind of completing to do. */
jpayne@69: extern const char *rl_special_prefixes;
jpayne@69:
jpayne@69: /* If non-zero, then this is the address of a function to call when
jpayne@69: completing on a directory name. The function is called with
jpayne@69: the address of a string (the current directory name) as an arg. It
jpayne@69: changes what is displayed when the possible completions are printed
jpayne@69: or inserted. The directory completion hook should perform
jpayne@69: any necessary dequoting. This function should return 1 if it modifies
jpayne@69: the directory name pointer passed as an argument. If the directory
jpayne@69: completion hook returns 0, it should not modify the directory name
jpayne@69: pointer passed as an argument. */
jpayne@69: extern rl_icppfunc_t *rl_directory_completion_hook;
jpayne@69:
jpayne@69: /* If non-zero, this is the address of a function to call when completing
jpayne@69: a directory name. This function takes the address of the directory name
jpayne@69: to be modified as an argument. Unlike rl_directory_completion_hook, it
jpayne@69: only modifies the directory name used in opendir(2), not what is displayed
jpayne@69: when the possible completions are printed or inserted. If set, it takes
jpayne@69: precedence over rl_directory_completion_hook. The directory rewrite
jpayne@69: hook should perform any necessary dequoting. This function has the same
jpayne@69: return value properties as the directory_completion_hook.
jpayne@69:
jpayne@69: I'm not happy with how this works yet, so it's undocumented. I'm trying
jpayne@69: it in bash to see how well it goes. */
jpayne@69: extern rl_icppfunc_t *rl_directory_rewrite_hook;
jpayne@69:
jpayne@69: /* If non-zero, this is the address of a function for the completer to call
jpayne@69: before deciding which character to append to a completed name. It should
jpayne@69: modify the directory name passed as an argument if appropriate, and return
jpayne@69: non-zero if it modifies the name. This should not worry about dequoting
jpayne@69: the filename; that has already happened by the time it gets here. */
jpayne@69: extern rl_icppfunc_t *rl_filename_stat_hook;
jpayne@69:
jpayne@69: /* If non-zero, this is the address of a function to call when reading
jpayne@69: directory entries from the filesystem for completion and comparing
jpayne@69: them to the partial word to be completed. The function should
jpayne@69: either return its first argument (if no conversion takes place) or
jpayne@69: newly-allocated memory. This can, for instance, convert filenames
jpayne@69: between character sets for comparison against what's typed at the
jpayne@69: keyboard. The returned value is what is added to the list of
jpayne@69: matches. The second argument is the length of the filename to be
jpayne@69: converted. */
jpayne@69: extern rl_dequote_func_t *rl_filename_rewrite_hook;
jpayne@69:
jpayne@69: /* Backwards compatibility with previous versions of readline. */
jpayne@69: #define rl_symbolic_link_hook rl_directory_completion_hook
jpayne@69:
jpayne@69: /* If non-zero, then this is the address of a function to call when
jpayne@69: completing a word would normally display the list of possible matches.
jpayne@69: This function is called instead of actually doing the display.
jpayne@69: It takes three arguments: (char **matches, int num_matches, int max_length)
jpayne@69: where MATCHES is the array of strings that matched, NUM_MATCHES is the
jpayne@69: number of strings in that array, and MAX_LENGTH is the length of the
jpayne@69: longest string in that array. */
jpayne@69: extern rl_compdisp_func_t *rl_completion_display_matches_hook;
jpayne@69:
jpayne@69: /* Non-zero means that the results of the matches are to be treated
jpayne@69: as filenames. This is ALWAYS zero on entry, and can only be changed
jpayne@69: within a completion entry finder function. */
jpayne@69: extern int rl_filename_completion_desired;
jpayne@69:
jpayne@69: /* Non-zero means that the results of the matches are to be quoted using
jpayne@69: double quotes (or an application-specific quoting mechanism) if the
jpayne@69: filename contains any characters in rl_word_break_chars. This is
jpayne@69: ALWAYS non-zero on entry, and can only be changed within a completion
jpayne@69: entry finder function. */
jpayne@69: extern int rl_filename_quoting_desired;
jpayne@69:
jpayne@69: /* Set to a function to quote a filename in an application-specific fashion.
jpayne@69: Called with the text to quote, the type of match found (single or multiple)
jpayne@69: and a pointer to the quoting character to be used, which the function can
jpayne@69: reset if desired. */
jpayne@69: extern rl_quote_func_t *rl_filename_quoting_function;
jpayne@69:
jpayne@69: /* Function to call to remove quoting characters from a filename. Called
jpayne@69: before completion is attempted, so the embedded quotes do not interfere
jpayne@69: with matching names in the file system. */
jpayne@69: extern rl_dequote_func_t *rl_filename_dequoting_function;
jpayne@69:
jpayne@69: /* Function to call to decide whether or not a word break character is
jpayne@69: quoted. If a character is quoted, it does not break words for the
jpayne@69: completer. */
jpayne@69: extern rl_linebuf_func_t *rl_char_is_quoted_p;
jpayne@69:
jpayne@69: /* Non-zero means to suppress normal filename completion after the
jpayne@69: user-specified completion function has been called. */
jpayne@69: extern int rl_attempted_completion_over;
jpayne@69:
jpayne@69: /* Set to a character describing the type of completion being attempted by
jpayne@69: rl_complete_internal; available for use by application completion
jpayne@69: functions. */
jpayne@69: extern int rl_completion_type;
jpayne@69:
jpayne@69: /* Set to the last key used to invoke one of the completion functions */
jpayne@69: extern int rl_completion_invoking_key;
jpayne@69:
jpayne@69: /* Up to this many items will be displayed in response to a
jpayne@69: possible-completions call. After that, we ask the user if she
jpayne@69: is sure she wants to see them all. The default value is 100. */
jpayne@69: extern int rl_completion_query_items;
jpayne@69:
jpayne@69: /* Character appended to completed words when at the end of the line. The
jpayne@69: default is a space. Nothing is added if this is '\0'. */
jpayne@69: extern int rl_completion_append_character;
jpayne@69:
jpayne@69: /* If set to non-zero by an application completion function,
jpayne@69: rl_completion_append_character will not be appended. */
jpayne@69: extern int rl_completion_suppress_append;
jpayne@69:
jpayne@69: /* Set to any quote character readline thinks it finds before any application
jpayne@69: completion function is called. */
jpayne@69: extern int rl_completion_quote_character;
jpayne@69:
jpayne@69: /* Set to a non-zero value if readline found quoting anywhere in the word to
jpayne@69: be completed; set before any application completion function is called. */
jpayne@69: extern int rl_completion_found_quote;
jpayne@69:
jpayne@69: /* If non-zero, the completion functions don't append any closing quote.
jpayne@69: This is set to 0 by rl_complete_internal and may be changed by an
jpayne@69: application-specific completion function. */
jpayne@69: extern int rl_completion_suppress_quote;
jpayne@69:
jpayne@69: /* If non-zero, readline will sort the completion matches. On by default. */
jpayne@69: extern int rl_sort_completion_matches;
jpayne@69:
jpayne@69: /* If non-zero, a slash will be appended to completed filenames that are
jpayne@69: symbolic links to directory names, subject to the value of the
jpayne@69: mark-directories variable (which is user-settable). This exists so
jpayne@69: that application completion functions can override the user's preference
jpayne@69: (set via the mark-symlinked-directories variable) if appropriate.
jpayne@69: It's set to the value of _rl_complete_mark_symlink_dirs in
jpayne@69: rl_complete_internal before any application-specific completion
jpayne@69: function is called, so without that function doing anything, the user's
jpayne@69: preferences are honored. */
jpayne@69: extern int rl_completion_mark_symlink_dirs;
jpayne@69:
jpayne@69: /* If non-zero, then disallow duplicates in the matches. */
jpayne@69: extern int rl_ignore_completion_duplicates;
jpayne@69:
jpayne@69: /* If this is non-zero, completion is (temporarily) inhibited, and the
jpayne@69: completion character will be inserted as any other. */
jpayne@69: extern int rl_inhibit_completion;
jpayne@69:
jpayne@69: /* Applications can set this to non-zero to have readline's signal handlers
jpayne@69: installed during the entire duration of reading a complete line, as in
jpayne@69: readline-6.2. This should be used with care, because it can result in
jpayne@69: readline receiving signals and not handling them until it's called again
jpayne@69: via rl_callback_read_char, thereby stealing them from the application.
jpayne@69: By default, signal handlers are only active while readline is active. */
jpayne@69: extern int rl_persistent_signal_handlers;
jpayne@69:
jpayne@69: /* Input error; can be returned by (*rl_getc_function) if readline is reading
jpayne@69: a top-level command (RL_ISSTATE (RL_STATE_READCMD)). */
jpayne@69: #define READERR (-2)
jpayne@69:
jpayne@69: /* Definitions available for use by readline clients. */
jpayne@69: #define RL_PROMPT_START_IGNORE '\001'
jpayne@69: #define RL_PROMPT_END_IGNORE '\002'
jpayne@69:
jpayne@69: /* Possible values for do_replace argument to rl_filename_quoting_function,
jpayne@69: called by rl_complete_internal. */
jpayne@69: #define NO_MATCH 0
jpayne@69: #define SINGLE_MATCH 1
jpayne@69: #define MULT_MATCH 2
jpayne@69:
jpayne@69: /* Possible state values for rl_readline_state */
jpayne@69: #define RL_STATE_NONE 0x000000 /* no state; before first call */
jpayne@69:
jpayne@69: #define RL_STATE_INITIALIZING 0x0000001 /* initializing */
jpayne@69: #define RL_STATE_INITIALIZED 0x0000002 /* initialization done */
jpayne@69: #define RL_STATE_TERMPREPPED 0x0000004 /* terminal is prepped */
jpayne@69: #define RL_STATE_READCMD 0x0000008 /* reading a command key */
jpayne@69: #define RL_STATE_METANEXT 0x0000010 /* reading input after ESC */
jpayne@69: #define RL_STATE_DISPATCHING 0x0000020 /* dispatching to a command */
jpayne@69: #define RL_STATE_MOREINPUT 0x0000040 /* reading more input in a command function */
jpayne@69: #define RL_STATE_ISEARCH 0x0000080 /* doing incremental search */
jpayne@69: #define RL_STATE_NSEARCH 0x0000100 /* doing non-inc search */
jpayne@69: #define RL_STATE_SEARCH 0x0000200 /* doing a history search */
jpayne@69: #define RL_STATE_NUMERICARG 0x0000400 /* reading numeric argument */
jpayne@69: #define RL_STATE_MACROINPUT 0x0000800 /* getting input from a macro */
jpayne@69: #define RL_STATE_MACRODEF 0x0001000 /* defining keyboard macro */
jpayne@69: #define RL_STATE_OVERWRITE 0x0002000 /* overwrite mode */
jpayne@69: #define RL_STATE_COMPLETING 0x0004000 /* doing completion */
jpayne@69: #define RL_STATE_SIGHANDLER 0x0008000 /* in readline sighandler */
jpayne@69: #define RL_STATE_UNDOING 0x0010000 /* doing an undo */
jpayne@69: #define RL_STATE_INPUTPENDING 0x0020000 /* rl_execute_next called */
jpayne@69: #define RL_STATE_TTYCSAVED 0x0040000 /* tty special chars saved */
jpayne@69: #define RL_STATE_CALLBACK 0x0080000 /* using the callback interface */
jpayne@69: #define RL_STATE_VIMOTION 0x0100000 /* reading vi motion arg */
jpayne@69: #define RL_STATE_MULTIKEY 0x0200000 /* reading multiple-key command */
jpayne@69: #define RL_STATE_VICMDONCE 0x0400000 /* entered vi command mode at least once */
jpayne@69: #define RL_STATE_CHARSEARCH 0x0800000 /* vi mode char search */
jpayne@69: #define RL_STATE_REDISPLAYING 0x1000000 /* updating terminal display */
jpayne@69:
jpayne@69: #define RL_STATE_DONE 0x2000000 /* done; accepted line */
jpayne@69: #define RL_STATE_TIMEOUT 0x4000000 /* done; timed out */
jpayne@69: #define RL_STATE_EOF 0x8000000 /* done; got eof on read */
jpayne@69:
jpayne@69: #define RL_SETSTATE(x) (rl_readline_state |= (x))
jpayne@69: #define RL_UNSETSTATE(x) (rl_readline_state &= ~(x))
jpayne@69: #define RL_ISSTATE(x) (rl_readline_state & (x))
jpayne@69:
jpayne@69: struct readline_state {
jpayne@69: /* line state */
jpayne@69: int point;
jpayne@69: int end;
jpayne@69: int mark;
jpayne@69: int buflen;
jpayne@69: char *buffer;
jpayne@69: UNDO_LIST *ul;
jpayne@69: char *prompt;
jpayne@69:
jpayne@69: /* global state */
jpayne@69: int rlstate;
jpayne@69: int done;
jpayne@69: Keymap kmap;
jpayne@69:
jpayne@69: /* input state */
jpayne@69: rl_command_func_t *lastfunc;
jpayne@69: int insmode;
jpayne@69: int edmode;
jpayne@69: char *kseq;
jpayne@69: int kseqlen;
jpayne@69:
jpayne@69: int pendingin;
jpayne@69: FILE *inf;
jpayne@69: FILE *outf;
jpayne@69: char *macro;
jpayne@69:
jpayne@69: /* signal state */
jpayne@69: int catchsigs;
jpayne@69: int catchsigwinch;
jpayne@69:
jpayne@69: /* search state */
jpayne@69:
jpayne@69: /* completion state */
jpayne@69: rl_compentry_func_t *entryfunc;
jpayne@69: rl_compentry_func_t *menuentryfunc;
jpayne@69: rl_compignore_func_t *ignorefunc;
jpayne@69: rl_completion_func_t *attemptfunc;
jpayne@69: const char *wordbreakchars;
jpayne@69:
jpayne@69: /* options state */
jpayne@69:
jpayne@69: /* hook state */
jpayne@69:
jpayne@69: /* reserved for future expansion, so the struct size doesn't change */
jpayne@69: char reserved[64];
jpayne@69: };
jpayne@69:
jpayne@69: extern int rl_save_state (struct readline_state *);
jpayne@69: extern int rl_restore_state (struct readline_state *);
jpayne@69:
jpayne@69: #ifdef __cplusplus
jpayne@69: }
jpayne@69: #endif
jpayne@69:
jpayne@69: #endif /* _READLINE_H_ */