APPROVE COMMIT
NOTE: This patch has been committed.
mule-packages/mule-base/ChangeLog addition:
2007-07-27 Aidan Kehoe <kehoea(a)parhasard.net>
* fsf-compat-unicode.el:
* fsf-compat-unicode.el (fsf-compat-ccl-program): New.
* fsf-compat-unicode.el (fsf-compat-init-mule-unicode-charsets):
Use fsf-compat-ccl-program, which better reflects the CCL
behaviour in force at the time it was compiled. Also move the CCL
program constant to actually shifting eight bits at a time.
XEmacs Packages source patch:
Diff command: cvs -q diff -Nu
Files affected: mule-packages/mule-base/fsf-compat-unicode.el
===================================================================
RCS
Index: mule-packages/mule-base/fsf-compat-unicode.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/mule-packages/mule-base/fsf-compat-unicode.el,v
retrieving revision 1.3
diff -u -u -r1.3 fsf-compat-unicode.el
--- mule-packages/mule-base/fsf-compat-unicode.el 2007/07/23 21:20:22 1.3
+++ mule-packages/mule-base/fsf-compat-unicode.el 2007/07/27 20:25:21
@@ -29,50 +29,40 @@
;;; Code:
;;; Only for 21.5 and newer.
-(unless (and (fboundp 'encode-char)
- (eq #x31C (with-fboundp '(encode-char decode-char)
- (encode-char (decode-char 'ucs #x31C) 'ucs))))
- (error "Unicode support needed for this file not available!"))
+(eval-when-compile (require 'ccl))
-(if (eval-when-compile
- (and (> emacs-major-version 20)
- (> emacs-minor-version 4)
- (featurep 'mule)))
+;; Check at runtime that the Unicode support is available, and that its
+;; coverage is good enough.
+(unless (if-fboundp 'encode-char
+ (with-fboundp '(encode-char decode-char)
+ (eq #x31C (encode-char (decode-char 'ucs #x31C) 'ucs))))
+ (error 'text-conversion-error
+ "Unicode support needed is not available in your XEmacs."))
+
+;; For redisplay of these character sets, provide a CCL program to address
+;; iso10646-1 X11 fonts.
+(defvar fsf-compat-ccl-program
+ (eval-when-compile
+ (let ((pre-existing [1 10 131127 7 98872 65823 147513 7 82009 127 22]))
+ (when (and (> emacs-major-version 20) (> emacs-minor-version 4)
+ (featurep 'mule))
+ ;; In the event that we're compiling on 21.5, check that the
+ ;; pre-existing constant reflects the intended CCL
+ ;; program. Otherwise, just go ahead and use it.
+ (assert (equal pre-existing
+ (ccl-compile
+ `(1
+ ((r1 = (r1 << 7))
+ (r1 = (r1 | r2))
+ (mule-to-unicode r0 r1)
+ (r1 = (r0 >> 7))
+ (r2 = (r0 & #x7F))))))
+ nil
+ "The pre-compiled CCL program appears broken. "))
+ pre-existing))
+ "CCL program required by `fsf-compat-init-mule-unicode-charsets'.")
- ;; If we're being compiled by 21.5, use the actual define-ccl-program
- ;; macro, but evaluated at runtime.
- ;;
- ;; Having this as
- ;;
- ;; (eval-when-compile (and (featurep 'mule) (macroexpand
- ;; '(define-ccl-program ...))
- ;;
- ;; in order to have the macro evaluated at compile time, results
- ;; in the statement being empty in the compiled file, which as I
- ;; understand it is a bug.
-
- (eval
- '(define-ccl-program fsf-compat-ccl-encode-to-ucs-2
- `(1
- ((r1 = (r1 << 7))
- (r1 = (r1 | r2))
- (mule-to-unicode r0 r1)
- (r1 = (r0 >> 7))
- (r2 = (r0 & 255))))
- "CCL program to transform Mule characters to UCS-2."))
-
- ;; Pre-expand the macro for 21.4. 21.4 will error on loading this file, but
- ;; it may compile it. define-ccl-program should not be a macro, but that's
- ;; by the way.
- (let ((prog [1 10 131127 8 98872 65823 147513 8 82009 255 22]))
- (defconst fsf-compat-ccl-encode-to-ucs-2 prog
- "CCL program to transform Mule characters to UCS-2.")
- (put (quote fsf-compat-ccl-encode-to-ucs-2)
- (quote ccl-program-idx)
- (register-ccl-program (quote fsf-compat-ccl-encode-to-ucs-2) prog))
- nil))
-
(defun fsf-compat-init-mule-unicode-charsets ()
"Make some Mule character sets that the FSF uses available in XEmacs.
@@ -92,17 +82,17 @@
(format
"Unicode subset (U+%04X..U+%04X) for FSF compatibility."
first-ucs last-ucs)
- (list 'dimension 2
- 'registries ["iso10646-1"]
- 'chars 96
- 'columns 1
- 'direction 'l2r
- 'final final
- 'graphic 0
- 'short-name (format "Unicode subset %c" final)
- 'long-name (format "Unicode subset (U+%04X..U+%04X)"
- first-ucs last-ucs)
- 'ccl-program 'fsf-compat-ccl-encode-to-ucs-2))
+ `(dimension 2
+ registries ["iso10646-1"]
+ chars 96
+ columns 1
+ direction l2r
+ final final
+ graphic 0
+ short-name ,(format "Unicode subset %c" final)
+ long-name ,(format "Unicode subset (U+%04X..U+%04X)"
+ first-ucs last-ucs)
+ ccl-program ,fsf-compat-ccl-program))
;; The names of the character sets lie, at least as of GNU Emacs
;; 22.0.50.3. The difference appears to be that they keep assigning
;; code points until the end of the 96x96 space of the character sets.
--
On the quay of the little Black Sea port, where the rescued pair came once
more into contact with civilization, Dobrinton was bitten by a dog which was
assumed to be mad, though it may only have been indiscriminating. (Saki)
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches