| 1 | /* Flags and parameters describing terminal's characteristics. |
| 2 | Copyright (C) 1985, 1986, 2003 Free Software Foundation, Inc. |
| 3 | |
| 4 | This file is part of GNU Emacs. |
| 5 | |
| 6 | GNU Emacs is free software; you can redistribute it and/or modify |
| 7 | it under the terms of the GNU General Public License as published by |
| 8 | the Free Software Foundation; either version 2, or (at your option) |
| 9 | any later version. |
| 10 | |
| 11 | GNU Emacs is distributed in the hope that it will be useful, |
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | GNU General Public License for more details. |
| 15 | |
| 16 | You should have received a copy of the GNU General Public License |
| 17 | along with GNU Emacs; see the file COPYING. If not, write to |
| 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
| 19 | Boston, MA 02111-1307, USA. */ |
| 20 | |
| 21 | /* Each termcap frame points to its own struct tty_output object in |
| 22 | the output_data.tty field. The tty_output structure contains the |
| 23 | information that is specific to termcap frames. */ |
| 24 | |
| 25 | struct tty_output |
| 26 | { |
| 27 | /* The Emacs structure for the tty device this frame is on. */ |
| 28 | struct tty_display_info *display_info; |
| 29 | |
| 30 | /* There is nothing else here at the moment... */ |
| 31 | }; |
| 32 | |
| 33 | /* Parameters that are shared between frames on the same tty device. */ |
| 34 | |
| 35 | struct tty_display_info |
| 36 | { |
| 37 | struct tty_display_info *next; /* Chain of all tty devices. */ |
| 38 | |
| 39 | char *name; /* The name of the device file or 0 if |
| 40 | stdin/stdout. */ |
| 41 | char *type; /* The type of the tty. */ |
| 42 | |
| 43 | /* Input/output */ |
| 44 | |
| 45 | FILE *input; /* The stream to be used for terminal input. */ |
| 46 | FILE *output; /* The stream to be used for terminal output. */ |
| 47 | |
| 48 | FILE *termscript; /* If nonzero, send all terminal output |
| 49 | characters to this stream also. */ |
| 50 | |
| 51 | struct emacs_tty *old_tty; /* The initial tty mode bits */ |
| 52 | |
| 53 | int term_initted; /* 1 if we have been through init_sys_modes. */ |
| 54 | |
| 55 | |
| 56 | int reference_count; /* Number of frames that are on this display. */ |
| 57 | |
| 58 | struct display *display; /* Points back to the generic display |
| 59 | structure. This is sometimes handy. */ |
| 60 | |
| 61 | /* Info on cursor positioning. */ |
| 62 | struct cm *Wcm; |
| 63 | |
| 64 | /* Redisplay. */ |
| 65 | |
| 66 | /* XXX GC does not know about this; is this a problem? */ |
| 67 | Lisp_Object top_frame; /* The topmost frame on this tty. */ |
| 68 | |
| 69 | /* The previous terminal frame we displayed on this tty. */ |
| 70 | struct frame *previous_terminal_frame; |
| 71 | |
| 72 | /* Strings, numbers and flags taken from the termcap entry. */ |
| 73 | |
| 74 | char *TS_ins_line; /* "al" */ |
| 75 | char *TS_ins_multi_lines; /* "AL" (one parameter, # lines to insert) */ |
| 76 | char *TS_bell; /* "bl" */ |
| 77 | char *TS_clr_to_bottom; /* "cd" */ |
| 78 | char *TS_clr_line; /* "ce", clear to end of line */ |
| 79 | char *TS_clr_frame; /* "cl" */ |
| 80 | char *TS_set_scroll_region; /* "cs" (2 params, first line and last line) */ |
| 81 | char *TS_set_scroll_region_1; /* "cS" (4 params: total lines, |
| 82 | lines above scroll region, lines below it, |
| 83 | total lines again) */ |
| 84 | char *TS_del_char; /* "dc" */ |
| 85 | char *TS_del_multi_chars; /* "DC" (one parameter, # chars to delete) */ |
| 86 | char *TS_del_line; /* "dl" */ |
| 87 | char *TS_del_multi_lines; /* "DL" (one parameter, # lines to delete) */ |
| 88 | char *TS_delete_mode; /* "dm", enter character-delete mode */ |
| 89 | char *TS_end_delete_mode; /* "ed", leave character-delete mode */ |
| 90 | char *TS_end_insert_mode; /* "ei", leave character-insert mode */ |
| 91 | char *TS_ins_char; /* "ic" */ |
| 92 | char *TS_ins_multi_chars; /* "IC" (one parameter, # chars to insert) */ |
| 93 | char *TS_insert_mode; /* "im", enter character-insert mode */ |
| 94 | char *TS_pad_inserted_char; /* "ip". Just padding, no commands. */ |
| 95 | char *TS_end_keypad_mode; /* "ke" */ |
| 96 | char *TS_keypad_mode; /* "ks" */ |
| 97 | char *TS_pad_char; /* "pc", char to use as padding */ |
| 98 | char *TS_repeat; /* "rp" (2 params, # times to repeat |
| 99 | and character to be repeated) */ |
| 100 | char *TS_end_standout_mode; /* "se" */ |
| 101 | char *TS_fwd_scroll; /* "sf" */ |
| 102 | char *TS_standout_mode; /* "so" */ |
| 103 | char *TS_rev_scroll; /* "sr" */ |
| 104 | char *TS_end_termcap_modes; /* "te" */ |
| 105 | char *TS_termcap_modes; /* "ti" */ |
| 106 | char *TS_visible_bell; /* "vb" */ |
| 107 | char *TS_cursor_normal; /* "ve" */ |
| 108 | char *TS_cursor_visible; /* "vs" */ |
| 109 | char *TS_cursor_invisible; /* "vi" */ |
| 110 | char *TS_set_window; /* "wi" (4 params, start and end of window, |
| 111 | each as vpos and hpos) */ |
| 112 | |
| 113 | char *TS_enter_bold_mode; /* "md" -- turn on bold (extra bright mode). */ |
| 114 | char *TS_enter_dim_mode; /* "mh" -- turn on half-bright mode. */ |
| 115 | char *TS_enter_blink_mode; /* "mb" -- enter blinking mode. */ |
| 116 | char *TS_enter_reverse_mode; /* "mr" -- enter reverse video mode. */ |
| 117 | char *TS_exit_underline_mode; /* "us" -- start underlining. */ |
| 118 | char *TS_enter_underline_mode; /* "ue" -- end underlining. */ |
| 119 | |
| 120 | /* "as"/"ae" -- start/end alternate character set. Not really |
| 121 | supported, yet. */ |
| 122 | char *TS_enter_alt_charset_mode; |
| 123 | char *TS_exit_alt_charset_mode; |
| 124 | |
| 125 | char *TS_exit_attribute_mode; /* "me" -- switch appearances off. */ |
| 126 | |
| 127 | /* Value of the "NC" (no_color_video) capability, or 0 if not present. */ |
| 128 | int TN_no_color_video; |
| 129 | |
| 130 | int TN_max_colors; /* "Co" -- number of colors. */ |
| 131 | |
| 132 | /* "pa" -- max. number of color pairs on screen. Not handled yet. |
| 133 | Could be a problem if not equal to TN_max_colors * TN_max_colors. */ |
| 134 | int TN_max_pairs; |
| 135 | |
| 136 | /* "op" -- SVr4 set default pair to its original value. */ |
| 137 | char *TS_orig_pair; |
| 138 | |
| 139 | /* "AF"/"AB" or "Sf"/"Sb"-- set ANSI or SVr4 foreground/background color. |
| 140 | 1 param, the color index. */ |
| 141 | char *TS_set_foreground; |
| 142 | char *TS_set_background; |
| 143 | |
| 144 | int TF_hazeltine; /* termcap hz flag. */ |
| 145 | int TF_insmode_motion; /* termcap mi flag: can move while in insert mode. */ |
| 146 | int TF_standout_motion; /* termcap mi flag: can move while in standout mode. */ |
| 147 | int TF_underscore; /* termcap ul flag: _ underlines if over-struck on |
| 148 | non-blank position. Must clear before writing _. */ |
| 149 | int TF_teleray; /* termcap xt flag: many weird consequences. |
| 150 | For t1061. */ |
| 151 | |
| 152 | int RPov; /* # chars to start a TS_repeat */ |
| 153 | |
| 154 | int delete_in_insert_mode; /* delete mode == insert mode */ |
| 155 | |
| 156 | int se_is_so; /* 1 if same string both enters and leaves |
| 157 | standout mode */ |
| 158 | |
| 159 | int costs_set; /* Nonzero if costs have been calculated. */ |
| 160 | |
| 161 | int insert_mode; /* Nonzero when in insert mode. */ |
| 162 | int standout_mode; /* Nonzero when in standout mode. */ |
| 163 | |
| 164 | |
| 165 | |
| 166 | /* 1 if should obey 0200 bit in input chars as "Meta", 2 if should |
| 167 | keep 0200 bit in input chars. 0 to ignore the 0200 bit. */ |
| 168 | |
| 169 | int meta_key; |
| 170 | |
| 171 | /* Size of window specified by higher levels. |
| 172 | This is the number of lines, from the top of frame downwards, |
| 173 | which can participate in insert-line/delete-line operations. |
| 174 | |
| 175 | Effectively it excludes the bottom frame_lines - specified_window_size |
| 176 | lines from those operations. */ |
| 177 | |
| 178 | int specified_window; |
| 179 | |
| 180 | /* Flag used in tty_show/hide_cursor. */ |
| 181 | |
| 182 | int cursor_hidden; |
| 183 | |
| 184 | /* Nonzero means use ^S/^Q for flow control. */ |
| 185 | int flow_control; |
| 186 | |
| 187 | #ifdef MULTI_KBOARD |
| 188 | /* The terminal's keyboard object. */ |
| 189 | struct kboard *kboard; |
| 190 | #endif |
| 191 | }; |
| 192 | |
| 193 | /* A chain of structures for all tty devices currently in use. */ |
| 194 | extern struct tty_display_info *tty_list; |
| 195 | |
| 196 | |
| 197 | #define FRAME_TTY(f) \ |
| 198 | ((f)->output_method == output_termcap \ |
| 199 | ? (f)->display->display_info.tty \ |
| 200 | : (abort(), (struct tty_display_info *) 0)) |
| 201 | |
| 202 | #define CURTTY() FRAME_TTY (SELECTED_FRAME()) |
| 203 | |
| 204 | #define TTY_INPUT(t) ((t)->input) |
| 205 | #define TTY_OUTPUT(t) ((t)->output) |
| 206 | #define TTY_TERMSCRIPT(t) ((t)->termscript) |
| 207 | |
| 208 | /* arch-tag: bf9f0d49-842b-42fb-9348-ec8759b27193 |
| 209 | (do not change this comment) */ |