Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libedit - provide enough hooks to compile gdb-5.3
details: https://anonhg.NetBSD.org/src/rev/a2b1680f6f2d
branches: trunk
changeset: 551968:a2b1680f6f2d
user: christos <christos%NetBSD.org@localhost>
date: Sun Sep 14 21:48:54 2003 +0000
description:
- provide enough hooks to compile gdb-5.3
- fix el_get(e, EL_TERMINAL, (char **))
diffstat:
lib/libedit/el.c | 9 +++--
lib/libedit/readline.c | 53 ++++++++++++++++++++++++++++-----------
lib/libedit/readline/readline.h | 55 ++++++++++++++++++++++++++++++++++++++++-
lib/libedit/shlib_version | 4 +-
lib/libedit/term.c | 12 +++++++-
lib/libedit/term.h | 4 ++-
6 files changed, 112 insertions(+), 25 deletions(-)
diffs (truncated from 324 to 300 lines):
diff -r 56c093d16ea3 -r a2b1680f6f2d lib/libedit/el.c
--- a/lib/libedit/el.c Sun Sep 14 21:36:51 2003 +0000
+++ b/lib/libedit/el.c Sun Sep 14 21:48:54 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: el.c,v 1.32 2003/08/07 16:44:30 agc Exp $ */
+/* $NetBSD: el.c,v 1.33 2003/09/14 21:48:54 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)el.c 8.2 (Berkeley) 1/3/94";
#else
-__RCSID("$NetBSD: el.c,v 1.32 2003/08/07 16:44:30 agc Exp $");
+__RCSID("$NetBSD: el.c,v 1.33 2003/09/14 21:48:54 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
@@ -293,11 +293,12 @@
rv = 0;
break;
-#if 0 /* XXX */
case EL_TERMINAL:
- rv = term_get(el, (const char *) &ret);
+ term_get(el, (const char **)ret);
+ rv = 0;
break;
+#if 0 /* XXX */
case EL_BIND:
case EL_TELLTC:
case EL_SETTC:
diff -r 56c093d16ea3 -r a2b1680f6f2d lib/libedit/readline.c
--- a/lib/libedit/readline.c Sun Sep 14 21:36:51 2003 +0000
+++ b/lib/libedit/readline.c Sun Sep 14 21:48:54 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: readline.c,v 1.31 2003/06/19 16:04:57 christos Exp $ */
+/* $NetBSD: readline.c,v 1.32 2003/09/14 21:48:54 christos Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
#include "config.h"
#if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: readline.c,v 1.31 2003/06/19 16:04:57 christos Exp $");
+__RCSID("$NetBSD: readline.c,v 1.32 2003/09/14 21:48:54 christos Exp $");
#endif /* not lint && not SCCSID */
#include <sys/types.h>
@@ -94,8 +94,23 @@
char *rl_completer_quote_characters = NULL;
CPFunction *rl_completion_entry_function = NULL;
CPPFunction *rl_attempted_completion_function = NULL;
+Function *rl_pre_input_hook = NULL;
+Function *rl_startup1_hook = NULL;
+Function *rl_getc_function = NULL;
+char *rl_terminal_name = NULL;
+int rl_already_prompted = 0;
+int rl_filename_completion_desired = 0;
+int rl_ignore_completion_duplicates = 0;
+VFunction *rl_redisplay_function = NULL;
+Function *rl_completion_display_matches_hook = NULL;
+Function *rl_prep_term_function = NULL;
+Function *rl_deprep_term_function = NULL;
/*
+ * The current prompt string.
+ */
+char *rl_prompt = NULL;
+/*
* This is set to character indicating type of completion being done by
* rl_complete_internal(); this is available for application completion
* functions.
@@ -141,17 +156,13 @@
static int rl_complete_internal(int);
static int _rl_qsort_string_compare(const void *, const void *);
-/*
- * needed for prompt switching in readline()
- */
-static char *el_rl_prompt = NULL;
-
/* ARGSUSED */
static char *
_get_prompt(EditLine *el __attribute__((__unused__)))
{
- return (el_rl_prompt);
+ rl_already_prompted = 1;
+ return (rl_prompt);
}
@@ -221,8 +232,8 @@
el_set(e, EL_HIST, history, h);
/* for proper prompt printing in readline() */
- el_rl_prompt = strdup("");
- if (el_rl_prompt == NULL) {
+ rl_prompt = strdup("");
+ if (rl_prompt == NULL) {
history_end(h);
el_end(e);
return -1;
@@ -233,6 +244,10 @@
/* set default mode to "emacs"-style and read setting afterwards */
/* so this can be overriden */
el_set(e, EL_EDITOR, "emacs");
+ if (rl_terminal_name != NULL)
+ el_set(e, EL_TERMINAL, rl_terminal_name);
+ else
+ el_get(e, EL_TERMINAL, &rl_terminal_name);
/*
* Word completition - this has to go AFTER rebinding keys
@@ -242,7 +257,6 @@
"ReadLine compatible completition function",
_el_rl_complete);
el_set(e, EL_BIND, "^I", "rl_complete", NULL);
-
/*
* Find out where the rl_complete function was added; this is
* used later to detect that lastcmd was also rl_complete.
@@ -266,6 +280,9 @@
rl_line_buffer = memchr(li->buffer, *li->buffer, 1);
rl_point = rl_end = 0;
+ if (rl_startup_hook)
+ (*rl_startup_hook)(NULL, 0);
+
return (0);
}
@@ -288,12 +305,18 @@
/* update prompt accordingly to what has been passed */
if (!prompt)
prompt = "";
- if (strcmp(el_rl_prompt, prompt) != 0) {
- free(el_rl_prompt);
- el_rl_prompt = strdup(prompt);
- if (el_rl_prompt == NULL)
+ if (strcmp(rl_prompt, prompt) != 0) {
+ free(rl_prompt);
+ rl_prompt = strdup(prompt);
+ if (rl_prompt == NULL)
return NULL;
}
+
+ if (rl_pre_input_hook)
+ (*rl_pre_input_hook)(NULL, 0);
+
+ rl_already_prompted = 0;
+
/* get one line from input stream */
ret = el_gets(e, &count);
diff -r 56c093d16ea3 -r a2b1680f6f2d lib/libedit/readline/readline.h
--- a/lib/libedit/readline/readline.h Sun Sep 14 21:36:51 2003 +0000
+++ b/lib/libedit/readline/readline.h Sun Sep 14 21:48:54 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: readline.h,v 1.2 2002/03/18 16:01:03 christos Exp $ */
+/* $NetBSD: readline.h,v 1.3 2003/09/14 21:48:55 christos Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -53,6 +53,32 @@
const char *data;
} HIST_ENTRY;
+typedef struct _keymap_entry {
+ char type;
+#define ISFUNC 0
+#define ISKMAP 1
+#define ISMACR 2
+ Function *function;
+} KEYMAP_ENTRY;
+
+#define KEYMAP_SIZE 256
+
+typedef KEYMAP_ENTRY KEYMAP_ENTRY_ARRAY[KEYMAP_SIZE];
+typedef KEYMAP_ENTRY *Keymap;
+
+#define control_character_threshold 0x20
+#define control_character_bit 0x40
+
+#ifndef CTRL
+#define CTRL(a) ((a) & 037)
+#endif
+#ifndef UNCTRL
+#define UNCTRL(a) (((a) - 'a' + 'A')|control_character_bit)
+#endif
+
+#define RUBOUT 0x7f
+#define ABORT_CHAR CTRL('G')
+
/* global variables used by readline enabled applications */
#ifdef __cplusplus
extern "C" {
@@ -74,6 +100,24 @@
extern int rl_completion_query_items;
extern char *rl_special_prefixes;
extern int rl_completion_append_character;
+extern Function *rl_pre_input_hook;
+extern Function *rl_startup_hook;
+extern char *rl_terminal_name;
+extern int rl_already_prompted;
+extern char *rl_prompt;
+/*
+ * The following is not implemented
+ */
+extern KEYMAP_ENTRY_ARRAY emacs_standard_keymap,
+ emacs_meta_keymap,
+ emacs_ctlx_keymap;
+extern int rl_filename_completion_desired;
+extern int rl_ignore_completion_duplicates;
+extern Function *rl_getc_function;
+extern VFunction *rl_redisplay_function;
+extern Function *rl_completion_display_matches_hook;
+extern VFunction *rl_prep_term_function;
+extern VFunction *rl_deprep_term_function;
/* supported functions */
char *readline(const char *);
@@ -111,6 +155,15 @@
int rl_insert(int, int);
void rl_reset_terminal(const char *);
int rl_bind_key(int, int (*)(int, int));
+
+/*
+ * The following are not implemented
+ */
+Keymap rl_get_keymap(void);
+Keymap rl_make_bare_keymap(void);
+int rl_add_defun(const char *, Function *, int);
+int rl_generic_bind(int, const char *, const char *, Keymap);
+int rl_bind_key_in_map(int, Function *, Keymap);
#ifdef __cplusplus
}
#endif
diff -r 56c093d16ea3 -r a2b1680f6f2d lib/libedit/shlib_version
--- a/lib/libedit/shlib_version Sun Sep 14 21:36:51 2003 +0000
+++ b/lib/libedit/shlib_version Sun Sep 14 21:48:54 2003 +0000
@@ -1,5 +1,5 @@
-# $NetBSD: shlib_version,v 1.12 2001/10/09 13:50:30 christos Exp $
+# $NetBSD: shlib_version,v 1.13 2003/09/14 21:48:55 christos Exp $
# Remember to update distrib/sets/lists/base/shl.* when changing
#
major=2
-minor=6
+minor=7
diff -r 56c093d16ea3 -r a2b1680f6f2d lib/libedit/term.c
--- a/lib/libedit/term.c Sun Sep 14 21:36:51 2003 +0000
+++ b/lib/libedit/term.c Sun Sep 14 21:48:54 2003 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: term.c,v 1.37 2003/08/07 16:44:34 agc Exp $ */
+/* $NetBSD: term.c,v 1.38 2003/09/14 21:48:55 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)term.c 8.2 (Berkeley) 4/30/95";
#else
-__RCSID("$NetBSD: term.c,v 1.37 2003/08/07 16:44:34 agc Exp $");
+__RCSID("$NetBSD: term.c,v 1.38 2003/09/14 21:48:55 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
@@ -352,6 +352,7 @@
term_init_arrow(el);
return (0);
}
+
/* term_end():
* Clean up the terminal stuff
*/
@@ -873,6 +874,12 @@
}
#endif
+protected void
+term_get(EditLine *el, const char **term)
+{
+ *term = el->el_term.t_name;
+}
+
/* term_set():
* Read in the terminal capabilities from the requested terminal
@@ -954,6 +961,7 @@
return (-1);
(void) sigprocmask(SIG_SETMASK, &oset, NULL);
term_bind_arrow(el);
+ el->el_term.t_name = term;
return (i <= 0 ? -1 : 0);
}
diff -r 56c093d16ea3 -r a2b1680f6f2d lib/libedit/term.h
Home |
Main Index |
Thread Index |
Old Index