source: heimdal/trunk/lib/libedit/src/editline/readline.h

Last change on this file was 1, checked in by Paul Smedley, 10 years ago

Initial commit of Heimdal 1.5.3

File size: 7.2 KB
Line 
1/* $NetBSD: readline.h,v 1.32 2010/09/16 20:08:52 christos Exp $ */
2
3/*-
4 * Copyright (c) 1997 The NetBSD Foundation, Inc.
5 * All rights reserved.
6 *
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jaromir Dolecek.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
12 * are met:
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31#ifndef _READLINE_H_
32#define _READLINE_H_
33
34#include <sys/types.h>
35#include <stdio.h>
36
37/* list of readline stuff supported by editline library's readline wrapper */
38
39/* typedefs */
40typedef int Function(const char *, int);
41typedef void VFunction(void);
42typedef void VCPFunction(char *);
43typedef char *CPFunction(const char *, int);
44typedef char **CPPFunction(const char *, int, int);
45typedef char *rl_compentry_func_t(const char *, int);
46typedef int rl_command_func_t(int, int);
47
48/* only supports length */
49typedef struct {
50 int length;
51} HISTORY_STATE;
52
53typedef void *histdata_t;
54
55typedef struct _hist_entry {
56 const char *line;
57 histdata_t data;
58} HIST_ENTRY;
59
60typedef struct _keymap_entry {
61 char type;
62#define ISFUNC 0
63#define ISKMAP 1
64#define ISMACR 2
65 Function *function;
66} KEYMAP_ENTRY;
67
68#define KEYMAP_SIZE 256
69
70typedef KEYMAP_ENTRY KEYMAP_ENTRY_ARRAY[KEYMAP_SIZE];
71typedef KEYMAP_ENTRY *Keymap;
72
73#define control_character_threshold 0x20
74#define control_character_bit 0x40
75
76#ifndef CTRL
77#include <sys/ioctl.h>
78#if !defined(__sun) && !defined(__hpux) && !defined(_AIX)
79#include <sys/ttydefaults.h>
80#endif
81#ifndef CTRL
82#define CTRL(c) ((c) & 037)
83#endif
84#endif
85#ifndef UNCTRL
86#define UNCTRL(c) (((c) - 'a' + 'A')|control_character_bit)
87#endif
88
89#define RUBOUT 0x7f
90#define ABORT_CHAR CTRL('G')
91#define RL_READLINE_VERSION 0x0402
92#define RL_PROMPT_START_IGNORE '\1'
93#define RL_PROMPT_END_IGNORE '\2'
94
95/* global variables used by readline enabled applications */
96#ifdef __cplusplus
97extern "C" {
98#endif
99extern const char *rl_library_version;
100extern int rl_readline_version;
101extern char *rl_readline_name;
102extern FILE *rl_instream;
103extern FILE *rl_outstream;
104extern char *rl_line_buffer;
105extern int rl_point, rl_end;
106extern int history_base, history_length;
107extern int max_input_history;
108extern char *rl_basic_word_break_characters;
109extern char *rl_completer_word_break_characters;
110extern char *rl_completer_quote_characters;
111extern Function *rl_completion_entry_function;
112extern CPPFunction *rl_attempted_completion_function;
113extern int rl_attempted_completion_over;
114extern int rl_completion_type;
115extern int rl_completion_query_items;
116extern char *rl_special_prefixes;
117extern int rl_completion_append_character;
118extern int rl_inhibit_completion;
119extern Function *rl_pre_input_hook;
120extern Function *rl_startup_hook;
121extern char *rl_terminal_name;
122extern int rl_already_prompted;
123extern char *rl_prompt;
124/*
125 * The following is not implemented
126 */
127extern KEYMAP_ENTRY_ARRAY emacs_standard_keymap,
128 emacs_meta_keymap,
129 emacs_ctlx_keymap;
130extern int rl_filename_completion_desired;
131extern int rl_ignore_completion_duplicates;
132extern int (*rl_getc_function)(FILE *);
133extern VFunction *rl_redisplay_function;
134extern VFunction *rl_completion_display_matches_hook;
135extern VFunction *rl_prep_term_function;
136extern VFunction *rl_deprep_term_function;
137extern int readline_echoing_p;
138extern int _rl_print_completions_horizontally;
139
140/* supported functions */
141char *readline(const char *);
142int rl_initialize(void);
143
144void using_history(void);
145int add_history(const char *);
146void clear_history(void);
147void stifle_history(int);
148int unstifle_history(void);
149int history_is_stifled(void);
150int where_history(void);
151HIST_ENTRY *current_history(void);
152HIST_ENTRY *history_get(int);
153HIST_ENTRY *remove_history(int);
154HIST_ENTRY *replace_history_entry(int, const char *, histdata_t);
155int history_total_bytes(void);
156int history_set_pos(int);
157HIST_ENTRY *previous_history(void);
158HIST_ENTRY *next_history(void);
159int history_search(const char *, int);
160int history_search_prefix(const char *, int);
161int history_search_pos(const char *, int, int);
162int read_history(const char *);
163int write_history(const char *);
164int history_truncate_file (const char *, int);
165int history_expand(char *, char **);
166char **history_tokenize(const char *);
167const char *get_history_event(const char *, int *, int);
168char *history_arg_extract(int, int, const char *);
169
170char *tilde_expand(char *);
171char *filename_completion_function(const char *, int);
172char *username_completion_function(const char *, int);
173int rl_complete(int, int);
174int rl_read_key(void);
175char **completion_matches(const char *, CPFunction *);
176void rl_display_match_list(char **, int, int);
177
178int rl_insert(int, int);
179int rl_insert_text(const char *);
180void rl_reset_terminal(const char *);
181int rl_bind_key(int, rl_command_func_t *);
182int rl_newline(int, int);
183void rl_callback_read_char(void);
184void rl_callback_handler_install(const char *, VCPFunction *);
185void rl_callback_handler_remove(void);
186void rl_redisplay(void);
187int rl_get_previous_history(int, int);
188void rl_prep_terminal(int);
189void rl_deprep_terminal(void);
190int rl_read_init_file(const char *);
191int rl_parse_and_bind(const char *);
192int rl_variable_bind(const char *, const char *);
193void rl_stuff_char(int);
194int rl_add_defun(const char *, Function *, int);
195HISTORY_STATE *history_get_history_state(void);
196void rl_get_screen_size(int *, int *);
197void rl_set_screen_size(int, int);
198char *rl_filename_completion_function (const char *, int);
199int _rl_abort_internal(void);
200int _rl_qsort_string_compare(char **, char **);
201char **rl_completion_matches(const char *, rl_compentry_func_t *);
202void rl_forced_update_display(void);
203int rl_set_prompt(const char *);
204int rl_on_new_line(void);
205
206/*
207 * The following are not implemented
208 */
209int rl_kill_text(int, int);
210Keymap rl_get_keymap(void);
211void rl_set_keymap(Keymap);
212Keymap rl_make_bare_keymap(void);
213int rl_generic_bind(int, const char *, const char *, Keymap);
214int rl_bind_key_in_map(int, rl_command_func_t *, Keymap);
215void rl_cleanup_after_signal(void);
216void rl_free_line_state(void);
217#ifdef __cplusplus
218}
219#endif
220
221#endif /* _READLINE_H_ */
Note: See TracBrowser for help on using the repository browser.