annotate src/console-tty.h @ 733:b1f74adcc1ff

[xemacs-hg @ 2002-01-22 20:40:00 by janv] Fix disabled-command-hook
author janv
date Tue, 22 Jan 2002 20:40:03 +0000
parents 190b164ddcac
children 84762348c6f9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 /* Define TTY specific console, device, and frame object for XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 Copyright (C) 1995 Board of Trustees, University of Illinois.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
3 Copyright (C) 1996 Ben Wing.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5 This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 Free Software Foundation; either version 2, or (at your option) any
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 along with XEmacs; see the file COPYING. If not, write to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 Boston, MA 02111-1307, USA. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22 /* Synched up with: Not in FSF. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24 /* Written by Chuck Thompson and Ben Wing. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 /* NOTE: Currently each TTY console can have only one device.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 Therefore, all stuff for both input and output is lumped into
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 the console structure. If it ever becomes meaningful to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29 have more than one device on a TTY console, the output stuff
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30 will have to get separated out. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
31
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
32 #ifndef INCLUDED_console_tty_h_
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
33 #define INCLUDED_console_tty_h_
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 #include "console.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
36 #include "syssignal.h" /* Always include before systty.h */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
37 #include "systty.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
38
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
39 DECLARE_CONSOLE_TYPE (tty);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
40
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 struct tty_console
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 int infd, outfd;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44 Lisp_Object instream, outstream;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 Lisp_Object terminal_type;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 Lisp_Object controlling_process;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 char *term_entry_buffer;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 /* Physical location of cursor on this console. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 int cursor_x;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 int cursor_y;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
53 /* The real location of the cursor. The above physical location may
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
54 be ahead of where we really are. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
55 int real_cursor_x;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
56 int real_cursor_y;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
57
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
58 int final_cursor_x;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
59 int final_cursor_y;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
60
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61 int height;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
62 int width;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
63
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 /* The count of frame number. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
65 int frame_count;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
67 /* flags indicating presence, absence or value of various features */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 struct
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 unsigned int must_write_spaces :1; /* terminal inserts nulls, not
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 spaces to fill whitespace on
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 screen */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73 unsigned int insert_mode_motion :1; /* cursor movement commands
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
74 work while in insert mode */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
75 unsigned int standout_motion :1; /* cursor movement is graceful
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
76 in standout or underline mode */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
77 unsigned int memory_above_frame :1; /* display retained above screen */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
78 unsigned int memory_below_frame :1; /* display retained below screen */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 unsigned int meta_key :2; /* 0 == mask off top bit;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
80 1 == top bit is meta;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
81 2 == top bit is useful as
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82 character info */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 unsigned int flow_control :1; /* Nonzero means use ^S/^Q as
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 cretinous flow control. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85 int standout_width; /* # of spaces printed when
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86 change to standout mode */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 int underline_width; /* # of spaces printed when
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 change to underline mode */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 } flags;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 /* cursor motion entries - each entry is commented with the terminfo
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 and the termcap entry */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 struct
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 /* local cursor movement */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
96 const char *up; /* cuu1, up */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
97 const char *down; /* cud1, do */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
98 const char *left; /* cub1, le */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
99 const char *right; /* cuf1, nd */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
100 const char *home; /* home, ho */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
101 const char *low_left; /* ll, ll */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
102 const char *car_return; /* cr, cr */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 /* parameterized local cursor movement */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
105 const char *multi_up; /* cuu, UP */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
106 const char *multi_down; /* cud, DO */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
107 const char *multi_left; /* cub, LE */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
108 const char *multi_right; /* cuf, RI */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 /* absolute cursor motion */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
111 const char *abs; /* cup, cm */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
112 const char *hor_abs; /* hpa, ch */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
113 const char *ver_abs; /* vpa, cv */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 /* scrolling */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
116 const char *scroll_forw; /* ind, sf */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
117 const char *scroll_back; /* ri, sr */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
118 const char *multi_scroll_forw; /* indn, SF */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
119 const char *multi_scroll_back; /* rin, SR */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
120 const char *set_scroll_region; /* csr, cs */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 } cm;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 /* screen editing entries - each entry is commented with the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124 terminfo and the termcap entry */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 struct
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 /* adding to the screen */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
128 const char *ins_line; /* il1, al */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
129 const char *multi_ins_line; /* il, AL */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
130 const char *repeat; /* rep, rp */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
131 const char *begin_ins_mode; /* smir, im */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
132 const char *end_ins_mode; /* rmir, ei */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
133 const char *ins_char; /* ich1, ic */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
134 const char *multi_ins_char; /* ich, IC */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
135 const char *insert_pad; /* ip, ip */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137 /* deleting from the screen */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
138 const char *clr_frame; /* clear, cl */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
139 const char *clr_from_cursor; /* ed, cd */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
140 const char *clr_to_eol; /* el, ce */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
141 const char *del_line; /* dl1, dl */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
142 const char *multi_del_line; /* dl, DL */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
143 const char *del_char; /* dch1, dc */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
144 const char *multi_del_char; /* dch, DC */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
145 const char *begin_del_mode; /* smdc, dm */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
146 const char *end_del_mode; /* rmdc, ed */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
147 const char *erase_at_cursor; /* ech, ec */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
148 } se;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
149
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
150 /* screen display entries - each entry is commented with the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
151 terminfo and termcap entry */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
152 struct
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
153 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
154 const char *begin_standout; /* smso, so */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
155 const char *end_standout; /* rmso, se */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
156 const char *begin_underline; /* smul, us */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
157 const char *end_underline; /* rmul, ue */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
158 const char *begin_alternate; /* smacs, as */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
159 const char *end_alternate; /* rmacs, ae */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
160
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
161 const char *turn_on_reverse; /* rev, mr */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
162 const char *turn_on_blinking; /* blink, mb */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
163 const char *turn_on_bold; /* bold, md */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
164 const char *turn_on_dim; /* dim, mh */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
165 const char *turn_off_attributes; /* sgr0, me */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
166
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
167 const char *visual_bell; /* flash, vb */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
168 const char *audio_bell; /* bel, bl */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
170 const char *cursor_visible; /* cvvis, vs */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
171 const char *cursor_normal; /* cnorm, ve */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
172 const char *init_motion; /* smcup, ti */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
173 const char *end_motion; /* rmcup, te */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
174 const char *keypad_on; /* smkx, ks */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
175 const char *keypad_off; /* rmkx, ke */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
176
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
177 const char *orig_pair; /* op, op */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
178 } sd;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
179
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
180 /* costs of various operations */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
181 struct
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
182 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
183 int cm_up;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
184 int cm_down;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
185 int cm_left;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
186 int cm_right;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
187 int cm_home;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
188 int cm_low_left;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
189 int cm_car_return;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
190 int cm_abs;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
191 int cm_hor_abs;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
192 int cm_ver_abs;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
193 } cost;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
194
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
195 /* The initial tty mode bits */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
196 struct emacs_tty old_tty;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
197
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198 /* Is this TTY our controlling terminal? */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
199 unsigned int controlling_terminal :1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200 unsigned int is_stdio :1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
202
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203 #define CONSOLE_TTY_DATA(c) CONSOLE_TYPE_DATA (c, tty)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
204 #define CONSOLE_TTY_CURSOR_X(c) (CONSOLE_TTY_DATA (c)->cursor_x)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
205 #define CONSOLE_TTY_CURSOR_Y(c) (CONSOLE_TTY_DATA (c)->cursor_y)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
206 #define CONSOLE_TTY_REAL_CURSOR_X(c) (CONSOLE_TTY_DATA (c)->real_cursor_x)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207 #define CONSOLE_TTY_REAL_CURSOR_Y(c) (CONSOLE_TTY_DATA (c)->real_cursor_y)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208 #define CONSOLE_TTY_FINAL_CURSOR_X(c) (CONSOLE_TTY_DATA (c)->final_cursor_x)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 #define CONSOLE_TTY_FINAL_CURSOR_Y(c) (CONSOLE_TTY_DATA (c)->final_cursor_y)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211 #define TTY_CM(c) (CONSOLE_TTY_DATA (c)->cm)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212 #define TTY_SE(c) (CONSOLE_TTY_DATA (c)->se)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213 #define TTY_SD(c) (CONSOLE_TTY_DATA (c)->sd)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214 #define TTY_FLAGS(c) (CONSOLE_TTY_DATA (c)->flags)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215 #define TTY_COST(c) (CONSOLE_TTY_DATA (c)->cost)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217 #define TTY_INC_CURSOR_X(c, n) do { \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
218 int TICX_n = (n); \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
219 assert (CONSOLE_TTY_CURSOR_X (c) == CONSOLE_TTY_REAL_CURSOR_X (c)); \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220 CONSOLE_TTY_CURSOR_X (c) += TICX_n; \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
221 CONSOLE_TTY_REAL_CURSOR_X (c) += TICX_n; \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
222 } while (0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
224 #define TTY_INC_CURSOR_Y(c, n) do { \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
225 int TICY_n = (n); \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226 CONSOLE_TTY_CURSOR_Y (c) += TICY_n; \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
227 CONSOLE_TTY_REAL_CURSOR_Y (c) += TICY_n; \
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
228 } while (0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
230 struct tty_device
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
231 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
232 #ifdef HAVE_TERMIOS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
233 speed_t ospeed; /* Output speed (from sg_ospeed) */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
234 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235 short ospeed; /* Output speed (from sg_ospeed) */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
236 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
237 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
238
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
239 #define DEVICE_TTY_DATA(d) DEVICE_TYPE_DATA (d, tty)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
240
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
241 /* termcap requires this to be global */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
242 #ifndef HAVE_TERMIOS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
243 extern short ospeed; /* Output speed (from sg_ospeed) */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
244 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
245
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
246 extern FILE *termscript;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
247
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
248 EXFUN (Fconsole_tty_controlling_process, 1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
249
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
250 /****************** Prototypes from cm.c *******************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
251
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
252 /* #### Verify that all of these are still needed. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
253
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
254 void cm_cost_init (struct console *c);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
255 void cmputc (int c);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
256 void cmgoto (struct frame *f, int row, int col);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
257 extern struct console *cmputc_console;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
258 void send_string_to_tty_console (struct console *c, unsigned char *str,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
259 int len);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
260
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
261
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
262 /*************** Prototypes from redisplay-tty.c ****************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
263
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
264 enum term_init_status
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
265 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
266 TTY_UNABLE_OPEN_DATABASE,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
267 TTY_TYPE_UNDEFINED,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
268 TTY_TYPE_INSUFFICIENT,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
269 TTY_SIZE_UNSPECIFIED,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
270 TTY_INIT_SUCCESS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
271 };
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
272
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
273 int init_tty_for_redisplay (struct device *d, char *terminal_type);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
274 /* #### These should probably be methods. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
275 void set_tty_modes (struct console *c);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
276 void reset_tty_modes (struct console *c);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
277
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
278 /* Used in sysdep.c to properly clear and position the cursor when exiting. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
279 void tty_redisplay_shutdown (struct console *c);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
280
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
281 /* called from console-stream.c */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
282 Lisp_Object tty_semi_canonicalize_console_connection (Lisp_Object connection,
578
190b164ddcac [xemacs-hg @ 2001-05-25 11:26:50 by ben]
ben
parents: 442
diff changeset
283 Error_Behavior errb);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
284 Lisp_Object tty_canonicalize_console_connection (Lisp_Object connection,
578
190b164ddcac [xemacs-hg @ 2001-05-25 11:26:50 by ben]
ben
parents: 442
diff changeset
285 Error_Behavior errb);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
286 Lisp_Object tty_semi_canonicalize_device_connection (Lisp_Object connection,
578
190b164ddcac [xemacs-hg @ 2001-05-25 11:26:50 by ben]
ben
parents: 442
diff changeset
287 Error_Behavior errb);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
288 Lisp_Object tty_canonicalize_device_connection (Lisp_Object connection,
578
190b164ddcac [xemacs-hg @ 2001-05-25 11:26:50 by ben]
ben
parents: 442
diff changeset
289 Error_Behavior errb);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
290 struct console * tty_find_console_from_fd (int fd);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
291
440
8de8e3f6228a Import from CVS: tag r21-2-28
cvs
parents: 428
diff changeset
292 #endif /* INCLUDED_console_tty_h_ */