Lines Matching refs:ev
81 #define HNEXT(h, ev) (*(h)->h_next)((h)->h_ref, ev) argument
82 #define HFIRST(h, ev) (*(h)->h_first)((h)->h_ref, ev) argument
83 #define HPREV(h, ev) (*(h)->h_prev)((h)->h_ref, ev) argument
84 #define HLAST(h, ev) (*(h)->h_last)((h)->h_ref, ev) argument
85 #define HCURR(h, ev) (*(h)->h_curr)((h)->h_ref, ev) argument
86 #define HSET(h, ev, n) (*(h)->h_set)((h)->h_ref, ev, n) argument
87 #define HCLEAR(h, ev) (*(h)->h_clear)((h)->h_ref, ev) argument
88 #define HENTER(h, ev, str) (*(h)->h_enter)((h)->h_ref, ev, str) argument
89 #define HADD(h, ev, str) (*(h)->h_add)((h)->h_ref, ev, str) argument
90 #define HDEL(h, ev, n) (*(h)->h_del)((h)->h_ref, ev, n) argument
123 TYPE(HistEvent) ev; /* What we return */
213 history_def_first(void *p, TYPE(HistEvent) *ev) in history_def_first() argument
219 *ev = h->cursor->ev; in history_def_first()
221 he_seterrev(ev, _HE_FIRST_NOTFOUND); in history_def_first()
233 history_def_last(void *p, TYPE(HistEvent) *ev) in history_def_last() argument
239 *ev = h->cursor->ev; in history_def_last()
241 he_seterrev(ev, _HE_LAST_NOTFOUND); in history_def_last()
253 history_def_next(void *p, TYPE(HistEvent) *ev) in history_def_next() argument
258 he_seterrev(ev, _HE_EMPTY_LIST); in history_def_next()
263 he_seterrev(ev, _HE_END_REACHED); in history_def_next()
268 *ev = h->cursor->ev; in history_def_next()
278 history_def_prev(void *p, TYPE(HistEvent) *ev) in history_def_prev() argument
283 he_seterrev(ev, in history_def_prev()
289 he_seterrev(ev, _HE_START_REACHED); in history_def_prev()
294 *ev = h->cursor->ev; in history_def_prev()
304 history_def_curr(void *p, TYPE(HistEvent) *ev) in history_def_curr() argument
309 *ev = h->cursor->ev; in history_def_curr()
311 he_seterrev(ev, in history_def_curr()
325 history_def_set(void *p, TYPE(HistEvent) *ev, const int n) in history_def_set() argument
330 he_seterrev(ev, _HE_EMPTY_LIST); in history_def_set()
333 if (h->cursor == &h->list || h->cursor->ev.num != n) { in history_def_set()
336 if (h->cursor->ev.num == n) in history_def_set()
340 he_seterrev(ev, _HE_NOT_FOUND); in history_def_set()
352 history_set_nth(void *p, TYPE(HistEvent) *ev, int n) in history_set_nth() argument
357 he_seterrev(ev, _HE_EMPTY_LIST); in history_set_nth()
365 he_seterrev(ev, _HE_NOT_FOUND); in history_set_nth()
376 history_def_add(void *p, TYPE(HistEvent) *ev, const Char *str) in history_def_add() argument
381 HistEventPrivate *evp = (void *)&h->cursor->ev; in history_def_add()
384 return history_def_enter(p, ev, str); in history_def_add()
388 he_seterrev(ev, _HE_MALLOC_FAILED); in history_def_add()
391 (void) Strncpy(s, h->cursor->ev.str, len); in history_def_add()
396 *ev = h->cursor->ev; in history_def_add()
402 history_deldata_nth(history_t *h, TYPE(HistEvent) *ev, in history_deldata_nth() argument
405 if (history_set_nth(h, ev, num) != 0) in history_deldata_nth()
410 ev->str = Strdup(h->cursor->ev.str); in history_deldata_nth()
411 ev->num = h->cursor->ev.num; in history_deldata_nth()
414 history_def_delete(h, ev, h->cursor); in history_deldata_nth()
424 history_def_del(void *p, TYPE(HistEvent) *ev __attribute__((__unused__)), in history_def_del() argument
428 if (history_def_set(h, ev, num) != 0) in history_def_del()
430 ev->str = Strdup(h->cursor->ev.str); in history_def_del()
431 ev->num = h->cursor->ev.num; in history_def_del()
432 history_def_delete(h, ev, h->cursor); in history_def_del()
443 TYPE(HistEvent) *ev __attribute__((__unused__)), hentry_t *hp) in history_def_delete()
445 HistEventPrivate *evp = (void *)&hp->ev; in history_def_delete()
465 history_def_insert(history_t *h, TYPE(HistEvent) *ev, const Char *str) in history_def_insert() argument
472 if ((c->ev.str = h_strdup(str)) == NULL) { in history_def_insert()
477 c->ev.num = ++h->eventid; in history_def_insert()
485 *ev = c->ev; in history_def_insert()
488 he_seterrev(ev, _HE_MALLOC_FAILED); in history_def_insert()
497 history_def_enter(void *p, TYPE(HistEvent) *ev, const Char *str) in history_def_enter() argument
502 Strcmp(h->list.next->ev.str, str) == 0) in history_def_enter()
505 if (history_def_insert(h, ev, str) == -1) in history_def_enter()
513 history_def_delete(h, ev, h->list.prev); in history_def_enter()
524 history_def_init(void **p, TYPE(HistEvent) *ev __attribute__((__unused__)), int n) in history_def_init() argument
536 h->list.ev.str = NULL; in history_def_init()
537 h->list.ev.num = 0; in history_def_init()
549 history_def_clear(void *p, TYPE(HistEvent) *ev) in history_def_clear() argument
554 history_def_delete(h, ev, h->list.prev); in history_def_clear()
571 TYPE(HistEvent) ev; in TYPE()
576 if (history_def_init(&h->h_ref, &ev, 0) == -1) { in TYPE()
602 TYPE(HistEvent) ev; in FUN()
605 history_def_clear(h->h_ref, &ev); in FUN()
616 history_setsize(TYPE(History) *h, TYPE(HistEvent) *ev, int num) in history_setsize() argument
620 he_seterrev(ev, _HE_NOT_ALLOWED); in history_setsize()
624 he_seterrev(ev, _HE_BAD_PARAM); in history_setsize()
636 history_getsize(TYPE(History) *h, TYPE(HistEvent) *ev) in history_getsize() argument
639 he_seterrev(ev, _HE_NOT_ALLOWED); in history_getsize()
642 ev->num = history_def_getsize(h->h_ref); in history_getsize()
643 if (ev->num < -1) { in history_getsize()
644 he_seterrev(ev, _HE_SIZE_NEGATIVE); in history_getsize()
655 history_setunique(TYPE(History) *h, TYPE(HistEvent) *ev, int uni) in history_setunique() argument
659 he_seterrev(ev, _HE_NOT_ALLOWED); in history_setunique()
671 history_getunique(TYPE(History) *h, TYPE(HistEvent) *ev) in history_getunique() argument
674 he_seterrev(ev, _HE_NOT_ALLOWED); in history_getunique()
677 ev->num = history_def_getunique(h->h_ref); in history_getunique()
688 TYPE(HistEvent) ev; in history_set_fun()
695 if (history_def_init(&h->h_ref, &ev, 0) == -1) in history_set_fun()
711 history_def_clear(h->h_ref, &ev); in history_set_fun()
740 TYPE(HistEvent) ev; in history_load()
777 if (HENTER(h, &ev, ct_decode_string(ptr, &conv)) == -1) { in history_load()
797 TYPE(HistEvent) ev; in history_save()
816 for (i = 0, retval = HLAST(h, &ev); in history_save()
818 retval = HPREV(h, &ev), i++) { in history_save()
819 str = ct_encode_string(ev.str, &conv); in history_save()
846 history_prev_event(TYPE(History) *h, TYPE(HistEvent) *ev, int num) in history_prev_event() argument
850 for (retval = HCURR(h, ev); retval != -1; retval = HPREV(h, ev)) in history_prev_event()
851 if (ev->num == num) in history_prev_event()
854 he_seterrev(ev, _HE_NOT_FOUND); in history_prev_event()
860 history_next_evdata(TYPE(History) *h, TYPE(HistEvent) *ev, int num, void **d) in history_next_evdata() argument
864 for (retval = HCURR(h, ev); retval != -1; retval = HPREV(h, ev)) in history_next_evdata()
865 if (ev->num == num) { in history_next_evdata()
871 he_seterrev(ev, _HE_NOT_FOUND); in history_next_evdata()
880 history_next_event(TYPE(History) *h, TYPE(HistEvent) *ev, int num) in history_next_event() argument
884 for (retval = HCURR(h, ev); retval != -1; retval = HNEXT(h, ev)) in history_next_event()
885 if (ev->num == num) in history_next_event()
888 he_seterrev(ev, _HE_NOT_FOUND); in history_next_event()
897 history_prev_string(TYPE(History) *h, TYPE(HistEvent) *ev, const Char *str) in history_prev_string() argument
902 for (retval = HCURR(h, ev); retval != -1; retval = HNEXT(h, ev)) in history_prev_string()
903 if (Strncmp(str, ev->str, len) == 0) in history_prev_string()
906 he_seterrev(ev, _HE_NOT_FOUND); in history_prev_string()
915 history_next_string(TYPE(History) *h, TYPE(HistEvent) *ev, const Char *str) in history_next_string() argument
920 for (retval = HCURR(h, ev); retval != -1; retval = HPREV(h, ev)) in history_next_string()
921 if (Strncmp(str, ev->str, len) == 0) in history_next_string()
924 he_seterrev(ev, _HE_NOT_FOUND); in history_next_string()
933 FUNW(history)(TYPE(History) *h, TYPE(HistEvent) *ev, int fun, ...) in FUNW()
941 he_seterrev(ev, _HE_OK); in FUNW()
945 retval = history_getsize(h, ev); in FUNW()
949 retval = history_setsize(h, ev, va_arg(va, int)); in FUNW()
953 retval = history_getunique(h, ev); in FUNW()
957 retval = history_setunique(h, ev, va_arg(va, int)); in FUNW()
962 retval = HADD(h, ev, str); in FUNW()
966 retval = HDEL(h, ev, va_arg(va, const int)); in FUNW()
971 if ((retval = HENTER(h, ev, str)) != -1) in FUNW()
972 h->h_ent = ev->num; in FUNW()
977 if ((retval = HSET(h, ev, h->h_ent)) != -1) in FUNW()
978 retval = HADD(h, ev, str); in FUNW()
982 retval = HFIRST(h, ev); in FUNW()
986 retval = HNEXT(h, ev); in FUNW()
990 retval = HLAST(h, ev); in FUNW()
994 retval = HPREV(h, ev); in FUNW()
998 retval = HCURR(h, ev); in FUNW()
1002 retval = HSET(h, ev, va_arg(va, const int)); in FUNW()
1006 HCLEAR(h, ev); in FUNW()
1013 he_seterrev(ev, _HE_HIST_READ); in FUNW()
1019 he_seterrev(ev, _HE_HIST_WRITE); in FUNW()
1023 retval = history_prev_event(h, ev, va_arg(va, int)); in FUNW()
1027 retval = history_next_event(h, ev, va_arg(va, int)); in FUNW()
1031 retval = history_prev_string(h, ev, va_arg(va, const Char *)); in FUNW()
1035 retval = history_next_string(h, ev, va_arg(va, const Char *)); in FUNW()
1056 he_seterrev(ev, _HE_PARAM_MISSING); in FUNW()
1069 retval = history_next_evdata(h, ev, num, d); in FUNW()
1077 retval = history_deldata_nth((history_t *)h->h_ref, ev, num, d); in FUNW()
1090 ((history_t *)h->h_ref)->cursor->ev.str = s; in FUNW()
1098 he_seterrev(ev, _HE_UNKNOWN); in FUNW()