annotate src/console-stream.c @ 4528:726060ee587c g++-warning-removal-2008-10-28

First draft of g++ 4.3 warning removal patch. Builds. *Needs ChangeLogs.*
author Stephen J. Turnbull <stephen@xemacs.org>
date Wed, 29 Oct 2008 04:06:33 +0900
parents d674024a8674
children ea701c23ed84 e0db3c197671
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 /* Stream device functions.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
2 Copyright (C) 1995 Free Software Foundation, Inc.
1279
cd0abfdb9e9d [xemacs-hg @ 2003-02-09 09:33:42 by ben]
ben
parents: 1204
diff changeset
3 Copyright (C) 1996, 2001, 2002, 2003 Ben Wing.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5 This file is part of XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
6
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
7 XEmacs is free software; you can redistribute it and/or modify it
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
8 under the terms of the GNU General Public License as published by the
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
9 Free Software Foundation; either version 2, or (at your option) any
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
10 later version.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
11
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
12 XEmacs is distributed in the hope that it will be useful, but WITHOUT
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
15 for more details.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
16
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
17 You should have received a copy of the GNU General Public License
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
18 along with XEmacs; see the file COPYING. If not, write to
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
19 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
20 Boston, MA 02111-1307, USA. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
21
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
22 /* Synched up with: Not in FSF. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
23
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
24 /* This file has been Mule-ized. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
25
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26 /* Written by Ben Wing. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
28 #include <config.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
29 #include "lisp.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
30
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
31 #include "device-impl.h"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
32 #include "events.h"
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
33 #include "frame-impl.h"
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
34 #include "redisplay.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
35 #include "sysdep.h"
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 771
diff changeset
36 #include "window.h"
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 771
diff changeset
37
872
79c6ff3eef26 [xemacs-hg @ 2002-06-20 21:18:01 by ben]
ben
parents: 867
diff changeset
38 #include "console-stream-impl.h"
800
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 771
diff changeset
39 #include "console-tty.h"
a5954632b187 [xemacs-hg @ 2002-03-31 08:27:14 by ben]
ben
parents: 771
diff changeset
40
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
41 #include "sysfile.h"
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43 DEFINE_CONSOLE_TYPE (stream);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
44
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
45 Lisp_Object Vterminal_console;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46 Lisp_Object Vterminal_device;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
47 Lisp_Object Vterminal_frame;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 Lisp_Object Vstdio_str;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 872
diff changeset
51 static const struct memory_description stream_console_data_description_1 [] = {
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 872
diff changeset
52 { XD_LISP_OBJECT, offsetof (struct stream_console, instream) },
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 872
diff changeset
53 { XD_END }
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 872
diff changeset
54 };
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 872
diff changeset
55
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2500
diff changeset
56 #ifdef NEW_GC
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2500
diff changeset
57 DEFINE_LRECORD_IMPLEMENTATION ("stream-console", stream_console,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2500
diff changeset
58 1, /*dumpable-flag*/
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2500
diff changeset
59 0, 0, 0, 0, 0,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2500
diff changeset
60 stream_console_data_description_1,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2500
diff changeset
61 Lisp_Stream_Console);
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2500
diff changeset
62 #else /* not NEW_GC */
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 872
diff changeset
63 const struct sized_memory_description stream_console_data_description = {
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 872
diff changeset
64 sizeof (struct stream_console), stream_console_data_description_1
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 872
diff changeset
65 };
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2500
diff changeset
66 #endif /* not NEW_GC */
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 872
diff changeset
67
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 static void
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
69 stream_init_console (struct console *con, Lisp_Object UNUSED (params))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
70 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71 Lisp_Object tty = CONSOLE_CONNECTION (con);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
72 struct stream_console *stream_con;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
73
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2500
diff changeset
74 #ifdef NEW_GC
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2500
diff changeset
75 if (CONSOLE_STREAM_DATA (con) == NULL)
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2500
diff changeset
76 CONSOLE_STREAM_DATA (con) = alloc_lrecord_type (struct stream_console,
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2500
diff changeset
77 &lrecord_stream_console);
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2500
diff changeset
78 #else /* not NEW_GC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
79 if (CONSOLE_STREAM_DATA (con) == NULL)
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 872
diff changeset
80 CONSOLE_STREAM_DATA (con) = xnew_and_zero (struct stream_console);
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2500
diff changeset
81 #endif /* not NEW_GC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 stream_con = CONSOLE_STREAM_DATA (con);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84
1204
e22b0213b713 [xemacs-hg @ 2003-01-12 11:07:58 by michaels]
michaels
parents: 872
diff changeset
85 stream_con->instream = Qnil;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
86
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 /* Open the specified console */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88 if (NILP (tty) || internal_equal (tty, Vstdio_str, 0))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90 stream_con->in = stdin;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 stream_con->out = stdout;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
92 stream_con->err = stderr;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 CHECK_STRING (tty);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 stream_con->in = stream_con->out = stream_con->err =
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
98 /* #### We don't currently do coding-system translation on
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
99 this descriptor. */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 578
diff changeset
100 qxe_fopen (XSTRING_DATA (tty), READ_PLUS_TEXT);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 if (!stream_con->in)
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 444
diff changeset
102 signal_error (Qio_error, "Unable to open tty", tty);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 static void
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
107 stream_init_device (struct device *d, Lisp_Object UNUSED (params))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109 struct console *con = XCONSOLE (DEVICE_CONSOLE (d));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111 DEVICE_INFD (d) = fileno (CONSOLE_STREAM_DATA (con)->in);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112 DEVICE_OUTFD (d) = fileno (CONSOLE_STREAM_DATA (con)->out);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113 init_baud_rate (d);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 init_one_device (d);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117 static int
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
118 stream_initially_selected_for_input (struct console *UNUSED (con))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
119 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120 return noninteractive && initialized;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
121 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 extern int stdout_needs_newline;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126 stream_delete_console (struct console *con)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
127 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
128 struct stream_console *stream_con = CONSOLE_STREAM_DATA (con);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
129 if (stream_con)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
130 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
131 if (/* stream_con->needs_newline */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
132 stdout_needs_newline) /* #### clean this up */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
133 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
134 fputc ('\n', stream_con->out);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
135 fflush (stream_con->out);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
136 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
137 if (stream_con->in != stdin)
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 578
diff changeset
138 retry_fclose (stream_con->in);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
139
3263
d674024a8674 [xemacs-hg @ 2006-02-27 16:29:00 by crestani]
crestani
parents: 3092
diff changeset
140 #ifndef NEW_GC
1726
a8d8f419b459 [xemacs-hg @ 2003-09-30 15:26:34 by james]
james
parents: 1279
diff changeset
141 xfree (stream_con, struct stream_console *);
3092
141c2920ea48 [xemacs-hg @ 2005-11-25 01:41:31 by crestani]
crestani
parents: 2500
diff changeset
142 #endif /* not NEW_GC */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
143 CONSOLE_STREAM_DATA (con) = NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
144 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
145 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
146
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
147 Lisp_Object
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
148 stream_semi_canonicalize_console_connection (Lisp_Object connection,
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
149 Error_Behavior UNUSED (errb))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
150 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
151 return NILP (connection) ? Vstdio_str : connection;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
152 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
153
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
154 Lisp_Object
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
155 stream_canonicalize_console_connection (Lisp_Object connection,
578
190b164ddcac [xemacs-hg @ 2001-05-25 11:26:50 by ben]
ben
parents: 563
diff changeset
156 Error_Behavior errb)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
157 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158 if (NILP (connection) || internal_equal (connection, Vstdio_str, 0))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
159 return Vstdio_str;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
160
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161 if (!ERRB_EQ (errb, ERROR_ME))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
163 if (!STRINGP (connection))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164 return Qunbound;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
165 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
166 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
167 CHECK_STRING (connection);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
168
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169 return Ffile_truename (connection, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
170 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
171
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
172 Lisp_Object
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
173 stream_semi_canonicalize_device_connection (Lisp_Object connection,
578
190b164ddcac [xemacs-hg @ 2001-05-25 11:26:50 by ben]
ben
parents: 563
diff changeset
174 Error_Behavior errb)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
175 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
176 return stream_semi_canonicalize_console_connection (connection, errb);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
177 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
178
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
179 Lisp_Object
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
180 stream_canonicalize_device_connection (Lisp_Object connection,
578
190b164ddcac [xemacs-hg @ 2001-05-25 11:26:50 by ben]
ben
parents: 563
diff changeset
181 Error_Behavior errb)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
182 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
183 return stream_canonicalize_console_connection (connection, errb);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
184 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
185
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
186
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
187 static void
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
188 stream_init_frame_1 (struct frame *f, Lisp_Object UNUSED (props),
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 578
diff changeset
189 int frame_name_is_defaulted)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
190 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
191 #if 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
192 struct device *d = XDEVICE (FRAME_DEVICE (f));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
193 if (!NILP (DEVICE_FRAME_LIST (d)))
563
183866b06e0b [xemacs-hg @ 2001-05-24 07:50:48 by ben]
ben
parents: 444
diff changeset
194 invalid_operation ("Only one frame allowed on stream devices", Qunbound);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
195 #endif
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 578
diff changeset
196 if (frame_name_is_defaulted)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 578
diff changeset
197 f->name = build_string ("stream");
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198 f->height = 80;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
199 f->width = 24;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200 f->visible = 0; /* so redisplay doesn't try to do anything */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
202
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
203
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
204 static int
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
205 stream_text_width (struct frame *UNUSED (f),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
206 struct face_cachel *UNUSED (cachel),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
207 const Ichar *UNUSED (str), Charcount len)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 return len;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
211
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212 static int
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
213 stream_left_margin_width (struct window *UNUSED (w))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
218 static int
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
219 stream_right_margin_width (struct window *UNUSED (w))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
220 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
221 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
222 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
223
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
224 static int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
225 stream_divider_height (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
226 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
227 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
228 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
229
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
230 static int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
231 stream_eol_cursor_width (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
232 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
233 return 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
234 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
235
1279
cd0abfdb9e9d [xemacs-hg @ 2003-02-09 09:33:42 by ben]
ben
parents: 1204
diff changeset
236 /* We used to try and check for redisplaying on stream devices (e.g. in
cd0abfdb9e9d [xemacs-hg @ 2003-02-09 09:33:42 by ben]
ben
parents: 1204
diff changeset
237 redisplay_device(), and beg out if so. However, we didn't always manage
cd0abfdb9e9d [xemacs-hg @ 2003-02-09 09:33:42 by ben]
ben
parents: 1204
diff changeset
238 completely. Now we do manage completely, and to verify this we abort if
cd0abfdb9e9d [xemacs-hg @ 2003-02-09 09:33:42 by ben]
ben
parents: 1204
diff changeset
239 we try to display a stream device. This might fix some crashes I've
cd0abfdb9e9d [xemacs-hg @ 2003-02-09 09:33:42 by ben]
ben
parents: 1204
diff changeset
240 been getting in pdump -- the only difference between crash and non-crash
cd0abfdb9e9d [xemacs-hg @ 2003-02-09 09:33:42 by ben]
ben
parents: 1204
diff changeset
241 is a few changes to the redisplay critical-section handling. */
cd0abfdb9e9d [xemacs-hg @ 2003-02-09 09:33:42 by ben]
ben
parents: 1204
diff changeset
242
cd0abfdb9e9d [xemacs-hg @ 2003-02-09 09:33:42 by ben]
ben
parents: 1204
diff changeset
243 static void
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
244 stream_window_output_begin (struct window *UNUSED (w))
1279
cd0abfdb9e9d [xemacs-hg @ 2003-02-09 09:33:42 by ben]
ben
parents: 1204
diff changeset
245 {
2500
3d8143fc88e1 [xemacs-hg @ 2005-01-24 23:33:30 by ben]
ben
parents: 2342
diff changeset
246 ABORT ();
1279
cd0abfdb9e9d [xemacs-hg @ 2003-02-09 09:33:42 by ben]
ben
parents: 1204
diff changeset
247 }
cd0abfdb9e9d [xemacs-hg @ 2003-02-09 09:33:42 by ben]
ben
parents: 1204
diff changeset
248
cd0abfdb9e9d [xemacs-hg @ 2003-02-09 09:33:42 by ben]
ben
parents: 1204
diff changeset
249 static void
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
250 stream_window_output_end (struct window *UNUSED (w))
1279
cd0abfdb9e9d [xemacs-hg @ 2003-02-09 09:33:42 by ben]
ben
parents: 1204
diff changeset
251 {
2500
3d8143fc88e1 [xemacs-hg @ 2005-01-24 23:33:30 by ben]
ben
parents: 2342
diff changeset
252 ABORT ();
1279
cd0abfdb9e9d [xemacs-hg @ 2003-02-09 09:33:42 by ben]
ben
parents: 1204
diff changeset
253 }
cd0abfdb9e9d [xemacs-hg @ 2003-02-09 09:33:42 by ben]
ben
parents: 1204
diff changeset
254
cd0abfdb9e9d [xemacs-hg @ 2003-02-09 09:33:42 by ben]
ben
parents: 1204
diff changeset
255 static void
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
256 stream_frame_output_begin (struct frame *UNUSED (f))
1279
cd0abfdb9e9d [xemacs-hg @ 2003-02-09 09:33:42 by ben]
ben
parents: 1204
diff changeset
257 {
2500
3d8143fc88e1 [xemacs-hg @ 2005-01-24 23:33:30 by ben]
ben
parents: 2342
diff changeset
258 ABORT ();
1279
cd0abfdb9e9d [xemacs-hg @ 2003-02-09 09:33:42 by ben]
ben
parents: 1204
diff changeset
259 }
cd0abfdb9e9d [xemacs-hg @ 2003-02-09 09:33:42 by ben]
ben
parents: 1204
diff changeset
260
cd0abfdb9e9d [xemacs-hg @ 2003-02-09 09:33:42 by ben]
ben
parents: 1204
diff changeset
261 static void
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
262 stream_frame_output_end (struct frame *UNUSED (f))
1279
cd0abfdb9e9d [xemacs-hg @ 2003-02-09 09:33:42 by ben]
ben
parents: 1204
diff changeset
263 {
2500
3d8143fc88e1 [xemacs-hg @ 2005-01-24 23:33:30 by ben]
ben
parents: 2342
diff changeset
264 ABORT ();
1279
cd0abfdb9e9d [xemacs-hg @ 2003-02-09 09:33:42 by ben]
ben
parents: 1204
diff changeset
265 }
cd0abfdb9e9d [xemacs-hg @ 2003-02-09 09:33:42 by ben]
ben
parents: 1204
diff changeset
266
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
267 static void
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
268 stream_output_display_block (struct window *UNUSED (w),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
269 struct display_line *UNUSED (dl),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
270 int UNUSED (block), int UNUSED (start),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
271 int UNUSED (end), int UNUSED (start_pixpos),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
272 int UNUSED (cursor_start),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
273 int UNUSED (cursor_width),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
274 int UNUSED (cursor_height))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
275 {
2500
3d8143fc88e1 [xemacs-hg @ 2005-01-24 23:33:30 by ben]
ben
parents: 2342
diff changeset
276 ABORT ();
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
277 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
278
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
279 static void
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
280 stream_clear_region (Lisp_Object UNUSED (window), struct device* UNUSED (d),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
281 struct frame *UNUSED (f), face_index UNUSED (findex),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
282 int UNUSED (x), int UNUSED (y), int UNUSED (width),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
283 int UNUSED (height), Lisp_Object UNUSED (fcolor),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
284 Lisp_Object UNUSED (bcolor),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
285 Lisp_Object UNUSED (background_pixmap))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
286 {
2500
3d8143fc88e1 [xemacs-hg @ 2005-01-24 23:33:30 by ben]
ben
parents: 2342
diff changeset
287 ABORT ();
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
288 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
289
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
290 static int
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
291 stream_flash (struct device *UNUSED (d))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
292 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
293 return 0; /* sorry can't do it */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
294 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
295
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
296 static void
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
297 stream_ring_bell (struct device *d, int UNUSED (volume), int UNUSED (pitch),
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1726
diff changeset
298 int UNUSED (duration))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
299 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
300 struct console *c = XCONSOLE (DEVICE_CONSOLE (d));
826
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 800
diff changeset
301 /* Don't output ^G when not a TTY -- in particular, under MS Windows, ^G
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 800
diff changeset
302 is interpreted as bell by the console, but not when running under
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 800
diff changeset
303 VC++. Probably this would be the same under Unix. */
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 800
diff changeset
304 if (isatty (fileno (CONSOLE_STREAM_DATA (c)->out)))
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 800
diff changeset
305 {
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 800
diff changeset
306 fputc (07, CONSOLE_STREAM_DATA (c)->out);
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 800
diff changeset
307 fflush (CONSOLE_STREAM_DATA (c)->out);
6728e641994e [xemacs-hg @ 2002-05-05 11:30:15 by ben]
ben
parents: 800
diff changeset
308 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
309 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
310
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
311
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
312 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
313 /* initialization */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
314 /************************************************************************/
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
315
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
316 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
317 console_type_create_stream (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
318 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
319 INITIALIZE_CONSOLE_TYPE (stream, "stream", "console-stream-p");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
320
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
321 /* console methods */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
322 CONSOLE_HAS_METHOD (stream, init_console);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
323 CONSOLE_HAS_METHOD (stream, initially_selected_for_input);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
324 CONSOLE_HAS_METHOD (stream, delete_console);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
325 CONSOLE_HAS_METHOD (stream, canonicalize_console_connection);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
326 CONSOLE_HAS_METHOD (stream, canonicalize_device_connection);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
327 CONSOLE_HAS_METHOD (stream, semi_canonicalize_console_connection);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
328 CONSOLE_HAS_METHOD (stream, semi_canonicalize_device_connection);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
329
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
330 /* device methods */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
331 CONSOLE_HAS_METHOD (stream, init_device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
332
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
333 /* frame methods */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
334 CONSOLE_HAS_METHOD (stream, init_frame_1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
335
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
336 /* redisplay methods */
1279
cd0abfdb9e9d [xemacs-hg @ 2003-02-09 09:33:42 by ben]
ben
parents: 1204
diff changeset
337 CONSOLE_HAS_METHOD (stream, text_width);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
338 CONSOLE_HAS_METHOD (stream, left_margin_width);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
339 CONSOLE_HAS_METHOD (stream, right_margin_width);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
340 CONSOLE_HAS_METHOD (stream, divider_height);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
341 CONSOLE_HAS_METHOD (stream, eol_cursor_width);
1279
cd0abfdb9e9d [xemacs-hg @ 2003-02-09 09:33:42 by ben]
ben
parents: 1204
diff changeset
342 CONSOLE_HAS_METHOD (stream, window_output_begin);
cd0abfdb9e9d [xemacs-hg @ 2003-02-09 09:33:42 by ben]
ben
parents: 1204
diff changeset
343 CONSOLE_HAS_METHOD (stream, window_output_end);
cd0abfdb9e9d [xemacs-hg @ 2003-02-09 09:33:42 by ben]
ben
parents: 1204
diff changeset
344 CONSOLE_HAS_METHOD (stream, frame_output_begin);
cd0abfdb9e9d [xemacs-hg @ 2003-02-09 09:33:42 by ben]
ben
parents: 1204
diff changeset
345 CONSOLE_HAS_METHOD (stream, frame_output_end);
cd0abfdb9e9d [xemacs-hg @ 2003-02-09 09:33:42 by ben]
ben
parents: 1204
diff changeset
346 CONSOLE_HAS_METHOD (stream, output_display_block);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
347 CONSOLE_HAS_METHOD (stream, clear_region);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
348 CONSOLE_HAS_METHOD (stream, flash);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
349 CONSOLE_HAS_METHOD (stream, ring_bell);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
350 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
351
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
352 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
353 reinit_console_type_create_stream (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
354 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
355 REINITIALIZE_CONSOLE_TYPE (stream);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
356 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
357
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
358 void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
359 vars_of_console_stream (void)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
360 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
361 DEFVAR_LISP ("terminal-console", &Vterminal_console /*
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
362 The initial console object, which represents XEmacs' stdout.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
363 */ );
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
364 Vterminal_console = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
365
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
366 DEFVAR_LISP ("terminal-device", &Vterminal_device /*
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
367 The initial device object, which represents XEmacs' stdout.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
368 */ );
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
369 Vterminal_device = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
370
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
371 DEFVAR_LISP ("terminal-frame", &Vterminal_frame /*
444
576fb035e263 Import from CVS: tag r21-2-37
cvs
parents: 442
diff changeset
372 The initial frame object, which represents XEmacs' stdout.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
373 */ );
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
374 Vterminal_frame = Qnil;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
375
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
376 /* Moved from console-tty.c */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
377 Vstdio_str = build_string ("stdio");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
378 staticpro (&Vstdio_str);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
379 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
380
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
381 #ifndef PDUMP
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
382 void
2342
91671c428d8b [xemacs-hg @ 2004-10-20 03:42:56 by james]
james
parents: 2286
diff changeset
383 init_console_stream (int UNUSED (reinit))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
384 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
385 /* This function can GC */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
386 if (!initialized)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
387 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
388 Vterminal_device = Fmake_device (Qstream, Qnil, Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
389 Vterminal_console = Fdevice_console (Vterminal_device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
390 Vterminal_frame = Fmake_frame (Qnil, Vterminal_device);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
391 minibuf_window = XFRAME (Vterminal_frame)->minibuffer_window;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
392 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
393 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
394 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
395 /* Re-initialize the FILE fields of the console. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
396 stream_init_console (XCONSOLE (Vterminal_console), Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
397 if (noninteractive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
398 event_stream_select_console (XCONSOLE (Vterminal_console));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
399 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
400 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
401
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
402 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
403
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
404 void
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
405 init_console_stream (int reinit)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
406 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
407 /* This function can GC */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
408 if (!reinit)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
409 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
410 Vterminal_device = Fmake_device (Qstream, Qnil, Qnil);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
411 Vterminal_console = Fdevice_console (Vterminal_device);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
412 Vterminal_frame = Fmake_frame (Qnil, Vterminal_device);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
413 minibuf_window = XFRAME (Vterminal_frame)->minibuffer_window;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 428
diff changeset
414 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
415 if (initialized)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
416 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
417 stream_init_console (XCONSOLE (Vterminal_console), Qnil);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
418 if (noninteractive)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
419 event_stream_select_console (XCONSOLE (Vterminal_console));
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
420 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
421 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
422 #endif