emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lisp/international/ccl.el,v


From: Miles Bader
Subject: [Emacs-diffs] Changes to emacs/lisp/international/ccl.el,v
Date: Fri, 01 Feb 2008 16:02:59 +0000

CVSROOT:        /cvsroot/emacs
Module name:    emacs
Changes by:     Miles Bader <miles>     08/02/01 16:01:31

Index: lisp/international/ccl.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/international/ccl.el,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -b -r1.43 -r1.44
--- lisp/international/ccl.el   8 Jan 2008 20:46:08 -0000       1.43
+++ lisp/international/ccl.el   1 Feb 2008 16:01:17 -0000       1.44
@@ -211,6 +211,11 @@
 ;; Embed string STR of length LEN in `ccl-program-vector' at
 ;; `ccl-current-ic'.
 (defun ccl-embed-string (len str)
+  (if (> len #xFFFFF)
+      (error "CCL: String too long: %d" len))
+  (if (> (string-bytes str) len)
+      (dotimes (i len)
+       (ccl-embed-data (logior #x1000000 (aref str i))))
   (let ((i 0))
     (while (< i len)
       (ccl-embed-data (logior (ash (aref str i) 16)
@@ -220,7 +225,7 @@
                               (if (< (+ i 2) len)
                                   (aref str (+ i 2))
                                 0)))
-      (setq i (+ i 3)))))
+       (setq i (+ i 3))))))
 
 ;; Embed a relative jump address to `ccl-current-ic' in
 ;; `ccl-program-vector' at IC without altering the other bit field.
@@ -463,7 +468,6 @@
 
 ;; Compile WRITE statement with string argument.
 (defun ccl-compile-write-string (str)
-  (setq str (string-as-unibyte str))
   (let ((len (length str)))
     (ccl-embed-code 'write-const-string 1 len)
     (ccl-embed-string len str))
@@ -675,7 +679,6 @@
           (ccl-embed-code 'write-const-jump 0 ccl-loop-head)
           (ccl-embed-data arg))
          ((stringp arg)
-          (setq arg (string-as-unibyte arg))
           (let ((len (length arg))
                 (i 0))
             (ccl-embed-code 'write-string-jump 0 ccl-loop-head)
@@ -733,7 +736,9 @@
       (error "CCL: Invalid number of arguments: %s" cmd))
   (let ((rrr (nth 1 cmd)))
     (cond ((integerp rrr)
-          (ccl-embed-code 'write-const-string 0 rrr))
+          (if (> rrr #xFFFFF)
+              (ccl-compile-write-string (string rrr))
+            (ccl-embed-code 'write-const-string 0 rrr)))
          ((stringp rrr)
           (ccl-compile-write-string rrr))
          ((and (symbolp rrr) (vectorp (nth 2 cmd)))
@@ -1137,12 +1142,16 @@
       (insert "write \"")
       (while (< i len)
        (let ((code (ccl-get-next-code)))
+         (if (/= (logand code #x1000000) 0)
+             (progn
+               (insert (logand code #xFFFFFF))
+               (setq i (1+ i)))
          (insert (format "%c" (lsh code -16)))
          (if (< (1+ i) len)
              (insert (format "%c" (logand (lsh code -8) 255))))
          (if (< (+ i 2) len)
              (insert (format "%c" (logand code 255))))
-         (setq i (+ i 3))))
+           (setq i (+ i 3)))))
       (insert "\"\n"))))
 
 (defun ccl-dump-write-array (rrr cc)
@@ -1509,7 +1518,12 @@
 MAP-SET := MAP-IDs | (MAP-IDs) MAP-SET
 MAP-ID := integer
 "
-  `(let ((prog ,(ccl-compile (eval ccl-program))))
+  `(let ((prog ,(unwind-protect
+                   (progn
+                     ;; To make ,(charset-id CHARSET) works well.
+                     (fset 'charset-id 'charset-id-internal)
+                     (ccl-compile (eval ccl-program)))
+                 (fmakunbound 'charset-id))))
      (defconst ,name prog ,doc)
      (put ',name 'ccl-program-idx (register-ccl-program ',name prog))
      nil))




reply via email to

[Prev in Thread] Current Thread [Next in Thread]