aboutsummaryrefslogtreecommitdiffstats
path: root/src/term.c
diff options
context:
space:
mode:
authorKaroly Lorentey2005-07-11 00:05:55 +0000
committerKaroly Lorentey2005-07-11 00:05:55 +0000
commit7e59217d2639c9913c2c76cd9d9825dabe78251a (patch)
treed4aca783b45c0625c242482c499074a1f39fa2b8 /src/term.c
parenta4c6993d4a0ac128dcee76fe1e87f6cade1be410 (diff)
downloademacs-7e59217d2639c9913c2c76cd9d9825dabe78251a.tar.gz
emacs-7e59217d2639c9913c2c76cd9d9825dabe78251a.zip
Rename `struct display' to `struct device'. Update function, parameter and variable names accordingly.
* src/termhooks.h (struct device): Rename to `struct device'. Rename member `next_display' to `next_device'. Rename member `delete_display_hook' to `delete_device_hook'. (FRAME_DISPLAY): Rename to FRAME_DEVICE. (DISPLAY_ACTIVE_P): Rename to DEVICE_ACTIVE_P. (DISPLAY_TERMINAL_CODING): Rename to DEVICE_TERMINAL_CODING. (DISPLAY_KEYBOARD_CODING): Rename to DEVICE_KEYBOARD_CODING. * src/frame.h (stuct frame): Rename `display' member to `device'. * src/xterm.h (x_display_info): Rename member `frame_display' to `device'. * src/termchar.h (struct tty_display_info): Rename `display' member to `device'. * src/keyboard.c (push_display_kboard): Rename to push_device_kboard. * lisp/frame.el (make-frame): Rename frame parameter `display-id' to `device'. * src/frame.c (Fmake_terminal_frame): Ditto. * src/xfns.c (Fx_create_frame): Ditto. * src/term.c (display_list): Rename to device_list. * src/term.c (initial_display): Rename to initial_device. * src/term.c (next_display_id): Rename to next_device_id. * src/term.c (get_display): Rename to get_device. * src/term.c (get_tty_display): Rename to get_tty_device. * src/term.c (get_named_tty_display): Rename to get_named_tty. * src/term.c (init_initial_display): Rename to init_initial_device. * src/term.c (delete_initial_display): Rename to delete_initial_device. * src/term.c (create_display): Rename to create_device. * src/term.c (delete_display): Rename to delete_device. * src/xfns.c (check_x_display_info): Document that the function allows display ids as well. * src/xterm.c (x_delete_frame_display): Rename to x_delete_device. * src/xterm.c (x_create_frame_display): Rename to x_create_device. * src/coding.c: Update. * src/dispextern.h: Update. * src/data.c: Update. * src/dispnew.c: Update. * src/frame.c: Update. * src/frame.h: Update. * src/keyboard.c: Update. * src/keyboard.h: Update. * src/lisp.h: Update. * src/sysdep.c: Update. * src/term.c: Update. * src/xdisp.c: Update. * src/xselect.c: Update. * src/xterm.c: Update. * src/prefix-args.c: Include stdlib.h for exit. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-382
Diffstat (limited to 'src/term.c')
-rw-r--r--src/term.c547
1 files changed, 270 insertions, 277 deletions
diff --git a/src/term.c b/src/term.c
index 94b848b520a..b2cba6a2665 100644
--- a/src/term.c
+++ b/src/term.c
@@ -85,9 +85,9 @@ static void turn_off_face P_ ((struct frame *, int face_id));
85static void tty_show_cursor P_ ((struct tty_display_info *)); 85static void tty_show_cursor P_ ((struct tty_display_info *));
86static void tty_hide_cursor P_ ((struct tty_display_info *)); 86static void tty_hide_cursor P_ ((struct tty_display_info *));
87 87
88static struct display *get_tty_display (Lisp_Object display); 88static struct device *get_tty_device (Lisp_Object device);
89 89
90void delete_initial_display P_ ((struct display *)); 90void delete_initial_device P_ ((struct device *));
91void create_tty_output P_ ((struct frame *)); 91void create_tty_output P_ ((struct frame *));
92void delete_tty_output P_ ((struct frame *)); 92void delete_tty_output P_ ((struct frame *));
93 93
@@ -126,10 +126,10 @@ Lisp_Object Vsuspend_tty_functions;
126Lisp_Object Vresume_tty_functions; 126Lisp_Object Vresume_tty_functions;
127 127
128/* Chain of all displays currently in use. */ 128/* Chain of all displays currently in use. */
129struct display *display_list; 129struct device *device_list;
130 130
131/* The initial display device, created by initial_term_init. */ 131/* The initial display device, created by initial_term_init. */
132struct display *initial_display; 132struct device *initial_device;
133 133
134/* Chain of all tty device parameters. */ 134/* Chain of all tty device parameters. */
135struct tty_display_info *tty_list; 135struct tty_display_info *tty_list;
@@ -172,7 +172,7 @@ int max_frame_lines;
172static int no_controlling_tty; 172static int no_controlling_tty;
173 173
174/* The first unallocated display id. */ 174/* The first unallocated display id. */
175static int next_display_id; 175static int next_device_id;
176 176
177/* Provided for lisp packages. */ 177/* Provided for lisp packages. */
178 178
@@ -216,8 +216,8 @@ ring_bell (struct frame *f)
216 216
217 Vring_bell_function = function; 217 Vring_bell_function = function;
218 } 218 }
219 else if (FRAME_DISPLAY (f)->ring_bell_hook) 219 else if (FRAME_DEVICE (f)->ring_bell_hook)
220 (*FRAME_DISPLAY (f)->ring_bell_hook) (f); 220 (*FRAME_DEVICE (f)->ring_bell_hook) (f);
221} 221}
222 222
223/* Ring the bell on a tty. */ 223/* Ring the bell on a tty. */
@@ -239,7 +239,7 @@ tty_ring_bell (struct frame *f)
239/* Set up termcap modes for Emacs. */ 239/* Set up termcap modes for Emacs. */
240 240
241void 241void
242tty_set_terminal_modes (struct display *display) 242tty_set_terminal_modes (struct device *display)
243{ 243{
244 struct tty_display_info *tty = display->display_info.tty; 244 struct tty_display_info *tty = display->display_info.tty;
245 245
@@ -256,7 +256,7 @@ tty_set_terminal_modes (struct display *display)
256/* Reset termcap modes before exiting Emacs. */ 256/* Reset termcap modes before exiting Emacs. */
257 257
258void 258void
259tty_reset_terminal_modes (struct display *display) 259tty_reset_terminal_modes (struct device *display)
260{ 260{
261 struct tty_display_info *tty = display->display_info.tty; 261 struct tty_display_info *tty = display->display_info.tty;
262 262
@@ -278,15 +278,15 @@ tty_reset_terminal_modes (struct display *display)
278void 278void
279update_begin (struct frame *f) 279update_begin (struct frame *f)
280{ 280{
281 if (FRAME_DISPLAY (f)->update_begin_hook) 281 if (FRAME_DEVICE (f)->update_begin_hook)
282 (*FRAME_DISPLAY (f)->update_begin_hook) (f); 282 (*FRAME_DEVICE (f)->update_begin_hook) (f);
283} 283}
284 284
285void 285void
286update_end (struct frame *f) 286update_end (struct frame *f)
287{ 287{
288 if (FRAME_DISPLAY (f)->update_end_hook) 288 if (FRAME_DEVICE (f)->update_end_hook)
289 (*FRAME_DISPLAY (f)->update_end_hook) (f); 289 (*FRAME_DEVICE (f)->update_end_hook) (f);
290} 290}
291 291
292/* Flag the end of a display update on a termcap display. */ 292/* Flag the end of a display update on a termcap display. */
@@ -310,8 +310,8 @@ tty_update_end (struct frame *f)
310void 310void
311set_terminal_window (struct frame *f, int size) 311set_terminal_window (struct frame *f, int size)
312{ 312{
313 if (FRAME_DISPLAY (f)->set_terminal_window_hook) 313 if (FRAME_DEVICE (f)->set_terminal_window_hook)
314 (*FRAME_DISPLAY (f)->set_terminal_window_hook) (f, size); 314 (*FRAME_DEVICE (f)->set_terminal_window_hook) (f, size);
315} 315}
316 316
317/* The implementation of set_terminal_window for termcap frames. */ 317/* The implementation of set_terminal_window for termcap frames. */
@@ -450,8 +450,8 @@ highlight_if_desired (struct tty_display_info *tty)
450void 450void
451cursor_to (struct frame *f, int vpos, int hpos) 451cursor_to (struct frame *f, int vpos, int hpos)
452{ 452{
453 if (FRAME_DISPLAY (f)->cursor_to_hook) 453 if (FRAME_DEVICE (f)->cursor_to_hook)
454 (*FRAME_DISPLAY (f)->cursor_to_hook) (f, vpos, hpos); 454 (*FRAME_DEVICE (f)->cursor_to_hook) (f, vpos, hpos);
455} 455}
456 456
457void 457void
@@ -479,8 +479,8 @@ tty_cursor_to (struct frame *f, int vpos, int hpos)
479void 479void
480raw_cursor_to (struct frame *f, int row, int col) 480raw_cursor_to (struct frame *f, int row, int col)
481{ 481{
482 if (FRAME_DISPLAY (f)->raw_cursor_to_hook) 482 if (FRAME_DEVICE (f)->raw_cursor_to_hook)
483 (*FRAME_DISPLAY (f)->raw_cursor_to_hook) (f, row, col); 483 (*FRAME_DEVICE (f)->raw_cursor_to_hook) (f, row, col);
484} 484}
485 485
486void 486void
@@ -504,8 +504,8 @@ tty_raw_cursor_to (struct frame *f, int row, int col)
504void 504void
505clear_to_end (struct frame *f) 505clear_to_end (struct frame *f)
506{ 506{
507 if (FRAME_DISPLAY (f)->clear_to_end_hook) 507 if (FRAME_DEVICE (f)->clear_to_end_hook)
508 (*FRAME_DISPLAY (f)->clear_to_end_hook) (f); 508 (*FRAME_DEVICE (f)->clear_to_end_hook) (f);
509} 509}
510 510
511/* Clear from cursor to end of frame on a termcap device. */ 511/* Clear from cursor to end of frame on a termcap device. */
@@ -536,8 +536,8 @@ tty_clear_to_end (struct frame *f)
536void 536void
537clear_frame (struct frame *f) 537clear_frame (struct frame *f)
538{ 538{
539 if (FRAME_DISPLAY (f)->clear_frame_hook) 539 if (FRAME_DEVICE (f)->clear_frame_hook)
540 (*FRAME_DISPLAY (f)->clear_frame_hook) (f); 540 (*FRAME_DEVICE (f)->clear_frame_hook) (f);
541} 541}
542 542
543/* Clear an entire termcap frame. */ 543/* Clear an entire termcap frame. */
@@ -568,8 +568,8 @@ tty_clear_frame (struct frame *f)
568void 568void
569clear_end_of_line (struct frame *f, int first_unused_hpos) 569clear_end_of_line (struct frame *f, int first_unused_hpos)
570{ 570{
571 if (FRAME_DISPLAY (f)->clear_end_of_line_hook) 571 if (FRAME_DEVICE (f)->clear_end_of_line_hook)
572 (*FRAME_DISPLAY (f)->clear_end_of_line_hook) (f, first_unused_hpos); 572 (*FRAME_DEVICE (f)->clear_end_of_line_hook) (f, first_unused_hpos);
573} 573}
574 574
575/* An implementation of clear_end_of_line for termcap frames. 575/* An implementation of clear_end_of_line for termcap frames.
@@ -739,8 +739,8 @@ encode_terminal_code (src, src_len, coding)
739void 739void
740write_glyphs (struct frame *f, struct glyph *string, int len) 740write_glyphs (struct frame *f, struct glyph *string, int len)
741{ 741{
742 if (FRAME_DISPLAY (f)->write_glyphs_hook) 742 if (FRAME_DEVICE (f)->write_glyphs_hook)
743 (*FRAME_DISPLAY (f)->write_glyphs_hook) (f, string, len); 743 (*FRAME_DEVICE (f)->write_glyphs_hook) (f, string, len);
744} 744}
745 745
746/* An implementation of write_glyphs for termcap frames. */ 746/* An implementation of write_glyphs for termcap frames. */
@@ -824,8 +824,8 @@ insert_glyphs (struct frame *f, struct glyph *start, int len)
824 if (len <= 0) 824 if (len <= 0)
825 return; 825 return;
826 826
827 if (FRAME_DISPLAY (f)->insert_glyphs_hook) 827 if (FRAME_DEVICE (f)->insert_glyphs_hook)
828 (*FRAME_DISPLAY (f)->insert_glyphs_hook) (f, start, len); 828 (*FRAME_DEVICE (f)->insert_glyphs_hook) (f, start, len);
829} 829}
830 830
831/* An implementation of insert_glyphs for termcap frames. */ 831/* An implementation of insert_glyphs for termcap frames. */
@@ -920,8 +920,8 @@ tty_insert_glyphs (struct frame *f, struct glyph *start, int len)
920void 920void
921delete_glyphs (struct frame *f, int n) 921delete_glyphs (struct frame *f, int n)
922{ 922{
923 if (FRAME_DISPLAY (f)->delete_glyphs_hook) 923 if (FRAME_DEVICE (f)->delete_glyphs_hook)
924 (*FRAME_DISPLAY (f)->delete_glyphs_hook) (f, n); 924 (*FRAME_DEVICE (f)->delete_glyphs_hook) (f, n);
925} 925}
926 926
927/* An implementation of delete_glyphs for termcap frames. */ 927/* An implementation of delete_glyphs for termcap frames. */
@@ -962,8 +962,8 @@ tty_delete_glyphs (struct frame *f, int n)
962void 962void
963ins_del_lines (struct frame *f, int vpos, int n) 963ins_del_lines (struct frame *f, int vpos, int n)
964{ 964{
965 if (FRAME_DISPLAY (f)->ins_del_lines_hook) 965 if (FRAME_DEVICE (f)->ins_del_lines_hook)
966 (*FRAME_DISPLAY (f)->ins_del_lines_hook) (f, vpos, n); 966 (*FRAME_DEVICE (f)->ins_del_lines_hook) (f, vpos, n);
967} 967}
968 968
969/* An implementation of ins_del_lines for termcap frames. */ 969/* An implementation of ins_del_lines for termcap frames. */
@@ -1953,11 +1953,12 @@ tty_capable_p (tty, caps, fg, bg)
1953 1953
1954DEFUN ("tty-display-color-p", Ftty_display_color_p, Stty_display_color_p, 1954DEFUN ("tty-display-color-p", Ftty_display_color_p, Stty_display_color_p,
1955 0, 1, 0, 1955 0, 1, 0,
1956 doc: /* Return non-nil if the tty device that DISPLAY uses can display colors. */) 1956 doc: /* Return non-nil if the display device DEVICE can display colors.
1957 (display) 1957DEVICE must be a tty device. */)
1958 Lisp_Object display; 1958 (device)
1959 Lisp_Object device;
1959{ 1960{
1960 struct display *d = get_tty_display (display); 1961 struct device *d = get_tty_device (device);
1961 if (!d) 1962 if (!d)
1962 return Qnil; 1963 return Qnil;
1963 else 1964 else
@@ -1967,11 +1968,11 @@ DEFUN ("tty-display-color-p", Ftty_display_color_p, Stty_display_color_p,
1967/* Return the number of supported colors. */ 1968/* Return the number of supported colors. */
1968DEFUN ("tty-display-color-cells", Ftty_display_color_cells, 1969DEFUN ("tty-display-color-cells", Ftty_display_color_cells,
1969 Stty_display_color_cells, 0, 1, 0, 1970 Stty_display_color_cells, 0, 1, 0,
1970 doc: /* Return the number of colors supported by the tty device that DISPLAY uses. */) 1971 doc: /* Return the number of colors supported by the tty device DEVICE. */)
1971 (display) 1972 (device)
1972 Lisp_Object display; 1973 Lisp_Object device;
1973{ 1974{
1974 struct display *d = get_tty_display (display); 1975 struct device *d = get_tty_device (device);
1975 if (!d) 1976 if (!d)
1976 return make_number (0); 1977 return make_number (0);
1977 else 1978 else
@@ -2117,86 +2118,79 @@ set_tty_color_mode (f, val)
2117 2118
2118 2119
2119 2120
2120/* Return the display object specified by DISPLAY. DISPLAY may be a 2121/* Return the display object specified by DEVICE. DEVICE may be a
2121 display id, a frame, or nil for the display device of the current 2122 display id, a frame, or nil for the display device of the current
2122 frame. If THROW is zero, return NULL for failure, otherwise throw 2123 frame. If THROW is zero, return NULL for failure, otherwise throw
2123 an error. */ 2124 an error. */
2124 2125
2125struct display * 2126struct device *
2126get_display (Lisp_Object display, int throw) 2127get_device (Lisp_Object device, int throw)
2127{ 2128{
2128 struct display *result = NULL; 2129 struct device *result = NULL;
2129 2130
2130 if (NILP (display)) 2131 if (NILP (device))
2131 display = selected_frame; 2132 device = selected_frame;
2132 2133
2133 if (INTEGERP (display)) 2134 if (INTEGERP (device))
2134 { 2135 {
2135 struct display *d; 2136 struct device *d;
2136 2137
2137 for (d = display_list; d; d = d->next_display) 2138 for (d = device_list; d; d = d->next_device)
2138 { 2139 {
2139 if (d->id == XINT (display)) 2140 if (d->id == XINT (device))
2140 { 2141 {
2141 result = d; 2142 result = d;
2142 break; 2143 break;
2143 } 2144 }
2144 } 2145 }
2145 } 2146 }
2146 else if (FRAMEP (display)) 2147 else if (FRAMEP (device))
2147 { 2148 {
2148 result = FRAME_DISPLAY (XFRAME (display)); 2149 result = FRAME_DEVICE (XFRAME (device));
2149 } 2150 }
2150 2151
2151 if (result == NULL && throw) 2152 if (result == NULL && throw)
2152 wrong_type_argument (Qdisplay_live_p, display); 2153 wrong_type_argument (Qdisplay_live_p, device);
2153 2154
2154 return result; 2155 return result;
2155} 2156}
2156 2157
2157/* Return the tty display object specified by DISPLAY. */ 2158/* Return the tty display object specified by DEVICE. */
2158 2159
2159static struct display * 2160static struct device *
2160get_tty_display (Lisp_Object display) 2161get_tty_device (Lisp_Object device)
2161{ 2162{
2162 struct display *d = get_display (display, 0); 2163 struct device *d = get_device (device, 0);
2163 2164
2164 if (d && d->type == output_initial) 2165 if (d && d->type == output_initial)
2165 d = NULL; 2166 d = NULL;
2166 2167
2167 if (d && d->type != output_termcap) 2168 if (d && d->type != output_termcap)
2168 { 2169 error ("Device %d is not a termcap display device", d->id);
2169#if 0 /* XXX We need a predicate as the first argument; find one. */
2170 wrong_type_argument ("Not a termcap display", display);
2171#else /* Until we fix the wrong_type_argument call above, simply throw
2172 a dumb error. */
2173 error ("DISPLAY is not a termcap display");
2174#endif
2175 }
2176 2170
2177 return d; 2171 return d;
2178} 2172}
2179 2173
2180/* Return the active termcap display that uses the tty device with the 2174/* Return the active termcap device that uses the tty device with the
2181 given name. If NAME is NULL, return the display corresponding to 2175 given name. If NAME is NULL, return the device corresponding to
2182 our controlling terminal. 2176 our controlling terminal.
2183 2177
2184 This function ignores suspended displays. 2178 This function ignores suspended devices.
2185 2179
2186 Returns NULL if the named terminal device is not opened. */ 2180 Returns NULL if the named terminal device is not opened. */
2187 2181
2188struct display * 2182struct device *
2189get_named_tty_display (name) 2183get_named_tty (name)
2190 char *name; 2184 char *name;
2191{ 2185{
2192 struct display *d; 2186 struct device *d;
2193 2187
2194 for (d = display_list; d; d = d->next_display) { 2188 for (d = device_list; d; d = d->next_device) {
2195 if (d->type == output_termcap 2189 if (d->type == output_termcap
2196 && ((d->display_info.tty->name == 0 && name == 0) 2190 && ((d->display_info.tty->name == 0 && name == 0)
2197 || (name && d->display_info.tty->name 2191 || (name && d->display_info.tty->name
2198 && !strcmp (d->display_info.tty->name, name))) 2192 && !strcmp (d->display_info.tty->name, name)))
2199 && DISPLAY_ACTIVE_P (d)) 2193 && DEVICE_ACTIVE_P (d))
2200 return d; 2194 return d;
2201 }; 2195 };
2202 2196
@@ -2206,15 +2200,15 @@ get_named_tty_display (name)
2206 2200
2207 2201
2208DEFUN ("display-name", Fdisplay_name, Sdisplay_name, 0, 1, 0, 2202DEFUN ("display-name", Fdisplay_name, Sdisplay_name, 0, 1, 0,
2209 doc: /* Return the name of the device that DISPLAY uses. 2203 doc: /* Return the name of the display device DEVICE.
2210It is not guaranteed that the returned value is unique among opened displays. 2204It is not guaranteed that the returned value is unique among opened devices.
2211 2205
2212DISPLAY may be a display, a frame, or nil (meaning the selected 2206DEVICE may be a display device id, a frame, or nil (meaning the
2213frame's display). */) 2207selected frame's display device). */)
2214 (display) 2208 (device)
2215 Lisp_Object display; 2209 Lisp_Object device;
2216{ 2210{
2217 struct display *d = get_display (display, 1); 2211 struct device *d = get_device (device, 1);
2218 2212
2219 if (d->name) 2213 if (d->name)
2220 return build_string (d->name); 2214 return build_string (d->name);
@@ -2223,14 +2217,14 @@ frame's display). */)
2223} 2217}
2224 2218
2225DEFUN ("display-tty-type", Fdisplay_tty_type, Sdisplay_tty_type, 0, 1, 0, 2219DEFUN ("display-tty-type", Fdisplay_tty_type, Sdisplay_tty_type, 0, 1, 0,
2226 doc: /* Return the type of the TTY device that DISPLAY uses. 2220 doc: /* Return the type of the tty device that DEVICE uses.
2227 2221
2228DISPLAY may be a display, a frame, or nil (meaning the selected 2222DEVICE may be a display device id, a frame, or nil (meaning the
2229frame's display). */) 2223selected frame's display device). */)
2230 (display) 2224 (device)
2231 Lisp_Object display; 2225 Lisp_Object device;
2232{ 2226{
2233 struct display *d = get_display (display, 1); 2227 struct device *d = get_device (device, 1);
2234 2228
2235 if (d->type != output_termcap) 2229 if (d->type != output_termcap)
2236 error ("Display %d is not a termcap display", d->id); 2230 error ("Display %d is not a termcap display", d->id);
@@ -2242,14 +2236,14 @@ frame's display). */)
2242} 2236}
2243 2237
2244DEFUN ("display-controlling-tty-p", Fdisplay_controlling_tty_p, Sdisplay_controlling_tty_p, 0, 1, 0, 2238DEFUN ("display-controlling-tty-p", Fdisplay_controlling_tty_p, Sdisplay_controlling_tty_p, 0, 1, 0,
2245 doc: /* Return non-nil if DISPLAY is on the controlling tty of the Emacs process. 2239 doc: /* Return non-nil if DEVICE is on the controlling tty of the Emacs process.
2246 2240
2247DISPLAY may be a display, a frame, or nil (meaning the selected 2241DEVICE may be a display device id, a frame, or nil (meaning the
2248frame's display). */) 2242selected frame's display device). */)
2249 (display) 2243 (device)
2250 Lisp_Object display; 2244 Lisp_Object device;
2251{ 2245{
2252 struct display *d = get_display (display, 1); 2246 struct device *d = get_device (device, 1);
2253 2247
2254 if (d->type != output_termcap || d->display_info.tty->name) 2248 if (d->type != output_termcap || d->display_info.tty->name)
2255 return Qnil; 2249 return Qnil;
@@ -2258,17 +2252,17 @@ frame's display). */)
2258} 2252}
2259 2253
2260DEFUN ("tty-no-underline", Ftty_no_underline, Stty_no_underline, 0, 1, 0, 2254DEFUN ("tty-no-underline", Ftty_no_underline, Stty_no_underline, 0, 1, 0,
2261 doc: /* Declare that the tty used by DISPLAY does not handle underlining. 2255 doc: /* Declare that the tty used by DEVICE does not handle underlining.
2262This is used to override the terminfo data, for certain terminals that 2256This is used to override the terminfo data, for certain terminals that
2263do not really do underlining, but say that they do. This function has 2257do not really do underlining, but say that they do. This function has
2264no effect if used on a non-tty display. 2258no effect if used on a non-tty display.
2265 2259
2266DISPLAY may be a display, a frame, or nil (meaning the selected 2260DEVICE may be a display device id, a frame, or nil (meaning the
2267frame's display). */) 2261selected frame's display device). */)
2268 (display) 2262 (device)
2269 Lisp_Object display; 2263 Lisp_Object device;
2270{ 2264{
2271 struct display *d = get_display (display, 1); 2265 struct device *d = get_device (device, 1);
2272 2266
2273 if (d->type == output_termcap) 2267 if (d->type == output_termcap)
2274 d->display_info.tty->TS_enter_underline_mode = 0; 2268 d->display_info.tty->TS_enter_underline_mode = 0;
@@ -2282,36 +2276,36 @@ frame's display). */)
2282 ***********************************************************************/ 2276 ***********************************************************************/
2283 2277
2284/* Create the bootstrap display device for the initial frame. 2278/* Create the bootstrap display device for the initial frame.
2285 Returns a display of type output_initial. */ 2279 Returns a device of type output_initial. */
2286 2280
2287struct display * 2281struct device *
2288init_initial_display (void) 2282init_initial_device (void)
2289{ 2283{
2290 if (initialized || display_list || tty_list) 2284 if (initialized || device_list || tty_list)
2291 abort (); 2285 abort ();
2292 2286
2293 initial_display = create_display (); 2287 initial_device = create_device ();
2294 initial_display->type = output_initial; 2288 initial_device->type = output_initial;
2295 initial_display->name = xstrdup ("initial_display"); 2289 initial_device->name = xstrdup ("initial_device");
2296 initial_display->kboard = initial_kboard; 2290 initial_device->kboard = initial_kboard;
2297 2291
2298 initial_display->delete_display_hook = &delete_initial_display; 2292 initial_device->delete_device_hook = &delete_initial_device;
2299 /* All other hooks are NULL. */ 2293 /* All other hooks are NULL. */
2300 2294
2301 return initial_display; 2295 return initial_device;
2302} 2296}
2303 2297
2304/* Deletes the bootstrap display device. 2298/* Deletes the bootstrap display device.
2305 Called through delete_display_hook. */ 2299 Called through delete_device_hook. */
2306 2300
2307void 2301void
2308delete_initial_display (struct display *display) 2302delete_initial_device (struct device *device)
2309{ 2303{
2310 if (display != initial_display) 2304 if (device != initial_device)
2311 abort (); 2305 abort ();
2312 2306
2313 delete_display (display); 2307 delete_device (device);
2314 initial_display = NULL; 2308 initial_device = NULL;
2315} 2309}
2316 2310
2317/* Drop the controlling terminal if fd is the same device. */ 2311/* Drop the controlling terminal if fd is the same device. */
@@ -2357,7 +2351,7 @@ static void maybe_fatal();
2357 2351
2358 If MUST_SUCCEED is true, then all errors are fatal. */ 2352 If MUST_SUCCEED is true, then all errors are fatal. */
2359 2353
2360struct display * 2354struct device *
2361init_tty (char *name, char *terminal_type, int must_succeed) 2355init_tty (char *name, char *terminal_type, int must_succeed)
2362{ 2356{
2363 char *area; 2357 char *area;
@@ -2367,72 +2361,72 @@ init_tty (char *name, char *terminal_type, int must_succeed)
2367 register char *p; 2361 register char *p;
2368 int status; 2362 int status;
2369 struct tty_display_info *tty; 2363 struct tty_display_info *tty;
2370 struct display *display; 2364 struct device *device;
2371 2365
2372 if (!terminal_type) 2366 if (!terminal_type)
2373 maybe_fatal (must_succeed, 0, 0, 2367 maybe_fatal (must_succeed, 0, 0,
2374 "Unknown terminal type", 2368 "Unknown terminal type",
2375 "Unknown terminal type"); 2369 "Unknown terminal type");
2376 2370
2377 /* If we already have an active display on the given device, use that. 2371 /* If we already have a display on the given device, use that. If
2378 If all displays are suspended, create a new one instead. */ 2372 all such displays are suspended, create a new one instead. */
2379 /* XXX Perhaps this should be made explicit by having init_tty 2373 /* XXX Perhaps this should be made explicit by having init_tty
2380 always create a new display and separating display and frame 2374 always create a new display and separating device and frame
2381 creation on Lisp level. */ 2375 creation on Lisp level. */
2382 display = get_named_tty_display (name); 2376 device = get_named_tty (name);
2383 if (display) 2377 if (device)
2384 return display; 2378 return device;
2385 2379
2386 display = create_display (); 2380 device = create_device ();
2387 tty = (struct tty_display_info *) xmalloc (sizeof (struct tty_display_info)); 2381 tty = (struct tty_display_info *) xmalloc (sizeof (struct tty_display_info));
2388 bzero (tty, sizeof (struct tty_display_info)); 2382 bzero (tty, sizeof (struct tty_display_info));
2389 tty->next = tty_list; 2383 tty->next = tty_list;
2390 tty_list = tty; 2384 tty_list = tty;
2391 2385
2392 display->type = output_termcap; 2386 device->type = output_termcap;
2393 display->display_info.tty = tty; 2387 device->display_info.tty = tty;
2394 tty->display = display; 2388 tty->device = device;
2395 2389
2396 tty->Wcm = (struct cm *) xmalloc (sizeof (struct cm)); 2390 tty->Wcm = (struct cm *) xmalloc (sizeof (struct cm));
2397 Wcm_clear (tty); 2391 Wcm_clear (tty);
2398 2392
2399 display->rif = 0; /* ttys don't support window-based redisplay. */ 2393 device->rif = 0; /* ttys don't support window-based redisplay. */
2400 2394
2401 display->cursor_to_hook = &tty_cursor_to; 2395 device->cursor_to_hook = &tty_cursor_to;
2402 display->raw_cursor_to_hook = &tty_raw_cursor_to; 2396 device->raw_cursor_to_hook = &tty_raw_cursor_to;
2403 2397
2404 display->clear_to_end_hook = &tty_clear_to_end; 2398 device->clear_to_end_hook = &tty_clear_to_end;
2405 display->clear_frame_hook = &tty_clear_frame; 2399 device->clear_frame_hook = &tty_clear_frame;
2406 display->clear_end_of_line_hook = &tty_clear_end_of_line; 2400 device->clear_end_of_line_hook = &tty_clear_end_of_line;
2407 2401
2408 display->ins_del_lines_hook = &tty_ins_del_lines; 2402 device->ins_del_lines_hook = &tty_ins_del_lines;
2409 2403
2410 display->insert_glyphs_hook = &tty_insert_glyphs; 2404 device->insert_glyphs_hook = &tty_insert_glyphs;
2411 display->write_glyphs_hook = &tty_write_glyphs; 2405 device->write_glyphs_hook = &tty_write_glyphs;
2412 display->delete_glyphs_hook = &tty_delete_glyphs; 2406 device->delete_glyphs_hook = &tty_delete_glyphs;
2413 2407
2414 display->ring_bell_hook = &tty_ring_bell; 2408 device->ring_bell_hook = &tty_ring_bell;
2415 2409
2416 display->reset_terminal_modes_hook = &tty_reset_terminal_modes; 2410 device->reset_terminal_modes_hook = &tty_reset_terminal_modes;
2417 display->set_terminal_modes_hook = &tty_set_terminal_modes; 2411 device->set_terminal_modes_hook = &tty_set_terminal_modes;
2418 display->update_begin_hook = 0; /* Not needed. */ 2412 device->update_begin_hook = 0; /* Not needed. */
2419 display->update_end_hook = &tty_update_end; 2413 device->update_end_hook = &tty_update_end;
2420 display->set_terminal_window_hook = &tty_set_terminal_window; 2414 device->set_terminal_window_hook = &tty_set_terminal_window;
2421 2415
2422 display->mouse_position_hook = 0; /* Not needed. */ 2416 device->mouse_position_hook = 0; /* Not needed. */
2423 display->frame_rehighlight_hook = 0; /* Not needed. */ 2417 device->frame_rehighlight_hook = 0; /* Not needed. */
2424 display->frame_raise_lower_hook = 0; /* Not needed. */ 2418 device->frame_raise_lower_hook = 0; /* Not needed. */
2425 2419
2426 display->set_vertical_scroll_bar_hook = 0; /* Not needed. */ 2420 device->set_vertical_scroll_bar_hook = 0; /* Not needed. */
2427 display->condemn_scroll_bars_hook = 0; /* Not needed. */ 2421 device->condemn_scroll_bars_hook = 0; /* Not needed. */
2428 display->redeem_scroll_bar_hook = 0; /* Not needed. */ 2422 device->redeem_scroll_bar_hook = 0; /* Not needed. */
2429 display->judge_scroll_bars_hook = 0; /* Not needed. */ 2423 device->judge_scroll_bars_hook = 0; /* Not needed. */
2430 2424
2431 display->read_socket_hook = &tty_read_avail_input; /* keyboard.c */ 2425 device->read_socket_hook = &tty_read_avail_input; /* keyboard.c */
2432 display->frame_up_to_date_hook = 0; /* Not needed. */ 2426 device->frame_up_to_date_hook = 0; /* Not needed. */
2433 2427
2434 display->delete_frame_hook = &delete_tty_output; 2428 device->delete_frame_hook = &delete_tty_output;
2435 display->delete_display_hook = &delete_tty; 2429 device->delete_device_hook = &delete_tty;
2436 2430
2437 if (name) 2431 if (name)
2438 { 2432 {
@@ -2456,7 +2450,7 @@ init_tty (char *name, char *terminal_type, int must_succeed)
2456 2450
2457 if (fd < 0) 2451 if (fd < 0)
2458 { 2452 {
2459 delete_tty (display); 2453 delete_tty (device);
2460 error ("Could not open file: %s", name); 2454 error ("Could not open file: %s", name);
2461 } 2455 }
2462 if (!isatty (fd)) 2456 if (!isatty (fd))
@@ -2469,7 +2463,7 @@ init_tty (char *name, char *terminal_type, int must_succeed)
2469 2463
2470 file = fdopen (fd, "w+"); 2464 file = fdopen (fd, "w+");
2471 tty->name = xstrdup (name); 2465 tty->name = xstrdup (name);
2472 display->name = xstrdup (name); 2466 device->name = xstrdup (name);
2473 tty->input = file; 2467 tty->input = file;
2474 tty->output = file; 2468 tty->output = file;
2475 } 2469 }
@@ -2482,7 +2476,7 @@ init_tty (char *name, char *terminal_type, int must_succeed)
2482 error ("There is no controlling terminal any more"); 2476 error ("There is no controlling terminal any more");
2483 } 2477 }
2484 tty->name = 0; 2478 tty->name = 0;
2485 display->name = xstrdup (ttyname (0)); 2479 device->name = xstrdup (ttyname (0));
2486 tty->input = stdin; 2480 tty->input = stdin;
2487 tty->output = stdout; 2481 tty->output = stdout;
2488 } 2482 }
@@ -2504,17 +2498,16 @@ init_tty (char *name, char *terminal_type, int must_succeed)
2504 FrameCols (tty) = FRAME_COLS (f); /* XXX */ 2498 FrameCols (tty) = FRAME_COLS (f); /* XXX */
2505 tty->specified_window = FRAME_LINES (f); /* XXX */ 2499 tty->specified_window = FRAME_LINES (f); /* XXX */
2506 2500
2507 tty->display->delete_in_insert_mode = 1; 2501 tty->device->delete_in_insert_mode = 1;
2508 2502
2509 UseTabs (tty) = 0; 2503 UseTabs (tty) = 0;
2510 display->scroll_region_ok = 0; 2504 device->scroll_region_ok = 0;
2511 2505
2512 /* Seems to insert lines when it's not supposed to, messing 2506 /* Seems to insert lines when it's not supposed to, messing up the
2513 up the display. In doing a trace, it didn't seem to be 2507 device. In doing a trace, it didn't seem to be called much, so I
2514 called much, so I don't think we're losing anything by 2508 don't think we're losing anything by turning it off. */
2515 turning it off. */ 2509 device->line_ins_del_ok = 0;
2516 display->line_ins_del_ok = 0; 2510 device->char_ins_del_ok = 1;
2517 display->char_ins_del_ok = 1;
2518 2511
2519 baud_rate = 19200; 2512 baud_rate = 19200;
2520 2513
@@ -2522,7 +2515,7 @@ init_tty (char *name, char *terminal_type, int must_succeed)
2522 FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none; /* XXX */ 2515 FRAME_VERTICAL_SCROLL_BAR_TYPE (f) = vertical_scroll_bar_none; /* XXX */
2523 TN_max_colors = 16; /* Required to be non-zero for tty-display-color-p */ 2516 TN_max_colors = 16; /* Required to be non-zero for tty-display-color-p */
2524 2517
2525 return display; 2518 return device;
2526#else /* not WINDOWSNT */ 2519#else /* not WINDOWSNT */
2527 2520
2528 Wcm_clear (tty); 2521 Wcm_clear (tty);
@@ -2538,11 +2531,11 @@ init_tty (char *name, char *terminal_type, int must_succeed)
2538 if (status < 0) 2531 if (status < 0)
2539 { 2532 {
2540#ifdef TERMINFO 2533#ifdef TERMINFO
2541 maybe_fatal (must_succeed, buffer, display, 2534 maybe_fatal (must_succeed, buffer, device,
2542 "Cannot open terminfo database file", 2535 "Cannot open terminfo database file",
2543 "Cannot open terminfo database file"); 2536 "Cannot open terminfo database file");
2544#else 2537#else
2545 maybe_fatal (must_succeed, buffer, display, 2538 maybe_fatal (must_succeed, buffer, device,
2546 "Cannot open termcap database file", 2539 "Cannot open termcap database file",
2547 "Cannot open termcap database file"); 2540 "Cannot open termcap database file");
2548#endif 2541#endif
@@ -2550,7 +2543,7 @@ init_tty (char *name, char *terminal_type, int must_succeed)
2550 if (status == 0) 2543 if (status == 0)
2551 { 2544 {
2552#ifdef TERMINFO 2545#ifdef TERMINFO
2553 maybe_fatal (must_succeed, buffer, display, 2546 maybe_fatal (must_succeed, buffer, device,
2554 "Terminal type %s is not defined", 2547 "Terminal type %s is not defined",
2555 "Terminal type %s is not defined.\n\ 2548 "Terminal type %s is not defined.\n\
2556If that is not the actual type of terminal you have,\n\ 2549If that is not the actual type of terminal you have,\n\
@@ -2559,7 +2552,7 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\
2559to do `unset TERMINFO' (C-shell: `unsetenv TERMINFO') as well.", 2552to do `unset TERMINFO' (C-shell: `unsetenv TERMINFO') as well.",
2560 terminal_type); 2553 terminal_type);
2561#else 2554#else
2562 maybe_fatal (must_succeed, buffer, display, 2555 maybe_fatal (must_succeed, buffer, device,
2563 "Terminal type %s is not defined", 2556 "Terminal type %s is not defined",
2564 "Terminal type %s is not defined.\n\ 2557 "Terminal type %s is not defined.\n\
2565If that is not the actual type of terminal you have,\n\ 2558If that is not the actual type of terminal you have,\n\
@@ -2681,9 +2674,9 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
2681 /* Since we make MagicWrap terminals look like AutoWrap, we need to have 2674 /* Since we make MagicWrap terminals look like AutoWrap, we need to have
2682 the former flag imply the latter. */ 2675 the former flag imply the latter. */
2683 AutoWrap (tty) = MagicWrap (tty) || tgetflag ("am"); 2676 AutoWrap (tty) = MagicWrap (tty) || tgetflag ("am");
2684 display->memory_below_frame = tgetflag ("db"); 2677 device->memory_below_frame = tgetflag ("db");
2685 tty->TF_hazeltine = tgetflag ("hz"); 2678 tty->TF_hazeltine = tgetflag ("hz");
2686 display->must_write_spaces = tgetflag ("in"); 2679 device->must_write_spaces = tgetflag ("in");
2687 tty->meta_key = tgetflag ("km") || tgetflag ("MT"); 2680 tty->meta_key = tgetflag ("km") || tgetflag ("MT");
2688 tty->TF_insmode_motion = tgetflag ("mi"); 2681 tty->TF_insmode_motion = tgetflag ("mi");
2689 tty->TF_standout_motion = tgetflag ("ms"); 2682 tty->TF_standout_motion = tgetflag ("ms");
@@ -2691,19 +2684,19 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
2691 tty->TF_teleray = tgetflag ("xt"); 2684 tty->TF_teleray = tgetflag ("xt");
2692 2685
2693#ifdef MULTI_KBOARD 2686#ifdef MULTI_KBOARD
2694 display->kboard = (KBOARD *) xmalloc (sizeof (KBOARD)); 2687 device->kboard = (KBOARD *) xmalloc (sizeof (KBOARD));
2695 init_kboard (display->kboard); 2688 init_kboard (device->kboard);
2696 display->kboard->next_kboard = all_kboards; 2689 device->kboard->next_kboard = all_kboards;
2697 all_kboards = display->kboard; 2690 all_kboards = device->kboard;
2698 display->kboard->reference_count++; 2691 device->kboard->reference_count++;
2699 /* Don't let the initial kboard remain current longer than necessary. 2692 /* Don't let the initial kboard remain current longer than necessary.
2700 That would cause problems if a file loaded on startup tries to 2693 That would cause problems if a file loaded on startup tries to
2701 prompt in the mini-buffer. */ 2694 prompt in the mini-buffer. */
2702 if (current_kboard == initial_kboard) 2695 if (current_kboard == initial_kboard)
2703 current_kboard = display->kboard; 2696 current_kboard = device->kboard;
2704#endif 2697#endif
2705 2698
2706 term_get_fkeys (address, display->kboard); 2699 term_get_fkeys (address, device->kboard);
2707 2700
2708 /* Get frame size from system, or else from termcap. */ 2701 /* Get frame size from system, or else from termcap. */
2709 { 2702 {
@@ -2719,13 +2712,13 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
2719 FrameRows (tty) = tgetnum ("li"); 2712 FrameRows (tty) = tgetnum ("li");
2720 2713
2721 if (FrameRows (tty) < 3 || FrameCols (tty) < 3) 2714 if (FrameRows (tty) < 3 || FrameCols (tty) < 3)
2722 maybe_fatal (must_succeed, NULL, display, 2715 maybe_fatal (must_succeed, NULL, device,
2723 "Screen size %dx%d is too small" 2716 "Screen size %dx%d is too small"
2724 "Screen size %dx%d is too small", 2717 "Screen size %dx%d is too small",
2725 FrameCols (tty), FrameRows (tty)); 2718 FrameCols (tty), FrameRows (tty));
2726 2719
2727#if 0 /* This is not used anywhere. */ 2720#if 0 /* This is not used anywhere. */
2728 tty->display->min_padding_speed = tgetnum ("pb"); 2721 tty->device->min_padding_speed = tgetnum ("pb");
2729#endif 2722#endif
2730 2723
2731 TabWidth (tty) = tgetnum ("tw"); 2724 TabWidth (tty) = tgetnum ("tw");
@@ -2803,7 +2796,7 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
2803 2796
2804 if (!strcmp (terminal_type, "supdup")) 2797 if (!strcmp (terminal_type, "supdup"))
2805 { 2798 {
2806 display->memory_below_frame = 1; 2799 device->memory_below_frame = 1;
2807 tty->Wcm->cm_losewrap = 1; 2800 tty->Wcm->cm_losewrap = 1;
2808 } 2801 }
2809 if (!strncmp (terminal_type, "c10", 3) 2802 if (!strncmp (terminal_type, "c10", 3)
@@ -2830,7 +2823,7 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
2830 tty->TS_set_window = "\033v%C %C %C %C "; 2823 tty->TS_set_window = "\033v%C %C %C %C ";
2831 } 2824 }
2832 /* Termcap entry often fails to have :in: flag */ 2825 /* Termcap entry often fails to have :in: flag */
2833 display->must_write_spaces = 1; 2826 device->must_write_spaces = 1;
2834 /* :ti string typically fails to have \E^G! in it */ 2827 /* :ti string typically fails to have \E^G! in it */
2835 /* This limits scope of insert-char to one line. */ 2828 /* This limits scope of insert-char to one line. */
2836 strcpy (area, tty->TS_termcap_modes); 2829 strcpy (area, tty->TS_termcap_modes);
@@ -2852,7 +2845,7 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
2852 2845
2853 if (Wcm_init (tty) == -1) /* can't do cursor motion */ 2846 if (Wcm_init (tty) == -1) /* can't do cursor motion */
2854 { 2847 {
2855 maybe_fatal (must_succeed, NULL, display, 2848 maybe_fatal (must_succeed, NULL, device,
2856 "Terminal type \"%s\" is not powerful enough to run Emacs", 2849 "Terminal type \"%s\" is not powerful enough to run Emacs",
2857#ifdef VMS 2850#ifdef VMS
2858 "Terminal type \"%s\" is not powerful enough to run Emacs.\n\ 2851 "Terminal type \"%s\" is not powerful enough to run Emacs.\n\
@@ -2881,7 +2874,7 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
2881 } 2874 }
2882 2875
2883 if (FrameRows (tty) <= 0 || FrameCols (tty) <= 0) 2876 if (FrameRows (tty) <= 0 || FrameCols (tty) <= 0)
2884 maybe_fatal (must_succeed, NULL, display, 2877 maybe_fatal (must_succeed, NULL, device,
2885 "Could not determine the frame size", 2878 "Could not determine the frame size",
2886 "Could not determine the frame size"); 2879 "Could not determine the frame size");
2887 2880
@@ -2895,30 +2888,30 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
2895 2888
2896 UseTabs (tty) = tabs_safe_p (fileno (tty->input)) && TabWidth (tty) == 8; 2889 UseTabs (tty) = tabs_safe_p (fileno (tty->input)) && TabWidth (tty) == 8;
2897 2890
2898 display->scroll_region_ok 2891 device->scroll_region_ok
2899 = (tty->Wcm->cm_abs 2892 = (tty->Wcm->cm_abs
2900 && (tty->TS_set_window || tty->TS_set_scroll_region || tty->TS_set_scroll_region_1)); 2893 && (tty->TS_set_window || tty->TS_set_scroll_region || tty->TS_set_scroll_region_1));
2901 2894
2902 display->line_ins_del_ok 2895 device->line_ins_del_ok
2903 = (((tty->TS_ins_line || tty->TS_ins_multi_lines) 2896 = (((tty->TS_ins_line || tty->TS_ins_multi_lines)
2904 && (tty->TS_del_line || tty->TS_del_multi_lines)) 2897 && (tty->TS_del_line || tty->TS_del_multi_lines))
2905 || (display->scroll_region_ok 2898 || (device->scroll_region_ok
2906 && tty->TS_fwd_scroll && tty->TS_rev_scroll)); 2899 && tty->TS_fwd_scroll && tty->TS_rev_scroll));
2907 2900
2908 display->char_ins_del_ok 2901 device->char_ins_del_ok
2909 = ((tty->TS_ins_char || tty->TS_insert_mode 2902 = ((tty->TS_ins_char || tty->TS_insert_mode
2910 || tty->TS_pad_inserted_char || tty->TS_ins_multi_chars) 2903 || tty->TS_pad_inserted_char || tty->TS_ins_multi_chars)
2911 && (tty->TS_del_char || tty->TS_del_multi_chars)); 2904 && (tty->TS_del_char || tty->TS_del_multi_chars));
2912 2905
2913 display->fast_clear_end_of_line = tty->TS_clr_line != 0; 2906 device->fast_clear_end_of_line = tty->TS_clr_line != 0;
2914 2907
2915 init_baud_rate (fileno (tty->input)); 2908 init_baud_rate (fileno (tty->input));
2916 2909
2917#ifdef AIXHFT 2910#ifdef AIXHFT
2918 /* The HFT system on AIX doesn't optimize for scrolling, so it's 2911 /* The HFT system on AIX doesn't optimize for scrolling, so it's
2919 really ugly at times. */ 2912 really ugly at times. */
2920 display->line_ins_del_ok = 0; 2913 device->line_ins_del_ok = 0;
2921 display->char_ins_del_ok = 0; 2914 device->char_ins_del_ok = 0;
2922#endif 2915#endif
2923 2916
2924 /* Don't do this. I think termcap may still need the buffer. */ 2917 /* Don't do this. I think termcap may still need the buffer. */
@@ -2927,26 +2920,26 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
2927 /* Init system terminal modes (RAW or CBREAK, etc.). */ 2920 /* Init system terminal modes (RAW or CBREAK, etc.). */
2928 init_sys_modes (tty); 2921 init_sys_modes (tty);
2929 2922
2930 return display; 2923 return device;
2931#endif /* not WINDOWSNT */ 2924#endif /* not WINDOWSNT */
2932} 2925}
2933 2926
2934/* Auxiliary error-handling function for init_tty. 2927/* Auxiliary error-handling function for init_tty.
2935 Free BUFFER and delete DISPLAY, then call error or fatal 2928 Free BUFFER and delete DEVICE, then call error or fatal
2936 with str1 or str2, respectively, according to MUST_SUCCEED. */ 2929 with str1 or str2, respectively, according to MUST_SUCCEED. */
2937 2930
2938static void 2931static void
2939maybe_fatal (must_succeed, buffer, display, str1, str2, arg1, arg2) 2932maybe_fatal (must_succeed, buffer, device, str1, str2, arg1, arg2)
2940 int must_succeed; 2933 int must_succeed;
2941 char *buffer; 2934 char *buffer;
2942 struct display *display; 2935 struct device *device;
2943 char *str1, *str2, *arg1, *arg2; 2936 char *str1, *str2, *arg1, *arg2;
2944{ 2937{
2945 if (buffer) 2938 if (buffer)
2946 xfree (buffer); 2939 xfree (buffer);
2947 2940
2948 if (display) 2941 if (device)
2949 delete_tty (display); 2942 delete_tty (device);
2950 2943
2951 if (must_succeed) 2944 if (must_succeed)
2952 fatal (str2, arg1, arg2); 2945 fatal (str2, arg1, arg2);
@@ -2976,35 +2969,35 @@ static int deleting_tty = 0;
2976/* Delete the given terminal device, closing all frames on it. */ 2969/* Delete the given terminal device, closing all frames on it. */
2977 2970
2978void 2971void
2979delete_tty (struct display *display) 2972delete_tty (struct device *device)
2980{ 2973{
2981 struct tty_display_info *tty; 2974 struct tty_display_info *tty;
2982 Lisp_Object tail, frame; 2975 Lisp_Object tail, frame;
2983 char *tty_name; 2976 char *tty_name;
2984 int last_display; 2977 int last_device;
2985 2978
2986 if (deleting_tty) 2979 if (deleting_tty)
2987 /* We get a recursive call when we delete the last frame on this 2980 /* We get a recursive call when we delete the last frame on this
2988 display. */ 2981 device. */
2989 return; 2982 return;
2990 2983
2991 if (display->type != output_termcap) 2984 if (device->type != output_termcap)
2992 abort (); 2985 abort ();
2993 2986
2994 tty = display->display_info.tty; 2987 tty = device->display_info.tty;
2995 2988
2996 last_display = 1; 2989 last_device = 1;
2997 FOR_EACH_FRAME (tail, frame) 2990 FOR_EACH_FRAME (tail, frame)
2998 { 2991 {
2999 struct frame *f = XFRAME (frame); 2992 struct frame *f = XFRAME (frame);
3000 if (FRAME_LIVE_P (f) && (!FRAME_TERMCAP_P (f) || FRAME_TTY (f) != tty)) 2993 if (FRAME_LIVE_P (f) && (!FRAME_TERMCAP_P (f) || FRAME_TTY (f) != tty))
3001 { 2994 {
3002 last_display = 0; 2995 last_device = 0;
3003 break; 2996 break;
3004 } 2997 }
3005 } 2998 }
3006 if (last_display) 2999 if (last_device)
3007 error ("Attempt to delete the sole display with live frames"); 3000 error ("Attempt to delete the sole display device with live frames");
3008 3001
3009 if (tty == tty_list) 3002 if (tty == tty_list)
3010 tty_list = tty->next; 3003 tty_list = tty->next;
@@ -3033,11 +3026,11 @@ delete_tty (struct display *display)
3033 } 3026 }
3034 } 3027 }
3035 3028
3036 /* reset_sys_modes needs a valid display, so this call needs to be 3029 /* reset_sys_modes needs a valid device, so this call needs to be
3037 before delete_display. */ 3030 before delete_device. */
3038 reset_sys_modes (tty); 3031 reset_sys_modes (tty);
3039 3032
3040 delete_display (display); 3033 delete_device (device);
3041 3034
3042 tty_name = tty->name; 3035 tty_name = tty->name;
3043 if (tty->type) 3036 if (tty->type)
@@ -3068,7 +3061,7 @@ delete_tty (struct display *display)
3068 3061
3069 3062
3070/* Initialize the tty-dependent part of frame F. The frame must 3063/* Initialize the tty-dependent part of frame F. The frame must
3071 already have its display initialized. */ 3064 already have its device initialized. */
3072 3065
3073void 3066void
3074create_tty_output (struct frame *f) 3067create_tty_output (struct frame *f)
@@ -3081,7 +3074,7 @@ create_tty_output (struct frame *f)
3081 t = xmalloc (sizeof (struct tty_output)); 3074 t = xmalloc (sizeof (struct tty_output));
3082 bzero (t, sizeof (struct tty_output)); 3075 bzero (t, sizeof (struct tty_output));
3083 3076
3084 t->display_info = FRAME_DISPLAY (f)->display_info.tty; 3077 t->display_info = FRAME_DEVICE (f)->display_info.tty;
3085 3078
3086 f->output_data.tty = t; 3079 f->output_data.tty = t;
3087} 3080}
@@ -3117,119 +3110,119 @@ mark_ttys ()
3117 3110
3118 3111
3119 3112
3120/* Create a new display object and add it to the display list. */ 3113/* Create a new device object and add it to the device list. */
3121 3114
3122struct display * 3115struct device *
3123create_display (void) 3116create_device (void)
3124{ 3117{
3125 struct display *display = (struct display *) xmalloc (sizeof (struct display)); 3118 struct device *device = (struct device *) xmalloc (sizeof (struct device));
3126 3119
3127 bzero (display, sizeof (struct display)); 3120 bzero (device, sizeof (struct device));
3128 display->next_display = display_list; 3121 device->next_device = device_list;
3129 display_list = display; 3122 device_list = device;
3130 3123
3131 display->id = next_display_id++; 3124 device->id = next_device_id++;
3132 3125
3133 display->keyboard_coding = 3126 device->keyboard_coding =
3134 (struct coding_system *) xmalloc (sizeof (struct coding_system)); 3127 (struct coding_system *) xmalloc (sizeof (struct coding_system));
3135 display->terminal_coding = 3128 device->terminal_coding =
3136 (struct coding_system *) xmalloc (sizeof (struct coding_system)); 3129 (struct coding_system *) xmalloc (sizeof (struct coding_system));
3137 3130
3138 setup_coding_system (Qnil, display->keyboard_coding); 3131 setup_coding_system (Qnil, device->keyboard_coding);
3139 setup_coding_system (Qnil, display->terminal_coding); 3132 setup_coding_system (Qnil, device->terminal_coding);
3140 3133
3141 return display; 3134 return device;
3142} 3135}
3143 3136
3144/* Remove a display from the display list and free its memory. */ 3137/* Remove a device from the device list and free its memory. */
3145 3138
3146void 3139void
3147delete_display (struct display *display) 3140delete_device (struct device *device)
3148{ 3141{
3149 struct display **dp; 3142 struct device **dp;
3150 Lisp_Object tail, frame; 3143 Lisp_Object tail, frame;
3151 3144
3152 /* Check for and close live frames that are still on this 3145 /* Check for and close live frames that are still on this
3153 display. */ 3146 device. */
3154 FOR_EACH_FRAME (tail, frame) 3147 FOR_EACH_FRAME (tail, frame)
3155 { 3148 {
3156 struct frame *f = XFRAME (frame); 3149 struct frame *f = XFRAME (frame);
3157 if (FRAME_LIVE_P (f) && f->display == display) 3150 if (FRAME_LIVE_P (f) && f->device == device)
3158 { 3151 {
3159 Fdelete_frame (frame, Qt); 3152 Fdelete_frame (frame, Qt);
3160 } 3153 }
3161 } 3154 }
3162 3155
3163 for (dp = &display_list; *dp != display; dp = &(*dp)->next_display) 3156 for (dp = &device_list; *dp != device; dp = &(*dp)->next_device)
3164 if (! *dp) 3157 if (! *dp)
3165 abort (); 3158 abort ();
3166 *dp = display->next_display; 3159 *dp = device->next_device;
3167 3160
3168 if (display->keyboard_coding) 3161 if (device->keyboard_coding)
3169 xfree (display->keyboard_coding); 3162 xfree (device->keyboard_coding);
3170 if (display->terminal_coding) 3163 if (device->terminal_coding)
3171 xfree (display->terminal_coding); 3164 xfree (device->terminal_coding);
3172 if (display->name) 3165 if (device->name)
3173 xfree (display->name); 3166 xfree (device->name);
3174 3167
3175#ifdef MULTI_KBOARD 3168#ifdef MULTI_KBOARD
3176 if (display->kboard && --display->kboard->reference_count == 0) 3169 if (device->kboard && --device->kboard->reference_count == 0)
3177 delete_kboard (display->kboard); 3170 delete_kboard (device->kboard);
3178#endif 3171#endif
3179 3172
3180 bzero (display, sizeof (struct display)); 3173 bzero (device, sizeof (struct device));
3181 xfree (display); 3174 xfree (device);
3182} 3175}
3183 3176
3184DEFUN ("delete-display", Fdelete_display, Sdelete_display, 0, 2, 0, 3177DEFUN ("delete-display", Fdelete_display, Sdelete_display, 0, 2, 0,
3185 doc: /* Delete DISPLAY by deleting all frames on it and closing the device. 3178 doc: /* Delete DEVICE by deleting all frames on it and closing the device.
3186DISPLAY may be a display id, a frame, or nil for the display 3179DEVICE may be a display device id, a frame, or nil (meaning the
3187device of the current frame. 3180selected frame's display device).
3188 3181
3189Normally, you may not delete a display if all other displays are suspended, 3182Normally, you may not delete a display if all other displays are suspended,
3190but if the second argument FORCE is non-nil, you may do so. */) 3183but if the second argument FORCE is non-nil, you may do so. */)
3191 (display, force) 3184 (device, force)
3192 Lisp_Object display, force; 3185 Lisp_Object device, force;
3193{ 3186{
3194 struct display *d, *p; 3187 struct device *d, *p;
3195 3188
3196 d = get_display (display, 0); 3189 d = get_device (device, 0);
3197 3190
3198 if (!d) 3191 if (!d)
3199 return Qnil; 3192 return Qnil;
3200 3193
3201 p = display_list; 3194 p = device_list;
3202 while (p && (p == d || !DISPLAY_ACTIVE_P (p))) 3195 while (p && (p == d || !DEVICE_ACTIVE_P (p)))
3203 p = p->next_display; 3196 p = p->next_device;
3204 3197
3205 if (NILP (force) && !p) 3198 if (NILP (force) && !p)
3206 error ("Attempt to delete the sole active display"); 3199 error ("Attempt to delete the sole active display device");
3207 3200
3208 if (d->delete_display_hook) 3201 if (d->delete_device_hook)
3209 (*d->delete_display_hook) (d); 3202 (*d->delete_device_hook) (d);
3210 else 3203 else
3211 delete_display (d); 3204 delete_device (d);
3212 3205
3213 return Qnil; 3206 return Qnil;
3214} 3207}
3215 3208
3216DEFUN ("display-live-p", Fdisplay_live_p, Sdisplay_live_p, 1, 1, 0, 3209DEFUN ("display-live-p", Fdisplay_live_p, Sdisplay_live_p, 1, 1, 0,
3217 doc: /* Return non-nil if OBJECT is a display which has not been deleted. 3210 doc: /* Return non-nil if OBJECT is a device which has not been deleted.
3218Value is nil if OBJECT is not a live display. 3211Value is nil if OBJECT is not a live display device.
3219If object is a live display, the return value indicates what sort of 3212If object is a live display device, the return value indicates what
3220output device it uses. See the documentation of `framep' for possible 3213sort of output device it uses. See the documentation of `framep' for
3221return values. 3214possible return values.
3222 3215
3223Displays are represented by their integer identifiers. */) 3216Display devices are represented by their integer identifiers. */)
3224 (object) 3217 (object)
3225 Lisp_Object object; 3218 Lisp_Object object;
3226{ 3219{
3227 struct display *d; 3220 struct device *d;
3228 3221
3229 if (!INTEGERP (object)) 3222 if (!INTEGERP (object))
3230 return Qnil; 3223 return Qnil;
3231 3224
3232 d = get_display (object, 0); 3225 d = get_device (object, 0);
3233 3226
3234 if (!d) 3227 if (!d)
3235 return Qnil; 3228 return Qnil;
@@ -3253,17 +3246,17 @@ Displays are represented by their integer identifiers. */)
3253} 3246}
3254 3247
3255DEFUN ("display-list", Fdisplay_list, Sdisplay_list, 0, 0, 0, 3248DEFUN ("display-list", Fdisplay_list, Sdisplay_list, 0, 0, 0,
3256 doc: /* Return a list of all displays. 3249 doc: /* Return a list of all display devices.
3257Displays are represented by their integer identifiers. */) 3250Display devices are represented by their integer identifiers. */)
3258 () 3251 ()
3259{ 3252{
3260 Lisp_Object displays = Qnil; 3253 Lisp_Object devices = Qnil;
3261 struct display *d; 3254 struct device *d;
3262 3255
3263 for (d = display_list; d; d = d->next_display) 3256 for (d = device_list; d; d = d->next_device)
3264 displays = Fcons (make_number (d->id), displays); 3257 devices = Fcons (make_number (d->id), devices);
3265 3258
3266 return displays; 3259 return devices;
3267} 3260}
3268 3261
3269 3262
@@ -3291,7 +3284,7 @@ it. */)
3291 (tty) 3284 (tty)
3292 Lisp_Object tty; 3285 Lisp_Object tty;
3293{ 3286{
3294 struct display *d = get_tty_display (tty); 3287 struct device *d = get_tty_device (tty);
3295 FILE *f; 3288 FILE *f;
3296 3289
3297 if (!d) 3290 if (!d)
@@ -3349,7 +3342,7 @@ currently selected frame. */)
3349 (tty) 3342 (tty)
3350 Lisp_Object tty; 3343 Lisp_Object tty;
3351{ 3344{
3352 struct display *d = get_tty_display (tty); 3345 struct device *d = get_tty_device (tty);
3353 int fd; 3346 int fd;
3354 3347
3355 if (!d) 3348 if (!d)
@@ -3357,7 +3350,7 @@ currently selected frame. */)
3357 3350
3358 if (!d->display_info.tty->input) 3351 if (!d->display_info.tty->input)
3359 { 3352 {
3360 if (get_named_tty_display (d->display_info.tty->name)) 3353 if (get_named_tty (d->display_info.tty->name))
3361 error ("Cannot resume display while another display is active on the same device"); 3354 error ("Cannot resume display while another display is active on the same device");
3362 3355
3363 fd = emacs_open (d->display_info.tty->name, O_RDWR | O_NOCTTY, 0); 3356 fd = emacs_open (d->display_info.tty->name, O_RDWR | O_NOCTTY, 0);