ppc64_elf_edit_opd revamp
[deliverable/binutils-gdb.git] / readline / rlprivate.h
1 /* rlprivate.h -- functions and variables global to the readline library,
2 but not intended for use by applications. */
3
4 /* Copyright (C) 1999-2010 Free Software Foundation, Inc.
5
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.
8
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.
13
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.
18
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/>.
21 */
22
23 #if !defined (_RL_PRIVATE_H_)
24 #define _RL_PRIVATE_H_
25
26 #include "rlconf.h" /* for VISIBLE_STATS */
27 #include "rlstdc.h"
28 #include "posixjmp.h" /* defines procenv_t */
29
30 /*************************************************************************
31 * *
32 * Convenience definitions *
33 * *
34 *************************************************************************/
35
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)
39
40 #define RL_CHECK_SIGNALS() \
41 do { \
42 if (_rl_caught_signal) _rl_signal_handler (_rl_caught_signal); \
43 } while (0)
44
45 /*************************************************************************
46 * *
47 * Global structs undocumented in texinfo manual and not in readline.h *
48 * *
49 *************************************************************************/
50 /* search types */
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 */
54
55 /* search flags */
56 #define SF_REVERSE 0x01
57 #define SF_FOUND 0x02
58 #define SF_FAILED 0x04
59 #define SF_CHGKMAP 0x08
60
61 typedef struct __rl_search_context
62 {
63 int type;
64 int sflags;
65
66 char *search_string;
67 int search_string_index;
68 int search_string_size;
69
70 char **lines;
71 char *allocated_line;
72 int hlen;
73 int hindex;
74
75 int save_point;
76 int save_mark;
77 int save_line;
78 int last_found_line;
79 char *prev_line_found;
80
81 UNDO_LIST *save_undo_list;
82
83 Keymap keymap; /* used when dispatching commands in search string */
84 Keymap okeymap; /* original keymap */
85
86 int history_pos;
87 int direction;
88
89 int lastc;
90 #if defined (HANDLE_MULTIBYTE)
91 char mb[MB_LEN_MAX];
92 #endif
93
94 char *sline;
95 int sline_len;
96 int sline_index;
97
98 char *search_terminators;
99 } _rl_search_cxt;
100
101 /* Callback data for reading numeric arguments */
102 #define NUM_SAWMINUS 0x01
103 #define NUM_SAWDIGITS 0x02
104 #define NUM_READONE 0x04
105
106 typedef int _rl_arg_cxt;
107
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
113
114 typedef struct __rl_keyseq_context
115 {
116 int flags;
117 int subseq_arg;
118 int subseq_retval; /* XXX */
119 Keymap dmap;
120
121 Keymap oldmap;
122 int okey;
123 struct __rl_keyseq_context *ocxt;
124 int childval;
125 } _rl_keyseq_cxt;
126
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
131
132 /* various states for vi-mode commands that use motion commands. reflects
133 RL_READLINE_STATE */
134 #define VMSTATE_READ 0x01
135 #define VMSTATE_NUMARG 0x02
136
137 typedef struct __rl_vimotion_context
138 {
139 int op;
140 int state;
141 int flags; /* reserved */
142 _rl_arg_cxt ncxt;
143 int numeric_arg;
144 int start, end; /* rl_point, rl_end */
145 int key, motion; /* initial key, motion command */
146 } _rl_vimotion_cxt;
147
148 /* fill in more as needed */
149 /* `Generic' callback data and functions */
150 typedef struct __rl_callback_generic_arg
151 {
152 int count;
153 int i1, i2;
154 /* add here as needed */
155 } _rl_callback_generic_arg;
156
157 typedef int _rl_callback_func_t PARAMS((_rl_callback_generic_arg *));
158
159 /*************************************************************************
160 * *
161 * Global functions undocumented in texinfo manual and not in readline.h *
162 * *
163 *************************************************************************/
164
165 /*************************************************************************
166 * *
167 * Global variables undocumented in texinfo manual and not in readline.h *
168 * *
169 *************************************************************************/
170
171 /* complete.c */
172 extern int rl_complete_with_tilde_expansion;
173 #if defined (VISIBLE_STATS)
174 extern int rl_visible_stats;
175 #endif /* VISIBLE_STATS */
176
177 /* readline.c */
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;
183
184 /* display.c */
185 extern int rl_display_fixed;
186
187 /* parens.c */
188 extern int rl_blink_matching_paren;
189
190 /*************************************************************************
191 * *
192 * Global functions and variables unsed and undocumented *
193 * *
194 *************************************************************************/
195
196 /* kill.c */
197 extern int rl_set_retained_kills PARAMS((int));
198
199 /* terminal.c */
200 extern void _rl_set_screen_size PARAMS((int, int));
201
202 /* undo.c */
203 extern int _rl_fix_last_undo_of_type PARAMS((int, int, int));
204
205 /* util.c */
206 extern char *_rl_savestring PARAMS((const char *));
207
208 /*************************************************************************
209 * *
210 * Functions and variables private to the readline library *
211 * *
212 *************************************************************************/
213
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. */
218
219 /*************************************************************************
220 * Undocumented private functions *
221 *************************************************************************/
222
223 #if defined(READLINE_CALLBACKS)
224
225 /* readline.c */
226 extern void readline_internal_setup PARAMS((void));
227 extern char *readline_internal_teardown PARAMS((int));
228 extern int readline_internal_char PARAMS((void));
229
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));
233
234 extern int _rl_dispatch_callback PARAMS((_rl_keyseq_cxt *));
235
236 /* callback.c */
237 extern _rl_callback_generic_arg *_rl_callback_data_alloc PARAMS((int));
238 extern void _rl_callback_data_dispose PARAMS((_rl_callback_generic_arg *));
239
240 #endif /* READLINE_CALLBACKS */
241
242 /* bind.c */
243
244 /* complete.c */
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 **));
248
249 /* display.c */
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));
264
265 /* input.c */
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));
272
273 /* isearch.c */
274 extern _rl_search_cxt *_rl_scxt_alloc PARAMS((int, int));
275 extern void _rl_scxt_dispose PARAMS((_rl_search_cxt *, int));
276
277 extern int _rl_isearch_dispatch PARAMS((_rl_search_cxt *, int));
278 extern int _rl_isearch_callback PARAMS((_rl_search_cxt *));
279
280 extern int _rl_search_getchar PARAMS((_rl_search_cxt *));
281
282 /* macro.c */
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));
289
290 /* misc.c */
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));
296
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));
300
301 extern void _rl_revert_all_lines PARAMS((void));
302
303 /* nls.c */
304 extern int _rl_init_eightbit PARAMS((void));
305
306 /* parens.c */
307 extern void _rl_enable_paren_matching PARAMS((int));
308
309 /* readline.c */
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));
315
316 /* rltty.c */
317 extern int _rl_disable_tty_signals PARAMS((void));
318 extern int _rl_restore_tty_signals PARAMS((void));
319
320 /* search.c */
321 extern int _rl_nsearch_callback PARAMS((_rl_search_cxt *));
322
323 /* signals.c */
324 extern void _rl_signal_handler PARAMS((int));
325
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));
330
331 /* terminal.c */
332 extern void _rl_get_screen_size PARAMS((int, int));
333 extern int _rl_init_terminal_io PARAMS((const char *));
334 #ifdef _MINIX
335 extern void _rl_output_character_function PARAMS((int));
336 #else
337 extern int _rl_output_character_function PARAMS((int));
338 #endif
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));
344
345 /* text.c */
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));
355 #else
356 extern int _rl_char_search_internal PARAMS((int, int, int));
357 #endif
358 extern int _rl_set_mark_at_pos PARAMS((int));
359
360 /* undo.c */
361 extern UNDO_LIST *_rl_copy_undo_entry PARAMS((UNDO_LIST *));
362 extern UNDO_LIST *_rl_copy_undo_list PARAMS((UNDO_LIST *));
363
364 /* util.c */
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)));
369 #else
370 extern void _rl_ttymsg ();
371 extern void _rl_errmsg ();
372 extern void _rl_trace ();
373 #endif
374
375 extern int _rl_tropen PARAMS((void));
376
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));
388
389 /* vi_mode.c */
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 *));
396
397 /*************************************************************************
398 * Undocumented private variables *
399 *************************************************************************/
400
401 /* bind.c */
402 extern const char * const _rl_possible_control_prefixes[];
403 extern const char * const _rl_possible_meta_prefixes[];
404
405 /* callback.c */
406 extern _rl_callback_func_t *_rl_callback_func;
407 extern _rl_callback_generic_arg *_rl_callback_data;
408
409 /* complete.c */
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;
423
424 /* display.c */
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;
429
430 /* isearch.c */
431 extern char *_rl_isearch_terminators;
432
433 extern _rl_search_cxt *_rl_iscxt;
434
435 /* macro.c */
436 extern char *_rl_executing_macro;
437
438 /* misc.c */
439 extern int _rl_history_preserve_point;
440 extern int _rl_history_saved_point;
441
442 extern _rl_arg_cxt _rl_argcxt;
443
444 /* readline.c */
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;
464
465 /* search.c */
466 extern _rl_search_cxt *_rl_nscxt;
467
468 /* signals.c */
469 extern int _rl_interrupt_immediately;
470 extern int volatile _rl_caught_signal;
471
472 extern int _rl_echoctl;
473
474 extern int _rl_intr_char;
475 extern int _rl_quit_char;
476 extern int _rl_susp_char;
477
478 /* terminal.c */
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;
497
498 /* undo.c */
499 extern int _rl_doing_an_undo;
500 extern int _rl_undo_group_level;
501
502 /* vi_mode.c */
503 extern int _rl_vi_last_command;
504 extern _rl_vimotion_cxt *_rl_vimvcxt;
505
506 #endif /* _RL_PRIVATE_H_ */
This page took 0.040739 seconds and 4 git commands to generate.