* mel-ccl.el (mel-ccl-encode-q-generic): New compile-time
authorakr <akr>
Thu, 10 Sep 1998 15:29:44 +0000 (15:29 +0000)
committerakr <akr>
Thu, 10 Sep 1998 15:29:44 +0000 (15:29 +0000)
function.
(mel-ccl-count-q-length): New compile-time function.
(mel-ccl-encode-uq): Use `mel-ccl-encode-q-generic'.
(mel-ccl-encode-cq): Use `mel-ccl-encode-q-generic'.
(mel-ccl-encode-pq): Use `mel-ccl-encode-q-generic'.
(mel-ccl-count-uq): New CCL program.
(mel-ccl-count-cq): Ditto.
(mel-ccl-count-pq): Ditto.
(mel-ccl-encode-base64-generic): New function.
(mel-ccl-encode-b): Use `mel-ccl-encode-base64-generic'.
(mel-ccl-encode-base64-crlf-crlf): Use
`mel-ccl-encode-base64-generic'.
(mel-ccl-encode-base64-crlf-lf): Use
`mel-ccl-encode-base64-generic'.
(base64-ccl-encode-string): Use `mel-ccl-base64-lf-rev' instead
of `mel-ccl-b-rev' for folding.
(base64-ccl-encode-region): Ditto.
(base64-ccl-decode-string): Remove useless `string-as-unibyte'
call.
(quoted-printable-ccl-insert-encoded-file): Remove unused
bindings.
(q-encoding-ccl-decode-string): Remove useless
`string-as-unibyte' call.
(q-encoding-ccl-encoded-length): New function.

* mel.el (q-encoding-ccl-encoded-length): New autoload.
(q-encoding-encoded-length): Use
`q-encoding-ccl-encoded-length' if defined.

ChangeLog
mel-ccl.el
mel.el

index 6ce2cb9..b47e8ec 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,37 @@
 1998-09-10  Tanaka Akira      <akr@jaist.ac.jp>
 
+       * mel-ccl.el (mel-ccl-encode-q-generic): New compile-time
+       function.
+       (mel-ccl-count-q-length): New compile-time function.
+       (mel-ccl-encode-uq): Use `mel-ccl-encode-q-generic'.
+       (mel-ccl-encode-cq): Use `mel-ccl-encode-q-generic'.
+       (mel-ccl-encode-pq): Use `mel-ccl-encode-q-generic'.
+       (mel-ccl-count-uq): New CCL program.
+       (mel-ccl-count-cq): Ditto.
+       (mel-ccl-count-pq): Ditto.
+       (mel-ccl-encode-base64-generic): New function.
+       (mel-ccl-encode-b): Use `mel-ccl-encode-base64-generic'.
+       (mel-ccl-encode-base64-crlf-crlf): Use
+       `mel-ccl-encode-base64-generic'.
+       (mel-ccl-encode-base64-crlf-lf): Use
+       `mel-ccl-encode-base64-generic'.
+       (base64-ccl-encode-string): Use `mel-ccl-base64-lf-rev' instead
+       of `mel-ccl-b-rev' for folding.
+       (base64-ccl-encode-region): Ditto.
+       (base64-ccl-decode-string): Remove useless `string-as-unibyte'
+       call.
+       (quoted-printable-ccl-insert-encoded-file): Remove unused
+       bindings.
+       (q-encoding-ccl-decode-string): Remove useless
+       `string-as-unibyte' call.
+       (q-encoding-ccl-encoded-length): New function.
+
+       * mel.el (q-encoding-ccl-encoded-length): New autoload.
+       (q-encoding-encoded-length): Use
+       `q-encoding-ccl-encoded-length' if defined.
+
+1998-09-10  Tanaka Akira      <akr@jaist.ac.jp>
+
        * mime-def.el (mime-library-version-string): bump up to
        FLAM-DOODLE 1.9.3.
 
