readline.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. #ifndef READLINE_H
  2. #define READLINE_H
  3. #include "qemu-common.h"
  4. #define READLINE_CMD_BUF_SIZE 4095
  5. #define READLINE_MAX_CMDS 64
  6. #define READLINE_MAX_COMPLETIONS 256
  7. typedef void ReadLineFunc(Monitor *mon, const char *str, void *opaque);
  8. typedef void ReadLineCompletionFunc(const char *cmdline);
  9. typedef struct ReadLineState {
  10. char cmd_buf[READLINE_CMD_BUF_SIZE + 1];
  11. int cmd_buf_index;
  12. int cmd_buf_size;
  13. char last_cmd_buf[READLINE_CMD_BUF_SIZE + 1];
  14. int last_cmd_buf_index;
  15. int last_cmd_buf_size;
  16. int esc_state;
  17. int esc_param;
  18. char *history[READLINE_MAX_CMDS];
  19. int hist_entry;
  20. ReadLineCompletionFunc *completion_finder;
  21. char *completions[READLINE_MAX_COMPLETIONS];
  22. int nb_completions;
  23. int completion_index;
  24. ReadLineFunc *readline_func;
  25. void *readline_opaque;
  26. int read_password;
  27. char prompt[256];
  28. Monitor *mon;
  29. } ReadLineState;
  30. void readline_add_completion(ReadLineState *rs, const char *str);
  31. void readline_set_completion_index(ReadLineState *rs, int completion_index);
  32. const char *readline_get_history(ReadLineState *rs, unsigned int index);
  33. void readline_handle_byte(ReadLineState *rs, int ch);
  34. void readline_start(ReadLineState *rs, const char *prompt, int read_password,
  35. ReadLineFunc *readline_func, void *opaque);
  36. void readline_restart(ReadLineState *rs);
  37. void readline_show_prompt(ReadLineState *rs);
  38. ReadLineState *readline_init(Monitor *mon,
  39. ReadLineCompletionFunc *completion_finder);
  40. #endif /* !READLINE_H */