MIRROR: javascript for 馃悳's, a tiny runtime with big ambitions
1#ifndef ANT_READLINE_H
2#define ANT_READLINE_H
3
4#include <stdbool.h>
5#include "highlight.h"
6
7typedef struct {
8 char **lines;
9 int count;
10 int capacity;
11 int current;
12} ant_history_t;
13
14typedef enum {
15 ANT_READLINE_LINE,
16 ANT_READLINE_EOF,
17 ANT_READLINE_INTERRUPT,
18} ant_readline_result_t;
19
20void ant_readline_install_signal_handler(void);
21void ant_readline_shutdown(void);
22
23void ant_history_init(ant_history_t *hist, int capacity);
24void ant_history_add(ant_history_t *hist, const char *line);
25void ant_history_load(ant_history_t *hist);
26void ant_history_save(const ant_history_t *hist);
27void ant_history_free(ant_history_t *hist);
28
29const char *ant_history_prev(ant_history_t *hist);
30const char *ant_history_next(ant_history_t *hist);
31
32ant_readline_result_t ant_readline(
33 ant_history_t *hist,
34 const char *prompt,
35 highlight_state line_state,
36 char **out_line
37);
38
39#endif