PageRenderTime 42ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 0ms

/src/termchar.h

https://gitlab.com/freesoftware/emacs
C Header | 240 lines | 110 code | 58 blank | 72 comment | 3 complexity | 8fda95d2766d7fcf744f92f63a5831ee MD5 | raw file
  1. /* Flags and parameters describing terminal's characteristics.
  2. Copyright (C) 1985-1986, 2001-2022 Free Software Foundation, Inc.
  3. This file is part of GNU Emacs.
  4. GNU Emacs is free software: you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation, either version 3 of the License, or (at
  7. your option) any later version.
  8. GNU Emacs is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
  14. #ifndef EMACS_TERMCHAR_H
  15. #define EMACS_TERMCHAR_H
  16. #include <stdio.h>
  17. #include "dispextern.h"
  18. /* Each termcap frame points to its own struct tty_output object in
  19. the output_data.tty field. The tty_output structure contains the
  20. information that is specific to termcap frames. */
  21. struct tty_output
  22. {
  23. /* The Emacs structure for the tty device this frame is on. */
  24. struct tty_display_info *display_info;
  25. /* There is nothing else here at the moment... */
  26. };
  27. enum { TERMCAP_BUFFER_SIZE = 4096 };
  28. /* Parameters that are shared between frames on the same tty device. */
  29. struct tty_display_info
  30. {
  31. struct tty_display_info *next; /* Chain of all tty devices. */
  32. char *name; /* The name of the device file or 0 if
  33. stdin/stdout. */
  34. char *type; /* The type of the tty. */
  35. /* Input/output */
  36. FILE *input; /* The stream to be used for terminal input.
  37. NULL if the terminal is suspended. */
  38. FILE *output; /* The stream to be used for terminal output.
  39. NULL if the terminal is suspended. */
  40. FILE *termscript; /* If nonzero, send all terminal output
  41. characters to this stream also. */
  42. struct emacs_tty *old_tty; /* The initial tty mode bits */
  43. bool_bf term_initted : 1; /* True if we have been through
  44. init_sys_modes. */
  45. int reference_count; /* Number of frames that are on this display. */
  46. struct terminal *terminal; /* Points back to the generic terminal
  47. structure. This is sometimes handy. */
  48. /* Info on cursor positioning. */
  49. struct cm *Wcm;
  50. /* Redisplay. */
  51. Lisp_Object top_frame; /* The topmost frame on this tty. */
  52. /* The previous frame we displayed on this tty. */
  53. struct frame *previous_frame;
  54. int previous_color_mode;
  55. /* Information about the range of text currently shown in
  56. mouse-face. */
  57. Mouse_HLInfo mouse_highlight;
  58. /* Buffer used internally by termcap (see tgetent in the Termcap
  59. manual). Only init_tty should use this. */
  60. char termcap_term_buffer[TERMCAP_BUFFER_SIZE];
  61. /* Buffer storing terminal description strings (see tgetstr in the
  62. Termcap manual). Only init_tty should use this. */
  63. char termcap_strings_buffer[TERMCAP_BUFFER_SIZE];
  64. /* Strings, numbers and flags taken from the termcap entry. */
  65. const char *TS_ins_line; /* "al" */
  66. const char *TS_ins_multi_lines; /* "AL" (one parameter, # lines to insert) */
  67. const char *TS_bell; /* "bl" */
  68. const char *TS_clr_to_bottom; /* "cd" */
  69. const char *TS_clr_line; /* "ce", clear to end of line */
  70. const char *TS_clr_frame; /* "cl" */
  71. const char *TS_set_scroll_region; /* "cs" (2 params, first line and last line) */
  72. const char *TS_set_scroll_region_1; /* "cS" (4 params: total lines,
  73. lines above scroll region, lines below it,
  74. total lines again) */
  75. const char *TS_del_char; /* "dc" */
  76. const char *TS_del_multi_chars; /* "DC" (one parameter, # chars to delete) */
  77. const char *TS_del_line; /* "dl" */
  78. const char *TS_del_multi_lines; /* "DL" (one parameter, # lines to delete) */
  79. const char *TS_delete_mode; /* "dm", enter character-delete mode */
  80. const char *TS_end_delete_mode; /* "ed", leave character-delete mode */
  81. const char *TS_end_insert_mode; /* "ei", leave character-insert mode */
  82. const char *TS_ins_char; /* "ic" */
  83. const char *TS_ins_multi_chars; /* "IC" (one parameter, # chars to insert) */
  84. const char *TS_insert_mode; /* "im", enter character-insert mode */
  85. const char *TS_pad_inserted_char; /* "ip". Just padding, no commands. */
  86. const char *TS_end_keypad_mode; /* "ke" */
  87. const char *TS_keypad_mode; /* "ks" */
  88. const char *TS_pad_char; /* "pc", char to use as padding */
  89. const char *TS_repeat; /* "rp" (2 params, # times to repeat
  90. and character to be repeated) */
  91. const char *TS_end_standout_mode; /* "se" */
  92. const char *TS_fwd_scroll; /* "sf" */
  93. const char *TS_standout_mode; /* "so" */
  94. const char *TS_rev_scroll; /* "sr" */
  95. const char *TS_end_termcap_modes; /* "te" */
  96. const char *TS_termcap_modes; /* "ti" */
  97. const char *TS_visible_bell; /* "vb" */
  98. const char *TS_cursor_normal; /* "ve" */
  99. const char *TS_cursor_visible; /* "vs" */
  100. const char *TS_cursor_invisible; /* "vi" */
  101. const char *TS_set_window; /* "wi" (4 params, start and end of window,
  102. each as vpos and hpos) */
  103. const char *TS_enter_bold_mode; /* "md" -- turn on bold (extra bright mode). */
  104. const char *TS_enter_italic_mode; /* "ZH" -- turn on italics mode. */
  105. const char *TS_enter_dim_mode; /* "mh" -- turn on half-bright mode. */
  106. const char *TS_enter_reverse_mode; /* "mr" -- enter reverse video mode. */
  107. const char *TS_exit_underline_mode; /* "us" -- start underlining. */
  108. const char *TS_enter_underline_mode; /* "ue" -- end underlining. */
  109. const char *TS_enter_strike_through_mode; /* "smxx" -- turn on strike-through
  110. mode. */
  111. /* "as"/"ae" -- start/end alternate character set. Not really
  112. supported, yet. */
  113. const char *TS_enter_alt_charset_mode;
  114. const char *TS_exit_alt_charset_mode;
  115. const char *TS_exit_attribute_mode; /* "me" -- switch appearances off. */
  116. /* Value of the "NC" (no_color_video) capability, or 0 if not present. */
  117. int TN_no_color_video;
  118. int TN_max_colors; /* "Co" -- number of colors. */
  119. /* "op" -- SVr4 set default pair to its original value. */
  120. const char *TS_orig_pair;
  121. /* "AF"/"AB" or "Sf"/"Sb"-- set ANSI or SVr4 foreground/background color.
  122. 1 param, the color index. */
  123. const char *TS_set_foreground;
  124. const char *TS_set_background;
  125. int TF_hazeltine; /* termcap hz flag. */
  126. int TF_insmode_motion; /* termcap mi flag: can move while in insert mode. */
  127. int TF_standout_motion; /* termcap mi flag: can move while in standout mode. */
  128. int TF_underscore; /* termcap ul flag: _ underlines if over-struck on
  129. non-blank position. Must clear before writing _. */
  130. int TF_teleray; /* termcap xt flag: many weird consequences.
  131. For t1061. */
  132. int RPov; /* # chars to start a TS_repeat */
  133. bool_bf delete_in_insert_mode : 1; /* delete mode == insert mode */
  134. bool_bf costs_set : 1; /* True if costs have been calculated. */
  135. bool_bf insert_mode : 1; /* True when in insert mode. */
  136. bool_bf standout_mode : 1; /* True when in standout mode. */
  137. /* 1 if should obey 0200 bit in input chars as "Meta", 2 if should
  138. keep 0200 bit in input chars. 0 to ignore the 0200 bit. */
  139. int meta_key;
  140. /* Size of window specified by higher levels.
  141. This is the number of lines, from the top of frame downwards,
  142. which can participate in insert-line/delete-line operations.
  143. Effectively it excludes the bottom frame_lines - specified_window_size
  144. lines from those operations. */
  145. int specified_window;
  146. /* Flag used in tty_show/hide_cursor. */
  147. bool_bf cursor_hidden : 1;
  148. /* True means use ^S/^Q for flow control. */
  149. bool_bf flow_control : 1;
  150. /* True means we are displaying a TTY menu on this tty. */
  151. bool_bf showing_menu : 1;
  152. /* True means spaces in the text must actually be output;
  153. can't just skip over some columns to leave them blank. */
  154. bool_bf must_write_spaces : 1;
  155. /* True if TTY can insert and delete lines. */
  156. bool_bf line_ins_del_ok : 1;
  157. /* True if TTY can insert and delete chars. */
  158. bool_bf char_ins_del_ok : 1;
  159. /* True if TTY supports setting the scroll window. */
  160. bool_bf scroll_region_ok : 1;
  161. /* True if TTY remembers lines scrolled off bottom. */
  162. bool_bf memory_below_frame : 1;
  163. /* Cost of setting the scroll window, measured in characters. */
  164. int scroll_region_cost;
  165. };
  166. /* A chain of structures for all tty devices currently in use. */
  167. extern struct tty_display_info *tty_list;
  168. #define FRAME_TTY(f) \
  169. (((f)->output_method == output_termcap \
  170. || (f)->output_method == output_msdos_raw) \
  171. ? (f)->terminal->display_info.tty \
  172. : (emacs_abort (), (struct tty_display_info *) 0))
  173. #define CURTTY() FRAME_TTY (SELECTED_FRAME())
  174. struct input_event;
  175. extern Lisp_Object tty_handle_tab_bar_click (struct frame *, int, int, bool,
  176. struct input_event *);
  177. #endif /* EMACS_TERMCHAR_H */