Start flushing out the IPI routines and do some clean-up.
[dragonfly/vkernel-mp.git] / lib / libedit / readline / readline.h
blob440b73c68d53b926d49fa0fb5bfccf330a93bb46
1 /*-
2 * Copyright (c) 1997 The NetBSD Foundation, Inc.
3 * All rights reserved.
5 * This code is derived from software contributed to The NetBSD Foundation
6 * by Jaromir Dolecek.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
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.
16 * 3. Neither the name of The NetBSD Foundation nor the names of its
17 * contributors may be used to endorse or promote products derived
18 * from this software without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
32 * $NetBSD: readline.h,v 1.19 2006/11/24 00:01:17 christos Exp $
33 * $DragonFly: src/lib/libedit/readline/readline.h,v 1.2 2007/05/05 00:27:40 pavalos Exp $
35 #ifndef _READLINE_H_
36 #define _READLINE_H_
38 #include <sys/types.h>
40 /* list of readline stuff supported by editline library's readline wrapper */
42 /* typedefs */
43 typedef int Function(const char *, int);
44 typedef void VFunction(void);
45 typedef void VCPFunction(char *);
46 typedef char *CPFunction(const char *, int);
47 typedef char **CPPFunction(const char *, int, int);
49 typedef struct _hist_entry {
50 const char *line;
51 const char *data;
52 } HIST_ENTRY;
54 typedef struct _keymap_entry {
55 char type;
56 #define ISFUNC 0
57 #define ISKMAP 1
58 #define ISMACR 2
59 Function *function;
60 } KEYMAP_ENTRY;
62 #define KEYMAP_SIZE 256
64 typedef KEYMAP_ENTRY KEYMAP_ENTRY_ARRAY[KEYMAP_SIZE];
65 typedef KEYMAP_ENTRY *Keymap;
67 #define control_character_threshold 0x20
68 #define control_character_bit 0x40
70 #ifndef CTRL
71 #include <sys/ioctl.h>
72 #if !defined(__sun__) && !defined(__hpux__)
73 #include <sys/ttydefaults.h>
74 #endif
75 #ifndef CTRL
76 #define CTRL(c) ((c) & 037)
77 #endif
78 #endif
79 #ifndef UNCTRL
80 #define UNCTRL(c) (((c) - 'a' + 'A')|control_character_bit)
81 #endif
83 #define RUBOUT 0x7f
84 #define ABORT_CHAR CTRL('G')
86 /* global variables used by readline enabled applications */
87 #ifdef __cplusplus
88 extern "C" {
89 #endif
90 extern const char *rl_library_version;
91 extern char *rl_readline_name;
92 extern FILE *rl_instream;
93 extern FILE *rl_outstream;
94 extern char *rl_line_buffer;
95 extern int rl_point, rl_end;
96 extern int history_base, history_length;
97 extern int max_input_history;
98 extern char *rl_basic_word_break_characters;
99 extern char *rl_completer_word_break_characters;
100 extern char *rl_completer_quote_characters;
101 extern Function *rl_completion_entry_function;
102 extern CPPFunction *rl_attempted_completion_function;
103 extern int rl_attempted_completion_over;
104 extern int rl_completion_type;
105 extern int rl_completion_query_items;
106 extern char *rl_special_prefixes;
107 extern int rl_completion_append_character;
108 extern int rl_inhibit_completion;
109 extern Function *rl_pre_input_hook;
110 extern Function *rl_startup_hook;
111 extern char *rl_terminal_name;
112 extern int rl_already_prompted;
113 extern char *rl_prompt;
115 * The following is not implemented
117 extern KEYMAP_ENTRY_ARRAY emacs_standard_keymap,
118 emacs_meta_keymap,
119 emacs_ctlx_keymap;
120 extern int rl_filename_completion_desired;
121 extern int rl_ignore_completion_duplicates;
122 extern Function *rl_getc_function;
123 extern VFunction *rl_redisplay_function;
124 extern VFunction *rl_completion_display_matches_hook;
125 extern VFunction *rl_prep_term_function;
126 extern VFunction *rl_deprep_term_function;
127 extern int readline_echoing_p;
128 extern int _rl_print_completions_horizontally;
130 /* supported functions */
131 char *readline(const char *);
132 int rl_initialize(void);
134 void using_history(void);
135 int add_history(const char *);
136 void clear_history(void);
137 void stifle_history(int);
138 int unstifle_history(void);
139 int history_is_stifled(void);
140 int where_history(void);
141 HIST_ENTRY *current_history(void);
142 HIST_ENTRY *history_get(int);
143 HIST_ENTRY *remove_history(int);
144 int history_total_bytes(void);
145 int history_set_pos(int);
146 HIST_ENTRY *previous_history(void);
147 HIST_ENTRY *next_history(void);
148 int history_search(const char *, int);
149 int history_search_prefix(const char *, int);
150 int history_search_pos(const char *, int, int);
151 int read_history(const char *);
152 int write_history(const char *);
153 int history_expand(char *, char **);
154 char **history_tokenize(const char *);
155 const char *get_history_event(const char *, int *, int);
156 char *history_arg_extract(int, int, const char *);
158 char *tilde_expand(char *);
159 char *filename_completion_function(const char *, int);
160 char *username_completion_function(const char *, int);
161 int rl_complete(int, int);
162 int rl_read_key(void);
163 char **completion_matches(const char *, CPFunction *);
164 void rl_display_match_list(char **, int, int);
166 int rl_insert(int, int);
167 void rl_reset_terminal(const char *);
168 int rl_bind_key(int, int (*)(int, int));
169 int rl_newline(int, int);
170 void rl_callback_read_char(void);
171 void rl_callback_handler_install(const char *, VCPFunction *);
172 void rl_callback_handler_remove(void);
173 void rl_redisplay(void);
174 int rl_get_previous_history(int, int);
175 void rl_prep_terminal(int);
176 void rl_deprep_terminal(void);
177 int rl_read_init_file(const char *);
178 int rl_parse_and_bind(const char *);
179 int rl_variable_bind(const char *, const char *);
180 void rl_stuff_char(int);
181 int rl_add_defun(const char *, Function *, int);
182 void rl_get_screen_size(int *, int *);
183 void rl_set_screen_size(int, int);
184 char *rl_filename_completion_function (const char *, int);
185 int _rl_abort_internal(void);
186 int _rl_qsort_string_compare(char **, char **);
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);
197 #ifdef __cplusplus
199 #endif
201 #endif /* _READLINE_H_ */