Mercurial > emacs
annotate src/terminal.c @ 112290:9164d0b32512
* fontset.c (free_realized_fontset): Mark unreachable code with if (0).
Previously it was marked by preceding it with "return;", but
Sun cc complains about this.
author | Paul Eggert <eggert@cs.ucla.edu> |
---|---|
date | Sun, 16 Jan 2011 19:05:08 -0800 |
parents | ef719132ddfa |
children | 42e22c4f06b7 |
rev | line source |
---|---|
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
1 /* Functions related to terminal devices. |
112218
376148b31b5e
Add 2011 to FSF/AIST copyright years.
Glenn Morris <rgm@gnu.org>
parents:
106815
diff
changeset
|
2 Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
3 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
4 This file is part of GNU Emacs. |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
5 |
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93369
diff
changeset
|
6 GNU Emacs is free software: you can redistribute it and/or modify |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
7 it under the terms of the GNU General Public License as published by |
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93369
diff
changeset
|
8 the Free Software Foundation, either version 3 of the License, or |
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93369
diff
changeset
|
9 (at your option) any later version. |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
10 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
11 GNU Emacs is distributed in the hope that it will be useful, |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
12 but WITHOUT ANY WARRANTY; without even the implied warranty of |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
14 GNU General Public License for more details. |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
15 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
16 You should have received a copy of the GNU General Public License |
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
93369
diff
changeset
|
17 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
18 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
19 #include <config.h> |
83440
6cb6e02413a8
(Hopefully) fix bootstrap error on OpenBSD. (reported by Han Boetes)
Karoly Lorentey <lorentey@elte.hu>
parents:
83431
diff
changeset
|
20 #include <stdio.h> |
105669
68dd71358159
* alloc.c: Do not define struct catchtag.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
103046
diff
changeset
|
21 #include <setjmp.h> |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
22 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
23 #include "lisp.h" |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
24 #include "frame.h" |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
25 #include "termchar.h" |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
26 #include "termhooks.h" |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
27 #include "charset.h" |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
28 #include "coding.h" |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
29 #include "keyboard.h" |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
30 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
31 /* Chain of all terminals currently in use. */ |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
32 struct terminal *terminal_list; |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
33 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
34 /* The first unallocated terminal id. */ |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
35 static int next_terminal_id; |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
36 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
37 /* The initial terminal device, created by initial_term_init. */ |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
38 struct terminal *initial_terminal; |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
39 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
40 /* Function to use to ring the bell. */ |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
41 Lisp_Object Vring_bell_function; |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
42 |
109100
2bc9a0c04c87
Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents:
106815
diff
changeset
|
43 static void delete_initial_terminal (struct terminal *); |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
44 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
45 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
46 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
47 void |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
48 ring_bell (struct frame *f) |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
49 { |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
50 if (!NILP (Vring_bell_function)) |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
51 { |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
52 Lisp_Object function; |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
53 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
54 /* Temporarily set the global variable to nil |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
55 so that if we get an error, it stays nil |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
56 and we don't call it over and over. |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
57 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
58 We don't specbind it, because that would carefully |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
59 restore the bad value if there's an error |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
60 and make the loop of errors happen anyway. */ |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
61 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
62 function = Vring_bell_function; |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
63 Vring_bell_function = Qnil; |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
64 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
65 call0 (function); |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
66 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
67 Vring_bell_function = function; |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
68 } |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
69 else if (FRAME_TERMINAL (f)->ring_bell_hook) |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
70 (*FRAME_TERMINAL (f)->ring_bell_hook) (f); |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
71 } |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
72 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
73 void |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
74 update_begin (struct frame *f) |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
75 { |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
76 if (FRAME_TERMINAL (f)->update_begin_hook) |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
77 (*FRAME_TERMINAL (f)->update_begin_hook) (f); |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
78 } |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
79 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
80 void |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
81 update_end (struct frame *f) |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
82 { |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
83 if (FRAME_TERMINAL (f)->update_end_hook) |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
84 (*FRAME_TERMINAL (f)->update_end_hook) (f); |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
85 } |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
86 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
87 /* Specify how many text lines, from the top of the window, |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
88 should be affected by insert-lines and delete-lines operations. |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
89 This, and those operations, are used only within an update |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
90 that is bounded by calls to update_begin and update_end. */ |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
91 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
92 void |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
93 set_terminal_window (struct frame *f, int size) |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
94 { |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
95 if (FRAME_TERMINAL (f)->set_terminal_window_hook) |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
96 (*FRAME_TERMINAL (f)->set_terminal_window_hook) (f, size); |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
97 } |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
98 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
99 /* Move cursor to row/column position VPOS/HPOS. HPOS/VPOS are |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
100 frame-relative coordinates. */ |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
101 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
102 void |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
103 cursor_to (struct frame *f, int vpos, int hpos) |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
104 { |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
105 if (FRAME_TERMINAL (f)->cursor_to_hook) |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
106 (*FRAME_TERMINAL (f)->cursor_to_hook) (f, vpos, hpos); |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
107 } |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
108 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
109 /* Similar but don't take any account of the wasted characters. */ |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
110 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
111 void |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
112 raw_cursor_to (struct frame *f, int row, int col) |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
113 { |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
114 if (FRAME_TERMINAL (f)->raw_cursor_to_hook) |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
115 (*FRAME_TERMINAL (f)->raw_cursor_to_hook) (f, row, col); |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
116 } |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
117 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
118 /* Erase operations */ |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
119 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
120 /* Clear from cursor to end of frame. */ |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
121 void |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
122 clear_to_end (struct frame *f) |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
123 { |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
124 if (FRAME_TERMINAL (f)->clear_to_end_hook) |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
125 (*FRAME_TERMINAL (f)->clear_to_end_hook) (f); |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
126 } |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
127 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
128 /* Clear entire frame */ |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
129 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
130 void |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
131 clear_frame (struct frame *f) |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
132 { |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
133 if (FRAME_TERMINAL (f)->clear_frame_hook) |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
134 (*FRAME_TERMINAL (f)->clear_frame_hook) (f); |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
135 } |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
136 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
137 /* Clear from cursor to end of line. |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
138 Assume that the line is already clear starting at column first_unused_hpos. |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
139 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
140 Note that the cursor may be moved, on terminals lacking a `ce' string. */ |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
141 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
142 void |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
143 clear_end_of_line (struct frame *f, int first_unused_hpos) |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
144 { |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
145 if (FRAME_TERMINAL (f)->clear_end_of_line_hook) |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
146 (*FRAME_TERMINAL (f)->clear_end_of_line_hook) (f, first_unused_hpos); |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
147 } |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
148 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
149 /* Output LEN glyphs starting at STRING at the nominal cursor position. |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
150 Advance the nominal cursor over the text. */ |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
151 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
152 void |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
153 write_glyphs (struct frame *f, struct glyph *string, int len) |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
154 { |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
155 if (FRAME_TERMINAL (f)->write_glyphs_hook) |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
156 (*FRAME_TERMINAL (f)->write_glyphs_hook) (f, string, len); |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
157 } |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
158 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
159 /* Insert LEN glyphs from START at the nominal cursor position. |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
160 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
161 If start is zero, insert blanks instead of a string at start */ |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
162 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
163 void |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
164 insert_glyphs (struct frame *f, struct glyph *start, int len) |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
165 { |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
166 if (len <= 0) |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
167 return; |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
168 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
169 if (FRAME_TERMINAL (f)->insert_glyphs_hook) |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
170 (*FRAME_TERMINAL (f)->insert_glyphs_hook) (f, start, len); |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
171 } |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
172 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
173 /* Delete N glyphs at the nominal cursor position. */ |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
174 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
175 void |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
176 delete_glyphs (struct frame *f, int n) |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
177 { |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
178 if (FRAME_TERMINAL (f)->delete_glyphs_hook) |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
179 (*FRAME_TERMINAL (f)->delete_glyphs_hook) (f, n); |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
180 } |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
181 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
182 /* Insert N lines at vpos VPOS. If N is negative, delete -N lines. */ |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
183 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
184 void |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
185 ins_del_lines (struct frame *f, int vpos, int n) |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
186 { |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
187 if (FRAME_TERMINAL (f)->ins_del_lines_hook) |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
188 (*FRAME_TERMINAL (f)->ins_del_lines_hook) (f, vpos, n); |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
189 } |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
190 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
191 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
192 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
193 |
103046 | 194 /* Return the terminal object specified by TERMINAL. TERMINAL may be |
195 a terminal object, a frame, or nil for the terminal device of the | |
196 current frame. If THROW is zero, return NULL for failure, | |
197 otherwise throw an error. */ | |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
198 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
199 struct terminal * |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
200 get_terminal (Lisp_Object terminal, int throw) |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
201 { |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
202 struct terminal *result = NULL; |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
203 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
204 if (NILP (terminal)) |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
205 terminal = selected_frame; |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
206 |
84694
95e3b5b2f3ef
(get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83728
diff
changeset
|
207 if (TERMINALP (terminal)) |
95e3b5b2f3ef
(get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83728
diff
changeset
|
208 result = XTERMINAL (terminal); |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
209 else if (FRAMEP (terminal)) |
103046 | 210 result = FRAME_TERMINAL (XFRAME (terminal)); |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
211 |
84694
95e3b5b2f3ef
(get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83728
diff
changeset
|
212 if (result && !result->name) |
95e3b5b2f3ef
(get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83728
diff
changeset
|
213 result = NULL; |
95e3b5b2f3ef
(get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83728
diff
changeset
|
214 |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
215 if (result == NULL && throw) |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
216 wrong_type_argument (Qterminal_live_p, terminal); |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
217 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
218 return result; |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
219 } |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
220 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
221 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
222 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
223 /* Create a new terminal object and add it to the terminal list. */ |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
224 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
225 struct terminal * |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
226 create_terminal (void) |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
227 { |
84694
95e3b5b2f3ef
(get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83728
diff
changeset
|
228 struct terminal *terminal = allocate_terminal (); |
95e3b5b2f3ef
(get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83728
diff
changeset
|
229 |
95e3b5b2f3ef
(get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83728
diff
changeset
|
230 terminal->name = NULL; |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
231 terminal->next_terminal = terminal_list; |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
232 terminal_list = terminal; |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
233 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
234 terminal->id = next_terminal_id++; |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
235 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
236 terminal->keyboard_coding = |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
237 (struct coding_system *) xmalloc (sizeof (struct coding_system)); |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
238 terminal->terminal_coding = |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
239 (struct coding_system *) xmalloc (sizeof (struct coding_system)); |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
240 |
91046 | 241 setup_coding_system (Qno_conversion, terminal->keyboard_coding); |
242 setup_coding_system (Qundecided, terminal->terminal_coding); | |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
243 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
244 terminal->param_alist = Qnil; |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
245 return terminal; |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
246 } |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
247 |
83525
b2e7507b55c6
Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents:
83522
diff
changeset
|
248 /* Low-level function to close all frames on a terminal, remove it |
b2e7507b55c6
Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents:
83522
diff
changeset
|
249 from the terminal list and free its memory. */ |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
250 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
251 void |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
252 delete_terminal (struct terminal *terminal) |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
253 { |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
254 struct terminal **tp; |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
255 Lisp_Object tail, frame; |
83522
a5d712e6585a
Fix crashes in `delete-terminal' caused by recursive calls or X displays with live frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83440
diff
changeset
|
256 |
100632
389db2f016a4
* frame.c (delete_frame): New function derived from
Martin Rudalics <rudalics@gmx.at>
parents:
97141
diff
changeset
|
257 /* Protect against recursive calls. delete_frame calls the |
83525
b2e7507b55c6
Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents:
83522
diff
changeset
|
258 delete_terminal_hook when we delete our last frame. */ |
84694
95e3b5b2f3ef
(get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83728
diff
changeset
|
259 if (!terminal->name) |
83522
a5d712e6585a
Fix crashes in `delete-terminal' caused by recursive calls or X displays with live frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83440
diff
changeset
|
260 return; |
84694
95e3b5b2f3ef
(get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83728
diff
changeset
|
261 xfree (terminal->name); |
95e3b5b2f3ef
(get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83728
diff
changeset
|
262 terminal->name = NULL; |
83522
a5d712e6585a
Fix crashes in `delete-terminal' caused by recursive calls or X displays with live frames.
Karoly Lorentey <lorentey@elte.hu>
parents:
83440
diff
changeset
|
263 |
83525
b2e7507b55c6
Fix C-x 5 2 on the controlling tty; fix some possible crash conditions and a memory leak.
Karoly Lorentey <lorentey@elte.hu>
parents:
83522
diff
changeset
|
264 /* Check for live frames that are still on this terminal. */ |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
265 FOR_EACH_FRAME (tail, frame) |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
266 { |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
267 struct frame *f = XFRAME (frame); |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
268 if (FRAME_LIVE_P (f) && f->terminal == terminal) |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
269 { |
100632
389db2f016a4
* frame.c (delete_frame): New function derived from
Martin Rudalics <rudalics@gmx.at>
parents:
97141
diff
changeset
|
270 /* Pass Qnoelisp rather than Qt. */ |
389db2f016a4
* frame.c (delete_frame): New function derived from
Martin Rudalics <rudalics@gmx.at>
parents:
97141
diff
changeset
|
271 delete_frame (frame, Qnoelisp); |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
272 } |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
273 } |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
274 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
275 for (tp = &terminal_list; *tp != terminal; tp = &(*tp)->next_terminal) |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
276 if (! *tp) |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
277 abort (); |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
278 *tp = terminal->next_terminal; |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
279 |
84694
95e3b5b2f3ef
(get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83728
diff
changeset
|
280 xfree (terminal->keyboard_coding); |
95e3b5b2f3ef
(get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83728
diff
changeset
|
281 terminal->keyboard_coding = NULL; |
95e3b5b2f3ef
(get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83728
diff
changeset
|
282 xfree (terminal->terminal_coding); |
95e3b5b2f3ef
(get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83728
diff
changeset
|
283 terminal->terminal_coding = NULL; |
100632
389db2f016a4
* frame.c (delete_frame): New function derived from
Martin Rudalics <rudalics@gmx.at>
parents:
97141
diff
changeset
|
284 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
285 if (terminal->kboard && --terminal->kboard->reference_count == 0) |
84694
95e3b5b2f3ef
(get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83728
diff
changeset
|
286 { |
95e3b5b2f3ef
(get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83728
diff
changeset
|
287 delete_kboard (terminal->kboard); |
95e3b5b2f3ef
(get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83728
diff
changeset
|
288 terminal->kboard = NULL; |
95e3b5b2f3ef
(get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83728
diff
changeset
|
289 } |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
290 } |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
291 |
93369
ed10c3092847
* keyboard.c (pending_funcalls): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91749
diff
changeset
|
292 Lisp_Object Qrun_hook_with_args; |
ed10c3092847
* keyboard.c (pending_funcalls): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91749
diff
changeset
|
293 static Lisp_Object Qdelete_terminal_functions; |
ed10c3092847
* keyboard.c (pending_funcalls): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91749
diff
changeset
|
294 static Lisp_Object Vdelete_terminal_functions; |
ed10c3092847
* keyboard.c (pending_funcalls): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91749
diff
changeset
|
295 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
296 DEFUN ("delete-terminal", Fdelete_terminal, Sdelete_terminal, 0, 2, 0, |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
297 doc: /* Delete TERMINAL by deleting all frames on it and closing the terminal. |
102845
9564179cff01
* terminal.c (Fterminal_name, Fdelete_terminal, Fterminal_name)
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
298 TERMINAL may be a terminal object, a frame, or nil (meaning the |
9564179cff01
* terminal.c (Fterminal_name, Fdelete_terminal, Fterminal_name)
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
299 selected frame's terminal). |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
300 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
301 Normally, you may not delete a display if all other displays are suspended, |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
302 but if the second argument FORCE is non-nil, you may do so. */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109126
diff
changeset
|
303 (Lisp_Object terminal, Lisp_Object force) |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
304 { |
91749
e1f7f307ce9e
(Fdelete_terminal): Clean up the `force' path.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91732
diff
changeset
|
305 struct terminal *t = get_terminal (terminal, 0); |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
306 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
307 if (!t) |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
308 return Qnil; |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
309 |
91749
e1f7f307ce9e
(Fdelete_terminal): Clean up the `force' path.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91732
diff
changeset
|
310 if (NILP (force)) |
e1f7f307ce9e
(Fdelete_terminal): Clean up the `force' path.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91732
diff
changeset
|
311 { |
e1f7f307ce9e
(Fdelete_terminal): Clean up the `force' path.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91732
diff
changeset
|
312 struct terminal *p = terminal_list; |
e1f7f307ce9e
(Fdelete_terminal): Clean up the `force' path.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91732
diff
changeset
|
313 while (p && (p == t || !TERMINAL_ACTIVE_P (p))) |
e1f7f307ce9e
(Fdelete_terminal): Clean up the `force' path.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91732
diff
changeset
|
314 p = p->next_terminal; |
100632
389db2f016a4
* frame.c (delete_frame): New function derived from
Martin Rudalics <rudalics@gmx.at>
parents:
97141
diff
changeset
|
315 |
91749
e1f7f307ce9e
(Fdelete_terminal): Clean up the `force' path.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91732
diff
changeset
|
316 if (!p) |
e1f7f307ce9e
(Fdelete_terminal): Clean up the `force' path.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91732
diff
changeset
|
317 error ("Attempt to delete the sole active display terminal"); |
e1f7f307ce9e
(Fdelete_terminal): Clean up the `force' path.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91732
diff
changeset
|
318 } |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
319 |
93369
ed10c3092847
* keyboard.c (pending_funcalls): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91749
diff
changeset
|
320 if (NILP (Vrun_hooks)) |
ed10c3092847
* keyboard.c (pending_funcalls): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91749
diff
changeset
|
321 ; |
ed10c3092847
* keyboard.c (pending_funcalls): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91749
diff
changeset
|
322 else if (EQ (force, Qnoelisp)) |
ed10c3092847
* keyboard.c (pending_funcalls): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91749
diff
changeset
|
323 pending_funcalls |
ed10c3092847
* keyboard.c (pending_funcalls): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91749
diff
changeset
|
324 = Fcons (list3 (Qrun_hook_with_args, |
ed10c3092847
* keyboard.c (pending_funcalls): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91749
diff
changeset
|
325 Qdelete_terminal_functions, terminal), |
ed10c3092847
* keyboard.c (pending_funcalls): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91749
diff
changeset
|
326 pending_funcalls); |
ed10c3092847
* keyboard.c (pending_funcalls): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91749
diff
changeset
|
327 else |
ed10c3092847
* keyboard.c (pending_funcalls): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91749
diff
changeset
|
328 safe_call2 (Qrun_hook_with_args, Qdelete_terminal_functions, terminal); |
ed10c3092847
* keyboard.c (pending_funcalls): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91749
diff
changeset
|
329 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
330 if (t->delete_terminal_hook) |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
331 (*t->delete_terminal_hook) (t); |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
332 else |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
333 delete_terminal (t); |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
334 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
335 return Qnil; |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
336 } |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
337 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
338 |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
339 DEFUN ("frame-terminal", Fframe_terminal, Sframe_terminal, 0, 1, 0, |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
340 doc: /* Return the terminal that FRAME is displayed on. |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
341 If FRAME is nil, the selected frame is used. |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
342 |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
343 The terminal device is represented by its integer identifier. */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109126
diff
changeset
|
344 (Lisp_Object frame) |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
345 { |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
346 struct terminal *t; |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
347 |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
348 if (NILP (frame)) |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
349 frame = selected_frame; |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
350 |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
351 CHECK_LIVE_FRAME (frame); |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
352 |
84694
95e3b5b2f3ef
(get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83728
diff
changeset
|
353 t = FRAME_TERMINAL (XFRAME (frame)); |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
354 |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
355 if (!t) |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
356 return Qnil; |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
357 else |
84694
95e3b5b2f3ef
(get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83728
diff
changeset
|
358 { |
95e3b5b2f3ef
(get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83728
diff
changeset
|
359 Lisp_Object terminal; |
95e3b5b2f3ef
(get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83728
diff
changeset
|
360 XSETTERMINAL (terminal, t); |
95e3b5b2f3ef
(get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83728
diff
changeset
|
361 return terminal; |
95e3b5b2f3ef
(get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83728
diff
changeset
|
362 } |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
363 } |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
364 |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
365 DEFUN ("terminal-live-p", Fterminal_live_p, Sterminal_live_p, 1, 1, 0, |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
366 doc: /* Return non-nil if OBJECT is a terminal which has not been deleted. |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
367 Value is nil if OBJECT is not a live display terminal. |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
368 If object is a live display terminal, the return value indicates what |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
369 sort of output terminal it uses. See the documentation of `framep' for |
84694
95e3b5b2f3ef
(get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83728
diff
changeset
|
370 possible return values. */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109126
diff
changeset
|
371 (Lisp_Object object) |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
372 { |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
373 struct terminal *t; |
100632
389db2f016a4
* frame.c (delete_frame): New function derived from
Martin Rudalics <rudalics@gmx.at>
parents:
97141
diff
changeset
|
374 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
375 t = get_terminal (object, 0); |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
376 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
377 if (!t) |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
378 return Qnil; |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
379 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
380 switch (t->type) |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
381 { |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
382 case output_initial: /* The initial frame is like a termcap frame. */ |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
383 case output_termcap: |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
384 return Qt; |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
385 case output_x_window: |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
386 return Qx; |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
387 case output_w32: |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
388 return Qw32; |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
389 case output_msdos_raw: |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
390 return Qpc; |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
391 case output_mac: |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
392 return Qmac; |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
94963
diff
changeset
|
393 case output_ns: |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
94963
diff
changeset
|
394 return Qns; |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
395 default: |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
396 abort (); |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
397 } |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
398 } |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
399 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
400 DEFUN ("terminal-list", Fterminal_list, Sterminal_list, 0, 0, 0, |
84694
95e3b5b2f3ef
(get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83728
diff
changeset
|
401 doc: /* Return a list of all terminal devices. */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109126
diff
changeset
|
402 (void) |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
403 { |
84694
95e3b5b2f3ef
(get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83728
diff
changeset
|
404 Lisp_Object terminal, terminals = Qnil; |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
405 struct terminal *t; |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
406 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
407 for (t = terminal_list; t; t = t->next_terminal) |
84694
95e3b5b2f3ef
(get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83728
diff
changeset
|
408 { |
95e3b5b2f3ef
(get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83728
diff
changeset
|
409 XSETTERMINAL (terminal, t); |
95e3b5b2f3ef
(get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83728
diff
changeset
|
410 terminals = Fcons (terminal, terminals); |
95e3b5b2f3ef
(get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83728
diff
changeset
|
411 } |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
412 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
413 return terminals; |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
414 } |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
415 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
416 DEFUN ("terminal-name", Fterminal_name, Sterminal_name, 0, 1, 0, |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
417 doc: /* Return the name of the terminal device TERMINAL. |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
418 It is not guaranteed that the returned value is unique among opened devices. |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
419 |
102845
9564179cff01
* terminal.c (Fterminal_name, Fdelete_terminal, Fterminal_name)
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
420 TERMINAL may be a terminal object, a frame, or nil (meaning the |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
421 selected frame's terminal). */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109126
diff
changeset
|
422 (Lisp_Object terminal) |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
423 { |
84697
efbb243fc83d
(get_terminal): Don't accept integers to represent terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84694
diff
changeset
|
424 struct terminal *t |
efbb243fc83d
(get_terminal): Don't accept integers to represent terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84694
diff
changeset
|
425 = TERMINALP (terminal) ? XTERMINAL (terminal) : get_terminal (terminal, 1); |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
426 |
84697
efbb243fc83d
(get_terminal): Don't accept integers to represent terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84694
diff
changeset
|
427 return t->name ? build_string (t->name) : Qnil; |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
428 } |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
429 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
430 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
431 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
432 /* Set the value of terminal parameter PARAMETER in terminal D to VALUE. |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
433 Return the previous value. */ |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
434 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
435 Lisp_Object |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
436 store_terminal_param (struct terminal *t, Lisp_Object parameter, Lisp_Object value) |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
437 { |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
438 Lisp_Object old_alist_elt = Fassq (parameter, t->param_alist); |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
439 if (EQ (old_alist_elt, Qnil)) |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
440 { |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
441 t->param_alist = Fcons (Fcons (parameter, value), t->param_alist); |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
442 return Qnil; |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
443 } |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
444 else |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
445 { |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
446 Lisp_Object result = Fcdr (old_alist_elt); |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
447 Fsetcdr (old_alist_elt, value); |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
448 return result; |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
449 } |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
450 } |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
451 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
452 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
453 DEFUN ("terminal-parameters", Fterminal_parameters, Sterminal_parameters, 0, 1, 0, |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
454 doc: /* Return the parameter-alist of terminal TERMINAL. |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
455 The value is a list of elements of the form (PARM . VALUE), where PARM |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
456 is a symbol. |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
457 |
102845
9564179cff01
* terminal.c (Fterminal_name, Fdelete_terminal, Fterminal_name)
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
458 TERMINAL can be a terminal object, a frame, or nil (meaning the |
9564179cff01
* terminal.c (Fterminal_name, Fdelete_terminal, Fterminal_name)
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
459 selected frame's terminal). */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109126
diff
changeset
|
460 (Lisp_Object terminal) |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
461 { |
84697
efbb243fc83d
(get_terminal): Don't accept integers to represent terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84694
diff
changeset
|
462 struct terminal *t |
efbb243fc83d
(get_terminal): Don't accept integers to represent terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84694
diff
changeset
|
463 = TERMINALP (terminal) ? XTERMINAL (terminal) : get_terminal (terminal, 1); |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
464 return Fcopy_alist (t->param_alist); |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
465 } |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
466 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
467 DEFUN ("terminal-parameter", Fterminal_parameter, Sterminal_parameter, 2, 2, 0, |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
468 doc: /* Return TERMINAL's value for parameter PARAMETER. |
102845
9564179cff01
* terminal.c (Fterminal_name, Fdelete_terminal, Fterminal_name)
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
469 TERMINAL can be a terminal object, a frame, or nil (meaning the |
9564179cff01
* terminal.c (Fterminal_name, Fdelete_terminal, Fterminal_name)
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
470 selected frame's terminal). */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109126
diff
changeset
|
471 (Lisp_Object terminal, Lisp_Object parameter) |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
472 { |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
473 Lisp_Object value; |
84697
efbb243fc83d
(get_terminal): Don't accept integers to represent terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84694
diff
changeset
|
474 struct terminal *t |
efbb243fc83d
(get_terminal): Don't accept integers to represent terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84694
diff
changeset
|
475 = TERMINALP (terminal) ? XTERMINAL (terminal) : get_terminal (terminal, 1); |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
476 CHECK_SYMBOL (parameter); |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
477 value = Fcdr (Fassq (parameter, t->param_alist)); |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
478 return value; |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
479 } |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
480 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
481 DEFUN ("set-terminal-parameter", Fset_terminal_parameter, |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
482 Sset_terminal_parameter, 3, 3, 0, |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
483 doc: /* Set TERMINAL's value for parameter PARAMETER to VALUE. |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
484 Return the previous value of PARAMETER. |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
485 |
102845
9564179cff01
* terminal.c (Fterminal_name, Fdelete_terminal, Fterminal_name)
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
486 TERMINAL can be a terminal object, a frame or nil (meaning the |
9564179cff01
* terminal.c (Fterminal_name, Fdelete_terminal, Fterminal_name)
Chong Yidong <cyd@stupidchicken.com>
parents:
100951
diff
changeset
|
487 selected frame's terminal). */) |
109179
8cfee7d2955f
Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109126
diff
changeset
|
488 (Lisp_Object terminal, Lisp_Object parameter, Lisp_Object value) |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
489 { |
84697
efbb243fc83d
(get_terminal): Don't accept integers to represent terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84694
diff
changeset
|
490 struct terminal *t |
efbb243fc83d
(get_terminal): Don't accept integers to represent terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84694
diff
changeset
|
491 = TERMINALP (terminal) ? XTERMINAL (terminal) : get_terminal (terminal, 1); |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
492 return store_terminal_param (t, parameter, value); |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
493 } |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
494 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
495 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
496 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
497 /* Create the bootstrap display terminal for the initial frame. |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
498 Returns a terminal of type output_initial. */ |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
499 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
500 struct terminal * |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
501 init_initial_terminal (void) |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
502 { |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
503 if (initialized || terminal_list || tty_list) |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
504 abort (); |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
505 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
506 initial_terminal = create_terminal (); |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
507 initial_terminal->type = output_initial; |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
508 initial_terminal->name = xstrdup ("initial_terminal"); |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
509 initial_terminal->kboard = initial_kboard; |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
510 initial_terminal->delete_terminal_hook = &delete_initial_terminal; |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
511 /* All other hooks are NULL. */ |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
512 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
513 return initial_terminal; |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
514 } |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
515 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
516 /* Deletes the bootstrap terminal device. |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
517 Called through delete_terminal_hook. */ |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
518 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
519 static void |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
520 delete_initial_terminal (struct terminal *terminal) |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
521 { |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
522 if (terminal != initial_terminal) |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
523 abort (); |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
524 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
525 delete_terminal (terminal); |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
526 initial_terminal = NULL; |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
527 } |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
528 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
529 void |
109126
aec1143e8d85
Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
109100
diff
changeset
|
530 syms_of_terminal (void) |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
531 { |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
532 |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
533 DEFVAR_LISP ("ring-bell-function", &Vring_bell_function, |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
534 doc: /* Non-nil means call this function to ring the bell. |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
535 The function should accept no arguments. */); |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
536 Vring_bell_function = Qnil; |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
537 |
93369
ed10c3092847
* keyboard.c (pending_funcalls): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91749
diff
changeset
|
538 DEFVAR_LISP ("delete-terminal-functions", &Vdelete_terminal_functions, |
ed10c3092847
* keyboard.c (pending_funcalls): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91749
diff
changeset
|
539 doc: /* Special hook run when a terminal is deleted. |
ed10c3092847
* keyboard.c (pending_funcalls): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91749
diff
changeset
|
540 Each function is called with argument, the terminal. |
ed10c3092847
* keyboard.c (pending_funcalls): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91749
diff
changeset
|
541 This may be called just before actually deleting the terminal, |
ed10c3092847
* keyboard.c (pending_funcalls): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91749
diff
changeset
|
542 or some time later. */); |
ed10c3092847
* keyboard.c (pending_funcalls): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91749
diff
changeset
|
543 Vdelete_terminal_functions = Qnil; |
105877
21bdda3ded62
* xterm.c (syms_of_xterm):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105669
diff
changeset
|
544 Qdelete_terminal_functions = intern_c_string ("delete-terminal-functions"); |
93369
ed10c3092847
* keyboard.c (pending_funcalls): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91749
diff
changeset
|
545 staticpro (&Qdelete_terminal_functions); |
105877
21bdda3ded62
* xterm.c (syms_of_xterm):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105669
diff
changeset
|
546 Qrun_hook_with_args = intern_c_string ("run-hook-with-args"); |
93369
ed10c3092847
* keyboard.c (pending_funcalls): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91749
diff
changeset
|
547 staticpro (&Qrun_hook_with_args); |
ed10c3092847
* keyboard.c (pending_funcalls): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91749
diff
changeset
|
548 |
83431
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
549 defsubr (&Sdelete_terminal); |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
550 defsubr (&Sframe_terminal); |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
551 defsubr (&Sterminal_live_p); |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
552 defsubr (&Sterminal_list); |
76396de7f50a
Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents:
83420
diff
changeset
|
553 defsubr (&Sterminal_name); |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
554 defsubr (&Sterminal_parameters); |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
555 defsubr (&Sterminal_parameter); |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
556 defsubr (&Sset_terminal_parameter); |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
557 |
105877
21bdda3ded62
* xterm.c (syms_of_xterm):
Dan Nicolaescu <dann@ics.uci.edu>
parents:
105669
diff
changeset
|
558 Fprovide (intern_c_string ("multi-tty"), Qnil); |
83420
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
559 } |
521d3f18b3d1
Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff
changeset
|
560 |