home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / SOURCE / D / CLISP / CLISPSRC.TAR / clisp-1995-01-01 / src / readline / readline.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-03-16  |  13.2 KB  |  325 lines

  1. /* readline.h -- changed by Bruno Haible, 16 March 1993 */
  2.  
  3. /* Readline.h -- the names of functions callable from within readline. */
  4.  
  5. #if !defined (_READLINE_H_)
  6. #define _READLINE_H_
  7.  
  8. #ifndef RL
  9. /* For prototypes:  extern int foo RL((int x, int y)); */
  10. #ifdef __STDC__
  11. #define RL(args) args
  12. #else
  13. #define RL(args) ()
  14. #endif
  15. #endif
  16.  
  17. #include "keymaps.h"
  18.  
  19. #if !defined (__FUNCTION_DEF)
  20. typedef int Function ();
  21. #define __FUNCTION_DEF
  22. #endif /* __FUNCTION_DEF */
  23.  
  24. /* Maintaining the state of undo.  We remember individual deletes and inserts
  25.    on a chain of things to do. */
  26.  
  27. /* The actions that undo knows how to undo.  Notice that UNDO_DELETE means
  28.    to insert some text, and UNDO_INSERT means to delete some text.   I.e.,
  29.    the code tells undo what to undo, not how to undo it. */
  30. enum undo_code { UNDO_DELETE, UNDO_INSERT, UNDO_BEGIN, UNDO_END };
  31.  
  32. /* What an element of THE_UNDO_LIST looks like. */
  33. typedef struct undo_list {
  34.   struct undo_list *next;
  35.   int start, end;        /* Where the change took place. */
  36.   char *text;            /* The text to insert, if undoing a delete. */
  37.   enum undo_code what;        /* Delete, Insert, Begin, End. */
  38. } UNDO_LIST;
  39.  
  40. /* The current undo list for RL_LINE_BUFFER. */
  41. extern UNDO_LIST *rl_undo_list;
  42.  
  43. #include "funmap.h"
  44.  
  45. /* The functions for manipulating the text of the line within readline.
  46. Most of these functions are bound to keys by default. */
  47. extern void rl_digit_argument RL((int ignore, int key));
  48. extern void rl_universal_argument RL((void));
  49. extern int ding RL((void));
  50. extern void rl_abort RL((void));
  51. extern void rl_forward RL((int count));
  52. extern void rl_backward RL((int count));
  53. extern void rl_beg_of_line RL((void));
  54. extern void rl_end_of_line RL((void));
  55. extern void rl_forward_word RL((int count));
  56. extern void rl_backward_word RL((int count));
  57. extern void rl_clear_screen RL((void));
  58. extern void rl_insert RL((int count, int c));
  59. extern void rl_quoted_insert RL((int count));
  60. extern void rl_tab_insert RL((int count));
  61. extern void rl_newline RL((int count, int key));
  62. extern void rl_do_lowercase_version RL((int ignore1, int ignore2));
  63. extern void rl_rubout RL((int count));
  64. extern void rl_delete RL((int count, int invoking_key));
  65. extern void rl_unix_word_rubout RL((void));
  66. extern void rl_unix_line_discard RL((void));
  67. extern void rl_upcase_word RL((int count));
  68. extern void rl_downcase_word RL((int count));
  69. extern void rl_capitalize_word RL((int count));
  70. extern void rl_transpose_words RL((int count));
  71. extern void rl_transpose_chars RL((int count));
  72. extern void rl_restart_output RL((int count, int key));
  73. extern void rl_complete RL((int ignore, int invoking_key));
  74. extern void rl_possible_completions RL((void));
  75. extern void rl_revert_line RL((void));
  76. extern void rl_undo_command RL((int count));
  77. extern void rl_beginning_of_history RL((void));
  78. extern void rl_end_of_history RL((void));
  79. extern void rl_get_next_history RL((int count));
  80. extern void rl_get_previous_history RL((int count));
  81. extern void rl_reverse_search_history RL((int sign, int key));
  82. extern void rl_forward_search_history RL((int sign, int key));
  83. extern void rl_kill_word RL((int count));
  84. extern void rl_backward_kill_word RL((int count));
  85. extern void rl_kill_line RL((int direction));
  86. extern void rl_backward_kill_line RL((int direction));
  87. extern void rl_yank RL((void));
  88. extern void rl_yank_pop RL((void));
  89. extern void rl_yank_nth_arg RL((int count, int ignore));
  90. extern void rl_re_read_init_file RL((int count, int ignore));
  91. extern int rl_dump_functions RL((int count));
  92.  
  93. /* These are *both* defined even when VI_MODE is not. */
  94. extern void rl_vi_editing_mode RL((void));
  95. extern void rl_emacs_editing_mode RL((void));
  96.  
  97. #if defined (VI_MODE)
  98. /* Things for vi mode. See vi_mode.c .*/
  99. extern void rl_vi_yank_arg RL((int count));
  100. extern void rl_vi_fetch_history RL((int count, int c));
  101. extern void rl_vi_search_again RL((int ignore, int key));
  102. extern void rl_vi_search RL((int count, int key));
  103. extern void rl_vi_dosearch RL((char* string, int dir));
  104. extern void rl_vi_complete RL((int ignore, int key));
  105. extern void rl_vi_prev_word RL((int count, int key));
  106. extern void rl_vi_next_word RL((int count, int key));
  107. extern void rl_vi_end_word RL((int count, int key));
  108. extern void rl_vi_fWord RL((int count));
  109. extern void rl_vi_bWord RL((int count));
  110. extern void rl_vi_eWord RL((int count));
  111. extern void rl_vi_fword RL((int count));
  112. extern void rl_vi_bword RL((int count));
  113. extern void rl_vi_eword RL((int count));
  114. extern int rl_vi_insert_beg RL((void));
  115. extern int rl_vi_append_mode RL((void));
  116. extern int rl_vi_append_eol RL((void));
  117. extern void rl_vi_eof_maybe RL((int count, int c));
  118. extern void rl_vi_insertion_mode RL((void));
  119. extern void rl_vi_movement_mode RL((void));
  120. extern void rl_vi_arg_digit RL((int count, int c));
  121. extern void rl_vi_change_case RL((int count, int ignore));
  122. extern void rl_vi_put RL((int count, int key));
  123. extern void rl_vi_check RL((void));
  124. extern void rl_vi_column RL((int count));
  125. extern void rl_vi_delete_to RL((int count, int key));
  126. extern void rl_vi_change_to RL((int count, int key));
  127. extern void rl_vi_yank_to RL((int count, int key));
  128. extern void rl_vi_delete RL((int count));
  129. extern void rl_vi_comment RL((void));
  130. extern void rl_vi_first_print RL((void));
  131. extern void rl_vi_char_search RL((int count, int key));
  132. extern void rl_vi_match RL((void));
  133. extern int rl_vi_bracktype RL((int c));
  134. extern void rl_vi_change_char RL((int count, int key));
  135. extern void rl_vi_subst RL((int count, int key));
  136. extern void rl_vi_overstrike RL((int count, int key));
  137. extern void rl_vi_overstrike_delete RL((int count));
  138. extern void rl_vi_replace RL((int count, int key));
  139. extern int rl_vi_possible_completions RL((void));
  140. #endif /* VI_MODE */
  141.  
  142. /* Keyboard macro commands. */
  143. extern void rl_start_kbd_macro RL((int ignore1, int ignore2));
  144. extern void rl_end_kbd_macro RL((int count, int ignore));
  145. extern void rl_call_last_kbd_macro RL((int count, int ignore));
  146.  
  147. /* Other functions. */
  148. extern char* readline RL((char* prompt));
  149. extern void rl_stuff_char RL((int key));
  150. extern int rl_read_key RL((void));
  151. extern void rl_dispatch RL((int key, Keymap map));
  152. extern void rl_digit_loop RL((void));
  153. extern void rl_redisplay RL((void));
  154. extern void rl_message RL((char* string, int arg1, int arg2));
  155. extern void rl_clear_message RL((void));
  156. extern void rl_prep_terminal RL((void));
  157. extern void rl_deprep_terminal RL((void));
  158. extern int numeric RL((int c));
  159. extern void rl_extend_line_buffer RL((int len));
  160. extern void rl_insert_text RL((char* string));
  161. extern void rl_refresh_line RL((void));
  162. extern void rl_arrow_keys RL((int count, int c));
  163. extern void rl_complete_internal RL((int what_to_do));
  164. extern char* username_completion_function RL((char* text, int state));
  165. extern int rl_do_undo RL((void));
  166. extern void rl_begin_undo_group RL((void));
  167. extern void rl_end_undo_group RL((void));
  168. extern void rl_modifying RL((int start, int end));
  169. extern void maybe_unsave_line RL((void));
  170. extern void maybe_save_line RL((void));
  171. extern void rl_search_history RL((int direction, int invoking_key));
  172. extern void rl_execute_next RL((int c));
  173. extern void rl_kill_text RL((int from, int to));
  174. extern unsigned char ** completion_matches RL((char* text, char* (*entry_function)()));
  175. extern char* filename_completion_function RL((char* text, int state));
  176. extern void rl_add_defun RL((char* name, Function* function, int key));
  177. extern int rl_bind_key RL((int key, Function* function));
  178. extern int rl_bind_key_in_map RL((int key, Function* function, Keymap map));
  179. extern int rl_unbind_key RL((int key));
  180. extern int rl_unbind_key_in_map RL((int key, Keymap map));
  181. extern void rl_generic_bind RL((int type, char* keyseq, void* data, Keymap map));
  182. extern int rl_getc RL((FILE* stream));
  183.  
  184. /* **************************************************************** */
  185. /*                                    */
  186. /*            Well Published Variables            */
  187. /*                                    */
  188. /* **************************************************************** */
  189.  
  190. /* Always true. */
  191. extern int rl_present_p;
  192.  
  193. /* The name of the calling program.  You should initialize this to
  194.    whatever was in argv[0].  It is used when parsing conditionals. */
  195. extern char *rl_readline_name;
  196.  
  197. /* The line buffer that is in use. */
  198. extern unsigned char *rl_line_buffer;
  199.  
  200. /* The location of point, and end. */
  201. extern int rl_point, rl_end;
  202.  
  203. /* The name of the terminal to use. */
  204. extern char *rl_terminal_name;
  205.  
  206. /* The input and output streams. */
  207. extern FILE *rl_instream, *rl_outstream;
  208.  
  209. /* The basic list of characters that signal a break between words for the
  210.    completer routine.  The initial contents of this variable is what
  211.    breaks words in the shell, i.e. "n\"\\'`@$>". */
  212. extern char *rl_basic_word_break_characters;
  213.  
  214. /* The list of characters that signal a break between words for
  215.    rl_complete_internal.  The default list is the contents of
  216.    rl_basic_word_break_characters.  */
  217. extern char *rl_completer_word_break_characters;
  218.  
  219. /* Basic list of quote characters */
  220. extern char *rl_basic_quote_characters;
  221.  
  222. /* List of characters which are used to quote a substring of the command
  223.    line, upon which completion is to be performed for the entire substring.
  224.    Within quoted substrings, rl_completer_word_break_characters are treated
  225.    as normal characters, unless they also appear in this list. */
  226. extern char *rl_completer_quote_characters;
  227.  
  228. /* List of characters that are word break characters, but should be left
  229.    in TEXT when it is passed to the completion function.  The shell uses
  230.    this to help determine what kind of completing to do. */
  231. extern char *rl_special_prefixes;
  232.  
  233. /* Pointer to the generator function for completion_matches ().
  234.    NULL means to use filename_entry_function (), the default filename
  235.    completer. */
  236. extern Function *rl_completion_entry_function;
  237.  
  238. /* If rl_ignore_some_completions_function is non-NULL it is the address
  239.    of a function to call after all of the possible matches have been
  240.    generated, but before the actual completion is done to the input line.
  241.    The function is called with one argument; a NULL terminated array
  242.    of (char *).  If your function removes any of the elements, they
  243.    must be free()'ed. */
  244. extern Function *rl_ignore_some_completions_function;
  245.  
  246. /* Pointer to alternative function to create matches.
  247.    Function is called with TEXT, START, and END.
  248.    START and END are indices in RL_LINE_BUFFER saying what the boundaries
  249.    of TEXT are.
  250.    If this function exists and returns NULL then call the value of
  251.    rl_completion_entry_function to try to match, otherwise use the
  252.    array of strings returned. */
  253. extern Function *rl_attempted_completion_function;
  254.  
  255. /* If non-zero, then this is the address of a function to call just
  256.    before readline_internal () prints the first prompt. */
  257. extern Function *rl_startup_hook;
  258.  
  259. /* If non-zero, indicates that the caller of readline() has already
  260.    output the prompt. */
  261. extern int rl_already_prompted;
  262.  
  263. /* If non-zero, then this is the address of a function to call when
  264.    completing on a directory name.  The function is called with
  265.    the address of a string (the current directory name) as an arg. */
  266. extern Function *rl_symbolic_link_hook;
  267.  
  268. /* If non-zero then this is the address of a function you want called
  269.    while Readline is waiting for character input.     */
  270. extern Function *rl_event_hook;
  271.  
  272. /* Non-zero means that modified history lines are preceded
  273.    with an asterisk. */
  274. extern int rl_show_star;
  275.  
  276.  
  277. /* **************************************************************** */
  278. /*                                                                  */
  279. /*             Tilde Variables That Can be Externally Set           */
  280. /*                                                                  */
  281. /* **************************************************************** */
  282.  
  283. /* If non-null, this contains the address of a function to call if the
  284.    standard meaning for expanding a tilde fails.  The function is called
  285.    with the text (sans tilde, as in "foo"), and returns a malloc()'ed string
  286.    which is the expansion, or a NULL pointer if there is no expansion. */
  287. extern Function *tilde_expansion_failure_hook;
  288.  
  289. /* When non-null, this is a NULL terminated array of strings which
  290.    are duplicates for a tilde prefix.  Bash uses this to expand
  291.    `=~' and `:~'. */
  292. extern char **tilde_additional_prefixes;
  293.  
  294. /* When non-null, this is a NULL terminated array of strings which match
  295.    the end of a username, instead of just "/".  Bash sets this to
  296.    `/' and `:'. */
  297. extern char **tilde_additional_suffixes;
  298.  
  299. /* **************************************************************** */
  300. /*                                    */
  301. /*            Well Published Functions            */
  302. /*                                    */
  303. /* **************************************************************** */
  304.  
  305. /* Read a line of input.  Prompt with PROMPT.  A NULL PROMPT means none. */
  306. extern char *readline RL((char* prompt));
  307.  
  308. /* Put the terminal in CBREAK mode so that we can detect key presses. */
  309. extern void rl_prep_terminal RL((void));
  310.  
  311. /* Restore the terminal to its original state. */
  312. extern void rl_deprep_terminal RL((void));
  313.  
  314. /* Return an array of strings which are the result of repeatadly calling
  315.    FUNC with TEXT. */
  316. extern unsigned char **completion_matches RL((char* text, char* (*entry_function)()));
  317.  
  318. /* rl_add_defun (char *name, Function *function, int key)
  319.    Add NAME to the list of named functions.  Make FUNCTION
  320.    be the function that gets called.
  321.    If KEY is not -1, then bind it. */
  322. extern void rl_add_defun RL((char* name, Function* function, int key));
  323.  
  324. #endif /* _READLINE_H_ */
  325.