index df33662..0dfe2b8 100644 (file)
@@ -189,7 +189,9 @@ abcdefghijklmnopqrstuvwxyz\
               `(write-repeat ,r0))))
           mel-ccl-256-table))))))
 
-(define-ccl-program mel-ccl-encode-uq
+(eval-when-compile
+
+(defun mel-ccl-encode-q-generic (raw)
   `(3
     (loop
      (loop
@@ -199,7 +201,7 @@ abcdefghijklmnopqrstuvwxyz\
           (lambda (r0)
             (cond
              ((= r0 32) `(write-repeat ?_))
-             ((member r0 mel-ccl-u-raw) `(write-repeat ,r0))
+             ((member r0 raw) `(write-repeat ,r0))
              (t '(break))))
           mel-ccl-256-table)))
      (write ?=)
@@ -207,45 +209,40 @@ abcdefghijklmnopqrstuvwxyz\
      (write r0 ,mel-ccl-low-table)
      (repeat))))
 
-(define-ccl-program mel-ccl-encode-cq
-  `(3
-    (loop
+;; On xemacs, generated program counts iso-8859-1 8bit character as 6bytes.
+(defun mel-ccl-count-q-length (raw)
+  `(0
+    ((r0 = 0)
      (loop
       (read-branch
-       r0
+       r1
        ,@(mapcar
-          (lambda (r0)
-            (cond
-             ((= r0 32) `(write-repeat ?_))
-             ((member r0 mel-ccl-c-raw) `(write-repeat ,r0))
-             (t '(break))))
-          mel-ccl-256-table)))
-     (write ?=)
-     (write r0 ,mel-ccl-high-table)
-     (write r0 ,mel-ccl-low-table)
-     (repeat))))
+         (lambda (r1)
+           (if (or (= r1 32) (member r1 raw))
+               '((r0 += 1) (repeat))
+             '((r0 += 3) (repeat))))
+         mel-ccl-256-table))))))
 
+)
+
+(define-ccl-program mel-ccl-encode-uq
+  (mel-ccl-encode-q-generic mel-ccl-u-raw))
+(define-ccl-program mel-ccl-encode-cq
+  (mel-ccl-encode-q-generic mel-ccl-c-raw))
 (define-ccl-program mel-ccl-encode-pq
-  `(3
-    (loop
-     (loop
-      (read-branch
-       r0
-       ,@(mapcar
-          (lambda (r0)
-            (cond
-             ((= r0 32) `(write-repeat ?_))
-             ((member r0 mel-ccl-p-raw) `(write-repeat ,r0))
-             (t '(break))))
-          mel-ccl-256-table)))
-     (write ?=)
-     (write r0 ,mel-ccl-high-table)
-     (write r0 ,mel-ccl-low-table)
-     (repeat))))
+  (mel-ccl-encode-q-generic mel-ccl-p-raw))
+
+(define-ccl-program mel-ccl-count-uq
+  (mel-ccl-count-q-length mel-ccl-u-raw))
+(define-ccl-program mel-ccl-count-cq
+  (mel-ccl-count-q-length mel-ccl-c-raw))
+(define-ccl-program mel-ccl-count-pq
+  (mel-ccl-count-q-length mel-ccl-p-raw))
 
 ;;; B/Base64
 
 (eval-when-compile
+
 (defun mel-ccl-decode-b-bit-ex (v)
   (logior
    (lsh (logand v (lsh 255 16)) -16)
@@ -373,76 +370,11 @@ abcdefghijklmnopqrstuvwxyz\
        (write r7)
        (write-repeat r4))))))
 
-;;; B
-
-;; mel-ccl-encode-b works only 20.3 or later because CCL_EOF_BLOCK
-;; is not executed on 20.2 (or former?).
-(define-ccl-program mel-ccl-encode-b
-  `(2
-    (loop
-     (r2 = 0)
-     (read-branch
-      r1
-      ,@(mapcar
-         (lambda (r1)
-           `((write ,(nth (lsh r1 -2) mel-ccl-64-to-256-table))
-             (r0 = ,(logand r1 3))))
-         mel-ccl-256-table))
-     (r2 = 1)
-     (read-branch
-      r1
-      ,@(mapcar
-         (lambda (r1)
-           `((write r0 ,(vconcat
-                         (mapcar
-                          (lambda (r0)
-                            (nth (logior (lsh r0 4)
-                                         (lsh r1 -4))
-                                 mel-ccl-64-to-256-table))
-                          mel-ccl-4-table)))
-             (r0 = ,(logand r1 15))))
-         mel-ccl-256-table))
-     (r2 = 2)
-     (read-branch
-      r1
-      ,@(mapcar
-         (lambda (r1)
-           `((write r0 ,(vconcat
-                         (mapcar
-                          (lambda (r0)
-                            (nth (logior (lsh r0 2)
-                                         (lsh r1 -6))
-                                 mel-ccl-64-to-256-table))
-                          mel-ccl-16-table)))))
-         mel-ccl-256-table))
-     (r1 &= 63)
-     (write r1 ,(vconcat
-                 (mapcar
-                  (lambda (r1)
-                    (nth r1 mel-ccl-64-to-256-table))
-                  mel-ccl-64-table)))
-     (repeat))
-    (branch
-     r2
-     (end)
-     ((write r0 ,(vconcat
-                  (mapcar
-                   (lambda (r0)
-                     (nth (lsh r0 4) mel-ccl-64-to-256-table))
-                   mel-ccl-4-table)))
-      (write "=="))
-     ((write r0 ,(vconcat
-                  (mapcar
-                   (lambda (r0)
-                     (nth (lsh r0 2) mel-ccl-64-to-256-table))
-                   mel-ccl-16-table)))
-      (write ?=)))
-    ))
-
-;;; Base64
+(eval-when-compile
 
-;; mel-ccl-encode-base64 does not works on 20.2 by same reason of mel-ccl-encode-b
-(define-ccl-program mel-ccl-encode-base64-crlf-crlf
+;; 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)
   `(2
     ((r3 = 0)
      (loop
@@ -488,100 +420,51 @@ abcdefghijklmnopqrstuvwxyz\
                      (nth r1 mel-ccl-64-to-256-table))
                    mel-ccl-64-table)))
       (r3 += 1)
-      (if (r3 == 19) ; 4 * 19 = 76 --> line break.
-          ((write "\r\n")
-           (r3 = 0)))
+      ,@(when quantums-per-line
+         `((if (r3 == ,quantums-per-line)
+               ((write ,(if output-crlf "\r\n" "\n"))
+                (r3 = 0)))))
       (repeat)))
     (branch
      r2
-     (if (r0 > 0) (write "\r\n"))
+     ,(if terminate-with-newline
+         `(if (r3 > 0) (write ,(if output-crlf "\r\n" "\n")))
+       `(r0 = 0))
      ((write r0 ,(vconcat
                   (mapcar
                    (lambda (r0)
                      (nth (lsh r0 4) mel-ccl-64-to-256-table))
                    mel-ccl-4-table)))
-      (write "==\r\n"))
+      (write ,(if terminate-with-newline
+                 (if output-crlf "==\r\n" "==\n")
+               "==")))
      ((write r0 ,(vconcat
                   (mapcar
                    (lambda (r0)
                      (nth (lsh r0 2) mel-ccl-64-to-256-table))
                    mel-ccl-16-table)))
-      (write "=\r\n")))
+      (write ,(if terminate-with-newline
+                 (if output-crlf "=\r\n" "=\n")
+               "="))))
     ))
