193 |
(define-minor-mode utf-translate-cjk-mode |
(define-minor-mode utf-translate-cjk-mode |
194 |
"Whether the UTF based coding systems should decode/encode CJK characters. |
"Whether the UTF based coding systems should decode/encode CJK characters. |
195 |
Enabling this loads tables which allow the coding systems mule-utf-8, |
Enabling this loads tables which allow the coding systems mule-utf-8, |
196 |
mule-utf-16-le and mule-utf-16-be to encode characters in the charsets |
mule-utf-16le and mule-utf-16be to encode characters in the charsets |
197 |
`korean-ksc5601', `chinese-gb2312', `chinese-big5-1', |
`korean-ksc5601', `chinese-gb2312', `chinese-big5-1', |
198 |
`chinese-big5-2', `japanese-jisx0208' and `japanese-jisx0212', and to |
`chinese-big5-2', `japanese-jisx0208' and `japanese-jisx0212', and to |
199 |
decode the corresponding unicodes into such characters. |
decode the corresponding unicodes into such characters. |
221 |
(setq ucs-mule-cjk-to-unicode |
(setq ucs-mule-cjk-to-unicode |
222 |
(make-hash-table :test 'eq :size 43000 :rehash-size 1000) |
(make-hash-table :test 'eq :size 43000 :rehash-size 1000) |
223 |
ucs-unicode-to-mule-cjk |
ucs-unicode-to-mule-cjk |
224 |
(make-hash-table :test 'eq :size 43000 :rehash-size 1000)) |
(make-hash-table :test 'eq :size 21500 :rehash-size 1000)) |
225 |
;; Load the files explicitly, to avoid having to keep |
;; Load the files explicitly, to avoid having to keep |
226 |
;; around the large tables they contain (as well as the |
;; around the large tables they contain (as well as the |
227 |
;; ones which get built). |
;; ones which get built). |
246 |
(load "subst-gb2312") |
(load "subst-gb2312") |
247 |
(load "subst-big5") |
(load "subst-big5") |
248 |
(load "subst-jis"))) ; jis covers as much as big5, gb2312 |
(load "subst-jis"))) ; jis covers as much as big5, gb2312 |
|
(let ((table (make-char-table 'translation-table))) |
|
|
(maphash (lambda (k v) |
|
|
(aset table k t)) |
|
|
ucs-mule-cjk-to-unicode) |
|
|
(define-translation-hash-table 'utf-subst-table-for-decode |
|
|
ucs-unicode-to-mule-cjk) |
|
|
(define-translation-hash-table 'utf-subst-table-for-encode |
|
|
ucs-mule-cjk-to-unicode)) |
|
249 |
(define-translation-hash-table 'utf-subst-table-for-decode |
(define-translation-hash-table 'utf-subst-table-for-decode |
250 |
(make-hash-table :test 'eq)) |
ucs-unicode-to-mule-cjk) |
251 |
(define-translation-hash-table 'utf-subst-table-for-encode |
(define-translation-hash-table 'utf-subst-table-for-encode |
252 |
(make-hash-table :test 'eq))))) |
ucs-mule-cjk-to-unicode) |
253 |
|
(set-char-table-extra-slot (get 'utf-translation-table-for-encode |
254 |
|
'translation-table) |
255 |
|
1 ucs-mule-cjk-to-unicode)) |
256 |
|
(define-translation-hash-table 'utf-subst-table-for-decode |
257 |
|
(make-hash-table :test 'eq)) |
258 |
|
(define-translation-hash-table 'utf-subst-table-for-encode |
259 |
|
(make-hash-table :test 'eq)) |
260 |
|
(set-char-table-extra-slot (get 'utf-translation-table-for-encode |
261 |
|
'translation-table) |
262 |
|
1 nil))) |
263 |
|
|
264 |
(define-ccl-program ccl-decode-mule-utf-8 |
(define-ccl-program ccl-decode-mule-utf-8 |
265 |
;; |
;; |
448 |
|
|
449 |
;; mule-unicode-e000-ffff |
;; mule-unicode-e000-ffff |
450 |
;; Fixme: fffe and ffff are invalid. |
;; Fixme: fffe and ffff are invalid. |
451 |
((r0 = ,(charset-id 'mule-unicode-e000-ffff)) |
((r4 = r3) ; don't zap r3 |
452 |
(r3 -= #xe000) |
(lookup-integer utf-subst-table-for-decode r4 r5) |
453 |
(r3 //= 96) |
(if r7 |
454 |
(r1 = (r7 + 32)) |
;; got a translation |
455 |
(r1 += ((r3 + 32) << 7)) |
((write-multibyte-character r4 r5) |
456 |
(write-multibyte-character r0 r1))))))))) |
;; Zapped through register starvation. |
457 |
|
(r5 = ,(charset-id 'eight-bit-control))) |
458 |
|
((r0 = ,(charset-id 'mule-unicode-e000-ffff)) |
459 |
|
(r3 -= #xe000) |
460 |
|
(r3 //= 96) |
461 |
|
(r1 = (r7 + 32)) |
462 |
|
(r1 += ((r3 + 32) << 7)) |
463 |
|
(write-multibyte-character r0 r1))))))))))) |
464 |
|
|
465 |
(if (r0 < #xfe) |
(if (r0 < #xfe) |
466 |
;; 4byte encoding |
;; 4byte encoding |
763 |
(save-excursion (setq length (diacritic-post-read-conversion length))) |
(save-excursion (setq length (diacritic-post-read-conversion length))) |
764 |
(save-excursion (setq length (thai-post-read-conversion length))) |
(save-excursion (setq length (thai-post-read-conversion length))) |
765 |
(save-excursion (setq length (lao-post-read-conversion length))) |
(save-excursion (setq length (lao-post-read-conversion length))) |
766 |
(save-excursion |
(save-excursion (setq length (devanagari-post-read-conversion length))) |
767 |
(setq length (in-is13194-devanagari-post-read-conversion length)))) |
(save-excursion (setq length (malayalam-post-read-conversion length))) |
768 |
|
(save-excursion (setq length (tamil-post-read-conversion length)))) |
769 |
length) |
length) |
770 |
|
|
771 |
;; ucs-tables is preloaded |
;; ucs-tables is preloaded |
810 |
(valid-codes (0 . 255)) |
(valid-codes (0 . 255)) |
811 |
;; (pre-write-conversion . utf-8-pre-write-conversion) |
;; (pre-write-conversion . utf-8-pre-write-conversion) |
812 |
(post-read-conversion . utf-8-post-read-conversion) |
(post-read-conversion . utf-8-post-read-conversion) |
813 |
|
(translation-table-for-encode . utf-translation-table-for-encode) |
814 |
(dependency unify-8859-on-encoding-mode |
(dependency unify-8859-on-encoding-mode |
815 |
unify-8859-on-decoding-mode |
unify-8859-on-decoding-mode |
816 |
utf-fragment-on-decoding |
utf-fragment-on-decoding |
839 |
;;; `((,(string-as-multibyte "[\200-\237\240-\377]") |
;;; `((,(string-as-multibyte "[\200-\237\240-\377]") |
840 |
;;; . utf-8-compose-function)))) |
;;; . utf-8-compose-function)))) |
841 |
|
|
842 |
|
;;; arch-tag: b08735b7-753b-4ae6-b754-0f3efe4515c5 |
843 |
;;; utf-8.el ends here |
;;; utf-8.el ends here |