terminal.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. /* terminal.h -- The external interface to terminal I/O.
  2. $Id$
  3. Copyright 1993, 1996, 1997, 2001, 2002, 2004, 2007, 2013, 2014, 2015
  4. Free Software Foundation, Inc.
  5. This program is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, either version 3 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. Originally uWritten by Brian Fox. */
  16. #if !defined (TERMINAL_H)
  17. #define TERMINAL_H
  18. #include "info.h"
  19. /* For almost every function externally visible from terminal.c, there is
  20. a corresponding "hook" function which can be bound in order to replace
  21. the functionality of the one found in terminal.c. This is how we go
  22. about implemented X window display. */
  23. /* The width and height of the terminal. */
  24. extern int screenwidth, screenheight;
  25. /* Non-zero means this terminal can't really do anything. */
  26. extern int terminal_is_dumb_p;
  27. /* Non-zero means that this terminal can produce a visible bell. */
  28. extern int terminal_has_visible_bell_p;
  29. /* Non-zero means to use that visible bell if at all possible. */
  30. extern int terminal_use_visible_bell_p;
  31. /* Non-zero means that this terminal can scroll lines up and down. */
  32. extern int terminal_can_scroll;
  33. /* Non-zero means that this terminal can scroll within a restricted region. */
  34. extern int terminal_can_scroll_region;
  35. /* Initialize the terminal which is known as TERMINAL_NAME. If this terminal
  36. doesn't have cursor addressability, TERMINAL_IS_DUMB_P becomes non-zero.
  37. The variables SCREENHEIGHT and SCREENWIDTH are set to the dimensions that
  38. this terminal actually has. */
  39. extern void terminal_initialize_terminal (char *terminal_name);
  40. extern VFunction *terminal_initialize_terminal_hook;
  41. /* Return the current screen width and height in the variables
  42. SCREENWIDTH and SCREENHEIGHT. */
  43. extern void terminal_get_screen_size (void);
  44. extern VFunction *terminal_get_screen_size_hook;
  45. /* Save and restore tty settings. */
  46. extern int terminal_prep_terminal (void);
  47. extern void terminal_unprep_terminal (void);
  48. extern VFunction *terminal_prep_terminal_hook;
  49. extern VFunction *terminal_unprep_terminal_hook;
  50. /* Re-initialize the terminal to TERMINAL_NAME. */
  51. extern void terminal_new_terminal (char *terminal_name);
  52. extern VFunction *terminal_new_terminal_hook;
  53. /* Move the cursor to the terminal location of X and Y. */
  54. extern void terminal_goto_xy (int x, int y);
  55. extern VFunction *terminal_goto_xy_hook;
  56. /* Print STRING to the terminal at the current position. */
  57. extern void terminal_put_text (char *string);
  58. extern VFunction *terminal_put_text_hook;
  59. /* Print NCHARS from STRING to the terminal at the current position. */
  60. extern void terminal_write_chars (char *string, int nchars);
  61. extern VFunction *terminal_write_chars_hook;
  62. /* Clear from the current position of the cursor to the end of the line. */
  63. extern void terminal_clear_to_eol (void);
  64. extern VFunction *terminal_clear_to_eol_hook;
  65. /* Clear the entire terminal screen. */
  66. extern void terminal_clear_screen (void);
  67. extern VFunction *terminal_clear_screen_hook;
  68. /* Move the cursor up one line. */
  69. extern void terminal_up_line (void);
  70. extern VFunction *terminal_up_line_hook;
  71. /* Move the cursor down one line. */
  72. extern void terminal_down_line (void);
  73. extern VFunction *terminal_down_line_hook;
  74. /* Turn on reverse video if possible. */
  75. extern void terminal_begin_inverse (void);
  76. extern VFunction *terminal_begin_inverse_hook;
  77. /* Turn off reverse video if possible. */
  78. extern void terminal_end_inverse (void);
  79. extern VFunction *terminal_end_inverse_hook;
  80. /* Turn on standout mode if possible. */
  81. extern void terminal_begin_standout (void);
  82. extern VFunction *terminal_begin_standout_hook;
  83. /* Turn off standout mode if possible. */
  84. extern void terminal_end_standout (void);
  85. extern VFunction *terminal_end_standout_hook;
  86. /* Turn on and off underline mode if possible. */
  87. void terminal_begin_underline (void);
  88. extern VFunction *terminal_begin_underline_hook;
  89. void terminal_end_underline (void);
  90. extern VFunction *terminal_end_underline_hook;
  91. /* Scroll an area of the terminal, starting with the region from START
  92. to END, AMOUNT lines. If AMOUNT is negative, the lines are scrolled
  93. towards the top of the screen, else they are scrolled towards the
  94. bottom of the screen. */
  95. extern void terminal_scroll_terminal (int start, int end, int amount);
  96. extern VFunction *terminal_scroll_terminal_hook;
  97. extern void terminal_scroll_region (int start, int end, int amount);
  98. /* Ring the terminal bell. The bell is run visibly if it both has one and
  99. terminal_use_visible_bell_p is non-zero. */
  100. extern void terminal_ring_bell (void);
  101. extern VFunction *terminal_ring_bell_hook;
  102. /* The key sequences output by special keys, if this terminal has any. */
  103. extern char *term_ku, *term_kd, *term_kr, *term_kl;
  104. extern char *term_kP, *term_kN;
  105. extern char *term_ke, *term_kh;
  106. extern char *term_kD, *term_ki;
  107. extern char *term_kB;
  108. extern char *term_so, *term_se;
  109. #define MP_NONE 0
  110. #define MP_NORMAL_TRACKING 1
  111. extern int mouse_protocol;
  112. #define COLOUR_MASK 000000000017
  113. #define COLOUR_BLACK (8 + 0)
  114. #define COLOUR_RED (8 + 1)
  115. #define COLOUR_GREEN (8 + 2)
  116. #define COLOUR_YELLOW (8 + 3)
  117. #define COLOUR_BLUE (8 + 4)
  118. #define COLOUR_MAGENTA (8 + 5)
  119. #define COLOUR_CYAN (8 + 6)
  120. #define COLOUR_WHITE (8 + 7)
  121. #define UNDERLINE_MASK 000000000020
  122. #define STANDOUT_MASK 000000000040
  123. #define BOLD_MASK 000000000100
  124. #define ZERO1_MASK 000000000200
  125. #define BLINK_MASK 000000000400
  126. #define BGCOLOUR_MASK 000000017000
  127. #define BGCOLOUR_BLACK ((8 + 0) << 9)
  128. #define BGCOLOUR_RED ((8 + 1) << 9)
  129. #define BGCOLOUR_GREEN ((8 + 2) << 9)
  130. #define BGCOLOUR_YELLOW ((8 + 3) << 9)
  131. #define BGCOLOUR_BLUE ((8 + 4) << 9)
  132. #define BGCOLOUR_MAGENTA ((8 + 5) << 9)
  133. #define BGCOLOUR_CYAN ((8 + 6) << 9)
  134. #define BGCOLOUR_WHITE ((8 + 7) << 9)
  135. #define ZERO2_MASK 000000100000
  136. #define ZERO3_MASK 000040000000
  137. #define ZERO4_MASK 020000000000
  138. /* ZEROi_MASK are always zero bits. */
  139. void terminal_switch_rendition (unsigned long desired_rendition);
  140. #endif /* !TERMINAL_H */