Mercurial > hg > xemacs-beta
comparison lisp/mule/mule-charset.el @ 777:e65d9cf16707
[xemacs-hg @ 2002-03-15 11:00:28 by ben]
config.h.in, sysdep.c, sysfile.h, systime.h: add HAVE_SYS_TIMES_H and use it to include sys/times.h, used for
struct tms in new POSIX() function times().
mule\mule-charset.el, obsolete.el, subr.el: Put back
previously-deleted truncate-string-to-width. Move other
non-Mule-specific stuff into subr.el or obsolete.el.
configure.in: check for sys/times.h.
author | ben |
---|---|
date | Fri, 15 Mar 2002 11:00:56 +0000 |
parents | 943eaba38521 |
children | 2923009caf47 |
comparison
equal
deleted
inserted
replaced
776:79940b592197 | 777:e65d9cf16707 |
---|---|
1 ;;; mule-charset.el --- Charset functions for Mule. -*- coding: iso-2022-7bit; -*- | 1 ;;; mule-charset.el --- Charset functions for Mule. -*- coding: iso-2022-7bit; -*- |
2 | 2 |
3 ;; Copyright (C) 1992 Free Software Foundation, Inc. | 3 ;; Copyright (C) 1992 Free Software Foundation, Inc. |
4 ;; Copyright (C) 1995 Amdahl Corporation. | 4 ;; Copyright (C) 1995 Amdahl Corporation. |
5 ;; Copyright (C) 1996 Sun Microsystems. | 5 ;; Copyright (C) 1996 Sun Microsystems. |
6 ;; Copyright (C) 2002 Ben Wing. | |
6 | 7 |
7 ;; Author: Unknown | 8 ;; Author: Unknown |
8 ;; Keywords: i18n, mule, internal | 9 ;; Keywords: i18n, mule, internal |
9 | 10 |
10 ;; This file is part of XEmacs. | 11 ;; This file is part of XEmacs. |
153 (defalias 'put-charset-property 'put) | 154 (defalias 'put-charset-property 'put) |
154 (defalias 'charset-plist 'object-plist) | 155 (defalias 'charset-plist 'object-plist) |
155 (defalias 'set-charset-plist 'setplist) | 156 (defalias 'set-charset-plist 'setplist) |
156 | 157 |
157 | 158 |
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 | |
208 ;; Setup auto-fill-chars for charsets that should invoke auto-filling. | 159 ;; Setup auto-fill-chars for charsets that should invoke auto-filling. |
209 ;; SPACE and NEWLIE are already set. | 160 ;; SPACE and NEWLINE are already set. |
210 (let ((l '(katakana-jisx0201 | 161 (let ((l '(katakana-jisx0201 |
211 japanese-jisx0208 japanese-jisx0212 | 162 japanese-jisx0208 japanese-jisx0212 |
212 chinese-gb2312 chinese-big5-1 chinese-big5-2))) | 163 chinese-gb2312 chinese-big5-1 chinese-big5-2))) |
213 (while l | 164 (while l |
214 (put-char-table (car l) t auto-fill-chars) | 165 (put-char-table (car l) t auto-fill-chars) |