"Fossies" - the Fresh Open Source Software Archive

Member "tnftp-20200705/libedit/readline/readline.h" (4 Jul 2020, 8057 Bytes) of package /linux/privat/tnftp-20200705.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "readline.h" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 20151004_vs_20200705.

    1 /*  $NetBSD: readline.h,v 1.7 2020/07/04 13:43:21 lukem Exp $   */
    2 /*  from    NetBSD: readline.h,v 1.46 2019/06/07 15:19:29 christos Exp  */
    3 
    4 /*-
    5  * Copyright (c) 1997 The NetBSD Foundation, Inc.
    6  * All rights reserved.
    7  *
    8  * This code is derived from software contributed to The NetBSD Foundation
    9  * by Jaromir Dolecek.
   10  *
   11  * Redistribution and use in source and binary forms, with or without
   12  * modification, are permitted provided that the following conditions
   13  * are met:
   14  * 1. Redistributions of source code must retain the above copyright
   15  *    notice, this list of conditions and the following disclaimer.
   16  * 2. Redistributions in binary form must reproduce the above copyright
   17  *    notice, this list of conditions and the following disclaimer in the
   18  *    documentation and/or other materials provided with the distribution.
   19  *
   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.
   31  */
   32 #ifndef _READLINE_H_
   33 #define _READLINE_H_
   34 
   35 #if 0 /* tnftp */
   36 #include <sys/types.h>
   37 #include <stdio.h>
   38 #endif /* tnftp */
   39 
   40 /* list of readline stuff supported by editline library's readline wrapper */
   41 
   42 /* typedefs */
   43 typedef int   Function(const char *, int);
   44 typedef char     *CPFunction(const char *, int);
   45 typedef void      VFunction(void);
   46 typedef void      rl_vcpfunc_t(char *);
   47 typedef char    **rl_completion_func_t(const char *, int, int);
   48 typedef char     *rl_compentry_func_t(const char *, int);
   49 typedef int   rl_command_func_t(int, int);
   50 typedef int   rl_hook_func_t(void);
   51 
   52 /* only supports length */
   53 typedef struct {
   54     int length;
   55 } HISTORY_STATE;
   56 
   57 typedef void *histdata_t;
   58 
   59 typedef struct _hist_entry {
   60     const char  *line;
   61     histdata_t   data;
   62 } HIST_ENTRY;
   63 
   64 typedef struct _keymap_entry {
   65     char type;
   66 #define ISFUNC  0
   67 #define ISKMAP  1
   68 #define ISMACR  2
   69     Function *function;
   70 } KEYMAP_ENTRY;
   71 
   72 #define KEYMAP_SIZE 256
   73 
   74 typedef KEYMAP_ENTRY KEYMAP_ENTRY_ARRAY[KEYMAP_SIZE];
   75 typedef KEYMAP_ENTRY *Keymap;
   76 
   77 #define control_character_threshold 0x20
   78 #define control_character_bit       0x40
   79 
   80 #ifndef CTRL
   81 /* XXX: tnftp - may need to move to tnftp.h */
   82 #include <sys/ioctl.h>
   83 #if !defined(__sun) && !defined(__hpux) && !defined(_AIX)
   84 #include <sys/ttydefaults.h>
   85 #endif
   86 #ifndef CTRL
   87 #define CTRL(c)     ((c) & 037)
   88 #endif
   89 #endif
   90 #ifndef UNCTRL
   91 #define UNCTRL(c)   (((c) - 'a' + 'A')|control_character_bit)
   92 #endif
   93 
   94 #define RUBOUT      0x7f
   95 #define ABORT_CHAR  CTRL('G')
   96 #define RL_READLINE_VERSION 0x0402
   97 #define RL_PROMPT_START_IGNORE  '\1'
   98 #define RL_PROMPT_END_IGNORE    '\2'
   99 
  100 /* global variables used by readline enabled applications */
  101 #ifdef __cplusplus
  102 extern "C" {
  103 #endif
  104 extern const char   *rl_library_version;
  105 extern int      rl_readline_version;
  106 extern const char   *rl_readline_name;
  107 extern FILE     *rl_instream;
  108 extern FILE     *rl_outstream;
  109 extern char     *rl_line_buffer;
  110 extern int       rl_point, rl_end;
  111 extern int       history_base, history_length;
  112 extern int       max_input_history;
  113 extern const char   *rl_basic_word_break_characters;
  114 extern char     *rl_completer_word_break_characters;
  115 extern const char   *rl_completer_quote_characters;
  116 extern rl_compentry_func_t *rl_completion_entry_function;
  117 extern char     *(*rl_completion_word_break_hook)(void);
  118 extern rl_completion_func_t *rl_attempted_completion_function;
  119 extern int       rl_attempted_completion_over;
  120 extern int      rl_completion_type;
  121 extern int      rl_completion_query_items;
  122 extern const char   *rl_special_prefixes;
  123 extern int      rl_completion_append_character;
  124 extern int      rl_inhibit_completion;
  125 extern Function     *rl_pre_input_hook;
  126 extern Function     *rl_startup_hook;
  127 extern char     *rl_terminal_name;
  128 extern int      rl_already_prompted;
  129 extern char     *rl_prompt;
  130 extern int      rl_done;
  131 /*
  132  * The following is not implemented
  133  */
  134 extern int      rl_catch_signals;
  135 extern int      rl_catch_sigwinch;
  136 extern KEYMAP_ENTRY_ARRAY emacs_standard_keymap,
  137             emacs_meta_keymap,
  138             emacs_ctlx_keymap;
  139 extern int      rl_filename_completion_desired;
  140 extern int      rl_ignore_completion_duplicates;
  141 extern int      (*rl_getc_function)(FILE *);
  142 extern VFunction    *rl_redisplay_function;
  143 extern VFunction    *rl_completion_display_matches_hook;
  144 extern VFunction    *rl_prep_term_function;
  145 extern VFunction    *rl_deprep_term_function;
  146 extern rl_hook_func_t   *rl_event_hook;
  147 extern int      readline_echoing_p;
  148 extern int      _rl_print_completions_horizontally;
  149 
  150 /* supported functions */
  151 char        *readline(const char *);
  152 int      rl_initialize(void);
  153 
  154 void         using_history(void);
  155 int      add_history(const char *);
  156 void         clear_history(void);
  157 int      append_history(int, const char *);
  158 void         stifle_history(int);
  159 int      unstifle_history(void);
  160 int      history_is_stifled(void);
  161 int      where_history(void);
  162 HIST_ENTRY  *current_history(void);
  163 HIST_ENTRY  *history_get(int);
  164 HIST_ENTRY  *remove_history(int);
  165 HIST_ENTRY  *replace_history_entry(int, const char *, histdata_t);
  166 int      history_total_bytes(void);
  167 int      history_set_pos(int);
  168 HIST_ENTRY  *previous_history(void);
  169 HIST_ENTRY  *next_history(void);
  170 HIST_ENTRY     **history_list(void);
  171 int      history_search(const char *, int);
  172 int      history_search_prefix(const char *, int);
  173 int      history_search_pos(const char *, int, int);
  174 int      read_history(const char *);
  175 int      write_history(const char *);
  176 int      history_truncate_file (const char *, int);
  177 int      history_expand(char *, char **);
  178 char           **history_tokenize(const char *);
  179 const char  *get_history_event(const char *, int *, int);
  180 char        *history_arg_extract(int, int, const char *);
  181 
  182 char        *tilde_expand(char *);
  183 char        *filename_completion_function(const char *, int);
  184 char        *username_completion_function(const char *, int);
  185 int      rl_complete(int, int);
  186 int      rl_read_key(void);
  187 char           **completion_matches(/* const */ char *, rl_compentry_func_t *);
  188 void         rl_display_match_list(char **, int, int);
  189 
  190 int      rl_insert(int, int);
  191 int      rl_insert_text(const char *);
  192 int      rl_reset_terminal(const char *);
  193 void         rl_resize_terminal(void);
  194 int      rl_bind_key(int, rl_command_func_t *);
  195 int      rl_newline(int, int);
  196 void         rl_callback_read_char(void);
  197 void         rl_callback_handler_install(const char *, rl_vcpfunc_t *);
  198 void         rl_callback_handler_remove(void);
  199 void         rl_redisplay(void);
  200 int      rl_get_previous_history(int, int);
  201 void         rl_prep_terminal(int);
  202 void         rl_deprep_terminal(void);
  203 int      rl_read_init_file(const char *);
  204 int      rl_parse_and_bind(const char *);
  205 int      rl_variable_bind(const char *, const char *);
  206 int      rl_stuff_char(int);
  207 int      rl_add_defun(const char *, rl_command_func_t *, int);
  208 HISTORY_STATE   *history_get_history_state(void);
  209 void         rl_get_screen_size(int *, int *);
  210 void         rl_set_screen_size(int, int);
  211 char        *rl_filename_completion_function (const char *, int);
  212 int      _rl_abort_internal(void);
  213 int      _rl_qsort_string_compare(char **, char **);
  214 char           **rl_completion_matches(const char *, rl_compentry_func_t *);
  215 void         rl_forced_update_display(void);
  216 int      rl_set_prompt(const char *);
  217 int      rl_on_new_line(void);
  218 void         rl_reset_after_signal(void);
  219 void         rl_echo_signal_char(int);
  220 
  221 /*
  222  * The following are not implemented
  223  */
  224 int      rl_kill_text(int, int);
  225 Keymap       rl_get_keymap(void);
  226 void         rl_set_keymap(Keymap);
  227 Keymap       rl_make_bare_keymap(void);
  228 int      rl_generic_bind(int, const char *, const char *, Keymap);
  229 int      rl_bind_key_in_map(int, rl_command_func_t *, Keymap);
  230 void         rl_cleanup_after_signal(void);
  231 void         rl_free_line_state(void);
  232 int      rl_set_keyboard_input_timeout(int);
  233 
  234 #ifdef __cplusplus
  235 }
  236 #endif
  237 
  238 #endif /* _READLINE_H_ */