Merge flim-1_10_4.
[elisp/flim.git] / mime-en.sgml
index fbb6f56..1aeb63c 100644 (file)
@@ -1,6 +1,6 @@
 <!doctype sinfo system>
 <head>
-<title>FLIM 1.8 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
 
@@ -42,46 +42,13 @@ a message or one of the parts in the body of a multipart entity.'  In
 this document, the term <concept>entity</concept> indicates all of
 header fields and body.
 <p>
-The definition of RFC 2045 indicates that a MIME message is a tree.
-An message is a tree, each node is an entity, like following figure.
-Namely MIME extends message to tree structure.
+The definition of RFC 2045 indicates that a MIME message is a tree,
+and each node of the tree is an entity.  Namely MIME extends message
+to tree structure.
 <p>
 FLIM uses <concept>mime-entity</concept> structure to represent
 information of entity.  In this document, it is called simply
 `mime-entity'.
-<p>
-\e$BA0=R$N$h$&$K!"\e(Bmessage \e$BCf$N3F\e(B entity \e$B$OLZ$N@a$KEv$?$j$^$9$,!"$3$NLZ$K$O\e(B
-\e$B?<$5$HF1$8?<$5$NCf$N=gHV$K=>$C$FHV9f$,IU$1$k$3$H$,$G$-$^$9!#B($A!"\e(B
-<verb>
-
-                              \e$B(#(!(!(!($\e(B
-                              \e$B("\e(B  nil \e$B("\e(B
-                              \e$B(&(!(((!(%\e(B
-              \e$B(#(!(!(!(!(!(!(!(!(!(+(!(!(!(!(!(!(!(!(!($\e(B
-            \e$B(#(*($\e(B              \e$B(#(*($\e(B              \e$B(#(*($\e(B
-            \e$B("#0("\e(B              \e$B("#1("\e(B              \e$B("#2("\e(B
-            \e$B(&(((%\e(B              \e$B(&(((%\e(B              \e$B(&(((%\e(B
-              \e$B("\e(B        \e$B(#(!(!(!(!(+(!(!(!(!($\e(B        \e$B("\e(B
-          \e$B(#(!(*(!($(#(!(*(!($(#(!(*(!($(#(!(*(!($(#(!(*(!($\e(B
-          \e$B("\e(B \e$B#0\e(B.\e$B#0("("\e(B \e$B#1\e(B.\e$B#0("("\e(B \e$B#1\e(B.\e$B#1("("\e(B \e$B#1\e(B.\e$B#2("("\e(B \e$B#2\e(B.\e$B#0("\e(B
-          \e$B(&(!(!(!(%(&(!(!(!(%(&(!(!(!(%(&(!(!(!(%(&(!(!(!(%\e(B
-
-</verb>
-<p>
-<noindent>\e$B$N$h$&$K?<$5\e(B n \e$B$N@a$K$OD9$5\e(B n \e$B$N@0?tNs$N@aHV9f$,?6$l$^$9!#$3$l\e(B
-\e$B$r\e(B <concept>entity-number</concept> \e$B$H8F$S$^$9!#\e(Bentity-number \e$B$O\e(B S \e$B<0$H\e(B
-\e$B$7$F$O\e(B <code>(1 2 3)</code> \e$B$N$h$&$J@0?t$N%j%9%H$H$7$FI=8=$5$l$^$9!#\e(B
-<p>
-mime-entity \e$B$G$O!"$3$l$HF1MM$N\e(B <concept>node-id</concept> \e$B$rMQ$$$^$9!#\e(B
-node-id \e$B$O$A$g$&$I\e(B entity-number \e$B$r5U$K$7$?%j%9%H$G!"\e(Bentity-number
-1.2.3 \e$B$KBP1~$9$k\e(B node-id \e$B$O\e(B <code>(3 2 1)</code> \e$B$G$9!#\e(B
-<p>
-\e$BA0=R$N$h$&$K!"\e(BMIME message \e$B$O\e(B entity \e$B$rC10L$H$7$?LZ9=B$$K$J$C$F$$$k$N$G!"\e(B
-\e$B$3$N:,$G$"$k\e(B message \e$BA4BN$b\e(B mime-entity \e$B$GI=8=$9$k$3$H$,$G$-!"\e(Bbuffer
-local \e$BJQ?t\e(B <code>mime-message-structure</code> \e$B$K3JG<$9$k$3$H$K$7$^$9!#\e(B
-\e$B$=$7$F!"\e(Bentity-number \e$B$d\e(B node-id \e$B$rMQ$$$k$3$H$G\e(B 
-<code>mime-message-structure</code> \e$B$K$*$1$k\e(B entity \e$B$NAjBPE*$J0LCV4X78$r\e(B
-\e$B07$&$3$H$,$G$-$^$9!#\e(B
 
 
 <h2> Functions to create mime-entity
@@ -99,7 +66,7 @@ depended on representation-type.
 </defun>
 
 <defun name="mime-parse-buffer">
-         <opts> buffer representation-type
+         <opts> buffer type
 <p>
 Parse <var>buffer</var> as message, and set the result to buffer local
 variable <code>mime-message-structure</code> of <var>buffer</var> as
@@ -107,14 +74,58 @@ mime-entity.
 <p>
 If <var>buffer</var> is omitted, current buffer is used.
 <p>
-<var>representation-type</var> is representation-type of created
-mime-entity.  Default value is <var>buffer</var>.
+<var>type</var> is representation-type of created mime-entity. <cf
+node="mm-backend"> Default value is <var>buffer</var>.
 </defun>
 
 
 <h2> Features about message tree
 <node> Entity hierarchy
 <p>
+Structure of a MIME message is tree.
+<p>
+In the tree, root node is the entity indicates all of the message.  In
+this document, it is called <concept>root-entity</concept> or
+<concept>message</concept>.  In FLIM, it is indicated by buffer local
+variable <code>mime-message-structure</code>.
+<p>
+Each entity except root-entity has a parent.  An entity may have
+children.  We can indicate an entity by relative position from a base
+entity, based on the parent-child relationship.
+<p>
+In addition, we can indicate an entity by absolute position of the
+message.
+<p>
+Each entity, which is a node of the tree, can be numbered by
+depth and left-to-right order of the depth.
+<verb>
+
+                              +-------+
+                              |  nil  |
+                              +---+---+
+              +-------------------+-------------------+
+            +-+-+               +-+-+               +-+-+
+            | 0 |               | 1 |               | 2 |
+            +-+-+               +-+-+               +-+-+
+              |         +---------+---------+         |
+           +--+--+   +--+--+   +--+--+   +--+--+   +--+--+
+           | 0.0 |   | 1.0 |   | 1.1 |   | 1.2 |   | 2.0 |
+           +-----+   +-----+   +-----+   +-----+   +-----+
+
+</verb>
+<p>
+Namely, if depth of a node is n, the node has a node-number, which is
+consists of n integers.  In this document, it is called
+<concept>entity-number</concept>.  An entity-number is represented by
+list of integer, like <code>(1 2 3)</code>.
+<p>
+mime-entity has also <concept>node-id</concept>.  A node-id is
+represented by reversed list of entity-number.  For example, node-id
+corresponding with 1.2.3 is <code>(3 2 1)</code>.
+<p>
+Each entity can be indicated by entity-number or node-id in
+<code>mime-message-structure</code>.
+
 <defvar name="mime-message-structure">
 <p>
 Buffer local variable to store mime-entity structure of message.
@@ -351,25 +362,22 @@ contains <var>entity</var>.
 <h2> Entity representations and implementations
 <node> mm-backend
 <p>
-Entity \e$B$OCj>]2=$5$l$?%G!<%?I=8=$G!"<B:]$N%G!<%?I=8=$H$7$F$OMQES$K1~$8$F\e(B
-\e$B$5$^$6$^$J$b$N$,MxMQ$G$-$k$h$&$K@_7W$5$l$F$$$^$9!#\e(B
+Entity is an abstraction.  It is designed to use various data
+representations for their purposes.
 <p>
-\e$B$3$3$G!"\e(Bentity \e$B$,$I$&$$$&<oN`$NI=8=$r9T$C$F$$$k$+$r<($9$N$,\e(B
-<concept>representation-type</concept> \e$B$G!"\e(Bentity \e$B$r@8@.$9$k;~$K$O$3$l$r\e(B
-\e$B;XDj$7$^$9!#\e(B<cf node="Entity Creation">
+Each entity has <concept>representation-type</concept>.  It must be
+specified when an entity is created. <cf node="Entity Creation">
 <p>
-\e$BA0@a$^$G$K=R$Y$FMh$?\e(B entity \e$B$KBP$9$k=hM}$O!"\e(Bentity \e$B$KBP$7$F$=$N=hM}$r0M\e(B
-\e$BMj$9$k$3$H$K$h$C$F<B8=$5$l$F$$$^$9!#\e(BEntity \e$B$O<+J,$N\e(B 
-representation-type \e$B$rCN$C$F$*$j!"$=$N\e(B representation-type \e$B$K1~$8$F<B:]\e(B
-\e$B$N=hM}$r9T$&4X?t$r8F$S=P$7$^$9!#$3$N$h$&$J4X?t$r\e(B <concept>entity \e$B=hM}\e(B
-method</concept> \e$B$H8F$S$^$9!#$^$?!"\e(Brepresentation-type \e$BKh$K$3$N$h$&$J4X\e(B
-\e$B?t$r$^$H$a$?$b$N$r\e(B <concept>mm-backend</concept> \e$B$H8F$S$^$9!#\e(B
+Functions about entity are implemented by request processing to the
+entity.  Each entity knows its representation-type.  Each entity calls
+processing function corresponding with the representation-type.  Such
+kind of function is called <concept>entity processing
+method</concept>.  A module, consists of them corresponding with a
+representation-type, is called <concept>mm-backend</concept>.
 <p>
-mm-backend \e$B$O\e(B representation-type \e$B$NL>A0$N@hF,$K\e(B <code>mm</code> \e$B$H$$$&\e(B
-\e$B@\F,<-$rIU$1$?4X?tL>$+$i$J$k\e(B module \e$B$G!"$=$N\e(B module \e$BL>$OF1MM$K\e(B
-representation-type \e$B$NL>A0$N@hF,$K\e(B <code>mm</code> \e$B$rIU$1$?$b$N$K$J$C$F\e(B
-\e$B$$$^$9!#$3$N\e(B module \e$B$O\e(B representation-type \e$B$N\e(B entity \e$B$,:G=i$K@8@.$5$l$k\e(B
-\e$B;~$K<+F0E*$K\e(B require \e$B$5$l$^$9!#\e(B
+Module name of each mm-backend consists of the prefix <code>mm</code>
+and its representation-type.  The module is required automatically
+when its entity is created at first.
 
 
 <h3> Message-passing for entity
@@ -378,18 +386,49 @@ representation-type \e$B$NL>A0$N@hF,$K\e(B <code>mm</code> \e$B$rIU$1$?$b$N$K$J$C$F
 <defun name="mime-entity-send">
              <args> entity message <rest> args
 <p>
-<var>entity</var> \e$B$K\e(B <var>message</var> \e$B$rAw$k!#\e(B
+Send <var>message</var> to <var>entity</var> with <var>args</var>, and
+return the result.
 <p>
-<var>args</var> \e$B$O\e(B <var>message</var> \e$B$N0z?t$G$"$k!#\e(B
+<var>args</var> is arguments of the <var>message</var>.
 </defun>
 
 
-<h3> How to make mm-backend
+<h3> Definition of mm-backend
 <node> mm-backend module
 <p>
-\e$B!J$9$_$^$;$s!#$=$N$&$A=q$-$^$9\e(B (^_^;\e$B!K\e(B
+<defmacro name="mm-define-backend">
+<args> type
+<opts> parents
+<p>
+Define <var>type</var> as a mm-backend.
+<p>
+If <var>PARENTS</var> is specified, <var>type</var> inherits parents.
+Each parent must be representation-type.
 <p>
-\e$B!J$H$j$"$($:!"\e(Bmm*.el \e$B$r;29M$K$7$F$/$@$5$$!K\e(B
+Example:
+<p>
+<lisp>
+(mm-define-backend chao (generic))
+</lisp>
+</defmacro>
+
+<defmacro name="mm-define-method">
+<args> name args <rest> body
+<p>
+Define <var>name</var> as a method function of (nth 1 (car
+<var>args</var>)) backend.
+<p>
+<var>args</var> is like an argument list of lambda, but (car
+<var>args</var>) must be specialized parameter.  (car (car
+<var>args</var>)) is name of variable and (nth 1 (car
+<var>args</var>)) is name of backend (representation-type).
+<p>
+Example:
+<p>
+<lisp>
+(mm-define-method entity-cooked-p ((entity chao)) nil)
+</lisp>
+</defmacro>
 
 
 <h1> Information of Content-Type field
@@ -415,14 +454,14 @@ Content-Type field.
 <h2> Format of Content-Type field
 <node> Content-Type field
 <p>
-Content-Type \e$BMs$N7A<0$O0J2<$N$h$&$KDj5A$5$l$F$$$^$9!'\e(B
+Format of Content-Type field is defined as follows:
 
 <quote>
 ``Content-Type'' ``:'' <concept>type</concept> ``/''
 <concept>subtype</concept> *( ``;'' <concept>parameter</concept> )
 </quote>
 <p>
-\e$BNc$($P!"\e(B
+For example:
 
 <quote>
 <verb>
@@ -430,25 +469,20 @@ Content-Type: image/jpeg
 </verb>
 </quote>
 
-<noindent>
-\e$B$d\e(B
-
 <quote>
 <verb>
 Content-Type: text/plain; charset=iso-2022-jp
 </verb>
 </quote>
-
-<noindent>
-\e$B$J$I$N$h$&$KMQ$$$i$l$^$9!#\e(B
 <p>
-\e$B$3$3$G!"\e(B`type' \e$B$H\e(B `subtype' \e$B$O\e(B entity \e$B$N7A<0$r<($9$b$N$G!"N><T$rAm>N$7\e(B
-\e$B$F!"\e(B`media-type' \e$B$H8F$V$3$H$K$7$^$9!#>e5-$NNc$K$*$1$k\e(B `image/jpeg' \e$B$d\e(B
-`text/plain' \e$B$O\e(B media-type \e$B$N#1$D$G$9!#\e(B
+`type' and `subtype' indicate format of an entity.  In this document,
+pair of them is called `media-type'.  `image/jpeg' or `text/plain' is
+a media-type.
 
 <memo>
 <p>
-Content-Type \e$BMs$N$J$$\e(B entity \e$B$O\e(B
+If an entity does not have Content-Type field, it is regarded as
+following:
 
 <quote>
 <verb>
@@ -457,7 +491,7 @@ Content-Type: text/plain; charset=us-ascii
 </quote>
 
 <noindent>
-\e$B$H$7$F2r<a$5$l$k!#\e(B<cf node="us-ascii">
+<cf node="us-ascii">
 </memo>
 
 
@@ -466,19 +500,20 @@ Content-Type: text/plain; charset=us-ascii
 <p>
 <define type="Structure" name="mime-content-type">
 <p>
-Content-Type \e$BMs$N>pJs$r3JG<$9$k$?$a$N9=B$BN!#\e(B
+Structure to store information of a Content-Type field.
 <p>
-\e$B$3$N9=B$BN$r;2>H$9$k$K$O\e(B <code>mime-content-type-\e$BMWAGL>\e(B</code> \e$B$H$$$&L>\e(B
-\e$BA0$N;2>H4X?t$rMQ$$$k!#\e(B
+Applications should use reference functions
+<code>mime-content-type-SLOT</code> to refer information of the
+structure.
 <p>
-\e$B$3$N9=B$BN$NMWAG$O0J2<$NDL$j$G$"$k!'\e(B
+Slots of the structure are following:
 
 <vl>
-<dt>primary-type<dd>media-type \e$B$N<g7?\e(B (symbol).
+<dt>primary-type<dd>primary type of media-type (symbol).
 </dd>
-<dt>subtype<dd>media-type \e$B$NI{7?\e(B (symbol).
+<dt>subtype<dd>subtype of media-type (symbol).
 </dd>
-<dt>parameters<dd>Content-Type \e$BMs$N\e(B parameter (\e$BO"A[\e(B list).
+<dt>parameters<dd>parameters of Content-Type field (association-list).
 </dd>
 </vl>
 </define>
@@ -486,13 +521,13 @@ Content-Type \e$BMs$N>pJs$r3JG<$9$k$?$a$N9=B$BN!#\e(B
 <defun name="make-mime-content-type">
          <args> type subtype
          <opts> parameters
-<p>content-type \e$B$N@8@.;R!#\e(B
+<p>Constructor of content-type.
 </defun>
 
 <defun name="mime-content-type-parameter">
 <args> content-type parameter
 <p>
-<var>content-type</var> \e$B$N\e(B <var>parameter</var> \e$B$NCM$rJV$9!#\e(B
+Return value of <var>parameter</var> of <var>content-type</var>.
 </defun>
 
 
@@ -502,14 +537,15 @@ Content-Type \e$BMs$N>pJs$r3JG<$9$k$?$a$N9=B$BN!#\e(B
 <defun name="mime-parse-Content-Type">
          <args> string
 <p>
-<var>string</var> \e$B$r\e(B content-type \e$B$H$7$F2r@O$7$?7k2L$rJV$9!#\e(B
+Parse <var>string</var> as field-body of Content-Type field.
 </defun>
 
 <defun name="mime-read-Content-Type">
 <p>
-\e$B8=:_$N\e(B buffer \e$B$N\e(B Content-Type \e$BMs$rFI$_<h$j!"2r@O$7$?7k2L$rJV$9!#\e(B
+Read field-body of Content-Type field from current-buffer,
+and return parsed it.
 <p>
-Content-Type \e$BMs$,B8:_$7$J$$>l9g$O\e(B nil \e$B$rJV$9!#\e(B
+Return <code>nil</code> if Content-Type field is not found.
 </defun>
 
 
@@ -527,8 +563,9 @@ Return type/subtype string from <var>type</var> and
 <h1> Information of Content-Disposition field
 <node> Content-Disposition
 <p>
-<concept>Content-Disposition \e$BMs\e(B</concept> \e$B$O\e(B entity \e$B$NI=<($d\e(B file \e$BL>$J$I\e(B
-\e$B$NB0@-$K$J$I$K4X$9$k>pJs$r5-=R$9$k$?$a$N$b$N$G$9!#\e(B
+<concept>Content-Disposition field</concept> is an optional field to
+specify presentation of an entity or attributes of an entity, such as
+file name.
 
 <rfc number="2183" type="Standards Track"
              author="S. Dorner, K. Moore and R. Troost"
@@ -536,9 +573,9 @@ Return type/subtype string from <var>type</var> and
              Internet Messages: The Content-Disposition Header"
              date="August 1997">
 <p>
-FLIM \e$B$O\e(B Content-Disposition \e$BMs$r9=J82r@O$9$k4X?t$H\e(B Content-Disposition 
-\e$BMs$N2r@O7k2L$r3JG<$9$k9=B$BN\e(B 
-<concept>mime-content-disposition</concept> \e$B$rDs6!$7$^$9!#\e(B
+FLIM provides parser for Content-Disposition field and structure
+<concept>mime-content-disposition</concept> to store information of
+Content-Disposition field.
 
 
 <h2> mime-content-disposition structure
@@ -546,17 +583,19 @@ FLIM \e$B$O\e(B Content-Disposition \e$BMs$r9=J82r@O$9$k4X?t$H\e(B Content-Dispositi
 <p>
 <define type="Structure" name="mime-content-disposition">
 <p>
-Content-Disposition \e$BMs$N2r@O7k2L$r<}$a$k$?$a$N9=B$BN!#\e(B
+Structure to store information of a Content-Disposition field.
 <p>
-\e$B$3$N9=B$BN$r;2>H$9$k$K$O\e(B <code>mime-content-disposition-\e$BMWAGL>\e(B</code> \e$B$H\e(B
-\e$B$$$&L>A0$N;2>H4X?t$rMQ$$$k!#\e(B
+Applications should use reference functions
+<code>mime-content-disposition-SLOT</code> to refer information of the
+structure.
 <p>
-\e$B$3$N9=B$BN$NMWAG$O0J2<$NDL$j$G$"$k!'\e(B
+Slots of the structure are following:
 
 <vl>
 <dt>disposition-type<dd>disposition-type (symbol).
 </dd>
-<dt>parameters<dd>Content-Disposition \e$BMs$N\e(B parameter (\e$BO"A[\e(B list).
+<dt>parameters<dd>parameters of Content-Disposition field
+(association-list).
 </dd>
 </vl>
 </define>
@@ -564,13 +603,14 @@ Content-Disposition \e$BMs$N2r@O7k2L$r<}$a$k$?$a$N9=B$BN!#\e(B
 <defun name="mime-content-disposition-parameter">
 <args> content-disposition parameter
 <p>
-<var>content-disposition</var> \e$B$N\e(B <var>parameter</var> \e$B$NCM$rJV$9!#\e(B
+Return value of <var>parameter</var> of
+<var>content-disposition</var>.
 </defun>
 
 <defun name="mime-content-disposition-filename">
 <args> content-disposition
 <p>
-<var>content-disposition</var> \e$B$N\e(B filename \e$B$NCM$rJV$9!#\e(B
+Return filename of <var>content-disposition</var>.
 </defun>
 
 
@@ -580,28 +620,30 @@ Content-Disposition \e$BMs$N2r@O7k2L$r<}$a$k$?$a$N9=B$BN!#\e(B
 <defun name="mime-parse-Content-Disposition">
            <args> string
 <p>
-<var>string</var> \e$B$r\e(B content-disposition \e$B$H$7$F2r@O$7$?7k2L$rJV$9!#\e(B
+Parse <var>string</var> as field-body of Content-Disposition field,
+and return the result.
 </defun>
 
 <defun name="mime-read-Content-Disposition">
 <p>
-\e$B8=:_$N\e(B buffer \e$B$N\e(B Content-Disposition \e$BMs$rFI$_<h$j!"2r@O$7$?7k2L$rJV$9!#\e(B
+Read field-body of Content-Disposition field from current-buffer,
 <p>
-Content-Disposition \e$BMs$,B8:_$7$J$$>l9g$O\e(B nil \e$B$rJV$9!#\e(B
+Return nil if Content-Disposition field is not found.
 </defun>
 
 
 <h1> Encoding Method
 <node> Content-Transfer-Encoding
 <p>
-<concept>Content-Transfer-Encoding \e$BMs\e(B</concept> \e$B$O\e(B entity \e$B$NId9f2=K!$r5-\e(B
-\e$B=R$9$k$?$a$N$b$N$G$9!#\e(B
+<concept>Content-Transfer-Encoding field</concept> is a header field
+to indicate body encoding of a entity.
 <p>
-FLIM \e$B$G$O\e(B Content-Transfer-Encoding \e$BMs$r9=J82r@O$9$k4X?t$rDs6!$7$^$9!#$3\e(B
-\e$B$l$i$N4X?t$O\e(B Content-Transfer-Encoding \e$BMs$N>pJs$OJ8;zNs$GI=8=$7$^$9!#\e(B
+FLIM provides parser functions for Content-Transfer-Encoding field.
+They represent information of Content-Transfer-Encoding field as
+string.
 <p>
-\e$B$^$?!"\e(BContent-Transfer-Encoding \e$B$K4p$E$$$FId9f2=!&I|9f2=$r9T$&4X?t$bDs\e(B
-\e$B6!$5$l$^$9!#\e(B
+In addition, FLIM provides encoder/decoder functions by
+Content-Transfer-Encoding.
 
 
 <h2> Parser
@@ -624,8 +666,8 @@ Content-Transfer-Encoding \e$BMs$,B8:_$7$J$$>l9g$O\e(B
 </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
@@ -641,49 +683,14 @@ Decode region <var>start</var> to <var>end</var> of current buffer
 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>
@@ -699,24 +706,102 @@ Decode and write current region encoded by <var>encoding</var> into
 <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> Network representation of header