annotate src/console-stream.c @ 388:aabb7f5b1c81 r21-2-9

Import from CVS: tag r21-2-9
author cvs
date Mon, 13 Aug 2007 11:09:42 +0200
parents bbff43aa5eb7
children 6719134a07c2
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"
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 267
diff changeset
37 #include "sysfile.h"
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 #include "window.h"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 DEFINE_CONSOLE_TYPE (stream);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 Lisp_Object Vterminal_console;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43 Lisp_Object Vterminal_device;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 Lisp_Object Vterminal_frame;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
46 Lisp_Object Vstdio_str;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 allocate_stream_console_struct (struct console *con)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 {
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 267
diff changeset
51 if (!CONSOLE_STREAM_DATA (con))
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 267
diff changeset
52 CONSOLE_STREAM_DATA (con) = xnew_and_zero (struct stream_console);
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents: 251
diff changeset
53 else
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 267
diff changeset
54 xzero (*CONSOLE_STREAM_DATA (con));
0
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
195
a2f645c6b9f8 Import from CVS: tag r20-3b24
cvs
parents: 185
diff changeset
65 if (NILP (tty) || internal_equal (tty, Vstdio_str, 0))
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 {
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 267
diff changeset
67 infd = stdin;
0
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 =
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 12
diff changeset
75 fopen ((char *) XSTRING_DATA (tty), "r+");
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 if (!infd)
16
0293115a14e9 Import from CVS: tag r19-15b91
cvs
parents: 12
diff changeset
77 error ("Unable to open tty %s", XSTRING_DATA (tty));
0
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);
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 267
diff changeset
81 CONSOLE_STREAM_DATA (con)->infd = infd;
0
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
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 267
diff changeset
91 DEVICE_INFD (d) = fileno (CONSOLE_STREAM_DATA (con)->infd);
0
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 {
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 267
diff changeset
106 if (CONSOLE_STREAM_DATA (con))
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents: 251
diff changeset
107 {
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 267
diff changeset
108 xfree (CONSOLE_STREAM_DATA (con));
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 267
diff changeset
109 CONSOLE_STREAM_DATA (con) = NULL;
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents: 251
diff changeset
110 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 extern int stdout_needs_newline;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 stream_delete_console (struct console *con)
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)->needs_newline */
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 110
diff changeset
119 stdout_needs_newline) /* #### clean this up */
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 fputc ('\n', CONSOLE_STREAM_DATA (con)->outfd);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 fflush (CONSOLE_STREAM_DATA (con)->outfd);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124 if (CONSOLE_STREAM_DATA (con)->infd != stdin)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 fclose (CONSOLE_STREAM_DATA (con)->infd);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 free_stream_console_struct (con);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
129 Lisp_Object
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 stream_semi_canonicalize_console_connection (Lisp_Object connection,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 Error_behavior errb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 {
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 267
diff changeset
133 return NILP (connection) ? Vstdio_str : connection;
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
136 Lisp_Object
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 stream_canonicalize_console_connection (Lisp_Object connection,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 Error_behavior errb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 {
195
a2f645c6b9f8 Import from CVS: tag r20-3b24
cvs
parents: 185
diff changeset
140 if (NILP (connection) || internal_equal (connection, Vstdio_str, 0))
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
141 return Vstdio_str;
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
142
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
143 if (!ERRB_EQ (errb, ERROR_ME))
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 if (!STRINGP (connection))
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
146 return Qunbound;
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 else
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
149 CHECK_STRING (connection);
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
150
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
151 return Ffile_truename (connection, Qnil);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
154 Lisp_Object
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 stream_semi_canonicalize_device_connection (Lisp_Object connection,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 Error_behavior errb)
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 return stream_semi_canonicalize_console_connection (connection, errb);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
161 Lisp_Object
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 stream_canonicalize_device_connection (Lisp_Object connection,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 Error_behavior errb)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 {
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
165 return stream_canonicalize_console_connection (connection, errb);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 }
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 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 stream_init_frame_1 (struct frame *f, Lisp_Object props)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 {
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 267
diff changeset
172 #if 0
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 struct device *d = XDEVICE (FRAME_DEVICE (f));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 if (!NILP (DEVICE_FRAME_LIST (d)))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 error ("Only one frame allowed on stream devices");
267
966663fcf606 Import from CVS: tag r20-5b32
cvs
parents: 251
diff changeset
176 #endif
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 f->name = build_string ("stream");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 f->height = 80;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 f->width = 24;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 f->visible = 0; /* so redisplay doesn't try to do anything */
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
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 static int
251
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 207
diff changeset
185 stream_text_width (struct frame *f, struct face_cachel *cachel,
677f6a0ee643 Import from CVS: tag r20-5b24
cvs
parents: 207
diff changeset
186 CONST Emchar *str, Charcount len)
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 return len;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 stream_left_margin_width (struct window *w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 return 0;
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 int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 stream_right_margin_width (struct window *w)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 return 0;
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 int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 stream_divider_height (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 return 1;
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 int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 stream_eol_cursor_width (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 return 1;
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 stream_output_begin (struct device *d)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 stream_output_end (struct device *d)
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_display_block (struct window *w, struct display_line *dl,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 int block, int start, int end,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 int start_pixpos, int cursor_start,
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 int cursor_width, int cursor_height)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 stream_output_vertical_divider (struct window *w, int clear)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 stream_clear_to_window_end (struct window *w, int ypos1, int ypos2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 static void
384
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 284
diff changeset
244 stream_clear_region (Lisp_Object window, struct device* d, struct frame * f,
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 284
diff changeset
245 face_index findex, int x, int y,
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 284
diff changeset
246 int width, int height, Lisp_Object fcolor, Lisp_Object bcolor,
bbff43aa5eb7 Import from CVS: tag r21-2-7
cvs
parents: 284
diff changeset
247 Lisp_Object background_pixmap)
0
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_height);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
302 CONSOLE_HAS_METHOD (stream, eol_cursor_width);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
303 CONSOLE_HAS_METHOD (stream, clear_to_window_end);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
304 CONSOLE_HAS_METHOD (stream, clear_region);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
305 CONSOLE_HAS_METHOD (stream, clear_frame);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
306 CONSOLE_HAS_METHOD (stream, output_begin);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
307 CONSOLE_HAS_METHOD (stream, output_end);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
308 CONSOLE_HAS_METHOD (stream, flash);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
309 CONSOLE_HAS_METHOD (stream, ring_bell);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
310 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
311
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
312 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
313 vars_of_console_stream (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
314 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
315 DEFVAR_LISP ("terminal-console", &Vterminal_console /*
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 78
diff changeset
316 The initial console-object, which represents XEmacs' stdout.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
317 */ );
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
318 Vterminal_console = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
319
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
320 DEFVAR_LISP ("terminal-device", &Vterminal_device /*
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 78
diff changeset
321 The initial device-object, which represents XEmacs' stdout.
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
322 */ );
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
323 Vterminal_device = Qnil;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
324
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
325 DEFVAR_LISP ("terminal-frame", &Vterminal_frame /*
110
fe104dbd9147 Import from CVS: tag r20-1b7
cvs
parents: 78
diff changeset
326 The initial frame-object, which represents XEmacs' stdout.
0
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_frame = Qnil;
78
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
329
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
330 /* Moved from console-tty.c */
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
331 Vstdio_str = build_string ("stdio");
c7528f8e288d Import from CVS: tag r20-0b34
cvs
parents: 70
diff changeset
332 staticpro (&Vstdio_str);
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
333 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
334
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
335 void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
336 init_console_stream (void)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
337 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
338 /* This function can GC */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
339 if (!initialized)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
340 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
341 Vterminal_device = Fmake_device (Qstream, Qnil, Qnil);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
342 Vterminal_console = Fdevice_console (Vterminal_device);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
343 Vterminal_frame = Fmake_frame (Qnil, Vterminal_device);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
344 minibuf_window = XFRAME (Vterminal_frame)->minibuffer_window;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
345 }
272
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 267
diff changeset
346 else
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 267
diff changeset
347 {
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 267
diff changeset
348 /* Re-initialize the FILE fields of the console. */
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 267
diff changeset
349 stream_init_console (XCONSOLE (Vterminal_console), Qnil);
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 267
diff changeset
350 if (noninteractive)
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 267
diff changeset
351 event_stream_select_console (XCONSOLE (Vterminal_console));
c5d627a313b1 Import from CVS: tag r21-0b34
cvs
parents: 267
diff changeset
352 }
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
353 }