/[emacs]/emacs/lisp/international/ucs-tables.el
ViewVC logotype

Diff of /emacs/lisp/international/ucs-tables.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.14 by rms, Sun Jul 21 20:24:38 2002 UTC revision 1.15 by fx, Tue Sep 10 17:39:53 2002 UTC
# Line 157  Translates from the iso8859 charsets and Line 157  Translates from the iso8859 charsets and
157    "Used as `translation-table-for-encode' for iso-8859-15.    "Used as `translation-table-for-encode' for iso-8859-15.
158  Translates from the iso8859 charsets and `mule-unicode-0100-24ff'.")  Translates from the iso8859 charsets and `mule-unicode-0100-24ff'.")
159    
 ;; 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))  
160  ;;; Set up the tables.  ;;; Set up the tables.
161    
162  ;; Most of these tables were derived from ones in Mule-UCS.  ;; Most of these tables were derived from ones in Mule-UCS.
# Line 1102  Translates from the iso8859 charsets and Line 1098  Translates from the iso8859 charsets and
1098           (nreverse l))))           (nreverse l))))
1099    
1100    ;; Convert the lists to the basic char tables.    ;; Convert the lists to the basic char tables.
1101    (dolist (n (list 15 14 9 8 7 5 4 3 2 1))    ;; Ensure `decode-char' doesn't use the fragmentation table.
1102      (let ((alist (symbol-value (intern (format "ucs-8859-%d-alist" n)))))    ;; Fixme: handa suggests using the RESTRICTION arg.
1103        (dolist (pair alist)    (let (utf-8-translation-table-for-decode)
1104          (let ((mule (car pair))      (dolist (n (list 15 14 9 8 7 5 4 3 2 1))
1105                (uc (cdr pair))        (let ((alist (symbol-value (intern (format "ucs-8859-%d-alist" n)))))
1106                (mu (decode-char 'ucs (cdr pair))))          (dolist (pair alist)
1107            (aset ucs-mule-8859-to-ucs-table mule uc)            (let ((mule (car pair))
1108            ;;      (aset ucs-ucs-to-mule-8859-table uc mule)                  (uc (cdr pair))
1109            ;;      (aset ucs-mule-unicode-to-mule-8859 mu mule)                  (mu (decode-char 'ucs (cdr pair))))
1110            (aset ucs-mule-8859-to-mule-unicode mule mu)              (aset ucs-mule-8859-to-ucs-table mule uc)
1111            (aset ucs-mule-to-mule-unicode mule mu)))))              ;;    (aset ucs-ucs-to-mule-8859-table uc mule)
1112    ;; The table optimizing here and elsewhere probably isn't very              ;;    (aset ucs-mule-unicode-to-mule-8859 mu mule)
1113    ;; useful, but seems good practice.              (aset ucs-mule-8859-to-mule-unicode mule mu)
1114    (optimize-char-table ucs-mule-to-mule-unicode)              (aset ucs-mule-to-mule-unicode mule mu)))))
1115    (optimize-char-table ucs-mule-8859-to-mule-unicode)      ;; Derive tables that can be used as per-coding-system
1116    ;; Derive tables that can be used as per-coding-system      ;; `translation-table-for-encode's.
1117    ;; `translation-table-for-encode's.      (dolist (n (list 15 14 9 8 7 5 4 3 2 1))
1118    (dolist (n (list 15 14 9 8 7 5 4 3 2 1))        (let* ((alist (symbol-value (intern (format "ucs-8859-%d-alist" n))))
1119      (let* ((alist (symbol-value (intern (format "ucs-8859-%d-alist" n))))               (encode-translator (set (intern (format "ucs-8859-%d-encode-table"
1120             (encode-translator (set (intern (format "ucs-8859-%d-encode-table"                                                       n))
1121                                                     n))                                       (make-translation-table)))
1122                                     (make-translation-table)))               elt)
1123             elt)          ;; Start with the mule-unicode component.
1124        ;; Start with the mule-unicode component.          (dolist (pair alist)
1125        (dolist (pair alist)            (let ((mule (car pair))
1126          (let ((mule (car pair))                  (mu (decode-char 'ucs (cdr pair))))
1127                (mu (decode-char 'ucs (cdr pair))))              (aset encode-translator mu mule)))
1128            (aset encode-translator mu mule)))          ;; Find characters from other 8859 sets which map to the same
1129        ;; Find characters from other 8859 sets which map to the same          ;; unicode as some character in this set.
1130        ;; unicode as some character in this set.          (map-char-table (lambda (k v)
1131        (map-char-table (lambda (k v)                            (if (and (setq elt (rassq v alist))
1132                          (if (and (setq elt (rassq v alist))                                     (not (assq k alist)))
1133                                   (not (assq k alist)))                                (aset encode-translator k (car elt))))
1134                              (aset encode-translator k (car elt))))                          ucs-mule-8859-to-ucs-table)
1135                        ucs-mule-8859-to-ucs-table)          (optimize-char-table encode-translator)))))
       (optimize-char-table encode-translator))))  
1136    
1137  ;; Register for use in CCL.  ;; Register for use in CCL.
1138  (define-translation-table 'ucs-mule-8859-to-mule-unicode  (define-translation-table 'ucs-mule-8859-to-mule-unicode
# Line 1158  everything on input operations." Line 1153  everything on input operations."
1153    (unless encode-only    (unless encode-only
1154      ;; Unify 8859 on decoding.  (Non-CCL coding systems only.)      ;; Unify 8859 on decoding.  (Non-CCL coding systems only.)
1155      (if utf-8-fragment-on-decoding      (if utf-8-fragment-on-decoding
1156          (map-char-table          (progn (map-char-table
1157           (lambda (k v)                  (lambda (k v)
1158             (if v (aset ucs-mule-to-mule-unicode v nil)))                    (if v (aset ucs-mule-to-mule-unicode v nil)))
1159           utf-8-translation-table-for-decode)                  utf-8-translation-table-for-decode)
1160                   (optimize-char-table ucs-mule-to-mule-unicode))
1161        ;; Reset in case it was changed.        ;; Reset in case it was changed.
1162        (map-char-table        (map-char-table
1163         (lambda (k v)         (lambda (k v)
# Line 2459  Interactively, prompts for a hex string Line 2455  Interactively, prompts for a hex string
2455                                    encode-translator))                                    encode-translator))
2456                ((memq cs '(lao thai-tis620 tibetan-iso-8bit))                ((memq cs '(lao thai-tis620 tibetan-iso-8bit))
2457                 (coding-system-put cs 'translation-table-for-input cs)))))                 (coding-system-put cs 'translation-table-for-input cs)))))
     (optimize-char-table ucs-mule-to-mule-unicode)  
2458      (dolist (c safe-charsets)      (dolist (c safe-charsets)
2459        (aset table (make-char c) t))        (aset table (make-char c) t))
2460      (coding-system-put 'mule-utf-8 'safe-charsets      (coding-system-put 'mule-utf-8 'safe-charsets

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.15

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26