(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-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.
(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
;; 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)
(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))
(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)
)))