diff options
author | Nirbhay Choubey <nirbhay.choubey@oracle.com> | 2011-10-14 01:03:25 +0530 |
---|---|---|
committer | Nirbhay Choubey <nirbhay.choubey@oracle.com> | 2011-10-14 01:03:25 +0530 |
commit | d96c25a79013eae662d1c0f5f43782126b24e696 (patch) | |
tree | be857526f550dbcca504a8e08be25977a493842f /cmd-line-utils/libedit/hist.h | |
parent | 6d59064948fa916667a7cc885ecdc4df3b8fb871 (diff) | |
download | mariadb-git-d96c25a79013eae662d1c0f5f43782126b24e696.tar.gz |
WL#5945 : Improve libedit library
Updated libedit library.
Diffstat (limited to 'cmd-line-utils/libedit/hist.h')
-rw-r--r-- | cmd-line-utils/libedit/hist.h | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/cmd-line-utils/libedit/hist.h b/cmd-line-utils/libedit/hist.h index 46e14634adf..a63be499dbd 100644 --- a/cmd-line-utils/libedit/hist.h +++ b/cmd-line-utils/libedit/hist.h @@ -1,4 +1,4 @@ -/* $NetBSD: hist.h,v 1.10 2003/08/07 16:44:31 agc Exp $ */ +/* $NetBSD: hist.h,v 1.13 2011/07/28 20:50:55 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -42,21 +42,29 @@ #include "histedit.h" -typedef int (*hist_fun_t)(ptr_t, HistEvent *, int, ...); +typedef int (*hist_fun_t)(void *, TYPE(HistEvent) *, int, ...); typedef struct el_history_t { - char *buf; /* The history buffer */ + Char *buf; /* The history buffer */ size_t sz; /* Size of history buffer */ - char *last; /* The last character */ + Char *last; /* The last character */ int eventno; /* Event we are looking for */ - ptr_t ref; /* Argument for history fcns */ + void * ref; /* Argument for history fcns */ hist_fun_t fun; /* Event access */ - HistEvent ev; /* Event cookie */ + TYPE(HistEvent) ev; /* Event cookie */ } el_history_t; -#define HIST_FUN(el, fn, arg) \ +#define HIST_FUN_INTERNAL(el, fn, arg) \ ((((*(el)->el_history.fun) ((el)->el_history.ref, &(el)->el_history.ev, \ fn, arg)) == -1) ? NULL : (el)->el_history.ev.str) +#ifdef WIDECHAR +#define HIST_FUN(el, fn, arg) \ + (((el)->el_flags & NARROW_HISTORY) ? hist_convert(el, fn, arg) : \ + HIST_FUN_INTERNAL(el, fn, arg)) +#else +#define HIST_FUN(el, fn, arg) HIST_FUN_INTERNAL(el, fn, arg) +#endif + #define HIST_NEXT(el) HIST_FUN(el, H_NEXT, NULL) #define HIST_FIRST(el) HIST_FUN(el, H_FIRST, NULL) @@ -69,8 +77,11 @@ typedef struct el_history_t { protected int hist_init(EditLine *); protected void hist_end(EditLine *); protected el_action_t hist_get(EditLine *); -protected int hist_set(EditLine *, hist_fun_t, ptr_t); -protected int hist_command(EditLine *, int, const char **); +protected int hist_set(EditLine *, hist_fun_t, void *); +protected int hist_command(EditLine *, int, const Char **); protected int hist_enlargebuf(EditLine *, size_t, size_t); +#ifdef WIDECHAR +protected wchar_t *hist_convert(EditLine *, int, void *); +#endif #endif /* _h_el_hist */ |