annotate lisp/mule/mule-coding.el @ 197:acd284d43ca1 r20-3b25

Import from CVS: tag r20-3b25
author cvs
date Mon, 13 Aug 2007 10:00:02 +0200
parents 3d6bfa290dbd
children e45d5e7c476e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
1 ;;; mule-coding.el --- Coding-system functions for Mule.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
2
197
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
3 ;; Copyright (C) 1995 Electrotechnical Laboratory, JAPAN.
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
4 ;; Licensed to the Free Software Foundation.
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
5 ;; Copyright (C) 1995 Amdahl Corporation.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
6 ;; Copyright (C) 1995 Sun Microsystems.
197
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
7 ;; Copyright (C) 1997 MORIOKA Tomohiko
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
8
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
9 ;; This file is part of XEmacs.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
10
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
11 ;; XEmacs is free software; you can redistribute it and/or modify it
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
12 ;; under the terms of the GNU General Public License as published by
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
13 ;; the Free Software Foundation; either version 2, or (at your option)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
14 ;; any later version.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
15
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
16 ;; XEmacs is distributed in the hope that it will be useful, but
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
19 ;; General Public License for more details.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
20
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
22 ;; along with XEmacs; see the file COPYING. If not, write to the
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
23 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
24 ;; Boston, MA 02111-1307, USA.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
25
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
26 ;;; Commentary:
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
27
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
28 ;;; split off of mule.el.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
29
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
30 ;;; Code:
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
31
197
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
32 (defalias 'check-coding-system 'get-coding-system)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
33
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
34 (defun modify-coding-system-alist (target-type regexp coding-system)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
35 "Modify one of look up tables for finding a coding system on I/O operation.
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
36 There are three of such tables, `file-coding-system-alist',
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
37 `process-coding-system-alist', and `network-coding-system-alist'.
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
38
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
39 TARGET-TYPE specifies which of them to modify.
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
40 If it is `file', it affects `file-coding-system-alist' (which see).
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
41 If it is `process', it affects `process-coding-system-alist' (which see).
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
42 If it is `network', it affects `network-codign-system-alist' (which see).
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
43
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
44 REGEXP is a regular expression matching a target of I/O operation.
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
45 The target is a file name if TARGET-TYPE is `file', a program name if
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
46 TARGET-TYPE is `process', or a network service name or a port number
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
47 to connect to if TARGET-TYPE is `network'.
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
48
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
49 CODING-SYSTEM is a coding system to perform code conversion on the I/O
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
50 operation, or a cons cell (DECODING . ENCODING) specifying the coding systems
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
51 for decoding and encoding respectively,
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
52 or a function symbol which, when called, returns such a cons cell."
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
53 (or (memq target-type '(file process network))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
54 (error "Invalid target type: %s" target-type))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
55 (or (stringp regexp)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
56 (and (eq target-type 'network) (integerp regexp))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
57 (error "Invalid regular expression: %s" regexp))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
58 (if (symbolp coding-system)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
59 (if (not (fboundp coding-system))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
60 (progn
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
61 (check-coding-system coding-system)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
62 (setq coding-system (cons coding-system coding-system))))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
63 (check-coding-system (car coding-system))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
64 (check-coding-system (cdr coding-system)))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
65 (cond ((eq target-type 'file)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
66 (let ((slot (assoc regexp file-coding-system-alist)))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
67 (if slot
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
68 (setcdr slot coding-system)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
69 (setq file-coding-system-alist
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
70 (cons (cons regexp coding-system)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
71 file-coding-system-alist)))))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
72 ((eq target-type 'process)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
73 (let ((slot (assoc regexp process-coding-system-alist)))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
74 (if slot
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
75 (setcdr slot coding-system)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
76 (setq process-coding-system-alist
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
77 (cons (cons regexp coding-system)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
78 process-coding-system-alist)))))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
79 (t
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
80 (let ((slot (assoc regexp network-coding-system-alist)))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
81 (if slot
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
82 (setcdr slot coding-system)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
83 (setq network-coding-system-alist
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
84 (cons (cons regexp coding-system)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
85 network-coding-system-alist)))))))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
86
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 86
diff changeset
87 (defun set-keyboard-coding-system (coding-system)
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 86
diff changeset
88 "Set the coding system used for TTY keyboard input. Currently broken."
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 86
diff changeset
89 (interactive "zkeyboard-coding-system: ")
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 86
diff changeset
90 (get-coding-system coding-system) ; correctness check
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 86
diff changeset
91 (setq keyboard-coding-system coding-system)
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 86
diff changeset
92 (redraw-modeline t))
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 86
diff changeset
93
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
94 (defun set-terminal-coding-system (coding-system)
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 86
diff changeset
95 "Set the coding system used for TTY display output. Currently broken."
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
96 (interactive "zterminal-coding-system: ")
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 86
diff changeset
97 (get-coding-system coding-system) ; correctness check
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
98 (setq terminal-coding-system coding-system)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
99 (redraw-modeline t))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
100
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
101 (defun set-pathname-coding-system (coding-system)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
102 "Set the coding system used for file system path names."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
103 (interactive "zPathname-coding-system: ")
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 86
diff changeset
104 (get-coding-system coding-system) ; correctness check
197
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
105 (setq file-name-coding-system coding-system))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
106
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
107 (defun what-coding-system (start end &optional arg)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
108 "Show the encoding of text in the region.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
109 This function is meant to be called interactively;
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
110 from a Lisp program, use `detect-coding-region' instead."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
111 (interactive "r\nP")
80
1ce6082ce73f Import from CVS: tag r20-0b90
cvs
parents: 74
diff changeset
112 (princ (detect-coding-region start end)))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
113
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
114 (defun decode-coding-string (str coding-system)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
115 "Decode the string STR which is encoded in CODING-SYSTEM.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
116 Does not modify STR. Returns the decoded string on successful conversion."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
117 (with-string-as-buffer-contents
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
118 str (decode-coding-region (point-min) (point-max) coding-system)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
119
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
120 (defun encode-coding-string (str coding-system)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
121 "Encode the string STR using CODING-SYSTEM.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
122 Does not modify STR. Returns the encoded string on successful conversion."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
123 (with-string-as-buffer-contents
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
124 str (encode-coding-region (point-min) (point-max) coding-system)))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
125
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
126
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
127 ;;;; Coding system accessors
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
128
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
129 (defun coding-system-mnemonic (coding-system)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
130 "Return the 'mnemonic property of CODING-SYSTEM."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
131 (coding-system-property coding-system 'mnemonic))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
132
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 120
diff changeset
133 (defalias 'coding-system-docstring 'coding-system-doc-string)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents: 120
diff changeset
134
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
135 (defun coding-system-eol-type (coding-system)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
136 "Return the 'eol-type property of CODING-SYSTEM."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
137 (coding-system-property coding-system 'eol-type))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
138
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
139 (defun coding-system-eol-lf (coding-system)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
140 "Return the 'eol-lf property of CODING-SYSTEM."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
141 (coding-system-property coding-system 'eol-lf))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
142
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
143 (defun coding-system-eol-crlf (coding-system)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
144 "Return the 'eol-crlf property of CODING-SYSTEM."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
145 (coding-system-property coding-system 'eol-crlf))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
146
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
147 (defun coding-system-eol-cr (coding-system)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
148 "Return the 'eol-cr property of CODING-SYSTEM."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
149 (coding-system-property coding-system 'eol-cr))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
150
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
151 (defun coding-system-post-read-conversion (coding-system)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
152 "Return the 'post-read-conversion property of CODING-SYSTEM."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
153 (coding-system-property coding-system 'post-read-conversion))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
154
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
155 (defun coding-system-pre-write-conversion (coding-system)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
156 "Return the 'pre-write-conversion property of CODING-SYSTEM."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
157 (coding-system-property coding-system 'pre-write-conversion))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
158
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
159 (defun coding-system-charset (coding-system register)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
160 "Return the 'charset property of CODING-SYSTEM for the specified REGISTER."
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 86
diff changeset
161 (unless (integerp register)
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 86
diff changeset
162 (signal 'wrong-type-argument (list 'integerp register)))
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 86
diff changeset
163 (coding-system-property
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 86
diff changeset
164 coding-system
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 86
diff changeset
165 (case register
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 86
diff changeset
166 (0 'charset-g0)
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 86
diff changeset
167 (1 'charset-g1)
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 86
diff changeset
168 (2 'charset-g2)
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 86
diff changeset
169 (3 'charset-g3)
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 86
diff changeset
170 (t (signal 'args-out-of-range (list register 0 3))))))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
171
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
172 (defun coding-system-force-on-output (coding-system register)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
173 "Return the 'force-on-output property of CODING-SYSTEM for the specified REGISTER."
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 86
diff changeset
174 (unless (integerp register)
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 86
diff changeset
175 (signal 'wrong-type-argument (list 'integerp register)))
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 86
diff changeset
176 (coding-system-property
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 86
diff changeset
177 coding-system
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 86
diff changeset
178 (case register
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 86
diff changeset
179 (0 'force-g0-on-output)
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 86
diff changeset
180 (1 'force-g1-on-output)
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 86
diff changeset
181 (2 'force-g2-on-output)
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 86
diff changeset
182 (3 'force-g3-on-output)
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 86
diff changeset
183 (t (signal 'args-out-of-range (list register 0 3))))))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
184
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
185 (defun coding-system-short (coding-system)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
186 "Return the 'short property of CODING-SYSTEM."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
187 (coding-system-property coding-system 'short))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
188
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
189 (defun coding-system-no-ascii-eol (coding-system)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
190 "Return the 'no-ascii-eol property of CODING-SYSTEM."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
191 (coding-system-property coding-system 'no-ascii-eol))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
192
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
193 (defun coding-system-no-ascii-cntl (coding-system)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
194 "Return the 'no-ascii-cntl property of CODING-SYSTEM."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
195 (coding-system-property coding-system 'no-ascii-cntl))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
196
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
197 (defun coding-system-seven (coding-system)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
198 "Return the 'seven property of CODING-SYSTEM."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
199 (coding-system-property coding-system 'seven))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
200
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
201 (defun coding-system-lock-shift (coding-system)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
202 "Return the 'lock-shift property of CODING-SYSTEM."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
203 (coding-system-property coding-system 'lock-shift))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
204
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 86
diff changeset
205 ;;(defun coding-system-use-japanese-jisx0201-roman (coding-system)
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 86
diff changeset
206 ;; "Return the 'use-japanese-jisx0201-roman property of CODING-SYSTEM."
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 86
diff changeset
207 ;; (coding-system-property coding-system 'use-japanese-jisx0201-roman))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
208
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 86
diff changeset
209 ;;(defun coding-system-use-japanese-jisx0208-1978 (coding-system)
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 86
diff changeset
210 ;; "Return the 'use-japanese-jisx0208-1978 property of CODING-SYSTEM."
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 86
diff changeset
211 ;; (coding-system-property coding-system 'use-japanese-jisx0208-2978))
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
212
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
213 (defun coding-system-no-iso6429 (coding-system)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
214 "Return the 'no-iso6429 property of CODING-SYSTEM."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
215 (coding-system-property coding-system 'no-iso6429))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
216
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
217 (defun coding-system-ccl-encode (coding-system)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
218 "Return the CCL 'encode property of CODING-SYSTEM."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
219 (coding-system-property coding-system 'encode))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
220
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
221 (defun coding-system-ccl-decode (coding-system)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
222 "Return the CCL 'decode property of CODING-SYSTEM."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
223 (coding-system-property coding-system 'decode))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
224
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
225
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
226 ;;;; Definitions of predefined coding systems
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
227
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
228 (make-coding-system
120
cca96a509cfe Import from CVS: tag r20-1b12
cvs
parents: 114
diff changeset
229 'automatic-conversion 'automatic-conversion
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
230 "Automatic conversion."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
231 '(mnemonic "Auto"))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
232
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
233 (make-coding-system
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
234 'ctext 'iso2022
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
235 "Coding-system used in X as Compound Text Encoding."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
236 '(charset-g0 ascii
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
237 charset-g1 latin-iso8859-1
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
238 eol-type lf
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
239 mnemonic "CText"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
240 ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
241
102
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 86
diff changeset
242 ;;; iso-8859-1 and ctext are aliases.
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 86
diff changeset
243
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 86
diff changeset
244 (copy-coding-system 'ctext 'iso-8859-1)
a145efe76779 Import from CVS: tag r20-1b3
cvs
parents: 86
diff changeset
245
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
246 (make-coding-system
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 165
diff changeset
247 'iso-2022-8bit-ss2 'iso2022
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
248 "ISO-2022 coding system using SS2 for 96-charset in 8-bit code."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
249 '(charset-g0 ascii
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
250 charset-g1 latin-iso8859-1
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
251 charset-g2 t ;; unspecified but can be used later.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
252 short t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
253 mnemonic "ISO8/SS"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
254 ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
255
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
256 (make-coding-system
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 165
diff changeset
257 'iso-2022-7bit-ss2 'iso2022
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
258 "ISO-2022 coding system using SS2 for 96-charset in 7-bit code."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
259 '(charset-g0 ascii
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
260 charset-g2 t ;; unspecified but can be used later.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
261 seven t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
262 short t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
263 mnemonic "ISO7/SS"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
264 ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
265
185
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 165
diff changeset
266 (copy-coding-system 'iso-2022-7bit-ss2 'iso-2022-jp-2)
3d6bfa290dbd Import from CVS: tag r20-3b19
cvs
parents: 165
diff changeset
267
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
268 (make-coding-system
197
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
269 'iso-2022-7bit 'iso2022
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
270 "ISO 2022 based 7-bit encoding using only G0"
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
271 '(charset-g0 ascii
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
272 seven t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
273 short t
197
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
274 mnemonic "ISO7"))
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
275
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
276 ;; compatibility for old XEmacsen
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
277 (copy-coding-system 'iso-2022-7bit 'iso-2022-7)
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
278
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
279 (make-coding-system
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
280 'iso-2022-8 'iso2022
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
281 "ISO-2022 eight-bit coding system. No single-shift or locking-shift."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
282 '(charset-g0 ascii
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
283 charset-g1 latin-iso8859-1
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
284 short t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
285 mnemonic "ISO8"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
286 ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
287
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
288 (make-coding-system
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
289 'escape-quoted 'iso2022
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
290 "ISO-2022 eight-bit coding system with escape quoting; used for .ELC files."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
291 '(charset-g0 ascii
74
54cc21c15cbb Import from CVS: tag r20-0b32
cvs
parents: 70
diff changeset
292 charset-g1 latin-iso8859-1
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
293 eol-type lf
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
294 escape-quoted t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
295 mnemonic "ESC/Quot"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
296 ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
297
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
298 (make-coding-system
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
299 'iso-2022-lock 'iso2022
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
300 "ISO-2022 coding system using Locking-Shift for 96-charset."
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
301 '(charset-g0 ascii
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
302 charset-g1 t ;; unspecified but can be used later.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
303 seven t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
304 lock-shift t
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
305 mnemonic "ISO7/Lock"
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
306 ))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
307
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
308 ;; initialize the coding categories to something semi-reasonable
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
309 ;; so that the remaining Lisp files can contain extended characters.
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
310 ;; (They will be in ISO-7 format)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
311
86
364816949b59 Import from CVS: tag r20-0b93
cvs
parents: 80
diff changeset
312 (set-coding-priority-list '(iso-8-2 iso-8-designate iso-8-1
70
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
313 iso-7 iso-lock-shift no-conversion))
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
314
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
315 (set-coding-category-system 'iso-7 'iso-2022-7)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
316 (set-coding-category-system 'iso-8-designate 'ctext)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
317 (set-coding-category-system 'iso-8-1 'ctext)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
318 (set-coding-category-system 'iso-lock-shift 'iso-2022-lock)
131b0175ea99 Import from CVS: tag r20-0b30
cvs
parents:
diff changeset
319 (set-coding-category-system 'no-conversion 'no-conversion)
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 104
diff changeset
320
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 104
diff changeset
321 (make-compatible-variable 'enable-multibyte-characters "Unimplemented")
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 104
diff changeset
322
197
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
323 (define-obsolete-variable-alias
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
324 'pathname-coding-system 'file-name-coding-system)
acd284d43ca1 Import from CVS: tag r20-3b25
cvs
parents: 185
diff changeset
325
114
8619ce7e4c50 Import from CVS: tag r20-1b9
cvs
parents: 104
diff changeset
326 ;;; mule-coding.el ends here