decoders writing control-1 chars?

Aidan Kehoe kehoea
Mon Nov 13 06:00:07 EST 2006


 Ar an t-ocht? l? de m? na Samhain, scr?obh Ilya N. Golubev: 

 > > it seems I sent that to the
 > > list, and not to you explicitly.
 > 
 > Then thanks for resending, since I am not on any of the lists.
 > 
 > Adding `ccl-program-definition' did not directly fix the broken
 > conversion.  It was practically necessary to figure what C code to
 > look at, and will remain so until no CCL coding system is ever used.
 > Will post separate patches on request.
 >
 > [...]
 > 
 > --- src/mule-ccl.c
 > +++ src/mule-ccl.c
 > @@ -1372,8 +1372,6 @@
 > 	      i = reg[RRR]; /* charset */
 >  	      if (i == LEADING_BYTE_ASCII) 
 >  		i = reg[rrr] & 0xFF;
 > -	      else if (LEADING_BYTE_CONTROL_1 == i)
 > -		i = ((reg[rrr] & 0xFF) - 0xA0);
 >  	      else if (POSSIBLE_LEADING_BYTE_P(i) &&
 >  		       !NILP(CHARSET_BY_LEADING_BYTE(i)))
 >  		{
 > @@ -2257,6 +2255,18 @@

Your change crashes a debug build of 21.5 when the following code is
executed:

(let ((ccl-vector [0 0 0 0 0 0 0 0 0]))
  (define-ccl-program ccl-write-two-control-1-chars
    `(1
      ((r0 = 143)
       (r1 = 0)
       (write-multibyte-character r0 r1)
       (r1 = 31)
       (write-multibyte-character r0 r1)))
    "CCL program to transform Mule characters to UCS-2.")

  (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)))
	  nil
	  "CCL's write-multibyte-character breaks for control-1! "))

This works okay, however: 

Index: src/mule-ccl.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/mule-ccl.c,v
retrieving revision 1.30
diff -u -u -r1.30 mule-ccl.c
--- src/mule-ccl.c	2006/06/14 06:10:10	1.30
+++ src/mule-ccl.c	2006/11/12 22:49:27
@@ -1390,7 +1390,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)))
 		{

There is a separate but similar problem with mule-to-unicode that I?m still
looking into.

-- 
Santa Maradona, priez pour moi!



More information about the XEmacs-Beta mailing list