annotate src/terminal.c @ 112397:a7191495c39c

Include entries from yesterdays checkins that were in an unsaved buffer.
author Ken Manheimer <ken.manheimer@gmail.com>
date Fri, 21 Jan 2011 11:36:24 -0500
parents 42e22c4f06b7
children
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
109100
2bc9a0c04c87 Remove __P and P_ from .c and .m files and definition of P_
Jan D <jan.h.d@swipnet.se>
parents: 106815
diff changeset
40 static void delete_initial_terminal (struct terminal *);
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
41
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
42
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
43
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
44 void
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
45 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
46 {
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
47 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
48 {
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
49 Lisp_Object function;
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
50
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
51 /* 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
52 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
53 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
54
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
55 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
56 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
57 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
58
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
59 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
60 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
61
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
62 call0 (function);
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
63
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
64 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
65 }
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
66 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
67 (*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
68 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
69
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
70 void
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
71 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
72 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
73 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
74 (*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
75 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
76
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
77 void
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
78 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
79 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
80 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
81 (*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
82 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
83
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
84 /* 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
85 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
86 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
87 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
88
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
89 void
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
90 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
91 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
92 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
93 (*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
94 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
95
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
96 /* 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
97 frame-relative coordinates. */
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 void
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
100 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
101 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
102 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
103 (*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
104 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
105
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
106 /* 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
107
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
108 void
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
109 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
110 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
111 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
112 (*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
113 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
114
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
115 /* Erase operations */
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 /* 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
118 void
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
119 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
120 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
121 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
122 (*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
123 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
124
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
125 /* Clear entire frame */
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 void
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
128 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
129 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
130 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
131 (*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
132 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
133
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
134 /* 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
135 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
136
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
137 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
138
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
139 void
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
140 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
141 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
142 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
143 (*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
144 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
145
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
146 /* 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
147 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
148
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
149 void
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
150 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
151 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
152 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
153 (*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
154 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
155
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
156 /* 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
157
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
158 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
159
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
160 void
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
161 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
162 {
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
163 if (len <= 0)
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
164 return;
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
165
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
166 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
167 (*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
168 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
169
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
170 /* 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
171
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
172 void
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
173 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
174 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
175 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
176 (*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
177 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
178
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
179 /* 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
180
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
181 void
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
182 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
183 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
184 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
185 (*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
186 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
187
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
188
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
189
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
190
103046
9637720d550b Minor comment fix.
Chong Yidong <cyd@stupidchicken.com>
parents: 102845
diff changeset
191 /* Return the terminal object specified by TERMINAL. TERMINAL may be
9637720d550b Minor comment fix.
Chong Yidong <cyd@stupidchicken.com>
parents: 102845
diff changeset
192 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
193 current frame. If THROW is zero, return NULL for failure,
9637720d550b Minor comment fix.
Chong Yidong <cyd@stupidchicken.com>
parents: 102845
diff changeset
194 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
195
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
196 struct terminal *
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
197 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
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 *result = NULL;
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
200
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
201 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
202 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
203
84694
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
204 if (TERMINALP (terminal))
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
205 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
206 else if (FRAMEP (terminal))
103046
9637720d550b Minor comment fix.
Chong Yidong <cyd@stupidchicken.com>
parents: 102845
diff changeset
207 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
208
84694
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
209 if (result && !result->name)
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
210 result = NULL;
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
211
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
212 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
213 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
214
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
215 return result;
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
216 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
217
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
218
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
219
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
220 /* 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
221
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
222 struct terminal *
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
223 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
224 {
84694
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
225 struct terminal *terminal = allocate_terminal ();
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
226
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
227 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
228 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
229 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
230
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->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
232
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
233 terminal->keyboard_coding =
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
234 (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
235 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
236 (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
237
91046
35069180a991 Fix up multi-tty merge
Miles Bader <miles@gnu.org>
parents: 84697
diff changeset
238 setup_coding_system (Qno_conversion, terminal->keyboard_coding);
35069180a991 Fix up multi-tty merge
Miles Bader <miles@gnu.org>
parents: 84697
diff changeset
239 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
240
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
241 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
242 return terminal;
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
243 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
244
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
245 /* 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
246 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
247
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
248 void
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
249 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
250 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
251 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
252 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
253
100632
389db2f016a4 * frame.c (delete_frame): New function derived from
Martin Rudalics <rudalics@gmx.at>
parents: 97141
diff changeset
254 /* 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
255 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
256 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
257 return;
84694
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
258 xfree (terminal->name);
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
259 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
260
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
261 /* 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
262 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
263 {
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
264 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
265 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
266 {
100632
389db2f016a4 * frame.c (delete_frame): New function derived from
Martin Rudalics <rudalics@gmx.at>
parents: 97141
diff changeset
267 /* Pass Qnoelisp rather than Qt. */
389db2f016a4 * frame.c (delete_frame): New function derived from
Martin Rudalics <rudalics@gmx.at>
parents: 97141
diff changeset
268 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
269 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
270 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
271
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
272 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
273 if (! *tp)
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
274 abort ();
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
275 *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
276
84694
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
277 xfree (terminal->keyboard_coding);
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
278 terminal->keyboard_coding = NULL;
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
279 xfree (terminal->terminal_coding);
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
280 terminal->terminal_coding = NULL;
100632
389db2f016a4 * frame.c (delete_frame): New function derived from
Martin Rudalics <rudalics@gmx.at>
parents: 97141
diff changeset
281
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
282 if (terminal->kboard && --terminal->kboard->reference_count == 0)
84694
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
283 {
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
284 delete_kboard (terminal->kboard);
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
285 terminal->kboard = NULL;
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
286 }
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
287 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
288
93369
ed10c3092847 * keyboard.c (pending_funcalls): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 91749
diff changeset
289 Lisp_Object Qrun_hook_with_args;
ed10c3092847 * keyboard.c (pending_funcalls): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 91749
diff changeset
290 static Lisp_Object Qdelete_terminal_functions;
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
291 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
292 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
293 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
294 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
295
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
296 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
297 but if the second argument FORCE is non-nil, you may do so. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109126
diff changeset
298 (Lisp_Object terminal, Lisp_Object force)
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
299 {
91749
e1f7f307ce9e (Fdelete_terminal): Clean up the `force' path.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 91732
diff changeset
300 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
301
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
302 if (!t)
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
303 return Qnil;
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
304
91749
e1f7f307ce9e (Fdelete_terminal): Clean up the `force' path.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 91732
diff changeset
305 if (NILP (force))
e1f7f307ce9e (Fdelete_terminal): Clean up the `force' path.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 91732
diff changeset
306 {
e1f7f307ce9e (Fdelete_terminal): Clean up the `force' path.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 91732
diff changeset
307 struct terminal *p = terminal_list;
e1f7f307ce9e (Fdelete_terminal): Clean up the `force' path.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 91732
diff changeset
308 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
309 p = p->next_terminal;
100632
389db2f016a4 * frame.c (delete_frame): New function derived from
Martin Rudalics <rudalics@gmx.at>
parents: 97141
diff changeset
310
91749
e1f7f307ce9e (Fdelete_terminal): Clean up the `force' path.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 91732
diff changeset
311 if (!p)
e1f7f307ce9e (Fdelete_terminal): Clean up the `force' path.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 91732
diff changeset
312 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
313 }
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
314
93369
ed10c3092847 * keyboard.c (pending_funcalls): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 91749
diff changeset
315 if (NILP (Vrun_hooks))
ed10c3092847 * keyboard.c (pending_funcalls): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 91749
diff changeset
316 ;
ed10c3092847 * keyboard.c (pending_funcalls): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 91749
diff changeset
317 else if (EQ (force, Qnoelisp))
ed10c3092847 * keyboard.c (pending_funcalls): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 91749
diff changeset
318 pending_funcalls
ed10c3092847 * keyboard.c (pending_funcalls): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 91749
diff changeset
319 = Fcons (list3 (Qrun_hook_with_args,
ed10c3092847 * keyboard.c (pending_funcalls): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 91749
diff changeset
320 Qdelete_terminal_functions, terminal),
ed10c3092847 * keyboard.c (pending_funcalls): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 91749
diff changeset
321 pending_funcalls);
ed10c3092847 * keyboard.c (pending_funcalls): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 91749
diff changeset
322 else
ed10c3092847 * keyboard.c (pending_funcalls): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 91749
diff changeset
323 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
324
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
325 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
326 (*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
327 else
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
328 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
329
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
330 return Qnil;
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
331 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
332
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
333
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
334 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
335 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
336 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
337
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
338 The terminal device is represented by its integer identifier. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109126
diff changeset
339 (Lisp_Object frame)
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
340 {
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
341 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
342
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
343 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
344 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
345
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
346 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
347
84694
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
348 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
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 (!t)
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
351 return Qnil;
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
352 else
84694
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
353 {
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
354 Lisp_Object terminal;
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
355 XSETTERMINAL (terminal, t);
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
356 return terminal;
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
357 }
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
358 }
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
359
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
360 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
361 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
362 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
363 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
364 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
365 possible return values. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109126
diff changeset
366 (Lisp_Object object)
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
367 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
368 struct terminal *t;
100632
389db2f016a4 * frame.c (delete_frame): New function derived from
Martin Rudalics <rudalics@gmx.at>
parents: 97141
diff changeset
369
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
370 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
371
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
372 if (!t)
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
373 return Qnil;
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
374
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
375 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
376 {
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
377 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
378 case output_termcap:
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
379 return Qt;
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
380 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
381 return Qx;
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
382 case output_w32:
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
383 return Qw32;
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
384 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
385 return Qpc;
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
386 case output_mac:
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
387 return Qmac;
96675
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 94963
diff changeset
388 case output_ns:
d45acf0c8d23 merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents: 94963
diff changeset
389 return Qns;
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
390 default:
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
391 abort ();
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
392 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
393 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
394
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
395 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
396 doc: /* Return a list of all terminal devices. */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109126
diff changeset
397 (void)
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
398 {
84694
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
399 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
400 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
401
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
402 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
403 {
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
404 XSETTERMINAL (terminal, t);
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
405 terminals = Fcons (terminal, terminals);
95e3b5b2f3ef (get_terminal): Handle terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 83728
diff changeset
406 }
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
407
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
408 return terminals;
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
409 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
410
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
411 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
412 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
413 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
414
102845
9564179cff01 * terminal.c (Fterminal_name, Fdelete_terminal, Fterminal_name)
Chong Yidong <cyd@stupidchicken.com>
parents: 100951
diff changeset
415 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
416 selected frame's terminal). */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109126
diff changeset
417 (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
418 {
84697
efbb243fc83d (get_terminal): Don't accept integers to represent terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84694
diff changeset
419 struct terminal *t
efbb243fc83d (get_terminal): Don't accept integers to represent terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84694
diff changeset
420 = 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
421
84697
efbb243fc83d (get_terminal): Don't accept integers to represent terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84694
diff changeset
422 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
423 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
424
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
425
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
426
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
427 /* 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
428 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
429
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
430 Lisp_Object
109126
aec1143e8d85 Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109100
diff changeset
431 store_terminal_param (struct terminal *t, Lisp_Object parameter, Lisp_Object value)
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
432 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
433 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
434 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
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 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
437 return Qnil;
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
438 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
439 else
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
440 {
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
441 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
442 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
443 return result;
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
444 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
445 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
446
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
447
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
448 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
449 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
450 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
451 is a symbol.
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
452
102845
9564179cff01 * terminal.c (Fterminal_name, Fdelete_terminal, Fterminal_name)
Chong Yidong <cyd@stupidchicken.com>
parents: 100951
diff changeset
453 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
454 selected frame's terminal). */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109126
diff changeset
455 (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
456 {
84697
efbb243fc83d (get_terminal): Don't accept integers to represent terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84694
diff changeset
457 struct terminal *t
efbb243fc83d (get_terminal): Don't accept integers to represent terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84694
diff changeset
458 = 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
459 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
460 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
461
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
462 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
463 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
464 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
465 selected frame's terminal). */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109126
diff changeset
466 (Lisp_Object terminal, Lisp_Object parameter)
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
467 {
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
468 Lisp_Object value;
84697
efbb243fc83d (get_terminal): Don't accept integers to represent terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84694
diff changeset
469 struct terminal *t
efbb243fc83d (get_terminal): Don't accept integers to represent terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84694
diff changeset
470 = 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
471 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
472 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
473 return value;
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
474 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
475
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
476 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
477 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
478 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
479 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
480
102845
9564179cff01 * terminal.c (Fterminal_name, Fdelete_terminal, Fterminal_name)
Chong Yidong <cyd@stupidchicken.com>
parents: 100951
diff changeset
481 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
482 selected frame's terminal). */)
109179
8cfee7d2955f Convert DEFUNs to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109126
diff changeset
483 (Lisp_Object terminal, Lisp_Object parameter, Lisp_Object value)
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
484 {
84697
efbb243fc83d (get_terminal): Don't accept integers to represent terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84694
diff changeset
485 struct terminal *t
efbb243fc83d (get_terminal): Don't accept integers to represent terminals.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 84694
diff changeset
486 = 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
487 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
488 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
489
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
490
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
491
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
492 /* 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
493 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
494
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
495 struct terminal *
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
496 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
497 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
498 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
499 abort ();
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
500
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
501 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
502 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
503 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
504 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
505 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
506 /* 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
507
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
508 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
509 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
510
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
511 /* 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
512 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
513
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
514 static void
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
515 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
516 {
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
517 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
518 abort ();
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
519
83431
76396de7f50a Rename `struct device' to `struct terminal'. Rename some terminal-related functions similarly.
Karoly Lorentey <lorentey@elte.hu>
parents: 83420
diff changeset
520 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
521 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
522 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
523
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
524 void
109126
aec1143e8d85 Convert (most) functions in src to standard C.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 109100
diff changeset
525 syms_of_terminal (void)
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
526 {
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
527
112364
42e22c4f06b7 Move all DEFVAR'd globals into a structure -- threading infrastructure
Tom Tromey <tromey@redhat.com>
parents: 112278
diff changeset
528 DEFVAR_LISP ("ring-bell-function", Vring_bell_function,
83420
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
529 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
530 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
531 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
532
112364
42e22c4f06b7 Move all DEFVAR'd globals into a structure -- threading infrastructure
Tom Tromey <tromey@redhat.com>
parents: 112278
diff changeset
533 DEFVAR_LISP ("delete-terminal-functions", Vdelete_terminal_functions,
93369
ed10c3092847 * keyboard.c (pending_funcalls): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 91749
diff changeset
534 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
535 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
536 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
537 or some time later. */);
ed10c3092847 * keyboard.c (pending_funcalls): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 91749
diff changeset
538 Vdelete_terminal_functions = Qnil;
105877
21bdda3ded62 * xterm.c (syms_of_xterm):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 105669
diff changeset
539 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
540 staticpro (&Qdelete_terminal_functions);
105877
21bdda3ded62 * xterm.c (syms_of_xterm):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 105669
diff changeset
541 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
542 staticpro (&Qrun_hook_with_args);
ed10c3092847 * keyboard.c (pending_funcalls): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 91749
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 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
545 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
546 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
547 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
548 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
549 defsubr (&Sterminal_parameters);
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
550 defsubr (&Sterminal_parameter);
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
551 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
552
105877
21bdda3ded62 * xterm.c (syms_of_xterm):
Dan Nicolaescu <dann@ics.uci.edu>
parents: 105669
diff changeset
553 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
554 }
521d3f18b3d1 Reimplement terminal parameters in C; clean up term.c, create terminal.c.
Karoly Lorentey <lorentey@elte.hu>
parents:
diff changeset
555