#include "compat.h"
#include "sys.h"
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include <sys/stat.h>
#include <string>
#include <fstream>
#include "histedit.h"
Go to the source code of this file.
Classes | |
struct | HistoryFcns_t |
struct | HEntry_t |
struct | History_t |
Defines | |
#define | HNEXT(h, ev) (*(h)->fNext)((h)->fRef, ev) |
#define | HFIRST(h, ev) (*(h)->fFirst)((h)->fRef, ev) |
#define | HPREV(h, ev) (*(h)->fPrev)((h)->fRef, ev) |
#define | HLAST(h, ev) (*(h)->fLast)((h)->fRef, ev) |
#define | HCURR(h, ev) (*(h)->fCurr)((h)->fRef, ev) |
#define | HSET(h, ev, n) (*(h)->fSet)((h)->fRef, ev, n) |
#define | HCLEAR(h, ev) (*(h)->fClear)((h)->fRef, ev) |
#define | HENTER(h, ev, str) (*(h)->fEnter)((h)->fRef, ev, str) |
#define | HADD(h, ev, str) (*(h)->fAdd)((h)->fRef, ev, str) |
#define | h_malloc(a) malloc(a) |
#define | h_realloc(a, b) realloc((a), (b)) |
#define | h_free(a) free(a) |
#define | history_def_setsize(p, num) (void) (((History_t*) p)->fMax = (num)) |
#define | history_def_getsize(p) (((History_t*) p)->fCur) |
#define | he_strerror(code) he_errlist[code] |
#define | he_seterrev(evp, code) |
#define | _HE_OK 0 |
#define | _HE_UNKNOWN 1 |
#define | _HE_MALLOC_FAILED 2 |
#define | _HE_FIRST_NOTFOUND 3 |
#define | _HE_LAST_NOTFOUND 4 |
#define | _HE_EMPTY_LIST 5 |
#define | _HE_END_REACHED 6 |
#define | _HE_START_REACHED 7 |
#define | _HE_CURR_INVALID 8 |
#define | _HE_NOT_FOUND 9 |
#define | _HE_HIST_READ 10 |
#define | _HE_HIST_WRITE 11 |
#define | _HE_PARAM_MISSING 12 |
#define | _HE_SIZE_NEGATIVE 13 |
#define | _HE_NOT_ALLOWED 14 |
#define | _HE_BAD_PARAM 15 |
Typedefs | |
typedef int(*) | HistoryGFun_t (ptr_t, HistEvent_t *) |
typedef int(*) | HistoryEFun_t (ptr_t, HistEvent_t *, const char *) |
typedef void(*) | HistoryVFun_t (ptr_t, HistEvent_t *) |
typedef int(*) | HistorySFun_t (ptr_t, HistEvent_t *, const int) |
Functions | |
el_private int | history_setsize (HistoryFcns_t *, HistEvent_t *, int) |
el_private int | history_getsize (HistoryFcns_t *, HistEvent_t *) |
el_private int | history_set_fun (HistoryFcns_t *, HistoryFcns_t *) |
el_private int | history_load (HistoryFcns_t *, const char *) |
el_private int | history_save (HistoryFcns_t *, const char *) |
el_private int | history_prev_event (HistoryFcns_t *, HistEvent_t *, int) |
el_private int | history_next_event (HistoryFcns_t *, HistEvent_t *, int) |
el_private int | history_next_string (HistoryFcns_t *, HistEvent_t *, const char *) |
el_private int | history_prev_string (HistoryFcns_t *, HistEvent_t *, const char *) |
el_private int | history_def_first (ptr_t, HistEvent_t *) |
el_private int | history_def_last (ptr_t, HistEvent_t *) |
el_private int | history_def_next (ptr_t, HistEvent_t *) |
el_private int | history_def_prev (ptr_t, HistEvent_t *) |
el_private int | history_def_curr (ptr_t, HistEvent_t *) |
el_private int | history_def_set (ptr_t, HistEvent_t *, const int n) |
el_private int | history_def_enter (ptr_t, HistEvent_t *, const char *) |
el_private int | history_def_add (ptr_t, HistEvent_t *, const char *) |
el_private void | history_def_init (ptr_t *, HistEvent_t *, int) |
el_private void | history_def_clear (ptr_t, HistEvent_t *) |
el_private int | history_def_insert (History_t *, HistEvent_t *, const char *) |
el_private void | history_def_delete (History_t *, HistEvent_t *, HEntry_t *) |
el_public HistoryFcns_t * | history_init (void) |
el_public void | history_end (HistoryFcns_t *h) |
int | history (HistoryFcns_t *h, HistEvent_t *ev, int fun,...) |
Variables | |
static const char *const | he_errlist [] |
#define _HE_BAD_PARAM 15 |
#define _HE_CURR_INVALID 8 |
#define _HE_EMPTY_LIST 5 |
Definition at line 176 of file history.cxx.
Referenced by history_def_curr(), history_def_next(), history_def_prev(), and history_def_set().
#define _HE_END_REACHED 6 |
Definition at line 177 of file history.cxx.
Referenced by history_def_next(), and history_def_prev().
#define _HE_FIRST_NOTFOUND 3 |
#define _HE_HIST_READ 10 |
#define _HE_HIST_WRITE 11 |
#define _HE_LAST_NOTFOUND 4 |
#define _HE_MALLOC_FAILED 2 |
Definition at line 173 of file history.cxx.
Referenced by history_def_add(), and history_def_insert().
#define _HE_NOT_ALLOWED 14 |
#define _HE_NOT_FOUND 9 |
Definition at line 180 of file history.cxx.
Referenced by history_def_set(), history_next_event(), history_next_string(), history_prev_event(), and history_prev_string().
#define _HE_OK 0 |
#define _HE_PARAM_MISSING 12 |
#define _HE_SIZE_NEGATIVE 13 |
#define _HE_START_REACHED 7 |
#define _HE_UNKNOWN 1 |
#define h_free | ( | a | ) | free(a) |
Definition at line 96 of file history.cxx.
Referenced by history_def_add(), and history_def_delete().
#define h_malloc | ( | a | ) | malloc(a) |
Definition at line 94 of file history.cxx.
Referenced by history_def_add(), history_def_init(), history_def_insert(), and history_init().
Definition at line 95 of file history.cxx.
Definition at line 88 of file history.cxx.
Referenced by history(), history_next_event(), history_next_string(), history_prev_event(), and history_prev_string().
#define he_seterrev | ( | evp, | |||
code | ) |
Value:
{ \ evp->fNum = code; \ evp->fStr = he_strerror(code); \ }
Definition at line 146 of file history.cxx.
Referenced by history(), history_def_add(), history_def_curr(), history_def_first(), history_def_insert(), history_def_last(), history_def_next(), history_def_prev(), history_def_set(), history_getsize(), history_next_event(), history_next_string(), history_prev_event(), history_prev_string(), and history_setsize().
#define he_strerror | ( | code | ) | he_errlist[code] |
Definition at line 145 of file history.cxx.
Definition at line 84 of file history.cxx.
Referenced by history(), history_next_event(), and history_prev_string().
Definition at line 86 of file history.cxx.
Referenced by history(), history_next_string(), and history_prev_event().
typedef int(*) HistoryEFun_t(ptr_t, HistEvent_t *, const char *) |
Definition at line 67 of file history.cxx.
typedef int(*) HistoryGFun_t(ptr_t, HistEvent_t *) |
Definition at line 66 of file history.cxx.
typedef int(*) HistorySFun_t(ptr_t, HistEvent_t *, const int) |
Definition at line 69 of file history.cxx.
typedef void(*) HistoryVFun_t(ptr_t, HistEvent_t *) |
Definition at line 68 of file history.cxx.
int history | ( | HistoryFcns_t * | h, | |
HistEvent_t * | ev, | |||
int | fun, | |||
... | ||||
) |
Definition at line 716 of file history.cxx.
References _HE_HIST_READ, _HE_HIST_WRITE, _HE_OK, _HE_PARAM_MISSING, _HE_UNKNOWN, HistoryFcns_t::fAdd, HistoryFcns_t::fClear, HistoryFcns_t::fCurr, HistoryFcns_t::fEnter, HistoryFcns_t::fFirst, HistoryFcns_t::fLast, HistoryFcns_t::fNext, HistEvent_t::fNum, HistoryFcns_t::fPrev, HistoryFcns_t::fRef, HistoryFcns_t::fSet, h, H_ADD, H_APPEND, H_CLEAR, H_CURR, H_END, H_ENTER, H_FIRST, H_FUNC, H_GETSIZE, H_LAST, H_LOAD, H_NEXT, H_NEXT_EVENT, H_NEXT_STR, H_PREV, H_PREV_EVENT, H_PREV_STR, H_SAVE, H_SET, H_SETSIZE, HADD, HCLEAR, HCURR, he_seterrev, HENTER, HFIRST, history_end(), history_getsize(), history_load(), history_next_event(), history_next_string(), history_prev_event(), history_prev_string(), history_save(), history_set_fun(), history_setsize(), HLAST, HNEXT, HPREV, HSET, retval, and str.
Referenced by _history_search_gen(), _move_history(), add_history(), clear_history(), history_get(), history_search_pos(), history_set_pos(), history_total_bytes(), read_history(), readline(), rl_initialize(), stifle_history(), unstifle_history(), where_history(), and write_history().
el_private int history_def_add | ( | ptr_t | , | |
HistEvent_t * | , | |||
const char * | ||||
) |
Definition at line 332 of file history.cxx.
References _HE_MALLOC_FAILED, h, h_free, h_malloc, he_seterrev, history_def_enter(), len, s, size_t, strlcat(), strlcpy(), and void.
Referenced by history_init(), and history_set_fun().
el_private void history_def_clear | ( | ptr_t | , | |
HistEvent_t * | ||||
) |
Definition at line 451 of file history.cxx.
References h, and history_def_delete().
Referenced by history_end(), history_init(), and history_set_fun().
el_private int history_def_curr | ( | ptr_t | , | |
HistEvent_t * | ||||
) |
Definition at line 283 of file history.cxx.
References _HE_CURR_INVALID, _HE_EMPTY_LIST, h, and he_seterrev.
Referenced by history_init(), and history_set_fun().
el_private void history_def_delete | ( | History_t * | , | |
HistEvent_t * | , | |||
HEntry_t * | ||||
) |
Definition at line 362 of file history.cxx.
Referenced by history_def_clear(), and history_def_enter().
el_private int history_def_enter | ( | ptr_t | , | |
HistEvent_t * | , | |||
const char * | ||||
) |
Definition at line 406 of file history.cxx.
References h, history_def_delete(), and history_def_insert().
Referenced by history_def_add(), history_init(), and history_set_fun().
el_private int history_def_first | ( | ptr_t | , | |
HistEvent_t * | ||||
) |
Definition at line 192 of file history.cxx.
References _HE_FIRST_NOTFOUND, h, and he_seterrev.
Referenced by history_init(), and history_set_fun().
el_private void history_def_init | ( | ptr_t * | , | |
HistEvent_t * | , | |||
int | ||||
) |
Definition at line 430 of file history.cxx.
References h, h_malloc, and NULL.
Referenced by history_init(), and history_set_fun().
el_private int history_def_insert | ( | History_t * | , | |
HistEvent_t * | , | |||
const char * | ||||
) |
Definition at line 379 of file history.cxx.
References _HE_MALLOC_FAILED, h, h_malloc, and he_seterrev.
Referenced by history_def_enter().
el_private int history_def_last | ( | ptr_t | , | |
HistEvent_t * | ||||
) |
Definition at line 212 of file history.cxx.
References _HE_LAST_NOTFOUND, h, and he_seterrev.
Referenced by history_init(), and history_set_fun().
el_private int history_def_next | ( | ptr_t | , | |
HistEvent_t * | ||||
) |
Definition at line 232 of file history.cxx.
References _HE_EMPTY_LIST, _HE_END_REACHED, h, and he_seterrev.
Referenced by history_end(), history_getsize(), history_init(), history_set_fun(), and history_setsize().
el_private int history_def_prev | ( | ptr_t | , | |
HistEvent_t * | ||||
) |
Definition at line 257 of file history.cxx.
References _HE_EMPTY_LIST, _HE_END_REACHED, _HE_START_REACHED, h, and he_seterrev.
Referenced by history_init(), and history_set_fun().
el_private int history_def_set | ( | ptr_t | , | |
HistEvent_t * | , | |||
const int | n | |||
) |
Definition at line 303 of file history.cxx.
References _HE_EMPTY_LIST, _HE_NOT_FOUND, h, and he_seterrev.
Referenced by history_init(), and history_set_fun().
el_public void history_end | ( | HistoryFcns_t * | h | ) |
Definition at line 491 of file history.cxx.
References h, history_def_clear(), and history_def_next().
Referenced by history(), rl_cleanup_after_signal(), and rl_initialize().
el_private int history_getsize | ( | HistoryFcns_t * | , | |
HistEvent_t * | ||||
) |
Definition at line 523 of file history.cxx.
References _HE_NOT_ALLOWED, _HE_SIZE_NEGATIVE, HistEvent_t::fNum, h, he_seterrev, history_def_getsize, history_def_next(), and retval.
Referenced by history().
el_public HistoryFcns_t* history_init | ( | void | ) |
Definition at line 467 of file history.cxx.
References h, h_malloc, history_def_add(), history_def_clear(), history_def_curr(), history_def_enter(), history_def_first(), history_def_init(), history_def_last(), history_def_next(), history_def_prev(), and history_def_set().
Referenced by rl_initialize().
el_private int history_load | ( | HistoryFcns_t * | , | |
const char * | ||||
) |
el_private int history_next_event | ( | HistoryFcns_t * | , | |
HistEvent_t * | , | |||
int | ||||
) |
Definition at line 660 of file history.cxx.
References _HE_NOT_FOUND, HistEvent_t::fNum, h, HCURR, he_seterrev, HNEXT, and retval.
Referenced by history().
el_private int history_next_string | ( | HistoryFcns_t * | , | |
HistEvent_t * | , | |||
const char * | ||||
) |
Definition at line 697 of file history.cxx.
References _HE_NOT_FOUND, HistEvent_t::fStr, h, HCURR, he_seterrev, HPREV, len, retval, and size_t.
Referenced by history().
el_private int history_prev_event | ( | HistoryFcns_t * | , | |
HistEvent_t * | , | |||
int | ||||
) |
Definition at line 642 of file history.cxx.
References _HE_NOT_FOUND, HistEvent_t::fNum, h, HCURR, he_seterrev, HPREV, and retval.
Referenced by history().
el_private int history_prev_string | ( | HistoryFcns_t * | , | |
HistEvent_t * | , | |||
const char * | ||||
) |
Definition at line 678 of file history.cxx.
References _HE_NOT_FOUND, HistEvent_t::fStr, h, HCURR, he_seterrev, HNEXT, len, retval, and size_t.
Referenced by history().
el_private int history_save | ( | HistoryFcns_t * | , | |
const char * | ||||
) |
el_private int history_set_fun | ( | HistoryFcns_t * | , | |
HistoryFcns_t * | ||||
) |
Definition at line 545 of file history.cxx.
References h, history_def_add(), history_def_clear(), history_def_curr(), history_def_enter(), history_def_first(), history_def_init(), history_def_last(), history_def_next(), history_def_prev(), history_def_set(), nh, and NULL.
Referenced by history().
el_private int history_setsize | ( | HistoryFcns_t * | , | |
HistEvent_t * | , | |||
int | ||||
) |
Definition at line 504 of file history.cxx.
References _HE_BAD_PARAM, _HE_NOT_ALLOWED, h, he_seterrev, history_def_next(), and history_def_setsize.
Referenced by history().
const char* const he_errlist[] [static] |
Initial value:
{ "OK", "unknown error", "malloc() failed", "first event not found", "last event not found", "empty list", "no next event", "no previous event", "current event is invalid", "event not found", "can't read history from file", "can't write history", "required parameter(s) not supplied", "history size negative", "function not allowed with other history-functions-set the default", "bad parameters" }
Definition at line 152 of file history.cxx.