]>
Commit | Line | Data |
---|---|---|
376253ec AL |
1 | #ifndef READLINE_H |
2 | #define READLINE_H | |
3 | ||
4 | #include "qemu-common.h" | |
5 | ||
4c36ba32 AL |
6 | #define READLINE_CMD_BUF_SIZE 4095 |
7 | #define READLINE_MAX_CMDS 64 | |
8 | #define READLINE_MAX_COMPLETIONS 256 | |
9 | ||
376253ec | 10 | typedef void ReadLineFunc(Monitor *mon, const char *str, void *opaque); |
d2674b2c WX |
11 | typedef void ReadLineCompletionFunc(Monitor *mon, |
12 | const char *cmdline); | |
4c36ba32 AL |
13 | |
14 | typedef struct ReadLineState { | |
15 | char cmd_buf[READLINE_CMD_BUF_SIZE + 1]; | |
16 | int cmd_buf_index; | |
17 | int cmd_buf_size; | |
18 | ||
19 | char last_cmd_buf[READLINE_CMD_BUF_SIZE + 1]; | |
20 | int last_cmd_buf_index; | |
21 | int last_cmd_buf_size; | |
22 | ||
23 | int esc_state; | |
24 | int esc_param; | |
376253ec | 25 | |
4c36ba32 AL |
26 | char *history[READLINE_MAX_CMDS]; |
27 | int hist_entry; | |
376253ec | 28 | |
4c36ba32 AL |
29 | ReadLineCompletionFunc *completion_finder; |
30 | char *completions[READLINE_MAX_COMPLETIONS]; | |
31 | int nb_completions; | |
32 | int completion_index; | |
376253ec | 33 | |
4c36ba32 AL |
34 | ReadLineFunc *readline_func; |
35 | void *readline_opaque; | |
36 | int read_password; | |
37 | char prompt[256]; | |
38 | Monitor *mon; | |
39 | } ReadLineState; | |
376253ec | 40 | |
4c36ba32 AL |
41 | void readline_add_completion(ReadLineState *rs, const char *str); |
42 | void readline_set_completion_index(ReadLineState *rs, int completion_index); | |
43 | ||
44 | const char *readline_get_history(ReadLineState *rs, unsigned int index); | |
45 | ||
46 | void readline_handle_byte(ReadLineState *rs, int ch); | |
47 | ||
48 | void readline_start(ReadLineState *rs, const char *prompt, int read_password, | |
376253ec | 49 | ReadLineFunc *readline_func, void *opaque); |
2724b180 | 50 | void readline_restart(ReadLineState *rs); |
4c36ba32 AL |
51 | void readline_show_prompt(ReadLineState *rs); |
52 | ||
53 | ReadLineState *readline_init(Monitor *mon, | |
54 | ReadLineCompletionFunc *completion_finder); | |
376253ec AL |
55 | |
56 | #endif /* !READLINE_H */ |