Ar an triú lá déag de mí na Samhain, scríobh Aidan Kehoe:
There is a separate but similar problem with mule-to-unicode that I’m
still
looking into.
Okay, the below eliminates both. I intend committing this evening.
src/ChangeLog addition:
2006-11-20 Aidan Kehoe <kehoea(a)parhasard.net>
* mule-ccl.c (CCL_MAKE_CHAR):
* mule-ccl.c (ccl_driver):
Eliminate a CCL bug with control-1 chars and
write-multibyte-character--thank you for the report, Ilya, and
eliminate a crash when a non-existent charset ID is specified for
a mule-to-unicode call.
tests/ChangeLog addition:
2006-11-20 Aidan Kehoe <kehoea(a)parhasard.net>
* automated/mule-tests.el:
Add tests to make sure the fixes to the CCL bugs I just checked in
don't regress.
XEmacs Trunk source patch:
Diff command: cvs -q diff -u
Files affected: tests/automated/mule-tests.el
===================================================================
RCS src/mule-ccl.c
===================================================================
RCS
Index: src/mule-ccl.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/mule-ccl.c,v
retrieving revision 1.30
diff -u -r1.30 mule-ccl.c
--- src/mule-ccl.c 2006/06/14 06:10:10 1.30
+++ src/mule-ccl.c 2006/11/20 11:47:01
@@ -850,13 +850,17 @@
macro is only used in the MuleToUnicode transformation. */
#define CCL_MAKE_CHAR(charset, code, c) \
do { \
+ \
+ if (!POSSIBLE_LEADING_BYTE_P(charset)) \
+ CCL_INVALID_CMD; \
+ \
if ((charset) == LEADING_BYTE_ASCII) \
{ \
c = (code) & 0xFF; \
} \
else if ((charset) == LEADING_BYTE_CONTROL_1) \
{ \
- c = ((code) & 0xFF) - 0xA0; \
+ c = ((code) & 0x1F) + 0x80; \
} \
else if (!NILP(charset_by_leading_byte(charset)) \
&& ((code) >= 32) \
@@ -1390,7 +1394,7 @@
if (i == LEADING_BYTE_ASCII)
i = reg[rrr] & 0xFF;
else if (LEADING_BYTE_CONTROL_1 == i)
- i = ((reg[rrr] & 0xFF) - 0xA0);
+ i = ((reg[rrr] & 0x1F) + 0x80);
else if (POSSIBLE_LEADING_BYTE_P(i) &&
!NILP(charset_by_leading_byte(i)))
{
Index: tests/automated/mule-tests.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/tests/automated/mule-tests.el,v
retrieving revision 1.10
diff -u -r1.10 mule-tests.el
--- tests/automated/mule-tests.el 2006/06/24 14:30:39 1.10
+++ tests/automated/mule-tests.el 2006/11/20 11:47:02
@@ -400,6 +400,48 @@
(encode-coding-string xemacs-character 'ctext))))))
;;---------------------------------------------------------------
+ ;; Regression test for a couple of CCL-related bugs.
+ ;;---------------------------------------------------------------
+
+ (let ((ccl-vector [0 0 0 0 0 0 0 0 0]))
+ (define-ccl-program ccl-write-two-control-1-chars
+ `(1
+ ((r0 = ,(charset-id 'control-1))
+ (r1 = 0)
+ (write-multibyte-character r0 r1)
+ (r1 = 31)
+ (write-multibyte-character r0 r1)))
+ "CCL program that writes two control-1 multibyte characters.")
+
+ (Assert (equal
+ (ccl-execute-on-string 'ccl-write-two-control-1-chars
+ ccl-vector "")
+ (format "%c%c" (make-char 'control-1 0)
+ (make-char 'control-1 31))))
+
+ (define-ccl-program ccl-unicode-two-control-1-chars
+ `(1
+ ((r0 = ,(charset-id 'control-1))
+ (r1 = 31)
+ (mule-to-unicode r0 r1)
+ (r4 = r0)
+ (r3 = ,(charset-id 'control-1))
+ (r2 = 0)
+ (mule-to-unicode r3 r2)))
+ "CCL program that writes two control-1 UCS code points in r3 and r4")
+
+ ;; Re-initialise the vector, mainly to clear the instruction counter,
+ ;; which is its last element.
+ (setq ccl-vector [0 0 0 0 0 0 0 0 0])
+
+ (ccl-execute-on-string 'ccl-unicode-two-control-1-chars ccl-vector "")
+
+ (Assert (and (eq (aref ccl-vector 3)
+ (encode-char (make-char 'control-1 0) 'ucs))
+ (eq (aref ccl-vector 4)
+ (encode-char (make-char 'control-1 31) 'ucs)))))
+
+ ;;---------------------------------------------------------------
;; Test charset-in-* functions
;;---------------------------------------------------------------
(with-temp-buffer
--
Santa Maradona, priez pour moi!
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches