~ubuntu-branches/ubuntu/maverick/mysql-5.1/maverick-proposed

« back to all changes in this revision

Viewing changes to cmd-line-utils/libedit/hist.h

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2012-02-22 14:16:05 UTC
  • mto: This revision was merged to the branch mainline in revision 20.
  • Revision ID: package-import@ubuntu.com-20120222141605-nxlu9yzc6attylc2
Tags: upstream-5.1.61
ImportĀ upstreamĀ versionĀ 5.1.61

Show diffs side-by-side

added added

removed removed

Lines of Context:
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 $       */
2
2
 
3
3
/*-
4
4
 * Copyright (c) 1992, 1993
42
42
 
43
43
#include "histedit.h"
44
44
 
45
 
typedef int (*hist_fun_t)(ptr_t, HistEvent *, int, ...);
 
45
typedef int (*hist_fun_t)(void *, TYPE(HistEvent) *, int, ...);
46
46
 
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                 */
55
55
} el_history_t;
56
56
 
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)
 
60
#ifdef WIDECHAR
 
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))
 
64
#else
 
65
#define HIST_FUN(el, fn, arg) HIST_FUN_INTERNAL(el, fn, arg)
 
66
#endif
 
67
 
60
68
 
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);
 
83
#ifdef WIDECHAR
 
84
protected wchar_t       *hist_convert(EditLine *, int, void *);
 
85
#endif
75
86
 
76
87
#endif /* _h_el_hist */