* ew-bq.el (ew-ccl-decode-b-0-table): Use `if' instead of `cond'
authorakr <akr>
Tue, 25 Aug 1998 16:20:16 +0000 (16:20 +0000)
committerakr <akr>
Tue, 25 Aug 1998 16:20:16 +0000 (16:20 +0000)
(ew-ccl-decode-b-1-table): Ditto.
(ew-ccl-decode-b-2-table): Ditto.
(ew-ccl-decode-b-3-table): Ditto.

* ew-quote.el:
  - Move `ew-quoting-char', `ew-quoting-chars-regexp' and
  `ew-type2-regexp' to ew-var.el.

* ew-unit.el:
  - Move `ew-anchored-encoded-word-regexp', `ew-b-regexp',
  `ew-q-regexp', `ew-byte-decoder-alist' and `ew-byte-checker-alist'
  to ew-var.el.

* ew-var.el (ew-permit-null-encoded-text): New variable.
(ew-encoded-text-regexp): Change positive closure to normal closure if
`ew-permit-null-encoded-text' is non-nil.
(ew-quoting-char): New variable (moved from ew-var.el).
(ew-quoting-chars-regexp): New variable (moved from ew-var.el).
(ew-type2-regexp): New variable (moved from ew-var.el).
(ew-anchored-encoded-word-regexp): New variable (moved from ew-unit.el).
(ew-b-regexp): New variable (moved from ew-unit.el).
(ew-q-regexp): New variable (moved from ew-unit.el).
(ew-byte-decoder-alist): New variable (moved from ew-unit.el).
(ew-byte-checker-alist): New variable (moved from ew-unit.el).
(ew-dynamic-options): Add `ew-permit-null-encoded-text'.

ChangeLog
ew-bq.el
ew-quote.el
ew-unit.el
ew-var.el

index fc5601b..c28e7a9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,34 @@
 1998-08-25  Tanaka Akira      <akr@jaist.ac.jp>
 
+       * ew-bq.el (ew-ccl-decode-b-0-table): Use `if' instead of `cond'
+       (ew-ccl-decode-b-1-table): Ditto.
+       (ew-ccl-decode-b-2-table): Ditto.
+       (ew-ccl-decode-b-3-table): Ditto.
+
+       * ew-quote.el:
+         - Move `ew-quoting-char', `ew-quoting-chars-regexp' and
+         `ew-type2-regexp' to ew-var.el.
+
+       * ew-unit.el:
+         - Move `ew-anchored-encoded-word-regexp', `ew-b-regexp',
+         `ew-q-regexp', `ew-byte-decoder-alist' and `ew-byte-checker-alist'
+         to ew-var.el.
+
+       * ew-var.el (ew-permit-null-encoded-text): New variable.
+       (ew-encoded-text-regexp): Change positive closure to normal closure if
+       `ew-permit-null-encoded-text' is non-nil.
+       (ew-quoting-char): New variable (moved from ew-var.el).
+       (ew-quoting-chars-regexp): New variable (moved from ew-var.el).
+       (ew-type2-regexp): New variable (moved from ew-var.el).
+       (ew-anchored-encoded-word-regexp): New variable (moved from ew-unit.el).
+       (ew-b-regexp): New variable (moved from ew-unit.el).
+       (ew-q-regexp): New variable (moved from ew-unit.el).
+       (ew-byte-decoder-alist): New variable (moved from ew-unit.el).
+       (ew-byte-checker-alist): New variable (moved from ew-unit.el).
+       (ew-dynamic-options): Add `ew-permit-null-encoded-text'.
+
+1998-08-25  Tanaka Akira      <akr@jaist.ac.jp>
+
        * ew-bq.el (ew-ccl-decode-base64): Abolished.
        (ew-ccl-decode-b-bit-ex): New compile time function.
        (ew-ccl-decode-b-0-table): New compile time constant.
