aboutsummaryrefslogtreecommitdiff
path: root/gnu/lib/libreadline/readline
diff options
context:
space:
mode:
authorAndrey A. Chernov <ache@FreeBSD.org>1994-05-09 23:24:44 +0000
committerAndrey A. Chernov <ache@FreeBSD.org>1994-05-09 23:24:44 +0000
commit9cadef18e6c5a4e182160533a09f6076ef501838 (patch)
treef28f2d52bb4b856ef6a375919e9f851bd131a2ec /gnu/lib/libreadline/readline
parentce4acff5b6111059cbb384355626bffe3112f432 (diff)
downloadsrc-9cadef18e6c5a4e182160533a09f6076ef501838.tar.gz
src-9cadef18e6c5a4e182160533a09f6076ef501838.zip
Merged with new readline 2.0 from bash
Notes
Notes: svn path=/head/; revision=1473
Diffstat (limited to 'gnu/lib/libreadline/readline')
-rw-r--r--gnu/lib/libreadline/readline/chardefs.h52
-rw-r--r--gnu/lib/libreadline/readline/history.h14
-rw-r--r--gnu/lib/libreadline/readline/keymaps.h44
-rw-r--r--gnu/lib/libreadline/readline/readline.h61
4 files changed, 146 insertions, 25 deletions
diff --git a/gnu/lib/libreadline/readline/chardefs.h b/gnu/lib/libreadline/readline/chardefs.h
index 9749ae489f46..c9dcff3ac80b 100644
--- a/gnu/lib/libreadline/readline/chardefs.h
+++ b/gnu/lib/libreadline/readline/chardefs.h
@@ -1,8 +1,24 @@
/* chardefs.h -- Character definitions for readline. */
#ifndef _CHARDEFS_
+#define _CHARDEFS_
+
+#include <ctype.h>
+
+#ifndef HAVE_STRING_H
+#define HAVE_STRING_H
+#endif
+
+#if defined (HAVE_STRING_H)
+# include <string.h>
+#else
+# include <strings.h>
+#endif /* HAVE_STRING_H */
#ifndef savestring
-#define savestring(x) (char *)strcpy (xmalloc (1 + strlen (x)), (x))
+#ifndef STATIC_MALLOC
+extern char *xmalloc ();
+#endif
+#define savestring(x) strcpy (xmalloc (1 + strlen (x)), (x))
#endif
#ifndef whitespace
@@ -14,11 +30,13 @@
#endif
/* Some character stuff. */
-#define control_character_threshold 0x020 /* smaller than this is control */
-#define meta_character_threshold 0x07f /* larger than this is Meta. */
+#define control_character_threshold 0x020 /* Smaller than this is control. */
+#define meta_character_threshold 0x07f /* Larger than this is Meta. */
#define control_character_bit 0x40 /* 0x000000, must be off. */
#define meta_character_bit 0x080 /* x0000000, must be on. */
+#define largest_char 255 /* Largest character value. */
+#define META_CHAR(c) ((c) > meta_character_threshold && (c) <= largest_char)
#define CTRL(c) ((c) & (~control_character_bit))
#define META(c) ((c) | meta_character_bit)
@@ -38,13 +56,41 @@
#define CTRL_P(c) ((c) < control_character_threshold)
#define META_P(c) ((c) > meta_character_threshold)
+#ifndef NEWLINE
#define NEWLINE '\n'
+#endif
+
+#ifndef RETURN
#define RETURN CTRL('M')
+#endif
+
+#ifndef RUBOUT
#define RUBOUT 0x07f
+#endif
+
+#ifndef TAB
#define TAB '\t'
+#endif
+
+#ifdef ABORT_CHAR
+#undef ABORT_CHAR
+#endif
#define ABORT_CHAR CTRL('G')
+
+#ifdef PAGE
+#undef PAGE
+#endif
#define PAGE CTRL('L')
+
+#ifdef SPACE
+#undef SPACE
+#endif
#define SPACE 0x020
+
+#ifdef ESC
+#undef ESC
+#endif
+
#define ESC CTRL('[')
#endif /* _CHARDEFS_ */
diff --git a/gnu/lib/libreadline/readline/history.h b/gnu/lib/libreadline/readline/history.h
index 0041171f944a..72bdff9f7cb9 100644
--- a/gnu/lib/libreadline/readline/history.h
+++ b/gnu/lib/libreadline/readline/history.h
@@ -6,6 +6,14 @@ typedef struct _hist_entry {
char *data;
} HIST_ENTRY;
+/* A structure used to pass the current state of the history stuff around. */
+typedef struct _hist_state {
+ HIST_ENTRY **entries; /* Pointer to the entries themselves. */
+ int offset; /* The location pointer within this array. */
+ int length; /* Number of elements within this array. */
+ int size; /* Number of slots allocated to this array. */
+} HISTORY_STATE;
+
/* For convenience only. You set this when interpreting history commands.
It is the logical offset of the first history element. */
extern int history_base;
@@ -14,6 +22,12 @@ extern int history_base;
just initializes the interactive variables. */
extern void using_history ();
+/* Return the current HISTORY_STATE of the history. */
+extern HISTORY_STATE *history_get_history_state ();
+
+/* Set the state of the current history array to STATE. */
+extern void history_set_history_state ();
+
/* Place STRING at the end of the history list.
The associated data field (if any) is set to NULL. */
extern void add_history ();
diff --git a/gnu/lib/libreadline/readline/keymaps.h b/gnu/lib/libreadline/readline/keymaps.h
index a0b5aeb376bf..2419f1a22ae0 100644
--- a/gnu/lib/libreadline/readline/keymaps.h
+++ b/gnu/lib/libreadline/readline/keymaps.h
@@ -1,13 +1,36 @@
/* keymaps.h -- Manipulation of readline keymaps. */
+/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
+
+ This file is part of the GNU Readline Library, a library for
+ reading lines of text with interactive input and history editing.
+
+ The GNU Readline Library is free software; you can redistribute it
+ and/or modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 1, or
+ (at your option) any later version.
+
+ The GNU Readline Library is distributed in the hope that it will be
+ useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+ of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ The GNU General Public License is often shipped with GNU software, and
+ is generally kept in a file called COPYING or LICENSE. If you do not
+ have a copy of the license, write to the Free Software Foundation,
+ 675 Mass Ave, Cambridge, MA 02139, USA. */
+
#ifndef _KEYMAPS_H_
#define _KEYMAPS_H_
#include <readline/chardefs.h>
-#ifndef __FUNCTION_DEF
+#if !defined (__FUNCTION_DEF)
+# define __FUNCTION_DEF
typedef int Function ();
-#define __FUNCTION_DEF
+typedef void VFunction ();
+typedef char *CPFunction ();
+typedef char **CPPFunction ();
#endif
/* A keymap contains one entry for each key in the ASCII set.
@@ -20,12 +43,17 @@ typedef struct _keymap_entry {
Function *function;
} KEYMAP_ENTRY;
+/* This must be large enough to hold bindings for all of the characters
+ in a desired character set (e.g, 128 for ASCII, 256 for ISO Latin-x,
+ and so on). */
+#define KEYMAP_SIZE 256
+
/* I wanted to make the above structure contain a union of:
union { Function *function; struct _keymap_entry *keymap; } value;
but this made it impossible for me to create a static array.
Maybe I need C lessons. */
-typedef KEYMAP_ENTRY KEYMAP_ENTRY_ARRAY[128];
+typedef KEYMAP_ENTRY KEYMAP_ENTRY_ARRAY[KEYMAP_SIZE];
typedef KEYMAP_ENTRY *Keymap;
/* The values that TYPE can have in a keymap entry. */
@@ -48,4 +76,14 @@ Keymap rl_copy_keymap ();
the Meta digits bound to produce numeric arguments. */
Keymap rl_make_keymap ();
+/* Return the keymap corresponding to a given name. Names look like
+ `emacs' or `emacs-meta' or `vi-insert'. */
+Keymap rl_get_keymap_by_name ();
+
+/* Return the current keymap. */
+Keymap rl_get_keymap ();
+
+/* Set the current keymap to MAP. */
+void rl_set_keymap ();
+
#endif /* _KEYMAPS_H_ */
diff --git a/gnu/lib/libreadline/readline/readline.h b/gnu/lib/libreadline/readline/readline.h
index 5b8b2a88342d..007bc87c89b7 100644
--- a/gnu/lib/libreadline/readline/readline.h
+++ b/gnu/lib/libreadline/readline/readline.h
@@ -1,18 +1,34 @@
/* Readline.h -- the names of functions callable from within readline. */
+/* Copyright (C) 1987, 1989, 1992 Free Software Foundation, Inc.
+
+ This file is part of the GNU Readline Library, a library for
+ reading lines of text with interactive input and history editing.
+
+ The GNU Readline Library is free software; you can redistribute it
+ and/or modify it under the terms of the GNU General Public License
+ as published by the Free Software Foundation; either version 1, or
+ (at your option) any later version.
+
+ The GNU Readline Library is distributed in the hope that it will be
+ useful, but WITHOUT ANY WARRANTY; without even the implied warranty
+ of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ The GNU General Public License is often shipped with GNU software, and
+ is generally kept in a file called COPYING or LICENSE. If you do not
+ have a copy of the license, write to the Free Software Foundation,
+ 675 Mass Ave, Cambridge, MA 02139, USA. */
+
#if !defined (_READLINE_H_)
#define _READLINE_H_
#include <readline/keymaps.h>
-#if !defined (__FUNCTION_DEF)
-typedef int Function ();
-#define __FUNCTION_DEF
-#endif /* __FUNCTION_DEF */
-
/* The functions for manipulating the text of the line within readline.
Most of these functions are bound to keys by default. */
extern int
+ rl_tilde_expand (),
rl_beg_of_line (), rl_backward (), rl_delete (), rl_end_of_line (),
rl_forward (), ding (), rl_backward (), rl_newline (), rl_kill_line (),
rl_clear_screen (), rl_get_next_history (), rl_get_previous_history (),
@@ -21,19 +37,32 @@ extern int
rl_yank (), rl_rubout (), rl_backward_word (), rl_kill_word (),
rl_forward_word (), rl_tab_insert (), rl_yank_pop (), rl_yank_nth_arg (),
rl_backward_kill_word (), rl_backward_kill_line (), rl_transpose_words (),
- rl_complete (), rl_possible_completions (), rl_do_lowercase_version (),
+ rl_complete (), rl_possible_completions (), rl_insert_completions (),
+ rl_do_lowercase_version (),
rl_digit_argument (), rl_universal_argument (), rl_abort (),
rl_undo_command (), rl_revert_line (), rl_beginning_of_history (),
rl_end_of_history (), rl_forward_search_history (), rl_insert (),
rl_upcase_word (), rl_downcase_word (), rl_capitalize_word (),
- rl_restart_output (), rl_re_read_init_file (), rl_dump_functions ();
+ rl_restart_output (), rl_re_read_init_file (), rl_dump_functions (),
+ rl_delete_horizontal_space ();
+
+/* #define PAREN_MATCHING */
+#if defined (PAREN_MATCHING)
+extern int rl_insert_close ();
+#endif /* PAREN_MATCHING */
/* These are *both* defined even when VI_MODE is not. */
extern int rl_vi_editing_mode (), rl_emacs_editing_mode ();
+/* Non incremental history searching. */
+extern int
+ rl_noninc_forward_search (), rl_noninc_reverse_search (),
+ rl_noninc_forward_search_again (), rl_noninc_reverse_search_again ();
+
#if defined (VI_MODE)
/* Things for vi mode. */
extern int
+ rl_vi_redo (), rl_vi_tilde_expand (),
rl_vi_movement_mode (), rl_vi_insertion_mode (), rl_vi_arg_digit (),
rl_vi_prev_word (), rl_vi_next_word (), rl_vi_char_search (),
rl_vi_eof_maybe (), rl_vi_append_mode (), rl_vi_put (),
@@ -42,9 +71,9 @@ extern int
rl_vi_bWord (), rl_vi_eword (), rl_vi_eWord (), rl_vi_end_word (),
rl_vi_change_case (), rl_vi_match (), rl_vi_bracktype (),
rl_vi_change_char (), rl_vi_yank_arg (), rl_vi_search (),
- rl_vi_search_again (), rl_vi_dosearch (), rl_vi_subst (),
- rl_vi_overstrike (), rl_vi_overstrike_delete (), rl_vi_replace(),
- rl_vi_column (), rl_vi_delete_to (), rl_vi_change_to (), rl_vi_yank_to (),
+ rl_vi_search_again (), rl_vi_subst (), rl_vi_overstrike (),
+ rl_vi_overstrike_delete (), rl_vi_replace(), rl_vi_column (),
+ rl_vi_delete_to (), rl_vi_change_to (), rl_vi_yank_to (),
rl_vi_complete (), rl_vi_fetch_history ();
#endif /* VI_MODE */
@@ -144,13 +173,7 @@ extern Function *rl_ignore_some_completions_function;
If this function exists and returns NULL then call the value of
rl_completion_entry_function to try to match, otherwise use the
array of strings returned. */
-extern Function *rl_attempted_completion_function;
-
-/* If non-null, this contains the address of a function to call if the
- standard meaning for expanding a tilde fails. The function is called
- with the text (sans tilde, as in "foo"), and returns a malloc()'ed string
- which is the expansion, or a NULL pointer if there is no expansion. */
-extern Function *rl_tilde_expander;
+extern CPPFunction *rl_attempted_completion_function;
/* If non-zero, then this is the address of a function to call just
before readline_internal () prints the first prompt. */
@@ -161,8 +184,8 @@ extern Function *rl_startup_hook;
the address of a string (the current directory name) as an arg. */
extern Function *rl_symbolic_link_hook;
-/* If non-zero then this is the address of a function you want called
- while Readline is waiting for character input. */
+/* The address of a function to call periodically while Readline is
+ awaiting character input, or NULL, for no event handling. */
extern Function *rl_event_hook;
/* Non-zero means that modified history lines are preceded