aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Love2002-12-17 17:58:13 +0000
committerDave Love2002-12-17 17:58:13 +0000
commit0c8410d509a03e8ec4d5fe5bd51723d22fd85081 (patch)
tree4c1d903b7b6ef7b6bd8b572a1a1d2364af35208c
parentb6da19efbc72b19f993620c7159c1a93fa78002d (diff)
downloademacs-0c8410d509a03e8ec4d5fe5bd51723d22fd85081.tar.gz
emacs-0c8410d509a03e8ec4d5fe5bd51723d22fd85081.zip
(ucs-mule-cjk-to-unicode)
(ucs-unicode-to-mule-cjk): Revert last change. (utf-subst-table-for-encode): Initially use ucs-mule-cjk-to-unicode. (utf-subst-table-for-decode): Initially use ucs-unicode-to-mule-cjk. (utf-fragment-on-decoding, utf-translate-cjk): Don't modify char-coding-system-table elements destructively. (utf-translate-cjk): Set ucs-mule-cjk-to-unicode, ucs-unicode-to-mule-cjk to new hash tables with realistic parameters.
-rw-r--r--lisp/international/utf-8.el33
1 files changed, 20 insertions, 13 deletions
diff --git a/lisp/international/utf-8.el b/lisp/international/utf-8.el
index 018691b1168..477c3e29c06 100644
--- a/lisp/international/utf-8.el
+++ b/lisp/international/utf-8.el
@@ -95,25 +95,23 @@ translation-table named `utf-translation-table-for-encode'")
95(define-translation-table 'utf-translation-table-for-decode) 95(define-translation-table 'utf-translation-table-for-decode)
96 96
97 97
98(defvar ucs-mule-cjk-to-unicode (make-hash-table :test 'eq :size 43000 98(defvar ucs-mule-cjk-to-unicode (make-hash-table :test 'eq)
99 :rehash-size 1000)
100 "Hash table mapping Emacs CJK character sets to Unicode code points. 99 "Hash table mapping Emacs CJK character sets to Unicode code points.
101 100
102If `utf-translate-cjk' is non-nil, this table populates the 101If `utf-translate-cjk' is non-nil, this table populates the
103translation-hash-table named `utf-subst-table-for-encode'.") 102translation-hash-table named `utf-subst-table-for-encode'.")
104 103
105(define-translation-hash-table 'utf-subst-table-for-encode 104(define-translation-hash-table 'utf-subst-table-for-encode
106 (make-hash-table :test 'eq :size 43000 :rehash-size 1000)) 105 ucs-mule-cjk-to-unicode)
107 106
108(defvar ucs-unicode-to-mule-cjk (make-hash-table :test 'eq :size 43000 107(defvar ucs-unicode-to-mule-cjk (make-hash-table :test 'eq)
109 :rehash-size 1000)
110 "Hash table mapping Unicode code points to Emacs CJK character sets. 108 "Hash table mapping Unicode code points to Emacs CJK character sets.
111 109
112If `utf-translate-cjk' is non-nil, this table populates the 110If `utf-translate-cjk' is non-nil, this table populates the
113translation-hash-table named `utf-subst-table-for-decode'.") 111translation-hash-table named `utf-subst-table-for-decode'.")
114 112
115(define-translation-hash-table 'utf-subst-table-for-decode 113(define-translation-hash-table 'utf-subst-table-for-decode
116 (make-hash-table :test 'eq :size 21500 :rehash-size 200)) 114 ucs-unicode-to-mule-cjk)
117 115
118(mapc 116(mapc
119 (lambda (pair) 117 (lambda (pair)
@@ -194,9 +192,9 @@ Setting this variable outside customize has no effect."
194 (lambda (key val) 192 (lambda (key val)
195 (if (and (>= key 128) val) 193 (if (and (>= key 128) val)
196 (aset char-coding-system-table key 194 (aset char-coding-system-table key
197 (delq 'mule-utf-8 195 (remq 'mule-utf-8
198 (delq 'mule-utf-16-le 196 (remq 'mule-utf-16-le
199 (delq 'mule-utf-16-be 197 (remq 'mule-utf-16-be
200 (aref char-coding-system-table 198 (aref char-coding-system-table
201 key))))))) 199 key)))))))
202 utf-defragmentation-table))) 200 utf-defragmentation-table)))
@@ -222,7 +220,16 @@ The tables are large (over 40000 entries), so this option is not the
222default. Also, installing them may be rather slow." 220default. Also, installing them may be rather slow."
223 :set (lambda (s v) 221 :set (lambda (s v)
224 (if v 222 (if v
223 ;; Fixme: Allow the use of the CJK charsets to be
224 ;; customized by reordering and possible omission.
225 (progn 225 (progn
226 ;; Redefine them with realistic initial sizes and a
227 ;; smallish rehash size to avoid wasting significant
228 ;; space after they're built.
229 (setq ucs-mule-cjk-to-unicode
230 (make-hash-table :test 'eq :size 43000 :rehash-size 1000)
231 ucs-unicode-to-mule-cjk
232 (make-hash-table :test 'eq :size 43000 :rehash-size 1000))
226 ;; Load the files explicitly, to avoid having to keep 233 ;; Load the files explicitly, to avoid having to keep
227 ;; around the large tables they contain (as well as the 234 ;; around the large tables they contain (as well as the
228 ;; ones which get built). 235 ;; ones which get built).
@@ -262,9 +269,9 @@ default. Also, installing them may be rather slow."
262 (lambda (k v) 269 (lambda (k v)
263 (if (gethash k ucs-mule-cjk-to-unicode) 270 (if (gethash k ucs-mule-cjk-to-unicode)
264 (aset char-coding-system-table k 271 (aset char-coding-system-table k
265 (delq 'mule-utf-8 272 (remq 'mule-utf-8
266 (delq 'mule-utf-16-le 273 (remq 'mule-utf-16-le
267 (delq 'mule-utf-16-be v)))))) 274 (remq 'mule-utf-16-be v))))))
268 char-coding-system-table) 275 char-coding-system-table)
269 (define-translation-hash-table 'utf-subst-table-for-decode 276 (define-translation-hash-table 'utf-subst-table-for-decode
270 (make-hash-table :test 'eq)) 277 (make-hash-table :test 'eq))