Sync up with chao-1_2_0_9.
[elisp/flim.git] / mime-def.el
index 1812efc..bb18d8e 100644 (file)
 ;;; Code:
 
 (defconst mime-spadework-module-version-string
-  "FLIM 1.1.1 - \"J\e-Dþjò\" ")\e-A
+  "FLIM 1.3.0 - \"Fushimi\"")
+
+
+;;; @ variables
+;;;
 
 (require 'custom)
 
 (custom-handle-keyword 'default-mime-charset :group 'mime
                       'custom-variable)
 
-(defvar mime-temp-directory (or (getenv "MIME_TMP_DIR")
-                               (getenv "TM_TMP_DIR")
-                               (getenv "TMPDIR")
-                               (getenv "TMP")
-                               (getenv "TEMP")
-                               "/tmp/")
-  "*Directory for temporary files.")
+(defcustom mime-temp-directory (or (getenv "MIME_TMP_DIR")
+                                  (getenv "TM_TMP_DIR")
+                                  (getenv "TMPDIR")
+                                  (getenv "TMP")
+                                  (getenv "TEMP")
+                                  "/tmp/")
+  "*Directory for temporary files."
+  :group 'mime
+  :type 'directory)
+
 
+;;; @ required functions
+;;;
 
 (unless (fboundp 'butlast)
   (defun butlast (x &optional n)
       (substring string (match-end 0))
     string))
 
+(defsubst regexp-* (regexp)
+  (concat regexp "*"))
+
+(defsubst regexp-or (&rest args)
+  (concat "\\(" (mapconcat (function identity) args "\\|") "\\)"))
 
-;;; @ definitions about MIME
+
+;;; @ about STD 11
+;;;
+
+(defconst std11-quoted-pair-regexp "\\\\.")
+(defconst std11-non-qtext-char-list '(?\" ?\\ ?\r ?\n))
+(defconst std11-qtext-regexp
+  (concat "[^" (char-list-to-string std11-non-qtext-char-list) "]"))
+(defconst std11-quoted-string-regexp
+  (concat "\""
+         (regexp-*
+          (regexp-or std11-qtext-regexp std11-quoted-pair-regexp)
+          )
+         "\""))
+
+
+;;; @ about MIME
 ;;;
 
 (defconst mime-tspecials "][()<>@,\;:\\\"/?=")
          "][" quoted-printable-hex-chars "]"))
 
 
+;;; @ utility
+;;;
+
+(defsubst mime-type/subtype-string (type &optional subtype)
+  "Return type/subtype string from TYPE and SUBTYPE."
+  (if type
+      (if subtype
+         (format "%s/%s" type subtype)
+       (format "%s" type))))
+
+
 ;;; @ end
 ;;;