CVS update by aidan xemacs/tests/automated ...
xemacs-cvs at xemacs.org
xemacs-cvs at xemacs.org
Mon Nov 20 14:21:56 EST 2006
User: aidan
Date: 06/11/20 20:21:56
Modified: xemacs/tests/automated mule-tests.el
Log:
Eliminate a couple of CCL bugs with control-1 characters.
Revision Changes Path
1.1015 +9 -0 XEmacs/xemacs/src/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/ChangeLog,v
retrieving revision 1.1014
retrieving revision 1.1015
diff -u -p -r1.1014 -r1.1015
--- ChangeLog 2006/11/18 18:17:53 1.1014
+++ ChangeLog 2006/11/20 19:21:47 1.1015
@@ -1,3 +1,12 @@
+2006-11-20 Aidan Kehoe <kehoea at 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.
+
2006-11-18 Mike Sperber <mike at xemacs.org>
* window.c (window_pixel_height_to_char_height): Cater to the
1.31 +6 -2 XEmacs/xemacs/src/mule-ccl.c
Index: mule-ccl.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/mule-ccl.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -p -r1.30 -r1.31
--- mule-ccl.c 2006/06/14 06:10:10 1.30
+++ mule-ccl.c 2006/11/20 19:21:49 1.31
@@ -850,13 +850,17 @@ static int stack_idx_of_map_multiple;
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 @@ ccl_driver (struct ccl_program *ccl,
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)))
{
1.84 +6 -0 XEmacs/xemacs/tests/ChangeLog
Index: ChangeLog
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/tests/ChangeLog,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -p -r1.83 -r1.84
--- ChangeLog 2006/08/04 22:55:18 1.83
+++ ChangeLog 2006/11/20 19:21:54 1.84
@@ -1,3 +1,9 @@
+2006-11-20 Aidan Kehoe <kehoea at parhasard.net>
+
+ * automated/mule-tests.el (featurep):
+ Add tests to make sure the fixes to the CCL bugs I just checked in
+ don't regress.
+
2006-08-05 Aidan Kehoe <kehoea at parhasard.net>
* automated/lisp-reader-tests.el:
1.11 +42 -0 XEmacs/xemacs/tests/automated/mule-tests.el
Index: mule-tests.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/tests/automated/mule-tests.el,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -p -r1.10 -r1.11
--- mule-tests.el 2006/06/24 14:30:39 1.10
+++ mule-tests.el 2006/11/20 19:21:56 1.11
@@ -400,6 +400,48 @@ This is a naive implementation in Lisp.
(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
More information about the XEmacs-CVS
mailing list