aboutsummaryrefslogtreecommitdiffstats
path: root/src/term.c
diff options
context:
space:
mode:
authorJim Blandy1992-07-13 20:53:59 +0000
committerJim Blandy1992-07-13 20:53:59 +0000
commitff11dfa15b3b56559bac0d5c6b0a26a80d2d5f6d (patch)
tree1d3957068bbd0a226e1bf934d04b099b2c0d15b8 /src/term.c
parent502b9b6441d9c3ce0fdc5f671447f30f11fb5afb (diff)
downloademacs-ff11dfa15b3b56559bac0d5c6b0a26a80d2d5f6d.tar.gz
emacs-ff11dfa15b3b56559bac0d5c6b0a26a80d2d5f6d.zip
*** empty log message ***
Diffstat (limited to 'src/term.c')
-rw-r--r--src/term.c246
1 files changed, 123 insertions, 123 deletions
diff --git a/src/term.c b/src/term.c
index 3663c44ff91..ede02179c8b 100644
--- a/src/term.c
+++ b/src/term.c
@@ -26,7 +26,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
26#include "cm.h" 26#include "cm.h"
27#undef NULL 27#undef NULL
28#include "lisp.h" 28#include "lisp.h"
29#include "screen.h" 29#include "frame.h"
30#include "disptab.h" 30#include "disptab.h"
31#include "termhooks.h" 31#include "termhooks.h"
32#include "keyboard.h" 32#include "keyboard.h"
@@ -34,10 +34,10 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
34#define max(a, b) ((a) > (b) ? (a) : (b)) 34#define max(a, b) ((a) > (b) ? (a) : (b))
35#define min(a, b) ((a) < (b) ? (a) : (b)) 35#define min(a, b) ((a) < (b) ? (a) : (b))
36 36
37#define OUTPUT(a) tputs (a, SCREEN_HEIGHT (selected_screen) - curY, cmputc) 37#define OUTPUT(a) tputs (a, FRAME_HEIGHT (selected_frame) - curY, cmputc)
38#define OUTPUT1(a) tputs (a, 1, cmputc) 38#define OUTPUT1(a) tputs (a, 1, cmputc)
39#define OUTPUTL(a, lines) tputs (a, lines, cmputc) 39#define OUTPUTL(a, lines) tputs (a, lines, cmputc)
40#define OUTPUT_IF(a) { if (a) tputs (a, SCREEN_HEIGHT (selected_screen) - curY, cmputc); } 40#define OUTPUT_IF(a) { if (a) tputs (a, FRAME_HEIGHT (selected_frame) - curY, cmputc); }
41#define OUTPUT1_IF(a) { if (a) tputs (a, 1, cmputc); } 41#define OUTPUT1_IF(a) { if (a) tputs (a, 1, cmputc); }
42 42
43/* Terminal charateristics that higher levels want to look at. 43/* Terminal charateristics that higher levels want to look at.
@@ -52,14 +52,14 @@ int line_ins_del_ok; /* Terminal can insert and delete lines */
52int char_ins_del_ok; /* Terminal can insert and delete chars */ 52int char_ins_del_ok; /* Terminal can insert and delete chars */
53int scroll_region_ok; /* Terminal supports setting the 53int scroll_region_ok; /* Terminal supports setting the
54 scroll window */ 54 scroll window */
55int memory_below_screen; /* Terminal remembers lines 55int memory_below_frame; /* Terminal remembers lines
56 scrolled off bottom */ 56 scrolled off bottom */
57int fast_clear_end_of_line; /* Terminal has a `ce' string */ 57int fast_clear_end_of_line; /* Terminal has a `ce' string */
58 58
59int dont_calculate_costs; /* Nonzero means don't bother computing */ 59int dont_calculate_costs; /* Nonzero means don't bother computing */
60 /* various cost tables; we won't use them. */ 60 /* various cost tables; we won't use them. */
61 61
62/* Nonzero means no need to redraw the entire screen on resuming 62/* Nonzero means no need to redraw the entire frame on resuming
63 a suspended Emacs. This is useful on terminals with multiple pages, 63 a suspended Emacs. This is useful on terminals with multiple pages,
64 where one page is used for Emacs and another for all else. */ 64 where one page is used for Emacs and another for all else. */
65int no_redraw_on_reenter; 65int no_redraw_on_reenter;
@@ -71,7 +71,7 @@ int (*cursor_to_hook) ();
71int (*raw_cursor_to_hook) (); 71int (*raw_cursor_to_hook) ();
72 72
73int (*clear_to_end_hook) (); 73int (*clear_to_end_hook) ();
74int (*clear_screen_hook) (); 74int (*clear_frame_hook) ();
75int (*clear_end_of_line_hook) (); 75int (*clear_end_of_line_hook) ();
76 76
77int (*ins_del_lines_hook) (); 77int (*ins_del_lines_hook) ();
@@ -95,17 +95,17 @@ int (*read_socket_hook) ();
95 95
96/* Return the current position of the mouse. This should clear 96/* Return the current position of the mouse. This should clear
97 mouse_moved until the next motion event arrives. */ 97 mouse_moved until the next motion event arrives. */
98void (*mouse_position_hook) ( /* SCREEN_PTR *s, 98void (*mouse_position_hook) ( /* FRAME_PTR *f,
99 Lisp_Object *x, 99 Lisp_Object *x,
100 Lisp_Object *y, 100 Lisp_Object *y,
101 unsigned long *time */ ); 101 unsigned long *time */ );
102 102
103/* When reading from a minibuffer in a different screen, Emacs wants 103/* When reading from a minibuffer in a different frame, Emacs wants
104 to shift the highlight from the selected screen to the minibuffer's 104 to shift the highlight from the selected frame to the minibuffer's
105 screen; under X, this means it lies about where the focus is. 105 frame; under X, this means it lies about where the focus is.
106 This hook tells the window system code to re-decide where to put 106 This hook tells the window system code to re-decide where to put
107 the highlight. */ 107 the highlight. */
108void (*screen_rehighlight_hook) ( /* SCREEN_PTR s */ ); 108void (*frame_rehighlight_hook) ( /* FRAME_PTR f */ );
109 109
110/* Strings, numbers and flags taken from the termcap entry. */ 110/* Strings, numbers and flags taken from the termcap entry. */
111 111
@@ -114,7 +114,7 @@ char *TS_ins_multi_lines; /* "AL" (one parameter, # lines to insert) */
114char *TS_bell; /* "bl" */ 114char *TS_bell; /* "bl" */
115char *TS_clr_to_bottom; /* "cd" */ 115char *TS_clr_to_bottom; /* "cd" */
116char *TS_clr_line; /* "ce", clear to end of line */ 116char *TS_clr_line; /* "ce", clear to end of line */
117char *TS_clr_screen; /* "cl" */ 117char *TS_clr_frame; /* "cl" */
118char *TS_set_scroll_region; /* "cs" (2 params, first line and last line) */ 118char *TS_set_scroll_region; /* "cs" (2 params, first line and last line) */
119char *TS_set_scroll_region_1; /* "cS" (4 params: total lines, 119char *TS_set_scroll_region_1; /* "cS" (4 params: total lines,
120 lines above scroll region, lines below it, 120 lines above scroll region, lines below it,
@@ -186,24 +186,24 @@ int insert_mode; /* Nonzero when in insert mode. */
186int standout_mode; /* Nonzero when in standout mode. */ 186int standout_mode; /* Nonzero when in standout mode. */
187 187
188/* Size of window specified by higher levels. 188/* Size of window specified by higher levels.
189 This is the number of lines, from the top of screen downwards, 189 This is the number of lines, from the top of frame downwards,
190 which can participate in insert-line/delete-line operations. 190 which can participate in insert-line/delete-line operations.
191 191
192 Effectively it excludes the bottom screen_height - specified_window_size 192 Effectively it excludes the bottom frame_height - specified_window_size
193 lines from those operations. */ 193 lines from those operations. */
194 194
195int specified_window; 195int specified_window;
196 196
197/* Screen currently being redisplayed; 0 if not currently redisplaying. 197/* Frame currently being redisplayed; 0 if not currently redisplaying.
198 (Direct output does not count). */ 198 (Direct output does not count). */
199 199
200SCREEN_PTR updating_screen; 200FRAME_PTR updating_frame;
201 201
202char *tparam (); 202char *tparam ();
203 203
204ring_bell () 204ring_bell ()
205{ 205{
206 if (! SCREEN_IS_TERMCAP (selected_screen)) 206 if (! FRAME_IS_TERMCAP (selected_frame))
207 { 207 {
208 (*ring_bell_hook) (); 208 (*ring_bell_hook) ();
209 return; 209 return;
@@ -213,7 +213,7 @@ ring_bell ()
213 213
214set_terminal_modes () 214set_terminal_modes ()
215{ 215{
216 if (! SCREEN_IS_TERMCAP (selected_screen)) 216 if (! FRAME_IS_TERMCAP (selected_frame))
217 { 217 {
218 (*set_terminal_modes_hook) (); 218 (*set_terminal_modes_hook) ();
219 return; 219 return;
@@ -226,7 +226,7 @@ set_terminal_modes ()
226 226
227reset_terminal_modes () 227reset_terminal_modes ()
228{ 228{
229 if (! SCREEN_IS_TERMCAP (selected_screen)) 229 if (! FRAME_IS_TERMCAP (selected_frame))
230 { 230 {
231 (*reset_terminal_modes_hook) (); 231 (*reset_terminal_modes_hook) ();
232 return; 232 return;
@@ -239,44 +239,44 @@ reset_terminal_modes ()
239 OUTPUT_IF (TS_end_termcap_modes); 239 OUTPUT_IF (TS_end_termcap_modes);
240 /* Output raw CR so kernel can track the cursor hpos. */ 240 /* Output raw CR so kernel can track the cursor hpos. */
241 /* But on magic-cookie terminals this can erase an end-standout marker and 241 /* But on magic-cookie terminals this can erase an end-standout marker and
242 cause the rest of the screen to be in standout, so move down first. */ 242 cause the rest of the frame to be in standout, so move down first. */
243 if (TN_standout_width >= 0) 243 if (TN_standout_width >= 0)
244 cmputc ('\n'); 244 cmputc ('\n');
245 cmputc ('\r'); 245 cmputc ('\r');
246} 246}
247 247
248update_begin (s) 248update_begin (f)
249 SCREEN_PTR s; 249 FRAME_PTR f;
250{ 250{
251 updating_screen = s; 251 updating_frame = f;
252 if (! SCREEN_IS_TERMCAP (updating_screen)) 252 if (! FRAME_IS_TERMCAP (updating_frame))
253 (*update_begin_hook) (s); 253 (*update_begin_hook) (f);
254} 254}
255 255
256update_end (s) 256update_end (f)
257 SCREEN_PTR s; 257 FRAME_PTR f;
258{ 258{
259 if (! SCREEN_IS_TERMCAP (updating_screen)) 259 if (! FRAME_IS_TERMCAP (updating_frame))
260 { 260 {
261 (*update_end_hook) (s); 261 (*update_end_hook) (f);
262 updating_screen = 0; 262 updating_frame = 0;
263 return; 263 return;
264 } 264 }
265 turn_off_insert (); 265 turn_off_insert ();
266 background_highlight (); 266 background_highlight ();
267 standout_requested = 0; 267 standout_requested = 0;
268 updating_screen = 0; 268 updating_frame = 0;
269} 269}
270 270
271set_terminal_window (size) 271set_terminal_window (size)
272 int size; 272 int size;
273{ 273{
274 if (! SCREEN_IS_TERMCAP (updating_screen)) 274 if (! FRAME_IS_TERMCAP (updating_frame))
275 { 275 {
276 (*set_terminal_window_hook) (size); 276 (*set_terminal_window_hook) (size);
277 return; 277 return;
278 } 278 }
279 specified_window = size ? size : SCREEN_HEIGHT (selected_screen); 279 specified_window = size ? size : FRAME_HEIGHT (selected_frame);
280 if (!scroll_region_ok) 280 if (!scroll_region_ok)
281 return; 281 return;
282 set_scroll_region (0, specified_window); 282 set_scroll_region (0, specified_window);
@@ -293,13 +293,13 @@ set_scroll_region (start, stop)
293 else if (TS_set_scroll_region_1) 293 else if (TS_set_scroll_region_1)
294 { 294 {
295 buf = tparam (TS_set_scroll_region_1, 0, 0, 295 buf = tparam (TS_set_scroll_region_1, 0, 0,
296 SCREEN_HEIGHT (selected_screen), start, 296 FRAME_HEIGHT (selected_frame), start,
297 SCREEN_HEIGHT (selected_screen) - stop, 297 FRAME_HEIGHT (selected_frame) - stop,
298 SCREEN_HEIGHT (selected_screen)); 298 FRAME_HEIGHT (selected_frame));
299 } 299 }
300 else 300 else
301 { 301 {
302 buf = tparam (TS_set_window, 0, 0, start, 0, stop, SCREEN_WIDTH (selected_screen)); 302 buf = tparam (TS_set_window, 0, 0, start, 0, stop, FRAME_WIDTH (selected_frame));
303 } 303 }
304 OUTPUT (buf); 304 OUTPUT (buf);
305 free (buf); 305 free (buf);
@@ -376,7 +376,7 @@ highlight_if_desired ()
376 376
377/* Handle standout mode for terminals in which TN_standout_width >= 0. 377/* Handle standout mode for terminals in which TN_standout_width >= 0.
378 On these terminals, standout is controlled by markers that 378 On these terminals, standout is controlled by markers that
379 live inside the screen memory. TN_standout_width is the width 379 live inside the terminal's memory. TN_standout_width is the width
380 that the marker occupies in memory. Standout runs from the marker 380 that the marker occupies in memory. Standout runs from the marker
381 to the end of the line on some terminals, or to the next 381 to the end of the line on some terminals, or to the next
382 turn-off-standout marker (TS_end_standout_mode) string 382 turn-off-standout marker (TS_end_standout_mode) string
@@ -406,7 +406,7 @@ reassert_line_highlight (highlight, vpos)
406 int highlight; 406 int highlight;
407 int vpos; 407 int vpos;
408{ 408{
409 if (! SCREEN_IS_TERMCAP ((updating_screen ? updating_screen : selected_screen))) 409 if (! FRAME_IS_TERMCAP ((updating_frame ? updating_frame : selected_frame)))
410 { 410 {
411 (*reassert_line_highlight_hook) (highlight, vpos); 411 (*reassert_line_highlight_hook) (highlight, vpos);
412 return; 412 return;
@@ -427,7 +427,7 @@ change_line_highlight (new_highlight, vpos, first_unused_hpos)
427 int new_highlight, vpos, first_unused_hpos; 427 int new_highlight, vpos, first_unused_hpos;
428{ 428{
429 standout_requested = new_highlight; 429 standout_requested = new_highlight;
430 if (! SCREEN_IS_TERMCAP (updating_screen)) 430 if (! FRAME_IS_TERMCAP (updating_frame))
431 { 431 {
432 (*change_line_highlight_hook) (new_highlight, vpos, first_unused_hpos); 432 (*change_line_highlight_hook) (new_highlight, vpos, first_unused_hpos);
433 return; 433 return;
@@ -444,7 +444,7 @@ change_line_highlight (new_highlight, vpos, first_unused_hpos)
444 /* On Teleray, make sure to erase the SO marker. */ 444 /* On Teleray, make sure to erase the SO marker. */
445 if (TF_teleray) 445 if (TF_teleray)
446 { 446 {
447 cmgoto (curY - 1, SCREEN_WIDTH (selected_screen) - 4); 447 cmgoto (curY - 1, FRAME_WIDTH (selected_frame) - 4);
448 OUTPUT ("\033S"); 448 OUTPUT ("\033S");
449 curY++; /* ESC S moves to next line where the TS_standout_mode was */ 449 curY++; /* ESC S moves to next line where the TS_standout_mode was */
450 curX = 0; 450 curX = 0;
@@ -462,9 +462,9 @@ change_line_highlight (new_highlight, vpos, first_unused_hpos)
462cursor_to (row, col) 462cursor_to (row, col)
463 int row, col; 463 int row, col;
464{ 464{
465 if (! SCREEN_IS_TERMCAP ((updating_screen 465 if (! FRAME_IS_TERMCAP ((updating_frame
466 ? updating_screen 466 ? updating_frame
467 : selected_screen)) 467 : selected_frame))
468 && cursor_to_hook) 468 && cursor_to_hook)
469 { 469 {
470 (*cursor_to_hook) (row, col); 470 (*cursor_to_hook) (row, col);
@@ -486,7 +486,7 @@ cursor_to (row, col)
486raw_cursor_to (row, col) 486raw_cursor_to (row, col)
487 int row, col; 487 int row, col;
488{ 488{
489 if (! SCREEN_IS_TERMCAP ((updating_screen ? updating_screen : selected_screen))) 489 if (! FRAME_IS_TERMCAP ((updating_frame ? updating_frame : selected_frame)))
490 { 490 {
491 (*raw_cursor_to_hook) (row, col); 491 (*raw_cursor_to_hook) (row, col);
492 return; 492 return;
@@ -502,12 +502,12 @@ raw_cursor_to (row, col)
502 502
503/* Erase operations */ 503/* Erase operations */
504 504
505/* clear from cursor to end of screen */ 505/* clear from cursor to end of frame */
506clear_to_end () 506clear_to_end ()
507{ 507{
508 register int i; 508 register int i;
509 509
510 if (clear_to_end_hook && SCREEN_IS_TERMCAP (updating_screen)) 510 if (clear_to_end_hook && FRAME_IS_TERMCAP (updating_frame))
511 { 511 {
512 (*clear_to_end_hook) (); 512 (*clear_to_end_hook) ();
513 return; 513 return;
@@ -516,33 +516,33 @@ clear_to_end ()
516 { 516 {
517 background_highlight (); 517 background_highlight ();
518 OUTPUT (TS_clr_to_bottom); 518 OUTPUT (TS_clr_to_bottom);
519 bzero (chars_wasted + curY, SCREEN_HEIGHT (selected_screen) - curY); 519 bzero (chars_wasted + curY, FRAME_HEIGHT (selected_frame) - curY);
520 } 520 }
521 else 521 else
522 { 522 {
523 for (i = curY; i < SCREEN_HEIGHT (selected_screen); i++) 523 for (i = curY; i < FRAME_HEIGHT (selected_frame); i++)
524 { 524 {
525 cursor_to (i, 0); 525 cursor_to (i, 0);
526 clear_end_of_line_raw (SCREEN_WIDTH (selected_screen)); 526 clear_end_of_line_raw (FRAME_WIDTH (selected_frame));
527 } 527 }
528 } 528 }
529} 529}
530 530
531/* Clear entire screen */ 531/* Clear entire frame */
532 532
533clear_screen () 533clear_frame ()
534{ 534{
535 if (clear_screen_hook 535 if (clear_frame_hook
536 && ! SCREEN_IS_TERMCAP ((updating_screen ? updating_screen : selected_screen))) 536 && ! FRAME_IS_TERMCAP ((updating_frame ? updating_frame : selected_frame)))
537 { 537 {
538 (*clear_screen_hook) (); 538 (*clear_frame_hook) ();
539 return; 539 return;
540 } 540 }
541 if (TS_clr_screen) 541 if (TS_clr_frame)
542 { 542 {
543 background_highlight (); 543 background_highlight ();
544 OUTPUT (TS_clr_screen); 544 OUTPUT (TS_clr_frame);
545 bzero (chars_wasted, SCREEN_HEIGHT (selected_screen)); 545 bzero (chars_wasted, FRAME_HEIGHT (selected_frame));
546 cmat (0, 0); 546 cmat (0, 0);
547 } 547 }
548 else 548 else
@@ -563,7 +563,7 @@ clear_end_of_line (first_unused_hpos)
563 int first_unused_hpos; 563 int first_unused_hpos;
564{ 564{
565 static GLYPH buf[1] = {SPACEGLYPH}; 565 static GLYPH buf[1] = {SPACEGLYPH};
566 if (SCREEN_IS_TERMCAP (selected_screen) 566 if (FRAME_IS_TERMCAP (selected_frame)
567 && TN_standout_width == 0 && curX == 0 && chars_wasted[curY] != 0) 567 && TN_standout_width == 0 && curX == 0 && chars_wasted[curY] != 0)
568 write_glyphs (buf, 1); 568 write_glyphs (buf, 1);
569 clear_end_of_line_raw (first_unused_hpos); 569 clear_end_of_line_raw (first_unused_hpos);
@@ -581,9 +581,9 @@ clear_end_of_line_raw (first_unused_hpos)
581 register int i; 581 register int i;
582 582
583 if (clear_end_of_line_hook 583 if (clear_end_of_line_hook
584 && ! SCREEN_IS_TERMCAP ((updating_screen 584 && ! FRAME_IS_TERMCAP ((updating_frame
585 ? updating_screen 585 ? updating_frame
586 : selected_screen))) 586 : selected_frame)))
587 { 587 {
588 (*clear_end_of_line_hook) (first_unused_hpos); 588 (*clear_end_of_line_hook) (first_unused_hpos);
589 return; 589 return;
@@ -605,8 +605,8 @@ clear_end_of_line_raw (first_unused_hpos)
605 turn_off_insert (); 605 turn_off_insert ();
606 606
607 /* Do not write in last row last col with Autowrap on. */ 607 /* Do not write in last row last col with Autowrap on. */
608 if (AutoWrap && curY == SCREEN_HEIGHT (selected_screen) - 1 608 if (AutoWrap && curY == FRAME_HEIGHT (selected_frame) - 1
609 && first_unused_hpos == SCREEN_WIDTH (selected_screen)) 609 && first_unused_hpos == FRAME_WIDTH (selected_frame))
610 first_unused_hpos--; 610 first_unused_hpos--;
611 611
612 for (i = curX; i < first_unused_hpos; i++) 612 for (i = curX; i < first_unused_hpos; i++)
@@ -629,7 +629,7 @@ write_glyphs (string, len)
629 register Lisp_Object *tbase = GLYPH_TABLE_BASE; 629 register Lisp_Object *tbase = GLYPH_TABLE_BASE;
630 630
631 if (write_glyphs_hook 631 if (write_glyphs_hook
632 && ! SCREEN_IS_TERMCAP ((updating_screen ? updating_screen : selected_screen))) 632 && ! FRAME_IS_TERMCAP ((updating_frame ? updating_frame : selected_frame)))
633 { 633 {
634 (*write_glyphs_hook) (string, len); 634 (*write_glyphs_hook) (string, len);
635 return; 635 return;
@@ -639,12 +639,12 @@ write_glyphs (string, len)
639 turn_off_insert (); 639 turn_off_insert ();
640 640
641 /* Don't dare write in last column of bottom line, if AutoWrap, 641 /* Don't dare write in last column of bottom line, if AutoWrap,
642 since that would scroll the whole screen on some terminals. */ 642 since that would scroll the whole frame on some terminals. */
643 643
644 if (AutoWrap 644 if (AutoWrap
645 && curY + 1 == SCREEN_HEIGHT (selected_screen) 645 && curY + 1 == FRAME_HEIGHT (selected_frame)
646 && (curX + len - (chars_wasted[curY] & 077) 646 && (curX + len - (chars_wasted[curY] & 077)
647 == SCREEN_WIDTH (selected_screen))) 647 == FRAME_WIDTH (selected_frame)))
648 len --; 648 len --;
649 649
650 cmplus (len); 650 cmplus (len);
@@ -696,7 +696,7 @@ insert_glyphs (start, len)
696 register int tlen = GLYPH_TABLE_LENGTH; 696 register int tlen = GLYPH_TABLE_LENGTH;
697 register Lisp_Object *tbase = GLYPH_TABLE_BASE; 697 register Lisp_Object *tbase = GLYPH_TABLE_BASE;
698 698
699 if (insert_glyphs_hook && ! SCREEN_IS_TERMCAP (updating_screen)) 699 if (insert_glyphs_hook && ! FRAME_IS_TERMCAP (updating_frame))
700 { 700 {
701 (*insert_glyphs_hook) (start, len); 701 (*insert_glyphs_hook) (start, len);
702 return; 702 return;
@@ -751,7 +751,7 @@ delete_glyphs (n)
751 char *buf; 751 char *buf;
752 register int i; 752 register int i;
753 753
754 if (delete_glyphs_hook && ! SCREEN_IS_TERMCAP (updating_screen)) 754 if (delete_glyphs_hook && ! FRAME_IS_TERMCAP (updating_frame))
755 { 755 {
756 (*delete_glyphs_hook) (n); 756 (*delete_glyphs_hook) (n);
757 return; 757 return;
@@ -792,7 +792,7 @@ ins_del_lines (vpos, n)
792 register int i = n > 0 ? n : -n; 792 register int i = n > 0 ? n : -n;
793 register char *buf; 793 register char *buf;
794 794
795 if (ins_del_lines_hook && ! SCREEN_IS_TERMCAP (updating_screen)) 795 if (ins_del_lines_hook && ! FRAME_IS_TERMCAP (updating_frame))
796 { 796 {
797 (*ins_del_lines_hook) (vpos, n); 797 (*ins_del_lines_hook) (vpos, n);
798 return; 798 return;
@@ -807,7 +807,7 @@ ins_del_lines (vpos, n)
807 as there will be a matching inslines later that will flush them. */ 807 as there will be a matching inslines later that will flush them. */
808 if (scroll_region_ok && vpos + i >= specified_window) 808 if (scroll_region_ok && vpos + i >= specified_window)
809 return; 809 return;
810 if (!memory_below_screen && vpos + i >= SCREEN_HEIGHT (selected_screen)) 810 if (!memory_below_frame && vpos + i >= FRAME_HEIGHT (selected_frame))
811 return; 811 return;
812 812
813 if (multi) 813 if (multi)
@@ -845,7 +845,7 @@ ins_del_lines (vpos, n)
845 register lower_limit 845 register lower_limit
846 = (scroll_region_ok 846 = (scroll_region_ok
847 ? specified_window 847 ? specified_window
848 : SCREEN_HEIGHT (selected_screen)); 848 : FRAME_HEIGHT (selected_frame));
849 849
850 if (n < 0) 850 if (n < 0)
851 { 851 {
@@ -861,9 +861,9 @@ ins_del_lines (vpos, n)
861 bzero (&chars_wasted[vpos], n); 861 bzero (&chars_wasted[vpos], n);
862 } 862 }
863 } 863 }
864 if (!scroll_region_ok && memory_below_screen && n < 0) 864 if (!scroll_region_ok && memory_below_frame && n < 0)
865 { 865 {
866 cursor_to (SCREEN_HEIGHT (selected_screen) + n, 0); 866 cursor_to (FRAME_HEIGHT (selected_frame) + n, 0);
867 clear_to_end (); 867 clear_to_end ();
868 } 868 }
869} 869}
@@ -916,13 +916,13 @@ per_line_cost (str)
916 916
917int *char_ins_del_vector; 917int *char_ins_del_vector;
918 918
919#define char_ins_del_cost(s) (&char_ins_del_vector[SCREEN_WIDTH ((s))]) 919#define char_ins_del_cost(f) (&char_ins_del_vector[FRAME_WIDTH ((f))])
920#endif 920#endif
921 921
922/* ARGSUSED */ 922/* ARGSUSED */
923static void 923static void
924calculate_ins_del_char_costs (screen) 924calculate_ins_del_char_costs (frame)
925 SCREEN_PTR screen; 925 FRAME_PTR frame;
926{ 926{
927 int ins_startup_cost, del_startup_cost; 927 int ins_startup_cost, del_startup_cost;
928 int ins_cost_per_char, del_cost_per_char; 928 int ins_cost_per_char, del_cost_per_char;
@@ -968,27 +968,27 @@ calculate_ins_del_char_costs (screen)
968 } 968 }
969 969
970 /* Delete costs are at negative offsets */ 970 /* Delete costs are at negative offsets */
971 p = &char_ins_del_cost (screen)[0]; 971 p = &char_ins_del_cost (frame)[0];
972 for (i = SCREEN_WIDTH (selected_screen); --i >= 0;) 972 for (i = FRAME_WIDTH (selected_frame); --i >= 0;)
973 *--p = (del_startup_cost += del_cost_per_char); 973 *--p = (del_startup_cost += del_cost_per_char);
974 974
975 /* Doing nothing is free */ 975 /* Doing nothing is free */
976 p = &char_ins_del_cost (screen)[0]; 976 p = &char_ins_del_cost (frame)[0];
977 *p++ = 0; 977 *p++ = 0;
978 978
979 /* Insert costs are at positive offsets */ 979 /* Insert costs are at positive offsets */
980 for (i = SCREEN_WIDTH (screen); --i >= 0;) 980 for (i = FRAME_WIDTH (frame); --i >= 0;)
981 *p++ = (ins_startup_cost += ins_cost_per_char); 981 *p++ = (ins_startup_cost += ins_cost_per_char);
982} 982}
983 983
984#ifdef HAVE_X_WINDOWS 984#ifdef HAVE_X_WINDOWS
985extern int x_screen_planes; 985extern int x_frame_planes;
986#endif 986#endif
987 987
988calculate_costs (screen) 988calculate_costs (frame)
989 SCREEN_PTR screen; 989 FRAME_PTR frame;
990{ 990{
991 register char *s = TS_set_scroll_region ? 991 register char *f = TS_set_scroll_region ?
992 TS_set_scroll_region 992 TS_set_scroll_region
993 : TS_set_scroll_region_1; 993 : TS_set_scroll_region_1;
994 994
@@ -996,16 +996,16 @@ calculate_costs (screen)
996 return; 996 return;
997 997
998#ifdef HAVE_X_WINDOWS 998#ifdef HAVE_X_WINDOWS
999 if (SCREEN_IS_X (screen)) 999 if (FRAME_IS_X (frame))
1000 { 1000 {
1001 do_line_insertion_deletion_costs (screen, 0, ".5*", 0, ".5*", 1001 do_line_insertion_deletion_costs (frame, 0, ".5*", 0, ".5*",
1002 0, 0, x_screen_planes); 1002 0, 0, x_frame_planes);
1003 return; 1003 return;
1004 } 1004 }
1005#endif 1005#endif
1006 1006
1007 /* These variables are only used for terminal stuff. They are allocated 1007 /* These variables are only used for terminal stuff. They are allocated
1008 once for the terminal screen of X-windows emacs, but not used afterwards. 1008 once for the terminal frame of X-windows emacs, but not used afterwards.
1009 1009
1010 char_ins_del_vector (i.e., char_ins_del_cost) isn't used because 1010 char_ins_del_vector (i.e., char_ins_del_cost) isn't used because
1011 X turns off char_ins_del_ok. 1011 X turns off char_ins_del_ok.
@@ -1014,48 +1014,48 @@ calculate_costs (screen)
1014 the term hook isn't called. */ 1014 the term hook isn't called. */
1015 1015
1016 if (chars_wasted != 0) 1016 if (chars_wasted != 0)
1017 chars_wasted = (char *) xrealloc (chars_wasted, SCREEN_HEIGHT (screen)); 1017 chars_wasted = (char *) xrealloc (chars_wasted, FRAME_HEIGHT (frame));
1018 else 1018 else
1019 chars_wasted = (char *) xmalloc (SCREEN_HEIGHT (screen)); 1019 chars_wasted = (char *) xmalloc (FRAME_HEIGHT (frame));
1020 1020
1021 if (copybuf != 0) 1021 if (copybuf != 0)
1022 copybuf = (char *) xrealloc (copybuf, SCREEN_HEIGHT (screen)); 1022 copybuf = (char *) xrealloc (copybuf, FRAME_HEIGHT (frame));
1023 else 1023 else
1024 copybuf = (char *) xmalloc (SCREEN_HEIGHT (screen)); 1024 copybuf = (char *) xmalloc (FRAME_HEIGHT (frame));
1025 1025
1026 if (char_ins_del_vector != 0) 1026 if (char_ins_del_vector != 0)
1027 char_ins_del_vector 1027 char_ins_del_vector
1028 = (int *) xrealloc (char_ins_del_vector, 1028 = (int *) xrealloc (char_ins_del_vector,
1029 (sizeof (int) 1029 (sizeof (int)
1030 + 2 * SCREEN_WIDTH (screen) * sizeof (int))); 1030 + 2 * FRAME_WIDTH (frame) * sizeof (int)));
1031 else 1031 else
1032 char_ins_del_vector 1032 char_ins_del_vector
1033 = (int *) xmalloc (sizeof (int) 1033 = (int *) xmalloc (sizeof (int)
1034 + 2 * SCREEN_WIDTH (screen) * sizeof (int)); 1034 + 2 * FRAME_WIDTH (frame) * sizeof (int));
1035 1035
1036 bzero (chars_wasted, SCREEN_HEIGHT (screen)); 1036 bzero (chars_wasted, FRAME_HEIGHT (frame));
1037 bzero (copybuf, SCREEN_HEIGHT (screen)); 1037 bzero (copybuf, FRAME_HEIGHT (frame));
1038 bzero (char_ins_del_vector, (sizeof (int) 1038 bzero (char_ins_del_vector, (sizeof (int)
1039 + 2 * SCREEN_WIDTH (screen) * sizeof (int))); 1039 + 2 * FRAME_WIDTH (frame) * sizeof (int)));
1040 1040
1041 if (s && (!TS_ins_line && !TS_del_line)) 1041 if (f && (!TS_ins_line && !TS_del_line))
1042 do_line_insertion_deletion_costs (screen, 1042 do_line_insertion_deletion_costs (frame,
1043 TS_rev_scroll, TS_ins_multi_lines, 1043 TS_rev_scroll, TS_ins_multi_lines,
1044 TS_fwd_scroll, TS_del_multi_lines, 1044 TS_fwd_scroll, TS_del_multi_lines,
1045 s, s, 1); 1045 f, f, 1);
1046 else 1046 else
1047 do_line_insertion_deletion_costs (screen, 1047 do_line_insertion_deletion_costs (frame,
1048 TS_ins_line, TS_ins_multi_lines, 1048 TS_ins_line, TS_ins_multi_lines,
1049 TS_del_line, TS_del_multi_lines, 1049 TS_del_line, TS_del_multi_lines,
1050 0, 0, 1); 1050 0, 0, 1);
1051 1051
1052 calculate_ins_del_char_costs (screen); 1052 calculate_ins_del_char_costs (frame);
1053 1053
1054 /* Don't use TS_repeat if its padding is worse than sending the chars */ 1054 /* Don't use TS_repeat if its padding is worse than sending the chars */
1055 if (TS_repeat && per_line_cost (TS_repeat) * baud_rate < 9000) 1055 if (TS_repeat && per_line_cost (TS_repeat) * baud_rate < 9000)
1056 RPov = string_cost (TS_repeat); 1056 RPov = string_cost (TS_repeat);
1057 else 1057 else
1058 RPov = SCREEN_WIDTH (screen) * 2; 1058 RPov = FRAME_WIDTH (frame) * 2;
1059 1059
1060 cmcostinit (); /* set up cursor motion costs */ 1060 cmcostinit (); /* set up cursor motion costs */
1061} 1061}
@@ -1151,7 +1151,7 @@ term_init (terminal_type)
1151 BackTab = tgetstr ("bt", address); 1151 BackTab = tgetstr ("bt", address);
1152 TS_clr_to_bottom = tgetstr ("cd", address); 1152 TS_clr_to_bottom = tgetstr ("cd", address);
1153 TS_clr_line = tgetstr ("ce", address); 1153 TS_clr_line = tgetstr ("ce", address);
1154 TS_clr_screen = tgetstr ("cl", address); 1154 TS_clr_frame = tgetstr ("cl", address);
1155 ColPosition = tgetstr ("ch", address); 1155 ColPosition = tgetstr ("ch", address);
1156 AbsPosition = tgetstr ("cm", address); 1156 AbsPosition = tgetstr ("cm", address);
1157 CR = tgetstr ("cr", address); 1157 CR = tgetstr ("cr", address);
@@ -1209,7 +1209,7 @@ term_init (terminal_type)
1209 MultiRight = tgetstr ("RI", address); 1209 MultiRight = tgetstr ("RI", address);
1210 1210
1211 AutoWrap = tgetflag ("am"); 1211 AutoWrap = tgetflag ("am");
1212 memory_below_screen = tgetflag ("db"); 1212 memory_below_frame = tgetflag ("db");
1213 TF_hazeltine = tgetflag ("hz"); 1213 TF_hazeltine = tgetflag ("hz");
1214 must_write_spaces = tgetflag ("in"); 1214 must_write_spaces = tgetflag ("in");
1215 meta_key = tgetflag ("km") || tgetflag ("MT"); 1215 meta_key = tgetflag ("km") || tgetflag ("MT");
@@ -1222,13 +1222,13 @@ term_init (terminal_type)
1222 1222
1223 term_get_fkeys (address); 1223 term_get_fkeys (address);
1224 1224
1225 /* Get screen size from system, or else from termcap. */ 1225 /* Get frame size from system, or else from termcap. */
1226 get_screen_size (&SCREEN_WIDTH (selected_screen), 1226 get_frame_size (&FRAME_WIDTH (selected_frame),
1227 &SCREEN_HEIGHT (selected_screen)); 1227 &FRAME_HEIGHT (selected_frame));
1228 if (SCREEN_WIDTH (selected_screen) <= 0) 1228 if (FRAME_WIDTH (selected_frame) <= 0)
1229 SCREEN_WIDTH (selected_screen) = tgetnum ("co"); 1229 FRAME_WIDTH (selected_frame) = tgetnum ("co");
1230 if (SCREEN_HEIGHT (selected_screen) <= 0) 1230 if (FRAME_HEIGHT (selected_frame) <= 0)
1231 SCREEN_HEIGHT (selected_screen) = tgetnum ("li"); 1231 FRAME_HEIGHT (selected_frame) = tgetnum ("li");
1232 1232
1233 min_padding_speed = tgetnum ("pb"); 1233 min_padding_speed = tgetnum ("pb");
1234 TN_standout_width = tgetnum ("sg"); 1234 TN_standout_width = tgetnum ("sg");
@@ -1285,7 +1285,7 @@ term_init (terminal_type)
1285 1285
1286 if (!strcmp (terminal_type, "supdup")) 1286 if (!strcmp (terminal_type, "supdup"))
1287 { 1287 {
1288 memory_below_screen = 1; 1288 memory_below_frame = 1;
1289 Wcm.cm_losewrap = 1; 1289 Wcm.cm_losewrap = 1;
1290 } 1290 }
1291 if (!strncmp (terminal_type, "c10", 3) 1291 if (!strncmp (terminal_type, "c10", 3)
@@ -1296,7 +1296,7 @@ term_init (terminal_type)
1296 for windows starting at the upper left corner; 1296 for windows starting at the upper left corner;
1297 but that is all Emacs uses. 1297 but that is all Emacs uses.
1298 1298
1299 This string works only if the screen is using 1299 This string works only if the frame is using
1300 the top of the video memory, because addressing is memory-relative. 1300 the top of the video memory, because addressing is memory-relative.
1301 So first check the :ti string to see if that is true. 1301 So first check the :ti string to see if that is true.
1302 1302
@@ -1330,9 +1330,9 @@ term_init (terminal_type)
1330 } 1330 }
1331 } 1331 }
1332 1332
1333 ScreenRows = SCREEN_HEIGHT (selected_screen); 1333 FrameRows = FRAME_HEIGHT (selected_frame);
1334 ScreenCols = SCREEN_WIDTH (selected_screen); 1334 FrameCols = FRAME_WIDTH (selected_frame);
1335 specified_window = SCREEN_HEIGHT (selected_screen); 1335 specified_window = FRAME_HEIGHT (selected_frame);
1336 1336
1337 if (Wcm_init () == -1) /* can't do cursor motion */ 1337 if (Wcm_init () == -1) /* can't do cursor motion */
1338#ifdef VMS 1338#ifdef VMS
@@ -1350,9 +1350,9 @@ use the C-shell command `setenv TERM ...' to specify the correct type.\n\
1350It may be necessary to do `unsetenv TERMCAP' as well.\n", 1350It may be necessary to do `unsetenv TERMCAP' as well.\n",
1351 terminal_type); 1351 terminal_type);
1352#endif 1352#endif
1353 if (SCREEN_HEIGHT (selected_screen) <= 0 1353 if (FRAME_HEIGHT (selected_frame) <= 0
1354 || SCREEN_WIDTH (selected_screen) <= 0) 1354 || FRAME_WIDTH (selected_frame) <= 0)
1355 fatal ("The screen size has not been specified."); 1355 fatal ("The frame size has not been specified.");
1356 1356
1357 delete_in_insert_mode 1357 delete_in_insert_mode
1358 = TS_delete_mode && TS_insert_mode 1358 = TS_delete_mode && TS_insert_mode
@@ -1364,7 +1364,7 @@ It may be necessary to do `unsetenv TERMCAP' as well.\n",
1364 1364
1365 /* Remove width of standout marker from usable width of line */ 1365 /* Remove width of standout marker from usable width of line */
1366 if (TN_standout_width > 0) 1366 if (TN_standout_width > 0)
1367 SCREEN_WIDTH (selected_screen) -= TN_standout_width; 1367 FRAME_WIDTH (selected_frame) -= TN_standout_width;
1368 1368
1369 UseTabs = tabs_safe_p () && TabWidth == 8; 1369 UseTabs = tabs_safe_p () && TabWidth == 8;
1370 1370