From d41488bbd741d4c77bdd10884808aadcf4126286 Mon Sep 17 00:00:00 2001 From: akr Date: Thu, 12 Nov 1998 13:10:06 +0000 Subject: [PATCH] * FLIM-ELS: (flim-modules): Install mel-b-ccl.el for mule-2.3@19.34. * mel-b-ccl.el (mel-ccl-decode-b): Check `ccl-cascading-read' to select implementation. (mel-ccl-encode-b): Use `define-long-ccl-program' to define. (mel-ccl-encode-base64-crlf-crlf): Ditto. (mel-ccl-encode-base64-crlf-lf): Ditto. --- ChangeLog | 11 +++ FLIM-ELS | 3 +- mel-b-ccl.el | 219 +++++++++++++++++++++++++++++++++++----------------------- 3 files changed, 145 insertions(+), 88 deletions(-) diff --git a/ChangeLog b/ChangeLog index f022f26..1878246 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,16 @@ 1998-11-12 Tanaka Akira + * FLIM-ELS: (flim-modules): Install mel-b-ccl.el for + mule-2.3@19.34. + + * mel-b-ccl.el (mel-ccl-decode-b): Check `ccl-cascading-read' to + select implementation. + (mel-ccl-encode-b): Use `define-long-ccl-program' to define. + (mel-ccl-encode-base64-crlf-crlf): Ditto. + (mel-ccl-encode-base64-crlf-lf): Ditto. + +1998-11-12 Tanaka Akira + * FLIM-ELS: (flim-modules): Do not install mel-b-ccl.el for mule-2.3@19.34. diff --git a/FLIM-ELS b/FLIM-ELS index ae577f4..c169dab 100644 --- a/FLIM-ELS +++ b/FLIM-ELS @@ -21,8 +21,7 @@ (require 'pccl) (unless-broken ccl-usable - (if (not (and (boundp 'MULE) MULE)) - (setq flim-modules (cons 'mel-b-ccl flim-modules))) + (setq flim-modules (cons 'mel-b-ccl flim-modules)) (setq flim-modules (cons 'mel-q-ccl flim-modules))) ;;; FLIM-ELS ends here diff --git a/mel-b-ccl.el b/mel-b-ccl.el index b01650c..7049b1e 100644 --- a/mel-b-ccl.el +++ b/mel-b-ccl.el @@ -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-long-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 @@ -307,14 +354,14 @@ abcdefghijklmnopqrstuvwxyz\ )) ) -(define-ccl-program mel-ccl-encode-b +(define-long-ccl-program mel-ccl-encode-b (mel-ccl-encode-base64-generic)) ;; 19 * 4 = 76 -(define-ccl-program mel-ccl-encode-base64-crlf-crlf +(define-long-ccl-program mel-ccl-encode-base64-crlf-crlf (mel-ccl-encode-base64-generic 19 t)) -(define-ccl-program mel-ccl-encode-base64-crlf-lf +(define-long-ccl-program mel-ccl-encode-base64-crlf-lf (mel-ccl-encode-base64-generic 19 nil)) -- 1.7.10.4