iconv: Bail out of the loop when an illegal sequence of bytes occurs.
[elinks/elinks-j605.git] / src / bfu / inphist.h
blobd7a5ecf08864c880d203dff4a791ccbee00cc124
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 LIST_OF(struct input_history_entry) 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 *,
46 LIST_OF(struct input_history_entry) *);
47 void do_tab_compl_file(struct dialog_data *,
48 LIST_OF(struct input_history_entry) *);
49 void do_tab_compl_unambiguous(struct dialog_data *,
50 LIST_OF(struct input_history_entry) *);
52 /* Load history file from elinks home. */
53 int load_input_history(struct input_history *history, unsigned char *filename);
55 /* Write history list to @filebane in elinks home. It returns a value different
56 * from 0 in case of failure, 0 on success. */
57 int save_input_history(struct input_history *history, unsigned char *filename);
59 void dlg_set_history(struct widget_data *);
61 #endif