terminal.h 967 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /* SPDX-License-Identifier: Apache-2.0 */
  2. /*
  3. * Copyright (C) 2013 Intel Corporation
  4. *
  5. */
  6. #include <stdarg.h>
  7. /* size of supported line */
  8. #define LINE_BUF_MAX 1024
  9. enum key_codes {
  10. KEY_BACKSPACE = 0x7F,
  11. KEY_INSERT = 1000, /* arbitrary value */
  12. KEY_DELETE,
  13. KEY_HOME,
  14. KEY_END,
  15. KEY_PGUP,
  16. KEY_PGDOWN,
  17. KEY_LEFT,
  18. KEY_RIGHT,
  19. KEY_UP,
  20. KEY_DOWN,
  21. KEY_CLEFT,
  22. KEY_CRIGHT,
  23. KEY_CUP,
  24. KEY_CDOWN,
  25. KEY_SLEFT,
  26. KEY_SRIGHT,
  27. KEY_SUP,
  28. KEY_SDOWN,
  29. KEY_MLEFT,
  30. KEY_MRIGHT,
  31. KEY_MUP,
  32. KEY_MDOWN,
  33. KEY_STAB,
  34. KEY_M_p,
  35. KEY_M_n
  36. };
  37. typedef void (*line_callback)(char *);
  38. void terminal_setup(void);
  39. int terminal_print(const char *format, ...);
  40. int terminal_vprint(const char *format, va_list args);
  41. void terminal_process_char(int c, line_callback process_line);
  42. void terminal_insert_into_command_line(const char *p);
  43. void terminal_draw_command_line(void);
  44. void terminal_prompt_for(const char *s, line_callback process_line);
  45. void process_tab(const char *line, int len);