1 /* rlprivate.h -- functions and variables global to the readline library,
2 but not intended for use by applications. */
4 /* Copyright (C) 1999-2010 Free Software Foundation, Inc.
6 This file is part of the GNU Readline Library (Readline), a library
7 for reading lines of text with interactive input and history editing.
9 Readline is free software: you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation, either version 3 of the License, or
12 (at your option) any later version.
14 Readline is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with Readline. If not, see <http://www.gnu.org/licenses/>.
23 #if !defined (_RL_PRIVATE_H_)
24 #define _RL_PRIVATE_H_
26 #include "rlconf.h" /* for VISIBLE_STATS */
28 #include "posixjmp.h" /* defines procenv_t */
30 /*************************************************************************
32 * Convenience definitions *
34 *************************************************************************/
36 #define EMACS_MODE() (rl_editing_mode == emacs_mode)
37 #define VI_COMMAND_MODE() (rl_editing_mode == vi_mode && _rl_keymap == vi_movement_keymap)
38 #define VI_INSERT_MODE() (rl_editing_mode == vi_mode && _rl_keymap == vi_insertion_keymap)
40 #define RL_CHECK_SIGNALS() \
42 if (_rl_caught_signal) _rl_signal_handler (_rl_caught_signal); \
45 /*************************************************************************
47 * Global structs undocumented in texinfo manual and not in readline.h *
49 *************************************************************************/
51 #define RL_SEARCH_ISEARCH 0x01 /* incremental search */
52 #define RL_SEARCH_NSEARCH 0x02 /* non-incremental search */
53 #define RL_SEARCH_CSEARCH 0x04 /* intra-line char search */
56 #define SF_REVERSE 0x01
58 #define SF_FAILED 0x04
59 #define SF_CHGKMAP 0x08
61 typedef struct __rl_search_context
67 int search_string_index;
68 int search_string_size;
79 char *prev_line_found;
81 UNDO_LIST *save_undo_list;
83 Keymap keymap; /* used when dispatching commands in search string */
84 Keymap okeymap; /* original keymap */
90 #if defined (HANDLE_MULTIBYTE)
98 char *search_terminators;
101 /* Callback data for reading numeric arguments */
102 #define NUM_SAWMINUS 0x01
103 #define NUM_SAWDIGITS 0x02
104 #define NUM_READONE 0x04
106 typedef int _rl_arg_cxt;
108 /* A context for reading key sequences longer than a single character when
109 using the callback interface. */
110 #define KSEQ_DISPATCHED 0x01
111 #define KSEQ_SUBSEQ 0x02
112 #define KSEQ_RECURSIVE 0x04
114 typedef struct __rl_keyseq_context
118 int subseq_retval; /* XXX */
123 struct __rl_keyseq_context *ocxt;
127 /* vi-mode commands that use result of motion command to define boundaries */
128 #define VIM_DELETE 0x01
129 #define VIM_CHANGE 0x02
130 #define VIM_YANK 0x04
132 /* various states for vi-mode commands that use motion commands. reflects
134 #define VMSTATE_READ 0x01
135 #define VMSTATE_NUMARG 0x02
137 typedef struct __rl_vimotion_context
141 int flags; /* reserved */
144 int start, end; /* rl_point, rl_end */
145 int key, motion; /* initial key, motion command */
148 /* fill in more as needed */
149 /* `Generic' callback data and functions */
150 typedef struct __rl_callback_generic_arg
154 /* add here as needed */
155 } _rl_callback_generic_arg;
157 typedef int _rl_callback_func_t PARAMS((_rl_callback_generic_arg *));
159 /*************************************************************************
161 * Global functions undocumented in texinfo manual and not in readline.h *
163 *************************************************************************/
165 /*************************************************************************
167 * Global variables undocumented in texinfo manual and not in readline.h *
169 *************************************************************************/
172 extern int rl_complete_with_tilde_expansion;
173 #if defined (VISIBLE_STATS)
174 extern int rl_visible_stats;
175 #endif /* VISIBLE_STATS */
178 extern int rl_line_buffer_len;
179 extern int rl_arg_sign;
180 extern int rl_visible_prompt_length;
181 extern int rl_key_sequence_length;
182 extern int rl_byte_oriented;
185 extern int rl_display_fixed;
188 extern int rl_blink_matching_paren;
190 /*************************************************************************
192 * Global functions and variables unsed and undocumented *
194 *************************************************************************/
197 extern int rl_set_retained_kills PARAMS((int));
200 extern void _rl_set_screen_size PARAMS((int, int));
203 extern int _rl_fix_last_undo_of_type PARAMS((int, int, int));
206 extern char *_rl_savestring PARAMS((const char *));
208 /*************************************************************************
210 * Functions and variables private to the readline library *
212 *************************************************************************/
214 /* NOTE: Functions and variables prefixed with `_rl_' are
215 pseudo-global: they are global so they can be shared
216 between files in the readline library, but are not intended
217 to be visible to readline callers. */
219 /*************************************************************************
220 * Undocumented private functions *
221 *************************************************************************/
223 #if defined(READLINE_CALLBACKS)
226 extern void readline_internal_setup PARAMS((void));
227 extern char *readline_internal_teardown PARAMS((int));
228 extern int readline_internal_char PARAMS((void));
230 extern _rl_keyseq_cxt *_rl_keyseq_cxt_alloc PARAMS((void));
231 extern void _rl_keyseq_cxt_dispose PARAMS((_rl_keyseq_cxt *));
232 extern void _rl_keyseq_chain_dispose PARAMS((void));
234 extern int _rl_dispatch_callback PARAMS((_rl_keyseq_cxt *));
237 extern _rl_callback_generic_arg *_rl_callback_data_alloc PARAMS((int));
238 extern void _rl_callback_data_dispose PARAMS((_rl_callback_generic_arg *));
240 #endif /* READLINE_CALLBACKS */
245 extern void _rl_reset_completion_state PARAMS((void));
246 extern char _rl_find_completion_word PARAMS((int *, int *));
247 extern void _rl_free_match_list PARAMS((char **));
250 extern char *_rl_strip_prompt PARAMS((char *));
251 extern void _rl_move_cursor_relative PARAMS((int, const char *));
252 extern void _rl_move_vert PARAMS((int));
253 extern void _rl_save_prompt PARAMS((void));
254 extern void _rl_restore_prompt PARAMS((void));
255 extern char *_rl_make_prompt_for_search PARAMS((int));
256 extern void _rl_erase_at_end_of_line PARAMS((int));
257 extern void _rl_clear_to_eol PARAMS((int));
258 extern void _rl_clear_screen PARAMS((void));
259 extern void _rl_update_final PARAMS((void));
260 extern void _rl_redisplay_after_sigwinch PARAMS((void));
261 extern void _rl_clean_up_for_exit PARAMS((void));
262 extern void _rl_erase_entire_line PARAMS((void));
263 extern int _rl_current_display_line PARAMS((void));
266 extern int _rl_any_typein PARAMS((void));
267 extern int _rl_input_available PARAMS((void));
268 extern int _rl_input_queued PARAMS((int));
269 extern void _rl_insert_typein PARAMS((int));
270 extern int _rl_unget_char PARAMS((int));
271 extern int _rl_pushed_input_available PARAMS((void));
274 extern _rl_search_cxt *_rl_scxt_alloc PARAMS((int, int));
275 extern void _rl_scxt_dispose PARAMS((_rl_search_cxt *, int));
277 extern int _rl_isearch_dispatch PARAMS((_rl_search_cxt *, int));
278 extern int _rl_isearch_callback PARAMS((_rl_search_cxt *));
280 extern int _rl_search_getchar PARAMS((_rl_search_cxt *));
283 extern void _rl_with_macro_input PARAMS((char *));
284 extern int _rl_next_macro_key PARAMS((void));
285 extern void _rl_push_executing_macro PARAMS((void));
286 extern void _rl_pop_executing_macro PARAMS((void));
287 extern void _rl_add_macro_char PARAMS((int));
288 extern void _rl_kill_kbd_macro PARAMS((void));
291 extern int _rl_arg_overflow PARAMS((void));
292 extern void _rl_arg_init PARAMS((void));
293 extern int _rl_arg_getchar PARAMS((void));
294 extern int _rl_arg_callback PARAMS((_rl_arg_cxt));
295 extern void _rl_reset_argument PARAMS((void));
297 extern void _rl_start_using_history PARAMS((void));
298 extern int _rl_free_saved_history_line PARAMS((void));
299 extern void _rl_set_insert_mode PARAMS((int, int));
301 extern void _rl_revert_all_lines PARAMS((void));
304 extern int _rl_init_eightbit PARAMS((void));
307 extern void _rl_enable_paren_matching PARAMS((int));
310 extern void _rl_init_line_state PARAMS((void));
311 extern void _rl_set_the_line PARAMS((void));
312 extern int _rl_dispatch PARAMS((int, Keymap));
313 extern int _rl_dispatch_subseq PARAMS((int, Keymap, int));
314 extern void _rl_internal_char_cleanup PARAMS((void));
317 extern int _rl_disable_tty_signals PARAMS((void));
318 extern int _rl_restore_tty_signals PARAMS((void));
321 extern int _rl_nsearch_callback PARAMS((_rl_search_cxt *));
324 extern void _rl_signal_handler PARAMS((int));
326 extern void _rl_block_sigint PARAMS((void));
327 extern void _rl_release_sigint PARAMS((void));
328 extern void _rl_block_sigwinch PARAMS((void));
329 extern void _rl_release_sigwinch PARAMS((void));
332 extern void _rl_get_screen_size PARAMS((int, int));
333 extern int _rl_init_terminal_io PARAMS((const char *));
335 extern void _rl_output_character_function PARAMS((int));
337 extern int _rl_output_character_function PARAMS((int));
339 extern void _rl_output_some_chars PARAMS((const char *, int));
340 extern int _rl_backspace PARAMS((int));
341 extern void _rl_enable_meta_key PARAMS((void));
342 extern void _rl_control_keypad PARAMS((int));
343 extern void _rl_set_cursor PARAMS((int, int));
346 extern void _rl_fix_point PARAMS((int));
347 extern int _rl_replace_text PARAMS((const char *, int, int));
348 extern int _rl_forward_char_internal PARAMS((int));
349 extern int _rl_insert_char PARAMS((int, int));
350 extern int _rl_overwrite_char PARAMS((int, int));
351 extern int _rl_overwrite_rubout PARAMS((int, int));
352 extern int _rl_rubout_char PARAMS((int, int));
353 #if defined (HANDLE_MULTIBYTE)
354 extern int _rl_char_search_internal PARAMS((int, int, char *, int));
356 extern int _rl_char_search_internal PARAMS((int, int, int));
358 extern int _rl_set_mark_at_pos PARAMS((int));
361 extern UNDO_LIST *_rl_copy_undo_entry PARAMS((UNDO_LIST *));
362 extern UNDO_LIST *_rl_copy_undo_list PARAMS((UNDO_LIST *));
365 #if defined (USE_VARARGS) && defined (PREFER_STDARG)
366 extern void _rl_ttymsg (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
367 extern void _rl_errmsg (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
368 extern void _rl_trace (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
370 extern void _rl_ttymsg ();
371 extern void _rl_errmsg ();
372 extern void _rl_trace ();
375 extern int _rl_tropen PARAMS((void));
377 extern int _rl_abort_internal PARAMS((void));
378 extern int _rl_null_function PARAMS((int, int));
379 extern char *_rl_strindex PARAMS((const char *, const char *));
380 extern int _rl_qsort_string_compare PARAMS((char **, char **));
381 extern int (_rl_uppercase_p) PARAMS((int));
382 extern int (_rl_lowercase_p) PARAMS((int));
383 extern int (_rl_pure_alphabetic) PARAMS((int));
384 extern int (_rl_digit_p) PARAMS((int));
385 extern int (_rl_to_lower) PARAMS((int));
386 extern int (_rl_to_upper) PARAMS((int));
387 extern int (_rl_digit_value) PARAMS((int));
390 extern void _rl_vi_initialize_line PARAMS((void));
391 extern void _rl_vi_reset_last PARAMS((void));
392 extern void _rl_vi_set_last PARAMS((int, int, int));
393 extern int _rl_vi_textmod_command PARAMS((int));
394 extern void _rl_vi_done_inserting PARAMS((void));
395 extern int _rl_vi_domove_callback PARAMS((_rl_vimotion_cxt *));
397 /*************************************************************************
398 * Undocumented private variables *
399 *************************************************************************/
402 extern const char * const _rl_possible_control_prefixes[];
403 extern const char * const _rl_possible_meta_prefixes[];
406 extern _rl_callback_func_t *_rl_callback_func;
407 extern _rl_callback_generic_arg *_rl_callback_data;
410 extern int _rl_complete_show_all;
411 extern int _rl_complete_show_unmodified;
412 extern int _rl_complete_mark_directories;
413 extern int _rl_complete_mark_symlink_dirs;
414 extern int _rl_completion_prefix_display_length;
415 extern int _rl_completion_columns;
416 extern int _rl_print_completions_horizontally;
417 extern int _rl_completion_case_fold;
418 extern int _rl_completion_case_map;
419 extern int _rl_match_hidden_files;
420 extern int _rl_page_completions;
421 extern int _rl_skip_completed_text;
422 extern int _rl_menu_complete_prefix_first;
425 extern int _rl_vis_botlin;
426 extern int _rl_last_c_pos;
427 extern int _rl_suppress_redisplay;
428 extern int _rl_want_redisplay;
431 extern char *_rl_isearch_terminators;
433 extern _rl_search_cxt *_rl_iscxt;
436 extern char *_rl_executing_macro;
439 extern int _rl_history_preserve_point;
440 extern int _rl_history_saved_point;
442 extern _rl_arg_cxt _rl_argcxt;
445 extern int _rl_echoing_p;
446 extern int _rl_horizontal_scroll_mode;
447 extern int _rl_mark_modified_lines;
448 extern int _rl_bell_preference;
449 extern int _rl_meta_flag;
450 extern int _rl_convert_meta_chars_to_ascii;
451 extern int _rl_output_meta_chars;
452 extern int _rl_bind_stty_chars;
453 extern int _rl_revert_all_at_newline;
454 extern int _rl_echo_control_chars;
455 extern char *_rl_comment_begin;
456 extern unsigned char _rl_parsing_conditionalized_out;
457 extern Keymap _rl_keymap;
458 extern FILE *_rl_in_stream;
459 extern FILE *_rl_out_stream;
460 extern int _rl_last_command_was_kill;
461 extern int _rl_eof_char;
462 extern procenv_t _rl_top_level;
463 extern _rl_keyseq_cxt *_rl_kscxt;
466 extern _rl_search_cxt *_rl_nscxt;
469 extern int _rl_interrupt_immediately;
470 extern int volatile _rl_caught_signal;
472 extern int _rl_echoctl;
474 extern int _rl_intr_char;
475 extern int _rl_quit_char;
476 extern int _rl_susp_char;
479 extern int _rl_enable_keypad;
480 extern int _rl_enable_meta;
481 extern char *_rl_term_clreol;
482 extern char *_rl_term_clrpag;
483 extern char *_rl_term_im;
484 extern char *_rl_term_ic;
485 extern char *_rl_term_ei;
486 extern char *_rl_term_DC;
487 extern char *_rl_term_up;
488 extern char *_rl_term_dc;
489 extern char *_rl_term_cr;
490 extern char *_rl_term_IC;
491 extern char *_rl_term_forward_char;
492 extern int _rl_screenheight;
493 extern int _rl_screenwidth;
494 extern int _rl_screenchars;
495 extern int _rl_terminal_can_insert;
496 extern int _rl_term_autowrap;
499 extern int _rl_doing_an_undo;
500 extern int _rl_undo_group_level;
503 extern int _rl_vi_last_command;
504 extern _rl_vimotion_cxt *_rl_vimvcxt;
506 #endif /* _RL_PRIVATE_H_ */