Mercurial > hg > xemacs-beta
comparison src/console-tty.c @ 412:697ef44129c6 r21-2-14
Import from CVS: tag r21-2-14
author | cvs |
---|---|
date | Mon, 13 Aug 2007 11:20:41 +0200 |
parents | b8cc9ab3f761 |
children | 41dbb7a9d5f2 |
comparison
equal
deleted
inserted
replaced
411:12e008d41344 | 412:697ef44129c6 |
---|---|
30 #include "console-tty.h" | 30 #include "console-tty.h" |
31 #include "console-stream.h" | 31 #include "console-stream.h" |
32 #include "faces.h" | 32 #include "faces.h" |
33 #include "frame.h" | 33 #include "frame.h" |
34 #include "lstream.h" | 34 #include "lstream.h" |
35 #include "glyphs.h" | |
36 #include "sysdep.h" | 35 #include "sysdep.h" |
37 #include "sysfile.h" | 36 #include "sysfile.h" |
38 #ifdef FILE_CODING | 37 #ifdef FILE_CODING |
39 #include "file-coding.h" | 38 #include "file-coding.h" |
40 #endif | 39 #endif |
40 #ifdef HAVE_GPM | |
41 #include "gpmevent.h" | |
42 #endif | |
41 | 43 |
42 DEFINE_CONSOLE_TYPE (tty); | 44 DEFINE_CONSOLE_TYPE (tty); |
43 DECLARE_IMAGE_INSTANTIATOR_FORMAT (nothing); | |
44 DECLARE_IMAGE_INSTANTIATOR_FORMAT (string); | |
45 DECLARE_IMAGE_INSTANTIATOR_FORMAT (formatted_string); | |
46 DECLARE_IMAGE_INSTANTIATOR_FORMAT (inherit); | |
47 | 45 |
48 Lisp_Object Qterminal_type; | 46 Lisp_Object Qterminal_type; |
49 Lisp_Object Qcontrolling_process; | 47 Lisp_Object Qcontrolling_process; |
50 | 48 |
51 | 49 |
113 tty_con->is_stdio = 0; | 111 tty_con->is_stdio = 0; |
114 } | 112 } |
115 | 113 |
116 tty_con->instream = make_filedesc_input_stream (tty_con->infd, 0, -1, 0); | 114 tty_con->instream = make_filedesc_input_stream (tty_con->infd, 0, -1, 0); |
117 tty_con->outstream = make_filedesc_output_stream (tty_con->outfd, 0, -1, 0); | 115 tty_con->outstream = make_filedesc_output_stream (tty_con->outfd, 0, -1, 0); |
118 #ifdef FILE_CODING | 116 #ifdef MULE |
119 tty_con->instream = | 117 tty_con->instream = |
120 make_decoding_input_stream (XLSTREAM (tty_con->instream), | 118 make_decoding_input_stream (XLSTREAM (tty_con->instream), |
121 Fget_coding_system (Qkeyboard)); | 119 Fget_coding_system (Vkeyboard_coding_system)); |
122 Lstream_set_character_mode (XLSTREAM (tty_con->instream)); | 120 Lstream_set_character_mode (XLSTREAM (tty_con->instream)); |
123 tty_con->outstream = | 121 tty_con->outstream = |
124 make_encoding_output_stream (XLSTREAM (tty_con->outstream), | 122 make_encoding_output_stream (XLSTREAM (tty_con->outstream), |
125 Fget_coding_system (Qterminal)); | 123 Fget_coding_system (Vterminal_coding_system)); |
126 #endif /* FILE_CODING */ | 124 #endif /* MULE */ |
127 tty_con->terminal_type = terminal_type; | 125 tty_con->terminal_type = terminal_type; |
128 tty_con->controlling_process = controlling_process; | 126 tty_con->controlling_process = controlling_process; |
127 | |
128 #ifdef HAVE_GPM | |
129 connect_to_gpm (con); | |
130 #endif | |
129 | 131 |
130 if (NILP (CONSOLE_NAME (con))) | 132 if (NILP (CONSOLE_NAME (con))) |
131 CONSOLE_NAME (con) = Ffile_name_nondirectory (tty); | 133 CONSOLE_NAME (con) = Ffile_name_nondirectory (tty); |
132 { | 134 { |
133 int tty_pg; | 135 int tty_pg; |
157 | 159 |
158 UNGCPRO; | 160 UNGCPRO; |
159 } | 161 } |
160 | 162 |
161 static void | 163 static void |
162 tty_mark_console (struct console *con) | 164 tty_mark_console (struct console *con, void (*markobj) (Lisp_Object)) |
163 { | 165 { |
164 struct tty_console *tty_con = CONSOLE_TTY_DATA (con); | 166 struct tty_console *tty_con = CONSOLE_TTY_DATA (con); |
165 mark_object (tty_con->terminal_type); | 167 markobj (tty_con->terminal_type); |
166 mark_object (tty_con->instream); | 168 markobj (tty_con->instream); |
167 mark_object (tty_con->outstream); | 169 markobj (tty_con->outstream); |
168 } | 170 } |
169 | 171 |
170 static int | 172 static int |
171 tty_initially_selected_for_input (struct console *con) | 173 tty_initially_selected_for_input (struct console *con) |
172 { | 174 { |
251 */ | 253 */ |
252 (console, codesys)) | 254 (console, codesys)) |
253 { | 255 { |
254 set_decoding_stream_coding_system | 256 set_decoding_stream_coding_system |
255 (XLSTREAM (CONSOLE_TTY_DATA (decode_tty_console (console))->instream), | 257 (XLSTREAM (CONSOLE_TTY_DATA (decode_tty_console (console))->instream), |
256 Fget_coding_system (NILP (codesys) ? Qkeyboard : codesys)); | 258 Fget_coding_system (NILP (codesys) ? Vkeyboard_coding_system : codesys)); |
257 return Qnil; | 259 return Qnil; |
258 } | 260 } |
259 | 261 |
260 DEFUN ("console-tty-output-coding-system", Fconsole_tty_output_coding_system, | 262 DEFUN ("console-tty-output-coding-system", Fconsole_tty_output_coding_system, |
261 0, 1, 0, /* | 263 0, 1, 0, /* |
275 */ | 277 */ |
276 (console, codesys)) | 278 (console, codesys)) |
277 { | 279 { |
278 set_encoding_stream_coding_system | 280 set_encoding_stream_coding_system |
279 (XLSTREAM (CONSOLE_TTY_DATA (decode_tty_console (console))->outstream), | 281 (XLSTREAM (CONSOLE_TTY_DATA (decode_tty_console (console))->outstream), |
280 Fget_coding_system (NILP (codesys) ? Qterminal : codesys)); | 282 Fget_coding_system (NILP (codesys) ? Vterminal_coding_system : codesys)); |
281 /* Redraw tty */ | |
282 face_property_was_changed (Vdefault_face, Qfont, Qtty); | |
283 return Qnil; | 283 return Qnil; |
284 } | 284 } |
285 | 285 |
286 /* #### Move this function to lisp */ | 286 /* ### Move this function to lisp */ |
287 DEFUN ("set-console-tty-coding-system", Fset_console_tty_coding_system, | 287 DEFUN ("set-console-tty-coding-system", Fset_console_tty_coding_system, |
288 0, 2, 0, /* | 288 0, 2, 0, /* |
289 Set the input and output coding systems of tty console CONSOLE to CODESYS. | 289 Set the input and output coding systems of tty console CONSOLE to CODESYS. |
290 CONSOLE defaults to the selected console. | 290 CONSOLE defaults to the selected console. |
291 If CODESYS is nil, the values of `keyboard-coding-system' and | 291 If CODESYS is nil, the values of `keyboard-coding-system' and |
365 CONSOLE_HAS_METHOD (tty, semi_canonicalize_console_connection); | 365 CONSOLE_HAS_METHOD (tty, semi_canonicalize_console_connection); |
366 CONSOLE_HAS_METHOD (tty, semi_canonicalize_device_connection); | 366 CONSOLE_HAS_METHOD (tty, semi_canonicalize_device_connection); |
367 } | 367 } |
368 | 368 |
369 void | 369 void |
370 reinit_console_type_create_tty (void) | |
371 { | |
372 REINITIALIZE_CONSOLE_TYPE (tty); | |
373 } | |
374 | |
375 void | |
376 image_instantiator_format_create_glyphs_tty (void) | |
377 { | |
378 IIFORMAT_VALID_CONSOLE (tty, nothing); | |
379 IIFORMAT_VALID_CONSOLE (tty, string); | |
380 IIFORMAT_VALID_CONSOLE (tty, formatted_string); | |
381 IIFORMAT_VALID_CONSOLE (tty, inherit); | |
382 } | |
383 | |
384 void | |
385 vars_of_console_tty (void) | 370 vars_of_console_tty (void) |
386 { | 371 { |
387 Fprovide (Qtty); | 372 Fprovide (Qtty); |
388 } | 373 } |