aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Love <[email protected]>2002-09-10 17:40:21 +0000
committerDave Love <[email protected]>2002-09-10 17:40:21 +0000
commitd2211627e7e9e1f09cf96172d5e60df605da2b91 (patch)
tree1f50e52dedcfc3e605978c39c6f0fc4264bf70c1
parent988b5a141bf7dc222728f9036ab1378a64ab5af6 (diff)
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 bd109b3406..b32387700d 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,23 @@
+2002-09-10 Dave Love <[email protected]>
+
+ * international/utf-8.el (ucs-mule-to-mule-unicode): Define
+ unconditionally.
+ (utf-8-fragmentation-table): New. Use it in top-level mapc.
+ (utf-8-fragment-on-decoding): Use it to keep
+ utf-8-translation-table-for-decode variable and translation table
+ in sync.
+
+ * international/ucs-tables.el: 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.
+
+ * international/utf-16.el (utf-16-le-pre-write-conversion)
+ (utf-16-be-pre-write-conversion): Deleted.
+ (mule-utf-16-le, mule-utf-16-be): Register encoding translation
+ table.
+
2002-09-10 Richard M. Stallman <[email protected]>
* files.el (diff-buffer-with-file): Simplify.
diff --git a/lisp/international/ucs-tables.el b/lisp/international/ucs-tables.el
index 99307ae60e..ee78a969d9 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'.")
"Used as `translation-table-for-encode' for iso-8859-15.
Translates from the iso8859 charsets and `mule-unicode-0100-24ff'.")
-;; Probably defined by utf-8.el.
-(defvar ucs-mule-to-mule-unicode (make-translation-table))
-(unless (get 'ucs-mule-to-mule-unicode 'translation-table)
- (define-translation-table 'ucs-mule-to-mule-unicode ucs-mule-to-mule-unicode))
;;; Set up the tables.
;; 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'.")
(nreverse l))))
;; Convert the lists to the basic char tables.
- (dolist (n (list 15 14 9 8 7 5 4 3 2 1))
- (let ((alist (symbol-value (intern (format "ucs-8859-%d-alist" n)))))
- (dolist (pair alist)
- (let ((mule (car pair))
- (uc (cdr pair))
- (mu (decode-char 'ucs (cdr pair))))
- (aset ucs-mule-8859-to-ucs-table mule uc)
- ;; (aset ucs-ucs-to-mule-8859-table uc mule)
- ;; (aset ucs-mule-unicode-to-mule-8859 mu mule)
- (aset ucs-mule-8859-to-mule-unicode mule mu)
- (aset ucs-mule-to-mule-unicode mule mu)))))
- ;; The table optimizing here and elsewhere probably isn't very
- ;; useful, but seems good practice.
- (optimize-char-table ucs-mule-to-mule-unicode)
- (optimize-char-table ucs-mule-8859-to-mule-unicode)
- ;; Derive tables that can be used as per-coding-system
- ;; `translation-table-for-encode's.
- (dolist (n (list 15 14 9 8 7 5 4 3 2 1))
- (let* ((alist (symbol-value (intern (format "ucs-8859-%d-alist" n))))
- (encode-translator (set (intern (format "ucs-8859-%d-encode-table"
- n))
- (make-translation-table)))
- elt)
- ;; Start with the mule-unicode component.
- (dolist (pair alist)
- (let ((mule (car pair))
- (mu (decode-char 'ucs (cdr pair))))
- (aset encode-translator mu mule)))
- ;; Find characters from other 8859 sets which map to the same
- ;; unicode as some character in this set.
- (map-char-table (lambda (k v)
- (if (and (setq elt (rassq v alist))
- (not (assq k alist)))
- (aset encode-translator k (car elt))))
- ucs-mule-8859-to-ucs-table)
- (optimize-char-table encode-translator))))
+ ;; Ensure `decode-char' doesn't use the fragmentation table.
+ ;; Fixme: handa suggests using the RESTRICTION arg.
+ (let (utf-8-translation-table-for-decode)
+ (dolist (n (list 15 14 9 8 7 5 4 3 2 1))
+ (let ((alist (symbol-value (intern (format "ucs-8859-%d-alist" n)))))
+ (dolist (pair alist)
+ (let ((mule (car pair))
+ (uc (cdr pair))
+ (mu (decode-char 'ucs (cdr pair))))
+ (aset ucs-mule-8859-to-ucs-table mule uc)
+ ;; (aset ucs-ucs-to-mule-8859-table uc mule)
+ ;; (aset ucs-mule-unicode-to-mule-8859 mu mule)
+ (aset ucs-mule-8859-to-mule-unicode mule mu)
+ (aset ucs-mule-to-mule-unicode mule mu)))))
+ ;; Derive tables that can be used as per-coding-system
+ ;; `translation-table-for-encode's.
+ (dolist (n (list 15 14 9 8 7 5 4 3 2 1))
+ (let* ((alist (symbol-value (intern (format "ucs-8859-%d-alist" n))))
+ (encode-translator (set (intern (format "ucs-8859-%d-encode-table"
+ n))
+ (make-translation-table)))
+ elt)
+ ;; Start with the mule-unicode component.
+ (dolist (pair alist)
+ (let ((mule (car pair))
+ (mu (decode-char 'ucs (cdr pair))))
+ (aset encode-translator mu mule)))
+ ;; Find characters from other 8859 sets which map to the same
+ ;; unicode as some character in this set.
+ (map-char-table (lambda (k v)
+ (if (and (setq elt (rassq v alist))
+ (not (assq k alist)))
+ (aset encode-translator k (car elt))))
+ ucs-mule-8859-to-ucs-table)
+ (optimize-char-table encode-translator)))))
;; Register for use in CCL.
(define-translation-table 'ucs-mule-8859-to-mule-unicode
@@ -1158,10 +1153,11 @@ everything on input operations."
(unless encode-only
;; Unify 8859 on decoding. (Non-CCL coding systems only.)
(if utf-8-fragment-on-decoding
- (map-char-table
- (lambda (k v)
- (if v (aset ucs-mule-to-mule-unicode v nil)))
- utf-8-translation-table-for-decode)
+ (progn (map-char-table
+ (lambda (k v)
+ (if v (aset ucs-mule-to-mule-unicode v nil)))
+ utf-8-translation-table-for-decode)
+ (optimize-char-table ucs-mule-to-mule-unicode))
;; Reset in case it was changed.
(map-char-table
(lambda (k v)
@@ -2459,7 +2455,6 @@ Interactively, prompts for a hex string giving the code."
encode-translator))
((memq cs '(lao thai-tis620 tibetan-iso-8bit))
(coding-system-put cs 'translation-table-for-input cs)))))
- (optimize-char-table ucs-mule-to-mule-unicode)
(dolist (c safe-charsets)
(aset table (make-char c) t))
(coding-system-put 'mule-utf-8 'safe-charsets