daily update
[external/binutils.git] / readline / readline.h
index f11b3d0..0de168c 100644 (file)
@@ -1,24 +1,23 @@
 /* Readline.h -- the names of functions callable from within readline. */
 
-/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2011 Free Software Foundation, Inc.
 
-   This file is part of the GNU Readline Library, a library for
-   reading lines of text with interactive input and history editing.
+   This file is part of the GNU Readline Library (Readline), a library
+   for reading lines of text with interactive input and history editing.      
 
-   The GNU Readline Library is free software; you can redistribute it
-   and/or modify it under the terms of the GNU General Public License
-   as published by the Free Software Foundation; either version 2, or
+   Readline is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.
 
-   The GNU Readline Library is distributed in the hope that it will be
-   useful, but WITHOUT ANY WARRANTY; without even the implied warranty
-   of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   Readline is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
 
-   The GNU General Public License is often shipped with GNU software, and
-   is generally kept in a file called COPYING or LICENSE.  If you do not
-   have a copy of the license, write to the Free Software Foundation,
-   59 Temple Place, Suite 330, Boston, MA 02111 USA. */
+   You should have received a copy of the GNU General Public License
+   along with Readline.  If not, see <http://www.gnu.org/licenses/>.
+*/
 
 #if !defined (_READLINE_H_)
 #define _READLINE_H_
