Mercurial > hg > xemacs-beta
comparison src/console-tty.c @ 5118:e0db3c197671 ben-lisp-object
merge up to latest default branch, doesn't compile yet
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Sat, 26 Dec 2009 21:18:49 -0600 |
parents | 229bd619740a |
children | d1247f3cc363 |
comparison
equal
deleted
inserted
replaced
5117:3742ea8250b5 | 5118:e0db3c197671 |
---|---|
57 { XD_LISP_OBJECT, offsetof (struct tty_console, instream) }, | 57 { XD_LISP_OBJECT, offsetof (struct tty_console, instream) }, |
58 { XD_LISP_OBJECT, offsetof (struct tty_console, outstream) }, | 58 { XD_LISP_OBJECT, offsetof (struct tty_console, outstream) }, |
59 { XD_END } | 59 { XD_END } |
60 }; | 60 }; |
61 | 61 |
62 #ifdef NEW_GC | |
63 DEFINE_DUMPABLE_INTERNAL_LISP_OBJECT ("tty-console", tty_console, | |
64 0, tty_console_data_description_1, | |
65 Lisp_Tty_Console); | |
66 #else /* not NEW_GC */ | |
62 const struct sized_memory_description tty_console_data_description = { | 67 const struct sized_memory_description tty_console_data_description = { |
63 sizeof (struct tty_console), tty_console_data_description_1 | 68 sizeof (struct tty_console), tty_console_data_description_1 |
64 }; | 69 }; |
70 #endif /* not NEW_GC */ | |
65 | 71 |
66 | 72 |
67 static void | 73 static void |
68 allocate_tty_console_struct (struct console *con) | 74 allocate_tty_console_struct (struct console *con) |
69 { | 75 { |
70 /* zero out all slots except the lisp ones ... */ | 76 /* zero out all slots except the lisp ones ... */ |
77 #ifdef NEW_GC | |
78 CONSOLE_TTY_DATA (con) = alloc_lrecord_type (struct tty_console, | |
79 &lrecord_tty_console); | |
80 #else /* not NEW_GC */ | |
71 CONSOLE_TTY_DATA (con) = xnew_and_zero (struct tty_console); | 81 CONSOLE_TTY_DATA (con) = xnew_and_zero (struct tty_console); |
82 #endif /* not NEW_GC */ | |
72 CONSOLE_TTY_DATA (con)->terminal_type = Qnil; | 83 CONSOLE_TTY_DATA (con)->terminal_type = Qnil; |
73 CONSOLE_TTY_DATA (con)->instream = Qnil; | 84 CONSOLE_TTY_DATA (con)->instream = Qnil; |
74 CONSOLE_TTY_DATA (con)->outstream = Qnil; | 85 CONSOLE_TTY_DATA (con)->outstream = Qnil; |
75 } | 86 } |
76 | 87 |
143 get_coding_system_for_text_file (Qterminal, 0), | 154 get_coding_system_for_text_file (Qterminal, 0), |
144 CODING_ENCODE, 0); | 155 CODING_ENCODE, 0); |
145 tty_con->terminal_type = terminal_type; | 156 tty_con->terminal_type = terminal_type; |
146 tty_con->controlling_process = controlling_process; | 157 tty_con->controlling_process = controlling_process; |
147 | 158 |
159 /* Defaults to 1 with Mule, 0 without. In the latter case the attribute is | |
160 read-only from Lisp. */ | |
161 tty_con->multiple_width = CONSOLE_TTY_SUPPORTS_MULTIPLE_WIDTH(c); | |
162 | |
148 if (NILP (CONSOLE_NAME (con))) | 163 if (NILP (CONSOLE_NAME (con))) |
149 CONSOLE_NAME (con) = Ffile_name_nondirectory (tty); | 164 CONSOLE_NAME (con) = Ffile_name_nondirectory (tty); |
150 { | 165 { |
151 pid_t tty_pg; | 166 pid_t tty_pg; |
152 pid_t controlling_tty_pg; | 167 pid_t controlling_tty_pg; |
200 if (tty_con->term_entry_buffer) /* allocated in term_init () */ | 215 if (tty_con->term_entry_buffer) /* allocated in term_init () */ |
201 { | 216 { |
202 xfree (tty_con->term_entry_buffer, char *); | 217 xfree (tty_con->term_entry_buffer, char *); |
203 tty_con->term_entry_buffer = NULL; | 218 tty_con->term_entry_buffer = NULL; |
204 } | 219 } |
220 #ifndef NEW_GC | |
205 xfree (tty_con, struct tty_console *); | 221 xfree (tty_con, struct tty_console *); |
222 #endif /* not NEW_GC */ | |
206 CONSOLE_TTY_DATA (con) = NULL; | 223 CONSOLE_TTY_DATA (con) = NULL; |
207 } | 224 } |
208 } | 225 } |
209 | 226 |
210 static void | 227 static void |
297 (XLSTREAM (CONSOLE_TTY_DATA (decode_tty_console (console))->outstream), | 314 (XLSTREAM (CONSOLE_TTY_DATA (decode_tty_console (console))->outstream), |
298 get_coding_system_for_text_file (NILP (codesys) ? Qterminal : codesys, | 315 get_coding_system_for_text_file (NILP (codesys) ? Qterminal : codesys, |
299 0)); | 316 0)); |
300 /* Redraw tty */ | 317 /* Redraw tty */ |
301 face_property_was_changed (Vdefault_face, Qfont, Qtty); | 318 face_property_was_changed (Vdefault_face, Qfont, Qtty); |
319 return Qnil; | |
320 } | |
321 | |
322 DEFUN ("console-tty-multiple-width", Fconsole_tty_multiple_width, | |
323 0, 1, 0, /* | |
324 Return whether CONSOLE treats East Asian double-width chars as such. | |
325 | |
326 CONSOLE defaults to the selected console. Without XEmacs support for | |
327 double-width characters, this always gives nil. | |
328 */ | |
329 (console)) | |
330 { | |
331 return CONSOLE_TTY_MULTIPLE_WIDTH (decode_tty_console(console)) | |
332 ? Qt : Qnil; | |
333 } | |
334 | |
335 DEFUN ("set-console-tty-multiple-width", Fset_console_tty_multiple_width, | |
336 0, 2, 0, /* | |
337 Set whether CONSOLE treats East Asian double-width characters as such. | |
338 | |
339 CONSOLE defaults to the selected console, and VALUE defaults to nil. | |
340 Without XEmacs support for double-width characters, this throws an error if | |
341 VALUE is non-nil. | |
342 */ | |
343 (console, value)) | |
344 { | |
345 struct console *c = decode_tty_console (console); | |
346 | |
347 /* So people outside of East Asia can put (set-console-tty-multiple-width | |
348 (selected-console) nil) in their init files, independent of whether | |
349 Mule is enabled. */ | |
350 if (!CONSOLE_TTY_MULTIPLE_WIDTH (c) && NILP(value)) | |
351 { | |
352 return Qnil; | |
353 } | |
354 | |
355 if (!CONSOLE_TTY_SUPPORTS_MULTIPLE_WIDTH (c)) | |
356 { | |
357 invalid_change | |
358 ("No console support for double-width chars", | |
359 Fmake_symbol(CONSOLE_NAME(c))); | |
360 } | |
361 | |
362 CONSOLE_TTY_DATA(c)->multiple_width = NILP(value) ? 0 : 1; | |
363 | |
302 return Qnil; | 364 return Qnil; |
303 } | 365 } |
304 | 366 |
305 /* #### Move this function to lisp */ | 367 /* #### Move this function to lisp */ |
306 DEFUN ("set-console-tty-coding-system", Fset_console_tty_coding_system, | 368 DEFUN ("set-console-tty-coding-system", Fset_console_tty_coding_system, |
412 DEFSUBR (Fconsole_tty_output_coding_system); | 474 DEFSUBR (Fconsole_tty_output_coding_system); |
413 DEFSUBR (Fset_console_tty_output_coding_system); | 475 DEFSUBR (Fset_console_tty_output_coding_system); |
414 DEFSUBR (Fconsole_tty_input_coding_system); | 476 DEFSUBR (Fconsole_tty_input_coding_system); |
415 DEFSUBR (Fset_console_tty_input_coding_system); | 477 DEFSUBR (Fset_console_tty_input_coding_system); |
416 DEFSUBR (Fset_console_tty_coding_system); | 478 DEFSUBR (Fset_console_tty_coding_system); |
479 DEFSUBR (Fconsole_tty_multiple_width); | |
480 DEFSUBR (Fset_console_tty_multiple_width); | |
417 } | 481 } |
418 | 482 |
419 void | 483 void |
420 console_type_create_tty (void) | 484 console_type_create_tty (void) |
421 { | 485 { |