grafthistory: support curl
[elinks/elinks-j605.git] / src / bfu / inphist.h
blob0011ef9d2018abc22c502b5ac1912820277a00c7
1 #ifndef EL__BFU_INPHIST_H
2 #define EL__BFU_INPHIST_H
4 #include "util/lists.h"
6 struct dialog_data;
9 struct input_history_entry {
10 LIST_HEAD(struct input_history_entry);
11 unsigned char data[1]; /* Must be last. */
14 struct input_history {
15 struct list_head entries;
16 int size;
17 unsigned int dirty:1;
18 unsigned int nosave:1;
21 #define INIT_INPUT_HISTORY(history) \
22 struct input_history history = { \
23 /* items: */ { D_LIST_HEAD(history.entries) }, \
24 /* size: */ 0, \
25 /* dirty: */ 0, \
26 /* nosave: */ 0, \
29 #define add_to_history_list(history, entry) \
30 do { \
31 add_to_list((history)->entries, entry); \
32 (history)->size++; \
33 if (!(history)->nosave) (history)->dirty = 1; \
34 } while (0)
36 #define del_from_history_list(history, entry) \
37 do { \
38 del_from_list((entry)); \
39 (history)->size--; \
40 if (!(history)->nosave) (history)->dirty = 1; \
41 } while (0)
43 void add_to_input_history(struct input_history *, unsigned char *, int);
45 void do_tab_compl(struct dialog_data *, struct list_head *);
46 void do_tab_compl_file(struct dialog_data *, struct list_head *);
47 void do_tab_compl_unambiguous(struct dialog_data *, struct list_head *);
49 /* Load history file from elinks home. */
50 int load_input_history(struct input_history *history, unsigned char *filename);
52 /* Write history list to @filebane in elinks home. It returns a value different
53 * from 0 in case of failure, 0 on success. */
54 int save_input_history(struct input_history *history, unsigned char *filename);
56 void dlg_set_history(struct widget_data *);
58 #endif