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