annotate src/terminal.c @ 112218:376148b31b5e

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