comparison lisp/international/mule.el @ 22186:fc4aaf1b1772

Change term "character translation table" to "translation table".
author Kenichi Handa <handa@m17n.org>
date Fri, 22 May 1998 09:45:34 +0000
parents c1998807c140
children 6f56af1aab96
comparison
equal deleted inserted replaced
22185:80a2aa51a6e1 22186:fc4aaf1b1772
326 ;; called, and before the text is encoded by the coding system itself. 326 ;; called, and before the text is encoded by the coding system itself.
327 ;; The arguments to this function is the same as those of a function 327 ;; The arguments to this function is the same as those of a function
328 ;; in `write-region-annotate-functions', i.e. FROM and TO specifying 328 ;; in `write-region-annotate-functions', i.e. FROM and TO specifying
329 ;; region of a text. 329 ;; region of a text.
330 ;; 330 ;;
331 ;; o character-translation-table-for-decode 331 ;; o translation-table-for-decode
332 ;; 332 ;;
333 ;; The value is a character translation table to be applied on 333 ;; The value is a translation table to be applied on decoding. See
334 ;; decoding. See the function `make-translation-table' for the format 334 ;; the function `make-translation-table' for the format of translation
335 ;; of translation table. 335 ;; table.
336 ;; 336 ;;
337 ;; o character-translation-table-for-encode 337 ;; o translation-table-for-encode
338 ;; 338 ;;
339 ;; The value is a character translation table to be applied on 339 ;; The value is a translation table to be applied on encoding.
340 ;; encoding.
341 ;; 340 ;;
342 ;; o safe-charsets 341 ;; o safe-charsets
343 ;; 342 ;;
344 ;; The value is a list of charsets safely supported by the coding 343 ;; The value is a list of charsets safely supported by the coding
345 ;; system. The value t means that all charsets Emacs handles are 344 ;; system. The value t means that all charsets Emacs handles are
985 (setq network-coding-system-alist 984 (setq network-coding-system-alist
986 (cons (cons regexp coding-system) 985 (cons (cons regexp coding-system)
987 network-coding-system-alist))))))) 986 network-coding-system-alist)))))))
988 987
989 (defun make-translation-table (&rest args) 988 (defun make-translation-table (&rest args)
990 "Make a character translation table (char table) from arguments. 989 "Make a translation table (char table) from arguments.
991 Each argument is a list of the form (FROM . TO), 990 Each argument is a list of the form (FROM . TO),
992 where FROM is a character to be translated to TO. 991 where FROM is a character to be translated to TO.
993 992
994 FROM can be a generic character (see make-char). In this case, TO is 993 FROM can be a generic character (see make-char). In this case, TO is
995 a generic character containing the same number of charcters or a 994 a generic character containing the same number of charcters or a
996 oridinal character. If FROM and TO are both generic characters, all 995 oridinal character. If FROM and TO are both generic characters, all
997 characters belonging to FROM are translated to characters belonging to TO 996 characters belonging to FROM are translated to characters belonging to TO
998 without changing their position code(s)." 997 without changing their position code(s)."
999 (let ((table (make-char-table 'character-translation-table)) 998 (let ((table (make-char-table 'translation-table))
1000 revlist) 999 revlist)
1001 (while args 1000 (while args
1002 (let ((elts (car args))) 1001 (let ((elts (car args)))
1003 (while elts 1002 (while elts
1004 (let* ((from (car (car elts))) 1003 (let* ((from (car (car elts)))
1043 (setq elts (cdr elts)))) 1042 (setq elts (cdr elts))))
1044 (setq args (cdr args))) 1043 (setq args (cdr args)))
1045 ;; Return TABLE just created. 1044 ;; Return TABLE just created.
1046 table)) 1045 table))
1047 1046
1048 (defun define-character-translation-table (symbol &rest args) 1047 (defun define-translation-table (symbol &rest args)
1049 "Define SYMBOL as a name of character translation table makde by ARGS. 1048 "Define SYMBOL as a name of translation table makde by ARGS.
1050 1049
1051 See the documentation of the function `make-translation-table' for the 1050 See the documentation of the function `make-translation-table' for the
1052 meaning of ARGS. 1051 meaning of ARGS.
1053 1052
1054 This function sets properties character-translation-table and 1053 This function sets properties translation-table and
1055 character-translation-table-id of SYMBOL to the created table itself 1054 translation-table-id of SYMBOL to the created table itself and
1056 and identification number of the table respectively." 1055 identification number of the table respectively."
1057 (let ((table (apply 'make-translation-table args)) 1056 (let ((table (apply 'make-translation-table args))
1058 (len (length character-translation-table-vector)) 1057 (len (length translation-table-vector))
1059 (id 0) 1058 (id 0)
1060 (done nil)) 1059 (done nil))
1061 (put symbol 'character-translation-table table) 1060 (put symbol 'translation-table table)
1062 (while (not done) 1061 (while (not done)
1063 (if (>= id len) 1062 (if (>= id len)
1064 (setq character-translation-table-vector 1063 (setq translation-table-vector
1065 (vconcat character-translation-table-vector 1064 (vconcat translation-table-vector (make-vector len nil))))
1066 (make-vector len nil)))) 1065 (let ((slot (aref translation-table-vector id)))
1067 (let ((slot (aref character-translation-table-vector id)))
1068 (if (or (not slot) 1066 (if (or (not slot)
1069 (eq (car slot) symbol)) 1067 (eq (car slot) symbol))
1070 (progn 1068 (progn
1071 (aset character-translation-table-vector id (cons symbol table)) 1069 (aset translation-table-vector id (cons symbol table))
1072 (setq done t)))) 1070 (setq done t))))
1073 (setq id (1+ id))) 1071 (setq id (1+ id)))
1074 (put symbol 'character-translation-table-id id) 1072 (put symbol 'translation-table-id id)
1075 id)) 1073 id))
1076 1074
1077 ;;; Initialize some variables. 1075 ;;; Initialize some variables.
1078 1076
1079 (put 'use-default-ascent 'char-table-extra-slots 0) 1077 (put 'use-default-ascent 'char-table-extra-slots 0)