Mercurial > hg > xemacs-beta
comparison lisp/mule/mule-charset.el @ 771:943eaba38521
[xemacs-hg @ 2002-03-13 08:51:24 by ben]
The big ben-mule-21-5 check-in!
Various files were added and deleted. See CHANGES-ben-mule.
There are still some test suite failures. No crashes, though.
Many of the failures have to do with problems in the test suite itself
rather than in the actual code. I'll be addressing these in the next
day or so -- none of the test suite failures are at all critical.
Meanwhile I'll be trying to address the biggest issues -- i.e. build
or run failures, which will almost certainly happen on various platforms.
All comments should be sent to ben@xemacs.org -- use a Cc: if necessary
when sending to mailing lists. There will be pre- and post- tags,
something like
pre-ben-mule-21-5-merge-in, and
post-ben-mule-21-5-merge-in.
author | ben |
---|---|
date | Wed, 13 Mar 2002 08:54:06 +0000 |
parents | 7039e6323819 |
children | e65d9cf16707 |
comparison
equal
deleted
inserted
replaced
770:336a418893b5 | 771:943eaba38521 |
---|---|
70 (or (memq charset list) | 70 (or (memq charset list) |
71 (setq list (cons charset list))))) | 71 (setq list (cons charset list))))) |
72 (setq i (1+ i))) | 72 (setq i (1+ i))) |
73 list)) | 73 list)) |
74 | 74 |
75 (defalias 'find-charset-string 'charsets-in-string) | |
76 (defalias 'find-charset-region 'charsets-in-region) | |
75 | 77 |
76 ;;;; Charset accessors | 78 ;;;; Charset accessors |
77 | 79 |
78 (defun charset-iso-graphic-plane (charset) | 80 (defun charset-iso-graphic-plane (charset) |
79 "Return the `graphic' property of CHARSET. | 81 "Return the `graphic' property of CHARSET. |
139 (unless (or (< pos (point-min)) | 141 (unless (or (< pos (point-min)) |
140 (> pos (point-max))) | 142 (> pos (point-max))) |
141 (char-charset (char-after pos)))) | 143 (char-charset (char-after pos)))) |
142 | 144 |
143 ;; Yuck! | 145 ;; Yuck! |
144 ;; We're not going to support this. | 146 ;; We're not going to support these. |
145 ;(defun charset-info (charset) | 147 ;(defun charset-info (charset) [incredibly broken function with random vectors] |
146 ; "Return a vector of information of CHARSET. | 148 ;(defun define-charset (...) [incredibly broken function with random vectors] |
147 ;The elements of the vector are: | |
148 ; CHARSET-ID, BYTES, DIMENSION, CHARS, WIDTH, DIRECTION, | |
149 ; LEADING-CODE-BASE, LEADING-CODE-EXT, | |
150 ; ISO-FINAL-CHAR, ISO-GRAPHIC-PLANE, | |
151 ; REVERSE-CHARSET, SHORT-NAME, LONG-NAME, DESCRIPTION, | |
152 ; PLIST, | |
153 ;where | |
154 ;CHARSET-ID (integer) is the identification number of the charset. | |
155 ;BYTES (integer) is the length of multi-byte form of a character in | |
156 ; the charset: one of 1, 2, 3, and 4. | |
157 ;DIMENSION (integer) is the number of bytes to represent a character of | |
158 ;the charset: 1 or 2. | |
159 ;CHARS (integer) is the number of characters in a dimension: 94 or 96. | |
160 ;WIDTH (integer) is the number of columns a character in the charset | |
161 ; occupies on the screen: one of 0, 1, and 2. | |
162 ;DIRECTION (integer) is the rendering direction of characters in the | |
163 ; charset when rendering. If 0, render from left to right, else | |
164 ; render from right to left. | |
165 ;LEADING-CODE-BASE (integer) is the base leading-code for the | |
166 ; charset. | |
167 ;LEADING-CODE-EXT (integer) is the extended leading-code for the | |
168 ; charset. All charsets of less than 0xA0 has the value 0. | |
169 ;ISO-FINAL-CHAR (character) is the final character of the | |
170 ; corresponding ISO 2022 charset. | |
171 ;ISO-GRAPHIC-PLANE (integer) is the graphic plane to be invoked | |
172 ; while encoding to variants of ISO 2022 coding system, one of the | |
173 ; following: 0/graphic-plane-left(GL), 1/graphic-plane-right(GR). | |
174 ;REVERSE-CHARSET (integer) is the charset which differs only in | |
175 ; LEFT-TO-RIGHT value from the charset. If there's no such a | |
176 ; charset, the value is -1. | |
177 ;SHORT-NAME (string) is the short name to refer to the charset. | |
178 ;LONG-NAME (string) is the long name to refer to the charset | |
179 ;DESCRIPTION (string) is the description string of the charset. | |
180 ;PLIST (property list) may contain any type of information a user | |
181 ; want to put and get by functions `put-charset-property' and | |
182 ; `get-charset-property' respectively." | |
183 ; (vector | |
184 ; (charset-id charset) | |
185 ; 1 | |
186 ; (charset-dimension charset) | |
187 ; (charset-chars charset) | |
188 ; (charset-width charset) | |
189 ; (charset-direction charset) | |
190 ; nil ;; (charset-leading-code-base (charset)) | |
191 ; nil ;; (charset-leading-code-ext (charset)) | |
192 ; (charset-iso-final-char charset) | |
193 ; (charset-iso-graphic-plane charset) | |
194 ; -1 | |
195 ; (charset-short-name charset) | |
196 ; (charset-long-name charset) | |
197 ; (charset-description charset) | |
198 ; (charset-plist charset))) | |
199 | |
200 ;(make-compatible 'charset-info "Don't use this if you can help it.") | |
201 | |
202 (defun define-charset (charset-id charset property-vector) | |
203 "Define CHARSET-ID as the identification number of CHARSET with INFO-VECTOR. | |
204 If CHARSET-ID is nil, it is decided automatically, which means CHARSET is | |
205 treated as a private charset. | |
206 INFO-VECTOR is a vector of the format: | |
207 [DIMENSION CHARS WIDTH DIRECTION ISO-FINAL-CHAR ISO-GRAPHIC-PLANE | |
208 SHORT-NAME LONG-NAME DESCRIPTION] | |
209 The meanings of each elements is as follows: | |
210 DIMENSION (integer) is the number of bytes to represent a character: 1 or 2. | |
211 CHARS (integer) is the number of characters in a dimension: 94 or 96. | |
212 WIDTH (integer) is the number of columns a character in the charset | |
213 occupies on the screen: one of 0, 1, and 2. | |
214 | |
215 DIRECTION (integer) is the rendering direction of characters in the | |
216 charset when rendering. If 0, render from left to right, else | |
217 render from right to left. | |
218 | |
219 ISO-FINAL-CHAR (character) is the final character of the | |
220 corresponding ISO 2022 charset. | |
221 | |
222 ISO-GRAPHIC-PLANE (integer) is the graphic plane to be invoked | |
223 while encoding to variants of ISO 2022 coding system, one of the | |
224 following: 0/graphic-plane-left(GL), 1/graphic-plane-right(GR). | |
225 | |
226 | |
227 SHORT-NAME (string) is the short name to refer to the charset. | |
228 | |
229 LONG-NAME (string) is the long name to refer to the charset. | |
230 | |
231 DESCRIPTION (string) is the description string of the charset." | |
232 (make-charset charset (aref property-vector 8) | |
233 (list | |
234 'short-name (aref property-vector 6) | |
235 'long-name (aref property-vector 7) | |
236 'dimension (aref property-vector 0) | |
237 'columns (aref property-vector 2) | |
238 'chars (aref property-vector 1) | |
239 'final (aref property-vector 4) | |
240 'graphic (aref property-vector 5) | |
241 'direction (aref property-vector 3)))) | |
242 | |
243 (make-compatible 'define-charset "") | |
244 | 149 |
245 ;;; Charset property | 150 ;;; Charset property |
246 | 151 |
247 (defalias 'get-charset-property 'get) | 152 (defalias 'get-charset-property 'get) |
248 (defalias 'put-charset-property 'put) | 153 (defalias 'put-charset-property 'put) |
249 (defalias 'charset-plist 'object-plist) | 154 (defalias 'charset-plist 'object-plist) |
250 (defalias 'set-charset-plist 'setplist) | 155 (defalias 'set-charset-plist 'setplist) |
251 | 156 |
157 | |
158 (defun char-width (character) | |
159 "Return number of columns a CHARACTER occupies when displayed." | |
160 (charset-width (char-charset character))) | |
161 | |
162 ;; The following several functions are useful in GNU Emacs 20 because | |
163 ;; of the multibyte "characters" the internal representation of which | |
164 ;; leaks into Lisp. In XEmacs/Mule they are trivial and unnecessary. | |
165 ;; We provide them for compatibility reasons solely. | |
166 | |
167 (define-obsolete-function-alias 'sref 'aref) | |
168 (defun char-bytes (character) | |
169 "Return number of bytes a CHARACTER occupies in a string or buffer. | |
170 It always returns 1 in XEmacs, and in recent FSF Emacs versions." | |
171 1) | |
172 (make-obsolete 'char-bytes "This function always returns 1") | |
173 | |
174 (defun string-to-sequence (string type) | |
175 "Convert STRING to a sequence of TYPE which contains characters in STRING. | |
176 TYPE should be `list' or `vector'. | |
177 Multibyte characters are concerned." | |
178 (ecase type | |
179 (list | |
180 (mapcar #'identity string)) | |
181 (vector | |
182 (mapvector #'identity string)))) | |
183 | |
184 (defun string-to-list (string) | |
185 "Return a list of characters in STRING." | |
186 (mapcar #'identity string)) | |
187 | |
188 (defun string-to-vector (string) | |
189 "Return a vector of characters in STRING." | |
190 (mapvector #'identity string)) | |
191 | |
192 (defun store-substring (string idx obj) | |
193 "Embed OBJ (string or character) at index IDX of STRING." | |
194 (let* ((str (cond ((stringp obj) obj) | |
195 ((characterp obj) (char-to-string obj)) | |
196 (t (error | |
197 "Invalid argument (should be string or character): %s" | |
198 obj)))) | |
199 (string-len (length string)) | |
200 (len (length str)) | |
201 (i 0)) | |
202 (while (and (< i len) (< idx string-len)) | |
203 (aset string idx (aref str i)) | |
204 (setq idx (1+ idx) i (1+ i))) | |
205 string)) | |
206 | |
207 | |
252 ;; Setup auto-fill-chars for charsets that should invoke auto-filling. | 208 ;; Setup auto-fill-chars for charsets that should invoke auto-filling. |
253 ;; SPACE and NEWLIE are already set. | 209 ;; SPACE and NEWLIE are already set. |
254 (let ((l '(katakana-jisx0201 | 210 (let ((l '(katakana-jisx0201 |
255 japanese-jisx0208 japanese-jisx0212 | 211 japanese-jisx0208 japanese-jisx0212 |
256 chinese-gb2312 chinese-big5-1 chinese-big5-2))) | 212 chinese-gb2312 chinese-big5-1 chinese-big5-2))) |