Mercurial > emacs
changeset 90061:48210be97b12
Cancel the change done in HEAD on 2004-11-30.
(coding_charset_list): New function.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Sat, 11 Dec 2004 02:12:49 +0000 |
parents | 637c6bc8a26f |
children | e1efd2496a29 |
files | src/coding.c |
diffstat | 1 files changed, 24 insertions(+), 89 deletions(-) [+] |
line wrap: on
line diff
--- a/src/coding.c Sat Dec 11 02:12:02 2004 +0000 +++ b/src/coding.c Sat Dec 11 02:12:49 2004 +0000 @@ -5085,6 +5085,30 @@ return; } +/* Return a list of charsets supported by CODING. */ + +Lisp_Object +coding_charset_list (coding) + struct coding_system *coding; +{ + Lisp_Object attrs, charset_list, coding_type; + + CODING_GET_INFO (coding, attrs, charset_list); + if (EQ (CODING_ATTR_TYPE (attrs), Qiso_2022)) + { + int flags = XINT (AREF (attrs, coding_attr_iso_flags)); + + if (flags & CODING_ISO_FLAG_FULL_SUPPORT) + charset_list = Viso_2022_charset_list; + } + else if (EQ (CODING_ATTR_TYPE (attrs), Qemacs_mule)) + { + charset_list = Vemacs_mule_charset_list; + } + return charset_list; +} + + /* Return raw-text or one of its subsidiaries that has the same eol_type as CODING-SYSTEM. */ @@ -6578,37 +6602,6 @@ return Qnil; } -/* Name (or base name) of work buffer for code conversion. */ -static Lisp_Object Vcode_conversion_workbuf_name; - -/* Set the current buffer to the working buffer prepared for - code-conversion. MULTIBYTE specifies the multibyteness of the - buffer. */ - -static struct buffer * -set_conversion_work_buffer (multibyte) - int multibyte; -{ - Lisp_Object buffer; - struct buffer *buf; - - buffer = Fget_buffer_create (Vcode_conversion_workbuf_name); - buf = XBUFFER (buffer); - delete_all_overlays (buf); - buf->directory = current_buffer->directory; - buf->read_only = Qnil; - buf->filename = Qnil; - buf->undo_list = Qt; - eassert (buf->overlays_before == NULL); - eassert (buf->overlays_after == NULL); - set_buffer_internal (buf); - if (BEG != BEGV || Z != ZV) - Fwiden (); - del_range_2 (BEG, BEG_BYTE, Z, Z_BYTE, 0); - buf->enable_multibyte_characters = multibyte ? Qt : Qnil; - return buf; -} - Lisp_Object code_conversion_save (with_work_buf, multibyte) int with_work_buf, multibyte; @@ -7026,64 +7019,6 @@ } - -/* Run pre-write-conversion function of CODING on NCHARS/NBYTES - text in *STR. *SIZE is the allocated bytes for STR. As it - is intended that this function is called from encode_terminal_code, - the pre-write-conversion function is run by safe_call and thus - "Error during redisplay: ..." is logged when an error occurs. - - Store the resulting text in *STR and set CODING->produced_char and - CODING->produced to the number of characters and bytes - respectively. If the size of *STR is too small, enlarge it by - xrealloc and update *STR and *SIZE. */ - -void -run_pre_write_conversin_on_c_str (str, size, nchars, nbytes, coding) - unsigned char **str; - int *size, nchars, nbytes; - struct coding_system *coding; -{ - struct gcpro gcpro1, gcpro2; - struct buffer *cur = current_buffer; - Lisp_Object old_deactivate_mark, old_last_coding_system_used; - Lisp_Object args[3]; - - /* It is not crucial to specbind this. */ - old_deactivate_mark = Vdeactivate_mark; - old_last_coding_system_used = Vlast_coding_system_used; - GCPRO2 (old_deactivate_mark, old_last_coding_system_used); - - /* We must insert the contents of STR as is without - unibyte<->multibyte conversion. For that, we adjust the - multibyteness of the working buffer to that of STR. */ - set_conversion_work_buffer (coding->src_multibyte); - insert_1_both (*str, nchars, nbytes, 0, 0, 0); - UNGCPRO; - inhibit_pre_post_conversion = 1; - args[0] = coding->pre_write_conversion; - args[1] = make_number (BEG); - args[2] = make_number (Z); - safe_call (3, args); - inhibit_pre_post_conversion = 0; - Vdeactivate_mark = old_deactivate_mark; - Vlast_coding_system_used = old_last_coding_system_used; - coding->produced_char = Z - BEG; - coding->produced = Z_BYTE - BEG_BYTE; - if (coding->produced > *size) - { - *size = coding->produced; - *str = xrealloc (*str, *size); - } - if (BEG < GPT && GPT < Z) - move_gap (BEG); - bcopy (BEG_ADDR, *str, coding->produced); - coding->src_multibyte - = ! NILP (current_buffer->enable_multibyte_characters); - set_buffer_internal (cur); -} - - Lisp_Object preferred_coding_system () {