mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 16:23:55 -06:00
monitor: Introduce ReadLineState (Jan Kiszka)
As another step towards decoupled monitor terminals encapsulate the state of the readline processor in a separate data structure called ReadLineState and adapt all interfaces appropriately. For now the monitor continues to instantiate just a single readline state. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6714 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
bb806047e2
commit
4c36ba3235
3 changed files with 249 additions and 231 deletions
48
readline.h
48
readline.h
|
@ -3,18 +3,52 @@
|
|||
|
||||
#include "qemu-common.h"
|
||||
|
||||
#define READLINE_CMD_BUF_SIZE 4095
|
||||
#define READLINE_MAX_CMDS 64
|
||||
#define READLINE_MAX_COMPLETIONS 256
|
||||
|
||||
typedef void ReadLineFunc(Monitor *mon, const char *str, void *opaque);
|
||||
typedef void ReadLineCompletionFunc(const char *cmdline);
|
||||
|
||||
void readline_add_completion(const char *str);
|
||||
void readline_set_completion_index(int index);
|
||||
void readline_find_completion(const char *cmdline);
|
||||
typedef struct ReadLineState {
|
||||
char cmd_buf[READLINE_CMD_BUF_SIZE + 1];
|
||||
int cmd_buf_index;
|
||||
int cmd_buf_size;
|
||||
|
||||
const char *readline_get_history(unsigned int index);
|
||||
char last_cmd_buf[READLINE_CMD_BUF_SIZE + 1];
|
||||
int last_cmd_buf_index;
|
||||
int last_cmd_buf_size;
|
||||
|
||||
void readline_handle_byte(int ch);
|
||||
int esc_state;
|
||||
int esc_param;
|
||||
|
||||
void readline_start(const char *prompt, int is_password,
|
||||
char *history[READLINE_MAX_CMDS];
|
||||
int hist_entry;
|
||||
|
||||
ReadLineCompletionFunc *completion_finder;
|
||||
char *completions[READLINE_MAX_COMPLETIONS];
|
||||
int nb_completions;
|
||||
int completion_index;
|
||||
|
||||
ReadLineFunc *readline_func;
|
||||
void *readline_opaque;
|
||||
int read_password;
|
||||
char prompt[256];
|
||||
Monitor *mon;
|
||||
} ReadLineState;
|
||||
|
||||
void readline_add_completion(ReadLineState *rs, const char *str);
|
||||
void readline_set_completion_index(ReadLineState *rs, int completion_index);
|
||||
|
||||
const char *readline_get_history(ReadLineState *rs, unsigned int index);
|
||||
|
||||
void readline_handle_byte(ReadLineState *rs, int ch);
|
||||
|
||||
void readline_start(ReadLineState *rs, const char *prompt, int read_password,
|
||||
ReadLineFunc *readline_func, void *opaque);
|
||||
void readline_show_prompt(void);
|
||||
void readline_show_prompt(ReadLineState *rs);
|
||||
|
||||
ReadLineState *readline_init(Monitor *mon,
|
||||
ReadLineCompletionFunc *completion_finder);
|
||||
|
||||
#endif /* !READLINE_H */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue