APPROVE COMMIT
NOTE: This patch has been committed.
lisp/ChangeLog addition:
2007-11-29 Aidan Kehoe <kehoea(a)parhasard.net>
* mule/mule-coding.el (make-8-bit-generate-helper):
Don't use 128 as a magic constant, instead make a let-binding to
in in the eval-when-compile clause, and pass that bound value
through to the run-time code. Fixes a bug where the compile-time
and run-time code didn't share this value.
* mule/mule-coding.el (make-8-bit-coding-system):
Mark the coding systems created by this code as such, for the sake
of automated testing of their round-trip compatibility.
src/ChangeLog addition:
2007-11-29 Aidan Kehoe <kehoea(a)parhasard.net>
* mule-ccl.c (ccl_driver):
Take out a static variable I was using for debugging.
tests/ChangeLog addition:
2007-11-29 Aidan Kehoe <kehoea(a)parhasard.net>
* automated/mule-tests.el:
Check the eight-bit fixed-width CCL coding systems for round-trip
compatibility with themselves.
XEmacs Trunk source patch:
Diff command: cvs -q diff -u
Files affected: tests/automated/mule-tests.el
===================================================================
RCS src/mule-ccl.c
===================================================================
RCS lisp/mule/mule-coding.el
===================================================================
RCS
Index: lisp/mule/mule-coding.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/lisp/mule/mule-coding.el,v
retrieving revision 1.25
diff -u -r1.25 mule-coding.el
--- lisp/mule/mule-coding.el 2007/08/26 20:00:42 1.25
+++ lisp/mule/mule-coding.el 2007/11/29 13:33:57
@@ -233,7 +233,8 @@
returns a list corresponding to such a ccl-program. If not, it returns nil. "
(let ((tentative-encode-program-parts
(eval-when-compile
- (let* ((compiled
+ (let* ((vec-len 128)
+ (compiled
(append
(ccl-compile
`(1
@@ -244,7 +245,10 @@
((if (r0 == #xABAB)
;; #xBFFE is a sentinel in the compiled
;; program.
- (write r1 ,(make-vector 256 #xBFFE))
+ ;; #xBFFE is a sentinel in the compiled
+ ;; program.
+ ((r0 = r1 & #x7F)
+ (write r0 ,(make-vector vec-len #xBFFE)))
((mule-to-unicode r0 r1)
(if (r0 == #xFFFD)
(write #xBEEF)
@@ -260,8 +264,11 @@
(lambda (entr) (eq #xBFFE entr))
first-part))))
(while compiled
- (if (eq #xBFFE (cadr compiled))
- (setcdr compiled nil))
+ (when (eq #xBFFE (cadr compiled))
+ (assert (= vec-len (search '(#xBFFE) (cdr compiled)
+ :test #'/=)) nil
+ "Strange ccl vector length")
+ (setcdr compiled nil))
(setq compiled (cdr compiled)))
;; Is the generated code as we expect it to be?
(assert (and (memq #xABAB first-part)
@@ -271,11 +278,11 @@
compiled CCL code,\nand that the constant #xABAB is #xABAB. If that is
not the case, and it appears not to be--that's why you're getting this
message--it will not work. ")
- (list first-part last-part))))
+ (list first-part last-part vec-len))))
(charset-lower -1)
(charset-upper -1)
worth-trying known-charsets encode-program
- other-charset-vector ucs)
+ other-charset-vector ucs args-out-of-range)
(loop for char across decode-table
do (pushnew (char-charset char) known-charsets))
@@ -311,7 +318,9 @@
worth-trying nil)))
(when worth-trying
- (setq other-charset-vector (make-vector 128 encode-failure-octet))
+ (setq other-charset-vector
+ (make-vector (third tentative-encode-program-parts)
+ encode-failure-octet))
(loop for i from charset-lower to charset-upper
do (aset other-charset-vector i
(gethash (encode-char (make-char worth-trying i)
@@ -611,6 +620,7 @@
description
(plist-put (plist-put props 'decode decode-program)
'encode encode-program)))
+ (coding-system-put name '8-bit-fixed t)
(coding-system-put name 'category
(make-8-bit-choose-category decode-table))
(loop for alias in aliases
@@ -682,6 +692,7 @@
'encode-table-sym
(symbol-value 'encode-table-sym)))
',encode-program))))
+ (coding-system-put ',name '8-bit-fixed t)
(coding-system-put ',name 'category ',
(make-8-bit-choose-category decode-table))
,(macroexpand `(loop for alias in ',aliases
Index: src/mule-ccl.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/mule-ccl.c,v
retrieving revision 1.36
diff -u -r1.36 mule-ccl.c
--- src/mule-ccl.c 2007/09/30 11:38:00 1.36
+++ src/mule-ccl.c 2007/11/29 13:33:57
@@ -956,7 +956,6 @@
int this_ic = 0;
int eof_ic = ccl->eof_ic;
int eof_hit = 0;
- static int ccl_driver_calls;
if (ic >= eof_ic)
ic = CCL_HEADER_MAIN;
@@ -970,8 +969,6 @@
#ifdef CCL_DEBUG
ccl_backtrace_idx = 0;
#endif
-
- ++ccl_driver_calls;
for (;;)
{
Index: tests/automated/mule-tests.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/tests/automated/mule-tests.el,v
retrieving revision 1.20
diff -u -r1.20 mule-tests.el
--- tests/automated/mule-tests.el 2007/08/21 12:39:11 1.20
+++ tests/automated/mule-tests.el 2007/11/29 13:33:57
@@ -495,6 +495,28 @@
(eq (aref ccl-vector 4)
(encode-char (make-char 'control-1 31) 'ucs)))))
+
+ ;; Test the 8 bit fixed-width coding systems for round-trip
+ ;; compatibility with themselves.
+ (loop
+ for coding-system in (coding-system-list)
+ with all-possible-octets = (apply #'string
+ (loop for i from ?\x00 to ?\xFF
+ collect i))
+ do
+ (when (and (coding-system-get coding-system '8-bit-fixed)
+ ;; Don't check the coding systems with autodetect, they are
+ ;; not round-trip compatible for the possible line-ending
+ ;; characters.
+ (string-match #r"-\(unix\|dos\|mac\)$"
+ (symbol-name coding-system)))
+ ;; These coding systems are round-trip compatible with themselves.
+ (Assert (equal (encode-coding-string
+ (decode-coding-string all-possible-octets
+ coding-system)
+ coding-system)
+ all-possible-octets))))
+
;;---------------------------------------------------------------
;; Test charset-in-* functions
;;---------------------------------------------------------------
--
¿Dónde estará ahora mi sobrino Yoghurtu Nghé, que tuvo que huir
precipitadamente de la aldea por culpa de la escasez de rinocerontes?
_______________________________________________
XEmacs-Patches mailing list
XEmacs-Patches(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-patches