]> git.proxmox.com Git - mirror_qemu.git/blame - include/qemu/readline.h
machine: Refactor smp-related call chains to pass MachineState
[mirror_qemu.git] / include / qemu / readline.h
CommitLineData
376253ec
AL
1#ifndef READLINE_H
2#define READLINE_H
3
4c36ba32
AL
4#define READLINE_CMD_BUF_SIZE 4095
5#define READLINE_MAX_CMDS 64
6#define READLINE_MAX_COMPLETIONS 256
7
d5d1507b
SW
8typedef void GCC_FMT_ATTR(2, 3) ReadLinePrintfFunc(void *opaque,
9 const char *fmt, ...);
c60bf339
SH
10typedef void ReadLineFlushFunc(void *opaque);
11typedef void ReadLineFunc(void *opaque, const char *str,
12 void *readline_opaque);
13typedef void ReadLineCompletionFunc(void *opaque,
d2674b2c 14 const char *cmdline);
4c36ba32
AL
15
16typedef struct ReadLineState {
17 char cmd_buf[READLINE_CMD_BUF_SIZE + 1];
18 int cmd_buf_index;
19 int cmd_buf_size;
20
21 char last_cmd_buf[READLINE_CMD_BUF_SIZE + 1];
22 int last_cmd_buf_index;
23 int last_cmd_buf_size;
24
25 int esc_state;
26 int esc_param;
376253ec 27
4c36ba32
AL
28 char *history[READLINE_MAX_CMDS];
29 int hist_entry;
376253ec 30
4c36ba32
AL
31 ReadLineCompletionFunc *completion_finder;
32 char *completions[READLINE_MAX_COMPLETIONS];
33 int nb_completions;
34 int completion_index;
376253ec 35
4c36ba32
AL
36 ReadLineFunc *readline_func;
37 void *readline_opaque;
38 int read_password;
39 char prompt[256];
c60bf339
SH
40
41 ReadLinePrintfFunc *printf_func;
42 ReadLineFlushFunc *flush_func;
43 void *opaque;
4c36ba32 44} ReadLineState;
376253ec 45
4c36ba32
AL
46void readline_add_completion(ReadLineState *rs, const char *str);
47void readline_set_completion_index(ReadLineState *rs, int completion_index);
48
49const char *readline_get_history(ReadLineState *rs, unsigned int index);
50
51void readline_handle_byte(ReadLineState *rs, int ch);
52
53void readline_start(ReadLineState *rs, const char *prompt, int read_password,
c60bf339 54 ReadLineFunc *readline_func, void *readline_opaque);
2724b180 55void readline_restart(ReadLineState *rs);
4c36ba32
AL
56void readline_show_prompt(ReadLineState *rs);
57
c60bf339
SH
58ReadLineState *readline_init(ReadLinePrintfFunc *printf_func,
59 ReadLineFlushFunc *flush_func,
60 void *opaque,
4c36ba32 61 ReadLineCompletionFunc *completion_finder);
e5dc1a6c 62void readline_free(ReadLineState *rs);
376253ec 63
175de524 64#endif /* READLINE_H */