annotate src/console-stream.c @ 0:376386a54a3c r19-14

Import from CVS: tag r19-14
author cvs
date Mon, 13 Aug 2007 08:45:50 +0200
parents
children bcdc7deadc19
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 /* Stream device functions.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 Copyright (C) 1995 Free Software Foundation, Inc.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 Copyright (C) 1996 Ben Wing.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 This file is part of XEmacs.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7 XEmacs is free software; you can redistribute it and/or modify it
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9 Free Software Foundation; either version 2, or (at your option) any
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 later version.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 for more details.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 along with XEmacs; see the file COPYING. If not, write to
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 Boston, MA 02111-1307, USA. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 /* Synched up with: Not in FSF. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 /* This file has been Mule-ized. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 /* Written by Ben Wing. */
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 <config.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 #include "lisp.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31 #include "console-stream.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 #include "console-tty.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33 #include "events.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 #include "frame.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35 #include "redisplay.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 #include "sysdep.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 #include "window.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 DEFINE_CONSOLE_TYPE (stream);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41 Lisp_Object Vterminal_console;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 Lisp_Object Vterminal_device;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 Lisp_Object Vterminal_frame;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 extern Lisp_Object Vstdio_str; /* in console-tty.c */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 allocate_stream_console_struct (struct console *con)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 con->console_data =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 (struct stream_console *) xmalloc (sizeof (struct stream_console));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 /* zero out all slots. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 memset (con->console_data, 0, sizeof (struct stream_console));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 stream_init_console (struct console *con, Lisp_Object params)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 Lisp_Object tty = CONSOLE_CONNECTION (con);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 FILE *infd, *outfd, *errfd;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 /* Open the specified console */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 if (NILP (tty) || !NILP (Fequal (tty, Vstdio_str)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 infd = stdin;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 outfd = stdout;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 errfd = stderr;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73 CHECK_STRING (tty);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 infd = outfd = errfd =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75 fopen ((char *) string_data (XSTRING (tty)), "r+");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 if (!infd)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 error ("Unable to open tty %s", string_data (XSTRING (tty)));
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 allocate_stream_console_struct (con);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 CONSOLE_STREAM_DATA (con)->infd = infd;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 CONSOLE_STREAM_DATA (con)->outfd = outfd;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 CONSOLE_STREAM_DATA (con)->errfd = errfd;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 stream_init_device (struct device *d, Lisp_Object params)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 struct console *con = XCONSOLE (DEVICE_CONSOLE (d));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 DEVICE_INFD (d) = fileno (CONSOLE_STREAM_DATA (con)->infd);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 DEVICE_OUTFD (d) = fileno (CONSOLE_STREAM_DATA (con)->outfd);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 init_baud_rate (d);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 init_one_device (d);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 stream_initially_selected_for_input (struct console *con)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 return noninteractive && initialized;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 free_stream_console_struct (struct console *con)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 struct stream_console *tcon = (struct stream_console *) con->console_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 if (tcon)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 xfree (tcon);
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 extern int stdout_needs_newline;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 stream_delete_console (struct console *con)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 if (/* CONSOLE_STREAM_DATA (con)->needs_newline */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 stdout_needs_newline) /* #### clean this up */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 fputc ('\n', CONSOLE_STREAM_DATA (con)->outfd);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 fflush (CONSOLE_STREAM_DATA (con)->outfd);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 if (CONSOLE_STREAM_DATA (con)->infd != stdin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 fclose (CONSOLE_STREAM_DATA (con)->infd);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 free_stream_console_struct (con);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 static Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 stream_semi_canonicalize_console_connection (Lisp_Object connection,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 Error_behavior errb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 return tty_semi_canonicalize_console_connection (connection, errb);
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 static Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 stream_canonicalize_console_connection (Lisp_Object connection,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 Error_behavior errb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 return tty_canonicalize_console_connection (connection, errb);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 static Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 stream_semi_canonicalize_device_connection (Lisp_Object connection,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 Error_behavior errb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 return tty_semi_canonicalize_device_connection (connection, errb);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 static Lisp_Object
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 stream_canonicalize_device_connection (Lisp_Object connection,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 Error_behavior errb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 return tty_canonicalize_device_connection (connection, errb);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 stream_init_frame_1 (struct frame *f, Lisp_Object props)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 struct device *d = XDEVICE (FRAME_DEVICE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 if (!NILP (DEVICE_FRAME_LIST (d)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 error ("Only one frame allowed on stream devices");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 f->name = build_string ("stream");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 f->height = 80;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 f->width = 24;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 f->visible = 0; /* so redisplay doesn't try to do anything */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 stream_text_width (struct face_cachel *cachel, CONST Emchar *str,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 Charcount len)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 return len;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 stream_left_margin_width (struct window *w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 return 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 stream_right_margin_width (struct window *w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 return 0;
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 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 stream_divider_width (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 return 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 stream_divider_height (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 return 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 stream_eol_cursor_width (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 return 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 stream_output_begin (struct device *d)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 stream_output_end (struct device *d)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 stream_output_display_block (struct window *w, struct display_line *dl,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 int block, int start, int end,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 int start_pixpos, int cursor_start,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 int cursor_width, int cursor_height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 stream_output_vertical_divider (struct window *w, int clear)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 stream_clear_to_window_end (struct window *w, int ypos1, int ypos2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 stream_clear_region (Lisp_Object locale, face_index findex, int x, int y,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 int width, int height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 stream_clear_frame (struct frame *f)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 stream_flash (struct device *d)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 return 0; /* sorry can't do it */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 stream_ring_bell (struct device *d, int volume, int pitch, int duration)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 struct console *c = XCONSOLE (DEVICE_CONSOLE (d));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 fputc (07, CONSOLE_STREAM_DATA (c)->outfd);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 fflush (CONSOLE_STREAM_DATA (c)->outfd);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 /************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 /* initialization */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 /************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 console_type_create_stream (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 INITIALIZE_CONSOLE_TYPE (stream, "stream", "console-stream-p");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 /* console methods */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 CONSOLE_HAS_METHOD (stream, init_console);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 CONSOLE_HAS_METHOD (stream, initially_selected_for_input);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 CONSOLE_HAS_METHOD (stream, delete_console);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274 CONSOLE_HAS_METHOD (stream, canonicalize_console_connection);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 CONSOLE_HAS_METHOD (stream, canonicalize_device_connection);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 CONSOLE_HAS_METHOD (stream, semi_canonicalize_console_connection);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 CONSOLE_HAS_METHOD (stream, semi_canonicalize_device_connection);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279 /* device methods */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 CONSOLE_HAS_METHOD (stream, init_device);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 /* frame methods */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 CONSOLE_HAS_METHOD (stream, init_frame_1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 /* redisplay methods */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 CONSOLE_HAS_METHOD (stream, left_margin_width);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 CONSOLE_HAS_METHOD (stream, right_margin_width);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288 CONSOLE_HAS_METHOD (stream, text_width);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 CONSOLE_HAS_METHOD (stream, output_display_block);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 CONSOLE_HAS_METHOD (stream, output_vertical_divider);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291 CONSOLE_HAS_METHOD (stream, divider_width);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 CONSOLE_HAS_METHOD (stream, divider_height);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 CONSOLE_HAS_METHOD (stream, eol_cursor_width);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294 CONSOLE_HAS_METHOD (stream, clear_to_window_end);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 CONSOLE_HAS_METHOD (stream, clear_region);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 CONSOLE_HAS_METHOD (stream, clear_frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 CONSOLE_HAS_METHOD (stream, output_begin);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 CONSOLE_HAS_METHOD (stream, output_end);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 CONSOLE_HAS_METHOD (stream, flash);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 CONSOLE_HAS_METHOD (stream, ring_bell);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 vars_of_console_stream (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 DEFVAR_LISP ("terminal-console", &Vterminal_console /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 The initial console-object, which represent's Emacs's stdout.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 */ );
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 Vterminal_console = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 DEFVAR_LISP ("terminal-device", &Vterminal_device /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 The initial device-object, which represent's Emacs's stdout.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 */ );
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 Vterminal_device = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
316 DEFVAR_LISP ("terminal-frame", &Vterminal_frame /*
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 The initial frame-object, which represents Emacs's stdout.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 */ );
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319 Vterminal_frame = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
321
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 init_console_stream (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 /* This function can GC */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 if (!initialized)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
327 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 Vterminal_device = Fmake_device (Qstream, Qnil, Qnil);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 Vterminal_console = Fdevice_console (Vterminal_device);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
330 Vterminal_frame = Fmake_frame (Qnil, Vterminal_device);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
331 minibuf_window = XFRAME (Vterminal_frame)->minibuffer_window;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
332 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 else if (noninteractive)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 event_stream_select_console (XCONSOLE (Vterminal_console));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 }