root/src/noitedit/readline/readline.h

Revision bafab25395cb398ddf5eae42145f0d0bfc00ec22, 4.8 kB (checked in by Theo Schlossnagle <jesus@omniti.com>, 7 years ago)

import of libedit... prepare to hack

  • Property mode set to 100644
Line 
1 /*      $NetBSD: readline.h,v 1.1 2001/01/05 21:15:50 jdolecek 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  * 3. All advertising materials mentioning features or use of this software
19  *    must display the following acknowledgement:
20  *      This product includes software developed by the NetBSD
21  *      Foundation, Inc. and its contributors.
22  * 4. Neither the name of The NetBSD Foundation nor the names of its
23  *    contributors may be used to endorse or promote products derived
24  *    from this software without specific prior written permission.
25  *
26  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36  * POSSIBILITY OF SUCH DAMAGE.
37  */
38 #ifndef _READLINE_H_
39 #define _READLINE_H_
40
41 #include <sys/types.h>
42 #if HAVE_SYS_CDEFS_H
43 #include <sys/cdefs.h>
44 #else
45 #ifndef __BEGIN_DECLS
46 #if defined(__cplusplus)
47 #define __BEGIN_DECLS   extern "C" {
48 #define __END_DECLS     }
49 #else
50 #define __BEGIN_DECLS
51 #define __END_DECLS
52 #endif
53 #endif
54 #endif
55
56 /* list of readline stuff supported by editline library's readline wrapper */
57
58 /* typedefs */
59 typedef int       Function(const char *, int);
60 typedef void      VFunction(void);
61 typedef char     *CPFunction(const char *, int);
62 typedef char    **CPPFunction(const char *, int, int);
63
64 typedef struct _hist_entry {
65         const char      *line;
66         const char      *data;
67 } HIST_ENTRY;
68
69 /* global variables used by readline enabled applications */
70 __BEGIN_DECLS
71 extern const char       *rl_library_version;
72 extern char             *rl_readline_name;
73 extern FILE             *rl_instream;
74 extern FILE             *rl_outstream;
75 extern char             *rl_line_buffer;
76 extern int               rl_point, rl_end;
77 extern int               history_base, history_length;
78 extern int               max_input_history;
79 extern char             *rl_basic_word_break_characters;
80 extern char             *rl_completer_word_break_characters;
81 extern char             *rl_completer_quote_characters;
82 extern CPFunction       *rl_completion_entry_function;
83 extern CPPFunction      *rl_attempted_completion_function;
84 extern int              rl_completion_type;
85 extern int              rl_completion_query_items;
86 extern char             *rl_special_prefixes;
87 extern int              rl_completion_append_character;
88
89 /* supported functions */
90 char            *readline(const char *);
91 int              rl_initialize(void);
92
93 void             using_history(void);
94 int              add_history(const char *);
95 void             clear_history(void);
96 void             stifle_history(int);
97 int              unstifle_history(void);
98 int              history_is_stifled(void);
99 int              where_history(void);
100 HIST_ENTRY      *current_history(void);
101 HIST_ENTRY      *history_get(int);
102 int              history_total_bytes(void);
103 int              history_set_pos(int);
104 HIST_ENTRY      *previous_history(void);
105 HIST_ENTRY      *next_history(void);
106 int              history_search(const char *, int);
107 int              history_search_prefix(const char *, int);
108 int              history_search_pos(const char *, int, int);
109 int              read_history(const char *);
110 int              write_history(const char *);
111 int              history_expand(char *, char **);
112 char           **history_tokenize(const char *);
113
114 char            *tilde_expand(char *);
115 char            *filename_completion_function(const char *, int);
116 char            *username_completion_function(const char *, int);
117 int              rl_complete(int, int);
118 int              rl_read_key(void);
119 char           **completion_matches(const char *, CPFunction *);
120 void             rl_display_match_list(char **, int, int);
121
122 int              rl_insert(int, int);
123 void             rl_reset_terminal(const char *);
124 int              rl_bind_key(int, int (*)(int, int));
125
126 /* Message Systems extensions */
127 typedef void (*ec_rl_line_consumer_func)(const char *line);
128 int ec_rl_setup_event_driven_mode(const char *prompt, ec_rl_line_consumer_func consumer);
129 int ec_rl_input_is_ready_to_read(void);
130 int ec_rl_finish_event_driven_mode(void);
131
132 __END_DECLS
133
134 #if _WIN32
135 # include "tty_win32.h"
136 #endif
137
138 #endif /* _READLINE_H_ */
Note: See TracBrowser for help on using the browser.