changeset 2633:b921e3d0ac3e

[xemacs-hg @ 2005-03-04 21:59:42 by aidan] Add encode-char and decode-char functions, for wider Mule compatibility. They do unicode-to-char and char-to-unicode, and are implemented in Mule-UCS and GNU Emacs.
author aidan
date Fri, 04 Mar 2005 21:59:43 +0000
parents a94fafdc4b7d
children 4a14dcf804f6
files lisp/ChangeLog lisp/unicode.el
diffstat 2 files changed, 24 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Thu Mar 03 22:51:13 2005 +0000
+++ b/lisp/ChangeLog	Fri Mar 04 21:59:43 2005 +0000
@@ -1,3 +1,13 @@
+2005-03-04  Aidan Kehoe  <kehoea@parhasard.net>
+
+	* unicode.el (decode-char): New. This is what the FSF Mule API
+	calls unicode-to-char. The API of the function is more general,
+	but support for anything beyond Unicode isn't implemented, and I
+	can't see why it would be, given that make-char does a fine job
+	already.
+	* unicode.el (encode-char): New. This is what the FSF Mule calls
+	char-to-unicode.
+
 2005-02-28  Simon Josefsson  <jas@extundo.com>
 
 	* about.el (xemacs-hackers): Add jas.
--- a/lisp/unicode.el	Thu Mar 03 22:51:13 2005 +0000
+++ b/lisp/unicode.el	Fri Mar 04 21:59:43 2005 +0000
@@ -304,6 +304,20 @@
    little-endian t
    need-bom t))
 
+(defun decode-char (quote-ucs code &optional restriction) 
+  "FSF compatibility--return Mule character with Unicode codepoint `code'.
+The second argument must be 'ucs, the third argument is ignored.  "
+  (assert (eq quote-ucs 'ucs) 
+	  "Sorry, decode-char doesn't yet support anything but the UCS.  ")
+  (unicode-to-char code))
+
+(defun encode-char (char quote-ucs &optional restriction)
+  "FSF compatibility--return the Unicode code point of `char'.
+The second argument must be 'ucs, the third argument is ignored.  "
+  (assert (eq quote-ucs 'ucs)
+	  "Sorry, encode-char doesn't yet support anything but the UCS.  ")
+  (char-to-unicode char))
+
 ;; #### UTF-7 is not yet implemented, and it's tricky to do.  There's
 ;; an implementation in appendix A.1 of the Unicode Standard, Version
 ;; 2.0, but I don't know its licensing characteristics.