diff options
| author | Kenichi Handa | 2004-12-11 02:12:49 +0000 |
|---|---|---|
| committer | Kenichi Handa | 2004-12-11 02:12:49 +0000 |
| commit | 0ff61e786c7fdeb3413020c9b633fc417be21323 (patch) | |
| tree | 5ec414508ae3589d239b55fb489436919b331a2a /src | |
| parent | 76c263971400a56dc2ab0def087cad182857642b (diff) | |
| download | emacs-0ff61e786c7fdeb3413020c9b633fc417be21323.tar.gz emacs-0ff61e786c7fdeb3413020c9b633fc417be21323.zip | |
Cancel the change done in HEAD on 2004-11-30.
(coding_charset_list): New function.
Diffstat (limited to 'src')
| -rw-r--r-- | src/coding.c | 113 |
1 files changed, 24 insertions, 89 deletions
diff --git a/src/coding.c b/src/coding.c index de65884254f..166cb036474 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -5085,6 +5085,30 @@ setup_coding_system (coding_system, coding) | |||
| 5085 | return; | 5085 | return; |
| 5086 | } | 5086 | } |
| 5087 | 5087 | ||
| 5088 | /* Return a list of charsets supported by CODING. */ | ||
| 5089 | |||
| 5090 | Lisp_Object | ||
| 5091 | coding_charset_list (coding) | ||
| 5092 | struct coding_system *coding; | ||
| 5093 | { | ||
| 5094 | Lisp_Object attrs, charset_list, coding_type; | ||
| 5095 | |||
| 5096 | CODING_GET_INFO (coding, attrs, charset_list); | ||
| 5097 | if (EQ (CODING_ATTR_TYPE (attrs), Qiso_2022)) | ||
| 5098 | { | ||
| 5099 | int flags = XINT (AREF (attrs, coding_attr_iso_flags)); | ||
| 5100 | |||
| 5101 | if (flags & CODING_ISO_FLAG_FULL_SUPPORT) | ||
| 5102 | charset_list = Viso_2022_charset_list; | ||
| 5103 | } | ||
| 5104 | else if (EQ (CODING_ATTR_TYPE (attrs), Qemacs_mule)) | ||
| 5105 | { | ||
| 5106 | charset_list = Vemacs_mule_charset_list; | ||
| 5107 | } | ||
| 5108 | return charset_list; | ||
| 5109 | } | ||
| 5110 | |||
| 5111 | |||
| 5088 | /* Return raw-text or one of its subsidiaries that has the same | 5112 | /* Return raw-text or one of its subsidiaries that has the same |
| 5089 | eol_type as CODING-SYSTEM. */ | 5113 | eol_type as CODING-SYSTEM. */ |
| 5090 | 5114 | ||
| @@ -6578,37 +6602,6 @@ code_conversion_restore (arg) | |||
| 6578 | return Qnil; | 6602 | return Qnil; |
| 6579 | } | 6603 | } |
| 6580 | 6604 | ||
| 6581 | /* Name (or base name) of work buffer for code conversion. */ | ||
| 6582 | static Lisp_Object Vcode_conversion_workbuf_name; | ||
| 6583 | |||
| 6584 | /* Set the current buffer to the working buffer prepared for | ||
| 6585 | code-conversion. MULTIBYTE specifies the multibyteness of the | ||
| 6586 | buffer. */ | ||
| 6587 | |||
| 6588 | static struct buffer * | ||
| 6589 | set_conversion_work_buffer (multibyte) | ||
| 6590 | int multibyte; | ||
| 6591 | { | ||
| 6592 | Lisp_Object buffer; | ||
| 6593 | struct buffer *buf; | ||
| 6594 | |||
| 6595 | buffer = Fget_buffer_create (Vcode_conversion_workbuf_name); | ||
| 6596 | buf = XBUFFER (buffer); | ||
| 6597 | delete_all_overlays (buf); | ||
| 6598 | buf->directory = current_buffer->directory; | ||
| 6599 | buf->read_only = Qnil; | ||
| 6600 | buf->filename = Qnil; | ||
| 6601 | buf->undo_list = Qt; | ||
| 6602 | eassert (buf->overlays_before == NULL); | ||
| 6603 | eassert (buf->overlays_after == NULL); | ||
| 6604 | set_buffer_internal (buf); | ||
| 6605 | if (BEG != BEGV || Z != ZV) | ||
| 6606 | Fwiden (); | ||
| 6607 | del_range_2 (BEG, BEG_BYTE, Z, Z_BYTE, 0); | ||
| 6608 | buf->enable_multibyte_characters = multibyte ? Qt : Qnil; | ||
| 6609 | return buf; | ||
| 6610 | } | ||
| 6611 | |||
| 6612 | Lisp_Object | 6605 | Lisp_Object |
| 6613 | code_conversion_save (with_work_buf, multibyte) | 6606 | code_conversion_save (with_work_buf, multibyte) |
| 6614 | int with_work_buf, multibyte; | 6607 | int with_work_buf, multibyte; |
| @@ -7026,64 +7019,6 @@ encode_coding_object (coding, src_object, from, from_byte, to, to_byte, | |||
| 7026 | } | 7019 | } |
| 7027 | 7020 | ||
| 7028 | 7021 | ||
| 7029 | |||
| 7030 | /* Run pre-write-conversion function of CODING on NCHARS/NBYTES | ||
| 7031 | text in *STR. *SIZE is the allocated bytes for STR. As it | ||
| 7032 | is intended that this function is called from encode_terminal_code, | ||
| 7033 | the pre-write-conversion function is run by safe_call and thus | ||
| 7034 | "Error during redisplay: ..." is logged when an error occurs. | ||
| 7035 | |||
| 7036 | Store the resulting text in *STR and set CODING->produced_char and | ||
| 7037 | CODING->produced to the number of characters and bytes | ||
| 7038 | respectively. If the size of *STR is too small, enlarge it by | ||
| 7039 | xrealloc and update *STR and *SIZE. */ | ||
| 7040 | |||
| 7041 | void | ||
| 7042 | run_pre_write_conversin_on_c_str (str, size, nchars, nbytes, coding) | ||
| 7043 | unsigned char **str; | ||
| 7044 | int *size, nchars, nbytes; | ||
| 7045 | struct coding_system *coding; | ||
| 7046 | { | ||
| 7047 | struct gcpro gcpro1, gcpro2; | ||
| 7048 | struct buffer *cur = current_buffer; | ||
| 7049 | Lisp_Object old_deactivate_mark, old_last_coding_system_used; | ||
| 7050 | Lisp_Object args[3]; | ||
| 7051 | |||
| 7052 | /* It is not crucial to specbind this. */ | ||
| 7053 | old_deactivate_mark = Vdeactivate_mark; | ||
| 7054 | old_last_coding_system_used = Vlast_coding_system_used; | ||
| 7055 | GCPRO2 (old_deactivate_mark, old_last_coding_system_used); | ||
| 7056 | |||
| 7057 | /* We must insert the contents of STR as is without | ||
| 7058 | unibyte<->multibyte conversion. For that, we adjust the | ||
| 7059 | multibyteness of the working buffer to that of STR. */ | ||
| 7060 | set_conversion_work_buffer (coding->src_multibyte); | ||
| 7061 | insert_1_both (*str, nchars, nbytes, 0, 0, 0); | ||
| 7062 | UNGCPRO; | ||
| 7063 | inhibit_pre_post_conversion = 1; | ||
| 7064 | args[0] = coding->pre_write_conversion; | ||
| 7065 | args[1] = make_number (BEG); | ||
| 7066 | args[2] = make_number (Z); | ||
| 7067 | safe_call (3, args); | ||
| 7068 | inhibit_pre_post_conversion = 0; | ||
| 7069 | Vdeactivate_mark = old_deactivate_mark; | ||
| 7070 | Vlast_coding_system_used = old_last_coding_system_used; | ||
| 7071 | coding->produced_char = Z - BEG; | ||
| 7072 | coding->produced = Z_BYTE - BEG_BYTE; | ||
| 7073 | if (coding->produced > *size) | ||
| 7074 | { | ||
| 7075 | *size = coding->produced; | ||
| 7076 | *str = xrealloc (*str, *size); | ||
| 7077 | } | ||
| 7078 | if (BEG < GPT && GPT < Z) | ||
| 7079 | move_gap (BEG); | ||
| 7080 | bcopy (BEG_ADDR, *str, coding->produced); | ||
| 7081 | coding->src_multibyte | ||
| 7082 | = ! NILP (current_buffer->enable_multibyte_characters); | ||
| 7083 | set_buffer_internal (cur); | ||
| 7084 | } | ||
| 7085 | |||
| 7086 | |||
| 7087 | Lisp_Object | 7022 | Lisp_Object |
| 7088 | preferred_coding_system () | 7023 | preferred_coding_system () |
| 7089 | { | 7024 | { |