annotate src/event-tty.c @ 412:697ef44129c6 r21-2-14

Import from CVS: tag r21-2-14
author cvs
date Mon, 13 Aug 2007 11:20:41 +0200
parents 2f8bb876ab1d
children 11054d720c21
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 /* The event_stream interface for tty's.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 Copyright (C) 1994, 1995 Board of Trustees, University of Illinois.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 Copyright (C) 1995 Sun Microsystems, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4 Copyright (C) 1995 Ben Wing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 under the terms of the GNU General Public License as published by the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 Free Software Foundation; either version 2, or (at your option) any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11 later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 XEmacs is distributed in the hope that it will be useful, but WITHOUT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 along with XEmacs; see the file COPYING. If not, write to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 Boston, MA 02111-1307, USA. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 /* Synched up with: Not in FSF. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 #include <config.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 #include "lisp.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28 #include "device.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 #include "console-tty.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 #include "events.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 #include "frame.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 #include "process.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 #include "sysproc.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 #include "syswait.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 #include "systime.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 /* Mask of bits indicating the descriptors that we wait for input on */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 extern SELECT_TYPE input_wait_mask, non_fake_input_wait_mask;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 extern SELECT_TYPE process_only_mask, tty_only_mask;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 static struct event_stream *tty_event_stream;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 /************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 /* timeout events */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 /************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 /* The pending timers are stored in an ordered list, where the first timer
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 on the list is the first one to fire. Times recorded here are
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 absolute. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52 static struct low_level_timeout *tty_timer_queue;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 emacs_tty_add_timeout (EMACS_TIME thyme)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 return add_low_level_timeout (&tty_timer_queue, thyme);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 emacs_tty_remove_timeout (int id)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 remove_low_level_timeout (&tty_timer_queue, id);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 static void
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 404
diff changeset
67 tty_timeout_to_emacs_event (struct Lisp_Event *emacs_event)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 emacs_event->event_type = timeout_event;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 /* timeout events have nil as channel */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 emacs_event->timestamp = 0; /* #### */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 emacs_event->event.timeout.interval_id =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 pop_low_level_timeout (&tty_timer_queue, 0);
382
064ab7fed2e0 Import from CVS: tag r21-2-6
cvs
parents: 272
diff changeset
74 emacs_event->event.timeout.function = Qnil;
064ab7fed2e0 Import from CVS: tag r21-2-6
cvs
parents: 272
diff changeset
75 emacs_event->event.timeout.object = Qnil;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 emacs_tty_event_pending_p (int user_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 if (!user_p)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 EMACS_TIME sometime;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 /* see if there's a pending timeout. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 EMACS_GET_TIME (sometime);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 if (tty_timer_queue &&
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 EMACS_TIME_EQUAL_OR_GREATER (sometime, tty_timer_queue->time))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 return 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 return poll_fds_for_input (user_p ? tty_only_mask :
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 non_fake_input_wait_mask);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96
392
1f50e6fe4f3f Import from CVS: tag r21-2-11
cvs
parents: 382
diff changeset
97 struct console *
1f50e6fe4f3f Import from CVS: tag r21-2-11
cvs
parents: 382
diff changeset
98 tty_find_console_from_fd (int fd)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 Lisp_Object concons;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 CONSOLE_LOOP (concons)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 struct console *c;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 c = XCONSOLE (XCAR (concons));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 if (CONSOLE_TTY_P (c) && CONSOLE_TTY_DATA (c)->infd == fd)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 return c;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 return 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 static void
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 404
diff changeset
115 emacs_tty_next_event (struct Lisp_Event *emacs_event)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 while (1)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 int ndesc;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 int i;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 SELECT_TYPE temp_mask = input_wait_mask;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 EMACS_TIME time_to_block;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 EMACS_SELECT_TIME select_time_to_block, *pointer_to_this;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 if (!get_low_level_timeout_interval (tty_timer_queue, &time_to_block))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 /* no timer events; block indefinitely */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 pointer_to_this = 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 EMACS_TIME_TO_SELECT_TIME (time_to_block, select_time_to_block);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 pointer_to_this = &select_time_to_block;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 ndesc = select (MAXDESC, &temp_mask, 0, 0, pointer_to_this);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 if (ndesc > 0)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 /* Look for a TTY event */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 for (i = 0; i < MAXDESC; i++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 /* To avoid race conditions (among other things, an infinite
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 loop when called from Fdiscard_input()), we must return
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 user events ahead of process events. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 if (FD_ISSET (i, &temp_mask) && FD_ISSET (i, &tty_only_mask))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 {
392
1f50e6fe4f3f Import from CVS: tag r21-2-11
cvs
parents: 382
diff changeset
145 struct console *c = tty_find_console_from_fd (i);
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 0
diff changeset
146
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 assert (c);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 if (read_event_from_tty_or_stream_desc (emacs_event, c, i))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 /* Look for a process event */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 for (i = 0; i < MAXDESC; i++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 if (FD_ISSET (i, &temp_mask) && FD_ISSET (i, &process_only_mask))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 Lisp_Object process;
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 404
diff changeset
159 struct Lisp_Process *p =
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 404
diff changeset
160 get_process_from_usid (FD_TO_USID(i));
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 0
diff changeset
161
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 assert (p);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 XSETPROCESS (process, p);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 emacs_event->event_type = process_event;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 /* process events have nil as channel */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 emacs_event->timestamp = 0; /* #### */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 emacs_event->event.process.process = process;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 /* We might get here when a fake event came through a signal. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 /* Return a dummy event, so that a cycle of the command loop will
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 occur. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 drain_signal_event_pipe ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 emacs_event->event_type = eval_event;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 /* eval events have nil as channel */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 emacs_event->event.eval.function = Qidentity;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 emacs_event->event.eval.object = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 else if (ndesc == 0) /* timeout fired */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 tty_timeout_to_emacs_event (emacs_event);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 return;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 static void
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 404
diff changeset
191 emacs_tty_handle_magic_event (struct Lisp_Event *emacs_event)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 /* Nothing to do currently */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 static void
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 404
diff changeset
198 emacs_tty_select_process (struct Lisp_Process *process)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 event_stream_unixoid_select_process (process);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 static void
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 404
diff changeset
204 emacs_tty_unselect_process (struct Lisp_Process *process)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 event_stream_unixoid_unselect_process (process);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 emacs_tty_select_console (struct console *con)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 event_stream_unixoid_select_console (con);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 emacs_tty_unselect_console (struct console *con)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 event_stream_unixoid_unselect_console (con);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 emacs_tty_quit_p (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 /* Nothing to do currently because QUIT is handled through SIGINT.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 This could change. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227
263
727739f917cb Import from CVS: tag r20-5b30
cvs
parents: 185
diff changeset
228 static USID
727739f917cb Import from CVS: tag r20-5b30
cvs
parents: 185
diff changeset
229 emacs_tty_create_stream_pair (void* inhandle, void* outhandle,
727739f917cb Import from CVS: tag r20-5b30
cvs
parents: 185
diff changeset
230 Lisp_Object* instream, Lisp_Object* outstream, int flags)
727739f917cb Import from CVS: tag r20-5b30
cvs
parents: 185
diff changeset
231 {
727739f917cb Import from CVS: tag r20-5b30
cvs
parents: 185
diff changeset
232 return event_stream_unixoid_create_stream_pair
727739f917cb Import from CVS: tag r20-5b30
cvs
parents: 185
diff changeset
233 (inhandle, outhandle, instream, outstream, flags);
727739f917cb Import from CVS: tag r20-5b30
cvs
parents: 185
diff changeset
234 }
727739f917cb Import from CVS: tag r20-5b30
cvs
parents: 185
diff changeset
235
727739f917cb Import from CVS: tag r20-5b30
cvs
parents: 185
diff changeset
236 static USID
727739f917cb Import from CVS: tag r20-5b30
cvs
parents: 185
diff changeset
237 emacs_tty_delete_stream_pair (Lisp_Object instream, Lisp_Object outstream)
727739f917cb Import from CVS: tag r20-5b30
cvs
parents: 185
diff changeset
238 {
727739f917cb Import from CVS: tag r20-5b30
cvs
parents: 185
diff changeset
239 return event_stream_unixoid_delete_stream_pair (instream, outstream);
727739f917cb Import from CVS: tag r20-5b30
cvs
parents: 185
diff changeset
240 }
727739f917cb Import from CVS: tag r20-5b30
cvs
parents: 185
diff changeset
241
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 /************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 /* initialization */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 /************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 void
412
697ef44129c6 Import from CVS: tag r21-2-14
cvs
parents: 404
diff changeset
248 vars_of_event_tty (void)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 {
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 0
diff changeset
250 tty_event_stream = xnew (struct event_stream);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 tty_event_stream->event_pending_p = emacs_tty_event_pending_p;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 tty_event_stream->next_event_cb = emacs_tty_next_event;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 tty_event_stream->handle_magic_event_cb = emacs_tty_handle_magic_event;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 tty_event_stream->add_timeout_cb = emacs_tty_add_timeout;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 tty_event_stream->remove_timeout_cb = emacs_tty_remove_timeout;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 tty_event_stream->select_console_cb = emacs_tty_select_console;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 tty_event_stream->unselect_console_cb = emacs_tty_unselect_console;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 tty_event_stream->select_process_cb = emacs_tty_select_process;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 tty_event_stream->unselect_process_cb = emacs_tty_unselect_process;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 tty_event_stream->quit_p_cb = emacs_tty_quit_p;
263
727739f917cb Import from CVS: tag r20-5b30
cvs
parents: 185
diff changeset
262 tty_event_stream->create_stream_pair_cb = emacs_tty_create_stream_pair;
727739f917cb Import from CVS: tag r20-5b30
cvs
parents: 185
diff changeset
263 tty_event_stream->delete_stream_pair_cb = emacs_tty_delete_stream_pair;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 init_event_tty_late (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 event_stream = tty_event_stream;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 }