2 * Copyright (c) 1997 The NetBSD Foundation, Inc.
5 * This code is derived from software contributed to The NetBSD Foundation
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
11 * 1. Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
18 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
21 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 * POSSIBILITY OF SUCH DAMAGE.
29 * $NetBSD: readline.h,v 1.23 2008/04/29 06:53:01 martin Exp $
30 * $DragonFly: src/lib/libedit/readline/readline.h,v 1.4 2008/05/17 22:48:04 pavalos Exp $
35 #include <sys/types.h>
37 /* list of readline stuff supported by editline library's readline wrapper */
40 typedef int Function(const char *, int);
41 typedef void VFunction(void);
42 typedef void VCPFunction(char *);
43 typedef char *CPFunction(const char *, int);
44 typedef char **CPPFunction(const char *, int, int);
45 typedef char *rl_compentry_func_t(const char *, int);
47 typedef struct _hist_entry
{
52 typedef struct _keymap_entry
{
60 #define KEYMAP_SIZE 256
62 typedef KEYMAP_ENTRY KEYMAP_ENTRY_ARRAY
[KEYMAP_SIZE
];
63 typedef KEYMAP_ENTRY
*Keymap
;
65 #define control_character_threshold 0x20
66 #define control_character_bit 0x40
69 #include <sys/ioctl.h>
70 #if !defined(__sun__) && !defined(__hpux__)
71 #include <sys/ttydefaults.h>
74 #define CTRL(c) ((c) & 037)
78 #define UNCTRL(c) (((c) - 'a' + 'A')|control_character_bit)
82 #define ABORT_CHAR CTRL('G')
84 /* global variables used by readline enabled applications */
88 extern const char *rl_library_version
;
89 extern char *rl_readline_name
;
90 extern FILE *rl_instream
;
91 extern FILE *rl_outstream
;
92 extern char *rl_line_buffer
;
93 extern int rl_point
, rl_end
;
94 extern int history_base
, history_length
;
95 extern int max_input_history
;
96 extern char *rl_basic_word_break_characters
;
97 extern char *rl_completer_word_break_characters
;
98 extern char *rl_completer_quote_characters
;
99 extern Function
*rl_completion_entry_function
;
100 extern CPPFunction
*rl_attempted_completion_function
;
101 extern int rl_attempted_completion_over
;
102 extern int rl_completion_type
;
103 extern int rl_completion_query_items
;
104 extern char *rl_special_prefixes
;
105 extern int rl_completion_append_character
;
106 extern int rl_inhibit_completion
;
107 extern Function
*rl_pre_input_hook
;
108 extern Function
*rl_startup_hook
;
109 extern char *rl_terminal_name
;
110 extern int rl_already_prompted
;
111 extern char *rl_prompt
;
113 * The following is not implemented
115 extern KEYMAP_ENTRY_ARRAY emacs_standard_keymap
,
118 extern int rl_filename_completion_desired
;
119 extern int rl_ignore_completion_duplicates
;
120 extern int (*rl_getc_function
)(FILE *);
121 extern VFunction
*rl_redisplay_function
;
122 extern VFunction
*rl_completion_display_matches_hook
;
123 extern VFunction
*rl_prep_term_function
;
124 extern VFunction
*rl_deprep_term_function
;
125 extern int readline_echoing_p
;
126 extern int _rl_print_completions_horizontally
;
128 /* supported functions */
129 char *readline(const char *);
130 int rl_initialize(void);
132 void using_history(void);
133 int add_history(const char *);
134 void clear_history(void);
135 void stifle_history(int);
136 int unstifle_history(void);
137 int history_is_stifled(void);
138 int where_history(void);
139 HIST_ENTRY
*current_history(void);
140 HIST_ENTRY
*history_get(int);
141 HIST_ENTRY
*remove_history(int);
142 int history_total_bytes(void);
143 int history_set_pos(int);
144 HIST_ENTRY
*previous_history(void);
145 HIST_ENTRY
*next_history(void);
146 int history_search(const char *, int);
147 int history_search_prefix(const char *, int);
148 int history_search_pos(const char *, int, int);
149 int read_history(const char *);
150 int write_history(const char *);
151 int history_expand(char *, char **);
152 char **history_tokenize(const char *);
153 const char *get_history_event(const char *, int *, int);
154 char *history_arg_extract(int, int, const char *);
156 char *tilde_expand(char *);
157 char *filename_completion_function(const char *, int);
158 char *username_completion_function(const char *, int);
159 int rl_complete(int, int);
160 int rl_read_key(void);
161 char **completion_matches(const char *, CPFunction
*);
162 void rl_display_match_list(char **, int, int);
164 int rl_insert(int, int);
165 void rl_reset_terminal(const char *);
166 int rl_bind_key(int, int (*)(int, int));
167 int rl_newline(int, int);
168 void rl_callback_read_char(void);
169 void rl_callback_handler_install(const char *, VCPFunction
*);
170 void rl_callback_handler_remove(void);
171 void rl_redisplay(void);
172 int rl_get_previous_history(int, int);
173 void rl_prep_terminal(int);
174 void rl_deprep_terminal(void);
175 int rl_read_init_file(const char *);
176 int rl_parse_and_bind(const char *);
177 int rl_variable_bind(const char *, const char *);
178 void rl_stuff_char(int);
179 int rl_add_defun(const char *, Function
*, int);
180 void rl_get_screen_size(int *, int *);
181 void rl_set_screen_size(int, int);
182 char *rl_filename_completion_function (const char *, int);
183 int _rl_abort_internal(void);
184 int _rl_qsort_string_compare(char **, char **);
185 char **rl_completion_matches(const char *, rl_compentry_func_t
*);
186 void rl_forced_update_display(void);
189 * The following are not implemented
191 int rl_kill_text(int, int);
192 Keymap
rl_get_keymap(void);
193 void rl_set_keymap(Keymap
);
194 Keymap
rl_make_bare_keymap(void);
195 int rl_generic_bind(int, const char *, const char *, Keymap
);
196 int rl_bind_key_in_map(int, Function
*, Keymap
);
201 #endif /* _READLINE_H_ */