index ab64816..467e9d2 100644 (file)
--- a/ew-bq.el
+++ b/ew-bq.el
   (vconcat
    (mapcar
     (lambda (v)
-      (cond
-       ((eq v t) (lsh 1 24))
-       (v (ew-ccl-decode-b-bit-ex (lsh v 18)))
-       (t (lsh 1 24))))
+      (if (integerp v)
+         (ew-ccl-decode-b-bit-ex (lsh v 18))
+       (lsh 1 24)))
     ew-ccl-256-to-64-table)))
 
 (defconst ew-ccl-decode-b-1-table
   (vconcat
    (mapcar
     (lambda (v)
-      (cond
-       ((eq v t) (lsh 1 25))
-       (v (ew-ccl-decode-b-bit-ex (lsh v 12)))
-       (t (lsh 1 25))))
+      (if (integerp v)
+         (ew-ccl-decode-b-bit-ex (lsh v 12))
+       (lsh 1 25)))
     ew-ccl-256-to-64-table)))
 
 (defconst ew-ccl-decode-b-2-table
   (vconcat
    (mapcar
     (lambda (v)
-      (cond
-       ((eq v t) (lsh 1 26))
-       (v (ew-ccl-decode-b-bit-ex (lsh v 6)))
-       (t (lsh 1 26))))
+      (if (integerp v)
+         (ew-ccl-decode-b-bit-ex (lsh v 6))
+       (lsh 1 26)))
     ew-ccl-256-to-64-table)))
 
 (defconst ew-ccl-decode-b-3-table
   (vconcat
    (mapcar
     (lambda (v)
-      (cond
-       ((eq v t) (lsh 1 27))
-       (v (ew-ccl-decode-b-bit-ex v))
-       (t (lsh 1 27))))
+      (if (integerp v)
+         (ew-ccl-decode-b-bit-ex v)
+       (lsh 1 27)))
     ew-ccl-256-to-64-table)))
