1
/* $NetBSD: hist.h,v 1.10 2003/08/07 16:44:31 agc Exp $ */
1
/* $NetBSD: hist.h,v 1.13 2011/07/28 20:50:55 christos Exp $ */
4
4
* Copyright (c) 1992, 1993
43
43
#include "histedit.h"
45
typedef int (*hist_fun_t)(ptr_t, HistEvent *, int, ...);
45
typedef int (*hist_fun_t)(void *, TYPE(HistEvent) *, int, ...);
47
47
typedef struct el_history_t {
48
char *buf; /* The history buffer */
48
Char *buf; /* The history buffer */
49
49
size_t sz; /* Size of history buffer */
50
char *last; /* The last character */
50
Char *last; /* The last character */
51
51
int eventno; /* Event we are looking for */
52
ptr_t ref; /* Argument for history fcns */
52
void * ref; /* Argument for history fcns */
53
53
hist_fun_t fun; /* Event access */
54
HistEvent ev; /* Event cookie */
54
TYPE(HistEvent) ev; /* Event cookie */
57
#define HIST_FUN(el, fn, arg) \
57
#define HIST_FUN_INTERNAL(el, fn, arg) \
58
58
((((*(el)->el_history.fun) ((el)->el_history.ref, &(el)->el_history.ev, \
59
59
fn, arg)) == -1) ? NULL : (el)->el_history.ev.str)
61
#define HIST_FUN(el, fn, arg) \
62
(((el)->el_flags & NARROW_HISTORY) ? hist_convert(el, fn, arg) : \
63
HIST_FUN_INTERNAL(el, fn, arg))
65
#define HIST_FUN(el, fn, arg) HIST_FUN_INTERNAL(el, fn, arg)
61
69
#define HIST_NEXT(el) HIST_FUN(el, H_NEXT, NULL)
62
70
#define HIST_FIRST(el) HIST_FUN(el, H_FIRST, NULL)
69
77
protected int hist_init(EditLine *);
70
78
protected void hist_end(EditLine *);
71
79
protected el_action_t hist_get(EditLine *);
72
protected int hist_set(EditLine *, hist_fun_t, ptr_t);
73
protected int hist_command(EditLine *, int, const char **);
80
protected int hist_set(EditLine *, hist_fun_t, void *);
81
protected int hist_command(EditLine *, int, const Char **);
74
82
protected int hist_enlargebuf(EditLine *, size_t, size_t);
84
protected wchar_t *hist_convert(EditLine *, int, void *);
76
87
#endif /* _h_el_hist */