273 |
(utf-translate-cjk-load-tables)) |
(utf-translate-cjk-load-tables)) |
274 |
(gethash code-point |
(gethash code-point |
275 |
(get 'utf-subst-table-for-decode 'translation-hash-table))) |
(get 'utf-subst-table-for-decode 'translation-hash-table))) |
276 |
|
|
277 |
|
|
278 |
(defun utf-lookup-subst-table-for-encode (char) |
(defun utf-lookup-subst-table-for-encode (char) |
279 |
(if (and utf-translate-cjk-mode |
(if (and utf-translate-cjk-mode |
282 |
(utf-translate-cjk-load-tables)) |
(utf-translate-cjk-load-tables)) |
283 |
(gethash char |
(gethash char |
284 |
(get 'utf-subst-table-for-encode 'translation-hash-table))) |
(get 'utf-subst-table-for-encode 'translation-hash-table))) |
285 |
|
|
286 |
(define-minor-mode utf-translate-cjk-mode |
(define-minor-mode utf-translate-cjk-mode |
287 |
"Whether the UTF based coding systems should decode/encode CJK characters. |
"Toggle whether UTF based coding systems de/encode CJK characters. |
288 |
|
If ARG is an integer, enable if ARG is positive and disable if |
289 |
|
zero or negative. This is a minor mode. |
290 |
Enabling this allows the coding systems mule-utf-8, |
Enabling this allows the coding systems mule-utf-8, |
291 |
mule-utf-16le and mule-utf-16be to encode characters in the charsets |
mule-utf-16le and mule-utf-16be to encode characters in the charsets |
292 |
`korean-ksc5601', `chinese-gb2312', `chinese-big5-1', |
`korean-ksc5601', `chinese-gb2312', `chinese-big5-1', |
298 |
turned on: ksc5601 for Korean, gb2312 for Chinese-GB, big5 for |
turned on: ksc5601 for Korean, gb2312 for Chinese-GB, big5 for |
299 |
Chinese-Big5 and jisx for other environments. |
Chinese-Big5 and jisx for other environments. |
300 |
|
|
301 |
This option is on by default. If you are not interested in CJK |
This mode is on by default. If you are not interested in CJK |
302 |
characters and want to avoid some overhead on encoding/decoding |
characters and want to avoid some overhead on encoding/decoding |
303 |
by the above coding systems, you can customize this option to nil." |
by the above coding systems, you can customize the user option |
304 |
|
`utf-translate-cjk-mode' to nil." |
305 |
:init-value t |
:init-value t |
306 |
:version "21.4" |
:version "21.4" |
307 |
:type 'boolean |
:type 'boolean |
608 |
;; UTF-8 decoder generates an UTF-8 sequence represented by a |
;; UTF-8 decoder generates an UTF-8 sequence represented by a |
609 |
;; sequence eight-bit-control/graphic chars for an untranslatable |
;; sequence eight-bit-control/graphic chars for an untranslatable |
610 |
;; character and an invalid byte. |
;; character and an invalid byte. |
611 |
;; |
;; |
612 |
;; This CCL parses that sequence (the first byte is already in r1), |
;; This CCL parses that sequence (the first byte is already in r1), |
613 |
;; writes out the original bytes of that sequence, and sets r5 to |
;; writes out the original bytes of that sequence, and sets r5 to |
614 |
;; -1. |
;; -1. |
627 |
(read-multibyte-character r5 r6) |
(read-multibyte-character r5 r6) |
628 |
(r0 = (r5 != ,(charset-id 'eight-bit-control))) |
(r0 = (r5 != ,(charset-id 'eight-bit-control))) |
629 |
(if ((r5 != ,(charset-id 'eight-bit-graphic)) & r0) |
(if ((r5 != ,(charset-id 'eight-bit-graphic)) & r0) |
630 |
((write r1) ; invalid UTF-8 |
((write r1) ; invalid UTF-8 |
631 |
(r1 = -1) |
(r1 = -1) |
632 |
(end))) |
(end))) |
633 |
|
|
644 |
(r1 = -1) |
(r1 = -1) |
645 |
;; Read the 3rd byte. |
;; Read the 3rd byte. |
646 |
(read-multibyte-character r5 r6) |
(read-multibyte-character r5 r6) |
647 |
(r0 = (r5 != ,(charset-id 'eight-bit-control))) |
(r0 = (r5 != ,(charset-id 'eight-bit-control))) |
648 |
(if ((r5 != ,(charset-id 'eight-bit-graphic)) & r0) |
(if ((r5 != ,(charset-id 'eight-bit-graphic)) & r0) |
649 |
(end)) ; invalid UTF-8 |
(end)) ; invalid UTF-8 |
650 |
(write r6) |
(write r6) |
654 |
(end))) |
(end))) |
655 |
;; Read the 4th byte. |
;; Read the 4th byte. |
656 |
(read-multibyte-character r5 r6) |
(read-multibyte-character r5 r6) |
657 |
(r0 = (r5 != ,(charset-id 'eight-bit-control))) |
(r0 = (r5 != ,(charset-id 'eight-bit-control))) |
658 |
(if ((r5 != ,(charset-id 'eight-bit-graphic)) & r0) |
(if ((r5 != ,(charset-id 'eight-bit-graphic)) & r0) |
659 |
(end)) ; invalid UTF-8 |
(end)) ; invalid UTF-8 |
660 |
;; 4-byte sequence for an untranslated character. |
;; 4-byte sequence for an untranslated character. |