1/* rlprivate.h -- functions and variables global to the readline library,
2 but not intended for use by applications. */
3
4/* Copyright (C) 1999-2005 Free Software Foundation, Inc.
5
6 This file is part of the GNU Readline Library, a library for
7 reading lines of text with interactive input and history editing.
8
9 The GNU Readline Library is free software; you can redistribute it
10 and/or modify it under the terms of the GNU General Public License
11 as published by the Free Software Foundation; either version 2, or
12 (at your option) any later version.
13
14 The GNU Readline Library is distributed in the hope that it will be
15 useful, but WITHOUT ANY WARRANTY; without even the implied warranty
16 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 The GNU General Public License is often shipped with GNU software, and
20 is generally kept in a file called COPYING or LICENSE. If you do not
21 have a copy of the license, write to the Free Software Foundation,
22 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
23
24#if !defined (_RL_PRIVATE_H_)
25#define _RL_PRIVATE_H_
26
27#include "rlconf.h" /* for VISIBLE_STATS */
28#include "rlstdc.h"
29#include "posixjmp.h" /* defines procenv_t */
30
31/*************************************************************************
32 * *
33 * Global structs undocumented in texinfo manual and not in readline.h *
34 * *
35 *************************************************************************/
36/* search types */
37#define RL_SEARCH_ISEARCH 0x01 /* incremental search */
38#define RL_SEARCH_NSEARCH 0x02 /* non-incremental search */
39#define RL_SEARCH_CSEARCH 0x04 /* intra-line char search */
40
41/* search flags */
42#define SF_REVERSE 0x01
43#define SF_FOUND 0x02
44#define SF_FAILED 0x04
45
46typedef struct __rl_search_context
47{
48 int type;
49 int sflags;
50
51 char *search_string;
52 int search_string_index;
53 int search_string_size;
54
55 char **lines;
56 char *allocated_line;
57 int hlen;
58 int hindex;
59
60 int save_point;
61 int save_mark;
62 int save_line;
63 int last_found_line;
64 char *prev_line_found;
65
66 UNDO_LIST *save_undo_list;
67
68 int history_pos;
69 int direction;
70
71 int lastc;
72#if defined (HANDLE_MULTIBYTE)
73 char mb[MB_LEN_MAX];
74#endif
75
76 char *sline;
77 int sline_len;
78 int sline_index;
79
80 const char *search_terminators;
81} _rl_search_cxt;
82
83/* Callback data for reading numeric arguments */
84#define NUM_SAWMINUS 0x01
85#define NUM_SAWDIGITS 0x02
86#define NUM_READONE 0x04
87
88typedef int _rl_arg_cxt;
89
90/* A context for reading key sequences longer than a single character when
91 using the callback interface. */
92#define KSEQ_DISPATCHED 0x01
93#define KSEQ_SUBSEQ 0x02
94#define KSEQ_RECURSIVE 0x04
95
96typedef struct __rl_keyseq_context
97{
98 int flags;
99 int subseq_arg;
100 int subseq_retval; /* XXX */
101 Keymap dmap;
102
103 Keymap oldmap;
104 int okey;
105 struct __rl_keyseq_context *ocxt;
106 int childval;
107} _rl_keyseq_cxt;
108
109 /* fill in more as needed */
110/* `Generic' callback data and functions */
111typedef struct __rl_callback_generic_arg
112{
113 int count;
114 int i1, i2;
115 /* add here as needed */
116} _rl_callback_generic_arg;
117
118typedef int _rl_callback_func_t PARAMS((_rl_callback_generic_arg *));
119
120/*************************************************************************
121 * *
122 * Global functions undocumented in texinfo manual and not in readline.h *
123 * *
124 *************************************************************************/
125
126/*************************************************************************
127 * *
128 * Global variables undocumented in texinfo manual and not in readline.h *
129 * *
130 *************************************************************************/
131
132/* complete.c */
133extern int rl_complete_with_tilde_expansion;
134#if defined (VISIBLE_STATS)
135extern int rl_visible_stats;
136#endif /* VISIBLE_STATS */
137
138/* readline.c */
139extern int rl_line_buffer_len;
140extern int rl_arg_sign;
141extern int rl_visible_prompt_length;
142extern int readline_echoing_p;
143extern int rl_key_sequence_length;
144extern int rl_byte_oriented;
145
146extern _rl_keyseq_cxt *_rl_kscxt;
147
148/* display.c */
149extern int rl_display_fixed;
150
151/* parens.c */
152extern int rl_blink_matching_paren;
153
154/*************************************************************************
155 * *
156 * Global functions and variables unsed and undocumented *
157 * *
158 *************************************************************************/
159
160/* kill.c */
161extern int rl_set_retained_kills PARAMS((int));
162
163/* terminal.c */
164extern void _rl_set_screen_size PARAMS((int, int));
165
166/* undo.c */
167extern int _rl_fix_last_undo_of_type PARAMS((enum undo_code, int, int));
168
169/* util.c */
170extern char *_rl_savestring PARAMS((const char *));
171
172/*************************************************************************
173 * *
174 * Functions and variables private to the readline library *
175 * *
176 *************************************************************************/
177
178/* NOTE: Functions and variables prefixed with `_rl_' are
179 pseudo-global: they are global so they can be shared
180 between files in the readline library, but are not intended
181 to be visible to readline callers. */
182
183/*************************************************************************
184 * Undocumented private functions *
185 *************************************************************************/
186
187#if defined(READLINE_CALLBACKS)
188
189/* readline.c */
190extern void readline_internal_setup PARAMS((void));
191extern char *readline_internal_teardown PARAMS((int));
192extern int readline_internal_char PARAMS((void));
193
194extern _rl_keyseq_cxt *_rl_keyseq_cxt_alloc PARAMS((void));
195extern void _rl_keyseq_cxt_dispose PARAMS((_rl_keyseq_cxt *));
196extern void _rl_keyseq_chain_dispose PARAMS((void));
197
198extern int _rl_dispatch_callback PARAMS((_rl_keyseq_cxt *));
199
200/* callback.c */
201extern _rl_callback_generic_arg *_rl_callback_data_alloc PARAMS((int));
202extern void _rl_callback_data_dispose PARAMS((_rl_callback_generic_arg *));
203
204#endif /* READLINE_CALLBACKS */
205
206/* bind.c */
207
208/* complete.c */
209extern char _rl_find_completion_word PARAMS((int *, int *));
210extern void _rl_free_match_list PARAMS((char **));
211
212/* display.c */
213extern char *_rl_strip_prompt PARAMS((char *));
214extern void _rl_move_cursor_relative PARAMS((int, const char *));
215extern void _rl_move_vert PARAMS((int));
216extern void _rl_save_prompt PARAMS((void));
217extern void _rl_restore_prompt PARAMS((void));
218extern char *_rl_make_prompt_for_search PARAMS((int));
219extern void _rl_erase_at_end_of_line PARAMS((int));
220extern void _rl_clear_to_eol PARAMS((int));
221extern void _rl_clear_screen PARAMS((void));
222extern void _rl_update_final PARAMS((void));
223extern void _rl_redisplay_after_sigwinch PARAMS((void));
224extern void _rl_clean_up_for_exit PARAMS((void));
225extern void _rl_erase_entire_line PARAMS((void));
226extern int _rl_current_display_line PARAMS((void));
227
228/* input.c */
229extern int _rl_any_typein PARAMS((void));
230extern int _rl_input_available PARAMS((void));
231extern int _rl_input_queued PARAMS((int));
232extern void _rl_insert_typein PARAMS((int));
233extern int _rl_unget_char PARAMS((int));
234extern int _rl_pushed_input_available PARAMS((void));
235
236/* isearch.c */
237extern _rl_search_cxt *_rl_scxt_alloc PARAMS((int, int));
238extern void _rl_scxt_dispose PARAMS((_rl_search_cxt *, int));
239
240extern int _rl_isearch_dispatch PARAMS((_rl_search_cxt *, int));
241extern int _rl_isearch_callback PARAMS((_rl_search_cxt *));
242
243extern int _rl_search_getchar PARAMS((_rl_search_cxt *));
244
245/* macro.c */
246extern void _rl_with_macro_input PARAMS((char *));
247extern int _rl_next_macro_key PARAMS((void));
248extern void _rl_push_executing_macro PARAMS((void));
249extern void _rl_pop_executing_macro PARAMS((void));
250extern void _rl_add_macro_char PARAMS((int));
251extern void _rl_kill_kbd_macro PARAMS((void));
252
253/* misc.c */
254extern int _rl_arg_overflow PARAMS((void));
255extern void _rl_arg_init PARAMS((void));
256extern int _rl_arg_getchar PARAMS((void));
257extern int _rl_arg_callback PARAMS((_rl_arg_cxt));
258extern void _rl_reset_argument PARAMS((void));
259
260extern void _rl_start_using_history PARAMS((void));
261extern int _rl_free_saved_history_line PARAMS((void));
262extern void _rl_set_insert_mode PARAMS((int, int));
263
264/* nls.c */
265extern int _rl_init_eightbit PARAMS((void));
266
267/* parens.c */
268extern void _rl_enable_paren_matching PARAMS((int));
269
270/* readline.c */
271extern void _rl_init_line_state PARAMS((void));
272extern void _rl_set_the_line PARAMS((void));
273extern int _rl_dispatch PARAMS((int, Keymap));
274extern int _rl_dispatch_subseq PARAMS((int, Keymap, int));
275extern void _rl_internal_char_cleanup PARAMS((void));
276
277/* rltty.c */
278extern int _rl_disable_tty_signals PARAMS((void));
279extern int _rl_restore_tty_signals PARAMS((void));
280
281/* search.c */
282extern int _rl_nsearch_callback PARAMS((_rl_search_cxt *));
283
284/* terminal.c */
285extern void _rl_get_screen_size PARAMS((int, int));
286extern int _rl_init_terminal_io PARAMS((const char *));
287#ifdef _MINIX
288extern void _rl_output_character_function PARAMS((int));
289#else
290extern int _rl_output_character_function PARAMS((int));
291#endif
292extern void _rl_output_some_chars PARAMS((const char *, int));
293extern int _rl_backspace PARAMS((int));
294extern void _rl_enable_meta_key PARAMS((void));
295extern void _rl_control_keypad PARAMS((int));
296extern void _rl_set_cursor PARAMS((int, int));
297
298/* text.c */
299extern void _rl_fix_point PARAMS((int));
300extern int _rl_replace_text PARAMS((const char *, int, int));
301extern int _rl_insert_char PARAMS((int, int));
302extern int _rl_overwrite_char PARAMS((int, int));
303extern int _rl_overwrite_rubout PARAMS((int, int));
304extern int _rl_rubout_char PARAMS((int, int));
305#if defined (HANDLE_MULTIBYTE)
306extern int _rl_char_search_internal PARAMS((int, int, char *, int));
307#else
308extern int _rl_char_search_internal PARAMS((int, int, int));
309#endif
310extern int _rl_set_mark_at_pos PARAMS((int));
311
312/* undo.c */
313extern UNDO_LIST *_rl_copy_undo_entry PARAMS((UNDO_LIST *));
314extern UNDO_LIST *_rl_copy_undo_list PARAMS((UNDO_LIST *));
315
316/* util.c */
317extern int _rl_abort_internal PARAMS((void));
318extern char *_rl_strindex PARAMS((const char *, const char *));
319extern int _rl_qsort_string_compare PARAMS((char **, char **));
320extern int (_rl_uppercase_p) PARAMS((int));
321extern int (_rl_lowercase_p) PARAMS((int));
322extern int (_rl_pure_alphabetic) PARAMS((int));
323extern int (_rl_digit_p) PARAMS((int));
324extern int (_rl_to_lower) PARAMS((int));
325extern int (_rl_to_upper) PARAMS((int));
326extern int (_rl_digit_value) PARAMS((int));
327
328/* vi_mode.c */
329extern void _rl_vi_initialize_line PARAMS((void));
330extern void _rl_vi_reset_last PARAMS((void));
331extern void _rl_vi_set_last PARAMS((int, int, int));
332extern int _rl_vi_textmod_command PARAMS((int));
333extern void _rl_vi_done_inserting PARAMS((void));
334
335/*************************************************************************
336 * Undocumented private variables *
337 *************************************************************************/
338
339/* bind.c */
340extern const char *_rl_possible_control_prefixes[];
341extern const char *_rl_possible_meta_prefixes[];
342
343/* callback.c */
344extern _rl_callback_func_t *_rl_callback_func;
345extern _rl_callback_generic_arg *_rl_callback_data;
346
347/* complete.c */
348extern int _rl_complete_show_all;
349extern int _rl_complete_show_unmodified;
350extern int _rl_complete_mark_directories;
351extern int _rl_complete_mark_symlink_dirs;
352extern int _rl_print_completions_horizontally;
353extern int _rl_completion_case_fold;
354extern int _rl_match_hidden_files;
355extern int _rl_page_completions;
356
357/* display.c */
358extern int _rl_vis_botlin;
359extern int _rl_last_c_pos;
360extern int _rl_suppress_redisplay;
361extern int _rl_want_redisplay;
362extern const char *rl_display_prompt;
363
364/* isearch.c */
365extern char *_rl_isearch_terminators;
366
367extern _rl_search_cxt *_rl_iscxt;
368
369/* macro.c */
370extern char *_rl_executing_macro;
371
372/* misc.c */
373extern int _rl_history_preserve_point;
374extern int _rl_history_saved_point;
375
376extern _rl_arg_cxt _rl_argcxt;
377
378/* readline.c */
379extern int _rl_horizontal_scroll_mode;
380extern int _rl_mark_modified_lines;
381extern int _rl_bell_preference;
382extern int _rl_meta_flag;
383extern int _rl_convert_meta_chars_to_ascii;
384extern int _rl_output_meta_chars;
385extern int _rl_bind_stty_chars;
386extern char *_rl_comment_begin;
387extern unsigned char _rl_parsing_conditionalized_out;
388extern Keymap _rl_keymap;
389extern FILE *_rl_in_stream;
390extern FILE *_rl_out_stream;
391extern int _rl_last_command_was_kill;
392extern int _rl_eof_char;
393extern procenv_t readline_top_level;
394
395/* search.c */
396extern _rl_search_cxt *_rl_nscxt;
397
398/* terminal.c */
399extern int _rl_enable_keypad;
400extern int _rl_enable_meta;
401extern const char *_rl_term_clreol;
402extern const char *_rl_term_clrpag;
403extern const char *_rl_term_im;
404extern const char *_rl_term_ic;
405extern const char *_rl_term_ei;
406extern const char *_rl_term_DC;
407extern const char *_rl_term_up;
408extern const char *_rl_term_dc;
409extern const char *_rl_term_cr;
410extern const char *_rl_term_IC;
411extern const char *_rl_term_forward_char;
412extern int _rl_screenheight;
413extern int _rl_screenwidth;
414extern int _rl_screenchars;
415extern int _rl_terminal_can_insert;
416extern int _rl_term_autowrap;
417
418/* undo.c */
419extern int _rl_doing_an_undo;
420extern int _rl_undo_group_level;
421
422/* vi_mode.c */
423extern int _rl_vi_last_command;
424
425#endif /* _RL_PRIVATE_H_ */
426