+1998-10-08 MORIOKA Tomohiko <morioka@jaist.ac.jp>
+
+ * mime-def.el, mel.el, mel-b-dl.el: Move variable
+ `base64-dl-module' from mel-b-dl.el and mel.el to mime-def.el.
+
+1998-10-08 MORIOKA Tomohiko <morioka@jaist.ac.jp>
+
+ * mel.el (mel-ccl-module): New variable; use it to check mel-ccl
+ is available.
+
+ * FLIM-ELS: Don't install mel-ccl for anything older than MULE
+ 2.3.
+
+1998-10-08 MORIOKA Tomohiko <morioka@jaist.ac.jp>
+
+ * mel-u.el: Use `mel-define-backend' to define "x-uue".
+ Define "x-uuencode" as a clone of "x-uue".
+
+ * Move variable `mel-encoding-module-alist' from mel.el to
+ mime-def.el.
+
+ * mel.el (mel-find-function): Use function
+ `mel-find-function-from-obarray'.
+ Use `mel-define-backend' to define "7bit", "8bit" and "binary";
+ don't define methods of "8bit" and "binary"; inherit methods from
+ "7bit".
+
+ * mime-def.el (mel-service-list): New variable.
+ (mel-define-service): New implementation.
+ (mel-find-function-from-obarray): New inline function.
+ (mel-copy-method): New inline function.
+ (mel-copy-backend): New inline function.
+ (mel-define-backend): New macro.
+
+1998-10-08 MORIOKA Tomohiko <morioka@jaist.ac.jp>
+
+ * mel-u.el: Define method functions of mel.
+ (mime-encode-region): Use `mel-define-method-function'; abolish
+ `uuencode-encode-region'.
+ (mime-decode-region): Use `mel-define-method-function'; abolish
+ `uuencode-decode-region'.
+ (mime-encode-string): New method.
+ (mime-decode-string): New method.
+ (mime-insert-encoded-file): Use `mel-define-method'; abolish
+ `uuencode-insert-encoded-file'.
+ (mime-write-decoded-region): Use `mel-define-method'; abolish
+ `uuencode-write-decoded-region'.
+
+1998-10-07 MORIOKA Tomohiko <morioka@jaist.ac.jp>
+
+ * mime-def.el (mel-define-service): Add DOC.
+ (mel-define-method): Add DOC.
+ (mel-define-method-function): Add DOC.
+
+ * mime-en.sgml, mime-ja.sgml: Modify for FLIM 1.10.
+
1998-10-06 MORIOKA Tomohiko <morioka@jaist.ac.jp>
* mel-g.el: Define method functions of mel.
(setq flim-modules (cons 'mel-b-dl flim-modules))
)
-(if (featurep 'mule)
+(if (and (featurep 'mule)
+ (not (and (boundp 'MULE) MULE)))
(setq flim-modules (cons 'mel-ccl flim-modules))
)
1.9.2 Shin-Tanabe \e$(B?7EDJU\e(B
1.10.0 K\e-Dòdo\e-A \e$(B6=8M\e(B
1.10.1 Miyamaki \e$(B;0;3LZ\e(B
------ Kintetsu-Miyazu \e$(B6aE45\DE\e(B
+1.10.2 Kintetsu-Miyazu \e$(B6aE45\DE\e(B
----- Komada \e$(B9}ED\e(B
------ Shin-H\e-Dòsono\e-A \e$(B?7=K1`\e(B
+----- Shin-H\e-Dòsono\e-A \e$(B?7=K1`\e(B ; <=> JR \e$(BJRD.@~\e(B \e$(B=K1`\e(B
----- Kizugawadai \e$(BLZDE@nBf\e(B
----- Yamadagawa \e$(B;3ED@n\e(B
----- Takanohara \e$(B9b$N86\e(B
1.10.0 Marutamach \e$(B4]B@D.\e(B
1.11.0 Imadegawa \e$(B:#=P@n\e(B
1.11.1 Kuramaguchi \e$(B0HGO8}\e(B
+1.11.2 Kita\e-Dòji\e-A \e$(BKLBgO)\e(B
#
PACKAGE = flim-chao
-VERSION = 1.11.1
+VERSION = 1.11.2
TAR = tar
RM = /bin/rm -f
(require 'mime-def)
(eval-and-compile
- (defvar base64-dl-module
- (expand-file-name "base64.so" exec-directory))
-
(defvar base64-dl-handle
(and (file-exists-p base64-dl-module)
(dynamic-link base64-dl-module)))
;; Created: 1995/10/25
;; Keywords: uuencode
-;; This file is part of MEL (MIME Encoding Library).
+;; This file is part of FLIM (Faithful Library about Internet Message).
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License as
(require 'mime-def)
+(mel-define-backend "x-uue")
+
+
;;; @ variables
;;;
))
)))
-(defalias 'uuencode-encode-region 'uuencode-external-encode-region)
-(defalias 'uuencode-decode-region 'uuencode-external-decode-region)
+(mel-define-method-function (mime-encode-region start end (nil "x-uue"))
+ 'uuencode-external-encode-region)
+(mel-define-method-function (mime-decode-region start end (nil "x-uue"))
+ 'uuencode-external-decode-region)
+
+
+;;; @ encoder/decoder for string
+;;;
+
+(mel-define-method mime-encode-string (string (nil "x-uue"))
+ (with-temp-buffer
+ (insert string)
+ (uuencode-external-encode-region (point-min)(point-max))
+ (buffer-string)))
+
+(mel-define-method mime-decode-string (string (nil "x-uue"))
+ (with-temp-buffer
+ (insert string)
+ (uuencode-external-decode-region (point-min)(point-max))
+ (buffer-string)))
;;; @ uuencode encoder/decoder for file
;;;
-(defun uuencode-insert-encoded-file (filename)
+(mel-define-method mime-insert-encoded-file (filename (nil "x-uue"))
"Insert file encoded by unofficial uuencode format.
This function uses external uuencode encoder which is specified by
variable `uuencode-external-encoder'."
(file-name-nondirectory filename))
)
-(defun uuencode-write-decoded-region (start end filename)
+(mel-define-method mime-write-decoded-region (start end filename
+ (nil "x-gzip64"))
"Decode and write current region encoded by uuencode into FILENAME.
START and END are buffer positions."
(interactive
(provide 'mel-u)
+(mel-define-backend "x-uuencode" ("x-uue"))
+
;;; mel-u.el ends here
:group 'mime
:type '(repeat string))
-(defvar mel-encoding-module-alist nil)
-
(defun mime-encoding-list (&optional service)
"Return list of Content-Transfer-Encoding.
If SERVICE is specified, it returns available list of
)))
(defsubst mel-find-function (service encoding)
- (let* ((oba (symbol-value (intern (format "%s-obarray" service))))
- (f (intern-soft encoding oba)))
- (or f
- (let ((rest (cdr (assoc encoding mel-encoding-module-alist))))
- (while (and rest
- (progn
- (require (car rest))
- (null (setq f (intern-soft encoding oba)))
- ))
- (setq rest (cdr rest))
- )
- f))))
+ (mel-find-function-from-obarray
+ (symbol-value (intern (format "%s-obarray" service))) encoding))
;;; @ setting for modules
;;;
-(defvar base64-dl-module
- (and (fboundp 'dynamic-link)
- (let ((path (expand-file-name "base64.so" exec-directory)))
- (and (file-exists-p path)
- path))))
-
+(defvar mel-ccl-module
+ (and (featurep 'mule)
+ (module-installed-p 'mel-ccl)))
(mel-use-module 'mel-b '("base64" "B"))
(mel-use-module 'mel-q '("quoted-printable" "Q"))
(mel-use-module 'mel-g '("x-gzip64"))
(mel-use-module 'mel-u '("x-uue" "x-uuencode"))
-(if (featurep 'mule)
+(if mel-ccl-module
(mel-use-module 'mel-ccl '("base64" "quoted-printable" "B" "Q"))
)
(mel-use-module 'mel-b-dl '("base64" "B"))
)
+(mel-define-backend "7bit")
(mel-define-method-function (mime-encode-string string (nil "7bit"))
'identity)
(mel-define-method-function (mime-decode-string string (nil "7bit"))
start end filename (nil "7bit"))
'write-region-as-binary)
-(mel-define-method-function (mime-encode-string string (nil "8bit"))
- 'identity)
-(mel-define-method-function (mime-decode-string string (nil "8bit"))
- 'identity)
-(mel-define-method mime-encode-region (start end (nil "8bit")))
-(mel-define-method mime-decode-region (start end (nil "8bit")))
-(mel-define-method-function (mime-insert-encoded-file filename (nil "8bit"))
- 'insert-file-contents-as-binary)
-(mel-define-method-function (mime-write-decoded-region
- start end filename (nil "8bit"))
- 'write-region-as-binary)
+(mel-define-backend "8bit" ("7bit"))
-(mel-define-method-function (mime-encode-string string (nil "binary"))
- 'identity)
-(mel-define-method-function (mime-decode-string string (nil "binary"))
- 'identity)
-(mel-define-method mime-encode-region (start end (nil "binary")))
-(mel-define-method mime-decode-region (start end (nil "binary")))
-(mel-define-method-function (mime-insert-encoded-file filename (nil "binary"))
- 'insert-file-contents-as-binary)
-(mel-define-method-function (mime-write-decoded-region
- start end filename (nil "binary"))
- 'write-region-as-binary)
+(mel-define-backend "binary" ("8bit"))
;;; @ region
;;; Code:
-(defconst mime-library-product ["Chao" (1 11 1) "Kuramaguchi"]
+(defconst mime-library-product ["Chao" (1 11 2) "Kita\e.D\8eòji"]
"Product name, version number and code name of MIME-library package.")
(defmacro mime-product-name (product)
(defvar mime-entity-implementation-alist nil)
(defmacro mm-define-backend (type &optional parents)
- "Define mm-backend TYPE.
+ "Define TYPE as a mm-backend.
If PARENTS is specified, TYPE inherits PARENTS.
Each parent must be backend name (symbol)."
(if parents
;;; @ for mel-backend
;;;
+(defvar mel-service-list nil)
+
(defmacro mel-define-service (name &optional args &rest rest)
- (if args
- `(progn
- (defvar ,(intern (format "%s-obarray" name)) (make-vector 1 nil))
- (defun ,name ,args
- ,@rest
- (funcall (mel-find-function ',name ,(car (last args)))
- ,@(mm-arglist-to-arguments (butlast args)))
- ))
- `(defvar ,(intern (format "%s-obarray" name)) (make-vector 1 nil))
- ))
+ "Define NAME as a service for Content-Transfer-Encodings.
+If ARGS is specified, NAME is defined as a generic function for the
+service."
+ `(progn
+ (add-to-list 'mel-service-list ',name)
+ (defvar ,(intern (format "%s-obarray" name)) (make-vector 1 nil))
+ ,@(if args
+ `((defun ,name ,args
+ ,@rest
+ (funcall (mel-find-function ',name ,(car (last args)))
+ ,@(mm-arglist-to-arguments (butlast args)))
+ )))
+ ))
(put 'mel-define-service 'lisp-indent-function 'defun)
+
+(defvar mel-encoding-module-alist nil)
+
+(defsubst mel-find-function-from-obarray (ob-array encoding)
+ (let* ((f (intern-soft encoding ob-array)))
+ (or f
+ (let ((rest (cdr (assoc encoding mel-encoding-module-alist))))
+ (while (and rest
+ (progn
+ (require (car rest))
+ (null (setq f (intern-soft encoding ob-array)))
+ ))
+ (setq rest (cdr rest))
+ )
+ f))))
+
+(defsubst mel-copy-method (service src-backend dst-backend)
+ (let* ((oa (symbol-value (intern (format "%s-obarray" service))))
+ (f (mel-find-function-from-obarray oa src-backend))
+ sym)
+ (when f
+ (setq sym (intern dst-backend oa))
+ (or (fboundp sym)
+ (fset sym (symbol-function f))
+ ))))
+
+(defsubst mel-copy-backend (src-backend dst-backend)
+ (let ((services mel-service-list))
+ (while services
+ (mel-copy-method (car services) src-backend dst-backend)
+ (setq services (cdr services)))))
+
+(defmacro mel-define-backend (type &optional parents)
+ "Define TYPE as a mel-backend.
+If PARENTS is specified, TYPE inherits PARENTS.
+Each parent must be backend name (string)."
+ (cons 'progn
+ (mapcar (lambda (parent)
+ `(mel-copy-backend ,parent ,type)
+ )
+ parents)))
+
(defmacro mel-define-method (name args &rest body)
+ "Define NAME as a method function of (nth 1 (car (last ARGS))) backend.
+ARGS is like an argument list of lambda, but (car (last ARGS)) must be
+specialized parameter. (car (car (last ARGS))) is name of variable
+and (nth 1 (car (last ARGS))) is name of backend (encoding)."
(let* ((specializer (car (last args)))
(class (nth 1 specializer)))
`(progn
(put 'mel-define-method 'lisp-indent-function 'defun)
(defmacro mel-define-method-function (spec function)
+ "Set SPEC's function definition to FUNCTION.
+First element of SPEC is service.
+Rest of ARGS is like an argument list of lambda, but (car (last ARGS))
+must be specialized parameter. (car (car (last ARGS))) is name of
+variable and (nth 1 (car (last ARGS))) is name of backend (encoding)."
(let* ((name (car spec))
(args (cdr spec))
(specializer (car (last args)))
(intern ,class ,(intern (format "%s-obarray" name))))
)))
+(defvar base64-dl-module
+ (and (fboundp 'dynamic-link)
+ (let ((path (expand-file-name "base64.so" exec-directory)))
+ (and (file-exists-p path)
+ path))))
+
;;; @ end
;;;
<!doctype sinfo system>
<head>
-<title>FLIM 1.9 Manual about MIME Features
+<title>FLIM 1.10 Manual about MIME Features
<author>MORIOKA Tomohiko <mail>morioka@jaist.ac.jp</mail>
<date>1998/07/01
</defun>
-<h2> Region encoding/decoding
-<node> Region encoder/decoder
+<h2> Encoder/decoder
+<node> encoder/decoder
<p>
<defun name="mime-encode-region">
<args> start end encoding
using <var>encoding</var>.
</defun>
-<defvar name="mime-encoding-method-alist">
-<p>
-Alist of encoding vs. corresponding method to encode region.
-<p>
-Each element looks like <code>(STRING . FUNCTION)</code> or
-<code>(STRING . nil)</code>. <var>string</var> is
-content-transfer-encoding. <code>function</code> is region encoder
-and <code>nil</code> means not to encode.
-</defvar>
-
-<defvar name="mime-decoding-method-alist">
-<p>
-Alist of encoding vs. corresponding method to decode region.
-<p>
-Each element looks like <code>(STRING . FUNCTION)</code> or
-<code>(STRING . nil)</code>. <var>string</var> is
-content-transfer-encoding. <code>function</code> is region decoder
-and <code>nil</code> means not to decode.
-</defvar>
-
-<h2> String encoding/decoding
-<node> String encoder/decoder
-<p>
<defun name="mime-decode-string">
<args> string encoding
<p>
<var>string</var> \e$B$r\e(B <var>encoding</var> \e$B$H$7$FI|9f$7$?7k2L$rJV$7$^$9!#\e(B
</defun>
-<defvar name="mime-string-decoding-method-alist">
-<p>
-Alist of encoding vs. corresponding method to decode string.
-<p>
-Each element looks like <code>(STRING . FUNCTION)</code>.
-STRING is content-transfer-encoding.
-FUNCTION is string decoder.
-</defvar>
-
-<h2> File encoding/decoding
-<node> File encoder/decoder
-<p>
<defun name="mime-insert-encoded-file">
<args> filename encoding
<p>
<var>start</var> and <var>end</var> are buffer positions.
</defun>
-<defvar name="mime-file-encoding-method-alist">
-<p>
-Alist of encoding vs. corresponding method to insert encoded file.
-<p>
-Each element looks like <code>(STRING . FUNCTION)</code>. STRING is
-content-transfer-encoding. FUNCTION is function to insert encoded
-file.
-</defvar>
-
-<defvar name="mime-file-decoding-method-alist">
-<p>
-Alist of encoding vs. corresponding method to write decoded region to
-file.
-<p>
-Each element looks like <code>(STRING . FUNCTION)</code>. STRING is
-content-transfer-encoding. FUNCTION is function to write decoded
-region to file.
-</defvar>
-
<h2> Other utilities
<node> Encoding information
</defun>
+<h2> How to write encoder/decoder module
+<node> mel-backend
+<p>
+<defmacro name="mel-define-method">
+<args> name args <rest> body
+<p>
+Define <var>name</var> as a method function of (nth 1 (car (last
+<var>args</var>))) backend.
+<p>
+<var>args</var> is like an argument list of lambda, but (car (last
+<var>args</var>)) must be specialized parameter. (car (car (last
+<var>args</var>))) is name of variable and (nth 1 (car (last
+<var>args</var>))) is name of backend (encoding).
+<p>
+Example:
+<p>
+<lisp>
+(mel-define-method mime-write-decoded-region (start end filename
+ (nil "base64"))
+ "Decode and write current region encoded by base64 into FILENAME.
+START and END are buffer positions."
+ (interactive
+ (list (region-beginning) (region-end)
+ (read-file-name "Write decoded region to file: ")))
+ (let ((str (buffer-substring start end)))
+ (with-temp-buffer
+ (insert (decode-base64-string str))
+ (write-region-as-binary (point-min) (point-max) filename)
+ )))
+</lisp>
+</defmacro>
+
+<defmacro name="mel-define-method-function">
+<args> spec function
+<p>
+Set <var>spec</var>'s function definition to <var>function</var>.
+<p>
+First element of <var>spec</var> is service.
+<p>
+Rest of <var>args</var> is like an argument list of lambda, but (car
+(last <var>args</var>)) must be specialized parameter. (car (car
+(last <var>args</var>))) is name of variable and (nth 1 (car (last
+<var>args</var>))) is name of backend (encoding).
+<p>
+Example:
+<p>
+<lisp>
+(mel-define-method-function (mime-encode-string string (nil "base64"))
+ 'encode-base64-string)
+</lisp>
+</defmacro>
+
+
+<h2> How to add encoding/decoding service
+<node> generic function for mel-backend
+<p>
+<defmacro name="mel-define-service">
+<args> name
+<opts> args doc-string
+<p>
+Define <var>name</var> as a service for Content-Transfer-Encodings.
+<p>
+If <var>args</var> is specified, <var>name</var> is defined as a
+generic function for the service.
+<p>
+Example:
+<p>
+<lisp>
+(mel-define-service encoded-text-encode-string (string encoding)
+ "Encode STRING as encoded-text using ENCODING.
+ENCODING must be string.")
+</lisp>
+</defmacro>
+
+
<h1> Network representation of header
<node> encoded-word
<p>
\input texinfo.tex
@setfilename mime-en.info
-@settitle{FLIM 1.9 Manual about MIME Features}
+@settitle{FLIM 1.10 Manual about MIME Features}
@titlepage
-@title FLIM 1.9 Manual about MIME Features
+@title FLIM 1.10 Manual about MIME Features
@author MORIOKA Tomohiko <morioka@@jaist.ac.jp>
@subtitle 1998/07/01
@end titlepage
@node Top, Introduction, (dir), (dir)
-@top FLIM 1.9 Manual about MIME Features
+@top FLIM 1.10 Manual about MIME Features
@ifinfo
If @var{buffer} is omitted, current buffer is used.@refill
@var{type} is representation-type of created
-mime-entity. (cf. @ref{mm-backend})
- Default value is @var{buffer}.
+mime-entity. (cf. @ref{mm-backend}) Default value is @var{buffer}.
@end defun
@menu
* Content-Transfer-Encoding parser:: Parser
-* Region encoder/decoder:: Region encoding/decoding
-* String encoder/decoder:: String encoding/decoding
-* File encoder/decoder:: File encoding/decoding
+* encoder/decoder:: Encoder/decoder
* Encoding information:: Other utilities
+* mel-backend:: How to write encoder/decoder module
+* generic function for mel-backend:: How to add encoding/decoding service
@end menu
-@node Content-Transfer-Encoding parser, Region encoder/decoder, Content-Transfer-Encoding, Content-Transfer-Encoding
+@node Content-Transfer-Encoding parser, encoder/decoder, Content-Transfer-Encoding, Content-Transfer-Encoding
@section Parser
@defun mime-parse-Content-Transfer-Encoding string
-@node Region encoder/decoder, String encoder/decoder, Content-Transfer-Encoding parser, Content-Transfer-Encoding
-@section Region encoding/decoding
+@node encoder/decoder, Encoding information, Content-Transfer-Encoding parser, Content-Transfer-Encoding
+@section Encoder/decoder
@defun mime-encode-region start end encoding
@end defun
-@defvar mime-encoding-method-alist
-Alist of encoding vs. corresponding method to encode region.@refill
-
-Each element looks like @code{(STRING . FUNCTION)} or @code{(STRING
-. nil)}. @var{string} is content-transfer-encoding. @code{function} is
-region encoder and @code{nil} means not to encode.
-@end defvar
+@defun mime-decode-string string encoding
+@var{string} \e$B$r\e(B @var{encoding} \e$B$H$7$FI|9f$7$?7k2L$rJV$7$^$9!#\e(B
+@end defun
-@defvar mime-decoding-method-alist
-Alist of encoding vs. corresponding method to decode region.@refill
-Each element looks like @code{(STRING . FUNCTION)} or @code{(STRING
-. nil)}. @var{string} is content-transfer-encoding. @code{function} is
-region decoder and @code{nil} means not to decode.
-@end defvar
+@defun mime-insert-encoded-file filename encoding
+Insert file @var{FILENAME} encoded by @var{ENCODING} format.
+@end defun
-@node String encoder/decoder, File encoder/decoder, Region encoder/decoder, Content-Transfer-Encoding
-@section String encoding/decoding
+@defun mime-write-decoded-region start end filename encoding
-@defun mime-decode-string string encoding
+Decode and write current region encoded by @var{encoding} into
+@var{filename}.@refill
-@var{string} \e$B$r\e(B @var{encoding} \e$B$H$7$FI|9f$7$?7k2L$rJV$7$^$9!#\e(B
+@var{start} and @var{end} are buffer positions.
@end defun
-@defvar mime-string-decoding-method-alist
-Alist of encoding vs. corresponding method to decode string.@refill
+@node Encoding information, mel-backend, encoder/decoder, Content-Transfer-Encoding
+@section Other utilities
-Each element looks like @code{(STRING . FUNCTION)}. STRING is
-content-transfer-encoding. FUNCTION is string decoder.
-@end defvar
+@defun mime-encoding-list &optional SERVICE
+Return list of Content-Transfer-Encoding.@refill
+If @var{service} is specified, it returns available list of
+Content-Transfer-Encoding for it.
+@end defun
-@node File encoder/decoder, Encoding information, String encoder/decoder, Content-Transfer-Encoding
-@section File encoding/decoding
-@defun mime-insert-encoded-file filename encoding
+@defun mime-encoding-alist &optional SERVICE
-Insert file @var{FILENAME} encoded by @var{ENCODING} format.
+Return table of Content-Transfer-Encoding for completion.@refill
+
+If @var{service} is specified, it returns available list of
+Content-Transfer-Encoding for it.
@end defun
-@defun mime-write-decoded-region start end filename encoding
-Decode and write current region encoded by @var{encoding} into
-@var{filename}.@refill
+@node mel-backend, generic function for mel-backend, Encoding information, Content-Transfer-Encoding
+@section How to write encoder/decoder module
-@var{start} and @var{end} are buffer positions.
-@end defun
+@defmac mel-define-method name args &rest body
+Define @var{name} as a method function of (nth 1 (car (last
+@var{args}))) backend.@refill
-@defvar mime-file-encoding-method-alist
+@var{args} is like an argument list of lambda, but (car (last
+@var{args})) must be specialized parameter. (car (car (last
+@var{args}))) is name of variable and (nth 1 (car (last @var{args}))) is
+name of backend (encoding).@refill
-Alist of encoding vs. corresponding method to insert encoded
-file.@refill
+Example:@refill
-Each element looks like @code{(STRING . FUNCTION)}. STRING is
-content-transfer-encoding. FUNCTION is function to insert encoded file.
-@end defvar
+@lisp
+(mel-define-method mime-write-decoded-region (start end filename
+ (nil "base64"))
+ "Decode and write current region encoded by base64 into FILENAME.
+START and END are buffer positions."
+ (interactive
+ (list (region-beginning) (region-end)
+ (read-file-name "Write decoded region to file: ")))
+ (let ((str (buffer-substring start end)))
+ (with-temp-buffer
+ (insert (decode-base64-string str))
+ (write-region-as-binary (point-min) (point-max) filename)
+ )))
+@end lisp
+@end defmac
-@defvar mime-file-decoding-method-alist
+@defmac mel-define-method-function spec function
-Alist of encoding vs. corresponding method to write decoded region to
-file.@refill
+Set @var{spec}'s function definition to @var{function}.@refill
-Each element looks like @code{(STRING . FUNCTION)}. STRING is
-content-transfer-encoding. FUNCTION is function to write decoded region
-to file.
-@end defvar
+First element of @var{spec} is service.@refill
+Rest of @var{args} is like an argument list of lambda, but (car (last
+@var{args})) must be specialized parameter. (car (car (last
+@var{args}))) is name of variable and (nth 1 (car (last @var{args}))) is
+name of backend (encoding).@refill
+Example:@refill
-@node Encoding information, , File encoder/decoder, Content-Transfer-Encoding
-@section Other utilities
+@lisp
+(mel-define-method-function (mime-encode-string string (nil "base64"))
+ 'encode-base64-string)
+@end lisp
+@end defmac
-@defun mime-encoding-list &optional SERVICE
-Return list of Content-Transfer-Encoding.@refill
-If @var{service} is specified, it returns available list of
-Content-Transfer-Encoding for it.
-@end defun
+@node generic function for mel-backend, , mel-backend, Content-Transfer-Encoding
+@section How to add encoding/decoding service
+@defmac mel-define-service name &optional args doc-string
-@defun mime-encoding-alist &optional SERVICE
+Define @var{name} as a service for Content-Transfer-Encodings.@refill
-Return table of Content-Transfer-Encoding for completion.@refill
+If @var{args} is specified, @var{name} is defined as a generic function
+for the service.@refill
-If @var{service} is specified, it returns available list of
-Content-Transfer-Encoding for it.
-@end defun
+Example:@refill
+
+@lisp
+(mel-define-service encoded-text-encode-string (string encoding)
+ "Encode STRING as encoded-text using ENCODING.
+ENCODING must be string.")
+@end lisp
+@end defmac
<!doctype sinfo system>
<head>
-<title>FLIM 1.9 MIME \e$B5!G=@bL@=q\e(B
+<title>FLIM 1.10 MIME \e$B5!G=@bL@=q\e(B
<author>\e$B<i2,\e(B \e$BCNI'\e(B <mail>morioka@jaist.ac.jp</mail>
<date>1998/07/01
</defun>
-<h2> \e$BNN0h$NId9f2=!&I|9f2=\e(B
-<node> Region encoder/decoder
+<h2> \e$BId9f2=!&I|9f2=\e(B
+<node> encoder/decoder
<p>
<defun name="mime-encode-region">
<args> start end encoding
using <var>encoding</var>.
</defun>
-<defvar name="mime-encoding-method-alist">
-<p>
-Alist of encoding vs. corresponding method to encode region.
-<p>
-Each element looks like <code>(STRING . FUNCTION)</code> or
-<code>(STRING . nil)</code>. <var>string</var> is
-content-transfer-encoding. <code>function</code> is region encoder
-and <code>nil</code> means not to encode.
-</defvar>
-
-<defvar name="mime-decoding-method-alist">
-<p>
-Alist of encoding vs. corresponding method to decode region.
-<p>
-Each element looks like <code>(STRING . FUNCTION)</code> or
-<code>(STRING . nil)</code>. <var>string</var> is
-content-transfer-encoding. <code>function</code> is region decoder
-and <code>nil</code> means not to decode.
-</defvar>
-
-<h2> \e$BJ8;zNs$NId9f2=!&I|9f2=\e(B
-<node> String encoder/decoder
-<p>
<defun name="mime-decode-string">
<args> string encoding
<p>
<var>string</var> \e$B$r\e(B <var>encoding</var> \e$B$H$7$FI|9f$7$?7k2L$rJV$7$^$9!#\e(B
</defun>
-<defvar name="mime-string-decoding-method-alist">
-<p>
-Alist of encoding vs. corresponding method to decode string.
-<p>
-Each element looks like <code>(STRING . FUNCTION)</code>.
-STRING is content-transfer-encoding.
-FUNCTION is string decoder.
-</defvar>
-
-<h2> File \e$B$NId9f2=!&I|9f2=\e(B
-<node> File encoder/decoder
-<p>
<defun name="mime-insert-encoded-file">
<args> filename encoding
<p>
<var>start</var> and <var>end</var> are buffer positions.
</defun>
-<defvar name="mime-file-encoding-method-alist">
+
+<h2> Other utilities
+<node> Encoding information
<p>
-Alist of encoding vs. corresponding method to insert encoded file.
+<defun name="mime-encoding-list">
+ <opts> SERVICE
<p>
-Each element looks like <code>(STRING . FUNCTION)</code>. STRING is
-content-transfer-encoding. FUNCTION is function to insert encoded
-file.
-</defvar>
+Return list of Content-Transfer-Encoding.
+<p>
+If <var>service</var> is specified, it returns available list of
+Content-Transfer-Encoding for it.
+</defun>
-<defvar name="mime-file-decoding-method-alist">
+<defun name="mime-encoding-alist">
+ <opts> SERVICE
<p>
-Alist of encoding vs. corresponding method to write decoded region to
-file.
+Return table of Content-Transfer-Encoding for completion.
<p>
-Each element looks like <code>(STRING . FUNCTION)</code>. STRING is
-content-transfer-encoding. FUNCTION is function to write decoded
-region to file.
-</defvar>
+If <var>service</var> is specified, it returns available list of
+Content-Transfer-Encoding for it.
+</defun>
+
+
+<h2> How to write encoder/decoder module
+<node> mel-backend
+<p>
+<defmacro name="mel-define-method">
+<args> name args <rest> body
+<p>
+Define <var>name</var> as a method function of (nth 1 (car (last
+<var>args</var>))) backend.
+<p>
+<var>args</var> is like an argument list of lambda, but (car (last
+<var>args</var>)) must be specialized parameter. (car (car (last
+<var>args</var>))) is name of variable and (nth 1 (car (last
+<var>args</var>))) is name of backend (encoding).
+<p>
+Example:
+<p>
+<lisp>
+(mel-define-method mime-write-decoded-region (start end filename
+ (nil "base64"))
+ "Decode and write current region encoded by base64 into FILENAME.
+START and END are buffer positions."
+ (interactive
+ (list (region-beginning) (region-end)
+ (read-file-name "Write decoded region to file: ")))
+ (let ((str (buffer-substring start end)))
+ (with-temp-buffer
+ (insert (decode-base64-string str))
+ (write-region-as-binary (point-min) (point-max) filename)
+ )))
+</lisp>
+</defmacro>
+
+<defmacro name="mel-define-method-function">
+<args> spec function
+<p>
+Set <var>spec</var>'s function definition to <var>function</var>.
+<p>
+First element of <var>spec</var> is service.
+<p>
+Rest of <var>args</var> is like an argument list of lambda, but (car
+(last <var>args</var>)) must be specialized parameter. (car (car
+(last <var>args</var>))) is name of variable and (nth 1 (car (last
+<var>args</var>))) is name of backend (encoding).
+<p>
+Example:
+<p>
+<lisp>
+(mel-define-method-function (mime-encode-string string (nil "base64"))
+ 'encode-base64-string)
+</lisp>
+</defmacro>
+
+
+<h2> How to add encoding/decoding service
+<node> generic function for mel-backend
+<p>
+<defmacro name="mel-define-service">
+<args> name
+<opts> args doc-string
+<p>
+Define <var>name</var> as a service for Content-Transfer-Encodings.
+<p>
+If <var>args</var> is specified, <var>name</var> is defined as a
+generic function for the service.
+<p>
+Example:
+<p>
+<lisp>
+(mel-define-service encoded-text-encode-string (string encoding)
+ "Encode STRING as encoded-text using ENCODING.
+ENCODING must be string.")
+</lisp>
+</defmacro>
<h1> Header \e$B$N\e(B network \e$BI=8=\e(B
\input texinfo.tex
@setfilename mime-ja.info
-@settitle{FLIM 1.9 MIME \e$B5!G=@bL@=q\e(B}
+@settitle{FLIM 1.10 MIME \e$B5!G=@bL@=q\e(B}
@titlepage
-@title FLIM 1.9 MIME \e$B5!G=@bL@=q\e(B
+@title FLIM 1.10 MIME \e$B5!G=@bL@=q\e(B
@author \e$B<i2,\e(B \e$BCNI'\e(B <morioka@@jaist.ac.jp>
@subtitle 1998/07/01
@end titlepage
@node Top, Introduction, (dir), (dir)
-@top FLIM 1.9 MIME \e$B5!G=@bL@=q\e(B
+@top FLIM 1.10 MIME \e$B5!G=@bL@=q\e(B
@ifinfo
@menu
* Content-Transfer-Encoding parser:: Content-Transfer-Encoding \e$BMs$N2r@O4o\e(B
-* Region encoder/decoder:: \e$BNN0h$NId9f2=!&I|9f2=\e(B
-* String encoder/decoder:: \e$BJ8;zNs$NId9f2=!&I|9f2=\e(B
-* File encoder/decoder:: File \e$B$NId9f2=!&I|9f2=\e(B
+* encoder/decoder:: \e$BId9f2=!&I|9f2=\e(B
+* Encoding information:: Other utilities
+* mel-backend:: How to write encoder/decoder module
+* generic function for mel-backend:: How to add encoding/decoding service
@end menu
-@node Content-Transfer-Encoding parser, Region encoder/decoder, Content-Transfer-Encoding, Content-Transfer-Encoding
+@node Content-Transfer-Encoding parser, encoder/decoder, Content-Transfer-Encoding, Content-Transfer-Encoding
@section Content-Transfer-Encoding \e$BMs$N2r@O4o\e(B
@defun mime-parse-Content-Transfer-Encoding string
-@node Region encoder/decoder, String encoder/decoder, Content-Transfer-Encoding parser, Content-Transfer-Encoding
-@section \e$BNN0h$NId9f2=!&I|9f2=\e(B
+@node encoder/decoder, Encoding information, Content-Transfer-Encoding parser, Content-Transfer-Encoding
+@section \e$BId9f2=!&I|9f2=\e(B
@defun mime-encode-region start end encoding
@end defun
-@defvar mime-encoding-method-alist
-Alist of encoding vs. corresponding method to encode region.@refill
-
-Each element looks like @code{(STRING . FUNCTION)} or @code{(STRING
-. nil)}. @var{string} is content-transfer-encoding. @code{function} is
-region encoder and @code{nil} means not to encode.
-@end defvar
+@defun mime-decode-string string encoding
+@var{string} \e$B$r\e(B @var{encoding} \e$B$H$7$FI|9f$7$?7k2L$rJV$7$^$9!#\e(B
+@end defun
-@defvar mime-decoding-method-alist
-Alist of encoding vs. corresponding method to decode region.@refill
-Each element looks like @code{(STRING . FUNCTION)} or @code{(STRING
-. nil)}. @var{string} is content-transfer-encoding. @code{function} is
-region decoder and @code{nil} means not to decode.
-@end defvar
+@defun mime-insert-encoded-file filename encoding
+Insert file @var{FILENAME} encoded by @var{ENCODING} format.
+@end defun
-@node String encoder/decoder, File encoder/decoder, Region encoder/decoder, Content-Transfer-Encoding
-@section \e$BJ8;zNs$NId9f2=!&I|9f2=\e(B
+@defun mime-write-decoded-region start end filename encoding
-@defun mime-decode-string string encoding
+Decode and write current region encoded by @var{encoding} into
+@var{filename}.@refill
-@var{string} \e$B$r\e(B @var{encoding} \e$B$H$7$FI|9f$7$?7k2L$rJV$7$^$9!#\e(B
+@var{start} and @var{end} are buffer positions.
@end defun
-@defvar mime-string-decoding-method-alist
-Alist of encoding vs. corresponding method to decode string.@refill
+@node Encoding information, mel-backend, encoder/decoder, Content-Transfer-Encoding
+@section Other utilities
-Each element looks like @code{(STRING . FUNCTION)}. STRING is
-content-transfer-encoding. FUNCTION is string decoder.
-@end defvar
+@defun mime-encoding-list &optional SERVICE
+Return list of Content-Transfer-Encoding.@refill
+If @var{service} is specified, it returns available list of
+Content-Transfer-Encoding for it.
+@end defun
-@node File encoder/decoder, , String encoder/decoder, Content-Transfer-Encoding
-@section File \e$B$NId9f2=!&I|9f2=\e(B
-@defun mime-insert-encoded-file filename encoding
+@defun mime-encoding-alist &optional SERVICE
-Insert file @var{FILENAME} encoded by @var{ENCODING} format.
+Return table of Content-Transfer-Encoding for completion.@refill
+
+If @var{service} is specified, it returns available list of
+Content-Transfer-Encoding for it.
@end defun
-@defun mime-write-decoded-region start end filename encoding
-Decode and write current region encoded by @var{encoding} into
-@var{filename}.@refill
+@node mel-backend, generic function for mel-backend, Encoding information, Content-Transfer-Encoding
+@section How to write encoder/decoder module
-@var{start} and @var{end} are buffer positions.
-@end defun
+@defmac mel-define-method name args &rest body
+Define @var{name} as a method function of (nth 1 (car (last
+@var{args}))) backend.@refill
-@defvar mime-file-encoding-method-alist
+@var{args} is like an argument list of lambda, but (car (last
+@var{args})) must be specialized parameter. (car (car (last
+@var{args}))) is name of variable and (nth 1 (car (last @var{args}))) is
+name of backend (encoding).@refill
-Alist of encoding vs. corresponding method to insert encoded
-file.@refill
+Example:@refill
-Each element looks like @code{(STRING . FUNCTION)}. STRING is
-content-transfer-encoding. FUNCTION is function to insert encoded file.
-@end defvar
+@lisp
+(mel-define-method mime-write-decoded-region (start end filename
+ (nil "base64"))
+ "Decode and write current region encoded by base64 into FILENAME.
+START and END are buffer positions."
+ (interactive
+ (list (region-beginning) (region-end)
+ (read-file-name "Write decoded region to file: ")))
+ (let ((str (buffer-substring start end)))
+ (with-temp-buffer
+ (insert (decode-base64-string str))
+ (write-region-as-binary (point-min) (point-max) filename)
+ )))
+@end lisp
+@end defmac
-@defvar mime-file-decoding-method-alist
+@defmac mel-define-method-function spec function
-Alist of encoding vs. corresponding method to write decoded region to
-file.@refill
+Set @var{spec}'s function definition to @var{function}.@refill
-Each element looks like @code{(STRING . FUNCTION)}. STRING is
-content-transfer-encoding. FUNCTION is function to write decoded region
-to file.
-@end defvar
+First element of @var{spec} is service.@refill
+
+Rest of @var{args} is like an argument list of lambda, but (car (last
+@var{args})) must be specialized parameter. (car (car (last
+@var{args}))) is name of variable and (nth 1 (car (last @var{args}))) is
+name of backend (encoding).@refill
+
+Example:@refill
+
+@lisp
+(mel-define-method-function (mime-encode-string string (nil "base64"))
+ 'encode-base64-string)
+@end lisp
+@end defmac
+
+
+
+@node generic function for mel-backend, , mel-backend, Content-Transfer-Encoding
+@section How to add encoding/decoding service
+
+@defmac mel-define-service name &optional args doc-string
+
+Define @var{name} as a service for Content-Transfer-Encodings.@refill
+
+If @var{args} is specified, @var{name} is defined as a generic function
+for the service.@refill
+
+Example:@refill
+
+@lisp
+(mel-define-service encoded-text-encode-string (string encoding)
+ "Encode STRING as encoded-text using ENCODING.
+ENCODING must be string.")
+@end lisp
+@end defmac