annotate src/console-stream.c @ 251:677f6a0ee643 r20-5b24

Import from CVS: tag r20-5b24
author cvs
date Mon, 13 Aug 2007 10:19:59 +0200
parents e45d5e7c476e
children 966663fcf606
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
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
45 Lisp_Object Vstdio_str;
0
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 {
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 110
diff changeset
50 con->console_data = xnew_and_zero (struct stream_console);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54 stream_init_console (struct console *con, Lisp_Object params)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 Lisp_Object tty = CONSOLE_CONNECTION (con);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 FILE *infd, *outfd, *errfd;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 /* Open the specified console */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60
195
a2f645c6b9f8 Import from CVS: tag r20-3b24
cvs
parents: 185
diff changeset
61 if (NILP (tty) || internal_equal (tty, Vstdio_str, 0))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 infd = stdin;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 outfd = stdout;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 errfd = stderr;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 CHECK_STRING (tty);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 infd = outfd = errfd =
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 12
diff changeset
71 fopen ((char *) XSTRING_DATA (tty), "r+");
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 if (!infd)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 12
diff changeset
73 error ("Unable to open tty %s", XSTRING_DATA (tty));
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 allocate_stream_console_struct (con);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 CONSOLE_STREAM_DATA (con)->infd = infd;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 CONSOLE_STREAM_DATA (con)->outfd = outfd;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 CONSOLE_STREAM_DATA (con)->errfd = errfd;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 stream_init_device (struct device *d, Lisp_Object params)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 struct console *con = XCONSOLE (DEVICE_CONSOLE (d));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 DEVICE_INFD (d) = fileno (CONSOLE_STREAM_DATA (con)->infd);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 DEVICE_OUTFD (d) = fileno (CONSOLE_STREAM_DATA (con)->outfd);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 init_baud_rate (d);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 init_one_device (d);
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 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 stream_initially_selected_for_input (struct console *con)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 return noninteractive && initialized;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 free_stream_console_struct (struct console *con)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 struct stream_console *tcon = (struct stream_console *) con->console_data;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 if (tcon)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 xfree (tcon);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 extern int stdout_needs_newline;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 stream_delete_console (struct console *con)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 if (/* CONSOLE_STREAM_DATA (con)->needs_newline */
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 110
diff changeset
113 stdout_needs_newline) /* #### clean this up */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 fputc ('\n', CONSOLE_STREAM_DATA (con)->outfd);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 fflush (CONSOLE_STREAM_DATA (con)->outfd);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 if (CONSOLE_STREAM_DATA (con)->infd != stdin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 fclose (CONSOLE_STREAM_DATA (con)->infd);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 free_stream_console_struct (con);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
123 Lisp_Object
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 stream_semi_canonicalize_console_connection (Lisp_Object connection,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 Error_behavior errb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 {
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
127 if (NILP (connection))
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
128 return Vstdio_str;
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
129
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
130 return connection;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
133 Lisp_Object
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 stream_canonicalize_console_connection (Lisp_Object connection,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 Error_behavior errb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 {
195
a2f645c6b9f8 Import from CVS: tag r20-3b24
cvs
parents: 185
diff changeset
137 if (NILP (connection) || internal_equal (connection, Vstdio_str, 0))
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
138 return Vstdio_str;
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
139
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
140 if (!ERRB_EQ (errb, ERROR_ME))
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
141 {
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
142 if (!STRINGP (connection))
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
143 return Qunbound;
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
144 }
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
145 else
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
146 CHECK_STRING (connection);
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
147
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
148 return Ffile_truename (connection, Qnil);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
151 Lisp_Object
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 stream_semi_canonicalize_device_connection (Lisp_Object connection,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 Error_behavior errb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 {
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
155 return stream_semi_canonicalize_console_connection (connection, errb);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
158 Lisp_Object
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 stream_canonicalize_device_connection (Lisp_Object connection,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 Error_behavior errb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 {
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
162 return stream_canonicalize_console_connection (connection, errb);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 stream_init_frame_1 (struct frame *f, Lisp_Object props)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 struct device *d = XDEVICE (FRAME_DEVICE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 if (!NILP (DEVICE_FRAME_LIST (d)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 error ("Only one frame allowed on stream devices");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 f->name = build_string ("stream");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 f->height = 80;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 f->width = 24;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 f->visible = 0; /* so redisplay doesn't try to do anything */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 static int
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 207
diff changeset
181 stream_text_width (struct frame *f, struct face_cachel *cachel,
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 207
diff changeset
182 CONST Emchar *str, Charcount len)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 return len;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 stream_left_margin_width (struct window *w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 return 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 stream_right_margin_width (struct window *w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 return 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 stream_divider_width (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 return 1;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 stream_divider_height (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 return 1;
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 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 stream_eol_cursor_width (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 return 1;
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_begin (struct device *d)
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
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 stream_output_end (struct device *d)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 stream_output_display_block (struct window *w, struct display_line *dl,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 int block, int start, int end,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 int start_pixpos, int cursor_start,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 int cursor_width, int cursor_height)
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_output_vertical_divider (struct window *w, int clear)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 {
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 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 stream_clear_to_window_end (struct window *w, int ypos1, int ypos2)
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
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 stream_clear_region (Lisp_Object locale, face_index findex, int x, int y,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 int width, int height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 stream_clear_frame (struct frame *f)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 stream_flash (struct device *d)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 return 0; /* sorry can't do it */
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 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 stream_ring_bell (struct device *d, int volume, int pitch, int duration)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 struct console *c = XCONSOLE (DEVICE_CONSOLE (d));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 fputc (07, CONSOLE_STREAM_DATA (c)->outfd);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 fflush (CONSOLE_STREAM_DATA (c)->outfd);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271 /************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 /* initialization */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 /************************************************************************/
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
274
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
275 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
276 console_type_create_stream (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
277 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
278 INITIALIZE_CONSOLE_TYPE (stream, "stream", "console-stream-p");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
279
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
280 /* console methods */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
281 CONSOLE_HAS_METHOD (stream, init_console);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
282 CONSOLE_HAS_METHOD (stream, initially_selected_for_input);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
283 CONSOLE_HAS_METHOD (stream, delete_console);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
284 CONSOLE_HAS_METHOD (stream, canonicalize_console_connection);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
285 CONSOLE_HAS_METHOD (stream, canonicalize_device_connection);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
286 CONSOLE_HAS_METHOD (stream, semi_canonicalize_console_connection);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
287 CONSOLE_HAS_METHOD (stream, semi_canonicalize_device_connection);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
288
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
289 /* device methods */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
290 CONSOLE_HAS_METHOD (stream, init_device);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
291
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
292 /* frame methods */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
293 CONSOLE_HAS_METHOD (stream, init_frame_1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
294
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
295 /* redisplay methods */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
296 CONSOLE_HAS_METHOD (stream, left_margin_width);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
297 CONSOLE_HAS_METHOD (stream, right_margin_width);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
298 CONSOLE_HAS_METHOD (stream, text_width);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
299 CONSOLE_HAS_METHOD (stream, output_display_block);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
300 CONSOLE_HAS_METHOD (stream, output_vertical_divider);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
301 CONSOLE_HAS_METHOD (stream, divider_width);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 CONSOLE_HAS_METHOD (stream, divider_height);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 CONSOLE_HAS_METHOD (stream, eol_cursor_width);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 CONSOLE_HAS_METHOD (stream, clear_to_window_end);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 CONSOLE_HAS_METHOD (stream, clear_region);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 CONSOLE_HAS_METHOD (stream, clear_frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 CONSOLE_HAS_METHOD (stream, output_begin);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 CONSOLE_HAS_METHOD (stream, output_end);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 CONSOLE_HAS_METHOD (stream, flash);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 CONSOLE_HAS_METHOD (stream, ring_bell);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 vars_of_console_stream (void)
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-console", &Vterminal_console /*
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 78
diff changeset
317 The initial console-object, which represents XEmacs' stdout.
0
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_console = 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 DEFVAR_LISP ("terminal-device", &Vterminal_device /*
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 78
diff changeset
322 The initial device-object, which represents XEmacs' stdout.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 */ );
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324 Vterminal_device = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
326 DEFVAR_LISP ("terminal-frame", &Vterminal_frame /*
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 78
diff changeset
327 The initial frame-object, which represents XEmacs' stdout.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
328 */ );
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
329 Vterminal_frame = Qnil;
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
330
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
331 /* Moved from console-tty.c */
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
332 Vstdio_str = build_string ("stdio");
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
333 staticpro (&Vstdio_str);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 init_console_stream (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 /* This function can GC */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 if (!initialized)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 Vterminal_device = Fmake_device (Qstream, Qnil, Qnil);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 Vterminal_console = Fdevice_console (Vterminal_device);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 Vterminal_frame = Fmake_frame (Qnil, Vterminal_device);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 minibuf_window = XFRAME (Vterminal_frame)->minibuffer_window;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
346 }
207
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 195
diff changeset
347 else {
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 195
diff changeset
348 /* Re-initialize the FILE fields of the console. */
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 195
diff changeset
349 stream_init_console (XCONSOLE (Vterminal_console), Qnil);
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 195
diff changeset
350 if (noninteractive)
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 195
diff changeset
351 event_stream_select_console (XCONSOLE (Vterminal_console));
e45d5e7c476e Import from CVS: tag r20-4b2
cvs
parents: 195
diff changeset
352 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 }