502
|
1 ;;; mule-coding.el --- Coding-system functions for Mule. -*- coding: iso-2022-7bit; -*-
|
333
|
2
|
|
3 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN.
|
|
4 ;; Licensed to the Free Software Foundation.
|
|
5 ;; Copyright (C) 1995 Amdahl Corporation.
|
|
6 ;; Copyright (C) 1995 Sun Microsystems.
|
|
7 ;; Copyright (C) 1997 MORIOKA Tomohiko
|
|
8
|
|
9 ;; This file is part of XEmacs.
|
|
10
|
|
11 ;; XEmacs is free software; you can redistribute it and/or modify it
|
|
12 ;; under the terms of the GNU General Public License as published by
|
|
13 ;; the Free Software Foundation; either version 2, or (at your option)
|
|
14 ;; any later version.
|
|
15
|
|
16 ;; XEmacs is distributed in the hope that it will be useful, but
|
|
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
19 ;; General Public License for more details.
|
|
20
|
|
21 ;; You should have received a copy of the GNU General Public License
|
444
|
22 ;; along with XEmacs; see the file COPYING. If not, write to the
|
333
|
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
24 ;; Boston, MA 02111-1307, USA.
|
|
25
|
|
26 ;;; Commentary:
|
|
27
|
|
28 ;;; split off of mule.el and mostly moved to coding.el
|
|
29
|
|
30 ;;; Code:
|
|
31
|
|
32 (defun coding-system-force-on-output (coding-system register)
|
|
33 "Return the 'force-on-output property of CODING-SYSTEM for the specified REGISTER."
|
444
|
34 (check-type register integer)
|
333
|
35 (coding-system-property
|
|
36 coding-system
|
|
37 (case register
|
|
38 (0 'force-g0-on-output)
|
|
39 (1 'force-g1-on-output)
|
|
40 (2 'force-g2-on-output)
|
|
41 (3 'force-g3-on-output)
|
|
42 (t (signal 'args-out-of-range (list register 0 3))))))
|
|
43
|
|
44 (defun coding-system-short (coding-system)
|
|
45 "Return the 'short property of CODING-SYSTEM."
|
|
46 (coding-system-property coding-system 'short))
|
|
47
|
|
48 (defun coding-system-no-ascii-eol (coding-system)
|
|
49 "Return the 'no-ascii-eol property of CODING-SYSTEM."
|
|
50 (coding-system-property coding-system 'no-ascii-eol))
|
|
51
|
|
52 (defun coding-system-no-ascii-cntl (coding-system)
|
|
53 "Return the 'no-ascii-cntl property of CODING-SYSTEM."
|
|
54 (coding-system-property coding-system 'no-ascii-cntl))
|
|
55
|
|
56 (defun coding-system-seven (coding-system)
|
|
57 "Return the 'seven property of CODING-SYSTEM."
|
|
58 (coding-system-property coding-system 'seven))
|
|
59
|
|
60 (defun coding-system-lock-shift (coding-system)
|
|
61 "Return the 'lock-shift property of CODING-SYSTEM."
|
|
62 (coding-system-property coding-system 'lock-shift))
|
|
63
|
528
|
64 (defun coding-system-charset (coding-system register)
|
|
65 "Return the charset initially designated to REGISTER in CODING-SYSTEM.
|
|
66 The allowable range of REGISTER is 0 through 3."
|
|
67 (if (or (< register 0) (> register 3))
|
|
68 (error 'args-out-of-range "coding-system-charset REGISTER" register 0 3))
|
|
69 (coding-system-property coding-system (nth register '(charset-g0
|
|
70 charset-g1
|
|
71 charset-g2
|
|
72 charset-g3))))
|
|
73
|
333
|
74 ;;(defun coding-system-use-japanese-jisx0201-roman (coding-system)
|
|
75 ;; "Return the 'use-japanese-jisx0201-roman property of CODING-SYSTEM."
|
|
76 ;; (coding-system-property coding-system 'use-japanese-jisx0201-roman))
|
|
77
|
|
78 ;;(defun coding-system-use-japanese-jisx0208-1978 (coding-system)
|
|
79 ;; "Return the 'use-japanese-jisx0208-1978 property of CODING-SYSTEM."
|
|
80 ;; (coding-system-property coding-system 'use-japanese-jisx0208-2978))
|
|
81
|
|
82 (defun coding-system-no-iso6429 (coding-system)
|
|
83 "Return the 'no-iso6429 property of CODING-SYSTEM."
|
|
84 (coding-system-property coding-system 'no-iso6429))
|
|
85
|
|
86 (defun coding-system-ccl-encode (coding-system)
|
|
87 "Return the CCL 'encode property of CODING-SYSTEM."
|
|
88 (coding-system-property coding-system 'encode))
|
|
89
|
|
90 (defun coding-system-ccl-decode (coding-system)
|
|
91 "Return the CCL 'decode property of CODING-SYSTEM."
|
|
92 (coding-system-property coding-system 'decode))
|
|
93
|
|
94
|
|
95 ;;;; Definitions of predefined coding systems
|
|
96
|
|
97 (make-coding-system
|
|
98 'ctext 'iso2022
|
|
99 "Coding-system used in X as Compound Text Encoding."
|
|
100 '(charset-g0 ascii
|
|
101 charset-g1 latin-iso8859-1
|
|
102 eol-type nil
|
|
103 mnemonic "CText"))
|
|
104
|
|
105 ;;; iso-8859-1 and ctext are aliases.
|
|
106
|
|
107 ;; (copy-coding-system 'ctext 'iso-8859-1)
|
|
108 (make-coding-system
|
|
109 'iso-8859-1 'no-conversion
|
|
110 "Coding-system used in X as Compound Text Encoding."
|
|
111 '(eol-type nil mnemonic "Noconv"))
|
|
112
|
|
113 (make-coding-system
|
|
114 'iso-2022-8bit-ss2 'iso2022
|
|
115 "ISO-2022 coding system using SS2 for 96-charset in 8-bit code."
|
|
116 '(charset-g0 ascii
|
|
117 charset-g1 latin-iso8859-1
|
|
118 charset-g2 t ;; unspecified but can be used later.
|
|
119 short t
|
|
120 mnemonic "ISO8/SS"
|
|
121 ))
|
|
122
|
|
123 (make-coding-system
|
|
124 'iso-2022-7bit-ss2 'iso2022
|
|
125 "ISO-2022 coding system using SS2 for 96-charset in 7-bit code."
|
|
126 '(charset-g0 ascii
|
|
127 charset-g2 t ;; unspecified but can be used later.
|
|
128 seven t
|
|
129 short t
|
|
130 mnemonic "ISO7/SS"
|
|
131 eol-type nil))
|
|
132
|
|
133 ;; (copy-coding-system 'iso-2022-7bit-ss2 'iso-2022-jp-2)
|
|
134 (make-coding-system
|
|
135 'iso-2022-jp-2 'iso2022
|
|
136 "ISO-2022 coding system using SS2 for 96-charset in 7-bit code."
|
|
137 '(charset-g0 ascii
|
|
138 charset-g2 t ;; unspecified but can be used later.
|
|
139 seven t
|
|
140 short t
|
|
141 mnemonic "ISO7/SS"
|
|
142 eol-type nil))
|
|
143
|
|
144 (make-coding-system
|
|
145 'iso-2022-7bit 'iso2022
|
|
146 "ISO 2022 based 7-bit encoding using only G0"
|
|
147 '(charset-g0 ascii
|
|
148 seven t
|
|
149 short t
|
|
150 mnemonic "ISO7"))
|
|
151
|
|
152 ;; compatibility for old XEmacsen
|
|
153 (copy-coding-system 'iso-2022-7bit 'iso-2022-7)
|
|
154
|
|
155 (make-coding-system
|
|
156 'iso-2022-8 'iso2022
|
|
157 "ISO-2022 eight-bit coding system. No single-shift or locking-shift."
|
|
158 '(charset-g0 ascii
|
|
159 charset-g1 latin-iso8859-1
|
|
160 short t
|
|
161 mnemonic "ISO8"
|
|
162 ))
|
|
163
|
|
164 (make-coding-system
|
|
165 'escape-quoted 'iso2022
|
|
166 "ISO-2022 eight-bit coding system with escape quoting; used for .ELC files."
|
|
167 '(charset-g0 ascii
|
|
168 charset-g1 latin-iso8859-1
|
|
169 eol-type lf
|
|
170 escape-quoted t
|
|
171 mnemonic "ESC/Quot"
|
|
172 ))
|
|
173
|
|
174 (make-coding-system
|
|
175 'iso-2022-lock 'iso2022
|
|
176 "ISO-2022 coding system using Locking-Shift for 96-charset."
|
|
177 '(charset-g0 ascii
|
|
178 charset-g1 t ;; unspecified but can be used later.
|
|
179 seven t
|
|
180 lock-shift t
|
|
181 mnemonic "ISO7/Lock"
|
|
182 ))
|
|
183
|
|
184 ;; initialize the coding categories to something semi-reasonable
|
|
185 ;; so that the remaining Lisp files can contain extended characters.
|
|
186 ;; (They will be in ISO-7 format)
|
448
|
187 ;; #### This list needs to be synched with the ones in mule-cmds.el.
|
333
|
188
|
448
|
189 (set-coding-priority-list '(iso-7
|
|
190 no-conversion
|
|
191 ;; utf-8
|
|
192 iso-8-1
|
|
193 iso-8-2
|
|
194 iso-8-designate
|
|
195 iso-lock-shift
|
|
196 shift-jis
|
|
197 big5
|
|
198 ;; ucs-4
|
|
199 ))
|
333
|
200
|
|
201 (set-coding-category-system 'iso-7 'iso-2022-7)
|
|
202 (set-coding-category-system 'iso-8-designate 'ctext)
|
|
203 (set-coding-category-system 'iso-8-1 'ctext)
|
|
204 (set-coding-category-system 'iso-lock-shift 'iso-2022-lock)
|
|
205 (set-coding-category-system 'no-conversion 'no-conversion)
|
|
206
|
442
|
207 (setq-default buffer-file-coding-system 'iso-2022-8)
|
|
208
|
333
|
209 ;;; mule-coding.el ends here
|