aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Love2002-09-10 17:40:21 +0000
committerDave Love2002-09-10 17:40:21 +0000
commitd2211627e7e9e1f09cf96172d5e60df605da2b91 (patch)
tree1f50e52dedcfc3e605978c39c6f0fc4264bf70c1
parent988b5a141bf7dc222728f9036ab1378a64ab5af6 (diff)
downloademacs-d2211627e7e9e1f09cf96172d5e60df605da2b91.tar.gz
emacs-d2211627e7e9e1f09cf96172d5e60df605da2b91.zip
Bind
utf-8-translation-table-for-decode when setting up tables and remove useless optimize-char-table. (ucs-mule-to-mule-unicode): Deleted. (ucs-unify-8859): Maybe optimize ucs-mule-to-mule-unicode.
-rw-r--r--lisp/ChangeLog20
-rw-r--r--lisp/international/ucs-tables.el85
2 files changed, 60 insertions, 45 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index bd109b3406c..b32387700de 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,23 @@
12002-09-10 Dave Love <fx@gnu.org>
2
3 * international/utf-8.el (ucs-mule-to-mule-unicode): Define
4 unconditionally.
5 (utf-8-fragmentation-table): New. Use it in top-level mapc.
6 (utf-8-fragment-on-decoding): Use it to keep
7 utf-8-translation-table-for-decode variable and translation table
8 in sync.
9
10 * international/ucs-tables.el: Bind
11 utf-8-translation-table-for-decode when setting up tables and
12 remove useless optimize-char-table.
13 (ucs-mule-to-mule-unicode): Deleted.
14 (ucs-unify-8859): Maybe optimize ucs-mule-to-mule-unicode.
15
16 * international/utf-16.el (utf-16-le-pre-write-conversion)
17 (utf-16-be-pre-write-conversion): Deleted.
18 (mule-utf-16-le, mule-utf-16-be): Register encoding translation
19 table.
20
12002-09-10 Richard M. Stallman <rms@gnu.org> 212002-09-10 Richard M. Stallman <rms@gnu.org>
2 22
3 * files.el (diff-buffer-with-file): Simplify. 23 * files.el (diff-buffer-with-file): Simplify.
diff --git a/lisp/international/ucs-tables.el b/lisp/international/ucs-tables.el
index 99307ae60ea..ee78a969d9b 100644
--- a/lisp/international/ucs-tables.el
+++ b/lisp/international/ucs-tables.el
@@ -157,10 +157,6 @@ Translates from the iso8859 charsets and `mule-unicode-0100-24ff'.")
157 "Used as `translation-table-for-encode' for iso-8859-15. 157 "Used as `translation-table-for-encode' for iso-8859-15.
158Translates from the iso8859 charsets and `mule-unicode-0100-24ff'.") 158Translates from the iso8859 charsets and `mule-unicode-0100-24ff'.")
159 159
160;; Probably defined by utf-8.el.
161(defvar ucs-mule-to-mule-unicode (make-translation-table))
162(unless (get 'ucs-mule-to-mule-unicode 'translation-table)
163 (define-translation-table 'ucs-mule-to-mule-unicode ucs-mule-to-mule-unicode))
164;;; Set up the tables. 160;;; Set up the tables.
165 161
166;; Most of these tables were derived from ones in Mule-UCS. 162;; Most of these tables were derived from ones in Mule-UCS.
@@ -1102,42 +1098,41 @@ Translates from the iso8859 charsets and `mule-unicode-0100-24ff'.")
1102 (nreverse l)))) 1098 (nreverse l))))
1103 1099
1104 ;; Convert the lists to the basic char tables. 1100 ;; Convert the lists to the basic char tables.
1105 (dolist (n (list 15 14 9 8 7 5 4 3 2 1)) 1101 ;; Ensure `decode-char' doesn't use the fragmentation table.
1106 (let ((alist (symbol-value (intern (format "ucs-8859-%d-alist" n))))) 1102 ;; Fixme: handa suggests using the RESTRICTION arg.
1107 (dolist (pair alist) 1103 (let (utf-8-translation-table-for-decode)
1108 (let ((mule (car pair)) 1104 (dolist (n (list 15 14 9 8 7 5 4 3 2 1))
1109 (uc (cdr pair)) 1105 (let ((alist (symbol-value (intern (format "ucs-8859-%d-alist" n)))))
1110 (mu (decode-char 'ucs (cdr pair)))) 1106 (dolist (pair alist)
1111 (aset ucs-mule-8859-to-ucs-table mule uc) 1107 (let ((mule (car pair))
1112 ;; (aset ucs-ucs-to-mule-8859-table uc mule) 1108 (uc (cdr pair))
1113 ;; (aset ucs-mule-unicode-to-mule-8859 mu mule) 1109 (mu (decode-char 'ucs (cdr pair))))
1114 (aset ucs-mule-8859-to-mule-unicode mule mu) 1110 (aset ucs-mule-8859-to-ucs-table mule uc)
1115 (aset ucs-mule-to-mule-unicode mule mu))))) 1111 ;; (aset ucs-ucs-to-mule-8859-table uc mule)
1116 ;; The table optimizing here and elsewhere probably isn't very 1112 ;; (aset ucs-mule-unicode-to-mule-8859 mu mule)
1117 ;; useful, but seems good practice. 1113 (aset ucs-mule-8859-to-mule-unicode mule mu)
1118 (optimize-char-table ucs-mule-to-mule-unicode) 1114 (aset ucs-mule-to-mule-unicode mule mu)))))
1119 (optimize-char-table ucs-mule-8859-to-mule-unicode) 1115 ;; Derive tables that can be used as per-coding-system
1120 ;; Derive tables that can be used as per-coding-system 1116 ;; `translation-table-for-encode's.
1121 ;; `translation-table-for-encode's. 1117 (dolist (n (list 15 14 9 8 7 5 4 3 2 1))
1122 (dolist (n (list 15 14 9 8 7 5 4 3 2 1)) 1118 (let* ((alist (symbol-value (intern (format "ucs-8859-%d-alist" n))))
1123 (let* ((alist (symbol-value (intern (format "ucs-8859-%d-alist" n)))) 1119 (encode-translator (set (intern (format "ucs-8859-%d-encode-table"
1124 (encode-translator (set (intern (format "ucs-8859-%d-encode-table" 1120 n))
1125 n)) 1121 (make-translation-table)))
1126 (make-translation-table))) 1122 elt)
1127 elt) 1123 ;; Start with the mule-unicode component.
1128 ;; Start with the mule-unicode component. 1124 (dolist (pair alist)
1129 (dolist (pair alist) 1125 (let ((mule (car pair))
1130 (let ((mule (car pair)) 1126 (mu (decode-char 'ucs (cdr pair))))
1131 (mu (decode-char 'ucs (cdr pair)))) 1127 (aset encode-translator mu mule)))
1132 (aset encode-translator mu mule))) 1128 ;; Find characters from other 8859 sets which map to the same
1133 ;; Find characters from other 8859 sets which map to the same 1129 ;; unicode as some character in this set.
1134 ;; unicode as some character in this set. 1130 (map-char-table (lambda (k v)
1135 (map-char-table (lambda (k v) 1131 (if (and (setq elt (rassq v alist))
1136 (if (and (setq elt (rassq v alist)) 1132 (not (assq k alist)))
1137 (not (assq k alist))) 1133 (aset encode-translator k (car elt))))
1138 (aset encode-translator k (car elt)))) 1134 ucs-mule-8859-to-ucs-table)
1139 ucs-mule-8859-to-ucs-table) 1135 (optimize-char-table encode-translator)))))
1140 (optimize-char-table encode-translator))))
1141 1136
1142;; Register for use in CCL. 1137;; Register for use in CCL.
1143(define-translation-table 'ucs-mule-8859-to-mule-unicode 1138(define-translation-table 'ucs-mule-8859-to-mule-unicode
@@ -1158,10 +1153,11 @@ everything on input operations."
1158 (unless encode-only 1153 (unless encode-only
1159 ;; Unify 8859 on decoding. (Non-CCL coding systems only.) 1154 ;; Unify 8859 on decoding. (Non-CCL coding systems only.)
1160 (if utf-8-fragment-on-decoding 1155 (if utf-8-fragment-on-decoding
1161 (map-char-table 1156 (progn (map-char-table
1162 (lambda (k v) 1157 (lambda (k v)
1163 (if v (aset ucs-mule-to-mule-unicode v nil))) 1158 (if v (aset ucs-mule-to-mule-unicode v nil)))
1164 utf-8-translation-table-for-decode) 1159 utf-8-translation-table-for-decode)
1160 (optimize-char-table ucs-mule-to-mule-unicode))
1165 ;; Reset in case it was changed. 1161 ;; Reset in case it was changed.
1166 (map-char-table 1162 (map-char-table
1167 (lambda (k v) 1163 (lambda (k v)
@@ -2459,7 +2455,6 @@ Interactively, prompts for a hex string giving the code."
2459 encode-translator)) 2455 encode-translator))
2460 ((memq cs '(lao thai-tis620 tibetan-iso-8bit)) 2456 ((memq cs '(lao thai-tis620 tibetan-iso-8bit))
2461 (coding-system-put cs 'translation-table-for-input cs))))) 2457 (coding-system-put cs 'translation-table-for-input cs)))))
2462 (optimize-char-table ucs-mule-to-mule-unicode)
2463 (dolist (c safe-charsets) 2458 (dolist (c safe-charsets)
2464 (aset table (make-char c) t)) 2459 (aset table (make-char c) t))
2465 (coding-system-put 'mule-utf-8 'safe-charsets 2460 (coding-system-put 'mule-utf-8 'safe-charsets