aboutsummaryrefslogtreecommitdiffstats
path: root/src/term.c
diff options
context:
space:
mode:
authorKaroly Lorentey2004-01-01 17:55:53 +0000
committerKaroly Lorentey2004-01-01 17:55:53 +0000
commit28d7d09f841801cd052bb4ba0df92016b9245870 (patch)
treeeed006b0a32c39edb7a37d893bb2b192c63b69a5 /src/term.c
parent819b8f00ed7b8a9a2190efaa02376ed332ecf763 (diff)
downloademacs-28d7d09f841801cd052bb4ba0df92016b9245870.tar.gz
emacs-28d7d09f841801cd052bb4ba0df92016b9245870.zip
Separate frame-local, tty-dependent parameters from tty-local parameters.
src/termchar.h (struct tty_output): Redefined to contain frame-local tty-dependent parameters. (Currently there are no such parameters, so it consists of the tty_display_info pointer.) (struct tty_display_info): New structure, with reference_count. (FRAME_TTY): Updated to reflect new termcap frame structure. src/term.c: Update prototypes. Use tty_display_info instead of tty_output. src/cm.c (current_tty, cmcheckmagic, cmcostinit, calccost, cmgoto, Wcm_clear) (Wcm_init): Use tty_display_info instead of tty_output. src/cm.h: Update prototypes. src/dispextern.h: Ditto. src/dispnew.c (window_change_signal, init_display, make_terminal_frame): Use tty_display_info instead of tty_output. src/frame.c (Fdelete_frame): Use tty_display_info instead of tty_output. Fix delete_tty check. (make_terminal_frame): Allocate f->output_data.tty. Increase reference count of tty device. (delete_frame): Free f->output_data.tty. Use reference count to decide if the tty should be closed. src/frame.h (FRAME_FOREGROUND_PIXEL, FRAME_BACKGROUND_PIXEL): New, unconditional definitions. (struct device): New declaration (at the moment, it is defined as empty in termhooks.h). (struct frame): Added display, background_pixel, foreground_pixel member. src/keyboard.c (read_avail_input): Use tty_display_info instead of tty_output. src/lisp.h: Declare struct display. Update prototypes. src/sysdep.c: Update prototypes. (discard_tty_input, init_all_sys_modes, init_sys_modes, reset_all_sys_modes) (reset_sys_modes, hft_init, hft_reset): Use tty_display_info instead of tty_output. git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-29
Diffstat (limited to 'src/term.c')
-rw-r--r--src/term.c145
1 files changed, 72 insertions, 73 deletions
diff --git a/src/term.c b/src/term.c
index 25f26e3c6e2..cce411debe7 100644
--- a/src/term.c
+++ b/src/term.c
@@ -69,11 +69,11 @@ extern int tgetnum P_ ((char *id));
69 69
70static void turn_on_face P_ ((struct frame *, int face_id)); 70static void turn_on_face P_ ((struct frame *, int face_id));
71static void turn_off_face P_ ((struct frame *, int face_id)); 71static void turn_off_face P_ ((struct frame *, int face_id));
72static void tty_show_cursor P_ ((struct tty_output *)); 72static void tty_show_cursor P_ ((struct tty_display_info *));
73static void tty_hide_cursor P_ ((struct tty_output *)); 73static void tty_hide_cursor P_ ((struct tty_display_info *));
74 74
75void delete_tty P_ ((struct tty_output *)); 75void delete_tty P_ ((struct tty_display_info *));
76static void delete_tty_1 P_ ((struct tty_output *)); 76static void delete_tty_1 P_ ((struct tty_display_info *));
77 77
78 78
79#define OUTPUT(tty, a) \ 79#define OUTPUT(tty, a) \
@@ -102,7 +102,7 @@ Lisp_Object Vring_bell_function;
102 102
103/* Terminal characteristics that higher levels want to look at. */ 103/* Terminal characteristics that higher levels want to look at. */
104 104
105struct tty_output *tty_list; 105struct tty_display_info *tty_list;
106 106
107/* Nonzero means no need to redraw the entire frame on resuming a 107/* Nonzero means no need to redraw the entire frame on resuming a
108 suspended Emacs. This is useful on terminals with multiple 108 suspended Emacs. This is useful on terminals with multiple
@@ -319,12 +319,12 @@ ring_bell ()
319 else if (!FRAME_TERMCAP_P (f)) 319 else if (!FRAME_TERMCAP_P (f))
320 (*ring_bell_hook) (); 320 (*ring_bell_hook) ();
321 else { 321 else {
322 struct tty_output *tty = FRAME_TTY (f); 322 struct tty_display_info *tty = FRAME_TTY (f);
323 OUTPUT (tty, tty->TS_visible_bell && visible_bell ? tty->TS_visible_bell : tty->TS_bell); 323 OUTPUT (tty, tty->TS_visible_bell && visible_bell ? tty->TS_visible_bell : tty->TS_bell);
324 } 324 }
325} 325}
326 326
327void tty_set_terminal_modes (struct tty_output *tty) 327void tty_set_terminal_modes (struct tty_display_info *tty)
328{ 328{
329 OUTPUT_IF (tty, tty->TS_termcap_modes); 329 OUTPUT_IF (tty, tty->TS_termcap_modes);
330 OUTPUT_IF (tty, tty->TS_cursor_visible); 330 OUTPUT_IF (tty, tty->TS_cursor_visible);
@@ -342,7 +342,7 @@ set_terminal_modes ()
342 (*set_terminal_modes_hook) (); 342 (*set_terminal_modes_hook) ();
343} 343}
344 344
345void tty_reset_terminal_modes (struct tty_output *tty) 345void tty_reset_terminal_modes (struct tty_display_info *tty)
346{ 346{
347 turn_off_highlight (tty); 347 turn_off_highlight (tty);
348 turn_off_insert (tty); 348 turn_off_insert (tty);
@@ -380,7 +380,7 @@ update_end (f)
380{ 380{
381 if (FRAME_TERMCAP_P (f)) 381 if (FRAME_TERMCAP_P (f))
382 { 382 {
383 struct tty_output *tty = FRAME_TTY (f); 383 struct tty_display_info *tty = FRAME_TTY (f);
384 if (!XWINDOW (selected_window)->cursor_off_p) 384 if (!XWINDOW (selected_window)->cursor_off_p)
385 tty_show_cursor (tty); 385 tty_show_cursor (tty);
386 turn_off_insert (tty); 386 turn_off_insert (tty);
@@ -399,7 +399,7 @@ set_terminal_window (size)
399 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame)); 399 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
400 if (FRAME_TERMCAP_P (f)) 400 if (FRAME_TERMCAP_P (f))
401 { 401 {
402 struct tty_output *tty = FRAME_TTY (f); 402 struct tty_display_info *tty = FRAME_TTY (f);
403 tty->specified_window = size ? size : FRAME_LINES (f); 403 tty->specified_window = size ? size : FRAME_LINES (f);
404 if (TTY_SCROLL_REGION_OK (tty)) 404 if (TTY_SCROLL_REGION_OK (tty))
405 set_scroll_region (0, tty->specified_window); 405 set_scroll_region (0, tty->specified_window);
@@ -414,7 +414,7 @@ set_scroll_region (start, stop)
414{ 414{
415 char *buf; 415 char *buf;
416 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame)); 416 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
417 struct tty_output *tty = FRAME_TTY (f); 417 struct tty_display_info *tty = FRAME_TTY (f);
418 418
419 if (tty->TS_set_scroll_region) 419 if (tty->TS_set_scroll_region)
420 buf = tparam (tty->TS_set_scroll_region, 0, 0, start, stop - 1); 420 buf = tparam (tty->TS_set_scroll_region, 0, 0, start, stop - 1);
@@ -433,7 +433,7 @@ set_scroll_region (start, stop)
433 433
434 434
435static void 435static void
436turn_on_insert (struct tty_output *tty) 436turn_on_insert (struct tty_display_info *tty)
437{ 437{
438 if (!tty->insert_mode) 438 if (!tty->insert_mode)
439 OUTPUT (tty, tty->TS_insert_mode); 439 OUTPUT (tty, tty->TS_insert_mode);
@@ -441,7 +441,7 @@ turn_on_insert (struct tty_output *tty)
441} 441}
442 442
443void 443void
444turn_off_insert (struct tty_output *tty) 444turn_off_insert (struct tty_display_info *tty)
445{ 445{
446 if (tty->insert_mode) 446 if (tty->insert_mode)
447 OUTPUT (tty, tty->TS_end_insert_mode); 447 OUTPUT (tty, tty->TS_end_insert_mode);
@@ -451,7 +451,7 @@ turn_off_insert (struct tty_output *tty)
451/* Handle highlighting. */ 451/* Handle highlighting. */
452 452
453void 453void
454turn_off_highlight (struct tty_output *tty) 454turn_off_highlight (struct tty_display_info *tty)
455{ 455{
456 if (tty->standout_mode) 456 if (tty->standout_mode)
457 OUTPUT_IF (tty, tty->TS_end_standout_mode); 457 OUTPUT_IF (tty, tty->TS_end_standout_mode);
@@ -459,7 +459,7 @@ turn_off_highlight (struct tty_output *tty)
459} 459}
460 460
461static void 461static void
462turn_on_highlight (struct tty_output *tty) 462turn_on_highlight (struct tty_display_info *tty)
463{ 463{
464 if (!tty->standout_mode) 464 if (!tty->standout_mode)
465 OUTPUT_IF (tty, tty->TS_standout_mode); 465 OUTPUT_IF (tty, tty->TS_standout_mode);
@@ -467,7 +467,7 @@ turn_on_highlight (struct tty_output *tty)
467} 467}
468 468
469static void 469static void
470toggle_highlight (struct tty_output *tty) 470toggle_highlight (struct tty_display_info *tty)
471{ 471{
472 if (tty->standout_mode) 472 if (tty->standout_mode)
473 turn_off_highlight (tty); 473 turn_off_highlight (tty);
@@ -479,7 +479,7 @@ toggle_highlight (struct tty_output *tty)
479/* Make cursor invisible. */ 479/* Make cursor invisible. */
480 480
481static void 481static void
482tty_hide_cursor (struct tty_output *tty) 482tty_hide_cursor (struct tty_display_info *tty)
483{ 483{
484 if (tty->cursor_hidden == 0) 484 if (tty->cursor_hidden == 0)
485 { 485 {
@@ -492,7 +492,7 @@ tty_hide_cursor (struct tty_output *tty)
492/* Ensure that cursor is visible. */ 492/* Ensure that cursor is visible. */
493 493
494static void 494static void
495tty_show_cursor (struct tty_output *tty) 495tty_show_cursor (struct tty_display_info *tty)
496{ 496{
497 if (tty->cursor_hidden) 497 if (tty->cursor_hidden)
498 { 498 {
@@ -508,7 +508,7 @@ tty_show_cursor (struct tty_output *tty)
508 depends on the user option inverse-video. */ 508 depends on the user option inverse-video. */
509 509
510void 510void
511background_highlight (struct tty_output *tty) 511background_highlight (struct tty_display_info *tty)
512{ 512{
513 if (inverse_video) 513 if (inverse_video)
514 turn_on_highlight (tty); 514 turn_on_highlight (tty);
@@ -519,7 +519,7 @@ background_highlight (struct tty_output *tty)
519/* Set standout mode to the mode specified for the text to be output. */ 519/* Set standout mode to the mode specified for the text to be output. */
520 520
521static void 521static void
522highlight_if_desired (struct tty_output *tty) 522highlight_if_desired (struct tty_display_info *tty)
523{ 523{
524 if (inverse_video) 524 if (inverse_video)
525 turn_on_highlight (tty); 525 turn_on_highlight (tty);
@@ -536,7 +536,7 @@ cursor_to (vpos, hpos)
536 int vpos, hpos; 536 int vpos, hpos;
537{ 537{
538 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame)); 538 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
539 struct tty_output *tty; 539 struct tty_display_info *tty;
540 540
541 if (! FRAME_TERMCAP_P (f) && cursor_to_hook) 541 if (! FRAME_TERMCAP_P (f) && cursor_to_hook)
542 { 542 {
@@ -568,7 +568,7 @@ raw_cursor_to (row, col)
568 int row, col; 568 int row, col;
569{ 569{
570 struct frame *f = updating_frame ? updating_frame : XFRAME (selected_frame); 570 struct frame *f = updating_frame ? updating_frame : XFRAME (selected_frame);
571 struct tty_output *tty; 571 struct tty_display_info *tty;
572 if (! FRAME_TERMCAP_P (f)) 572 if (! FRAME_TERMCAP_P (f))
573 { 573 {
574 (*raw_cursor_to_hook) (row, col); 574 (*raw_cursor_to_hook) (row, col);
@@ -594,7 +594,7 @@ clear_to_end ()
594 register int i; 594 register int i;
595 595
596 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame)); 596 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
597 struct tty_output *tty; 597 struct tty_display_info *tty;
598 598
599 if (clear_to_end_hook && ! FRAME_TERMCAP_P (f)) 599 if (clear_to_end_hook && ! FRAME_TERMCAP_P (f))
600 { 600 {
@@ -623,7 +623,7 @@ void
623clear_frame () 623clear_frame ()
624{ 624{
625 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame)); 625 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
626 struct tty_output *tty; 626 struct tty_display_info *tty;
627 627
628 if (clear_frame_hook && ! FRAME_TERMCAP_P (f)) 628 if (clear_frame_hook && ! FRAME_TERMCAP_P (f))
629 { 629 {
@@ -654,7 +654,7 @@ clear_end_of_line (first_unused_hpos)
654 int first_unused_hpos; 654 int first_unused_hpos;
655{ 655{
656 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame)); 656 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
657 struct tty_output *tty; 657 struct tty_display_info *tty;
658 658
659 if (clear_end_of_line_hook 659 if (clear_end_of_line_hook
660 && ! FRAME_TERMCAP_P (f)) 660 && ! FRAME_TERMCAP_P (f))
@@ -667,7 +667,7 @@ clear_end_of_line (first_unused_hpos)
667} 667}
668 668
669void 669void
670tty_clear_end_of_line (struct tty_output *tty, int first_unused_hpos) 670tty_clear_end_of_line (struct tty_display_info *tty, int first_unused_hpos)
671{ 671{
672 register int i; 672 register int i;
673 /* Detect the case where we are called from reset_sys_modes 673 /* Detect the case where we are called from reset_sys_modes
@@ -818,7 +818,7 @@ write_glyphs (string, len)
818{ 818{
819 int produced, consumed; 819 int produced, consumed;
820 struct frame *f = updating_frame ? updating_frame : XFRAME (selected_frame); 820 struct frame *f = updating_frame ? updating_frame : XFRAME (selected_frame);
821 struct tty_output *tty; 821 struct tty_display_info *tty;
822 unsigned char conversion_buffer[1024]; 822 unsigned char conversion_buffer[1024];
823 int conversion_buffer_size = sizeof conversion_buffer; 823 int conversion_buffer_size = sizeof conversion_buffer;
824 824
@@ -923,7 +923,7 @@ insert_glyphs (start, len)
923 char *buf; 923 char *buf;
924 struct glyph *glyph = NULL; 924 struct glyph *glyph = NULL;
925 struct frame *f; 925 struct frame *f;
926 struct tty_output *tty; 926 struct tty_display_info *tty;
927 927
928 if (len <= 0) 928 if (len <= 0)
929 return; 929 return;
@@ -1016,7 +1016,7 @@ delete_glyphs (n)
1016 char *buf; 1016 char *buf;
1017 register int i; 1017 register int i;
1018 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame)); 1018 struct frame *f = (updating_frame ? updating_frame : XFRAME (selected_frame));
1019 struct tty_output *tty = FRAME_TTY (f); 1019 struct tty_display_info *tty = FRAME_TTY (f);
1020 1020
1021 if (delete_glyphs_hook && ! FRAME_TERMCAP_P (f)) 1021 if (delete_glyphs_hook && ! FRAME_TERMCAP_P (f))
1022 { 1022 {
@@ -1062,7 +1062,7 @@ ins_del_lines (vpos, n)
1062 } 1062 }
1063 else 1063 else
1064 { 1064 {
1065 struct tty_output *tty = FRAME_TTY (f); 1065 struct tty_display_info *tty = FRAME_TTY (f);
1066 char *multi = n > 0 ? tty->TS_ins_multi_lines : tty->TS_del_multi_lines; 1066 char *multi = n > 0 ? tty->TS_ins_multi_lines : tty->TS_del_multi_lines;
1067 char *single = n > 0 ? tty->TS_ins_line : tty->TS_del_line; 1067 char *single = n > 0 ? tty->TS_ins_line : tty->TS_del_line;
1068 char *scroll = n > 0 ? tty->TS_rev_scroll : tty->TS_fwd_scroll; 1068 char *scroll = n > 0 ? tty->TS_rev_scroll : tty->TS_fwd_scroll;
@@ -1181,7 +1181,7 @@ static void
1181calculate_ins_del_char_costs (f) 1181calculate_ins_del_char_costs (f)
1182 FRAME_PTR f; 1182 FRAME_PTR f;
1183{ 1183{
1184 struct tty_output *tty = FRAME_TTY (f); 1184 struct tty_display_info *tty = FRAME_TTY (f);
1185 int ins_startup_cost, del_startup_cost; 1185 int ins_startup_cost, del_startup_cost;
1186 int ins_cost_per_char, del_cost_per_char; 1186 int ins_cost_per_char, del_cost_per_char;
1187 register int i; 1187 register int i;
@@ -1243,7 +1243,7 @@ void
1243calculate_costs (frame) 1243calculate_costs (frame)
1244 FRAME_PTR frame; 1244 FRAME_PTR frame;
1245{ 1245{
1246 struct tty_output *tty = FRAME_TTY (frame); 1246 struct tty_display_info *tty = FRAME_TTY (frame);
1247 register char *f = (tty->TS_set_scroll_region 1247 register char *f = (tty->TS_set_scroll_region
1248 ? tty->TS_set_scroll_region 1248 ? tty->TS_set_scroll_region
1249 : tty->TS_set_scroll_region_1); 1249 : tty->TS_set_scroll_region_1);
@@ -1251,7 +1251,7 @@ calculate_costs (frame)
1251 FRAME_COST_BAUD_RATE (frame) = baud_rate; 1251 FRAME_COST_BAUD_RATE (frame) = baud_rate;
1252 1252
1253 if (FRAME_TERMCAP_P (frame)) 1253 if (FRAME_TERMCAP_P (frame))
1254 TTY_SCROLL_REGION_COST (frame->output_data.tty) = string_cost (f); 1254 TTY_SCROLL_REGION_COST (FRAME_TTY (frame)) = string_cost (f);
1255 1255
1256 /* These variables are only used for terminal stuff. They are allocated 1256 /* These variables are only used for terminal stuff. They are allocated
1257 once for the terminal frame of X-windows emacs, but not used afterwards. 1257 once for the terminal frame of X-windows emacs, but not used afterwards.
@@ -1761,7 +1761,7 @@ turn_on_face (f, face_id)
1761 struct face *face = FACE_FROM_ID (f, face_id); 1761 struct face *face = FACE_FROM_ID (f, face_id);
1762 long fg = face->foreground; 1762 long fg = face->foreground;
1763 long bg = face->background; 1763 long bg = face->background;
1764 struct tty_output *tty = FRAME_TTY (f); 1764 struct tty_display_info *tty = FRAME_TTY (f);
1765 1765
1766 /* Do this first because TS_end_standout_mode may be the same 1766 /* Do this first because TS_end_standout_mode may be the same
1767 as TS_exit_attribute_mode, which turns all appearances off. */ 1767 as TS_exit_attribute_mode, which turns all appearances off. */
@@ -1859,7 +1859,7 @@ turn_off_face (f, face_id)
1859 int face_id; 1859 int face_id;
1860{ 1860{
1861 struct face *face = FACE_FROM_ID (f, face_id); 1861 struct face *face = FACE_FROM_ID (f, face_id);
1862 struct tty_output *tty = FRAME_TTY (f); 1862 struct tty_display_info *tty = FRAME_TTY (f);
1863 1863
1864 xassert (face != NULL); 1864 xassert (face != NULL);
1865 1865
@@ -1910,7 +1910,7 @@ turn_off_face (f, face_id)
1910 1910
1911int 1911int
1912tty_capable_p (tty, caps, fg, bg) 1912tty_capable_p (tty, caps, fg, bg)
1913 struct tty_output *tty; 1913 struct tty_display_info *tty;
1914 unsigned caps; 1914 unsigned caps;
1915 unsigned long fg, bg; 1915 unsigned long fg, bg;
1916{ 1916{
@@ -1938,7 +1938,7 @@ DEFUN ("tty-display-color-p", Ftty_display_color_p, Stty_display_color_p,
1938 (display) 1938 (display)
1939 Lisp_Object display; 1939 Lisp_Object display;
1940{ 1940{
1941 struct tty_output *tty = FRAME_TTY (SELECTED_FRAME ()); 1941 struct tty_display_info *tty = FRAME_TTY (SELECTED_FRAME ());
1942 return tty->TN_max_colors > 0 ? Qt : Qnil; 1942 return tty->TN_max_colors > 0 ? Qt : Qnil;
1943} 1943}
1944 1944
@@ -1949,7 +1949,7 @@ DEFUN ("tty-display-color-cells", Ftty_display_color_cells,
1949 (display) 1949 (display)
1950 Lisp_Object display; 1950 Lisp_Object display;
1951{ 1951{
1952 struct tty_output *tty = FRAME_TTY (SELECTED_FRAME ()); 1952 struct tty_display_info *tty = FRAME_TTY (SELECTED_FRAME ());
1953 return make_number (tty->TN_max_colors); 1953 return make_number (tty->TN_max_colors);
1954} 1954}
1955 1955
@@ -1958,7 +1958,7 @@ DEFUN ("tty-display-color-cells", Ftty_display_color_cells,
1958/* Save or restore the default color-related capabilities of this 1958/* Save or restore the default color-related capabilities of this
1959 terminal. */ 1959 terminal. */
1960static void 1960static void
1961tty_default_color_capabilities (struct tty_output *tty, int save) 1961tty_default_color_capabilities (struct tty_display_info *tty, int save)
1962{ 1962{
1963 static char 1963 static char
1964 *default_orig_pair, *default_set_foreground, *default_set_background; 1964 *default_orig_pair, *default_set_foreground, *default_set_background;
@@ -2000,7 +2000,7 @@ tty_default_color_capabilities (struct tty_output *tty, int save)
2000 support; zero means set up for the default capabilities, the ones 2000 support; zero means set up for the default capabilities, the ones
2001 we saw at term_init time; -1 means turn off color support. */ 2001 we saw at term_init time; -1 means turn off color support. */
2002void 2002void
2003tty_setup_colors (struct tty_output *tty, int mode) 2003tty_setup_colors (struct tty_display_info *tty, int mode)
2004{ 2004{
2005 /* Canonicalize all negative values of MODE. */ 2005 /* Canonicalize all negative values of MODE. */
2006 if (mode < -1) 2006 if (mode < -1)
@@ -2092,11 +2092,11 @@ set_tty_color_mode (f, val)
2092 2092
2093 2093
2094 2094
2095struct tty_output * 2095struct tty_display_info *
2096get_named_tty (name) 2096get_named_tty (name)
2097 char *name; 2097 char *name;
2098{ 2098{
2099 struct tty_output *tty = tty_list; 2099 struct tty_display_info *tty = tty_list;
2100 2100
2101 while (tty) { 2101 while (tty) {
2102 if ((tty->name == 0 && name == 0) 2102 if ((tty->name == 0 && name == 0)
@@ -2130,8 +2130,8 @@ DEFUN ("frame-tty-name", Fframe_tty_name, Sframe_tty_name, 0, 1, 0,
2130 if (f->output_method != output_termcap) 2130 if (f->output_method != output_termcap)
2131 wrong_type_argument (Qframe_tty_name, frame); 2131 wrong_type_argument (Qframe_tty_name, frame);
2132 2132
2133 if (f->output_data.tty->name) 2133 if (FRAME_TTY (f)->name)
2134 return build_string (f->output_data.tty->name); 2134 return build_string (FRAME_TTY (f)->name);
2135 else 2135 else
2136 return Qnil; 2136 return Qnil;
2137} 2137}
@@ -2156,8 +2156,8 @@ DEFUN ("frame-tty-type", Fframe_tty_type, Sframe_tty_type, 0, 1, 0,
2156 if (f->output_method != output_termcap) 2156 if (f->output_method != output_termcap)
2157 wrong_type_argument (Qframe_tty_type, frame); 2157 wrong_type_argument (Qframe_tty_type, frame);
2158 2158
2159 if (f->output_data.tty->type) 2159 if (FRAME_TTY (f)->type)
2160 return build_string (f->output_data.tty->type); 2160 return build_string (FRAME_TTY (f)->type);
2161 else 2161 else
2162 return Qnil; 2162 return Qnil;
2163} 2163}
@@ -2167,22 +2167,22 @@ DEFUN ("frame-tty-type", Fframe_tty_type, Sframe_tty_type, 0, 1, 0,
2167 Initialization 2167 Initialization
2168 ***********************************************************************/ 2168 ***********************************************************************/
2169 2169
2170struct tty_output * 2170struct tty_display_info *
2171term_dummy_init (void) 2171term_dummy_init (void)
2172{ 2172{
2173 if (initialized || tty_list) 2173 if (initialized || tty_list)
2174 error ("tty already initialized"); 2174 error ("tty already initialized");
2175 2175
2176 tty_list = xmalloc (sizeof (struct tty_output)); 2176 tty_list = xmalloc (sizeof (struct tty_display_info));
2177 bzero (tty_list, sizeof (struct tty_output)); 2177 bzero (tty_list, sizeof (struct tty_display_info));
2178 TTY_NAME (tty_list) = 0; 2178 tty_list->name = 0;
2179 TTY_INPUT (tty_list) = stdin; 2179 tty_list->input = stdin;
2180 TTY_OUTPUT (tty_list) = stdout; 2180 tty_list->input = stdout;
2181 return tty_list; 2181 return tty_list;
2182} 2182}
2183 2183
2184 2184
2185struct tty_output * 2185struct tty_display_info *
2186term_init (Lisp_Object frame, char *name, char *terminal_type) 2186term_init (Lisp_Object frame, char *name, char *terminal_type)
2187{ 2187{
2188 char *area; 2188 char *area;
@@ -2192,7 +2192,7 @@ term_init (Lisp_Object frame, char *name, char *terminal_type)
2192 register char *p; 2192 register char *p;
2193 int status; 2193 int status;
2194 struct frame *f = XFRAME (frame); 2194 struct frame *f = XFRAME (frame);
2195 struct tty_output *tty; 2195 struct tty_display_info *tty;
2196 2196
2197 tty = get_named_tty (name); 2197 tty = get_named_tty (name);
2198 if (tty) 2198 if (tty)
@@ -2204,8 +2204,8 @@ term_init (Lisp_Object frame, char *name, char *terminal_type)
2204 } 2204 }
2205 else 2205 else
2206 { 2206 {
2207 tty = (struct tty_output *) xmalloc (sizeof (struct tty_output)); 2207 tty = (struct tty_display_info *) xmalloc (sizeof (struct tty_display_info));
2208 bzero (tty, sizeof (struct tty_output)); 2208 bzero (tty, sizeof (struct tty_display_info));
2209 tty->next = tty_list; 2209 tty->next = tty_list;
2210 tty_list = tty; 2210 tty_list = tty;
2211 } 2211 }
@@ -2216,7 +2216,9 @@ term_init (Lisp_Object frame, char *name, char *terminal_type)
2216 /* Make sure the frame is live; if an error happens, it must be 2216 /* Make sure the frame is live; if an error happens, it must be
2217 deleted. */ 2217 deleted. */
2218 f->output_method = output_termcap; 2218 f->output_method = output_termcap;
2219 f->output_data.tty = tty; 2219 if (! f->output_data.tty)
2220 abort ();
2221 f->output_data.tty->display_info = tty;
2220 2222
2221 if (name) 2223 if (name)
2222 { 2224 {
@@ -2229,18 +2231,18 @@ term_init (Lisp_Object frame, char *name, char *terminal_type)
2229 error ("Could not open file: %s", name); 2231 error ("Could not open file: %s", name);
2230 } 2232 }
2231 file = fdopen (fd, "w+"); 2233 file = fdopen (fd, "w+");
2232 TTY_NAME (tty) = xstrdup (name); 2234 tty->name = xstrdup (name);
2233 TTY_INPUT (tty) = file; 2235 tty->input = file;
2234 TTY_OUTPUT (tty) = file; 2236 tty->output = file;
2235 } 2237 }
2236 else 2238 else
2237 { 2239 {
2238 TTY_NAME (tty) = 0; 2240 tty->name = 0;
2239 TTY_INPUT (tty) = stdin; 2241 tty->input = stdin;
2240 TTY_OUTPUT (tty) = stdout; 2242 tty->output = stdout;
2241 } 2243 }
2242 2244
2243 TTY_TYPE (tty) = xstrdup (terminal_type); 2245 tty->type = xstrdup (terminal_type);
2244 2246
2245 add_keyboard_wait_descriptor (fileno (tty->input)); 2247 add_keyboard_wait_descriptor (fileno (tty->input));
2246 2248
@@ -2699,9 +2701,6 @@ to do `unset TERMCAP' (C-shell: `unsetenv TERMCAP') as well.",
2699 2701
2700 tty->top_frame = frame; 2702 tty->top_frame = frame;
2701 2703
2702 tty->foreground_pixel = FACE_TTY_DEFAULT_FG_COLOR;
2703 tty->background_pixel = FACE_TTY_DEFAULT_BG_COLOR;
2704
2705 /* Init system terminal modes (RAW or CBREAK, etc.). */ 2704 /* Init system terminal modes (RAW or CBREAK, etc.). */
2706 init_sys_modes (tty); 2705 init_sys_modes (tty);
2707 2706
@@ -2730,7 +2729,7 @@ DEFUN ("delete-tty", Fdelete_tty, Sdelete_tty, 0, 1, 0,
2730 (tty) 2729 (tty)
2731 Lisp_Object tty; 2730 Lisp_Object tty;
2732{ 2731{
2733 struct tty_output *t; 2732 struct tty_display_info *t;
2734 char *name = 0; 2733 char *name = 0;
2735 2734
2736 CHECK_STRING (tty); 2735 CHECK_STRING (tty);
@@ -2753,7 +2752,7 @@ DEFUN ("delete-tty", Fdelete_tty, Sdelete_tty, 0, 1, 0,
2753static int deleting_tty = 0; 2752static int deleting_tty = 0;
2754 2753
2755void 2754void
2756delete_tty (struct tty_output *tty) 2755delete_tty (struct tty_display_info *tty)
2757{ 2756{
2758 Lisp_Object tail, frame; 2757 Lisp_Object tail, frame;
2759 2758
@@ -2768,7 +2767,7 @@ delete_tty (struct tty_output *tty)
2768 tty_list = tty->next; 2767 tty_list = tty->next;
2769 else 2768 else
2770 { 2769 {
2771 struct tty_output *p; 2770 struct tty_display_info *p;
2772 for (p = tty_list; p && p->next != tty; p = p->next) 2771 for (p = tty_list; p && p->next != tty; p = p->next)
2773 ; 2772 ;
2774 2773
@@ -2814,7 +2813,7 @@ delete_tty (struct tty_output *tty)
2814 if (tty->Wcm) 2813 if (tty->Wcm)
2815 xfree (tty->Wcm); 2814 xfree (tty->Wcm);
2816 2815
2817 bzero (tty, sizeof (struct tty_output)); 2816 bzero (tty, sizeof (struct tty_display_info));
2818 xfree (tty); 2817 xfree (tty);
2819 deleting_tty = 0; 2818 deleting_tty = 0;
2820} 2819}
@@ -2822,12 +2821,12 @@ delete_tty (struct tty_output *tty)
2822 2821
2823 2822
2824 2823
2825/* Mark the pointers in the tty_output objects. 2824/* Mark the pointers in the tty_display_info objects.
2826 Called by the Fgarbage_collector. */ 2825 Called by the Fgarbage_collector. */
2827void 2826void
2828mark_ttys () 2827mark_ttys ()
2829{ 2828{
2830 struct tty_output *tty; 2829 struct tty_display_info *tty;
2831 Lisp_Object *p; 2830 Lisp_Object *p;
2832 for (tty = tty_list; tty; tty = tty->next) 2831 for (tty = tty_list; tty; tty = tty->next)
2833 { 2832 {