+
 )
 
 (define-ccl-program ew-ccl-decode-b
index 583d060..e95bfb0 100644 (file)
 ;; B : token.
 ;; C : encoded-text.
 
-(eval-and-compile
-  (defconst ew-quoting-char ?+))
-(defconst ew-quoting-chars-regexp
-  (eval-when-compile
-    (concat (regexp-quote (char-to-string ew-quoting-char)) "*")))
-
-(defconst ew-type2-regexp
-  (eval-when-compile
-    (require 'ew-var)
-    (concat (regexp-quote "=?")
-            "\\(" ew-token-regexp "\\)"
-            (regexp-quote "?")
-            "\\(" ew-token-regexp "\\)"
-            (regexp-quote "?")
-            "\\(" ew-encoded-text-regexp "\\)"
-            (regexp-quote "?")
-            "\\'")))
-
 ;;;
 
 (defun ew-quoting-char-seq (num)
index a9af477..569c1ac 100644 (file)
@@ -5,36 +5,6 @@
 
 (provide 'ew-unit)
 
-(defconst ew-anchored-encoded-word-regexp
-  (eval-when-compile
-    (require 'ew-var)
-    (concat "\\`" ew-encoded-word-regexp "\\'")))
-
-(defconst ew-b-regexp
-  (eval-when-compile
-    (concat "\\`\\("
-            "[A-Za-z0-9+/]"
-            "[A-Za-z0-9+/]"
-            "[A-Za-z0-9+/]"
-            "[A-Za-z0-9+/]"
-            "\\)*"
-            "[A-Za-z0-9+/]"
-            "[A-Za-z0-9+/]"
-            "\\(==\\|"
-            "[A-Za-z0-9+/]"
-            "[A-Za-z0-9+/=]"
-            "\\)\\'")))
-
-(defconst ew-q-regexp "\\`\\([^=?]\\|=[0-9A-Fa-f][0-9A-Fa-f]\\)*\\'")
-
-(defconst ew-byte-decoder-alist
-  '(("B" . ew-decode-b)
-    ("Q" . ew-decode-q)))
-
-(defconst ew-byte-checker-alist
-  '(("B" . ew-b-check)
-    ("Q" . ew-q-check)))
-
 (defun ew-b-check (encoding encoded-text) (string-match ew-b-regexp encoded-text))
 (defun ew-q-check (encoding encoded-text) (string-match ew-q-regexp encoded-text))
 
index 9ac619b..f4b8154 100644 (file)
--- a/ew-var.el
+++ b/ew-var.el
@@ -8,6 +8,7 @@
 (defvar ew-ignore-76bytes-limit nil)
 (defvar ew-permit-sticked-comment nil)
 (defvar ew-permit-sticked-special nil)
+(defvar ew-permit-null-encoded-text nil) ; affect when loading time.
 
 (defvar ew-remove-bare-crlf nil)
 (defvar ew-default-mime-charset 'x-ctext)
 
 ;;; constants.
 
-(eval-and-compile
-  (defconst ew-token-regexp "[-!#-'*+0-9A-Z^-~]+")
-  (defconst ew-encoded-text-regexp "[!->@-~]+")
-)
+(defconst ew-token-regexp "[-!#-'*+0-9A-Z^-~]+")
+(defconst ew-encoded-text-regexp
+  (if ew-permit-null-encoded-text
+      "[!->@-~]*"
+    "[!->@-~]+"))
+
 (defconst ew-encoded-word-regexp
+  (concat (regexp-quote "=?")
+          "\\(" ew-token-regexp "\\)"
+          (regexp-quote "?")
+          "\\(" ew-token-regexp "\\)"
+          (regexp-quote "?")
+          "\\(" ew-encoded-text-regexp "\\)"
+          (regexp-quote "?=")))
+
+(defconst ew-anchored-encoded-word-regexp
+  (concat "\\`" ew-encoded-word-regexp "\\'"))
+
+(defconst ew-b-regexp
   (eval-when-compile
-    (concat (regexp-quote "=?")
-            "\\(" ew-token-regexp "\\)"
-            (regexp-quote "?")
-            "\\(" ew-token-regexp "\\)"
-            (regexp-quote "?")
-            "\\(" ew-encoded-text-regexp "\\)"
-            (regexp-quote "?="))))
+    (concat "\\`\\("
+            "[A-Za-z0-9+/]"
+            "[A-Za-z0-9+/]"
+            "[A-Za-z0-9+/]"
+            "[A-Za-z0-9+/]"
+            "\\)*"
+            "\\("
+            "[A-Za-z0-9+/]"
+            "[A-Za-z0-9+/]"
+            "\\(==\\|[A-Za-z0-9+/]=\\)"
+            "\\)?"
+            "\\'")))
+
+(defconst ew-q-regexp
+  "\\`\\([^=?]\\|=[0-9A-Fa-f][0-9A-Fa-f]\\)*\\'")
+
+(defconst ew-quoting-char ?+)
+(defconst ew-quoting-chars-regexp
+  (concat (regexp-quote (char-to-string ew-quoting-char)) "*"))
+
+(defconst ew-type2-regexp
+  (concat (regexp-quote "=?")
+          "\\(" ew-token-regexp "\\)"
+          (regexp-quote "?")
+          "\\(" ew-token-regexp "\\)"
+          (regexp-quote "?")
+          "\\(" ew-encoded-text-regexp "\\)"
+          (regexp-quote "?")
+          "\\'"))
+
+(defconst ew-byte-decoder-alist
+  '(("B" . ew-decode-b)
+    ("Q" . ew-decode-q)))
+
+(defconst ew-byte-checker-alist
+  '(("B" . ew-b-check)
+    ("Q" . ew-q-check)))
 
 ;;; utilities for variables.
 
     (if ew-permit-sticked-comment 16 0)
     (if ew-permit-sticked-special 32 0)
     (if ew-remove-bare-crlf 64 0)
+    (if ew-permit-null-encoded-text 128 0)
     )))