Mercurial > emacs
comparison src/cm.c @ 82989:f3845715a5f6
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
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Thu, 01 Jan 2004 17:55:53 +0000 |
parents | 56e4b7166995 |
children | 039bd6989d29 |
comparison
equal
deleted
inserted
replaced
82988:f82e3a6f5ccb | 82989:f3845715a5f6 |
---|---|
60 cost++; | 60 cost++; |
61 return c; | 61 return c; |
62 } | 62 } |
63 | 63 |
64 /* The terminal to use for low-level output. */ | 64 /* The terminal to use for low-level output. */ |
65 struct tty_output * current_tty; | 65 struct tty_display_info *current_tty; |
66 | 66 |
67 int | 67 int |
68 cmputc (c) | 68 cmputc (c) |
69 char c; | 69 char c; |
70 { | 70 { |
133 * in limbo if we use direct cursor addressing from the phantom column. | 133 * in limbo if we use direct cursor addressing from the phantom column. |
134 * The only guaranteed safe thing to do is to emit a CRLF immediately | 134 * The only guaranteed safe thing to do is to emit a CRLF immediately |
135 * after we reach the last column; this takes us to a known state. | 135 * after we reach the last column; this takes us to a known state. |
136 */ | 136 */ |
137 void | 137 void |
138 cmcheckmagic (struct tty_output *tty) | 138 cmcheckmagic (struct tty_display_info *tty) |
139 { | 139 { |
140 if (curX (tty) == FrameCols (tty)) | 140 if (curX (tty) == FrameCols (tty)) |
141 { | 141 { |
142 if (!MagicWrap (tty) || curY (tty) >= FrameRows (tty) - 1) | 142 if (!MagicWrap (tty) || curY (tty) >= FrameRows (tty) - 1) |
143 abort (); | 143 abort (); |
158 * in the variable ospeed. (Note: this holds B300, B9600, etc -- ie stuff | 158 * in the variable ospeed. (Note: this holds B300, B9600, etc -- ie stuff |
159 * out of <sgtty.h>.) | 159 * out of <sgtty.h>.) |
160 */ | 160 */ |
161 | 161 |
162 void | 162 void |
163 cmcostinit (struct tty_output *tty) | 163 cmcostinit (struct tty_display_info *tty) |
164 { | 164 { |
165 char *p; | 165 char *p; |
166 | 166 |
167 #define COST(x,e) (x ? (cost = 0, tputs (x, 1, e), cost) : BIG) | 167 #define COST(x,e) (x ? (cost = 0, tputs (x, 1, e), cost) : BIG) |
168 #define CMCOST(x,e) ((x == 0) ? BIG : (p = tgoto(x, 0, 0), COST(p ,e))) | 168 #define CMCOST(x,e) ((x == 0) ? BIG : (p = tgoto(x, 0, 0), COST(p ,e))) |
198 * up and down, and left and right, motions, and tabs. If doit is set | 198 * up and down, and left and right, motions, and tabs. If doit is set |
199 * actually perform the motion. | 199 * actually perform the motion. |
200 */ | 200 */ |
201 | 201 |
202 static int | 202 static int |
203 calccost (struct tty_output *tty, int srcy, int srcx, int dsty, int dstx, int doit) | 203 calccost (struct tty_display_info *tty, |
204 int srcy, int srcx, int dsty, int dstx, int doit) | |
204 { | 205 { |
205 register int deltay, | 206 register int deltay, |
206 deltax, | 207 deltax, |
207 c, | 208 c, |
208 totalcost; | 209 totalcost; |
334 #define USELL 2 | 335 #define USELL 2 |
335 #define USECR 3 | 336 #define USECR 3 |
336 | 337 |
337 void | 338 void |
338 cmgoto (tty, row, col) | 339 cmgoto (tty, row, col) |
339 struct tty_output *tty; | 340 struct tty_display_info *tty; |
340 int row, col; | 341 int row, col; |
341 { | 342 { |
342 int homecost, | 343 int homecost, |
343 crcost, | 344 crcost, |
344 llcost, | 345 llcost, |
439 /* Clear out all terminal info. | 440 /* Clear out all terminal info. |
440 Used before copying into it the info on the actual terminal. | 441 Used before copying into it the info on the actual terminal. |
441 */ | 442 */ |
442 | 443 |
443 void | 444 void |
444 Wcm_clear (struct tty_output *tty) | 445 Wcm_clear (struct tty_display_info *tty) |
445 { | 446 { |
446 bzero (tty->Wcm, sizeof (struct cm)); | 447 bzero (tty->Wcm, sizeof (struct cm)); |
447 UP = 0; | 448 UP = 0; |
448 BC = 0; | 449 BC = 0; |
449 } | 450 } |
454 * Return -1 if cannot. | 455 * Return -1 if cannot. |
455 * Return -2 if size not specified. | 456 * Return -2 if size not specified. |
456 */ | 457 */ |
457 | 458 |
458 int | 459 int |
459 Wcm_init (struct tty_output *tty) | 460 Wcm_init (struct tty_display_info *tty) |
460 { | 461 { |
461 #if 0 | 462 #if 0 |
462 if (tty->Wcm->cm_abs && !tty->Wcm->cm_ds) | 463 if (tty->Wcm->cm_abs && !tty->Wcm->cm_ds) |
463 return 0; | 464 return 0; |
464 #endif | 465 #endif |