annotate src/terminal.c @ 105262:dd56317c5c3b

* NEWS: Mention Tramp connection methods "imap" and "imaps".
author Michael Albinus <michael.albinus@gmx.de>
date Mon, 28 Sep 2009 15:51:00 +0000
parents 9637720d550b
children 68dd71358159
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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.
100951
e038c1a8307c Add 2009 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 100632
diff changeset
2 Copyright (C) 2005, 2006, 2007, 2008, 2009 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>
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
21
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
22 #include "lisp.h"
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
23 #include "frame.h"
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
24 #include "termchar.h"
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
25 #include "termhooks.h"
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
26 #include "charset.h"
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
27 #include "coding.h"
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
28 #include "keyboard.h"
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
29
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
30 /* 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
31 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
32
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
33 /* 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
34 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
35
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
36 /* 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
37 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
38
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
39 /* 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
40 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
41
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
42 static void delete_initial_terminal P_ ((struct terminal *));
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
43
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 void
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
47 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
48 {
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
49 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
50 {
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
51 Lisp_Object function;
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
52
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
53 /* 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
54 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
55 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
56
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
57 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
58 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
59 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
60
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
61 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
62 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
63
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
64 call0 (function);
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
65
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
66 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
67 }
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
68 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
69 (*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
70 }
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 void
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
73 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
74 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
75 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
76 (*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
77 }
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 void
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
80 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
81 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
82 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
83 (*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
84 }
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 /* 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
87 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
88 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
89 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
90
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
91 void
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
92 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
93 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
94 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
95 (*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
96 }
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 /* 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
99 frame-relative coordinates. */
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
100
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
101 void
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
102 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
103 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
104 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
105 (*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
106 }
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 /* 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
109
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
110 void
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
111 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
112 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
113 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
114 (*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
115 }
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 /* Erase operations */
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
118
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
119 /* 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
120 void
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
121 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
122 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
123 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
124 (*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
125 }
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 /* Clear entire frame */
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
128
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
129 void
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
130 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
131 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
132 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
133 (*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
134 }
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 /* 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
137 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
138
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
139 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
140
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
141 void
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
142 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
143 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
144 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
145 (*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
146 }
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 /* 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
149 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
150
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
151 void
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
152 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
153 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
154 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
155 (*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
156 }
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 /* 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
159
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
160 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
161
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
162 void
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
163 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
164 {
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
165 if (len <= 0)
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
166 return;
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
167
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
168 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
169 (*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
170 }
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 /* 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
173
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
174 void
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
175 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
176 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
177 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
178 (*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
179 }
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 /* 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
182
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
183 void
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
184 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
185 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
186 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
187 (*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
188 }
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
103046
9637720d550b Minor comment fix.
Chong Yidong <cyd@stupidchicken.com>
parents: 102845
diff changeset
193 /* Return the terminal object specified by TERMINAL. TERMINAL may be
9637720d550b Minor comment fix.
Chong Yidong <cyd@stupidchicken.com>
parents: 102845
diff changeset
194 a terminal object, a frame, or nil for the terminal device of the
9637720d550b Minor comment fix.
Chong Yidong <cyd@stupidchicken.com>
parents: 102845
diff changeset
195 current frame. If THROW is zero, return NULL for failure,
9637720d550b Minor comment fix.
Chong Yidong <cyd@stupidchicken.com>
parents: 102845
diff changeset
196 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
197
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
198 struct terminal *
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
199 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
200 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
201 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
202
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
203 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
204 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
205
84694
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
206 if (TERMINALP (terminal))
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
207 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
208 else if (FRAMEP (terminal))
103046
9637720d550b Minor comment fix.
Chong Yidong <cyd@stupidchicken.com>
parents: 102845
diff changeset
209 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
210
84694
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
211 if (result && !result->name)
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
212 result = NULL;
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
213
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
214 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
215 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
216
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
217 return result;
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
218 }
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
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
222 /* 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
223
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
224 struct terminal *
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
225 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
226 {
84694
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
227 struct terminal *terminal = allocate_terminal ();
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
228
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
229 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
230 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
231 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
232
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
233 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
234
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
235 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
236 (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
237 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
238 (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
239
91046
35069180a991 Fix up multi-tty merge
Miles Bader <miles@gnu.org>
parents: 84697
diff changeset
240 setup_coding_system (Qno_conversion, terminal->keyboard_coding);
35069180a991 Fix up multi-tty merge
Miles Bader <miles@gnu.org>
parents: 84697
diff changeset
241 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
242
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
243 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
244 return terminal;
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
245 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
246
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
247 /* 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
248 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
249
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
250 void
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
251 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
252 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
253 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
254 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
255
100632
389db2f016a4 * frame.c (delete_frame): New function derived from
Martin Rudalics <rudalics@gmx.at>
parents: 97141
diff changeset
256 /* 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
257 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
258 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
259 return;
84694
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
260 xfree (terminal->name);
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
261 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
262
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
263 /* 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
264 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
265 {
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
266 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
267 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
268 {
100632
389db2f016a4 * frame.c (delete_frame): New function derived from
Martin Rudalics <rudalics@gmx.at>
parents: 97141
diff changeset
269 /* Pass Qnoelisp rather than Qt. */
389db2f016a4 * frame.c (delete_frame): New function derived from
Martin Rudalics <rudalics@gmx.at>
parents: 97141
diff changeset
270 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
271 }
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
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
274 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
275 if (! *tp)
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
276 abort ();
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
277 *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
278
84694
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
279 xfree (terminal->keyboard_coding);
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
280 terminal->keyboard_coding = NULL;
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
281 xfree (terminal->terminal_coding);
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
282 terminal->terminal_coding = NULL;
100632
389db2f016a4 * frame.c (delete_frame): New function derived from
Martin Rudalics <rudalics@gmx.at>
parents: 97141
diff changeset
283
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
284 if (terminal->kboard && --terminal->kboard->reference_count == 0)
84694
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
285 {
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
286 delete_kboard (terminal->kboard);
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
287 terminal->kboard = NULL;
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
288 }
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
289 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
290
93369
ed10c3092847 * keyboard.c (pending_funcalls): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 91749
diff changeset
291 Lisp_Object Qrun_hook_with_args;
ed10c3092847 * keyboard.c (pending_funcalls): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 91749
diff changeset
292 static Lisp_Object Qdelete_terminal_functions;
ed10c3092847 * keyboard.c (pending_funcalls): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 91749
diff changeset
293 static Lisp_Object Vdelete_terminal_functions;
ed10c3092847 * keyboard.c (pending_funcalls): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 91749
diff changeset
294
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
295 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
296 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
297 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
298 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
299
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
300 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
301 but if the second argument FORCE is non-nil, you may do so. */)
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
302 (terminal, force)
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
303 Lisp_Object terminal, 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. */)
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
344 (frame)
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
345 Lisp_Object frame;
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
346 {
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
347 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
348
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
349 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
350 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
351
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
352 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
353
84694
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
354 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
355
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
356 if (!t)
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
357 return Qnil;
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
358 else
84694
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
359 {
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
360 Lisp_Object terminal;
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
361 XSETTERMINAL (terminal, t);
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
362 return terminal;
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
363 }
83431
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
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
366 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
367 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
368 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
369 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
370 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
371 possible return values. */)
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
372 (object)
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
373 Lisp_Object object;
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
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 struct terminal *t;
100632
389db2f016a4 * frame.c (delete_frame): New function derived from
Martin Rudalics <rudalics@gmx.at>
parents: 97141
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 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
378
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
379 if (!t)
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
380 return Qnil;
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
381
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
382 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
383 {
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
384 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
385 case output_termcap:
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
386 return Qt;
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
387 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
388 return Qx;
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
389 case output_w32:
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
390 return Qw32;
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
391 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
392 return Qpc;
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
393 case output_mac:
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
394 return Qmac;
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 94963
diff changeset
395 case output_ns:
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 94963
diff changeset
396 return Qns;
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
397 default:
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
398 abort ();
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
399 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
400 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
401
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
402 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
403 doc: /* Return a list of all terminal devices. */)
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
404 ()
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
405 {
84694
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
406 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
407 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
408
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
409 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
410 {
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
411 XSETTERMINAL (terminal, t);
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
412 terminals = Fcons (terminal, terminals);
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
413 }
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
414
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
415 return terminals;
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
416 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
417
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
418 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
419 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
420 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
421
102845
9564179cff01 * terminal.c (Fterminal_name, Fdelete_terminal, Fterminal_name)
Chong Yidong <cyd@stupidchicken.com>
parents: 100951
diff changeset
422 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
423 selected frame's terminal). */)
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
424 (terminal)
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
425 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
426 {
84697
efbb243fc83d (get_terminal): Don't accept integers to represent terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84694
diff changeset
427 struct terminal *t
efbb243fc83d (get_terminal): Don't accept integers to represent terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84694
diff changeset
428 = 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
429
84697
efbb243fc83d (get_terminal): Don't accept integers to represent terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84694
diff changeset
430 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
431 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
432
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
433
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
434
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
435 /* Return the value of terminal parameter PARAM in terminal T. */
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
436 Lisp_Object
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
437 get_terminal_param (t, param)
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
438 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
439 Lisp_Object param;
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 Lisp_Object tem = Fassq (param, 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 if (EQ (tem, Qnil))
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
443 return tem;
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
444 return Fcdr (tem);
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
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
447 /* 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
448 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
449
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
450 Lisp_Object
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
451 store_terminal_param (t, parameter, value)
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
452 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
453 Lisp_Object parameter;
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
454 Lisp_Object value;
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
455 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
456 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
457 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
458 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
459 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
460 return Qnil;
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
461 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
462 else
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
463 {
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
464 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
465 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
466 return result;
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
467 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
468 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
469
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
470
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
471 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
472 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
473 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
474 is a symbol.
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
475
102845
9564179cff01 * terminal.c (Fterminal_name, Fdelete_terminal, Fterminal_name)
Chong Yidong <cyd@stupidchicken.com>
parents: 100951
diff changeset
476 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
477 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
478 (terminal)
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
479 Lisp_Object terminal;
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
480 {
84697
efbb243fc83d (get_terminal): Don't accept integers to represent terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84694
diff changeset
481 struct terminal *t
efbb243fc83d (get_terminal): Don't accept integers to represent terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84694
diff changeset
482 = 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
483 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
484 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
485
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
486 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
487 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
488 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
489 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
490 (terminal, parameter)
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
491 Lisp_Object terminal;
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
492 Lisp_Object parameter;
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 Lisp_Object value;
84697
efbb243fc83d (get_terminal): Don't accept integers to represent terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84694
diff changeset
495 struct terminal *t
efbb243fc83d (get_terminal): Don't accept integers to represent terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84694
diff changeset
496 = 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
497 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
498 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
499 return value;
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
500 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
501
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
502 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
503 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
504 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
505 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
506
102845
9564179cff01 * terminal.c (Fterminal_name, Fdelete_terminal, Fterminal_name)
Chong Yidong <cyd@stupidchicken.com>
parents: 100951
diff changeset
507 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
508 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
509 (terminal, parameter, value)
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
510 Lisp_Object terminal;
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
511 Lisp_Object parameter;
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
512 Lisp_Object value;
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
513 {
84697
efbb243fc83d (get_terminal): Don't accept integers to represent terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84694
diff changeset
514 struct terminal *t
efbb243fc83d (get_terminal): Don't accept integers to represent terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84694
diff changeset
515 = 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
516 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
517 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
518
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
519
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
520
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
521 /* 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
522 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
523
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
524 struct terminal *
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
525 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
526 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
527 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
528 abort ();
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
529
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
530 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
531 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
532 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
533 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
534 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
535 /* 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
536
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
537 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
538 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
539
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
540 /* 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
541 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
542
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
543 static void
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
544 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
545 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
546 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
547 abort ();
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
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 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
550 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
551 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
552
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
553 void
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
554 syms_of_terminal ()
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
555 {
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
556
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
557 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
558 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
559 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
560 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
561
93369
ed10c3092847 * keyboard.c (pending_funcalls): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 91749
diff changeset
562 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
563 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
564 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
565 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
566 or some time later. */);
ed10c3092847 * keyboard.c (pending_funcalls): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 91749
diff changeset
567 Vdelete_terminal_functions = Qnil;
ed10c3092847 * keyboard.c (pending_funcalls): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 91749
diff changeset
568 Qdelete_terminal_functions = intern ("delete-terminal-functions");
ed10c3092847 * keyboard.c (pending_funcalls): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 91749
diff changeset
569 staticpro (&Qdelete_terminal_functions);
ed10c3092847 * keyboard.c (pending_funcalls): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 91749
diff changeset
570 Qrun_hook_with_args = intern ("run-hook-with-args");
ed10c3092847 * keyboard.c (pending_funcalls): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 91749
diff changeset
571 staticpro (&Qrun_hook_with_args);
ed10c3092847 * keyboard.c (pending_funcalls): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 91749
diff changeset
572
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
573 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
574 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
575 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
576 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
577 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
578 defsubr (&Sterminal_parameters);
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
579 defsubr (&Sterminal_parameter);
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
580 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
581
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
582 Fprovide (intern ("multi-tty"), Qnil);
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
583 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
584
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
585 /* arch-tag: e9af6f27-b483-47dc-bb1a-730c1c5cab03
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
586 (do not change this comment) */