Mercurial > hg > xemacs-beta
diff 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 |
line wrap: on
line diff
--- a/src/console-tty.c Sat Dec 26 00:20:27 2009 -0600 +++ b/src/console-tty.c Sat Dec 26 21:18:49 2009 -0600 @@ -59,16 +59,27 @@ { XD_END } }; +#ifdef NEW_GC +DEFINE_DUMPABLE_INTERNAL_LISP_OBJECT ("tty-console", tty_console, + 0, tty_console_data_description_1, + Lisp_Tty_Console); +#else /* not NEW_GC */ const struct sized_memory_description tty_console_data_description = { sizeof (struct tty_console), tty_console_data_description_1 }; +#endif /* not NEW_GC */ static void allocate_tty_console_struct (struct console *con) { /* zero out all slots except the lisp ones ... */ +#ifdef NEW_GC + CONSOLE_TTY_DATA (con) = alloc_lrecord_type (struct tty_console, + &lrecord_tty_console); +#else /* not NEW_GC */ CONSOLE_TTY_DATA (con) = xnew_and_zero (struct tty_console); +#endif /* not NEW_GC */ CONSOLE_TTY_DATA (con)->terminal_type = Qnil; CONSOLE_TTY_DATA (con)->instream = Qnil; CONSOLE_TTY_DATA (con)->outstream = Qnil; @@ -145,6 +156,10 @@ tty_con->terminal_type = terminal_type; tty_con->controlling_process = controlling_process; + /* Defaults to 1 with Mule, 0 without. In the latter case the attribute is + read-only from Lisp. */ + tty_con->multiple_width = CONSOLE_TTY_SUPPORTS_MULTIPLE_WIDTH(c); + if (NILP (CONSOLE_NAME (con))) CONSOLE_NAME (con) = Ffile_name_nondirectory (tty); { @@ -202,7 +217,9 @@ xfree (tty_con->term_entry_buffer, char *); tty_con->term_entry_buffer = NULL; } +#ifndef NEW_GC xfree (tty_con, struct tty_console *); +#endif /* not NEW_GC */ CONSOLE_TTY_DATA (con) = NULL; } } @@ -302,6 +319,51 @@ return Qnil; } +DEFUN ("console-tty-multiple-width", Fconsole_tty_multiple_width, + 0, 1, 0, /* +Return whether CONSOLE treats East Asian double-width chars as such. + +CONSOLE defaults to the selected console. Without XEmacs support for +double-width characters, this always gives nil. +*/ + (console)) +{ + return CONSOLE_TTY_MULTIPLE_WIDTH (decode_tty_console(console)) + ? Qt : Qnil; +} + +DEFUN ("set-console-tty-multiple-width", Fset_console_tty_multiple_width, + 0, 2, 0, /* +Set whether CONSOLE treats East Asian double-width characters as such. + +CONSOLE defaults to the selected console, and VALUE defaults to nil. +Without XEmacs support for double-width characters, this throws an error if +VALUE is non-nil. +*/ + (console, value)) +{ + struct console *c = decode_tty_console (console); + + /* So people outside of East Asia can put (set-console-tty-multiple-width + (selected-console) nil) in their init files, independent of whether + Mule is enabled. */ + if (!CONSOLE_TTY_MULTIPLE_WIDTH (c) && NILP(value)) + { + return Qnil; + } + + if (!CONSOLE_TTY_SUPPORTS_MULTIPLE_WIDTH (c)) + { + invalid_change + ("No console support for double-width chars", + Fmake_symbol(CONSOLE_NAME(c))); + } + + CONSOLE_TTY_DATA(c)->multiple_width = NILP(value) ? 0 : 1; + + return Qnil; +} + /* #### Move this function to lisp */ DEFUN ("set-console-tty-coding-system", Fset_console_tty_coding_system, 0, 2, 0, /* @@ -414,6 +476,8 @@ DEFSUBR (Fconsole_tty_input_coding_system); DEFSUBR (Fset_console_tty_input_coding_system); DEFSUBR (Fset_console_tty_coding_system); + DEFSUBR (Fconsole_tty_multiple_width); + DEFSUBR (Fset_console_tty_multiple_width); } void