Blob


1 /*
2 * Copyright (c) 2021, 2024 Omar Polo <op@omarpolo.com>
3 *
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
17 struct hist;
19 #define HIST_LINEAR 0x0
20 #define HIST_WRAP 0x1
22 struct hist *hist_new(int);
23 void hist_free(struct hist *);
24 void hist_erase(struct hist *);
26 size_t hist_size(struct hist *);
27 size_t hist_off(struct hist *);
29 const char *hist_cur(struct hist *);
30 int hist_cur_offs(struct hist *, size_t *, size_t *);
32 int hist_set_cur(struct hist *, const char *);
33 int hist_set_offs(struct hist *, size_t, size_t);
35 const char *hist_nth(struct hist *, size_t);
36 const char *hist_prev(struct hist *);
37 const char *hist_next(struct hist *);
39 void hist_seek_start(struct hist *);
41 int hist_push(struct hist *, const char *);
42 int hist_prepend(struct hist *, const char *);
43 int hist_append(struct hist *, const char *);