1 ;;; -*- byte-compile-dynamic: t;coding: iso-2022-7bit -*-
2 ;;; un-supple.el --- Supplemental translation rules for
3 ;;; other conversions than Unicode Consortium's definition.
5 ;; Copyright (C) 2000 Miyashita Hisashi
7 ;; Keywords: mule, multilingual,
8 ;; character set, coding-system, ISO/IEC 10646,
9 ;; Unicode, JIS X 0221, JDK, Japanese-EUC, Windows.
11 ;; This file is part of Mule-UCS
13 ;; Mule-UCS is free software; you can redistribute it and/or modify
14 ;; it under the terms of the GNU General Public License as published by
15 ;; the Free Software Foundation; either version 2, or (at your option)
18 ;; Mule-UCS is distributed in the hope that it will be useful,
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ;; GNU General Public License for more details.
23 ;; You should have received a copy of the GNU General Public License
24 ;; along with this program; see the file COPYING. If not, write to the
25 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
26 ;; Boston, MA 02111-1307, USA.
30 ;; There should be no need for this file, as opposed to un-define.el, to
31 ;; ever be loaded by a 21.5 XEmacs, which is why we don't provide the
32 ;; mucs-ignore-version-incompatiblities workaround to suppress this error.
33 (if (fboundp 'unicode-precedence-list)
34 (error "Your XEmacs version is incompatible with Mule-UCS; not loaded."))
36 (let ((mucs-ignore-version-incompatibilities t))
39 (defvar un-supple-current-translation-rule nil)
42 (mucs-require-data 'usupple))
47 (defvar un-supple-translation-rule-alist
48 '((jisx0221 . unicode-translation-rule-for-jisx0221)
49 (jdk . unicode-translation-rule-for-jdk)
50 (windows . unicode-translation-rule-for-windows)))
52 (defun un-supple-reconstruct-tr-def (tr-def sup-tr-rule)
53 (let* ((tr1 (copy-sequence tr-def))
57 (unicode-get-translation-rule-from-charset
59 un-supple-translation-rule-alist))
62 '(unicode-translation-rule-for-fullwidth-or-halfwidth-normalization))
63 (if (mucs-ccl-inspect-facility 'valid-map-multiple)
69 (if (setq ins (rassq (car tr2) alist))
72 (setq tr2 (cdr tr2))))
74 (error "Cannot find out apropriate location in %S"
76 (cond ((eq (car ins) 'ascii)
78 (setcdr slot (cons sup-tr-rule
81 (setq tr1 (delq (cdr ins) tr1)))
83 (setcar slot sup-tr-rule)))
86 (defmacro un-supple-embed-translation-macro (tr)
87 `(tae-embed-for-dynamic-modification
88 'unicode-basic-translation-rule
89 (un-supple-reconstruct-tr-def
90 (tae-get-translation-definition
91 'unicode-basic-translation-rule)
96 (mucs-import-package un-define)
97 (un-supple-embed-translation-macro
98 unicode-translation-rule-for-jisx0221)
99 (un-supple-embed-translation-macro
100 unicode-translation-rule-for-jdk)
101 (un-supple-embed-translation-macro
102 unicode-translation-rule-for-windows)
103 (un-supple-embed-translation-macro
104 unicode-translation-rule-for-fullwidth-or-halfwidth-normalization))
106 ;; interface functions
108 (defun un-supple-modify-translation-rule (sup-tr base-tr)
109 (tae-modify-translation
111 (un-supple-reconstruct-tr-def
112 (tae-get-translation-definition base-tr)
115 (defun un-supple-enable (sup)
121 un-supple-translation-rule-alist)))
123 (error "Unknown supplemental translation for %S" sup))))
124 (un-supple-modify-translation-rule
125 tr 'unicode-basic-translation-rule)))
129 ;;; un-supple ends here.