@@ -40,9 +39,9 @@ extern "C" {
 #endif
 
 /* Hex-encoded Readline version number. */
-#define RL_READLINE_VERSION    0x0403          /* Readline 4.3 */
-#define RL_VERSION_MAJOR       4
-#define RL_VERSION_MINOR       3
+#define RL_READLINE_VERSION    0x0602          /* Readline 6.2 */
+#define RL_VERSION_MAJOR       6
+#define RL_VERSION_MINOR       2
 
 /* Readline data structures. */
 
@@ -96,6 +95,7 @@ extern int rl_forward_word PARAMS((int, int));
 extern int rl_backward_word PARAMS((int, int));
 extern int rl_refresh_line PARAMS((int, int));
 extern int rl_clear_screen PARAMS((int, int));
+extern int rl_skip_csi_sequence PARAMS((int, int));
 extern int rl_arrow_keys PARAMS((int, int));
 
 /* Bindable commands for inserting and deleting text. */
@@ -151,7 +151,9 @@ extern int rl_dump_variables PARAMS((int, int));
 extern int rl_complete PARAMS((int, int));
 extern int rl_possible_completions PARAMS((int, int));
 extern int rl_insert_completions PARAMS((int, int));
+extern int rl_old_menu_complete PARAMS((int, int));
 extern int rl_menu_complete PARAMS((int, int));
+extern int rl_backward_menu_complete PARAMS((int, int));
 
 /* Bindable commands for killing and yanking text, and managing the kill ring. */
 extern int rl_kill_word PARAMS((int, int));
@@ -160,6 +162,7 @@ extern int rl_kill_line PARAMS((int, int));
 extern int rl_backward_kill_line PARAMS((int, int));
 extern int rl_kill_full_line PARAMS((int, int));
 extern int rl_unix_word_rubout PARAMS((int, int));
+extern int rl_unix_filename_rubout PARAMS((int, int));
 extern int rl_unix_line_discard PARAMS((int, int));
 extern int rl_copy_region_to_kill PARAMS((int, int));
 extern int rl_kill_region PARAMS((int, int));
@@ -232,6 +235,7 @@ extern int rl_vi_append_mode PARAMS((int, int));
 extern int rl_vi_append_eol PARAMS((int, int));
 extern int rl_vi_eof_maybe PARAMS((int, int));
 extern int rl_vi_insertion_mode PARAMS((int, int));
+extern int rl_vi_insert_mode PARAMS((int, int));
 extern int rl_vi_movement_mode PARAMS((int, int));
 extern int rl_vi_arg_digit PARAMS((int, int));
 extern int rl_vi_change_case PARAMS((int, int));
@@ -240,6 +244,7 @@ extern int rl_vi_column PARAMS((int, int));
 extern int rl_vi_delete_to PARAMS((int, int));
 extern int rl_vi_change_to PARAMS((int, int));
 extern int rl_vi_yank_to PARAMS((int, int));
+extern int rl_vi_rubout PARAMS((int, int));
 extern int rl_vi_delete PARAMS((int, int));
 extern int rl_vi_back_to_indent PARAMS((int, int));
 extern int rl_vi_first_print PARAMS((int, int));
@@ -258,6 +263,8 @@ extern int rl_vi_check PARAMS((void));
 extern int rl_vi_domove PARAMS((int, int *));
 extern int rl_vi_bracktype PARAMS((int));
 
+extern void rl_vi_start_inserting PARAMS((int, int, int));
+
 /* VI-mode pseudo-bindable commands, used as utility functions. */
 extern int rl_vi_fWord PARAMS((int, int));
 extern int rl_vi_bWord PARAMS((int, int));
@@ -290,12 +297,22 @@ extern int rl_bind_key PARAMS((int, rl_command_func_t *));
 extern int rl_bind_key_in_map PARAMS((int, rl_command_func_t *, Keymap));
 extern int rl_unbind_key PARAMS((int));
 extern int rl_unbind_key_in_map PARAMS((int, Keymap));
+extern int rl_bind_key_if_unbound PARAMS((int, rl_command_func_t *));
+extern int rl_bind_key_if_unbound_in_map PARAMS((int, rl_command_func_t *, Keymap));
 extern int rl_unbind_function_in_map PARAMS((rl_command_func_t *, Keymap));
 extern int rl_unbind_command_in_map PARAMS((const char *, Keymap));
-extern int rl_set_key PARAMS((const char *, rl_command_func_t *, Keymap));
+extern int rl_bind_keyseq PARAMS((const char *, rl_command_func_t *));
+extern int rl_bind_keyseq_in_map PARAMS((const char *, rl_command_func_t *, Keymap));
+extern int rl_bind_keyseq_if_unbound PARAMS((const char *, rl_command_func_t *));
+extern int rl_bind_keyseq_if_unbound_in_map PARAMS((const char *, rl_command_func_t *, Keymap));
 extern int rl_generic_bind PARAMS((int, const char *, char *, Keymap));
+
+extern char *rl_variable_value PARAMS((const char *));
 extern int rl_variable_bind PARAMS((const char *, const char *));
 
+/* Backwards compatibility, use rl_bind_keyseq_in_map instead. */
+extern int rl_set_key PARAMS((const char *, rl_command_func_t *, Keymap));
+
 /* Backwards compatibility, use rl_generic_bind instead. */
 extern int rl_macro_bind PARAMS((const char *, const char *, Keymap));
 
@@ -358,7 +375,7 @@ extern int rl_clear_message PARAMS((void));
 extern int rl_reset_line_state PARAMS((void));
 extern int rl_crlf PARAMS((void));
 
-#if (defined (__STDC__) || defined (__cplusplus)) && defined (USE_VARARGS) && defined (PREFER_STDARG)
+#if defined (USE_VARARGS) && defined (PREFER_STDARG)
 extern int rl_message (const char *, ...)  __attribute__((__format__ (printf, 1, 2)));
 #else
 extern int rl_message ();
@@ -384,11 +401,13 @@ extern char *rl_copy_text PARAMS((int, int));
 extern void rl_prep_terminal PARAMS((int));
 extern void rl_deprep_terminal PARAMS((void));
 extern void rl_tty_set_default_bindings PARAMS((Keymap));
+extern void rl_tty_unset_default_bindings PARAMS((Keymap));
 
 extern int rl_reset_terminal PARAMS((const char *));
 extern void rl_resize_terminal PARAMS((void));
 extern void rl_set_screen_size PARAMS((int, int));
 extern void rl_get_screen_size PARAMS((int *, int *));
+extern void rl_reset_screen_size PARAMS((void));
 
 extern char *rl_get_termcap PARAMS((const char *));
 
@@ -404,6 +423,7 @@ extern int rl_set_keyboard_input_timeout PARAMS((int));
 extern void rl_extend_line_buffer PARAMS((int));
 extern int rl_ding PARAMS((void));
 extern int rl_alphabetic PARAMS((int));
+extern void rl_free PARAMS((void *));
 
 /* Readline signal handling, from signals.c */
 extern int rl_set_signals PARAMS((void));
@@ -411,7 +431,9 @@ extern int rl_clear_signals PARAMS((void));
 extern void rl_cleanup_after_signal PARAMS((void));
 extern void rl_reset_after_signal PARAMS((void));
 extern void rl_free_line_state PARAMS((void));
+
+extern void rl_echo_signal_char PARAMS((int)); 
+
 extern int rl_set_paren_blink_timeout PARAMS((int));
 
 /* Undocumented. */
@@ -477,6 +499,10 @@ extern const char *rl_readline_name;
    readline (), and should not be assigned to directly. */
 extern char *rl_prompt;
 
+/* The prompt string that is actually displayed by rl_redisplay.  Public so
+   applications can more easily supply their own redisplay functions. */
+extern char *rl_display_prompt;
+
 /* The line buffer that is in use. */
 extern char *rl_line_buffer;
 
@@ -516,6 +542,11 @@ extern const char *rl_terminal_name;
 extern FILE *rl_instream;
 extern FILE *rl_outstream;
 
+/* If non-zero, Readline gives values of LINES and COLUMNS from the environment
+   greater precedence than values fetched from the kernel when computing the
+   screen dimensions. */
+extern int rl_prefer_env_winsize;
+
 /* If non-zero, then this is the address of a function to call just
    before readline_internal () prints the first prompt. */
 extern rl_hook_func_t *rl_startup_hook;
@@ -578,6 +609,10 @@ extern int rl_catch_sigwinch;
    filename completer. */
 extern rl_compentry_func_t *rl_completion_entry_function;
 
+/* Optional generator for menu completion.  Default is
+   rl_completion_entry_function (rl_filename_completion_function). */
+ extern rl_compentry_func_t *rl_menu_completion_entry_function;
+
 /* If rl_ignore_some_completions_function is non-NULL it is the address
    of a function to call after all of the possible matches have been
    generated, but before the actual completion is done to the input line.
@@ -603,7 +638,12 @@ extern const char *rl_basic_word_break_characters;
 /* The list of characters that signal a break between words for
    rl_complete_internal.  The default list is the contents of
    rl_basic_word_break_characters.  */
-extern const char *rl_completer_word_break_characters;
+extern /*const*/ char *rl_completer_word_break_characters;
+
+/* Hook function to allow an application to set the completion word
+   break characters before readline breaks up the line.  Allows
+   position-dependent word break characters. */
+extern rl_cpvfunc_t *rl_completion_word_break_hook;
 
 /* List of characters which can be used to quote a substring of the line.
    Completion occurs on the entire substring, and within the substring   
@@ -626,18 +666,37 @@ extern const char *rl_special_prefixes;
    completing on a directory name.  The function is called with
    the address of a string (the current directory name) as an arg.  It
    changes what is displayed when the possible completions are printed
-   or inserted. */
+   or inserted.  The directory completion hook should perform
+   any necessary dequoting.  This function should return 1 if it modifies
+   the directory name pointer passed as an argument.  If the directory
+   completion hook returns 0, it should not modify the directory name
+   pointer passed as an argument. */
 extern rl_icppfunc_t *rl_directory_completion_hook;
 
 /* If non-zero, this is the address of a function to call when completing
    a directory name.  This function takes the address of the directory name
    to be modified as an argument.  Unlike rl_directory_completion_hook, it
    only modifies the directory name used in opendir(2), not what is displayed
-   when the possible completions are printed or inserted.  It is called
-   before rl_directory_completion_hook.  I'm not happy with how this works
-   yet, so it's undocumented. */
+   when the possible completions are printed or inserted.  If set, it takes
+   precedence over rl_directory_completion_hook.  The directory rewrite
+   hook should perform any necessary dequoting.  This function has the same
+   return value properties as the directory_completion_hook.
+
+   I'm not happy with how this works yet, so it's undocumented.  I'm trying
+   it in bash to see how well it goes. */
 extern rl_icppfunc_t *rl_directory_rewrite_hook;
 
+/* If non-zero, this is the address of a function to call when reading
+   directory entries from the filesystem for completion and comparing
+   them to the partial word to be completed.  The function should
+   either return its first argument (if no conversion takes place) or
+   newly-allocated memory.  This can, for instance, convert filenames
+   between character sets for comparison against what's typed at the
+   keyboard.  The returned value is what is added to the list of
+   matches.  The second argument is the length of the filename to be
+   converted. */
+extern rl_dequote_func_t *rl_filename_rewrite_hook;
+
 /* Backwards compatibility with previous versions of readline. */
 #define rl_symbolic_link_hook rl_directory_completion_hook
 
@@ -687,6 +746,14 @@ extern int rl_attempted_completion_over;
    functions. */
 extern int rl_completion_type;
 
+/* Set to the last key used to invoke one of the completion functions */
+extern int rl_completion_invoking_key;
+
+/* Up to this many items will be displayed in response to a
+   possible-completions call.  After that, we ask the user if she
+   is sure she wants to see them all.  The default value is 100. */
+extern int rl_completion_query_items;
+
 /* Character appended to completed words when at the end of the line.  The
    default is a space.  Nothing is added if this is '\0'. */
 extern int rl_completion_append_character;
@@ -695,10 +762,21 @@ extern int rl_completion_append_character;
    rl_completion_append_character will not be appended. */
 extern int rl_completion_suppress_append;
 
-/* Up to this many items will be displayed in response to a
-   possible-completions call.  After that, we ask the user if she
-   is sure she wants to see them all.  The default value is 100. */
-extern int rl_completion_query_items;
+/* Set to any quote character readline thinks it finds before any application
+   completion function is called. */
+extern int rl_completion_quote_character;
+
+/* Set to a non-zero value if readline found quoting anywhere in the word to
+   be completed; set before any application completion function is called. */
+extern int rl_completion_found_quote;
+
+/* If non-zero, the completion functions don't append any closing quote.
+   This is set to 0 by rl_complete_internal and may be changed by an
+   application-specific completion function. */
+extern int rl_completion_suppress_quote;
+
+/* If non-zero, readline will sort the completion matches.  On by default. */
+extern int rl_sort_completion_matches;
 
 /* If non-zero, a slash will be appended to completed filenames that are
    symbolic links to directory names, subject to the value of the
@@ -718,6 +796,10 @@ extern int rl_ignore_completion_duplicates;
    completion character will be inserted as any other. */
 extern int rl_inhibit_completion;
 
+/* Input error; can be returned by (*rl_getc_function) if readline is reading
+   a top-level command (RL_ISSTATE (RL_STATE_READCMD)). */
+#define READERR                        (-2)
+
 /* Definitions available for use by readline clients. */
 #define RL_PROMPT_START_IGNORE '\001'
 #define RL_PROMPT_END_IGNORE   '\002'
@@ -729,28 +811,34 @@ extern int rl_inhibit_completion;
 #define MULT_MATCH      2
 
 /* Possible state values for rl_readline_state */
-#define RL_STATE_NONE          0x00000         /* no state; before first call */
-
-#define RL_STATE_INITIALIZING  0x00001         /* initializing */
-#define RL_STATE_INITIALIZED   0x00002         /* initialization done */
-#define RL_STATE_TERMPREPPED   0x00004         /* terminal is prepped */
-#define RL_STATE_READCMD       0x00008         /* reading a command key */
-#define RL_STATE_METANEXT      0x00010         /* reading input after ESC */
-#define RL_STATE_DISPATCHING   0x00020         /* dispatching to a command */
-#define RL_STATE_MOREINPUT     0x00040         /* reading more input in a command function */
-#define RL_STATE_ISEARCH       0x00080         /* doing incremental search */
-#define RL_STATE_NSEARCH       0x00100         /* doing non-inc search */
-#define RL_STATE_SEARCH                0x00200         /* doing a history search */
-#define RL_STATE_NUMERICARG    0x00400         /* reading numeric argument */
-#define RL_STATE_MACROINPUT    0x00800         /* getting input from a macro */
-#define RL_STATE_MACRODEF      0x01000         /* defining keyboard macro */
-#define RL_STATE_OVERWRITE     0x02000         /* overwrite mode */
-#define RL_STATE_COMPLETING    0x04000         /* doing completion */
-#define RL_STATE_SIGHANDLER    0x08000         /* in readline sighandler */
-#define RL_STATE_UNDOING       0x10000         /* doing an undo */
-#define RL_STATE_INPUTPENDING  0x20000         /* rl_execute_next called */
-
-#define RL_STATE_DONE          0x80000         /* done; accepted line */
+#define RL_STATE_NONE          0x000000                /* no state; before first call */
+
+#define RL_STATE_INITIALIZING  0x0000001       /* initializing */
+#define RL_STATE_INITIALIZED   0x0000002       /* initialization done */
+#define RL_STATE_TERMPREPPED   0x0000004       /* terminal is prepped */
+#define RL_STATE_READCMD       0x0000008       /* reading a command key */
+#define RL_STATE_METANEXT      0x0000010       /* reading input after ESC */
+#define RL_STATE_DISPATCHING   0x0000020       /* dispatching to a command */
+#define RL_STATE_MOREINPUT     0x0000040       /* reading more input in a command function */
+#define RL_STATE_ISEARCH       0x0000080       /* doing incremental search */
+#define RL_STATE_NSEARCH       0x0000100       /* doing non-inc search */
+#define RL_STATE_SEARCH                0x0000200       /* doing a history search */
+#define RL_STATE_NUMERICARG    0x0000400       /* reading numeric argument */
+#define RL_STATE_MACROINPUT    0x0000800       /* getting input from a macro */
+#define RL_STATE_MACRODEF      0x0001000       /* defining keyboard macro */
+#define RL_STATE_OVERWRITE     0x0002000       /* overwrite mode */
+#define RL_STATE_COMPLETING    0x0004000       /* doing completion */
+#define RL_STATE_SIGHANDLER    0x0008000       /* in readline sighandler */
+#define RL_STATE_UNDOING       0x0010000       /* doing an undo */
+#define RL_STATE_INPUTPENDING  0x0020000       /* rl_execute_next called */
+#define RL_STATE_TTYCSAVED     0x0040000       /* tty special chars saved */
+#define RL_STATE_CALLBACK      0x0080000       /* using the callback interface */
+#define RL_STATE_VIMOTION      0x0100000       /* reading vi motion arg */
+#define RL_STATE_MULTIKEY      0x0200000       /* reading multiple-key command */
+#define RL_STATE_VICMDONCE     0x0400000       /* entered vi command mode at least once */
+#define RL_STATE_REDISPLAYING  0x0800000       /* updating terminal display */
+
+#define RL_STATE_DONE          0x1000000       /* done; accepted line */
 
 #define RL_SETSTATE(x)         (rl_readline_state |= (x))
 #define RL_UNSETSTATE(x)       (rl_readline_state &= ~(x))
@@ -785,6 +873,12 @@ struct readline_state {
   int catchsigs;
   int catchsigwinch;
 
+  /* search state */
+
+  /* completion state */
+
+  /* options state */
+
   /* reserved for future expansion, so the struct size doesn't change */
   char reserved[64];
 };