158310Sache/* rlprivate.h -- functions and variables global to the readline library,
258310Sache		  but not intended for use by applications. */
358310Sache
4157184Sache/* Copyright (C) 1999-2005 Free Software Foundation, Inc.
558310Sache
658310Sache   This file is part of the GNU Readline Library, a library for
758310Sache   reading lines of text with interactive input and history editing.
858310Sache
958310Sache   The GNU Readline Library is free software; you can redistribute it
1058310Sache   and/or modify it under the terms of the GNU General Public License
1158310Sache   as published by the Free Software Foundation; either version 2, or
1258310Sache   (at your option) any later version.
1358310Sache
1458310Sache   The GNU Readline Library is distributed in the hope that it will be
1558310Sache   useful, but WITHOUT ANY WARRANTY; without even the implied warranty
1658310Sache   of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1758310Sache   GNU General Public License for more details.
1858310Sache
1958310Sache   The GNU General Public License is often shipped with GNU software, and
2058310Sache   is generally kept in a file called COPYING or LICENSE.  If you do not
2158310Sache   have a copy of the license, write to the Free Software Foundation,
2258310Sache   59 Temple Place, Suite 330, Boston, MA 02111 USA. */
2358310Sache
2458310Sache#if !defined (_RL_PRIVATE_H_)
2558310Sache#define _RL_PRIVATE_H_
2658310Sache
2758310Sache#include "rlconf.h"	/* for VISIBLE_STATS */
2858310Sache#include "rlstdc.h"
29119610Sache#include "posixjmp.h"	/* defines procenv_t */
3058310Sache
3158310Sache/*************************************************************************
3258310Sache *									 *
33157184Sache * Global structs undocumented in texinfo manual and not in readline.h   *
34157184Sache *									 *
35157184Sache *************************************************************************/
36157184Sache/* search types */
37157184Sache#define RL_SEARCH_ISEARCH	0x01		/* incremental search */
38157184Sache#define RL_SEARCH_NSEARCH	0x02		/* non-incremental search */
39157184Sache#define RL_SEARCH_CSEARCH	0x04		/* intra-line char search */
40157184Sache
41157184Sache/* search flags */
42157184Sache#define SF_REVERSE		0x01
43157184Sache#define SF_FOUND		0x02
44157184Sache#define SF_FAILED		0x04
45157184Sache
46157184Sachetypedef struct  __rl_search_context
47157184Sache{
48157184Sache  int type;
49157184Sache  int sflags;
50157184Sache
51157184Sache  char *search_string;
52157184Sache  int search_string_index;
53157184Sache  int search_string_size;
54157184Sache
55157184Sache  char **lines;
56157184Sache  char *allocated_line;
57157184Sache  int hlen;
58157184Sache  int hindex;
59157184Sache
60157184Sache  int save_point;
61157184Sache  int save_mark;
62157184Sache  int save_line;
63157184Sache  int last_found_line;
64157184Sache  char *prev_line_found;
65157184Sache
66157184Sache  UNDO_LIST *save_undo_list;
67157184Sache
68157184Sache  int history_pos;
69157184Sache  int direction;
70157184Sache
71157184Sache  int lastc;
72157184Sache#if defined (HANDLE_MULTIBYTE)
73157184Sache  char mb[MB_LEN_MAX];
74157184Sache#endif
75157184Sache
76157184Sache  char *sline;
77157184Sache  int sline_len;
78157184Sache  int sline_index;
79157184Sache
80157184Sache  char  *search_terminators;
81157184Sache} _rl_search_cxt;
82157184Sache
83157184Sache/* Callback data for reading numeric arguments */
84157184Sache#define NUM_SAWMINUS	0x01
85157184Sache#define NUM_SAWDIGITS	0x02
86157184Sache#define NUM_READONE	0x04
87157184Sache
88157184Sachetypedef int _rl_arg_cxt;
89157184Sache
90157184Sache/* A context for reading key sequences longer than a single character when
91157184Sache   using the callback interface. */
92157184Sache#define KSEQ_DISPATCHED	0x01
93157184Sache#define KSEQ_SUBSEQ	0x02
94157184Sache#define KSEQ_RECURSIVE	0x04
95157184Sache
96157184Sachetypedef struct __rl_keyseq_context
97157184Sache{
98157184Sache  int flags;
99157184Sache  int subseq_arg;
100157184Sache  int subseq_retval;		/* XXX */
101157184Sache  Keymap dmap;
102157184Sache
103157184Sache  Keymap oldmap;
104157184Sache  int okey;
105157184Sache  struct __rl_keyseq_context *ocxt;
106157184Sache  int childval;
107157184Sache} _rl_keyseq_cxt;
108157184Sache
109157184Sache  /* fill in more as needed */
110157184Sache/* `Generic' callback data and functions */
111157184Sachetypedef struct __rl_callback_generic_arg
112157184Sache{
113157184Sache  int count;
114157184Sache  int i1, i2;
115157184Sache  /* add here as needed */
116157184Sache} _rl_callback_generic_arg;
117157184Sache
118157184Sachetypedef int _rl_callback_func_t PARAMS((_rl_callback_generic_arg *));
119157184Sache
120157184Sache/*************************************************************************
121157184Sache *									 *
12258310Sache * Global functions undocumented in texinfo manual and not in readline.h *
12358310Sache *									 *
12458310Sache *************************************************************************/
12558310Sache
12658310Sache/*************************************************************************
12758310Sache *									 *
12858310Sache * Global variables undocumented in texinfo manual and not in readline.h *
12958310Sache *									 *
13058310Sache *************************************************************************/
13158310Sache
13258310Sache/* complete.c */
13358310Sacheextern int rl_complete_with_tilde_expansion;
13458310Sache#if defined (VISIBLE_STATS)
13558310Sacheextern int rl_visible_stats;
13658310Sache#endif /* VISIBLE_STATS */
13758310Sache
13858310Sache/* readline.c */
13958310Sacheextern int rl_line_buffer_len;
14058310Sacheextern int rl_arg_sign;
14158310Sacheextern int rl_visible_prompt_length;
14258310Sacheextern int readline_echoing_p;
14358310Sacheextern int rl_key_sequence_length;
144119610Sacheextern int rl_byte_oriented;
14558310Sache
146157184Sacheextern _rl_keyseq_cxt *_rl_kscxt;
147157184Sache
14858310Sache/* display.c */
14958310Sacheextern int rl_display_fixed;
15058310Sache
15158310Sache/* parens.c */
15258310Sacheextern int rl_blink_matching_paren;
15358310Sache
15458310Sache/*************************************************************************
15558310Sache *									 *
15658310Sache * Global functions and variables unsed and undocumented		 *
15758310Sache *									 *
15858310Sache *************************************************************************/
15958310Sache
16058310Sache/* kill.c */
161119610Sacheextern int rl_set_retained_kills PARAMS((int));
16258310Sache
16358310Sache/* terminal.c */
164119610Sacheextern void _rl_set_screen_size PARAMS((int, int));
16558310Sache
16658310Sache/* undo.c */
167119610Sacheextern int _rl_fix_last_undo_of_type PARAMS((int, int, int));
16858310Sache
16958310Sache/* util.c */
170119610Sacheextern char *_rl_savestring PARAMS((const char *));
17158310Sache
17258310Sache/*************************************************************************
17358310Sache *									 *
17458310Sache * Functions and variables private to the readline library		 *
17558310Sache *									 *
17658310Sache *************************************************************************/
17758310Sache
17858310Sache/* NOTE: Functions and variables prefixed with `_rl_' are
17958310Sache   pseudo-global: they are global so they can be shared
18058310Sache   between files in the readline library, but are not intended
18158310Sache   to be visible to readline callers. */
18258310Sache
18358310Sache/*************************************************************************
18458310Sache * Undocumented private functions					 *
18558310Sache *************************************************************************/
18658310Sache
18758310Sache#if defined(READLINE_CALLBACKS)
18858310Sache
18958310Sache/* readline.c */
190119610Sacheextern void readline_internal_setup PARAMS((void));
191119610Sacheextern char *readline_internal_teardown PARAMS((int));
192119610Sacheextern int readline_internal_char PARAMS((void));
19358310Sache
194157184Sacheextern _rl_keyseq_cxt *_rl_keyseq_cxt_alloc PARAMS((void));
195157184Sacheextern void _rl_keyseq_cxt_dispose PARAMS((_rl_keyseq_cxt *));
196157184Sacheextern void _rl_keyseq_chain_dispose PARAMS((void));
197157184Sache
198157184Sacheextern int _rl_dispatch_callback PARAMS((_rl_keyseq_cxt *));
199157184Sache
200157184Sache/* callback.c */
201157184Sacheextern _rl_callback_generic_arg *_rl_callback_data_alloc PARAMS((int));
202157184Sacheextern void _rl_callback_data_dispose PARAMS((_rl_callback_generic_arg *));
203157184Sache
20458310Sache#endif /* READLINE_CALLBACKS */
20558310Sache
20658310Sache/* bind.c */
20758310Sache
208119610Sache/* complete.c */
209119610Sacheextern char _rl_find_completion_word PARAMS((int *, int *));
210119610Sacheextern void _rl_free_match_list PARAMS((char **));
211119610Sache
21258310Sache/* display.c */
213119610Sacheextern char *_rl_strip_prompt PARAMS((char *));
214119610Sacheextern void _rl_move_cursor_relative PARAMS((int, const char *));
215119610Sacheextern void _rl_move_vert PARAMS((int));
216119610Sacheextern void _rl_save_prompt PARAMS((void));
217119610Sacheextern void _rl_restore_prompt PARAMS((void));
218119610Sacheextern char *_rl_make_prompt_for_search PARAMS((int));
219119610Sacheextern void _rl_erase_at_end_of_line PARAMS((int));
220119610Sacheextern void _rl_clear_to_eol PARAMS((int));
221119610Sacheextern void _rl_clear_screen PARAMS((void));
222119610Sacheextern void _rl_update_final PARAMS((void));
223119610Sacheextern void _rl_redisplay_after_sigwinch PARAMS((void));
224119610Sacheextern void _rl_clean_up_for_exit PARAMS((void));
225119610Sacheextern void _rl_erase_entire_line PARAMS((void));
226119610Sacheextern int _rl_current_display_line PARAMS((void));
22758310Sache
22858310Sache/* input.c */
229119610Sacheextern int _rl_any_typein PARAMS((void));
230119610Sacheextern int _rl_input_available PARAMS((void));
231119610Sacheextern int _rl_input_queued PARAMS((int));
232119610Sacheextern void _rl_insert_typein PARAMS((int));
233119610Sacheextern int _rl_unget_char PARAMS((int));
234136644Sacheextern int _rl_pushed_input_available PARAMS((void));
23558310Sache
236157184Sache/* isearch.c */
237157184Sacheextern _rl_search_cxt *_rl_scxt_alloc PARAMS((int, int));
238157184Sacheextern void _rl_scxt_dispose PARAMS((_rl_search_cxt *, int));
239157184Sache
240157184Sacheextern int _rl_isearch_dispatch PARAMS((_rl_search_cxt *, int));
241157184Sacheextern int _rl_isearch_callback PARAMS((_rl_search_cxt *));
242157184Sache
243157184Sacheextern int _rl_search_getchar PARAMS((_rl_search_cxt *));
244157184Sache
24558310Sache/* macro.c */
246119610Sacheextern void _rl_with_macro_input PARAMS((char *));
247119610Sacheextern int _rl_next_macro_key PARAMS((void));
248119610Sacheextern void _rl_push_executing_macro PARAMS((void));
249119610Sacheextern void _rl_pop_executing_macro PARAMS((void));
250119610Sacheextern void _rl_add_macro_char PARAMS((int));
251119610Sacheextern void _rl_kill_kbd_macro PARAMS((void));
25258310Sache
253119610Sache/* misc.c */
254157184Sacheextern int _rl_arg_overflow PARAMS((void));
255157184Sacheextern void _rl_arg_init PARAMS((void));
256157184Sacheextern int _rl_arg_getchar PARAMS((void));
257157184Sacheextern int _rl_arg_callback PARAMS((_rl_arg_cxt));
258157184Sacheextern void _rl_reset_argument PARAMS((void));
259157184Sache
260119610Sacheextern void _rl_start_using_history PARAMS((void));
261119610Sacheextern int _rl_free_saved_history_line PARAMS((void));
262119610Sacheextern void _rl_set_insert_mode PARAMS((int, int));
263119610Sache
26458310Sache/* nls.c */
265119610Sacheextern int _rl_init_eightbit PARAMS((void));
26658310Sache
26758310Sache/* parens.c */
268119610Sacheextern void _rl_enable_paren_matching PARAMS((int));
26958310Sache
27058310Sache/* readline.c */
271119610Sacheextern void _rl_init_line_state PARAMS((void));
272119610Sacheextern void _rl_set_the_line PARAMS((void));
273119610Sacheextern int _rl_dispatch PARAMS((int, Keymap));
274119610Sacheextern int _rl_dispatch_subseq PARAMS((int, Keymap, int));
275157184Sacheextern void _rl_internal_char_cleanup PARAMS((void));
27658310Sache
27758310Sache/* rltty.c */
278119610Sacheextern int _rl_disable_tty_signals PARAMS((void));
279119610Sacheextern int _rl_restore_tty_signals PARAMS((void));
28058310Sache
281157184Sache/* search.c */
282157184Sacheextern int _rl_nsearch_callback PARAMS((_rl_search_cxt *));
283157184Sache
28458310Sache/* terminal.c */
285119610Sacheextern void _rl_get_screen_size PARAMS((int, int));
286119610Sacheextern int _rl_init_terminal_io PARAMS((const char *));
28758310Sache#ifdef _MINIX
288119610Sacheextern void _rl_output_character_function PARAMS((int));
28958310Sache#else
290119610Sacheextern int _rl_output_character_function PARAMS((int));
29158310Sache#endif
292119610Sacheextern void _rl_output_some_chars PARAMS((const char *, int));
293119610Sacheextern int _rl_backspace PARAMS((int));
294119610Sacheextern void _rl_enable_meta_key PARAMS((void));
295119610Sacheextern void _rl_control_keypad PARAMS((int));
296119610Sacheextern void _rl_set_cursor PARAMS((int, int));
29758310Sache
298119610Sache/* text.c */
299119610Sacheextern void _rl_fix_point PARAMS((int));
300119610Sacheextern int _rl_replace_text PARAMS((const char *, int, int));
301119610Sacheextern int _rl_insert_char PARAMS((int, int));
302119610Sacheextern int _rl_overwrite_char PARAMS((int, int));
303119610Sacheextern int _rl_overwrite_rubout PARAMS((int, int));
304119610Sacheextern int _rl_rubout_char PARAMS((int, int));
305119610Sache#if defined (HANDLE_MULTIBYTE)
306119610Sacheextern int _rl_char_search_internal PARAMS((int, int, char *, int));
307119610Sache#else
308119610Sacheextern int _rl_char_search_internal PARAMS((int, int, int));
309119610Sache#endif
310119610Sacheextern int _rl_set_mark_at_pos PARAMS((int));
311119610Sache
312165670Sache/* undo.c */
313165670Sacheextern UNDO_LIST *_rl_copy_undo_entry PARAMS((UNDO_LIST *));
314165670Sacheextern UNDO_LIST *_rl_copy_undo_list PARAMS((UNDO_LIST *));
315165670Sache
31658310Sache/* util.c */
317119610Sacheextern int _rl_abort_internal PARAMS((void));
318119610Sacheextern char *_rl_strindex PARAMS((const char *, const char *));
319119610Sacheextern int _rl_qsort_string_compare PARAMS((char **, char **));
320119610Sacheextern int (_rl_uppercase_p) PARAMS((int));
321119610Sacheextern int (_rl_lowercase_p) PARAMS((int));
322119610Sacheextern int (_rl_pure_alphabetic) PARAMS((int));
323119610Sacheextern int (_rl_digit_p) PARAMS((int));
324119610Sacheextern int (_rl_to_lower) PARAMS((int));
325119610Sacheextern int (_rl_to_upper) PARAMS((int));
326119610Sacheextern int (_rl_digit_value) PARAMS((int));
32758310Sache
32858310Sache/* vi_mode.c */
329119610Sacheextern void _rl_vi_initialize_line PARAMS((void));
330119610Sacheextern void _rl_vi_reset_last PARAMS((void));
331119610Sacheextern void _rl_vi_set_last PARAMS((int, int, int));
332119610Sacheextern int _rl_vi_textmod_command PARAMS((int));
333119610Sacheextern void _rl_vi_done_inserting PARAMS((void));
33458310Sache
33558310Sache/*************************************************************************
33658310Sache * Undocumented private variables					 *
33758310Sache *************************************************************************/
33858310Sache
33975406Sache/* bind.c */
34075406Sacheextern const char *_rl_possible_control_prefixes[];
34175406Sacheextern const char *_rl_possible_meta_prefixes[];
34275406Sache
343157184Sache/* callback.c */
344157184Sacheextern _rl_callback_func_t *_rl_callback_func;
345157184Sacheextern _rl_callback_generic_arg *_rl_callback_data;
346157184Sache
34758310Sache/* complete.c */
34858310Sacheextern int _rl_complete_show_all;
349136644Sacheextern int _rl_complete_show_unmodified;
35058310Sacheextern int _rl_complete_mark_directories;
351119610Sacheextern int _rl_complete_mark_symlink_dirs;
35258310Sacheextern int _rl_print_completions_horizontally;
35358310Sacheextern int _rl_completion_case_fold;
354119610Sacheextern int _rl_match_hidden_files;
355119610Sacheextern int _rl_page_completions;
35658310Sache
35758310Sache/* display.c */
35858310Sacheextern int _rl_vis_botlin;
35958310Sacheextern int _rl_last_c_pos;
36058310Sacheextern int _rl_suppress_redisplay;
361157184Sacheextern int _rl_want_redisplay;
36258310Sacheextern char *rl_display_prompt;
36358310Sache
36458310Sache/* isearch.c */
365119610Sacheextern char *_rl_isearch_terminators;
36658310Sache
367157184Sacheextern _rl_search_cxt *_rl_iscxt;
368157184Sache
36958310Sache/* macro.c */
37058310Sacheextern char *_rl_executing_macro;
37158310Sache
372119610Sache/* misc.c */
373119610Sacheextern int _rl_history_preserve_point;
374119610Sacheextern int _rl_history_saved_point;
375119610Sache
376157184Sacheextern _rl_arg_cxt _rl_argcxt;
377157184Sache
37858310Sache/* readline.c */
37958310Sacheextern int _rl_horizontal_scroll_mode;
38058310Sacheextern int _rl_mark_modified_lines;
38158310Sacheextern int _rl_bell_preference;
38258310Sacheextern int _rl_meta_flag;
38358310Sacheextern int _rl_convert_meta_chars_to_ascii;
38458310Sacheextern int _rl_output_meta_chars;
385157184Sacheextern int _rl_bind_stty_chars;
38658310Sacheextern char *_rl_comment_begin;
38758310Sacheextern unsigned char _rl_parsing_conditionalized_out;
38858310Sacheextern Keymap _rl_keymap;
38958310Sacheextern FILE *_rl_in_stream;
39058310Sacheextern FILE *_rl_out_stream;
39158310Sacheextern int _rl_last_command_was_kill;
39258310Sacheextern int _rl_eof_char;
39358310Sacheextern procenv_t readline_top_level;
39458310Sache
395157184Sache/* search.c */
396157184Sacheextern _rl_search_cxt *_rl_nscxt;
397157184Sache
39858310Sache/* terminal.c */
39958310Sacheextern int _rl_enable_keypad;
40058310Sacheextern int _rl_enable_meta;
40175406Sacheextern char *_rl_term_clreol;
40275406Sacheextern char *_rl_term_clrpag;
40375406Sacheextern char *_rl_term_im;
40475406Sacheextern char *_rl_term_ic;
40575406Sacheextern char *_rl_term_ei;
40675406Sacheextern char *_rl_term_DC;
40775406Sacheextern char *_rl_term_up;
40875406Sacheextern char *_rl_term_dc;
40975406Sacheextern char *_rl_term_cr;
41075406Sacheextern char *_rl_term_IC;
411165670Sacheextern char *_rl_term_forward_char;
41275406Sacheextern int _rl_screenheight;
41375406Sacheextern int _rl_screenwidth;
41475406Sacheextern int _rl_screenchars;
41575406Sacheextern int _rl_terminal_can_insert;
41658310Sacheextern int _rl_term_autowrap;
41758310Sache
41858310Sache/* undo.c */
41958310Sacheextern int _rl_doing_an_undo;
42058310Sacheextern int _rl_undo_group_level;
42158310Sache
422136644Sache/* vi_mode.c */
423136644Sacheextern int _rl_vi_last_command;
424136644Sache
42558310Sache#endif /* _RL_PRIVATE_H_ */
426