+)
+
+(define-ccl-program mel-ccl-encode-b
+  (mel-ccl-encode-base64-generic))
+
+;; 19 * 4 = 76
+(define-ccl-program mel-ccl-encode-base64-crlf-crlf
+  (mel-ccl-encode-base64-generic 19 t))
 
-;; produce newline as LF instead of CRLF.
 (define-ccl-program mel-ccl-encode-base64-crlf-lf
-  `(2
-    ((r3 = 0)
-     (loop
-      (r2 = 0)
-      (read-branch
-       r1
-       ,@(mapcar
-          (lambda (r1)
-            `((write ,(nth (lsh r1 -2) mel-ccl-64-to-256-table))
-              (r0 = ,(logand r1 3))))
-          mel-ccl-256-table))
-      (r2 = 1)
-      (read-branch
-       r1
-       ,@(mapcar
-          (lambda (r1)
-            `((write r0 ,(vconcat
-                          (mapcar
-                           (lambda (r0)
-                             (nth (logior (lsh r0 4)
-                                          (lsh r1 -4))
-                                  mel-ccl-64-to-256-table))
-                           mel-ccl-4-table)))
-              (r0 = ,(logand r1 15))))
-          mel-ccl-256-table))
-      (r2 = 2)
-      (read-branch
-       r1
-       ,@(mapcar
-          (lambda (r1)
-            `((write r0 ,(vconcat
-                          (mapcar
-                           (lambda (r0)
-                             (nth (logior (lsh r0 2)
-                                          (lsh r1 -6))
-                                  mel-ccl-64-to-256-table))
-                           mel-ccl-16-table)))))
-          mel-ccl-256-table))
-      (r1 &= 63)
-      (write r1 ,(vconcat
-                  (mapcar
-                   (lambda (r1)
-                     (nth r1 mel-ccl-64-to-256-table))
-                   mel-ccl-64-table)))
-      (r3 += 1)
-      (if (r3 == 19) ; 4 * 19 = 76 --> line break.
-          ((write "\n")
-           (r3 = 0)))
-      (repeat)))
-    (branch
-     r2
-     (if (r0 > 0) (write "\n"))
-     ((write r0 ,(vconcat
-                  (mapcar
-                   (lambda (r0)
-                     (nth (lsh r0 4) mel-ccl-64-to-256-table))
-                   mel-ccl-4-table)))
-      (write "==\n"))
-     ((write r0 ,(vconcat
-                  (mapcar
-                   (lambda (r0)
-                     (nth (lsh r0 2) mel-ccl-64-to-256-table))
-                   mel-ccl-16-table)))
-      (write "=\n")))
-    ))
+  (mel-ccl-encode-base64-generic 19 nil))
 
 ;; Quoted-Printable
 
 (eval-when-compile
 
-;; mel-ccl-encode-quoted-printable does not works on 20.2 by same reason of mel-ccl-encode-b
+;; Generated CCL program works not properly on 20.2 because CCL_EOF_BLOCK
+;; is not executed.
 (defun mel-ccl-encode-quoted-printable-generic (input-crlf output-crlf)
   `(4
     ((r6 = 0)                          ; column
@@ -1192,26 +1075,26 @@ abcdefghijklmnopqrstuvwxyz\
 (unless (and (boundp 'ccl-encoder-eof-block-is-broken)
             ccl-encoder-eof-block-is-broken)
 
-(defun base64-ccl-encode-string (string)
-  "Encode STRING with base64 encoding."
-  (decode-coding-string string 'mel-ccl-b-rev))
+  (defun base64-ccl-encode-string (string)
+    "Encode STRING with base64 encoding."
+    (decode-coding-string string 'mel-ccl-base64-lf-rev))
 
-(defun base64-ccl-encode-region (start end)
-  "Encode region from START to END with base64 encoding."
-  (interactive "r")
-  (decode-coding-region start end 'mel-ccl-b-rev))
+  (defun base64-ccl-encode-region (start end)
+    "Encode region from START to END with base64 encoding."
+    (interactive "r")
+    (decode-coding-region start end 'mel-ccl-base64-lf-rev))
 
-(defun base64-ccl-insert-encoded-file (filename)
-  "Encode contents of file FILENAME to base64, and insert the result."
-  (interactive (list (read-file-name "Insert encoded file: ")))
-  (let ((coding-system-for-read 'mel-ccl-b-rev))
-    (insert-file-contents filename)))
+  (defun base64-ccl-insert-encoded-file (filename)
+    "Encode contents of file FILENAME to base64, and insert the result."
+    (interactive (list (read-file-name "Insert encoded file: ")))
+    (let ((coding-system-for-read 'mel-ccl-b-rev))
+      (insert-file-contents filename)))
 
-)
+  )
 
 (defun base64-ccl-decode-string (string)
   "Decode base64 encoded STRING"
-  (string-as-unibyte (encode-coding-string string 'mel-ccl-b-rev)))
+  (encode-coding-string string 'mel-ccl-b-rev))
 
 (defun base64-ccl-decode-region (start end)
   "Decode base64 encoded the region from START to END."
@@ -1233,26 +1116,25 @@ abcdefghijklmnopqrstuvwxyz\
 (unless (and (boundp 'ccl-encoder-eof-block-is-broken)
             ccl-encoder-eof-block-is-broken)
 
-(defun quoted-printable-ccl-encode-string (string)
-  "Encode STRING with quoted-printable encoding."
-  (decode-coding-string
-   string
-   'mel-ccl-quoted-printable-lf-lf-rev))
+  (defun quoted-printable-ccl-encode-string (string)
+    "Encode STRING with quoted-printable encoding."
+    (decode-coding-string
+     string
+     'mel-ccl-quoted-printable-lf-lf-rev))
 
-(defun quoted-printable-ccl-encode-region (start end)
-  "Encode the region from START to END with quoted-printable
+  (defun quoted-printable-ccl-encode-region (start end)
+    "Encode the region from START to END with quoted-printable
 encoding."
-  (interactive "r")
-  (decode-coding-region start end 'mel-ccl-quoted-printable-lf-lf-rev))
+    (interactive "r")
+    (decode-coding-region start end 'mel-ccl-quoted-printable-lf-lf-rev))
 
-(defun quoted-printable-ccl-insert-encoded-file (filename)
-  "Encode contents of the file named as FILENAME, and insert it."
-  (interactive (list (read-file-name "Insert encoded file: ")))
-  (let ((start (point)) end
-       (coding-system-for-read 'mel-ccl-quoted-printable-lf-lf-rev))
-    (insert-file-contents filename)))
+  (defun quoted-printable-ccl-insert-encoded-file (filename)
+    "Encode contents of the file named as FILENAME, and insert it."
+    (interactive (list (read-file-name "Insert encoded file: ")))
+    (let ((coding-system-for-read 'mel-ccl-quoted-printable-lf-lf-rev))
+      (insert-file-contents filename)))
 
-)
+  )
 
 (defun quoted-printable-ccl-decode-string (string)
   "Decode quoted-printable encoded STRING."
@@ -1292,11 +1174,26 @@ MODE allows `text', `comment', `phrase' or nil.  Default value is
 
 (defun q-encoding-ccl-decode-string (string)
   "Decode Q encoded STRING and return the result."
-  (string-as-unibyte
-   (encode-coding-string
-    string
-    'mel-ccl-uq-rev)))
+  (encode-coding-string
+   string
+   'mel-ccl-uq-rev))
 
+(unless running-xemacs
+  (defun q-encoding-ccl-encoded-length (string &optional mode)
+    "Encode STRING to Q-encoding of encoded-word, and return the result.
+MODE allows `text', `comment', `phrase' or nil.  Default value is
+`phrase'."
+    (let ((status [nil nil nil nil nil nil nil nil nil]))
+      (fillarray status nil)
+      (ccl-execute-on-string
+       (cond
+       ((eq mode 'text) 'mel-ccl-count-uq)
+       ((eq mode 'comment) 'mel-ccl-count-cq)
+       (t 'mel-ccl-count-pq))
+       status
+       string)
+      (aref status 0)))
+  )
 
 ;;; @ end
 ;;;
diff --git a/mel.el b/mel.el
index 2f5ddd2..c113b92 100644 (file)
--- a/mel.el
+++ b/mel.el
@@ -72,40 +72,40 @@ external decoder is called.")
 
 (when base64-dl-module
   (autoload 'base64-dl-encode-string "mel-dl"
-   "Encode STRING to base64, and return the result.")
+    "Encode STRING to base64, and return the result.")
   (autoload 'base64-dl-decode-string "mel-dl"
-   "Decode STRING which is encoded in base64, and return the result.")
+    "Decode STRING which is encoded in base64, and return the result.")
   (autoload 'base64-dl-encode-region "mel-dl"
-   "Encode current region by base64." t)
+    "Encode current region by base64." t)
   (autoload 'base64-dl-decode-region "mel-dl"
-   "Decode current region by base64." t))
+    "Decode current region by base64." t))
 
 ;; mel-b
 (autoload 'base64-internal-encode-string "mel-b"
- "Encode STRING to base64, and return the result.")
+  "Encode STRING to base64, and return the result.")
 (autoload 'base64-internal-decode-string "mel-b"
- "Decode STRING which is encoded in base64, and return the result.")
+  "Decode STRING which is encoded in base64, and return the result.")
 (autoload 'base64-internal-encode-region "mel-b"
- "Encode current region by base64." t)
+  "Encode current region by base64." t)
 (autoload 'base64-internal-decode-region "mel-b"
- "Decode current region by base64." t)
+  "Decode current region by base64." t)
 (autoload 'base64-internal-insert-encoded-file "mel-b"
- "Encode contents of file to base64, and insert the result." t)
+  "Encode contents of file to base64, and insert the result." t)
 (autoload 'base64-internal-write-decoded-region "mel-b"
- "Decode and write current region encoded by base64 into FILENAME." t)
+  "Decode and write current region encoded by base64 into FILENAME." t)
 
 (autoload 'base64-external-encode-string "mel-b"
- "Encode STRING to base64, and return the result.")
+  "Encode STRING to base64, and return the result.")
 (autoload 'base64-external-decode-string "mel-b"
- "Decode STRING which is encoded in base64, and return the result.")
+  "Decode STRING which is encoded in base64, and return the result.")
 (autoload 'base64-external-encode-region "mel-b"
- "Encode current region by base64." t)
+  "Encode current region by base64." t)
 (autoload 'base64-external-decode-region "mel-b"
- "Decode current region by base64." t)
+  "Decode current region by base64." t)
 (autoload 'base64-external-insert-encoded-file "mel-b"
- "Encode contents of file to base64, and insert the result." t)
+  "Encode contents of file to base64, and insert the result." t)
 (autoload 'base64-external-write-decoded-region "mel-b"
- "Decode and write current region encoded by base64 into FILENAME." t)
+  "Decode and write current region encoded by base64 into FILENAME." t)
 
 ;; for encoded-word
 (autoload 'base64-internal-encoded-length "mel-b")
@@ -204,18 +204,26 @@ external decoder is called.")
   `phrase'.")
   (autoload 'q-encoding-ccl-decode-string "mel-ccl"
     "Decode Q encoded STRING and return the result.")
-)
+
+  (unless running-xemacs
+    (autoload 'q-encoding-ccl-encoded-length "mel-ccl"
+      "Encode STRING to Q-encoding of encoded-word, and return the result.
+MODE allows `text', `comment', `phrase' or nil.  Default value is
+`phrase'.")
+    )
+  )
+
 
 ;;; @ entrance functions.
 ;;;
 
 (cond
-  ((fboundp 'base64-dl-encode-string)
-    (defalias 'base64-encode-string 'base64-dl-encode-string))
-  ((fboundp 'base64-ccl-encode-string)
-    (defalias 'base64-encode-string 'base64-ccl-encode-string))
-  (t
-    (defalias 'base64-encode-string 'base64-internal-encode-string)))
+ ((fboundp 'base64-dl-encode-string)
+  (defalias 'base64-encode-string 'base64-dl-encode-string))
+ ((fboundp 'base64-ccl-encode-string)
+  (defalias 'base64-encode-string 'base64-ccl-encode-string))
+ (t
+  (defalias 'base64-encode-string 'base64-internal-encode-string)))
 
 (defun base64-internal-external-decode-string (string)
   "Decode STRING which is encoded in base64, and return the result.
@@ -231,12 +239,12 @@ metamail or XEmacs package)."
     (base64-internal-decode-string string)))
 
 (cond
-  ((fboundp 'base64-dl-decode-string)
-    (defalias 'base64-decode-string 'base64-dl-decode-string))
-  ((fboundp 'base64-ccl-decode-string)
-    (defalias 'base64-decode-string 'base64-ccl-decode-string))
-  (t
-    (defalias 'base64-decode-string 'base64-internal-external-decode-string)))
+ ((fboundp 'base64-dl-decode-string)
+  (defalias 'base64-decode-string 'base64-dl-decode-string))
+ ((fboundp 'base64-ccl-decode-string)
+  (defalias 'base64-decode-string 'base64-ccl-decode-string))
+ (t
+  (defalias 'base64-decode-string 'base64-internal-external-decode-string)))
 
 (defun base64-internal-external-encode-region (start end)
   "Encode current region by base64.
@@ -253,12 +261,12 @@ metamail or XEmacs package)."
     (base64-internal-encode-region start end)))
 
 (cond
-  ((fboundp 'base64-dl-encode-region)
-    (defalias 'base64-encode-region 'base64-dl-encode-region)) ; no fold
-  ((fboundp 'base64-ccl-encode-region)
-    (defalias 'base64-encode-region 'base64-ccl-encode-region)) ; no fold
-  (t
-    (defalias 'base64-encode-region 'base64-internal-external-encode-region))) ; LF fold
+ ((fboundp 'base64-dl-encode-region)
+  (defalias 'base64-encode-region 'base64-dl-encode-region)) ; no fold
+ ((fboundp 'base64-ccl-encode-region)
+  (defalias 'base64-encode-region 'base64-ccl-encode-region)) ; LF fold
+ (t
+  (defalias 'base64-encode-region 'base64-internal-external-encode-region))) ; LF fold
 
 (defun base64-internal-external-decode-region (start end)
   "Decode current region by base64.
@@ -275,12 +283,12 @@ metamail or XEmacs package)."
     (base64-internal-decode-region start end)))
 
 (cond
-  ((fboundp 'base64-dl-decode-region)
-    (defalias 'base64-decode-region 'base64-dl-decode-region))
-  ((fboundp 'base64-ccl-decode-region)
-    (defalias 'base64-decode-region 'base64-ccl-decode-region))
-  (t
-    (defalias 'base64-decode-region 'base64-internal-external-decode-region)))
+ ((fboundp 'base64-dl-decode-region)
+  (defalias 'base64-decode-region 'base64-dl-decode-region))
+ ((fboundp 'base64-ccl-decode-region)
+  (defalias 'base64-decode-region 'base64-ccl-decode-region))
+ (t
+  (defalias 'base64-decode-region 'base64-internal-external-decode-region)))
 
 (defun base64-internal-external-insert-encoded-file (filename)
   "Encode contents of file FILENAME to base64, and insert the result.
@@ -295,10 +303,10 @@ mmencode included in metamail or XEmacs package)."
     (base64-internal-insert-encoded-file filename)))
 
 (cond
-  ((fboundp 'base64-ccl-insert-encoded-file)
-    (defalias 'base64-insert-encoded-file 'base64-ccl-insert-encoded-file))
-  (t
-    (defalias 'base64-insert-encoded-file 'base64-internal-external-insert-encoded-file)))
+ ((fboundp 'base64-ccl-insert-encoded-file)
+  (defalias 'base64-insert-encoded-file 'base64-ccl-insert-encoded-file))
+ (t
+  (defalias 'base64-insert-encoded-file 'base64-internal-external-insert-encoded-file)))
 
 (defun base64-internal-external-write-decoded-region (start end filename)
   "Decode and write current region encoded by base64 into FILENAME.
@@ -312,134 +320,136 @@ START and END are buffer positions."
     (base64-internal-write-decoded-region start end filename)))
 
 (cond
-  ((fboundp 'base64-ccl-write-decoded-region)
-    (defalias 'base64-write-decoded-region 'base64-ccl-write-decoded-region))
-  (t
-    (defalias 'base64-write-decoded-region 'base64-internal-external-write-decoded-region)))
+ ((fboundp 'base64-ccl-write-decoded-region)
+  (defalias 'base64-write-decoded-region 'base64-ccl-write-decoded-region))
+ (t
+  (defalias 'base64-write-decoded-region 'base64-internal-external-write-decoded-region)))
 
 (cond
-  (t
-    (defalias 'base64-encoded-length 'base64-internal-encoded-length)))
+ (t
+  (defalias 'base64-encoded-length 'base64-internal-encoded-length)))
 
 (cond
-  ((fboundp 'quoted-printable-ccl-encode-string)
-    (defalias 'quoted-printable-encode-string 'quoted-printable-ccl-encode-string))
-  (t
-    (defun quoted-printable-encode-string (string)
-      "Encode STRING to quoted-printable, and return the result."
-      (if (and quoted-printable-internal-encoding-limit
-               (> (length string) quoted-printable-internal-encoding-limit))
-          (quoted-printable-external-encode-string string)
-        (quoted-printable-internal-encode-string string)))))
+ ((fboundp 'quoted-printable-ccl-encode-string)
+  (defalias 'quoted-printable-encode-string 'quoted-printable-ccl-encode-string))
+ (t
+  (defun quoted-printable-encode-string (string)
+    "Encode STRING to quoted-printable, and return the result."
+    (if (and quoted-printable-internal-encoding-limit
+            (> (length string) quoted-printable-internal-encoding-limit))
+       (quoted-printable-external-encode-string string)
+      (quoted-printable-internal-encode-string string)))))
 
 (cond
-  ((fboundp 'quoted-printable-ccl-decode-string)
-    (defalias 'quoted-printable-decode-string 'quoted-printable-ccl-decode-string))
-  (t
-    (defun quoted-printable-decode-string (string)
-      "Decode STRING which is encoded in quoted-printable, and return the result."
-      (if (and quoted-printable-internal-decoding-limit
-               (> (length string) quoted-printable-internal-decoding-limit))
-          (quoted-printable-external-decode-string string)
-        (quoted-printable-internal-decode-string string)))))
+ ((fboundp 'quoted-printable-ccl-decode-string)
+  (defalias 'quoted-printable-decode-string 'quoted-printable-ccl-decode-string))
+ (t
+  (defun quoted-printable-decode-string (string)
+    "Decode STRING which is encoded in quoted-printable, and return the result."
+    (if (and quoted-printable-internal-decoding-limit
+            (> (length string) quoted-printable-internal-decoding-limit))
+       (quoted-printable-external-decode-string string)
+      (quoted-printable-internal-decode-string string)))))
 
 (cond
-  ((fboundp 'quoted-printable-ccl-encode-region)
-    (defalias 'quoted-printable-encode-region 'quoted-printable-ccl-encode-region))
-  (t
-    (defun quoted-printable-encode-region (start end)
-      "Encode current region by quoted-printable.
+ ((fboundp 'quoted-printable-ccl-encode-region)
+  (defalias 'quoted-printable-encode-region 'quoted-printable-ccl-encode-region))
+ (t
+  (defun quoted-printable-encode-region (start end)
+    "Encode current region by quoted-printable.
 START and END are buffer positions.
 This function calls internal quoted-printable encoder if size of
 region is smaller than `quoted-printable-internal-encoding-limit',
 otherwise it calls external quoted-printable encoder specified by
 `quoted-printable-external-encoder'.  In this case, you must install
 the program (maybe mmencode included in metamail or XEmacs package)."
-      (interactive "r")
-      (if (and quoted-printable-internal-encoding-limit
-               (> (- end start) quoted-printable-internal-encoding-limit))
-          (quoted-printable-external-encode-region start end)
-        (quoted-printable-internal-encode-region start end)
-        ))))
+    (interactive "r")
+    (if (and quoted-printable-internal-encoding-limit
+            (> (- end start) quoted-printable-internal-encoding-limit))
+       (quoted-printable-external-encode-region start end)
+      (quoted-printable-internal-encode-region start end)
+      ))))
 
 (cond
-  ((fboundp 'quoted-printable-ccl-decode-region)
-    (defalias 'quoted-printable-decode-region 'quoted-printable-ccl-decode-region))
-  (t
-    (defun quoted-printable-decode-region (start end)
-      "Decode current region by quoted-printable.
+ ((fboundp 'quoted-printable-ccl-decode-region)
+  (defalias 'quoted-printable-decode-region 'quoted-printable-ccl-decode-region))
+ (t
+  (defun quoted-printable-decode-region (start end)
+    "Decode current region by quoted-printable.
 START and END are buffer positions.
 This function calls internal quoted-printable decoder if size of
 region is smaller than `quoted-printable-internal-decoding-limit',
 otherwise it calls external quoted-printable decoder specified by
 `quoted-printable-external-decoder'.  In this case, you must install
 the program (maybe mmencode included in metamail or XEmacs package)."
-      (interactive "r")
-      (if (and quoted-printable-internal-decoding-limit
-               (> (- end start) quoted-printable-internal-decoding-limit))
-          (quoted-printable-external-decode-region start end)
-        (quoted-printable-internal-decode-region start end)
-        ))))
+    (interactive "r")
+    (if (and quoted-printable-internal-decoding-limit
+            (> (- end start) quoted-printable-internal-decoding-limit))
+       (quoted-printable-external-decode-region start end)
+      (quoted-printable-internal-decode-region start end)
+      ))))
 
 (cond
-  ((fboundp 'quoted-printable-ccl-insert-encoded-file)
-    (defalias 'quoted-printable-insert-encoded-file 'quoted-printable-ccl-insert-encoded-file))
-  (t
-    (defalias 'quoted-printable-insert-encoded-file 'quoted-printable-external-insert-encoded-file)))
+ ((fboundp 'quoted-printable-ccl-insert-encoded-file)
+  (defalias 'quoted-printable-insert-encoded-file 'quoted-printable-ccl-insert-encoded-file))
+ (t
+  (defalias 'quoted-printable-insert-encoded-file 'quoted-printable-external-insert-encoded-file)))
 
 (cond
-  ((fboundp 'quoted-printable-ccl-write-decoded-region)
-    (defalias 'quoted-printable-write-decoded-region 'quoted-printable-ccl-write-decoded-region))
-  (t
-    (defalias 'quoted-printable-write-decoded-region 'quoted-printable-external-write-decoded-region)))
+ ((fboundp 'quoted-printable-ccl-write-decoded-region)
+  (defalias 'quoted-printable-write-decoded-region 'quoted-printable-ccl-write-decoded-region))
+ (t
+  (defalias 'quoted-printable-write-decoded-region 'quoted-printable-external-write-decoded-region)))
 
 (cond
-  ((fboundp 'q-encoding-ccl-encode-string)
-    (defalias 'q-encoding-encode-string 'q-encoding-ccl-encode-string))
-  (t
-    (defalias 'q-encoding-encode-string 'q-encoding-internal-encode-string)))
+ ((fboundp 'q-encoding-ccl-encode-string)
+  (defalias 'q-encoding-encode-string 'q-encoding-ccl-encode-string))
+ (t
+  (defalias 'q-encoding-encode-string 'q-encoding-internal-encode-string)))
 
 (cond
-  ((fboundp 'q-encoding-ccl-decode-string)
-    (defalias 'q-encoding-decode-string 'q-encoding-ccl-decode-string))
-  (t
-    (defalias 'q-encoding-decode-string 'q-encoding-internal-decode-string)))
+ ((fboundp 'q-encoding-ccl-decode-string)
+  (defalias 'q-encoding-decode-string 'q-encoding-ccl-decode-string))
+ (t
+  (defalias 'q-encoding-decode-string 'q-encoding-internal-decode-string)))
 
 (cond
-  (t
-    (defalias 'q-encoding-encoded-length 'q-encoding-internal-encoded-length)))
+ ((fboundp 'q-encoding-ccl-encoded-length)
+  (defalias 'q-encoding-encoded-length 'q-encoding-ccl-encoded-length))
+ (t
+  (defalias 'q-encoding-encoded-length 'q-encoding-internal-encoded-length)))
 
 (cond
-  (t
-    (defalias 'uuencode-encode-region 'uuencode-external-encode-region)))
+ (t
+  (defalias 'uuencode-encode-region 'uuencode-external-encode-region)))
 
 (cond
-  (t
-    (defalias 'uuencode-decode-region 'uuencode-external-decode-region)))
+ (t
+  (defalias 'uuencode-decode-region 'uuencode-external-decode-region)))
 
 (cond
-  (t
-    (defalias 'uuencode-insert-encoded-file 'uuencode-external-insert-encoded-file)))
+ (t
+  (defalias 'uuencode-insert-encoded-file 'uuencode-external-insert-encoded-file)))
 
 (cond
-  (t
-    (defalias 'uuencode-write-decoded-region 'uuencode-external-write-decoded-region)))
+ (t
+  (defalias 'uuencode-write-decoded-region 'uuencode-external-write-decoded-region)))
 
 (cond
-  (t
-    (defalias 'gzip64-encode-region 'gzip64-external-encode-region)))
+ (t
+  (defalias 'gzip64-encode-region 'gzip64-external-encode-region)))
 
 (cond
-  (t
-    (defalias 'gzip64-decode-region 'gzip64-external-decode-region)))
+ (t
+  (defalias 'gzip64-decode-region 'gzip64-external-decode-region)))
 
 (cond
-  (t
-    (defalias 'gzip64-insert-encoded-file 'gzip64-external-insert-encoded-file)))
+ (t
+  (defalias 'gzip64-insert-encoded-file 'gzip64-external-insert-encoded-file)))
 
 (cond
-  (t
-    (defalias 'gzip64-write-decoded-region 'gzip64-external-write-decoded-region)))
+ (t
+  (defalias 'gzip64-write-decoded-region 'gzip64-external-write-decoded-region)))
 
 ;;; @ region
 ;;;