Mercurial > hg > xemacs-beta
diff 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 |
line wrap: on
line diff
--- a/lisp/mule/mule-charset.el Fri Mar 08 13:33:14 2002 +0000 +++ b/lisp/mule/mule-charset.el Wed Mar 13 08:54:06 2002 +0000 @@ -72,6 +72,8 @@ (setq i (1+ i))) list)) +(defalias 'find-charset-string 'charsets-in-string) +(defalias 'find-charset-region 'charsets-in-region) ;;;; Charset accessors @@ -141,106 +143,9 @@ (char-charset (char-after pos)))) ;; Yuck! -;; We're not going to support this. -;(defun charset-info (charset) -; "Return a vector of information of CHARSET. -;The elements of the vector are: -; CHARSET-ID, BYTES, DIMENSION, CHARS, WIDTH, DIRECTION, -; LEADING-CODE-BASE, LEADING-CODE-EXT, -; ISO-FINAL-CHAR, ISO-GRAPHIC-PLANE, -; REVERSE-CHARSET, SHORT-NAME, LONG-NAME, DESCRIPTION, -; PLIST, -;where -;CHARSET-ID (integer) is the identification number of the charset. -;BYTES (integer) is the length of multi-byte form of a character in -; the charset: one of 1, 2, 3, and 4. -;DIMENSION (integer) is the number of bytes to represent a character of -;the charset: 1 or 2. -;CHARS (integer) is the number of characters in a dimension: 94 or 96. -;WIDTH (integer) is the number of columns a character in the charset -; occupies on the screen: one of 0, 1, and 2. -;DIRECTION (integer) is the rendering direction of characters in the -; charset when rendering. If 0, render from left to right, else -; render from right to left. -;LEADING-CODE-BASE (integer) is the base leading-code for the -; charset. -;LEADING-CODE-EXT (integer) is the extended leading-code for the -; charset. All charsets of less than 0xA0 has the value 0. -;ISO-FINAL-CHAR (character) is the final character of the -; corresponding ISO 2022 charset. -;ISO-GRAPHIC-PLANE (integer) is the graphic plane to be invoked -; while encoding to variants of ISO 2022 coding system, one of the -; following: 0/graphic-plane-left(GL), 1/graphic-plane-right(GR). -;REVERSE-CHARSET (integer) is the charset which differs only in -; LEFT-TO-RIGHT value from the charset. If there's no such a -; charset, the value is -1. -;SHORT-NAME (string) is the short name to refer to the charset. -;LONG-NAME (string) is the long name to refer to the charset -;DESCRIPTION (string) is the description string of the charset. -;PLIST (property list) may contain any type of information a user -; want to put and get by functions `put-charset-property' and -; `get-charset-property' respectively." -; (vector -; (charset-id charset) -; 1 -; (charset-dimension charset) -; (charset-chars charset) -; (charset-width charset) -; (charset-direction charset) -; nil ;; (charset-leading-code-base (charset)) -; nil ;; (charset-leading-code-ext (charset)) -; (charset-iso-final-char charset) -; (charset-iso-graphic-plane charset) -; -1 -; (charset-short-name charset) -; (charset-long-name charset) -; (charset-description charset) -; (charset-plist charset))) - -;(make-compatible 'charset-info "Don't use this if you can help it.") - -(defun define-charset (charset-id charset property-vector) - "Define CHARSET-ID as the identification number of CHARSET with INFO-VECTOR. -If CHARSET-ID is nil, it is decided automatically, which means CHARSET is - treated as a private charset. -INFO-VECTOR is a vector of the format: - [DIMENSION CHARS WIDTH DIRECTION ISO-FINAL-CHAR ISO-GRAPHIC-PLANE - SHORT-NAME LONG-NAME DESCRIPTION] -The meanings of each elements is as follows: -DIMENSION (integer) is the number of bytes to represent a character: 1 or 2. -CHARS (integer) is the number of characters in a dimension: 94 or 96. -WIDTH (integer) is the number of columns a character in the charset -occupies on the screen: one of 0, 1, and 2. - -DIRECTION (integer) is the rendering direction of characters in the -charset when rendering. If 0, render from left to right, else -render from right to left. - -ISO-FINAL-CHAR (character) is the final character of the -corresponding ISO 2022 charset. - -ISO-GRAPHIC-PLANE (integer) is the graphic plane to be invoked -while encoding to variants of ISO 2022 coding system, one of the -following: 0/graphic-plane-left(GL), 1/graphic-plane-right(GR). - - -SHORT-NAME (string) is the short name to refer to the charset. - -LONG-NAME (string) is the long name to refer to the charset. - -DESCRIPTION (string) is the description string of the charset." - (make-charset charset (aref property-vector 8) - (list - 'short-name (aref property-vector 6) - 'long-name (aref property-vector 7) - 'dimension (aref property-vector 0) - 'columns (aref property-vector 2) - 'chars (aref property-vector 1) - 'final (aref property-vector 4) - 'graphic (aref property-vector 5) - 'direction (aref property-vector 3)))) - -(make-compatible 'define-charset "") +;; We're not going to support these. +;(defun charset-info (charset) [incredibly broken function with random vectors] +;(defun define-charset (...) [incredibly broken function with random vectors] ;;; Charset property @@ -249,6 +154,57 @@ (defalias 'charset-plist 'object-plist) (defalias 'set-charset-plist 'setplist) + +(defun char-width (character) + "Return number of columns a CHARACTER occupies when displayed." + (charset-width (char-charset character))) + +;; The following several functions are useful in GNU Emacs 20 because +;; of the multibyte "characters" the internal representation of which +;; leaks into Lisp. In XEmacs/Mule they are trivial and unnecessary. +;; We provide them for compatibility reasons solely. + +(define-obsolete-function-alias 'sref 'aref) +(defun char-bytes (character) + "Return number of bytes a CHARACTER occupies in a string or buffer. +It always returns 1 in XEmacs, and in recent FSF Emacs versions." + 1) +(make-obsolete 'char-bytes "This function always returns 1") + +(defun string-to-sequence (string type) + "Convert STRING to a sequence of TYPE which contains characters in STRING. +TYPE should be `list' or `vector'. +Multibyte characters are concerned." + (ecase type + (list + (mapcar #'identity string)) + (vector + (mapvector #'identity string)))) + +(defun string-to-list (string) + "Return a list of characters in STRING." + (mapcar #'identity string)) + +(defun string-to-vector (string) + "Return a vector of characters in STRING." + (mapvector #'identity string)) + +(defun store-substring (string idx obj) + "Embed OBJ (string or character) at index IDX of STRING." + (let* ((str (cond ((stringp obj) obj) + ((characterp obj) (char-to-string obj)) + (t (error + "Invalid argument (should be string or character): %s" + obj)))) + (string-len (length string)) + (len (length str)) + (i 0)) + (while (and (< i len) (< idx string-len)) + (aset string idx (aref str i)) + (setq idx (1+ idx) i (1+ i))) + string)) + + ;; Setup auto-fill-chars for charsets that should invoke auto-filling. ;; SPACE and NEWLIE are already set. (let ((l '(katakana-jisx0201