From ad48c8cef55bea00a362e6be6833ebca0f8d8f69 Mon Sep 17 00:00:00 2001 From: akr Date: Wed, 9 Sep 1998 18:53:51 +0000 Subject: [PATCH] * mel-ccl.el (mel-ccl-28-table): New compile time constant. (mel-ccl-64-to-256-table): Ditto. (mel-ccl-qp-table): Mark LF. (mel-ccl-16-to-256-table): Convert integer from character. (mel-ccl-u-raw): Ditto. (mel-ccl-c-raw): Ditto. (mel-ccl-p-raw): Ditto. (mel-ccl-decode-q): Ditto. (mel-ccl-encode-base64): Abolished. (mel-ccl-encode-base64-crlf-crlf): Renamed from `mel-ccl-encode-base64'. (mel-ccl-encode-base64-crlf-lf): New CCL program. (mel-ccl-encode-quoted-printable-generic): New compile-time function. (mel-ccl-decode-quoted-printable-generic): Ditto. (mel-ccl-encode-quoted-printable): Abolished. (mel-ccl-decode-quoted-printable): Ditto. (mel-ccl-encode-quoted-printable-crlf-crlf): New CCL program. (mel-ccl-encode-quoted-printable-crlf-lf): Ditto. (mel-ccl-encode-quoted-printable-lf-crlf): Ditto. (mel-ccl-encode-quoted-printable-lf-lf): Ditto. (mel-ccl-decode-quoted-printable-crlf-crlf): Ditto. (mel-ccl-decode-quoted-printable-crlf-lf): Ditto. (mel-ccl-decode-quoted-printable-lf-crlf): Ditto. (mel-ccl-decode-quoted-printable-lf-lf): Ditto. (mel-ccl-uq): Abolished. (mel-ccl-cq): Ditto. (mel-ccl-pq): Ditto. (mel-ccl-b): Ditto. (mel-ccl-quoted-printable): Ditto. (mel-ccl-base64): Ditto. (mel-ccl-uq-rev): New coding-system. (mel-ccl-cq-rev): Ditto. (mel-ccl-pq-rev): Ditto. (mel-ccl-quoted-printable-crlf-crlf-rev): Ditto. (mel-ccl-quoted-printable-crlf-lf-rev): Ditto. (mel-ccl-quoted-printable-lf-crlf-rev): Ditto. (mel-ccl-quoted-printable-lf-lf-rev): Ditto. (mel-ccl-base64-crlf): Ditto. (mel-ccl-base64-lf): Ditto. (base64-ccl-encode-string): Use `mel-ccl-b-rev'. (base64-ccl-encode-region): Ditto. (base64-ccl-insert-encoded-file): Ditto. (base64-ccl-decode-string): Ditto. (base64-ccl-decode-region): Ditto. (quoted-printable-ccl-encode-string): Use `mel-ccl-quoted-printable-lf-lf-rev'. (quoted-printable-ccl-encode-region): Ditto. (quoted-printable-ccl-insert-encoded-file): Ditto. (quoted-printable-ccl-decode-string): Ditto. (quoted-printable-ccl-decode-region): Ditto. (quoted-printable-ccl-write-decoded-region): Ditto. (q-encoding-ccl-encode-string): Use `mel-ccl-uq-rev', `mel-ccl-cq-rev' and `mel-ccl-pq-rev'. (q-encoding-ccl-decode-string): Use `mel-ccl-uq-rev'. --- ChangeLog | 58 ++++ ew-dec.el | 4 + mel-ccl.el | 902 ++++++++++++++++++++++++++++++++++++++++++------------------ 3 files changed, 689 insertions(+), 275 deletions(-) diff --git a/ChangeLog b/ChangeLog index 97e92e4..166df7e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,61 @@ +1998-09-09 Tanaka Akira + + * mel-ccl.el (mel-ccl-28-table): New compile time constant. + (mel-ccl-64-to-256-table): Ditto. + (mel-ccl-qp-table): Mark LF. + (mel-ccl-16-to-256-table): Convert integer from character. + (mel-ccl-u-raw): Ditto. + (mel-ccl-c-raw): Ditto. + (mel-ccl-p-raw): Ditto. + (mel-ccl-decode-q): Ditto. + (mel-ccl-encode-base64): Abolished. + (mel-ccl-encode-base64-crlf-crlf): Renamed from + `mel-ccl-encode-base64'. + (mel-ccl-encode-base64-crlf-lf): New CCL program. + (mel-ccl-encode-quoted-printable-generic): New compile-time + function. + (mel-ccl-decode-quoted-printable-generic): Ditto. + (mel-ccl-encode-quoted-printable): Abolished. + (mel-ccl-decode-quoted-printable): Ditto. + (mel-ccl-encode-quoted-printable-crlf-crlf): New CCL program. + (mel-ccl-encode-quoted-printable-crlf-lf): Ditto. + (mel-ccl-encode-quoted-printable-lf-crlf): Ditto. + (mel-ccl-encode-quoted-printable-lf-lf): Ditto. + (mel-ccl-decode-quoted-printable-crlf-crlf): Ditto. + (mel-ccl-decode-quoted-printable-crlf-lf): Ditto. + (mel-ccl-decode-quoted-printable-lf-crlf): Ditto. + (mel-ccl-decode-quoted-printable-lf-lf): Ditto. + (mel-ccl-uq): Abolished. + (mel-ccl-cq): Ditto. + (mel-ccl-pq): Ditto. + (mel-ccl-b): Ditto. + (mel-ccl-quoted-printable): Ditto. + (mel-ccl-base64): Ditto. + (mel-ccl-uq-rev): New coding-system. + (mel-ccl-cq-rev): Ditto. + (mel-ccl-pq-rev): Ditto. + (mel-ccl-quoted-printable-crlf-crlf-rev): Ditto. + (mel-ccl-quoted-printable-crlf-lf-rev): Ditto. + (mel-ccl-quoted-printable-lf-crlf-rev): Ditto. + (mel-ccl-quoted-printable-lf-lf-rev): Ditto. + (mel-ccl-base64-crlf): Ditto. + (mel-ccl-base64-lf): Ditto. + (base64-ccl-encode-string): Use `mel-ccl-b-rev'. + (base64-ccl-encode-region): Ditto. + (base64-ccl-insert-encoded-file): Ditto. + (base64-ccl-decode-string): Ditto. + (base64-ccl-decode-region): Ditto. + (quoted-printable-ccl-encode-string): Use + `mel-ccl-quoted-printable-lf-lf-rev'. + (quoted-printable-ccl-encode-region): Ditto. + (quoted-printable-ccl-insert-encoded-file): Ditto. + (quoted-printable-ccl-decode-string): Ditto. + (quoted-printable-ccl-decode-region): Ditto. + (quoted-printable-ccl-write-decoded-region): Ditto. + (q-encoding-ccl-encode-string): Use `mel-ccl-uq-rev', + `mel-ccl-cq-rev' and `mel-ccl-pq-rev'. + (q-encoding-ccl-decode-string): Use `mel-ccl-uq-rev'. + 1998-09-02 Tanaka Akira * ew-dec.el (ew-decode-field-interest-option-order): New diff --git a/ew-dec.el b/ew-dec.el index 4a70444..d43b3f7 100644 --- a/ew-dec.el +++ b/ew-dec.el @@ -589,4 +589,8 @@ each line is separated by CRLF." (ew-decode-field "From"" ()=?+US-ASCII?Q??=?+US-ASCII?Q?a?= =?US-ASCII?Q??= (aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)") +(let ((ew-default-mime-charset 'iso-2022-jp-2)) + (ew-decode-field-no-cache + "From" "\"Cl\351ment Brousset\" ")) + ) diff --git a/mel-ccl.el b/mel-ccl.el index 5614521..df33662 100644 --- a/mel-ccl.el +++ b/mel-ccl.el @@ -13,6 +13,10 @@ (defconst mel-ccl-16-table '( 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15)) +(defconst mel-ccl-28-table + '( 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 + 16 17 18 19 20 21 22 23 24 25 26 27)) + (defconst mel-ccl-64-table '( 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 @@ -56,7 +60,7 @@ nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)) (defconst mel-ccl-16-to-256-table - '(?0 ?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9 ?A ?B ?C ?D ?E ?F)) + (mapcar 'char-int "0123456789ABCDEF")) (defconst mel-ccl-high-table (vconcat @@ -71,28 +75,28 @@ mel-ccl-256-table))) (defconst mel-ccl-u-raw - (append - "0123456789" - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz" - "!@#$%&'()*+,-./:;<>@[\\]^`{|}~" - ())) + (mapcar + 'char-int + "0123456789\ +ABCDEFGHIJKLMNOPQRSTUVWXYZ\ +abcdefghijklmnopqrstuvwxyz\ +!@#$%&'()*+,-./:;<>@[\\]^`{|}~")) (defconst mel-ccl-c-raw - (append - "0123456789" - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz" - "!@#$%&'*+,-./:;<>@[]^`{|}~" - ())) + (mapcar + 'char-int + "0123456789\ +ABCDEFGHIJKLMNOPQRSTUVWXYZ\ +abcdefghijklmnopqrstuvwxyz\ +!@#$%&'*+,-./:;<>@[]^`{|}~")) (defconst mel-ccl-p-raw - (append - "0123456789" - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz" - "!*+-/" - ())) + (mapcar + 'char-int + "0123456789\ +ABCDEFGHIJKLMNOPQRSTUVWXYZ\ +abcdefghijklmnopqrstuvwxyz\ +!*+-/")) (defconst mel-ccl-256-to-64-table '(nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil @@ -113,13 +117,15 @@ nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil)) (defconst mel-ccl-64-to-256-table - '(?A ?B ?C ?D ?E ?F ?G ?H ?I ?J ?K ?L ?M ?N ?O ?P - ?Q ?R ?S ?T ?U ?V ?W ?X ?Y ?Z ?a ?b ?c ?d ?e ?f - ?g ?h ?i ?j ?k ?l ?m ?n ?o ?p ?q ?r ?s ?t ?u ?v - ?w ?x ?y ?z ?0 ?1 ?2 ?3 ?4 ?5 ?6 ?7 ?8 ?9 ?+ ?/)) + (mapcar + 'char-int + "ABCDEFGHIJKLMNOPQRSTUVWXYZ\ +abcdefghijklmnopqrstuvwxyz\ +0123456789\ ++/")) (defconst mel-ccl-qp-table - [enc enc enc enc enc enc enc enc enc wsp enc enc enc cr enc enc + [enc enc enc enc enc enc enc enc enc wsp lf enc enc cr enc enc enc enc enc enc enc enc enc enc enc enc enc enc enc enc enc enc wsp raw raw raw raw raw raw raw raw raw raw raw raw raw raw raw raw raw raw raw raw raw raw raw raw raw raw raw raw enc raw raw @@ -142,6 +148,8 @@ ;;; @ CCL programs ;;; +;;; Q + (define-ccl-program mel-ccl-decode-q `(1 ((loop @@ -150,9 +158,9 @@ ,@(mapcar (lambda (r0) (cond - ((= r0 ?_) + ((= r0 (char-int ?_)) `(write-repeat ? )) - ((= r0 ?=) + ((= r0 (char-int ?=)) `((loop (read-branch r1 @@ -235,6 +243,8 @@ (write r0 ,mel-ccl-low-table) (repeat)))) +;;; B/Base64 + (eval-when-compile (defun mel-ccl-decode-b-bit-ex (v) (logior @@ -363,6 +373,8 @@ (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 @@ -427,8 +439,10 @@ (write ?=))) )) +;;; Base64 + ;; 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 +(define-ccl-program mel-ccl-encode-base64-crlf-crlf `(2 ((r3 = 0) (loop @@ -495,14 +509,86 @@ (write "=\r\n"))) )) +;; 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"))) + )) + +;; Quoted-Printable + +(eval-when-compile + ;; mel-ccl-encode-quoted-printable does not works on 20.2 by same reason of mel-ccl-encode-b -(define-ccl-program mel-ccl-encode-quoted-printable +(defun mel-ccl-encode-quoted-printable-generic (input-crlf output-crlf) `(4 - ((r6 = 0) ; column - (r5 = 0) ; previous character is white space + ((r6 = 0) ; column + (r5 = 0) ; previous character is white space (r4 = 0) (read r0) - (loop ; r6 <= 75 + (loop ; r6 <= 75 (loop (loop (branch @@ -514,7 +600,12 @@ ((eq tmp 'raw) '((r3 = 0) (break))) ; RAW ((eq tmp 'enc) '((r3 = 1) (break))) ; ENC ((eq tmp 'wsp) '((r3 = 2) (break))) ; WSP - ((eq tmp 'cr) '((r3 = 3) (break))) ; CR + ((eq tmp 'cr) (if input-crlf + '((r3 = 3) (break)) ; CR + '((r3 = 1) (break)))) ; ENC + ((eq tmp 'lf) (if input-crlf + '((r3 = 1) (break)) ; ENC + '((r3 = 3) (break)))) ; CRLF ))) mel-ccl-256-table))) (branch @@ -536,7 +627,7 @@ (write-read-repeat r0 ,mel-ccl-low-table)) (if (r6 > 73) ((r6 = 3) - (write "=\r\n=") + (write ,(if output-crlf "=\r\n=" "=\n=")) (write r0 ,mel-ccl-high-table) (r4 = 3) (write-read-repeat r0 ,mel-ccl-low-table)) @@ -548,143 +639,189 @@ (r4 = 4) (write-read-repeat r0)) ((r6 = 1) - (write "=\r\n") + (write ,(if output-crlf "=\r\n" "=\n")) (r4 = 5) (write-read-repeat r0)))) - ;; r0:r3=CR - ((if ((r6 > 73) & r5) - ((r6 = 0) - (r5 = 0) - (write "=\r\n"))) - (break)))) + ;; r0:r3=CR/CRLF + ,(if input-crlf + ;; r0:r3=CR + `((if ((r6 > 73) & r5) + ((r6 = 0) + (r5 = 0) + (write ,(if output-crlf "=\r\n" "=\n")))) + (break)) + ;; r0:r3=CRLF + `(if r5 + ;; WSP ; r0:r3=CRLF + ((r5 = 0) + (r6 = 0) + (write ,(if output-crlf "=\r\n" "=\n")) + ,@(if output-crlf '((write ?\r)) '()) + (write-read-repeat r0)) + ;; noWSP ; r0:r3=CRLF + ((r5 = 0) + (r6 = 0) + ,@(if output-crlf '((write ?\r)) '()) + (write-read-repeat r0))) + ))) ;; r0:r3={RAW,ENC,CR} (loop - (if (r0 == ?\r) - ;; r0=\r:r3=CR - ((r4 = 6) - (read r0) - ;; CR:r3=CR r0 - (if (r0 == ?\n) - ;; CR:r3=CR r0=LF - (if r5 - ;; r5=WSP ; CR:r3=CR r0=LF - ((r6 = 0) - (r5 = 0) - (write "=\r\n\r\n") - (r4 = 7) - (read r0) - (break)) - ;; r5=noWSP ; CR:r3=CR r0=LF - ((r6 = 0) - (r5 = 0) - (write "\r\n") - (r4 = 8) - (read r0) - (break))) - ;; CR:r3=CR r0=noLF - (if (r6 < 73) - ((r6 += 3) - (r5 = 0) - (write "=0D") - (break)) - (if (r6 == 73) - (if (r0 == ?\r) - ;; CR:r3=CR r0=CR - ((r4 = 9) - (read r0) - ;; CR:r3=CR CR r0 - (if (r0 == ?\n) - ;; CR:r3=CR CR LF - ((r6 = 0) - (r5 = 0) - (write "=0D\r\n") - (r4 = 10) - (read r0) - (break)) - ;; CR:r3=CR CR noLF - ((r6 = 6) - (r5 = 0) - (write "=\r\n=0D=0D") - (break)))) - ;; CR:r3=CR r0=noLFnorCR - ((r6 = 3) - (r5 = 0) - (write "=\r\n=0D") - (break))) - ((r6 = 3) - (r5 = 0) - (write "=\r\n=0D") - (break)))))) - ;; r0:r3={RAW,ENC} - ((r4 = 11) - (read r1) - ;; r0:r3={RAW,ENC} r1 - (if (r1 == ?\r) - ;; r0:r3={RAW,ENC} r1=CR - ((r4 = 12) - (read r1) - ;; r0:r3={RAW,ENC} CR r1 - (if (r1 == ?\n) - ;; r0:r3={RAW,ENC} CR r1=LF + ,(funcall + (lambda (after-cr after-raw-enc) + (if input-crlf + `(if (r0 == ?\r) + ,after-cr + ,after-raw-enc) + after-raw-enc)) + ;; r0=\r:r3=CR + `((r4 = 6) + (read r0) + ;; CR:r3=CR r0 + (if (r0 == ?\n) + ;; CR:r3=CR r0=LF + (if r5 + ;; r5=WSP ; CR:r3=CR r0=LF ((r6 = 0) (r5 = 0) - (branch - r3 - ;; r0:r3=RAW CR r1=LF - ((write r0) - (write "\r\n") - (r4 = 13) - (read r0) - (break)) - ;; r0:r3=ENC CR r1=LF - ((write ?=) - (write r0 ,mel-ccl-high-table) - (write r0 ,mel-ccl-low-table) - (write "\r\n") - (r4 = 14) - (read r0) - (break)))) - ;; r0:r3={RAW,ENC} CR r1=noLF - ((branch - r3 - ;; r0:r3=RAW CR r1:noLF - ((r6 = 4) - (r5 = 0) - (write "=\r\n") - (write r0) - (write "=0D") - (r0 = r1) + (write ,(if output-crlf "=\r\n\r\n" "=\n\n")) + (r4 = 7) + (read r0) (break)) - ;; r0:r3=ENC CR r1:noLF - ((r6 = 6) - (r5 = 0) - (write "=\r\n=") - (write r0 ,mel-ccl-high-table) - (write r0 ,mel-ccl-low-table) - (write "=0D") - (r0 = r1) - (break)))) - )) - ;; r0:r3={RAW,ENC} r1:noCR - ((branch - r3 - ;; r0:r3=RAW r1:noCR - ((r6 = 1) - (r5 = 0) - (write "=\r\n") - (write r0) - (r0 = r1) - (break)) - ;; r0:r3=ENC r1:noCR - ((r6 = 3) - (r5 = 0) - (write "=\r\n=") - (write r0 ,mel-ccl-high-table) - (write r0 ,mel-ccl-low-table) - (r0 = r1) - (break)))))))) + ;; r5=noWSP ; CR:r3=CR r0=LF + ((r6 = 0) + (r5 = 0) + (write ,(if output-crlf "\r\n" "\n")) + (r4 = 8) + (read r0) + (break))) + ;; CR:r3=CR r0=noLF + (if (r6 < 73) + ((r6 += 3) + (r5 = 0) + (write "=0D") + (break)) + (if (r6 == 73) + (if (r0 == ?\r) + ;; CR:r3=CR r0=CR + ((r4 = 9) + (read r0) + ;; CR:r3=CR CR r0 + (if (r0 == ?\n) + ;; CR:r3=CR CR LF + ((r6 = 0) + (r5 = 0) + (write ,(if output-crlf "=0D\r\n" "=0D\n")) + (r4 = 10) + (read r0) + (break)) + ;; CR:r3=CR CR noLF + ((r6 = 6) + (r5 = 0) + (write ,(if output-crlf "=\r\n=0D=0D" "=\n=0D=0D")) + (break)))) + ;; CR:r3=CR r0=noLFnorCR + ((r6 = 3) + (r5 = 0) + (write ,(if output-crlf "=\r\n=0D" "=\n=0D")) + (break))) + ((r6 = 3) + (r5 = 0) + (write ,(if output-crlf "=\r\n=0D" "=\n=0D")) + (break)))))) + (funcall + (lambda (after-newline after-cr-nolf after-nonewline) + (if input-crlf + ;; r0:r3={RAW,ENC} + `((r4 = 11) + (read r1) + ;; r0:r3={RAW,ENC} r1 + (if (r1 == ?\r) + ;; r0:r3={RAW,ENC} r1=CR + ((r4 = 12) + (read r1) + ;; r0:r3={RAW,ENC} CR r1 + (if (r1 == ?\n) + ;; r0:r3=RAW CR r1=LF + ,after-newline + ;; r0:r3=RAW CR r1=noLF + ,after-cr-nolf)) + ;; r0:r3={RAW,ENC} r1:noCR + ,after-nonewline)) + ;; r0:r3={RAW,ENC} + `((r4 = 11) + (read r1) + ;; r0:r3={RAW,ENC} r1 + (if (r1 == ?\n) + ;; r0:r3={RAW,ENC} r1=CRLF + ,after-newline + ;; r0:r3={RAW,ENC} r1:noCRLF + ,after-nonewline)))) + ;; r0:r3={RAW,ENC} CR r1=LF + ;; r0:r3={RAW,ENC} r1=CRLF + `((r6 = 0) + (r5 = 0) + (branch + r3 + ;; r0:r3=RAW CR r1=LF + ;; r0:r3=RAW r1=CRLF + ((write r0) + (write ,(if output-crlf "\r\n" "\n")) + (r4 = 13) + (read r0) + (break)) + ;; r0:r3=ENC CR r1=LF + ;; r0:r3=ENC r1=CRLF + ((write ?=) + (write r0 ,mel-ccl-high-table) + (write r0 ,mel-ccl-low-table) + (write ,(if output-crlf "\r\n" "\n")) + (r4 = 14) + (read r0) + (break)))) + ;; r0:r3={RAW,ENC} CR r1=noLF + `((branch + r3 + ;; r0:r3=RAW CR r1:noLF + ((r6 = 4) + (r5 = 0) + (write ,(if output-crlf "=\r\n" "=\n")) + (write r0) + (write "=0D") + (r0 = r1) + (break)) + ;; r0:r3=ENC CR r1:noLF + ((r6 = 6) + (r5 = 0) + (write ,(if output-crlf "=\r\n=" "=\n=")) + (write r0 ,mel-ccl-high-table) + (write r0 ,mel-ccl-low-table) + (write "=0D") + (r0 = r1) + (break)))) + ;; r0:r3={RAW,ENC} r1:noCR + ;; r0:r3={RAW,ENC} r1:noCRLF + `((branch + r3 + ;; r0:r3=RAW r1:noCR + ;; r0:r3=RAW r1:noCRLF + ((r6 = 1) + (r5 = 0) + (write ,(if output-crlf "=\r\n" "=\n")) + (write r0) + (r0 = r1) + (break)) + ;; r0:r3=ENC r1:noCR + ;; r0:r3=ENC r1:noCRLF + ((r6 = 3) + (r5 = 0) + (write ,(if output-crlf "=\r\n=" "=\n=")) + (write r0 ,mel-ccl-high-table) + (write r0 ,mel-ccl-low-table) + (r0 = r1) + (break))))))) (repeat))) - (;(write "[EOF:") (write r4 ,mel-ccl-high-table) (write r4 ,mel-ccl-low-table) (write "]") + ;; EOF + ( ;(write "[EOF:") (write r4 ,mel-ccl-high-table) (write r4 ,mel-ccl-low-table) (write "]") (branch r4 ;; 0: (start) ; @@ -696,19 +833,19 @@ ;; 3: SOFTBREAK r0:r3=ENC ; (end) ;; 4: r0:r3=WSP ; - ((write "=\r\n") (end)) + ((write ,(if output-crlf "=\r\n" "=\n")) (end)) ;; 5: SOFTBREAK r0:r3=WSP ; - ((write "=\r\n") (end)) + ((write ,(if output-crlf "=\r\n" "=\n")) (end)) ;; 6: ; r0=\r:r3=CR (if (r6 <= 73) ((write "=0D") (end)) - ((write "=\r\n=0D") (end))) + ((write ,(if output-crlf "=\r\n=0D" "=\n=0D")) (end))) ;; 7: r5=WSP SOFTBREAK CR:r3=CR r0=LF ; (end) ;; 8: r5=noWSP CR:r3=CR r0=LF ; (end) ;; 9: (r6=73) ; CR:r3=CR r0=CR - ((write "=\r\n=0D=0D") (end)) + ((write ,(if output-crlf "=\r\n=0D=0D" "=\n=0D=0D")) (end)) ;; 10: (r6=73) CR:r3=CR CR LF ; (end) ;; 11: ; r0:r3={RAW,ENC} @@ -722,23 +859,27 @@ ;; 12: ; r0:r3={RAW,ENC} r1=CR (branch r3 - ((write "=\r\n") + ;; ; r0:r3=RAW r1=CR + ((write ,(if output-crlf "=\r\n" "=\n")) (write r0) (write "=0D") (end)) - ((write "=\r\n=") + ;; ; r0:r3=ENC r1=CR + ((write ,(if output-crlf "=\r\n=" "=\n=")) (write r0 ,mel-ccl-high-table) (write r0 ,mel-ccl-low-table) (write "=0D") (end))) ;; 13: r0:r3=RAW CR LF ; + ;; 13: r0:r3=RAW CRLF ; (end) ;; 14: r0:r3=ENC CR LF ; + ;; 14: r0:r3=ENC CRLF ; (end) )) )) -(define-ccl-program mel-ccl-decode-quoted-printable +(defun mel-ccl-decode-quoted-printable-generic (input-crlf output-crlf) `(1 ((read r0) (loop @@ -748,8 +889,45 @@ (lambda (r0) (let ((tmp (aref mel-ccl-qp-table r0))) (cond - ((or (eq tmp 'raw) (eq tmp 'wsp)) `(write-read-repeat r0)) - ((eq r0 ?=) + ((eq tmp 'raw) `(write-read-repeat r0)) + ((eq tmp 'wsp) (if (eq r0 (char-int ? )) + `(r1 = 1) + `(r1 = 0))) + ((eq tmp 'cr) + (if input-crlf + ;; r0='\r' + `((read r0) + ;; '\r' r0 + (if (r0 == ?\n) + ;; '\r' r0='\n' + ;; hard line break found. + ,(if output-crlf + '((write ?\r) + (write-read-repeat r0)) + '(write-read-repeat r0)) + ;; '\r' r0:[^\n] + ;; invalid control character (bare CR) found. + ;; -> ignore it and rescan from r0. + (repeat))) + ;; r0='\r' + ;; invalid character (bare CR) found. + ;; -> ignore. + `((read r0) + (repeat)))) + ((eq tmp 'lf) + (if input-crlf + ;; r0='\n' + ;; invalid character (bare LF) found. + ;; -> ignore. + `((read r0) + (repeat)) + ;; r0='\r\n' + ;; hard line break found. + (if output-crlf + '((write ?\r) + (write-read-repeat r0)) + '(write-read-repeat r0)))) + ((eq r0 (char-int ?=)) ;; r0='=' `((read r0) ;; '=' r0 @@ -771,23 +949,44 @@ ,@(mapcar (lambda (r0) (cond - ((eq r0 ?\r) - ;; '=' [\t ]* r0='\r' - `((read r0) - ;; '=' [\t ]* '\r' r0 - (if (r0 == ?\n) - ;; '=' [\t ]* '\r' r0='\n' - ;; soft line break found. - ((read r0) - (repeat)) - ;; '=' [\t ]* '\r' r0:[^\n] - ;; invalid input -> - ;; output "=\r" and rescan from r0. - ((write "=\r") - (repeat))))) + ((eq r0 (char-int ?\r)) + (if input-crlf + ;; '=' [\t ]* r0='\r' + `((read r0) + ;; '=' [\t ]* '\r' r0 + (if (r0 == ?\n) + ;; '=' [\t ]* '\r' r0='\n' + ;; soft line break found. + ((read r0) + (repeat)) + ;; '=' [\t ]* '\r' r0:[^\n] + ;; invalid input -> + ;; output "=" and rescan from r0. + ((write "=") + (repeat)))) + ;; '=' [\t ]* r0='\r' + ;; invalid input (bare CR found) -> + ;; output "=" and rescan from next. + `((write ?=) + (read r0) + (repeat)))) + ((eq r0 (char-int ?\n)) + (if input-crlf + ;; '=' [\t ]* r0='\n' + ;; invalid input (bare LF found) -> + ;; output "=" and rescan from next. + `((write ?=) + (read r0) + (repeat)) + ;; '=' [\t ]* r0='\r\n' + ;; soft line break found. + `((read r0) + (repeat)))) ((setq tmp (nth r0 mel-ccl-256-to-16-table)) ;; '=' [\t ]* r0:[0-9A-F] - `(r0 = ,tmp)) + ;; upper nibble of hexadecimal digit found. + `((r1 = r0) + (r0 = ,tmp))) (t ;; '=' [\t ]* r0:[^\r0-9A-F] ;; invalid input -> @@ -795,13 +994,13 @@ `((write ?=) (repeat))))) mel-ccl-256-table)) - ;; '=' [\t ]* r0:[0-9A-F] + ;; '=' [\t ]* r1:r0:[0-9A-F] (read-branch - r1 + r2 ,@(mapcar - (lambda (r1) - (if (setq tmp (nth r1 mel-ccl-256-to-16-table)) - ;; '=' [\t ]* [0-9A-F] r1:[0-9A-F] + (lambda (r2) + (if (setq tmp (nth r2 mel-ccl-256-to-16-table)) + ;; '=' [\t ]* r1:r0:[0-9A-F] r2:[0-9A-F] `(write-read-repeat r0 ,(vconcat @@ -809,78 +1008,182 @@ (lambda (r0) (logior (lsh r0 4) tmp)) mel-ccl-16-table))) - ;; '=' [\t ]* [0-9A-F] r1:[^0-9A-F] + ;; '=' [\t ]* r1:r0:[0-9A-F] r2:[^0-9A-F] ;; invalid input - `(r2 = 0) ; nop + `(r3 = 0) ; nop )) mel-ccl-256-table)) - ;; '=' [\t ]* [0-9A-F] r1:[^0-9A-F] - ;; invalid input + ;; '=' [\t ]* r1:r0:[0-9A-F] r2:[^0-9A-F] + ;; invalid input -> + ;; output "=" with hex digit and rescan from r2. (write ?=) - (write r0 ,(vconcat mel-ccl-16-to-256-table)) - (write r1) - (read r0) - (repeat))) - ((eq tmp 'cr) - ;; r0='\r' - `((read r0) - ;; '\r' r0 - (if (r0 == ?\n) - ;; '\r' r0='\n' - ;; hard line break found. - ((write ?\r) - (write-read-repeat r0)) - ;; '\r' r0:[^\n] - ;; invalid control character (bare CR) found. - ;; -> ignore it and rescan from r0. - (repeat)))) + (r0 = r2) + (write-repeat r1))) (t ;; r0:[^\t\r -~] ;; invalid character found. ;; -> ignore. `((read r0) (repeat)))))) - mel-ccl-256-table)))))) + mel-ccl-256-table)) + ;; r1[0]:[\t ] + (loop + ,@(apply + 'append + (mapcar + (lambda (regnum) + (let ((reg (aref [r1 r2 r3 r4 r5] regnum))) + (apply + 'append + (mapcar + (lambda (bit) + (if (= bit 0) + (if (= regnum 0) + nil + `((read r0) + (if (r0 == ?\t) + (,reg = 0) + (if (r0 == ?\ ) + (,reg = 1) + ((r6 = ,(+ (* regnum 28) bit)) + (break)))))) + `((read r0) + (if (r0 == ?\ ) + (,reg |= ,(lsh 1 bit)) + (if (r0 != ?\t) + ((r6 = ,(+ (* regnum 28) bit)) + (break))))))) + mel-ccl-28-table)))) + '(0 1 2 3 4))) + ;; white space buffer exhaust. + ;; error: line length limit (76bytes) violation. + ;; -> ignore these white spaces. + (repeat)) + ,(if input-crlf + `(if (r0 == ?\r) + ((read r0) + (if (r0 == ?\n) + ;; trailing white spaces found. + ;; -> ignore these white spacs. + ((write ,(if output-crlf "\r\n" "\n")) + (read r0) + (repeat)) + ;; [\t ]* \r r0:[^\n] + ;; error: bare CR found. + ;; -> output white spaces and ignore bare CR. + )) + ;; [\t ]* r0:[^\r] + ;; middle white spaces found. + ) + `(if (r0 == ?\n) + ;; trailing white spaces found. + ;; -> ignore these white spacs. + ((write ,(if output-crlf "\r\n" "\n")) + (read r0) + (repeat)) + ;; [\t ]* r0:[^\n] + ;; middle white spaces found. + )) + ,@(apply + 'append + (mapcar + (lambda (regnum) + (let ((reg (aref [r1 r2 r3 r4 r5] regnum))) + (apply + 'append + (mapcar + (lambda (bit) + `((if (,reg & ,(lsh 1 bit)) + (write ?\ ) + (write ?\t)) + (if (r6 == ,(+ (* regnum 28) bit 1)) + (repeat)))) + mel-ccl-28-table)))) + '(0 1 2 3 4))) + (repeat) + )))) + +) + +(define-ccl-program mel-ccl-encode-quoted-printable-crlf-crlf + (mel-ccl-encode-quoted-printable-generic t t)) + +(define-ccl-program mel-ccl-encode-quoted-printable-crlf-lf + (mel-ccl-encode-quoted-printable-generic t nil)) + +(define-ccl-program mel-ccl-encode-quoted-printable-lf-crlf + (mel-ccl-encode-quoted-printable-generic nil t)) + +(define-ccl-program mel-ccl-encode-quoted-printable-lf-lf + (mel-ccl-encode-quoted-printable-generic nil nil)) + +(define-ccl-program mel-ccl-decode-quoted-printable-crlf-crlf + (mel-ccl-decode-quoted-printable-generic t t)) + +(define-ccl-program mel-ccl-decode-quoted-printable-crlf-lf + (mel-ccl-decode-quoted-printable-generic t nil)) + +(define-ccl-program mel-ccl-decode-quoted-printable-lf-crlf + (mel-ccl-decode-quoted-printable-generic nil t)) + +(define-ccl-program mel-ccl-decode-quoted-printable-lf-lf + (mel-ccl-decode-quoted-printable-generic nil nil)) ;;; @ coding system ;;; (make-ccl-coding-system - 'mel-ccl-uq ?Q "MIME Q-encoding in unstructured field" - 'mel-ccl-decode-q 'mel-ccl-encode-uq) + 'mel-ccl-uq-rev ?Q "MIME Q-encoding in unstructured field (reversed)" + 'mel-ccl-encode-uq 'mel-ccl-decode-q) (make-ccl-coding-system - 'mel-ccl-cq ?Q "MIME Q-encoding in comment" - 'mel-ccl-decode-q 'mel-ccl-encode-cq) + 'mel-ccl-cq-rev ?Q "MIME Q-encoding in comment (reversed)" + 'mel-ccl-encode-cq 'mel-ccl-decode-q) (make-ccl-coding-system - 'mel-ccl-pq ?Q "MIME Q-encoding in phrase" - 'mel-ccl-decode-q 'mel-ccl-encode-pq) + 'mel-ccl-pq-rev ?Q "MIME Q-encoding in phrase (reversed)" + 'mel-ccl-encode-pq 'mel-ccl-decode-q) (make-ccl-coding-system - 'mel-ccl-b ?B "MIME B-encoding" - 'mel-ccl-decode-b 'mel-ccl-encode-b) + 'mel-ccl-b-rev ?B "MIME B-encoding (reversed)" + 'mel-ccl-encode-b 'mel-ccl-decode-b) (make-ccl-coding-system - 'mel-ccl-quoted-printable ?Q "MIME Quoted-Printable-encoding" - 'mel-ccl-decode-quoted-printable 'mel-ccl-encode-quoted-printable) + 'mel-ccl-quoted-printable-crlf-crlf-rev + ?Q "MIME Quoted-Printable-encoding (reversed)" + 'mel-ccl-encode-quoted-printable-crlf-crlf + 'mel-ccl-decode-quoted-printable-crlf-crlf) (make-ccl-coding-system - 'mel-ccl-base64 ?B "MIME Base64-encoding" - 'mel-ccl-decode-b 'mel-ccl-encode-base64) + 'mel-ccl-quoted-printable-lf-crlf-rev + ?Q "MIME Quoted-Printable-encoding (LF encoding) (reversed)" + 'mel-ccl-encode-quoted-printable-crlf-lf + 'mel-ccl-decode-quoted-printable-lf-crlf) (make-ccl-coding-system - 'mel-ccl-b-rev ?B "MIME B-encoding (reversed)" - 'mel-ccl-encode-b 'mel-ccl-decode-b) + 'mel-ccl-quoted-printable-crlf-lf-rev + ?Q "MIME Quoted-Printable-encoding (LF internal) (reversed)" + 'mel-ccl-encode-quoted-printable-lf-crlf + 'mel-ccl-decode-quoted-printable-crlf-lf) + +(make-ccl-coding-system + 'mel-ccl-quoted-printable-lf-lf-rev + ?Q "MIME Quoted-Printable-encoding (LF encoding) (LF internal) (reversed)" + 'mel-ccl-encode-quoted-printable-lf-lf + 'mel-ccl-decode-quoted-printable-lf-lf) (make-ccl-coding-system - 'mel-ccl-quoted-printable-rev ?Q "MIME Quoted-Printable-encoding (reversed)" - 'mel-ccl-encode-quoted-printable 'mel-ccl-decode-quoted-printable) + 'mel-ccl-base64-crlf-rev + ?B "MIME Base64-encoding (reversed)" + 'mel-ccl-encode-base64-crlf-crlf + 'mel-ccl-decode-b) (make-ccl-coding-system - 'mel-ccl-base64-rev ?B "MIME Base64-encoding (reversed)" - 'mel-ccl-encode-base64 'mel-ccl-decode-b) + 'mel-ccl-base64-lf-rev + ?B "MIME Base64-encoding (LF encoding) (reversed)" + 'mel-ccl-encode-base64-crlf-lf + 'mel-ccl-decode-b) ;;; @ B @@ -891,29 +1194,29 @@ (defun base64-ccl-encode-string (string) "Encode STRING with base64 encoding." - (encode-coding-string string 'mel-ccl-b)) + (decode-coding-string string 'mel-ccl-b-rev)) (defun base64-ccl-encode-region (start end) "Encode region from START to END with base64 encoding." (interactive "r") - (encode-coding-region start end 'mel-ccl-b)) + (decode-coding-region start end 'mel-ccl-b-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)) + (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 (decode-coding-string string 'mel-ccl-b))) + (string-as-unibyte (encode-coding-string string 'mel-ccl-b-rev))) (defun base64-ccl-decode-region (start end) "Decode base64 encoded the region from START to END." (interactive "r") - (decode-coding-region start end 'mel-ccl-b)) + (encode-coding-region start end 'mel-ccl-b-rev)) (defun base64-ccl-write-decoded-region (start end filename) "Decode the region from START to END and write out to FILENAME." @@ -933,65 +1236,44 @@ (defun quoted-printable-ccl-encode-string (string) "Encode STRING with quoted-printable encoding." (decode-coding-string - (encode-coding-string - (encode-coding-string - string - 'raw-text-dos) - 'mel-ccl-quoted-printable) - 'raw-text-dos)) + 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 encoding." (interactive "r") - (setq end (+ start (encode-coding-region start end 'raw-text-dos))) - (setq end (+ start (encode-coding-region start end 'mel-ccl-quoted-printable))) - (decode-coding-region start end 'raw-text-dos)) + (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-rev)) - (setq end (+ start (cadr (insert-file-contents filename)))) - (decode-coding-region start end 'raw-text-dos))) + (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." - (decode-coding-string - (decode-coding-string - (encode-coding-string - string - 'raw-text-dos) - 'mel-ccl-quoted-printable) - 'raw-text-dos)) + (encode-coding-string + string + 'mel-ccl-quoted-printable-lf-lf-rev)) (defun quoted-printable-ccl-decode-region (start end) "Decode the region from START to END with quoted-printable encoding." (interactive "r") - (setq end (+ start (encode-coding-region start end 'raw-text-dos))) - (setq end (+ start (decode-coding-region start end 'mel-ccl-quoted-printable))) - (decode-coding-region start end 'raw-text-dos)) - + (encode-coding-region start end 'mel-ccl-quoted-printable-lf-lf-rev)) + (defun quoted-printable-ccl-write-decoded-region (start end filename) "Decode quoted-printable encoded current region and write out to FILENAME." (interactive (list (region-beginning) (region-end) (read-file-name "Write decoded region to file: "))) - (let ((buf (current-buffer)) tmp) - (with-temp-buffer - (setq tmp (current-buffer)) - (save-excursion - (set-buffer buf) - (copy-to-buffer tmp start end)) - (encode-coding-region (point-min) (point-max) 'raw-text-dos) - (decode-coding-region (point-min) (point-max) 'mel-ccl-quoted-printable) - (decode-coding-region (point-min) (point-max) 'raw-text-dos) - (write-region-as-binary (point-min) (point-max) filename)))) + (let ((coding-system-for-write 'mel-ccl-quoted-printable-lf-lf-rev)) + (write-region start end filename))) ;;; @ Q @@ -1001,19 +1283,19 @@ encoding." "Encode STRING to Q-encoding of encoded-word, and return the result. MODE allows `text', `comment', `phrase' or nil. Default value is `phrase'." - (encode-coding-string + (decode-coding-string string (cond - ((eq mode 'text) 'mel-ccl-uq) - ((eq mode 'comment) 'mel-ccl-cq) - (t 'mel-ccl-pq)))) + ((eq mode 'text) 'mel-ccl-uq-rev) + ((eq mode 'comment) 'mel-ccl-cq-rev) + (t 'mel-ccl-pq-rev)))) (defun q-encoding-ccl-decode-string (string) "Decode Q encoded STRING and return the result." (string-as-unibyte - (decode-coding-string + (encode-coding-string string - 'mel-ccl-uq))) + 'mel-ccl-uq-rev))) ;;; @ end @@ -1021,3 +1303,73 @@ MODE allows `text', `comment', `phrase' or nil. Default value is (provide 'mel-ccl) +'( +(let ((str0 "a\f \t\r +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\r +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\r +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\r +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\f\r +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\f\r +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\f\r + \r + \r + \r +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \r +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \r +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \r +aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa \r +bbb \r +bbbb\r +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\rccc\r +ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\r\r\nccc\r +ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\r\rccc\r +cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc\rccc\r +dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd\r\neee\r +dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd\reee\r +ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddeee\r +") + str1 encoded decoded) + (setq str1 (ew-crlf-to-lf str0) + encoded + (list + (decode-coding-string + str0 + 'mel-ccl-quoted-printable-crlf-crlf-rev) + (decode-coding-string + str0 + 'mel-ccl-quoted-printable-lf-crlf-rev) + (decode-coding-string + str1 + 'mel-ccl-quoted-printable-crlf-lf-rev) + (decode-coding-string + str1 + 'mel-ccl-quoted-printable-lf-lf-rev)) + decoded + (list + (encode-coding-string + (nth 0 encoded) + 'mel-ccl-quoted-printable-crlf-crlf-rev) + (encode-coding-string + (nth 1 encoded) + 'mel-ccl-quoted-printable-lf-crlf-rev) + (encode-coding-string + (nth 2 encoded) + 'mel-ccl-quoted-printable-crlf-lf-rev) + (encode-coding-string + (nth 3 encoded) + 'mel-ccl-quoted-printable-lf-lf-rev))) + (list + (string= str0 (nth 0 decoded)) + (string= str0 (nth 1 decoded)) + (string= str1 (nth 2 decoded)) + (string= str1 (nth 3 decoded)))) + +;; for xemacs +(defun make-ccl-coding-system (name mnemonic doc-string decoder encoder) + (make-coding-system + name 'ccl doc-string + (list 'mnemonic (char-to-string mnemonic) + 'decode (symbol-value decoder) + 'encode (symbol-value encoder)))) + +) -- 1.7.10.4