Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-18 09:27:11

0001 /* Readline.h -- the names of functions callable from within readline. */
0002 
0003 /* Copyright (C) 1987-2024 Free Software Foundation, Inc.
0004 
0005    This file is part of the GNU Readline Library (Readline), a library
0006    for reading lines of text with interactive input and history editing.      
0007 
0008    Readline is free software: you can redistribute it and/or modify
0009    it under the terms of the GNU General Public License as published by
0010    the Free Software Foundation, either version 3 of the License, or
0011    (at your option) any later version.
0012 
0013    Readline is distributed in the hope that it will be useful,
0014    but WITHOUT ANY WARRANTY; without even the implied warranty of
0015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0016    GNU General Public License for more details.
0017 
0018    You should have received a copy of the GNU General Public License
0019    along with Readline.  If not, see <http://www.gnu.org/licenses/>.
0020 */
0021 
0022 #if !defined (_READLINE_H_)
0023 #define _READLINE_H_
0024 
0025 #ifdef __cplusplus
0026 extern "C" {
0027 #endif
0028 
0029 #if defined (READLINE_LIBRARY)
0030 #  include "rlstdc.h"
0031 #  include "rltypedefs.h"
0032 #  include "keymaps.h"
0033 #  include "tilde.h"
0034 #else
0035 #  include <readline/rlstdc.h>
0036 #  include <readline/rltypedefs.h>
0037 #  include <readline/keymaps.h>
0038 #  include <readline/tilde.h>
0039 #endif
0040 
0041 /* Hex-encoded Readline version number. */
0042 #define RL_READLINE_VERSION 0x0803      /* Readline 8.3 */
0043 #define RL_VERSION_MAJOR    8
0044 #define RL_VERSION_MINOR    3
0045 
0046 /* Readline data structures. */
0047 
0048 /* Maintaining the state of undo.  We remember individual deletes and inserts
0049    on a chain of things to do. */
0050 
0051 /* The actions that undo knows how to undo.  Notice that UNDO_DELETE means
0052    to insert some text, and UNDO_INSERT means to delete some text.   I.e.,
0053    the code tells undo what to undo, not how to undo it. */
0054 enum undo_code { UNDO_DELETE, UNDO_INSERT, UNDO_BEGIN, UNDO_END };
0055 
0056 /* What an element of THE_UNDO_LIST looks like. */
0057 typedef struct undo_list {
0058   struct undo_list *next;
0059   int start, end;       /* Where the change took place. */
0060   char *text;           /* The text to insert, if undoing a delete. */
0061   enum undo_code what;      /* Delete, Insert, Begin, End. */
0062 } UNDO_LIST;
0063 
0064 /* The current undo list for RL_LINE_BUFFER. */
0065 extern UNDO_LIST *rl_undo_list;
0066 
0067 /* The data structure for mapping textual names to code addresses. */
0068 typedef struct _funmap {
0069   const char *name;
0070   rl_command_func_t *function;
0071 } FUNMAP;
0072 
0073 extern FUNMAP **funmap;
0074 
0075 /* **************************************************************** */
0076 /*                                  */
0077 /*       Functions available to bind to key sequences       */
0078 /*                                  */
0079 /* **************************************************************** */
0080 
0081 /* Bindable commands for numeric arguments. */
0082 extern int rl_digit_argument (int, int);
0083 extern int rl_universal_argument (int, int);
0084 
0085 /* Bindable commands for moving the cursor. */
0086 extern int rl_forward_byte (int, int);
0087 extern int rl_forward_char (int, int);
0088 extern int rl_forward (int, int);
0089 extern int rl_backward_byte (int, int);
0090 extern int rl_backward_char (int, int);
0091 extern int rl_backward (int, int);
0092 extern int rl_beg_of_line (int, int);
0093 extern int rl_end_of_line (int, int);
0094 extern int rl_forward_word (int, int);
0095 extern int rl_backward_word (int, int);
0096 extern int rl_refresh_line (int, int);
0097 extern int rl_clear_screen (int, int);
0098 extern int rl_clear_display (int, int);
0099 extern int rl_skip_csi_sequence (int, int);
0100 extern int rl_arrow_keys (int, int);
0101 
0102 extern int rl_previous_screen_line (int, int);
0103 extern int rl_next_screen_line (int, int);
0104 
0105 /* Bindable commands for inserting and deleting text. */
0106 extern int rl_insert (int, int);
0107 extern int rl_quoted_insert (int, int);
0108 extern int rl_tab_insert (int, int);
0109 extern int rl_newline (int, int);
0110 extern int rl_do_lowercase_version (int, int);
0111 extern int rl_rubout (int, int);
0112 extern int rl_delete (int, int);
0113 extern int rl_rubout_or_delete (int, int);
0114 extern int rl_delete_horizontal_space (int, int);
0115 extern int rl_delete_or_show_completions (int, int);
0116 extern int rl_insert_comment (int, int);
0117 
0118 /* Bindable commands for changing case. */
0119 extern int rl_upcase_word (int, int);
0120 extern int rl_downcase_word (int, int);
0121 extern int rl_capitalize_word (int, int);
0122 
0123 /* Bindable commands for transposing characters and words. */
0124 extern int rl_transpose_words (int, int);
0125 extern int rl_transpose_chars (int, int);
0126 
0127 /* Bindable commands for searching within a line. */
0128 extern int rl_char_search (int, int);
0129 extern int rl_backward_char_search (int, int);
0130 
0131 /* Bindable commands for readline's interface to the command history. */
0132 extern int rl_beginning_of_history (int, int);
0133 extern int rl_end_of_history (int, int);
0134 extern int rl_get_next_history (int, int);
0135 extern int rl_get_previous_history (int, int);
0136 extern int rl_operate_and_get_next (int, int);
0137 extern int rl_fetch_history (int, int);
0138 
0139 /* Bindable commands for managing the mark and region. */
0140 extern int rl_set_mark (int, int);
0141 extern int rl_exchange_point_and_mark (int, int);
0142 
0143 /* Bindable commands to set the editing mode (emacs or vi). */
0144 extern int rl_vi_editing_mode (int, int);
0145 extern int rl_emacs_editing_mode (int, int);
0146 
0147 /* Bindable commands to change the insert mode (insert or overwrite) */
0148 extern int rl_overwrite_mode (int, int);
0149 
0150 /* Bindable commands for managing key bindings. */
0151 extern int rl_re_read_init_file (int, int);
0152 extern int rl_dump_functions (int, int);
0153 extern int rl_dump_macros (int, int);
0154 extern int rl_dump_variables (int, int);
0155 
0156 /* Bindable commands for word completion. */
0157 extern int rl_complete (int, int);
0158 extern int rl_possible_completions (int, int);
0159 extern int rl_insert_completions (int, int);
0160 extern int rl_old_menu_complete (int, int);
0161 extern int rl_menu_complete (int, int);
0162 extern int rl_backward_menu_complete (int, int);
0163 extern int rl_export_completions (int, int);
0164 
0165 /* Bindable commands for killing and yanking text, and managing the kill ring. */
0166 extern int rl_kill_word (int, int);
0167 extern int rl_backward_kill_word (int, int);
0168 extern int rl_kill_line (int, int);
0169 extern int rl_backward_kill_line (int, int);
0170 extern int rl_kill_full_line (int, int);
0171 extern int rl_unix_word_rubout (int, int);
0172 extern int rl_unix_filename_rubout (int, int);
0173 extern int rl_unix_line_discard (int, int);
0174 extern int rl_copy_region_to_kill (int, int);
0175 extern int rl_kill_region (int, int);
0176 extern int rl_copy_forward_word (int, int);
0177 extern int rl_copy_backward_word (int, int);
0178 extern int rl_yank (int, int);
0179 extern int rl_yank_pop (int, int);
0180 extern int rl_yank_nth_arg (int, int);
0181 extern int rl_yank_last_arg (int, int);
0182 extern int rl_bracketed_paste_begin (int, int);
0183 /* Not available unless _WIN32 is defined. */
0184 #if defined (_WIN32)
0185 extern int rl_paste_from_clipboard (int, int);
0186 #endif
0187 
0188 /* Bindable commands for incremental searching. */
0189 extern int rl_reverse_search_history (int, int);
0190 extern int rl_forward_search_history (int, int);
0191 
0192 /* Bindable keyboard macro commands. */
0193 extern int rl_start_kbd_macro (int, int);
0194 extern int rl_end_kbd_macro (int, int);
0195 extern int rl_call_last_kbd_macro (int, int);
0196 extern int rl_print_last_kbd_macro (int, int);
0197 
0198 /* Bindable undo commands. */
0199 extern int rl_revert_line (int, int);
0200 extern int rl_undo_command (int, int);
0201 
0202 /* Bindable tilde expansion commands. */
0203 extern int rl_tilde_expand (int, int);
0204 
0205 /* Bindable terminal control commands. */
0206 extern int rl_restart_output (int, int);
0207 extern int rl_stop_output (int, int);
0208 
0209 /* Miscellaneous bindable commands. */
0210 extern int rl_abort (int, int);
0211 extern int rl_tty_status (int, int);
0212 
0213 extern int rl_execute_named_command (int, int);
0214 
0215 /* Bindable commands for incremental and non-incremental history searching. */
0216 extern int rl_history_search_forward (int, int);
0217 extern int rl_history_search_backward (int, int);
0218 extern int rl_history_substr_search_forward (int, int);
0219 extern int rl_history_substr_search_backward (int, int);
0220 extern int rl_noninc_forward_search (int, int);
0221 extern int rl_noninc_reverse_search (int, int);
0222 extern int rl_noninc_forward_search_again (int, int);
0223 extern int rl_noninc_reverse_search_again (int, int);
0224 
0225 /* Bindable command used when inserting a matching close character. */
0226 extern int rl_insert_close (int, int);
0227 
0228 /* Not available unless READLINE_CALLBACKS is defined. */
0229 extern void rl_callback_handler_install (const char *, rl_vcpfunc_t *);
0230 extern void rl_callback_read_char (void);
0231 extern void rl_callback_handler_remove (void);
0232 extern void rl_callback_sigcleanup (void);
0233 
0234 /* Things for vi mode. Not available unless readline is compiled -DVI_MODE. */
0235 /* VI-mode bindable commands. */
0236 extern int rl_vi_redo (int, int);
0237 extern int rl_vi_undo (int, int);
0238 extern int rl_vi_yank_arg (int, int);
0239 extern int rl_vi_fetch_history (int, int);
0240 extern int rl_vi_search_again (int, int);
0241 extern int rl_vi_search (int, int);
0242 extern int rl_vi_complete (int, int);
0243 extern int rl_vi_tilde_expand (int, int);
0244 extern int rl_vi_prev_word (int, int);
0245 extern int rl_vi_next_word (int, int);
0246 extern int rl_vi_end_word (int, int);
0247 extern int rl_vi_insert_beg (int, int);
0248 extern int rl_vi_append_mode (int, int);
0249 extern int rl_vi_append_eol (int, int);
0250 extern int rl_vi_eof_maybe (int, int);
0251 extern int rl_vi_insertion_mode (int, int);
0252 extern int rl_vi_insert_mode (int, int);
0253 extern int rl_vi_movement_mode (int, int);
0254 extern int rl_vi_arg_digit (int, int);
0255 extern int rl_vi_change_case (int, int);
0256 extern int rl_vi_put (int, int);
0257 extern int rl_vi_column (int, int);
0258 extern int rl_vi_delete_to (int, int);
0259 extern int rl_vi_change_to (int, int);
0260 extern int rl_vi_yank_to (int, int);
0261 extern int rl_vi_yank_pop (int, int);
0262 extern int rl_vi_rubout (int, int);
0263 extern int rl_vi_delete (int, int);
0264 extern int rl_vi_back_to_indent (int, int);
0265 extern int rl_vi_unix_word_rubout (int, int);
0266 extern int rl_vi_first_print (int, int);
0267 extern int rl_vi_char_search (int, int);
0268 extern int rl_vi_match (int, int);
0269 extern int rl_vi_change_char (int, int);
0270 extern int rl_vi_subst (int, int);
0271 extern int rl_vi_overstrike (int, int);
0272 extern int rl_vi_overstrike_delete (int, int);
0273 extern int rl_vi_replace (int, int);
0274 extern int rl_vi_set_mark (int, int);
0275 extern int rl_vi_goto_mark (int, int);
0276 
0277 /* VI-mode utility functions. */
0278 extern int rl_vi_check (void);
0279 extern int rl_vi_domove (int, int *);
0280 extern int rl_vi_bracktype (int);
0281 
0282 extern void rl_vi_start_inserting (int, int, int);
0283 
0284 /* VI-mode pseudo-bindable commands, used as utility functions. */
0285 extern int rl_vi_fWord (int, int);
0286 extern int rl_vi_bWord (int, int);
0287 extern int rl_vi_eWord (int, int);
0288 extern int rl_vi_fword (int, int);
0289 extern int rl_vi_bword (int, int);
0290 extern int rl_vi_eword (int, int);
0291 
0292 /* **************************************************************** */
0293 /*                                  */
0294 /*          Well Published Functions            */
0295 /*                                  */
0296 /* **************************************************************** */
0297 
0298 /* Readline functions. */
0299 /* Read a line of input.  Prompt with PROMPT.  A NULL PROMPT means none. */
0300 extern char *readline (const char *);
0301 
0302 extern int rl_set_prompt (const char *);
0303 extern int rl_expand_prompt (char *);
0304 
0305 extern int rl_initialize (void);
0306 
0307 /* Undocumented; unused by readline */
0308 extern int rl_discard_argument (void);
0309 
0310 /* Utility functions to bind keys to readline commands. */
0311 extern int rl_add_defun (const char *, rl_command_func_t *, int);
0312 extern int rl_bind_key (int, rl_command_func_t *);
0313 extern int rl_bind_key_in_map (int, rl_command_func_t *, Keymap);
0314 extern int rl_unbind_key (int);
0315 extern int rl_unbind_key_in_map (int, Keymap);
0316 extern int rl_bind_key_if_unbound (int, rl_command_func_t *);
0317 extern int rl_bind_key_if_unbound_in_map (int, rl_command_func_t *, Keymap);
0318 extern int rl_unbind_function_in_map (rl_command_func_t *, Keymap);
0319 extern int rl_unbind_command_in_map (const char *, Keymap);
0320 extern int rl_bind_keyseq (const char *, rl_command_func_t *);
0321 extern int rl_bind_keyseq_in_map (const char *, rl_command_func_t *, Keymap);
0322 extern int rl_bind_keyseq_if_unbound (const char *, rl_command_func_t *);
0323 extern int rl_bind_keyseq_if_unbound_in_map (const char *, rl_command_func_t *, Keymap);
0324 extern int rl_generic_bind (int, const char *, char *, Keymap);
0325 
0326 extern char *rl_variable_value (const char *);
0327 extern int rl_variable_bind (const char *, const char *);
0328 
0329 /* Backwards compatibility, use rl_bind_keyseq_in_map instead. */
0330 extern int rl_set_key (const char *, rl_command_func_t *, Keymap);
0331 
0332 /* Backwards compatibility, use rl_generic_bind instead. */
0333 extern int rl_macro_bind (const char *, const char *, Keymap);
0334 
0335 /* Undocumented in the texinfo manual; not really useful to programs. */
0336 extern int rl_translate_keyseq (const char *, char *, int *);
0337 extern char *rl_untranslate_keyseq (int);
0338 
0339 extern rl_command_func_t *rl_named_function (const char *);
0340 extern rl_command_func_t *rl_function_of_keyseq (const char *, Keymap, int *);
0341 extern rl_command_func_t *rl_function_of_keyseq_len (const char *, size_t, Keymap, int *);
0342 extern int rl_trim_arg_from_keyseq (const char *, size_t, Keymap);
0343 
0344 extern void rl_list_funmap_names (void);
0345 extern char **rl_invoking_keyseqs_in_map (rl_command_func_t *, Keymap);
0346 extern char **rl_invoking_keyseqs (rl_command_func_t *);
0347 
0348 extern void rl_print_keybinding (const char *, Keymap, int);
0349 
0350 extern void rl_function_dumper (int);
0351 extern void rl_macro_dumper (int);
0352 extern void rl_variable_dumper (int);
0353 
0354 extern int rl_read_init_file (const char *);
0355 extern int rl_parse_and_bind (char *);
0356 
0357 /* Functions for manipulating keymaps. */
0358 extern Keymap rl_make_bare_keymap (void);
0359 extern int rl_empty_keymap (Keymap);
0360 extern Keymap rl_copy_keymap (Keymap);
0361 extern Keymap rl_make_keymap (void);
0362 extern void rl_discard_keymap (Keymap);
0363 extern void rl_free_keymap (Keymap);
0364 
0365 extern Keymap rl_get_keymap_by_name (const char *);
0366 extern char *rl_get_keymap_name (Keymap);
0367 extern void rl_set_keymap (Keymap);
0368 extern Keymap rl_get_keymap (void);
0369 
0370 extern int rl_set_keymap_name (const char *, Keymap);
0371 
0372 /* Undocumented; used internally only. */
0373 extern void rl_set_keymap_from_edit_mode (void);
0374 extern char *rl_get_keymap_name_from_edit_mode (void);
0375 
0376 /* Functions for manipulating the funmap, which maps command names to functions. */
0377 extern int rl_add_funmap_entry (const char *, rl_command_func_t *);
0378 extern const char **rl_funmap_names (void);
0379 /* Undocumented, only used internally -- there is only one funmap, and this
0380    function may be called only once. */
0381 extern void rl_initialize_funmap (void);
0382 
0383 /* Utility functions for managing keyboard macros. */
0384 extern void rl_push_macro_input (char *);
0385 
0386 /* Functions for undoing, from undo.c */
0387 extern void rl_add_undo (enum undo_code, int, int, char *);
0388 extern void rl_free_undo_list (void);
0389 extern int rl_do_undo (void);
0390 extern int rl_begin_undo_group (void);
0391 extern int rl_end_undo_group (void);
0392 extern int rl_modifying (int, int);
0393 
0394 /* Functions for redisplay. */
0395 extern void rl_redisplay (void);
0396 extern int rl_on_new_line (void);
0397 extern int rl_on_new_line_with_prompt (void);
0398 extern int rl_forced_update_display (void);
0399 extern int rl_clear_visible_line (void);
0400 extern int rl_clear_message (void);
0401 extern int rl_reset_line_state (void);
0402 extern int rl_crlf (void);
0403 
0404 /* Functions to manage the mark and region, especially the notion of an
0405    active mark and an active region. */
0406 extern void rl_keep_mark_active (void);
0407 
0408 extern void rl_activate_mark (void);
0409 extern void rl_deactivate_mark (void);
0410 extern int rl_mark_active_p (void);
0411 
0412 extern int rl_message (const char *, ...)  __attribute__((__format__ (printf, 1, 2)));
0413 
0414 extern int rl_show_char (int);
0415 
0416 /* Undocumented in texinfo manual. */
0417 extern int rl_character_len (int, int);
0418 extern void rl_redraw_prompt_last_line (void);
0419 
0420 /* Save and restore internal prompt redisplay information. */
0421 extern void rl_save_prompt (void);
0422 extern void rl_restore_prompt (void);
0423 
0424 /* Modifying text. */
0425 extern void rl_replace_line (const char *, int);
0426 extern int rl_insert_text (const char *);
0427 extern int rl_delete_text (int, int);
0428 extern int rl_kill_text (int, int);
0429 extern char *rl_copy_text (int, int);
0430 
0431 /* Terminal and tty mode management. */
0432 extern void rl_prep_terminal (int);
0433 extern void rl_deprep_terminal (void);
0434 extern void rl_tty_set_default_bindings (Keymap);
0435 extern void rl_tty_unset_default_bindings (Keymap);
0436 
0437 extern int rl_tty_set_echoing (int);
0438 extern int rl_reset_terminal (const char *);
0439 extern void rl_resize_terminal (void);
0440 extern void rl_set_screen_size (int, int);
0441 extern void rl_get_screen_size (int *, int *);
0442 extern void rl_reset_screen_size (void);
0443 
0444 extern char *rl_get_termcap (const char *);
0445 extern void rl_reparse_colors (void);
0446 
0447 /* Functions for character input. */
0448 extern int rl_stuff_char (int);
0449 extern int rl_execute_next (int);
0450 extern int rl_clear_pending_input (void);
0451 extern int rl_read_key (void);
0452 extern int rl_getc (FILE *);
0453 extern int rl_set_keyboard_input_timeout (int);
0454 
0455 /* Functions to set and reset timeouts. */
0456 extern int rl_set_timeout (unsigned int, unsigned int);
0457 extern int rl_timeout_remaining (unsigned int *, unsigned int *);
0458 
0459 #undef rl_clear_timeout
0460 #define rl_clear_timeout() rl_set_timeout (0, 0)
0461 
0462 /* `Public' utility functions . */
0463 extern void rl_extend_line_buffer (int);
0464 extern int rl_ding (void);
0465 extern int rl_alphabetic (int);
0466 extern void rl_free (void *);
0467 
0468 /* Readline signal handling, from signals.c */
0469 extern int rl_set_signals (void);
0470 extern int rl_clear_signals (void);
0471 extern void rl_cleanup_after_signal (void);
0472 extern void rl_reset_after_signal (void);
0473 extern void rl_free_line_state (void);
0474 
0475 extern int rl_pending_signal (void);
0476 extern void rl_check_signals (void);
0477 
0478 extern void rl_echo_signal_char (int); 
0479 
0480 extern int rl_set_paren_blink_timeout (int);
0481 
0482 /* History management functions. */
0483 
0484 extern void rl_clear_history (void);
0485 
0486 /* Undocumented. */
0487 extern int rl_maybe_save_line (void);
0488 extern int rl_maybe_unsave_line (void);
0489 extern int rl_maybe_replace_line (void);
0490 
0491 /* Completion functions. */
0492 extern int rl_complete_internal (int);
0493 extern void rl_display_match_list (char **, int, int);
0494 
0495 extern char **rl_completion_matches (const char *, rl_compentry_func_t *);
0496 extern char *rl_username_completion_function (const char *, int);
0497 extern char *rl_filename_completion_function (const char *, int);
0498 
0499 extern int rl_completion_mode (rl_command_func_t *);
0500 
0501 #if 0
0502 /* Backwards compatibility (compat.c).  These will go away sometime. */
0503 extern void free_undo_list (void);
0504 extern int maybe_save_line (void);
0505 extern int maybe_unsave_line (void);
0506 extern int maybe_replace_line (void);
0507 
0508 extern int ding (void);
0509 extern int alphabetic (int);
0510 extern int crlf (void);
0511 
0512 extern char **completion_matches (char *, rl_compentry_func_t *);
0513 extern char *username_completion_function (const char *, int);
0514 extern char *filename_completion_function (const char *, int);
0515 #endif
0516 
0517 /* **************************************************************** */
0518 /*                                  */
0519 /*          Well Published Variables            */
0520 /*                                  */
0521 /* **************************************************************** */
0522 
0523 /* The version of this incarnation of the readline library. */
0524 extern const char *rl_library_version;      /* e.g., "4.2" */
0525 extern int rl_readline_version;         /* e.g., 0x0402 */
0526 
0527 /* True if this is real GNU readline. */
0528 extern int rl_gnu_readline_p;
0529 
0530 /* Flags word encapsulating the current readline state. */
0531 extern unsigned long rl_readline_state;
0532 
0533 /* Says which editing mode readline is currently using.  1 means emacs mode;
0534    0 means vi mode. */
0535 extern int rl_editing_mode;
0536 
0537 /* Insert or overwrite mode for emacs mode.  1 means insert mode; 0 means
0538    overwrite mode.  Reset to insert mode on each input line. */
0539 extern int rl_insert_mode;
0540 
0541 /* The name of the calling program.  You should initialize this to
0542    whatever was in argv[0].  It is used when parsing conditionals. */
0543 extern const char *rl_readline_name;
0544 
0545 /* The prompt readline uses.  This is set from the argument to
0546    readline (), and should not be assigned to directly. */
0547 extern char *rl_prompt;
0548 
0549 /* The prompt string that is actually displayed by rl_redisplay.  Public so
0550    applications can more easily supply their own redisplay functions. */
0551 extern char *rl_display_prompt;
0552 
0553 /* The line buffer that is in use. */
0554 extern char *rl_line_buffer;
0555 
0556 /* The location of point, and end. */
0557 extern int rl_point;
0558 extern int rl_end;
0559 
0560 /* The mark, or saved cursor position. */
0561 extern int rl_mark;
0562 
0563 /* Flag to indicate that readline has finished with the current input
0564    line and should return it. */
0565 extern int rl_done;
0566 
0567 /* Flag to indicate that readline has read an EOF character or read has
0568    returned 0 or error, and is returning a NULL line as a result. */
0569 extern int rl_eof_found;
0570 
0571 /* If set to a character value, that will be the next keystroke read. */
0572 extern int rl_pending_input;
0573 
0574 /* Non-zero if we called this function from _rl_dispatch().  It's present
0575    so functions can find out whether they were called from a key binding
0576    or directly from an application. */
0577 extern int rl_dispatching;
0578 
0579 /* Non-zero if the user typed a numeric argument before executing the
0580    current function. */
0581 extern int rl_explicit_arg;
0582 
0583 /* The current value of the numeric argument specified by the user. */
0584 extern int rl_numeric_arg;
0585 
0586 /* The address of the last command function Readline executed. */
0587 extern rl_command_func_t *rl_last_func;
0588 
0589 /* The name of the terminal to use. */
0590 extern const char *rl_terminal_name;
0591 
0592 /* The input and output streams. */
0593 extern FILE *rl_instream;
0594 extern FILE *rl_outstream;
0595 
0596 /* If non-zero, Readline gives values of LINES and COLUMNS from the environment
0597    greater precedence than values fetched from the kernel when computing the
0598    screen dimensions. */
0599 extern int rl_prefer_env_winsize;
0600 
0601 /* If non-zero, then this is the address of a function to call just
0602    before readline_internal () prints the first prompt. */
0603 extern rl_hook_func_t *rl_startup_hook;
0604 
0605 /* If non-zero, this is the address of a function to call just before
0606    readline_internal_setup () returns and readline_internal starts
0607    reading input characters. */
0608 extern rl_hook_func_t *rl_pre_input_hook;
0609       
0610 /* The address of a function to call periodically while Readline is
0611    awaiting character input, or NULL, for no event handling. */
0612 extern rl_hook_func_t *rl_event_hook;
0613 
0614 /* The address of a function to call if a read is interrupted by a signal. */
0615 extern rl_hook_func_t *rl_signal_event_hook;
0616 
0617 extern rl_hook_func_t *rl_timeout_event_hook;
0618 
0619 /* The address of a function to call if Readline needs to know whether or not
0620    there is data available from the current input source. */
0621 extern rl_hook_func_t *rl_input_available_hook;
0622 
0623 /* The address of the function to call to fetch a character from the current
0624    Readline input stream */
0625 extern rl_getc_func_t *rl_getc_function;
0626 
0627 extern rl_voidfunc_t *rl_redisplay_function;
0628 
0629 extern rl_vintfunc_t *rl_prep_term_function;
0630 extern rl_voidfunc_t *rl_deprep_term_function;
0631 
0632 extern rl_macro_print_func_t *rl_macro_display_hook;
0633 
0634 /* Dispatch variables. */
0635 extern Keymap rl_executing_keymap;
0636 extern Keymap rl_binding_keymap;
0637 
0638 extern int rl_executing_key;
0639 extern char *rl_executing_keyseq;
0640 extern int rl_key_sequence_length;
0641 
0642 /* Display variables. */
0643 /* If non-zero, readline will erase the entire line, including any prompt,
0644    if the only thing typed on an otherwise-blank line is something bound to
0645    rl_newline. */
0646 extern int rl_erase_empty_line;
0647 
0648 /* If non-zero, the application has already printed the prompt (rl_prompt)
0649    before calling readline, so readline should not output it the first time
0650    redisplay is done. */
0651 extern int rl_already_prompted;
0652 
0653 /* A non-zero value means to read only this many characters rather than
0654    up to a character bound to accept-line. */
0655 extern int rl_num_chars_to_read;
0656 
0657 /* The text of a currently-executing keyboard macro. */
0658 extern char *rl_executing_macro;
0659 
0660 /* Variables to control readline signal handling. */
0661 /* If non-zero, readline will install its own signal handlers for
0662    SIGINT, SIGTERM, SIGQUIT, SIGALRM, SIGTSTP, SIGTTIN, and SIGTTOU. */
0663 extern int rl_catch_signals;
0664 
0665 /* If non-zero, readline will install a signal handler for SIGWINCH
0666    that also attempts to call any calling application's SIGWINCH signal
0667    handler.  Note that the terminal is not cleaned up before the
0668    application's signal handler is called; use rl_cleanup_after_signal()
0669    to do that. */
0670 extern int rl_catch_sigwinch;
0671 
0672 /* If non-zero, the readline SIGWINCH handler will modify LINES and
0673    COLUMNS in the environment. */
0674 extern int rl_change_environment;
0675 
0676 /* Completion variables. */
0677 /* Pointer to the generator function for completion_matches ().
0678    NULL means to use rl_filename_completion_function (), the default
0679    filename completer. */
0680 extern rl_compentry_func_t *rl_completion_entry_function;
0681 
0682 /* Optional generator for menu completion.  Default is
0683    rl_completion_entry_function (rl_filename_completion_function). */
0684 extern rl_compentry_func_t *rl_menu_completion_entry_function;
0685 
0686 /* If rl_ignore_some_completions_function is non-NULL it is the address
0687    of a function to call after all of the possible matches have been
0688    generated, but before the actual completion is done to the input line.
0689    The function is called with one argument; a NULL terminated array
0690    of (char *).  If your function removes any of the elements, they
0691    must be free()'ed. */
0692 extern rl_compignore_func_t *rl_ignore_some_completions_function;
0693 
0694 /* Pointer to alternative function to create matches.
0695    Function is called with TEXT, START, and END.
0696    START and END are indices in RL_LINE_BUFFER saying what the boundaries
0697    of TEXT are.
0698    If this function exists and returns NULL then call the value of
0699    rl_completion_entry_function to try to match, otherwise use the
0700    array of strings returned. */
0701 extern rl_completion_func_t *rl_attempted_completion_function;
0702 
0703 /* The basic list of characters that signal a break between words for the
0704    completer routine.  The initial contents of this variable is what
0705    breaks words in the shell, i.e. "n\"\\'`@$>". */
0706 extern const char *rl_basic_word_break_characters;
0707 
0708 /* The list of characters that signal a break between words for
0709    rl_complete_internal.  The default list is the contents of
0710    rl_basic_word_break_characters.  */
0711 extern const char *rl_completer_word_break_characters;
0712 
0713 /* Hook function to allow an application to set the completion word
0714    break characters before readline breaks up the line.  Allows
0715    position-dependent word break characters. */
0716 extern rl_cpvfunc_t *rl_completion_word_break_hook;
0717 
0718 /* List of characters which can be used to quote a substring of the line.
0719    Completion occurs on the entire substring, and within the substring   
0720    rl_completer_word_break_characters are treated as any other character,
0721    unless they also appear within this list. */
0722 extern const char *rl_completer_quote_characters;
0723 
0724 /* List of quote characters which cause a word break. */
0725 extern const char *rl_basic_quote_characters;
0726 
0727 /* List of characters that need to be quoted in filenames by the completer. */
0728 extern const char *rl_filename_quote_characters;
0729 
0730 /* List of characters that are word break characters, but should be left
0731    in TEXT when it is passed to the completion function.  The shell uses
0732    this to help determine what kind of completing to do. */
0733 extern const char *rl_special_prefixes;
0734 
0735 /* If non-zero, then this is the address of a function to call when
0736    completing on a directory name.  The function is called with
0737    the address of a string (the current directory name) as an arg.  It
0738    changes what is displayed when the possible completions are printed
0739    or inserted.  The directory completion hook should perform
0740    any necessary dequoting.  This function should return 1 if it modifies
0741    the directory name pointer passed as an argument.  If the directory
0742    completion hook returns 0, it should not modify the directory name
0743    pointer passed as an argument. */
0744 extern rl_icppfunc_t *rl_directory_completion_hook;
0745 
0746 /* If non-zero, this is the address of a function to call when completing
0747    a directory name.  This function takes the address of the directory name
0748    to be modified as an argument.  Unlike rl_directory_completion_hook, it
0749    only modifies the directory name used in opendir(2), not what is displayed
0750    when the possible completions are printed or inserted.  If set, it takes
0751    precedence over rl_directory_completion_hook.  The directory rewrite
0752    hook should perform any necessary dequoting.  This function has the same
0753    return value properties as the directory_completion_hook.
0754 
0755    I'm not happy with how this works yet, so it's undocumented.  I'm trying
0756    it in bash to see how well it goes. */
0757 extern rl_icppfunc_t *rl_directory_rewrite_hook;
0758 
0759 /* If non-zero, this is the address of a function for the completer to call
0760    before deciding which character to append to a completed name.  It should
0761    modify the directory name passed as an argument if appropriate, and return
0762    non-zero if it modifies the name.  This should not worry about dequoting
0763    the filename; that has already happened by the time it gets here. */
0764 extern rl_icppfunc_t *rl_filename_stat_hook;
0765 
0766 /* If non-zero, this is the address of a function to call when reading
0767    directory entries from the filesystem for completion and comparing
0768    them to the partial word to be completed.  The function should
0769    either return its first argument (if no conversion takes place) or
0770    newly-allocated memory.  This can, for instance, convert filenames
0771    between character sets for comparison against what's typed at the
0772    keyboard.  The returned value is what is added to the list of
0773    matches.  The second argument is the length of the filename to be
0774    converted. */
0775 extern rl_dequote_func_t *rl_filename_rewrite_hook;
0776 
0777 /* If non-zero, this is the address of a function to call before
0778    comparing the filename portion of a word to be completed with directory
0779    entries from the filesystem. This takes the address of the partial word
0780    to be completed, after any rl_filename_dequoting_function has been applied.
0781    The function should either return its first argument (if no conversion
0782    takes place) or newly-allocated memory. This can, for instance, convert
0783    the filename portion of the completion word to a character set suitable
0784    for comparison against directory entries read from the filesystem (after
0785    their potential modification by rl_filename_rewrite_hook). 
0786    The returned value is what is added to the list of matches.
0787    The second argument is the length of the filename to be converted. */
0788 extern rl_dequote_func_t *rl_completion_rewrite_hook;
0789 
0790 /* Backwards compatibility with previous versions of readline. */
0791 #define rl_symbolic_link_hook rl_directory_completion_hook
0792 
0793 /* If non-zero, then this is the address of a function to call when
0794    completing a word would normally display the list of possible matches.
0795    This function is called instead of actually doing the display.
0796    It takes three arguments: (char **matches, int num_matches, int max_length)
0797    where MATCHES is the array of strings that matched, NUM_MATCHES is the
0798    number of strings in that array, and MAX_LENGTH is the length of the
0799    longest string in that array. */
0800 extern rl_compdisp_func_t *rl_completion_display_matches_hook;
0801 
0802 /* Non-zero means that the results of the matches are to be treated
0803    as filenames.  This is ALWAYS zero on entry, and can only be changed
0804    within a completion entry finder function. */
0805 extern int rl_filename_completion_desired;
0806 
0807 /* Non-zero means that the results of the matches are to be quoted using
0808    double quotes (or an application-specific quoting mechanism) if the
0809    filename contains any characters in rl_word_break_chars.  This is
0810    ALWAYS non-zero on entry, and can only be changed within a completion
0811    entry finder function. */
0812 extern int rl_filename_quoting_desired;
0813 
0814 /* Non-zero means we should apply filename-type quoting to all completions
0815    even if we are not otherwise treating the matches as filenames. This is
0816    ALWAYS zero on entry, and can only be changed within a completion entry
0817    finder function. */
0818 extern int rl_full_quoting_desired;
0819 
0820 /* Set to a function to quote a filename in an application-specific fashion.
0821    Called with the text to quote, the type of match found (single or multiple)
0822    and a pointer to the quoting character to be used, which the function can
0823    reset if desired. */
0824 extern rl_quote_func_t *rl_filename_quoting_function;
0825 
0826 /* Function to call to remove quoting characters from a filename.  Called
0827    before completion is attempted, so the embedded quotes do not interfere
0828    with matching names in the file system. */
0829 extern rl_dequote_func_t *rl_filename_dequoting_function;
0830 
0831 /* Function to call to decide whether or not a word break character is
0832    quoted.  If a character is quoted, it does not break words for the
0833    completer. */
0834 extern rl_linebuf_func_t *rl_char_is_quoted_p;
0835 
0836 /* Non-zero means to suppress normal filename completion after the
0837    user-specified completion function has been called. */
0838 extern int rl_attempted_completion_over;
0839 
0840 /* Set to a character describing the type of completion being attempted by
0841    rl_complete_internal; available for use by application completion
0842    functions. */
0843 extern int rl_completion_type;
0844 
0845 /* Set to the last key used to invoke one of the completion functions */
0846 extern int rl_completion_invoking_key;
0847 
0848 /* Up to this many items will be displayed in response to a
0849    possible-completions call.  After that, we ask the user if she
0850    is sure she wants to see them all.  The default value is 100. */
0851 extern int rl_completion_query_items;
0852 
0853 /* Character appended to completed words when at the end of the line.  The
0854    default is a space.  Nothing is added if this is '\0'. */
0855 extern int rl_completion_append_character;
0856 
0857 /* If set to non-zero by an application completion function,
0858    rl_completion_append_character will not be appended. */
0859 extern int rl_completion_suppress_append;
0860 
0861 /* Set to any quote character readline thinks it finds before any application
0862    completion function is called. */
0863 extern int rl_completion_quote_character;
0864 
0865 /* Set to a non-zero value if readline found quoting anywhere in the word to
0866    be completed; set before any application completion function is called. */
0867 extern int rl_completion_found_quote;
0868 
0869 /* If non-zero, the completion functions don't append any closing quote.
0870    This is set to 0 by rl_complete_internal and may be changed by an
0871    application-specific completion function. */
0872 extern int rl_completion_suppress_quote;
0873 
0874 /* If non-zero, readline will sort the completion matches.  On by default. */
0875 extern int rl_sort_completion_matches;
0876 
0877 /* If non-zero, a slash will be appended to completed filenames that are
0878    symbolic links to directory names, subject to the value of the
0879    mark-directories variable (which is user-settable).  This exists so
0880    that application completion functions can override the user's preference
0881    (set via the mark-symlinked-directories variable) if appropriate.
0882    It's set to the value of _rl_complete_mark_symlink_dirs in
0883    rl_complete_internal before any application-specific completion
0884    function is called, so without that function doing anything, the user's
0885    preferences are honored. */
0886 extern int rl_completion_mark_symlink_dirs;
0887 
0888 /* If non-zero, then disallow duplicates in the matches. */
0889 extern int rl_ignore_completion_duplicates;
0890 
0891 /* If this is non-zero, completion is (temporarily) inhibited, and the
0892    completion character will be inserted as any other. */
0893 extern int rl_inhibit_completion;
0894 
0895 /* Applications can set this to non-zero to have readline's signal handlers
0896    installed during the entire duration of reading a complete line, as in
0897    readline-6.2.  This should be used with care, because it can result in
0898    readline receiving signals and not handling them until it's called again
0899    via rl_callback_read_char, thereby stealing them from the application.
0900    By default, signal handlers are only active while readline is active. */   
0901 extern int rl_persistent_signal_handlers;
0902 
0903 /* Input error; can be returned by (*rl_getc_function) if readline is reading
0904    a top-level command (RL_ISSTATE (RL_STATE_READCMD)). */
0905 #define READERR         (-2)
0906 
0907 /* Definitions available for use by readline clients. */
0908 #define RL_PROMPT_START_IGNORE  '\001'
0909 #define RL_PROMPT_END_IGNORE    '\002'
0910 
0911 /* Possible values for do_replace argument to rl_filename_quoting_function,
0912    called by rl_complete_internal. */
0913 #define NO_MATCH        0
0914 #define SINGLE_MATCH    1
0915 #define MULT_MATCH      2
0916 
0917 /* Possible state values for rl_readline_state */
0918 #define RL_STATE_NONE       0x0000000   /* no state; before first call */
0919 
0920 #define RL_STATE_INITIALIZING   0x00000001  /* initializing */
0921 #define RL_STATE_INITIALIZED    0x00000002  /* initialization done */
0922 #define RL_STATE_TERMPREPPED    0x00000004  /* terminal is prepped */
0923 #define RL_STATE_READCMD    0x00000008  /* reading a command key */
0924 #define RL_STATE_METANEXT   0x00000010  /* reading input after ESC */
0925 #define RL_STATE_DISPATCHING    0x00000020  /* dispatching to a command */
0926 #define RL_STATE_MOREINPUT  0x00000040  /* reading more input in a command function */
0927 #define RL_STATE_ISEARCH    0x00000080  /* doing incremental search */
0928 #define RL_STATE_NSEARCH    0x00000100  /* doing non-inc search */
0929 #define RL_STATE_SEARCH     0x00000200  /* doing a history search */
0930 #define RL_STATE_NUMERICARG 0x00000400  /* reading numeric argument */
0931 #define RL_STATE_MACROINPUT 0x00000800  /* getting input from a macro */
0932 #define RL_STATE_MACRODEF   0x00001000  /* defining keyboard macro */
0933 #define RL_STATE_OVERWRITE  0x00002000  /* overwrite mode */
0934 #define RL_STATE_COMPLETING 0x00004000  /* doing completion */
0935 #define RL_STATE_SIGHANDLER 0x00008000  /* in readline sighandler */
0936 #define RL_STATE_UNDOING    0x00010000  /* doing an undo */
0937 #define RL_STATE_INPUTPENDING   0x00020000  /* rl_execute_next called */
0938 #define RL_STATE_TTYCSAVED  0x00040000  /* tty special chars saved */
0939 #define RL_STATE_CALLBACK   0x00080000  /* using the callback interface */
0940 #define RL_STATE_VIMOTION   0x00100000  /* reading vi motion arg */
0941 #define RL_STATE_MULTIKEY   0x00200000  /* reading multiple-key command */
0942 #define RL_STATE_VICMDONCE  0x00400000  /* entered vi command mode at least once */
0943 #define RL_STATE_CHARSEARCH 0x00800000  /* vi mode char search */
0944 #define RL_STATE_REDISPLAYING   0x01000000  /* updating terminal display */
0945 
0946 #define RL_STATE_DONE       0x02000000  /* done; accepted line */
0947 #define RL_STATE_TIMEOUT    0x04000000  /* done; timed out */
0948 #define RL_STATE_EOF        0x08000000  /* done; got eof on read */
0949 
0950 /* Rearrange these for next major version */
0951 #define RL_STATE_READSTR    0x10000000  /* reading a string for M-x */
0952 
0953 #define RL_SETSTATE(x)      (rl_readline_state |= (x))
0954 #define RL_UNSETSTATE(x)    (rl_readline_state &= ~(x))
0955 #define RL_ISSTATE(x)       (rl_readline_state & (x))
0956 
0957 struct readline_state {
0958   /* line state */
0959   int point;
0960   int end;
0961   int mark;
0962   int buflen;
0963   char *buffer;
0964   UNDO_LIST *ul;
0965   char *prompt;
0966 
0967   /* global state */
0968   int rlstate;      /* XXX -- needs to be unsigned long */
0969   int done;
0970   Keymap kmap;
0971 
0972   /* input state */
0973   rl_command_func_t *lastfunc;
0974   int insmode;
0975   int edmode;
0976   char *kseq;
0977   int kseqlen;
0978 
0979   int pendingin;
0980   FILE *inf;
0981   FILE *outf;
0982   char *macro;
0983 
0984   /* signal state */
0985   int catchsigs;
0986   int catchsigwinch;
0987 
0988   /* search state */
0989 
0990   /* completion state */
0991   rl_compentry_func_t *entryfunc;
0992   rl_compentry_func_t *menuentryfunc;
0993   rl_compignore_func_t *ignorefunc;
0994   rl_completion_func_t *attemptfunc;
0995   const char *wordbreakchars;
0996 
0997   /* options state */
0998 
0999   /* hook state */
1000   
1001   /* reserved for future expansion, so the struct size doesn't change */
1002   char reserved[64];
1003 };
1004 
1005 extern int rl_save_state (struct readline_state *);
1006 extern int rl_restore_state (struct readline_state *);
1007 
1008 #ifdef __cplusplus
1009 }
1010 #endif
1011 
1012 #endif /* _READLINE_H_ */