Sync up with latest chao-1_12 from chao-1_12_2.
authorakr <akr>
Fri, 13 Nov 1998 07:33:31 +0000 (07:33 +0000)
committerakr <akr>
Fri, 13 Nov 1998 07:33:31 +0000 (07:33 +0000)
ChangeLog
mel-b-ccl.el
mel-q-ccl.el
mel.el

index 9065118..e2ce76e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+1998-11-12  Tanaka Akira  <akr@jaist.ac.jp>
+
+       * mel-b-ccl.el (mel-ccl-decode-b): Check `ccl-cascading-read' to
+       select implementation.
+
+1998-11-12  Tanaka Akira  <akr@jaist.ac.jp>
+
+       * mel-q-ccl.el (mel-ccl-encode-quoted-printable-generic): workaround 
+       for mule-2.3@19.34.
+
+1998-11-12  Tanaka Akira  <akr@jaist.ac.jp>
+
+       * mel.el (mel-b-builtin): New variable.
+
 1998-11-10  Tanaka Akira  <akr@jaist.ac.jp>
 
        * FLIM-ELS: require 'pccl.
index b01650c..fd84a78 100644 (file)
@@ -143,96 +143,143 @@ abcdefghijklmnopqrstuvwxyz\
 
 )
 
-(define-ccl-program mel-ccl-decode-b
-  `(1
-    (loop
-     (read r0 r1 r2 r3)
-     (r4 = r0 ,mel-ccl-decode-b-0-table)
-     (r5 = r1 ,mel-ccl-decode-b-1-table)
-     (r4 |= r5)
-     (r5 = r2 ,mel-ccl-decode-b-2-table)
-     (r4 |= r5)
-     (r5 = r3 ,mel-ccl-decode-b-3-table)
-     (r4 |= r5)
-     (if (r4 & ,(lognot (1- (lsh 1 24))))
-        ((loop
-          (if (r4 & ,(lsh 1 24))
-              ((r0 = r1) (r1 = r2) (r2 = r3) (read r3)
-               (r4 >>= 1) (r4 &= ,(logior (lsh 7 24)))
-               (r5 = r3 ,mel-ccl-decode-b-3-table)
-               (r4 |= r5)
-               (repeat))
-            (break)))
-         (loop
-          (if (r4 & ,(lsh 1 25))
-              ((r1 = r2) (r2 = r3) (read r3)
-               (r4 >>= 1) (r4 &= ,(logior (lsh 7 24)))
-               (r5 = r3 ,mel-ccl-decode-b-3-table)
-               (r4 |= r5)
-               (repeat))
-            (break)))
-         (loop
-          (if (r2 != ?=)
-              (if (r4 & ,(lsh 1 26))
-                  ((r2 = r3) (read r3)
-                   (r4 >>= 1) (r4 &= ,(logior (lsh 7 24)))
-                   (r5 = r3 ,mel-ccl-decode-b-3-table)
-                   (r4 |= r5)
-                   (repeat))
-                ((r6 = 0)
-                 (break)))
-            ((r6 = 1)
-             (break))))
-         (loop
-          (if (r3 != ?=)
-              (if (r4 & ,(lsh 1 27))
-                  ((read r3)
-                   (r4 = r3 ,mel-ccl-decode-b-3-table)
-                   (repeat))
-                (break))
-            ((r6 |= 2)
-             (break))))
-         (r4 = r0 ,mel-ccl-decode-b-0-table)
-         (r5 = r1 ,mel-ccl-decode-b-1-table)
-         (r4 |= r5)
-         (branch
-          r6
-          ;; BBBB
-          ((r5 = r2 ,mel-ccl-decode-b-2-table)
+(if-broken ccl-cascading-read
+    (define-ccl-program mel-ccl-decode-b
+      `(1
+       (loop
+        (loop
+         (read-branch
+          r1
+          ,@(mapcar
+             (lambda (v)
+               (cond
+                ((or (eq v nil) (eq v t)) '(repeat))
+                (t `((r0 = ,(lsh v 2)) (break)))))
+             mel-ccl-256-to-64-table)))
+        (loop
+         (read-branch
+          r1
+          ,@(mapcar
+             (lambda (v)
+               (cond
+                ((or (eq v nil) (eq v t)) '(repeat))
+                ((= (lsh v -4) 0) `((write r0) (r0 = ,(lsh (logand v 15) 4)) (break)))
+                (t `((r0 |= ,(lsh v -4)) (write r0) (r0 = ,(lsh (logand v 15) 4)) (break)))))
+             mel-ccl-256-to-64-table)))
+        (loop
+         (read-branch
+          r1
+          ,@(mapcar
+             (lambda (v)
+               (cond
+                ((eq v nil) '(repeat))
+                ((eq v t) '(end))
+                ((= (lsh v -2) 0) `((write r0) (r0 = ,(lsh (logand v 3) 6)) (break)))
+                (t `((r0 |= ,(lsh v -2)) (write r0) (r0 = ,(lsh (logand v 3) 6)) (break)))))
+             mel-ccl-256-to-64-table)))
+        (loop
+         (read-branch
+          r1
+          ,@(mapcar
+             (lambda (v)
+               (cond
+                ((eq v nil) '(repeat))
+                ((eq v t) '(end))
+                (t `((r0 |= ,v) (write r0) (break)))))
+             mel-ccl-256-to-64-table)))
+        (repeat))))
+  (define-ccl-program mel-ccl-decode-b
+    `(1
+      (loop
+       (read r0 r1 r2 r3)
+       (r4 = r0 ,mel-ccl-decode-b-0-table)
+       (r5 = r1 ,mel-ccl-decode-b-1-table)
+       (r4 |= r5)
+       (r5 = r2 ,mel-ccl-decode-b-2-table)
+       (r4 |= r5)
+       (r5 = r3 ,mel-ccl-decode-b-3-table)
+       (r4 |= r5)
+       (if (r4 & ,(lognot (1- (lsh 1 24))))
+          ((loop
+            (if (r4 & ,(lsh 1 24))
+                ((r0 = r1) (r1 = r2) (r2 = r3) (read r3)
+                 (r4 >>= 1) (r4 &= ,(logior (lsh 7 24)))
+                 (r5 = r3 ,mel-ccl-decode-b-3-table)
+                 (r4 |= r5)
+                 (repeat))
+              (break)))
+           (loop
+            (if (r4 & ,(lsh 1 25))
+                ((r1 = r2) (r2 = r3) (read r3)
+                 (r4 >>= 1) (r4 &= ,(logior (lsh 7 24)))
+                 (r5 = r3 ,mel-ccl-decode-b-3-table)
+                 (r4 |= r5)
+                 (repeat))
+              (break)))
+           (loop
+            (if (r2 != ?=)
+                (if (r4 & ,(lsh 1 26))
+                    ((r2 = r3) (read r3)
+                     (r4 >>= 1) (r4 &= ,(logior (lsh 7 24)))
+                     (r5 = r3 ,mel-ccl-decode-b-3-table)
+                     (r4 |= r5)
+                     (repeat))
+                  ((r6 = 0)
+                   (break)))
+              ((r6 = 1)
+               (break))))
+           (loop
+            (if (r3 != ?=)
+                (if (r4 & ,(lsh 1 27))
+                    ((read r3)
+                     (r4 = r3 ,mel-ccl-decode-b-3-table)
+                     (repeat))
+                  (break))
+              ((r6 |= 2)
+               (break))))
+           (r4 = r0 ,mel-ccl-decode-b-0-table)
+           (r5 = r1 ,mel-ccl-decode-b-1-table)
            (r4 |= r5)
-           (r5 = r3 ,mel-ccl-decode-b-3-table)
-           (r4 |= r5)
-           (r4 >8= 0)
-           (write r7)
-           (r4 >8= 0)
-           (write r7)
-           (write-repeat r4))
-          ;; error: BB=B 
-          ((write (r4 & 255))
-           (end))
-          ;; BBB=
-          ((r5 = r2 ,mel-ccl-decode-b-2-table)
-           (r4 |= r5)
-           (r4 >8= 0)
-           (write r7)
-           (write (r4 & 255))
-           (end)                       ; Excessive (end) is workaround for XEmacs 21.0.
+           (branch
+            r6
+            ;; BBBB
+            ((r5 = r2 ,mel-ccl-decode-b-2-table)
+             (r4 |= r5)
+             (r5 = r3 ,mel-ccl-decode-b-3-table)
+             (r4 |= r5)
+             (r4 >8= 0)
+             (write r7)
+             (r4 >8= 0)
+             (write r7)
+             (write-repeat r4))
+            ;; error: BB=B 
+            ((write (r4 & 255))
+             (end))
+            ;; BBB=
+            ((r5 = r2 ,mel-ccl-decode-b-2-table)
+             (r4 |= r5)
+             (r4 >8= 0)
+             (write r7)
+             (write (r4 & 255))
+             (end)                     ; Excessive (end) is workaround for XEmacs 21.0.
                                        ; Without this, "AAA=" is converted to "^@^@^@".
-           (end))
-          ;; BB==
-          ((write (r4 & 255))
-           (end))))
-       ((r4 >8= 0)
-       (write r7)
-       (r4 >8= 0)
-       (write r7)
-       (write-repeat r4))))))
+             (end))
+            ;; BB==
+            ((write (r4 & 255))
+             (end))))
+        ((r4 >8= 0)
+         (write r7)
+         (r4 >8= 0)
+         (write r7)
+         (write-repeat r4))))))
+  )
 
 (eval-when-compile
 
 ;; Generated CCL program works not properly on 20.2 because CCL_EOF_BLOCK
 ;; is not executed.
-(defun mel-ccl-encode-base64-generic (&optional quantums-per-line output-crlf terminate-with-newline)
+(defun mel-ccl-encode-base64-generic
+  (&optional quantums-per-line output-crlf terminate-with-newline)
   `(2
     ((r3 = 0)
      (loop
index 17b58be..116994e 100644 (file)
@@ -496,7 +496,7 @@ abcdefghijklmnopqrstuvwxyz\
               (write ,(if output-crlf "=\r\n" "=\n"))
               (write r0)
               (write "=0D")
-              (r0 = r1)
+              (r0 = (r1 + 0)) ; "+ 0" is workaround for mule 2.3@19.34.
               (break))
              ;; r0:r3=ENC CR r1:noLF
              ((r6 = 6)
@@ -505,7 +505,7 @@ abcdefghijklmnopqrstuvwxyz\
               (write r0 ,mel-ccl-high-table)
               (write r0 ,mel-ccl-low-table)
               (write "=0D")
-              (r0 = r1)
+              (r0 = (r1 + 0))
               (break))))
           ;; r0:r3={RAW,ENC} r1:noCR
           ;; r0:r3={RAW,ENC} r1:noCRLF
@@ -517,7 +517,7 @@ abcdefghijklmnopqrstuvwxyz\
               (r5 = 0)
               (write ,(if output-crlf "=\r\n" "=\n"))
               (write r0)
-              (r0 = r1)
+              (r0 = (r1 + 0))
               (break))
              ;; r0:r3=ENC r1:noCR
              ;; r0:r3=ENC r1:noCRLF
@@ -526,7 +526,7 @@ abcdefghijklmnopqrstuvwxyz\
               (write ,(if output-crlf "=\r\n=" "=\n="))
               (write r0 ,mel-ccl-high-table)
               (write r0 ,mel-ccl-low-table)
-              (r0 = r1)
+              (r0 = (r1 + 0))
               (break)))))))
       (repeat)))
     ;; EOF
@@ -712,7 +712,7 @@ abcdefghijklmnopqrstuvwxyz\
                          ((setq tmp (nth r0 mel-ccl-256-to-16-table))
                           ;; '=' [\t ]* r0:[0-9A-F]
                           ;; upper nibble of hexadecimal digit found.
-                          `((r1 = r0)
+                          `((r1 = (r0 + 0))
                            (r0 = ,tmp)))
                          (t
                           ;; '=' [\t ]* r0:[^\r0-9A-F]
@@ -744,7 +744,7 @@ abcdefghijklmnopqrstuvwxyz\
                   ;; invalid input ->
                   ;; output "=" with hex digit and rescan from r2.
                   (write ?=)
-                  (r0 = r2)
+                  (r0 = (r2 + 0))
                   (write-repeat r1)))
                (t
                 ;; r0:[^\t\r -~]
diff --git a/mel.el b/mel.el
index ccfc072..c8764a9 100644 (file)
--- a/mel.el
+++ b/mel.el
@@ -96,8 +96,11 @@ Content-Transfer-Encoding for it."
 
 (mel-define-backend "binary" ("8bit"))
 
-(when (and (fboundp 'base64-encode-string)
-          (subrp (symbol-function 'base64-encode-string)))
+(defvar mel-b-builtin
+   (and (fboundp 'base64-encode-string)
+        (subrp (symbol-function 'base64-encode-string))))
+
+(when mel-b-builtin
   (mel-define-backend "base64")
   (mel-define-method-function (mime-encode-string string (nil "base64"))
                              'base64-encode-string)