*** empty log message ***
[m17n/m17n-lib.git] / src / coding.c
index eb7cc95..2832310 100644 (file)
@@ -1,5 +1,5 @@
 /* coding.c -- code conversion module.
 /* coding.c -- code conversion module.
-   Copyright (C) 2003, 2004
+   Copyright (C) 2003, 2004, 2005, 2007, 2008, 2009, 2010
      National Institute of Advanced Industrial Science and Technology (AIST)
      Registration Number H15PRO112
 
      National Institute of Advanced Industrial Science and Technology (AIST)
      Registration Number H15PRO112
 
@@ -17,7 +17,7 @@
 
    You should have received a copy of the GNU Lesser General Public
    License along with the m17n library; if not, write to the Free
 
    You should have received a copy of the GNU Lesser General Public
    License along with the m17n library; if not, write to the Free
-   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    02111-1307, USA.  */
 
 /***en
    02111-1307, USA.  */
 
 /***en
     coding system into an M-text, and inversely, can encode an M-text
     into a byte sequence.  */
 
     coding system into an M-text, and inversely, can encode an M-text
     into a byte sequence.  */
 
-/***oldja
+/***ja
     @addtogroup m17nConv
     @addtogroup m17nConv
-    @brief ¥³¡¼¥É·Ï¥ª¥Ö¥¸¥§¥¯¥È¤È¤½¤ì¤Ë´Ø¤¹¤ë API
+    @brief ¥³¡¼¥É·Ï¥ª¥Ö¥¸¥§¥¯¥È¤È¤½¤ì¤Ë´Ø¤¹¤ë API.
 
 
-    m17n ¥é¥¤¥Ö¥é¥ê¤Ï¡¢Éä¹æ²½Ê¸»ú½¸¹ç (coded character sets; CCS) ¤Îʸ
-    »úÉä¹ç²½Êý¼° (character encoding scheme; CES) ¤ò @e ¥³¡¼¥É·Ï ¤È¸Æ
-    ¤Ö¥ª¥Ö¥¸¥§¥¯¥È¤Çɽ¸½¤¹¤ë¡£m17n ¥é¥¤¥Ö¥é¥ê¤¬¥µ¥Ý¡¼¥È¤¹¤ëCES ¤Ï¡¢
-    UTF-8, UTF-16, ISO-2022, DIRECT-CHARSET, ¤½¤Î¾¡¢¤ËÂçÊ̤µ¤ì¤ë¡£¥¢
-    ¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é¥à¤¬Æȼ«¤Ë¥³¡¼¥É·Ï¤òÄɲ乤뤳¤È¤â²Äǽ¤Ç¤¢¤ë¡£
+    m17n ¥é¥¤¥Ö¥é¥ê¤Ï¡¢Éä¹æ²½Ê¸»ú½¸¹ç (coded character set; CCS) 
+    ¤Îʸ»úÉä¹ç²½Êý¼° (character encoding scheme; CES) ¤ò @e ¥³¡¼¥É·Ï 
+    ¤È¸Æ¤Ö¥ª¥Ö¥¸¥§¥¯¥È¤Çɽ¸½¤¹¤ë¡£
+    ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é¥à¤ÏÆȼ«¤Ë¥³¡¼¥É·Ï¤òÄɲ乤뤳¤È¤â¤Ç¤­¤ë¡£
 
 
-    ¥³¡¼¥É¥Ý¥¤¥ó¥È¤«¤éʸ»ú¥³¡¼¥É¤Ø¤ÎÊÑ´¹¤ò @e ¥¨¥ó¥³¡¼¥É ¤È¸Æ¤Ó¡¢Ê¸»ú
-    ¥³¡¼¥É¤«¤é¥³¡¼¥É¥Ý¥¤¥ó¥È¤Ø¤ÎÊÑ´¹¤ò @e ¥Ç¥³¡¼¥É ¤È¸Æ¤Ö¡£
+    ¥³¡¼¥É¥Ý¥¤¥ó¥È¤«¤éʸ»ú¥³¡¼¥É¤Ø¤ÎÊÑ´¹¤ò @e ¥¨¥ó¥³¡¼¥É 
+    ¤È¸Æ¤Ó¡¢Ê¸»ú¥³¡¼¥É¤«¤é¥³¡¼¥É¥Ý¥¤¥ó¥È¤Ø¤ÎÊÑ´¹¤ò @e ¥Ç¥³¡¼¥É ¤È¸Æ¤Ö¡£
 
 
-    ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é¥à¤Ï¡¢»ØÄꤵ¤ì¤¿¥³¡¼¥É·Ï¤Ç¥Ð¥¤¥ÈÎó¤ò¥Ç¥³¡¼
-    ¥É¤¹¤ë¤³¤È¤Ç M-text ¤òÆÀ¤ë¤³¤È¤¬¤Ç¤­¤ë¡£¤Þ¤¿µÕ¤Ë¡¢»ØÄꤵ¤ì¤¿¥³¡¼¥É
-    ·Ï¤Ç M-text ¤ò¥¨¥ó¥³¡¼¥É¤·¤¹¤ë¤³¤È¤Ç¥Ð¥¤¥ÈÎó¤òÆÀ¤ë¤³¤È¤¬¤Ç¤­¤ë¡£  */
+    ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é¥à¤Ï¡¢»ØÄꤵ¤ì¤¿¥³¡¼¥É·Ï¤Ç¥Ð¥¤¥ÈÎó¤ò¥Ç¥³¡¼¥É¤¹¤ë¤³¤È¤Ë¤è¤Ã¤Æ
+    M-text ¤òÆÀ¤ë¤³¤È¤¬¤Ç¤­¤ë¡£¤Þ¤¿µÕ¤Ë¡¢»ØÄꤵ¤ì¤¿¥³¡¼¥É·Ï¤Ç M-text 
+    ¤ò¥¨¥ó¥³¡¼¥É¤·¤¹¤ë¤³¤È¤Ë¤è¤Ã¤Æ¥Ð¥¤¥ÈÎó¤òÆÀ¤ë¤³¤È¤¬¤Ç¤­¤ë¡£  */
 
 /*=*/
 
 
 /*=*/
 
@@ -100,7 +99,7 @@ typedef struct
       reseting a converter.  */
   int (*resetter) (MConverter *converter);
 
       reseting a converter.  */
   int (*resetter) (MConverter *converter);
 
-  int (*decoder) (unsigned char *str, int str_bytes, MText *mt,
+  int (*decoder) (const unsigned char *str, int str_bytes, MText *mt,
                  MConverter *converter);
 
   int (*encoder) (MText *mt, int from, int to,
                  MConverter *converter);
 
   int (*encoder) (MText *mt, int from, int to,
@@ -156,7 +155,10 @@ typedef struct {
      Beginning of the byte sequence bound to this converter. */
   /**ja
      ¤³¤Î¥³¥ó¥Ð¡¼¥¿¤Ë·ë¤ÓÉÕ¤±¤é¤ì¤¿¥Ð¥¤¥ÈÎó¤ÎÀèƬ°ÌÃÖ */
      Beginning of the byte sequence bound to this converter. */
   /**ja
      ¤³¤Î¥³¥ó¥Ð¡¼¥¿¤Ë·ë¤ÓÉÕ¤±¤é¤ì¤¿¥Ð¥¤¥ÈÎó¤ÎÀèƬ°ÌÃÖ */
-  unsigned char *buf;
+  union {
+    const unsigned char *in;
+    unsigned char *out;
+  } buf;
 
   /**en
      Size of buf. */
 
   /**en
      Size of buf. */
@@ -391,8 +393,8 @@ encode_unsupporeted_char (int c, unsigned char *dst, unsigned char *dst_end,
 
 static int
 finish_decoding (MText *mt, MConverter *converter, int nchars,
 
 static int
 finish_decoding (MText *mt, MConverter *converter, int nchars,
-                unsigned char *source, unsigned char *src_end,
-                unsigned char *src,
+                const unsigned char *source, const unsigned char *src_end,
+                const unsigned char *src,
                 int error)
 {
   MConverterStatus *internal = (MConverterStatus *) converter->internal_info;
                 int error)
 {
   MConverterStatus *internal = (MConverterStatus *) converter->internal_info;
@@ -421,7 +423,7 @@ finish_decoding (MText *mt, MConverter *converter, int nchars,
     {
       unsigned char *dst = mt->data + mt->nbytes;
       unsigned char *dst_end = mt->data + mt->allocated;
     {
       unsigned char *dst = mt->data + mt->nbytes;
       unsigned char *dst_end = mt->data + mt->allocated;
-      unsigned char *src_stop = src_end;
+      const unsigned char *src_stop = src_end;
       int c;
       int last_nchars = nchars;
 
       int c;
       int last_nchars = nchars;
 
@@ -512,15 +514,15 @@ reset_coding_charset (MConverter *converter)
 }
 
 static int
 }
 
 static int
-decode_coding_charset (unsigned char *source, int src_bytes, MText *mt,
+decode_coding_charset (const unsigned char *source, int src_bytes, MText *mt,
                       MConverter *converter)
 {
   MConverterStatus *internal = (MConverterStatus *) converter->internal_info;
   MCodingSystem *coding = internal->coding;
                       MConverter *converter)
 {
   MConverterStatus *internal = (MConverterStatus *) converter->internal_info;
   MCodingSystem *coding = internal->coding;
-  unsigned char *src = internal->carryover;
-  unsigned char *src_stop = src + internal->carryover_bytes;
-  unsigned char *src_end = source + src_bytes;
-  unsigned char *src_base;
+  const unsigned char *src = internal->carryover;
+  const unsigned char *src_stop = src + internal->carryover_bytes;
+  const unsigned char *src_end = source + src_bytes;
+  const unsigned char *src_base;
   unsigned char *dst = mt->data + mt->nbytes;
   unsigned char *dst_end = mt->data + mt->allocated;
   int nchars = 0;
   unsigned char *dst = mt->data + mt->nbytes;
   unsigned char *dst_end = mt->data + mt->allocated;
   int nchars = 0;
@@ -713,15 +715,15 @@ encode_coding_charset (MText *mt, int from, int to,
 
 
 static int
 
 
 static int
-decode_coding_utf_8 (unsigned char *source, int src_bytes, MText *mt,
+decode_coding_utf_8 (const unsigned char *source, int src_bytes, MText *mt,
                     MConverter *converter)
 {
   MConverterStatus *internal = (MConverterStatus *) converter->internal_info;
   MCodingSystem *coding = internal->coding;
                     MConverter *converter)
 {
   MConverterStatus *internal = (MConverterStatus *) converter->internal_info;
   MCodingSystem *coding = internal->coding;
-  unsigned char *src = internal->carryover;
-  unsigned char *src_stop = src + internal->carryover_bytes;
-  unsigned char *src_end = source + src_bytes;
-  unsigned char *src_base;
+  const unsigned char *src = internal->carryover;
+  const unsigned char *src_stop = src + internal->carryover_bytes;
+  const unsigned char *src_end = source + src_bytes;
+  const unsigned char *src_base;
   unsigned char *dst = mt->data + mt->nbytes;
   unsigned char *dst_end = mt->data + mt->allocated;
   int nchars = 0;
   unsigned char *dst = mt->data + mt->nbytes;
   unsigned char *dst_end = mt->data + mt->allocated;
   int nchars = 0;
@@ -922,14 +924,14 @@ reset_coding_utf (MConverter *converter)
 }
 
 static int
 }
 
 static int
-decode_coding_utf_16 (unsigned char *source, int src_bytes, MText *mt,
+decode_coding_utf_16 (const unsigned char *source, int src_bytes, MText *mt,
                      MConverter *converter)
 {
   MConverterStatus *internal = (MConverterStatus *) converter->internal_info;
                      MConverter *converter)
 {
   MConverterStatus *internal = (MConverterStatus *) converter->internal_info;
-  unsigned char *src = internal->carryover;
-  unsigned char *src_stop = src + internal->carryover_bytes;
-  unsigned char *src_end = source + src_bytes;
-  unsigned char *src_base;
+  const unsigned char *src = internal->carryover;
+  const unsigned char *src_stop = src + internal->carryover_bytes;
+  const unsigned char *src_end = source + src_bytes;
+  const unsigned char *src_base;
   unsigned char *dst = mt->data + mt->nbytes;
   unsigned char *dst_end = mt->data + mt->allocated;
   int nchars = 0;
   unsigned char *dst = mt->data + mt->nbytes;
   unsigned char *dst_end = mt->data + mt->allocated;
   int nchars = 0;
@@ -1026,14 +1028,14 @@ decode_coding_utf_16 (unsigned char *source, int src_bytes, MText *mt,
 
 
 static int
 
 
 static int
-decode_coding_utf_32 (unsigned char *source, int src_bytes, MText *mt,
+decode_coding_utf_32 (const unsigned char *source, int src_bytes, MText *mt,
                      MConverter *converter)
 {
   MConverterStatus *internal = (MConverterStatus *) converter->internal_info;
                      MConverter *converter)
 {
   MConverterStatus *internal = (MConverterStatus *) converter->internal_info;
-  unsigned char *src = internal->carryover;
-  unsigned char *src_stop = src + internal->carryover_bytes;
-  unsigned char *src_end = source + src_bytes;
-  unsigned char *src_base;
+  const unsigned char *src = internal->carryover;
+  const unsigned char *src_stop = src + internal->carryover_bytes;
+  const unsigned char *src_end = source + src_bytes;
+  const unsigned char *src_base;
   unsigned char *dst = mt->data + mt->nbytes;
   unsigned char *dst_end = mt->data + mt->allocated;
   int nchars = 0;
   unsigned char *dst = mt->data + mt->nbytes;
   unsigned char *dst_end = mt->data + mt->allocated;
   int nchars = 0;
@@ -1525,15 +1527,15 @@ find_ctext_non_standard_charset (char *charset_name)
 }
 
 static int
 }
 
 static int
-decode_coding_iso_2022 (unsigned char *source, int src_bytes, MText *mt,
+decode_coding_iso_2022 (const unsigned char *source, int src_bytes, MText *mt,
                       MConverter *converter)
 {
   MConverterStatus *internal = (MConverterStatus *) converter->internal_info;
   MCodingSystem *coding = internal->coding;
                       MConverter *converter)
 {
   MConverterStatus *internal = (MConverterStatus *) converter->internal_info;
   MCodingSystem *coding = internal->coding;
-  unsigned char *src = internal->carryover;
-  unsigned char *src_stop = src + internal->carryover_bytes;
-  unsigned char *src_end = source + src_bytes;
-  unsigned char *src_base;
+  const unsigned char *src = internal->carryover;
+  const unsigned char *src_stop = src + internal->carryover_bytes;
+  const unsigned char *src_end = source + src_bytes;
+  const unsigned char *src_base;
   unsigned char *dst = mt->data + mt->nbytes;
   unsigned char *dst_end = mt->data + mt->allocated;
   int nchars = 0;
   unsigned char *dst = mt->data + mt->nbytes;
   unsigned char *dst_end = mt->data + mt->allocated;
   int nchars = 0;
@@ -1752,8 +1754,10 @@ decode_coding_iso_2022 (unsigned char *source, int src_bytes, MText *mt,
              else
                goto invalid_byte;
              /* We must update these variables now.  */
              else
                goto invalid_byte;
              /* We must update these variables now.  */
-             charset0 = status->designation[status->invocation[0]];
-             charset1 = status->designation[status->invocation[1]];
+             if (status->invocation[0] >= 0)
+               charset0 = status->designation[status->invocation[0]];
+             if (status->invocation[1] >= 0)
+               charset1 = status->designation[status->invocation[1]];
              continue;
 
            case 'n':           /* invocation of locking-shift-2 */
              continue;
 
            case 'n':           /* invocation of locking-shift-2 */
@@ -1832,7 +1836,7 @@ decode_coding_iso_2022 (unsigned char *source, int src_bytes, MText *mt,
                int bytes;
                int i;
 
                int bytes;
                int i;
 
-               if (! spec->flags & MCODING_ISO_DESIGNATION_CTEXT_EXT)
+               if (! (spec->flags & MCODING_ISO_DESIGNATION_CTEXT_EXT))
                  goto invalid_byte;
                /* Compound-text uses these escape sequences:
 
                  goto invalid_byte;
                /* Compound-text uses these escape sequences:
 
@@ -1905,8 +1909,10 @@ decode_coding_iso_2022 (unsigned char *source, int src_bytes, MText *mt,
              else
                goto invalid_byte;
              /* We must update these variables now.  */
              else
                goto invalid_byte;
              /* We must update these variables now.  */
-             charset0 = status->designation[status->invocation[0]];
-             charset1 = status->designation[status->invocation[1]];
+             if (status->invocation[0] >= 0)
+               charset0 = status->designation[status->invocation[0]];
+             if (status->invocation[1] >= 0)
+               charset1 = status->designation[status->invocation[1]];
              continue;
 
            unused_escape_sequence:
              continue;
 
            unused_escape_sequence:
@@ -2635,7 +2641,7 @@ reset_coding_sjis (MConverter *converter)
       MSymbol kana_sym = msymbol ("jisx0201-kana");
       MCharset *kana = MCHARSET (kana_sym);
 
       MSymbol kana_sym = msymbol ("jisx0201-kana");
       MCharset *kana = MCHARSET (kana_sym);
 
-      if (! kanji_sym || ! kana_sym)
+      if (! kanji || ! kana)
        return -1;
       coding->ncharsets = 3;
       coding->charsets[1] = kanji;
        return -1;
       coding->ncharsets = 3;
       coding->charsets[1] = kanji;
@@ -2646,15 +2652,15 @@ reset_coding_sjis (MConverter *converter)
 }
 
 static int
 }
 
 static int
-decode_coding_sjis (unsigned char *source, int src_bytes, MText *mt,
+decode_coding_sjis (const unsigned char *source, int src_bytes, MText *mt,
                    MConverter *converter)
 {
   MConverterStatus *internal = (MConverterStatus *) converter->internal_info;
   MCodingSystem *coding = internal->coding;
                    MConverter *converter)
 {
   MConverterStatus *internal = (MConverterStatus *) converter->internal_info;
   MCodingSystem *coding = internal->coding;
-  unsigned char *src = internal->carryover;
-  unsigned char *src_stop = src + internal->carryover_bytes;
-  unsigned char *src_end = source + src_bytes;
-  unsigned char *src_base;
+  const unsigned char *src = internal->carryover;
+  const unsigned char *src_stop = src + internal->carryover_bytes;
+  const unsigned char *src_end = source + src_bytes;
+  const unsigned char *src_base;
   unsigned char *dst = mt->data + mt->nbytes;
   unsigned char *dst_end = mt->data + mt->allocated - MAX_UTF8_CHAR_BYTES;
   int nchars = 0;
   unsigned char *dst = mt->data + mt->nbytes;
   unsigned char *dst_end = mt->data + mt->allocated - MAX_UTF8_CHAR_BYTES;
   int nchars = 0;
@@ -2819,14 +2825,19 @@ find_coding (MSymbol name)
 
   if (! coding)
     {
 
   if (! coding)
     {
-      MPlist *param = mplist_get (coding_definition_list, name);
+      MPlist *plist, *pl;
+      MSymbol sym = msymbol__canonicalize (name);
 
 
-      if (! param)
+      plist = mplist_find_by_key (coding_definition_list, sym);
+      if (! plist)
        return NULL;
        return NULL;
-      param = mplist__from_plist (param);
-      mconv_define_coding (MSYMBOL_NAME (name), param, NULL, NULL, NULL, NULL);
+      pl = MPLIST_PLIST (plist);
+      name = MPLIST_VAL (pl);
+      mconv_define_coding (MSYMBOL_NAME (name), MPLIST_NEXT (pl),
+                          NULL, NULL, NULL, NULL);
       coding = (MCodingSystem *) msymbol_get (name, Mcoding);
       coding = (MCodingSystem *) msymbol_get (name, Mcoding);
-      M17N_OBJECT_UNREF (param);
+      plist = mplist_pop (plist);
+      M17N_OBJECT_UNREF (plist);
     }
   return coding;
 }
     }
   return coding;
 }
@@ -2965,6 +2976,9 @@ mcoding__init (void)
                                          NULL, NULL, NULL, NULL);
 
   mplist_put (param, Mtype, Mnil);
                                          NULL, NULL, NULL, NULL);
 
   mplist_put (param, Mtype, Mnil);
+  pl = mplist ();
+  mplist_add (pl, Msymbol, msymbol ("Shift_JIS"));
+  mplist_put (param, Maliases, pl);
   mplist_set (charsets, Msymbol, Mcharset_ascii);
   Mcoding_sjis = mconv_define_coding ("sjis", param,
                                      reset_coding_sjis,
   mplist_set (charsets, Msymbol, Mcharset_ascii);
   Mcoding_sjis = mconv_define_coding ("sjis", param,
                                      reset_coding_sjis,
@@ -2973,6 +2987,7 @@ mcoding__init (void)
 
   M17N_OBJECT_UNREF (charsets);
   M17N_OBJECT_UNREF (param);
 
   M17N_OBJECT_UNREF (charsets);
   M17N_OBJECT_UNREF (param);
+  M17N_OBJECT_UNREF (pl);
 
   return 0;
 }
 
   return 0;
 }
@@ -3004,31 +3019,19 @@ mcoding__fini (void)
 }
 
 void
 }
 
 void
-mconv__define_coding_from_charset (MSymbol sym)
-{
-  MPlist *param = mplist (), *charsets = mplist ();
-
-  mplist_set (charsets, Msymbol, sym);
-  mplist_add (param, Mtype, Mcharset);
-  mplist_add (param, Mcharsets, charsets);
-  mconv_define_coding (msymbol_name (sym), param, NULL, NULL, NULL, NULL);
-  M17N_OBJECT_UNREF (charsets);
-  M17N_OBJECT_UNREF (param);
-}
-
-void
 mconv__register_charset_coding (MSymbol sym)
 {
 mconv__register_charset_coding (MSymbol sym)
 {
-  if (! mplist_find_by_key (coding_definition_list, sym))
+  MSymbol name = msymbol__canonicalize (sym);
+
+  if (! mplist_find_by_key (coding_definition_list, name))
     {
       MPlist *param = mplist (), *charsets = mplist ();
 
       mplist_set (charsets, Msymbol, sym);
     {
       MPlist *param = mplist (), *charsets = mplist ();
 
       mplist_set (charsets, Msymbol, sym);
-      mplist_add (param, Msymbol, Mtype);
-      mplist_add (param, Msymbol, Mcharset);
-      mplist_add (param, Msymbol, Mcharsets);
-      mplist_add (param, Mplist, charsets);
-      mplist_put (coding_definition_list, sym, param);
+      mplist_add (param, Msymbol, sym);
+      mplist_add (param, Mtype, Mcharset);
+      mplist_add (param, Mcharsets, charsets);
+      mplist_put (coding_definition_list, name, param);
       M17N_OBJECT_UNREF (charsets);
     }
 }
       M17N_OBJECT_UNREF (charsets);
     }
 }
@@ -3040,13 +3043,13 @@ mcoding__load_from_database ()
   MDatabase *mdb = mdatabase_find (msymbol ("coding-list"), Mnil, Mnil, Mnil);
   MPlist *def_list, *plist;
   MPlist *definitions = coding_definition_list;
   MDatabase *mdb = mdatabase_find (msymbol ("coding-list"), Mnil, Mnil, Mnil);
   MPlist *def_list, *plist;
   MPlist *definitions = coding_definition_list;
-  int mdebug_mask = MDEBUG_CODING;
+  int mdebug_flag = MDEBUG_CODING;
 
   if (! mdb)
     return 0;
   MDEBUG_PUSH_TIME ();
   def_list = (MPlist *) mdatabase_load (mdb);
 
   if (! mdb)
     return 0;
   MDEBUG_PUSH_TIME ();
   def_list = (MPlist *) mdatabase_load (mdb);
-  MDEBUG_PRINT_TIME ("CODING", (stderr, " to load the data."));
+  MDEBUG_PRINT_TIME ("CODING", (mdebug__output, " to load the data."));
   MDEBUG_POP_TIME ();
   if (! def_list)
     return -1;
   MDEBUG_POP_TIME ();
   if (! def_list)
     return -1;
@@ -3054,8 +3057,8 @@ mcoding__load_from_database ()
   MDEBUG_PUSH_TIME ();
   MPLIST_DO (plist, def_list)
     {
   MDEBUG_PUSH_TIME ();
   MPLIST_DO (plist, def_list)
     {
-      MPlist *pl;
-      MSymbol name;
+      MPlist *pl, *aliases;
+      MSymbol name, canonicalized;
 
       if (! MPLIST_PLIST_P (plist))
        MERROR (MERROR_CHARSET, -1);
 
       if (! MPLIST_PLIST_P (plist))
        MERROR (MERROR_CHARSET, -1);
@@ -3063,19 +3066,31 @@ mcoding__load_from_database ()
       if (! MPLIST_SYMBOL_P (pl))
        MERROR (MERROR_CHARSET, -1);
       name = MPLIST_SYMBOL (pl);
       if (! MPLIST_SYMBOL_P (pl))
        MERROR (MERROR_CHARSET, -1);
       name = MPLIST_SYMBOL (pl);
-      pl = MPLIST_NEXT (pl);
-      definitions = mplist_add (definitions, name, pl);
-      M17N_OBJECT_REF (pl);
+      canonicalized = msymbol__canonicalize (name);
+      pl = mplist__from_plist (MPLIST_NEXT (pl));
+      mplist_push (pl, Msymbol, name);
+      definitions = mplist_add (definitions, canonicalized, pl);
+      aliases = mplist_get (pl, Maliases);
+      if (aliases)
+       MPLIST_DO (aliases, aliases)
+         if (MPLIST_SYMBOL_P (aliases))
+           {
+             name = MPLIST_SYMBOL (aliases);
+             canonicalized = msymbol__canonicalize (name);
+             definitions = mplist_add (definitions, canonicalized, pl);
+             M17N_OBJECT_REF (pl);
+           }
     }
 
   M17N_OBJECT_UNREF (def_list);
     }
 
   M17N_OBJECT_UNREF (def_list);
-  MDEBUG_PRINT_TIME ("CODING", (stderr, " to parse the loaded data."));
+  MDEBUG_PRINT_TIME ("CODING", (mdebug__output, " to parse the loaded data."));
   MDEBUG_POP_TIME ();
   return 0;
 }
 
 /*** @} */
 #endif /* !FOR_DOXYGEN || DOXYGEN_INTERNAL_MODULE */
   MDEBUG_POP_TIME ();
   return 0;
 }
 
 /*** @} */
 #endif /* !FOR_DOXYGEN || DOXYGEN_INTERNAL_MODULE */
+
 \f
 /* External API */
 
 \f
 /* External API */
 
@@ -3083,63 +3098,59 @@ mcoding__load_from_database ()
 /*** @{ */
 /*=*/
 
 /*** @{ */
 /*=*/
 
-/***en @name Variables: Symbols representing a coding system */
-/***oldja @name ÊÑ¿ô: ÄêµÁºÑ¤ß¥³¡¼¥É·Ï¤ò»ØÄꤹ¤ë¤¿¤á¤Î¥·¥ó¥Ü¥ë */
+/***en @name Variables: Symbols representing coding systems */
+/***ja @name ÊÑ¿ô: ÄêµÁºÑ¤ß¥³¡¼¥É·Ï¤ò»ØÄꤹ¤ë¤¿¤á¤Î¥·¥ó¥Ü¥ë */
 /*** @{ */
 /*=*/
 
 /***en
 /*** @{ */
 /*=*/
 
 /***en
-    @brief Symbol for the coding system US-ASCII
+    @brief Symbol for the coding system US-ASCII.
 
     The symbol #Mcoding_us_ascii has name <tt>"us-ascii"</tt> and
     represents a coding system for the CES US-ASCII.  */
 
 
     The symbol #Mcoding_us_ascii has name <tt>"us-ascii"</tt> and
     represents a coding system for the CES US-ASCII.  */
 
-/***oldja
-    @brief MIME charset "US-ASCII" ¤ËÂбþ¤¹¤ë¥³¡¼¥É·Ï¤Î¥·¥ó¥Ü¥ë
+/***ja
+    @brief US-ASCII ¥³¡¼¥É·Ï¤Î¥·¥ó¥Ü¥ë.
 
 
-    ¥·¥ó¥Ü¥ë @c Mcoding_us_ascii ¤Ï <tt>"us-ascii"</tt> ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Á¡¢
-    MIME charset <tt>"US-ASCII"</tt> ¤ËÂбþ¤¹¤ë¥³¡¼¥É·Ï¤ò»ØÄꤹ¤ë¤¿¤á
-    ¤Ë»È¤ï¤ì¤ë¡£
-     */
+    ¥·¥ó¥Ü¥ë #Mcoding_us_ascii ¤Ï <tt>"us-ascii"</tt> ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Á¡¢
+    CES US-ASCII ÍѤΥ³¡¼¥É·Ï¤ò¼¨¤¹¡£
+    */
 MSymbol Mcoding_us_ascii;
 /*=*/
 
 /***en
 MSymbol Mcoding_us_ascii;
 /*=*/
 
 /***en
-    @brief Symbol for the coding system ISO-8859-1
+    @brief Symbol for the coding system ISO-8859-1.
 
     The symbol #Mcoding_iso_8859_1 has name <tt>"iso-8859-1"</tt> and
     represents a coding system for the CES ISO-8859-1.  */
 
 
     The symbol #Mcoding_iso_8859_1 has name <tt>"iso-8859-1"</tt> and
     represents a coding system for the CES ISO-8859-1.  */
 
-/***oldja
-    @brief MIME charset "ISO-8859-1" ¤ËÂбþ¤¹¤ë¥³¡¼¥É·Ï¤Î¥·¥ó¥Ü¥ë
+/***ja
+    @brief ISO-8859-1 ¥³¡¼¥É·Ï¤Î¥·¥ó¥Ü¥ë.
 
 
-    ¥·¥ó¥Ü¥ë @c Mcoding_iso_8859_1 ¤Ï <tt>"iso-8859-1"</tt> ¤È¤¤¤¦Ì¾Á°
-    ¤ò»ý¤Á¡¢MIME charset <tt>"ISO-8859-1"</tt> ¤ËÂбþ¤¹¤ë¥³¡¼¥É·Ï¤ò»Ø
-    Äꤹ¤ë¤¿¤á¤Ë»È¤ï¤ì¤ë¡£ */
+    ¥·¥ó¥Ü¥ë #Mcoding_iso_8859_1 ¤Ï <tt>"iso-8859-1"</tt> 
+    ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Á¡¢CES ISO-8859-1 ÍѤΥ³¡¼¥É·Ï¤ò¼¨¤¹¡£  */
 
 MSymbol Mcoding_iso_8859_1;
 /*=*/
 
 /***en
 
 MSymbol Mcoding_iso_8859_1;
 /*=*/
 
 /***en
-    @brief Symbol for the coding system UTF-8
+    @brief Symbol for the coding system UTF-8.
 
     The symbol #Mcoding_utf_8 has name <tt>"utf-8"</tt> and represents
     a coding system for the CES UTF-8.  */
 
 
     The symbol #Mcoding_utf_8 has name <tt>"utf-8"</tt> and represents
     a coding system for the CES UTF-8.  */
 
-/***oldja
-    @brief RFC 2279 ¤Î "UTF-8" ¤ËÂбþ¤¹¤ë¥³¡¼¥É·Ï¤Î¥·¥ó¥Ü¥ë¡ÊUnicode ÍÑ¡Ë
+/***ja
+    @brief UTF-8 ¥³¡¼¥É·Ï¤Î¥·¥ó¥Ü¥ë.
 
 
-    ¥·¥ó¥Ü¥ë @c Mcoding_utf_8 ¤Ï <tt>"utf-8"</tt> ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Á¡¢
-    RFC 2279 ¤ÇÄêµÁ¤µ¤ì¤ë<tt>"UTF-8"</tt> ¤ËÂбþ¤¹¤ë¥³¡¼¥É·Ï¤ò»ØÄꤹ¤ë
-    ¤¿¤á¤Ë»È¤ï¤ì¤ë¡£¤³¤Î¥³¡¼¥É·Ï¤Ï Unicode ¤ÎÁ´¤Æ¤Îʸ»ú¤ò¥µ¥Ý¡¼¥È¤¹¤ë¡£
+    ¥·¥ó¥Ü¥ë #Mcoding_utf_8 ¤Ï <tt>"utf-8"</tt> ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Á¡¢CES
+    UTF-8 ÍѤΥ³¡¼¥É·Ï¤ò¼¨¤¹¡£
      */
 
 MSymbol Mcoding_utf_8;
 /*=*/
 
 /***en
      */
 
 MSymbol Mcoding_utf_8;
 /*=*/
 
 /***en
-    @brief UTF-8-FULL
-
+    @brief Symbol for the coding system UTF-8-FULL.
 
     The symbol #Mcoding_utf_8_full has name <tt>"utf-8-full"</tt> and
     represents a coding system that is a extension of UTF-8.  This
 
     The symbol #Mcoding_utf_8_full has name <tt>"utf-8-full"</tt> and
     represents a coding system that is a extension of UTF-8.  This
@@ -3147,82 +3158,117 @@ MSymbol Mcoding_utf_8;
     limited to the Unicode characters.  It can encode all characters
     supported by the m17n library.  */
 
     limited to the Unicode characters.  It can encode all characters
     supported by the m17n library.  */
 
-/***oldja
-    @brief RFC 2279 ¤Î "UTF-8" ¤ËÂбþ¤¹¤ë¥³¡¼¥É·Ï¤Î¥·¥ó¥Ü¥ë¡ÊÁ´Ê¸»úÍÑ¡Ë
+/***ja
+    @brief UTF-8-FULL ¥³¡¼¥É·Ï¤Î¥·¥ó¥Ü¥ë.
 
 
-    ¥·¥ó¥Ü¥ë @c Mcoding_utf_8_full ¤Ï <tt>"utf-8-full"</tt> ¤È¤¤¤¦Ì¾Á°
-    ¤ò»ý¤Á¡¢RFC 2279 ¤ÇÄêµÁ¤µ¤ì¤ë<tt>"UTF-8"</tt> ¤ËÂбþ¤¹¤ë¥³¡¼¥É·Ï¤ò
-    »ØÄꤹ¤ë¤¿¤á¤Ë»È¤ï¤ì¤ë¡£¤³¤Î¥³¡¼¥É·Ï¤Ï m17n ¥é¥¤¥Ö¥é¥ê¤¬°·¤¦Á´¤Æ¤Î
-    Ê¸»ú¤ò¥µ¥Ý¡¼¥È¤¹¤ë¡£  */
+    ¥·¥ó¥Ü¥ë #Mcoding_utf_8_full ¤Ï <tt>"utf-8-full"</tt> 
+    ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Á¡¢<tt>"UTF-8"</tt> ¤Î³ÈÄ¥¤Ç¤¢¤ë¥³¡¼¥É·Ï¤ò¼¨¤¹¡£
+    ¤³¤Î¥³¡¼¥É·Ï¤Ï UTF-8 ¤ÈƱ¤¸¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¥¢¥ë¥´¥ê¥º¥à¤òÍѤ¤¤ë¤¬¡¢ÂоݤÏ
+    Unicode Ê¸»ú¤Ë¤Ï¸ÂÄꤵ¤ì¤Ê¤¤¡£
+    ¤Þ¤¿m17n ¥é¥¤¥Ö¥é¥ê¤¬°·¤¦Á´¤Æ¤Îʸ»ú¤ò¥¨¥ó¥³¡¼¥É¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
+    */
 
 MSymbol Mcoding_utf_8_full;
 /*=*/
 
 /***en
 
 MSymbol Mcoding_utf_8_full;
 /*=*/
 
 /***en
-    @brief UTF-16
+    @brief Symbol for the coding system UTF-16.
 
     The symbol #Mcoding_utf_16 has name <tt>"utf-16"</tt> and
     represents a coding system for the CES UTF-16 (RFC 2279).  */
 
     The symbol #Mcoding_utf_16 has name <tt>"utf-16"</tt> and
     represents a coding system for the CES UTF-16 (RFC 2279).  */
-/***oldja
-    @brief RFC 2781 ¤Î "UTF-16" ¤ËÂбþ¤¹¤ë¥³¡¼¥É·Ï¤Î¥·¥ó¥Ü¥ë
+/***ja
+    @brief UTF-16 ¥³¡¼¥É·Ï¤Î¥·¥ó¥Ü¥ë.
 
 
-    ¥·¥ó¥Ü¥ë @c Mcoding_utf_16 ¤Ï <tt>"utf-16"</tt> ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Á¡¢
-    RFC 2279 ¤ÇÄêµÁ¤µ¤ì¤ë<tt>"UTF-16"</tt> ¤ËÂбþ¤¹¤ë¥³¡¼¥É·Ï¤ò»ØÄꤹ
-    ¤ë¤¿¤á¤Ë»È¤ï¤ì¤ë¡£¤³¤Î¥³¡¼¥É·Ï¤Ï Unicode ¤ÎÁ´¤Æ¤Îʸ»ú¤ò¥µ¥Ý¡¼¥È¤¹
-    ¤ë¡£ */
+    ¥·¥ó¥Ü¥ë #Mcoding_utf_16 ¤Ï <tt>"utf-16"</tt> ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Á¡¢
+    CES UTF-16 (RFC 2279) ÍѤΥ³¡¼¥É·Ï¤ò¼¨¤¹¡£
+     */
 
 MSymbol Mcoding_utf_16;
 /*=*/
 
 /***en
 
 MSymbol Mcoding_utf_16;
 /*=*/
 
 /***en
-    @brief UTF-16BE
+    @brief Symbol for the coding system UTF-16BE.
 
     The symbol #Mcoding_utf_16be has name <tt>"utf-16be"</tt> and
     represents a coding system for the CES UTF-16BE (RFC 2279).  */
 
 
     The symbol #Mcoding_utf_16be has name <tt>"utf-16be"</tt> and
     represents a coding system for the CES UTF-16BE (RFC 2279).  */
 
+/***ja
+    @brief UTF-16BE ¥³¡¼¥É·Ï¤Î¥·¥ó¥Ü¥ë.
+
+    ¥·¥ó¥Ü¥ë #Mcoding_utf_16be ¤Ï <tt>"utf-16be"</tt> ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Á¡¢
+    CES UTF-16BE (RFC 2279) ÍѤΥ³¡¼¥É·Ï¤ò¼¨¤¹¡£     */
+
 MSymbol Mcoding_utf_16be;
 /*=*/
 
 /***en
 MSymbol Mcoding_utf_16be;
 /*=*/
 
 /***en
-    @brief UTF-16LE
+    @brief Symbol for the coding system UTF-16LE.
 
     The symbol #Mcoding_utf_16le has name <tt>"utf-16le"</tt> and
     represents a coding system for the CES UTF-16LE (RFC 2279).  */
 
 
     The symbol #Mcoding_utf_16le has name <tt>"utf-16le"</tt> and
     represents a coding system for the CES UTF-16LE (RFC 2279).  */
 
+/***ja
+    @brief UTF-16LE ¥³¡¼¥É·Ï¤Î¥·¥ó¥Ü¥ë.
+
+    ¥·¥ó¥Ü¥ë #Mcoding_utf_16le ¤Ï <tt>"utf-16le"</tt> ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Á¡¢
+    CES UTF-16LE (RFC 2279) ÍѤΥ³¡¼¥É·Ï¤ò¼¨¤¹¡£     */
+
 MSymbol Mcoding_utf_16le;
 /*=*/
 
 /***en
 MSymbol Mcoding_utf_16le;
 /*=*/
 
 /***en
-    @brief UTF-32
+    @brief Symbol for the coding system UTF-32.
 
     The symbol #Mcoding_utf_32 has name <tt>"utf-32"</tt> and
     represents a coding system for the CES UTF-32 (RFC 2279).  */
 
 
     The symbol #Mcoding_utf_32 has name <tt>"utf-32"</tt> and
     represents a coding system for the CES UTF-32 (RFC 2279).  */
 
+/***ja
+    @brief UTF-32 ¥³¡¼¥É·Ï¤Î¥·¥ó¥Ü¥ë.
+
+    ¥·¥ó¥Ü¥ë #Mcoding_utf_32 ¤Ï <tt>"utf-32"</tt> ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Á¡¢
+    CES UTF-32 (RFC 2279) ÍѤΥ³¡¼¥É·Ï¤ò¼¨¤¹¡£     */
+
 MSymbol Mcoding_utf_32;
 /*=*/
 
 /***en
 MSymbol Mcoding_utf_32;
 /*=*/
 
 /***en
-    @brief UTF-32be
+    @brief Symbol for the coding system UTF-32BE.
 
     The symbol #Mcoding_utf_32be has name <tt>"utf-32be"</tt> and
     represents a coding system for the CES UTF-32BE (RFC 2279).  */
 
     The symbol #Mcoding_utf_32be has name <tt>"utf-32be"</tt> and
     represents a coding system for the CES UTF-32BE (RFC 2279).  */
+/***ja
+    @brief UTF-32BE ¥³¡¼¥É·Ï¤Î¥·¥ó¥Ü¥ë.
+
+    ¥·¥ó¥Ü¥ë #Mcoding_utf_32be ¤Ï <tt>"utf-32be"</tt> ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Á¡¢
+    CES UTF-32BE (RFC 2279) ÍѤΥ³¡¼¥É·Ï¤ò¼¨¤¹¡£     */
 
 MSymbol Mcoding_utf_32be;
 /*=*/
 
 /***en
 
 MSymbol Mcoding_utf_32be;
 /*=*/
 
 /***en
-    @brief UTF-32LE
+    @brief Symbol for the coding system UTF-32LE.
 
     The symbol #Mcoding_utf_32le has name <tt>"utf-32le"</tt> and
     represents a coding system for the CES UTF-32LE (RFC 2279).  */
 
     The symbol #Mcoding_utf_32le has name <tt>"utf-32le"</tt> and
     represents a coding system for the CES UTF-32LE (RFC 2279).  */
+/***ja
+    @brief UTF-32LE ¥³¡¼¥É·Ï¤Î¥·¥ó¥Ü¥ë.
+
+    ¥·¥ó¥Ü¥ë #Mcoding_utf_32le ¤Ï <tt>"utf-32le"</tt> ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Á¡¢
+    CES UTF-32LE (RFC 2279) ÍѤΥ³¡¼¥É·Ï¤ò¼¨¤¹¡£     */
+
 MSymbol Mcoding_utf_32le;
 /*=*/
 
 /***en
 MSymbol Mcoding_utf_32le;
 /*=*/
 
 /***en
-    @brief SJIS
+    @brief Symbol for the coding system SJIS.
 
     The symbol #Mcoding_sjis has name <tt>"sjis"</tt> and represents a coding
     system for the CES Shift-JIS.  */ 
 
     The symbol #Mcoding_sjis has name <tt>"sjis"</tt> and represents a coding
     system for the CES Shift-JIS.  */ 
+/***ja
+    @brief SJIS ¥³¡¼¥É·Ï¤Î¥·¥ó¥Ü¥ë.
+
+    ¥·¥ó¥Ü¥ë #Mcoding_sjis has ¤Ï <tt>"sjis"</tt> ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Á¡¢
+    CES Shift-JISÍѤΥ³¡¼¥É·Ï¤ò¼¨¤¹¡£  */ 
 
 MSymbol Mcoding_sjis;
 /*** @} */ 
 
 MSymbol Mcoding_sjis;
 /*** @} */ 
@@ -3230,14 +3276,16 @@ MSymbol Mcoding_sjis;
 
 /***en
     @name Variables: Parameter keys for mconv_define_coding ().  */
 
 /***en
     @name Variables: Parameter keys for mconv_define_coding ().  */
+/***ja
+    @name ÊÑ¿ô:  mconv_define_coding () Íѥѥé¥á¡¼¥¿¥­¡¼  */
 /*** @{ */
 /*=*/
 
 /***en
     Parameter key for mconv_define_coding () (which see). */ 
 /*** @{ */
 /*=*/
 
 /***en
     Parameter key for mconv_define_coding () (which see). */ 
+/***ja
+    mconv_define_coding () Íѥѥé¥á¡¼¥¿¥­¡¼ (¾ÜºÙ¤Ï mconv_define_coding ()»²¾È). */ 
 MSymbol Mtype;
 MSymbol Mtype;
-/*=*/
-
 MSymbol Mcharsets;
 MSymbol Mflags;
 MSymbol Mdesignation;
 MSymbol Mcharsets;
 MSymbol Mflags;
 MSymbol Mdesignation;
@@ -3249,7 +3297,9 @@ MSymbol Mlittle_endian;
 /*=*/
 
 /***en
 /*=*/
 
 /***en
-    @name Variables: Symbols representing coding system type.  */
+    @name Variables: Symbols representing coding system types.  */
+/***ja
+    @name ÊÑ¿ô¡§ ¥³¡¼¥É·Ï¤Î¥¿¥¤¥×¤ò¼¨¤¹¥·¥ó¥Ü¥ë.  */
 /*** @{ */
 /*=*/
 
 /*** @{ */
 /*=*/
 
@@ -3257,6 +3307,10 @@ MSymbol Mlittle_endian;
     Symbol that can be a value of the #Mtype parameter of a coding
     system used in an argument to the mconv_define_coding () function
     (which see).  */
     Symbol that can be a value of the #Mtype parameter of a coding
     system used in an argument to the mconv_define_coding () function
     (which see).  */
+/***ja 
+    ´Ø¿ô mconv_define_coding () ¤Î°ú¿ô¤È¤·¤ÆÍѤ¤¤é¤ì¤ë¥³¡¼¥É·Ï¤Î¥Ñ¥é¥á¡¼¥¿
+    #Mtype ¤ÎÃͤȤʤêÆÀ¤ë¥·¥ó¥Ü¥ë¡£(¾ÜºÙ¤Ï 
+    mconv_define_coding ()»²¾È)¡£  */
  
 MSymbol Mutf;
 /*=*/
  
 MSymbol Mutf;
 /*=*/
@@ -3266,16 +3320,19 @@ MSymbol Miso_2022;
 /*=*/
 
 /***en
 /*=*/
 
 /***en
-    @name Variables: Symbols appearing in the value of #Mfrag parameter.  */
+    @name Variables: Symbols appearing in the value of Mflags parameter.  */
+/***ja
+    @name ÊÑ¿ô¡§ ¥Ñ¥é¥á¡¼¥¿ Mflags ¤ÎÃͤȤʤêÆÀ¤ë¥·¥ó¥Ü¥ë.  */
 /*** @{ */
 /*** @{ */
-/*=*/
-
 /***en
 /***en
-    Symbol that can be a value of the #Mflags parameter of a coding
+    Symbols that can be a value of the @b Mflags parameter of a coding
     system used in an argument to the mconv_define_coding () function
     (which see).  */
     system used in an argument to the mconv_define_coding () function
     (which see).  */
+/***ja 
+    ´Ø¿ô mconv_define_coding () ¤Î°ú¿ô¤È¤·¤ÆÍѤ¤¤é¤ì¤ë¥³¡¼¥É·Ï¤Î¥Ñ¥é¥á¡¼¥¿
+    @b Mflags ¤ÎÃͤȤʤêÆÀ¤ë¥·¥ó¥Ü¥ë¡£(¾ÜºÙ¤Ï 
+    mconv_define_coding ()»²¾È)¡£  */
 MSymbol Mreset_at_eol;
 MSymbol Mreset_at_eol;
-/*=*/
 MSymbol Mreset_at_cntl;
 MSymbol Meight_bit;
 MSymbol Mlong_form;
 MSymbol Mreset_at_cntl;
 MSymbol Meight_bit;
 MSymbol Mlong_form;
@@ -3294,161 +3351,168 @@ MSymbol Mfull_support;
 /*=*/
 
 /***en
 /*=*/
 
 /***en
-    @name Variables: etc
+    @name Variables: Others
 
     Remaining variables.  */
 
     Remaining variables.  */
-/***oldja @name ÊÑ¿ô: ¤½¤Î¾ */
+/***ja @name ÊÑ¿ô: ¤½¤Î¾ 
+
+    ¤Û¤«¤ÎÊÑ¿ô¡£ */
 /*** @{ */
 /*=*/
 /***en
     @brief Symbol whose name is "maybe".
 
     The variable #Mmaybe is a symbol of name <tt>"maybe"</tt>.  It is
 /*** @{ */
 /*=*/
 /***en
     @brief Symbol whose name is "maybe".
 
     The variable #Mmaybe is a symbol of name <tt>"maybe"</tt>.  It is
-    used a value of #Mbom parameter of the function
+    used a value of @b Mbom parameter of the function
     mconv_define_coding () (which see).  */
     mconv_define_coding () (which see).  */
+/***ja
+    @brief "maybe"¤È¤¤¤¦Ì¾Á°¤ò»ý¤Ä¥·¥ó¥Ü¥ë.
+
+    ÊÑ¿ô #Mmaybe ¤Ï <tt>"maybe"</tt> ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Ä¡£¤³¤ì¤Ï´Ø¿ô 
+    mconv_define_coding () ¥Ñ¥é¥á¡¼¥¿ @b Mbom ¤ÎÃͤȤ·¤ÆÍѤ¤¤é¤ì¤ë¡£
+    (¾ÜºÙ¤Ï mconv_define_coding () »²¾È)¡£ */
 
 MSymbol Mmaybe;
 /*=*/
 
 /***en
 
 MSymbol Mmaybe;
 /*=*/
 
 /***en
-    @brief The symbol @c Mcoding
+    @brief The symbol @c Mcoding.
 
     Any decoded M-text has a text property whose key is the predefined
     symbol @c Mcoding.  The name of @c Mcoding is
     <tt>"coding"</tt>.  */
 
 
     Any decoded M-text has a text property whose key is the predefined
     symbol @c Mcoding.  The name of @c Mcoding is
     <tt>"coding"</tt>.  */
 
-/***oldja
-    @brief ¥·¥ó¥Ü¥ë @c Mcoding
+/***ja
+    @brief ¥·¥ó¥Ü¥ë @c Mcoding.
 
 
-    ¥Ç¥³¡¼¥É¤µ¤ì¤¿ M-text ¤Ï¡¢¥­¡¼¤¬ @c Mcoding ¤Ç¤¢¤ë¤è¤¦¤Ê¥Æ¥­¥¹¥È¥×
-    ¥í¥Ñ¥Æ¥£¤ò»ý¤Ä¡£¥·¥ó¥Ü¥ë @c Mcoding ¤Ï <tt>"coding"</tt> ¤È¤¤¤¦Ì¾
-    Á°¤Ç¤¢¤é¤«¤¸¤áÄêµÁ¤µ¤ì¤Æ¤¤¤ë¡£  */
+    ¥Ç¥³¡¼¥É¤µ¤ì¤¿ M-text ¤Ï¤¹¤Ù¤Æ¡¢¥­¡¼¤¬ÄêµÁºÑ¤ß¥·¥ó¥Ü¥ë @c Mcoding 
+    ¤Ç¤¢¤ë¤è¤¦¤Ê¥Æ¥­¥¹¥È¥×¥í¥Ñ¥Æ¥£¤ò»ý¤Ä¡£¥·¥ó¥Ü¥ë @c Mcoding ¤Ï 
+    <tt>"coding"</tt> ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Ä¡£  */
 
 MSymbol Mcoding;
 /*=*/
 /*** @} */ 
 
 MSymbol Mcoding;
 /*=*/
 /*** @} */ 
-/*=*/
 
 /***en
 
 /***en
-    @brief Define a coding system
+    @brief Define a coding system.
 
     The mconv_define_coding () function defines a new coding system
 
     The mconv_define_coding () function defines a new coding system
-    and makes it accessive via a symbol whose name is $NAME.  $PLIST
-    specifies parameters of the charset as below:
+    and makes it accessible via a symbol whose name is $NAME.  $PLIST
+    specifies parameters of the coding system as below:
 
     <ul>
 
     <li> Key is @c Mtype, value is a symbol
 
     The value specifies the type of the coding system.  It must be
 
     <ul>
 
     <li> Key is @c Mtype, value is a symbol
 
     The value specifies the type of the coding system.  It must be
-    #Mcharset, #Mutf, #Miso_2022, or #Mnil.
-
-    If the type is #Mcharset, $EXTRA_INFO is ignored.
+    @b Mcharset, @b Mutf, @b Miso_2022, or @b Mnil.
 
 
-    If the type is #Miso_2022, $EXTRA_INFO must be a pointer to
-    #MCodingInfoISO2022.
+    If the type is @b Mcharset, $EXTRA_INFO is ignored.
 
 
-    If the type is #Mutf, $EXTRA_INFO must be a pointer to
+    If the type is @b Mutf, $EXTRA_INFO must be a pointer to
     #MCodingInfoUTF.
 
     #MCodingInfoUTF.
 
+    If the type is @b Miso_2022, $EXTRA_INFO must be a pointer to
+    #MCodingInfoISO2022.
+
     If the type is #Mnil, the argument $RESETTER, $DECODER, and
     $ENCODER must be supplied.  $EXTRA_INFO is ignored.  Otherwise,
     they can be @c NULL and the m17n library provides proper defaults.
 
     If the type is #Mnil, the argument $RESETTER, $DECODER, and
     $ENCODER must be supplied.  $EXTRA_INFO is ignored.  Otherwise,
     they can be @c NULL and the m17n library provides proper defaults.
 
-    <li> Key is #Mcharsets, value is a plist
+    <li> Key is @b Mcharsets, value is a plist
 
     The value specifies a list charsets supported by the coding
     system.  The keys of the plist must be #Msymbol, and the values
     must be symbols representing charsets.
 
 
     The value specifies a list charsets supported by the coding
     system.  The keys of the plist must be #Msymbol, and the values
     must be symbols representing charsets.
 
-    <li> Key is #Mflags, value is a plist
+    <li> Key is @b Mflags, value is a plist
 
 
-    If the type is #Miso_2022, the values specifies flags to control
-    the ISO 2022 interpreter.  The keys of the plist must e @c
-    Msymbol, and values must be one of the following.
+    If the type is @b Miso_2022, the values specifies flags to control
+    the ISO 2022 interpreter.  The keys of the plist must e #Msymbol,
+    and values must be one of the following.
 
     <ul>
 
 
     <ul>
 
-    <li> #Mreset_at_eol
+    <li> @b Mreset_at_eol
 
 
-    If this flag exits, designation and invocation status is reset to
+    If this flag exists, designation and invocation status is reset to
     the initial state at the end of line.
 
     the initial state at the end of line.
 
-    <li> #Mreset_at_cntl
+    <li> @b Mreset_at_cntl
 
     If this flag exists, designation and invocation status is reset to
     the initial state at a control character.
 
 
     If this flag exists, designation and invocation status is reset to
     the initial state at a control character.
 
-    <li> #Meight_bit
+    <li> @b Meight_bit
 
     If this flag exists, the graphic plane right is used.
 
 
     If this flag exists, the graphic plane right is used.
 
-    <li> #Mlong_form
+    <li> @b Mlong_form
 
     If this flag exists, the over-long escape sequences (ESC '$' '('
 
     If this flag exists, the over-long escape sequences (ESC '$' '('
-    <final_byte>) are used for designating the charsets JISX0208.1978,
+    \<final_byte\>) are used for designating the CCS JISX0208.1978,
     GB2312, and JISX0208.
 
     GB2312, and JISX0208.
 
-    <li> #Mdesignation_g0
+    <li> @b Mdesignation_g0
 
 
-    If this flag and #Mfull_support exists, designates charsets not
+    If this flag and @b Mfull_support exists, designates charsets not
     listed in the charset list to the graphic register G0.
 
     listed in the charset list to the graphic register G0.
 
-    <li> #Mdesignation_g1
+    <li> @b Mdesignation_g1
 
 
-    If this flag and #Mfull_support exists, designates charsets not
+    If this flag and @b Mfull_support exists, designates charsets not
     listed in the charset list to the graphic register G1.
 
     listed in the charset list to the graphic register G1.
 
-    <li> #Mdesignation_ctext
+    <li> @b Mdesignation_ctext
 
 
-    If this flag and #Mfull_support exists, designates charsets not
+    If this flag and @b Mfull_support exists, designates charsets not
     listed in the charset list to a graphic register G0 or G1 based on
     the criteria of the Compound Text.
 
     listed in the charset list to a graphic register G0 or G1 based on
     the criteria of the Compound Text.
 
-    <li> #Mdesignation_ctext_ext
+    <li> @b Mdesignation_ctext_ext
 
 
-    If this flag and #Mfull_support exists, designates charsets not
+    If this flag and @b Mfull_support exists, designates charsets not
     listed in the charset list to a graphic register G0 or G1, or use
     extended segment for such charsets based on the criteria of the
     Compound Text.
 
     listed in the charset list to a graphic register G0 or G1, or use
     extended segment for such charsets based on the criteria of the
     Compound Text.
 
-    <li> #Mlocking_shift
+    <li> @b Mlocking_shift
 
     If this flag exists, use locking shift.
 
 
     If this flag exists, use locking shift.
 
-    <li> #Msingle_shift
+    <li> @b Msingle_shift
 
     If this flag exists, use single shift.
 
 
     If this flag exists, use single shift.
 
-    <li> #Msingle_shift_7
+    <li> @b Msingle_shift_7
 
     If this flag exists, use 7-bit single shift code (0x19).
 
 
     If this flag exists, use 7-bit single shift code (0x19).
 
-    <li> #Meuc_tw_shift;
+    <li> @b Meuc_tw_shift
 
     If this flag exists, use a special shifting according to EUC-TW.
 
 
     If this flag exists, use a special shifting according to EUC-TW.
 
-    <li> #Miso_6429
+    <li> @b Miso_6429
 
     This flag is currently ignored.
 
 
     This flag is currently ignored.
 
-    <li> #Mrevision_number
+    <li> @b Mrevision_number
 
     If this flag exists, use a revision number escape sequence to
     designate a charset that has a revision number.
 
 
     If this flag exists, use a revision number escape sequence to
     designate a charset that has a revision number.
 
-    <li> #Mfull_support
+    <li> @b Mfull_support
 
     If this flag exists, support all charsets registered in the
     International Registry.
 
     </ul>
 
 
     If this flag exists, support all charsets registered in the
     International Registry.
 
     </ul>
 
-    <li> Key is #Mdesignation, value is a plist
+    <li> Key is @b Mdesignation, value is a plist
 
 
-    If the type is #Miso_2022, the value specifies how to designate
-    each supported characters.  The keys of the plist must be @c
-    Minteger, and the values must be numbers indicating a graphic
+    If the type is @b Miso_2022, the value specifies how to designate
+    each supported characters.  The keys of the plist must be 
+    #Minteger, and the values must be numbers indicating a graphic
     registers.  The Nth element value is for the Nth charset of the
     charset list.  The value 0..3 means that it is assumed that a
     charset is already designated to the graphic register 0..3.  The
     registers.  The Nth element value is for the Nth charset of the
     charset list.  The value 0..3 means that it is assumed that a
     charset is already designated to the graphic register 0..3.  The
@@ -3456,9 +3520,9 @@ MSymbol Mcoding;
     to any register at first, and if necessary, is designated to the
     (G+4) graphic register.
 
     to any register at first, and if necessary, is designated to the
     (G+4) graphic register.
 
-    <li> Key is #Minvocation, value is a plist
+    <li> Key is @b Minvocation, value is a plist
 
 
-    If the type is #Miso_2022, the value specifies how to invocate
+    If the type is @b Miso_2022, the value specifies how to invocate
     each graphic registers.  The plist length must be one or two.  The
     keys of the plist must be #Minteger, and the values must be
     numbers indicating a graphic register.  The value of the first
     each graphic registers.  The plist length must be one or two.  The
     keys of the plist must be #Minteger, and the values must be
     numbers indicating a graphic register.  The value of the first
@@ -3468,22 +3532,22 @@ MSymbol Mcoding;
     second element specifies which graphic register is invocated to
     the graphic plane right.
 
     second element specifies which graphic register is invocated to
     the graphic plane right.
 
-    <li> Key is #Mcode_unit, value is an integer
+    <li> Key is @b Mcode_unit, value is an integer
 
 
-    If the type is #Mutf, the value specifies the bit length of a
+    If the type is @b Mutf, the value specifies the bit length of a
     code-unit.  It must be 8, 16, or 32.
 
     code-unit.  It must be 8, 16, or 32.
 
-    <li> Key is #Mbom, value is a symbol
+    <li> Key is @b Mbom, value is a symbol
 
 
-    If the type is #Mutf and the code-unit bit length is 16 or 32,
+    If the type is @b Mutf and the code-unit bit length is 16 or 32,
     it specifies whether or not to use BOM (Byte Order Mark).  If the
     value is #Mnil (default), BOM is not used, else if the value is
     #Mmaybe, the existence of BOM is detected at decoding time, else
     BOM is used.
 
     it specifies whether or not to use BOM (Byte Order Mark).  If the
     value is #Mnil (default), BOM is not used, else if the value is
     #Mmaybe, the existence of BOM is detected at decoding time, else
     BOM is used.
 
-    <li> Key is #Mlittle_endian, value is a symbol
+    <li> Key is @b Mlittle_endian, value is a symbol
 
 
-    If the type is #Mutf and the code-unit bit length is 16 or 32,
+    If the type is @b Mutf and the code-unit bit length is 16 or 32,
     it specifies whether or not the encoding is little endian.  If the
     value is #Mnil (default), it is big endian, else it is little
     endian.
     it specifies whether or not the encoding is little endian.  If the
     value is #Mnil (default), it is big endian, else it is little
     endian.
@@ -3526,72 +3590,194 @@ MSymbol Mcoding;
 
     If the operation was successful, mconv_define_coding () returns a
     symbol whose name is $NAME.  If an error is detected, it returns
 
     If the operation was successful, mconv_define_coding () returns a
     symbol whose name is $NAME.  If an error is detected, it returns
-    #Mnil and assigns an error code to the external variable @c
-    merror_code.  */
+    #Mnil and assigns an error code to the external variable #merror_code.  */
 
 
-/***oldja
-    @brief ¥³¡¼¥É·Ï¤ÎÄêµÁ
+/***ja
+    @brief ¥³¡¼¥É·Ï¤òÄêµÁ¤¹¤ë.
 
     ´Ø¿ô mconv_define_coding () ¤Ï¡¢¿·¤·¤¤¥³¡¼¥É·Ï¤òÄêµÁ¤·¡¢¤½¤ì¤ò 
 
     ´Ø¿ô mconv_define_coding () ¤Ï¡¢¿·¤·¤¤¥³¡¼¥É·Ï¤òÄêµÁ¤·¡¢¤½¤ì¤ò 
-    $NAME ¤È¤¤¤¦Ì¾Á°¤Î¥·¥ó¥Ü¥ë·Ðͳ¤Ç¥¢¥¯¥»¥¹¤Ç¤­¤ë¤è¤¦¤Ë¤¹¤ë¡£
+    $NAME ¤È¤¤¤¦Ì¾Á°¤Î¥·¥ó¥Ü¥ë·Ðͳ¤Ç¥¢¥¯¥»¥¹¤Ç¤­¤ë¤è¤¦¤Ë¤¹¤ë¡£ $PLIST 
+    ¤Ç¤ÏÄêµÁ¤¹¤ë¥³¡¼¥É·Ï¤Î¥Ñ¥é¥á¡¼¥¿¤ò°Ê²¼¤Î¤è¤¦¤Ë»ØÄꤹ¤ë¡£
+
+    <ul>
+
+    <li> ¥­¡¼¤¬ @c Mtype ¤ÇÃͤ¬¥·¥ó¥Ü¥ë¤Î»þ
+
+    Ãͤϥ³¡¼¥É·Ï¤Î¥¿¥¤¥×¤òɽ¤·¡¢@b Mcharset, @b Mutf, @b Miso_2022, #Mnil 
+    ¤Î¤¤¤º¤ì¤«¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
+
+    ¥¿¥¤¥×¤¬ @b Mcharset ¤Ê¤é¤Ð $EXTRA_INFO ¤Ï̵»ë¤µ¤ì¤ë¡£
+
+    ¥¿¥¤¥×¤¬ @b Mutf ¤Ê¤é¤Ð $EXTRA_INFO ¤Ï #MCodingInfoUTF 
+    ¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
+
+    ¥¿¥¤¥×¤¬ @b Miso_2022¤Ê¤é¤Ð $EXTRA_INFO ¤Ï #MCodingInfoISO2022 
+    ¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
+
+    ¥¿¥¤¥×¤¬ #Mnil ¤Ê¤é¤Ð¡¢°ú¿ô $RESETTER, $DECODER, $ENCODER 
+    ¤òÍ¿¤¨¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£$EXTRA_INFO ¤Ï̵»ë¤µ¤ì¤ë¡£
+    ¤½¤ì°Ê³°¤Î¾ì¹ç¤Ë¤Ï¤³¤ì¤é¤Ï @c NULL ¤Ç¤è¤¯¡¢
+    m17n ¥é¥¤¥Ö¥é¥ê¤¬Å¬Àڤʥǥե©¥ë¥ÈÃͤòÍ¿¤¨¤ë¡£
+
+    <li> ¥­¡¼¤¬ @b Mcharsets ¤ÇÃͤ¬ plist ¤Î»þ
+
+    ÃͤϤ³¤Î¥³¡¼¥É·Ï¤Ç¥µ¥Ý¡¼¥È¤µ¤ì¤ëʸ»ú¥»¥Ã¥È¤Î¥ê¥¹¥È¤Ç¤¢¤ë¡£plist¤Î¥­¡¼¤Ï
+    #Msymbol¡¢ÃͤÏʸ»ú¥»¥Ã¥È¤ò¼¨¤¹¥·¥ó¥Ü¥ë¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
+
+    <li> ¥­¡¼¤¬ @b Mflags Ãͤ¬ plist ¤Î»þ
+
+    ¥¿¥¤¥×¤¬ @b Miso_2022 ¤Ê¤é¤Ð¡¢¤³¤ÎÃͤÏ, ISO 2022 
+    ¥¤¥ó¥¿¥×¥ê¥¿ÍѤÎÀ©¸æ¥Õ¥é¥Ã¥°¤ò¼¨¤¹¡£plist ¤Î¥­¡¼¤Ï #Msymbol 
+    ¤Ç¤¢¤ê¡¢Ãͤϰʲ¼¤Î¤¤¤º¤ì¤«¤Ç¤¢¤ë¡£
+
+    <ul>
+
+    <li> @b Mreset_at_eol
+
+    ¤³¤Î¥Õ¥é¥°¤¬¤¢¤ì¤Ð¡¢¿Þ·Áʸ»ú½¸¹ç¤Î»Ø¼¨¤ä¸Æ½Ð¤Ï¹ÔËö¤Ç¥ê¥»¥Ã¥È¤µ¤ì¤ÆÅö½é¤Î¾õÂÖ¤ËÌá¤ë¡£
+
+    <li> @b Mreset_at_cntl
+
+    ¤³¤Î¥Õ¥é¥°¤¬¤¢¤ì¤Ð¡¢¿Þ·Áʸ»ú½¸¹ç¤Î»Ø¼¨¤ä¸Æ½Ð¤ÏÀ©¸æʸ»ú¤Ë½Ð²ñ¤Ã¤¿»þÅÀ¤Ç¥ê¥»¥Ã¥È¤µ¤ì¤ÆÅö½é¤Î¾õÂÖ¤ËÌá¤ë¡£
+
+    <li> @b Meight_bit
 
 
-    $TYPE ¤Ï Îóµó·¿ #MCodingType ¤Î¤¤¤º¤ì¤«¤Ç¤¢¤ê¡¢¥³¡¼¥É·Ï¤Î¹½Â¤¤ò
-    »ØÄꤹ¤ë¡£
+    ¤³¤Î¥Õ¥é¥°¤¬¤¢¤ì¤Ð¡¢¿Þ·Áʸ»ú½¸¹ç¤Î±¦È¾Ì̤¬ÍѤ¤¤é¤ì¤ë¡£
 
 
-    $CHARSET_NAMES ¤Ï¥µ¥Ý¡¼¥È¤¹¤ëʸ»ú¥»¥Ã¥È¤òɽ¤ï¤¹¥·¥ó¥Ü¥ë¤ÎÇÛÎó¤Ç¤¢¤ê¡¢
-    $NCHARSETS ¤Ï¤½¤ÎÍ×ÁÇ¿ô¤Ç¤¢¤ë¡£
+    <li> @b Mlong_form
 
 
-    $TYPE ¤¬ #MCODING_TYPE_MISC ¤Ç¤¢¤ë¾ì¹ç¤Ë¤Ï¡¢$RESETTER, $DECODER,
-    $ENCODER ¤òÍ¿¤¨¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£¤½¤ì°Ê³°¤Î¾ì¹ç¤Ë¤Ï¤³¤ì¤é¤Ï @c
-    NULL ¤Ç¹½¤ï¤Ê¤¤¡£¤½¤ÎºÝ¤Ë¤Ï m17n ¥é¥¤¥Ö¥é¥ê¤¬Å¬Àڤʥǥե©¥ë¥ÈÃͤò
-    Í¿¤¨¤ë¡£
+    ¤³¤Î¥Õ¥é¥°¤¬¤¢¤ì¤Ð¡¢Ê¸»ú½¸¹ç JISX0208.1978, GB2312, JISX0208 
+    ¤ò»Ø¼¨¤¹¤ëºÝ¤Ë over-long ¥¨¥¹¥±¡¼¥×¥·¡¼¥±¥ó¥¹ (ESC '$' '('
+    \<final_byte\>) ¤¬ÍѤ¤¤é¤ì¤ë¡£
 
 
-    $RESETTER ¤Ï¤³¤Î¥³¡¼¥É·ÏÍѤΥ³¥ó¥Ð¡¼¥¿¤ò½é´ü¾õÂ֤˥ꥻ¥Ã¥È¤¹¤ë´Ø¿ô
-    ¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¡£¤³¤Î´Ø¿ô¤Ï¥³¥ó¥Ð¡¼¥¿¥ª¥Ö¥¸¥§¥¯¥È¤Ø¤Î¥Ý¥¤¥ó¥¿¤È
-    ¤¤¤¦£±°ú¿ô¤ò¤È¤ë¡£
+    <li> @b Mdesignation_g0
 
 
-    $DECODER ¤Ï¥Ð¥¤¥ÈÎó¤ò¤³¤Î¥³¡¼¥É·Ï¤Ë½¾¤Ã¤Æ¥Ç¥³¡¼¥É¤¹¤ë´Ø¿ô¤Ø¤Î¥Ý¥¤
-    ¥ó¥¿¤Ç¤¢¤ë¡£¤³¤Î´Ø¿ô¤Ï°Ê²¼¤Î4°ú¿ô¤ò¤È¤ë¡£
+    ¤³¤Î¥Õ¥é¥°¤È @b Mfull_support ¤¬¤¢¤ì¤Ð¡¢Ê¸»ú¥»¥Ã¥È¥ê¥¹¥È¤Ë¸½¤ï¤ì¤Ê¤¤Ê¸»ú¥»¥Ã¥È¤ò
+    G0 ½¸¹ç¤Ë»Ø¼¨¤¹¤ë¡£
 
 
-       @li ¥Ð¥¤¥ÈÎó¤Ø¤Î¥Ý¥¤¥ó¥¿
+    <li> @b Mdesignation_g1
+
+    ¤³¤Î¥Õ¥é¥°¤È @b Mfull_support ¤¬¤¢¤ì¤Ð¡¢Ê¸»ú¥»¥Ã¥È¥ê¥¹¥È¤Ë¸½¤ï¤ì¤Ê¤¤Ê¸»ú¥»¥Ã¥È¤ò
+    G1 ½¸¹ç¤Ë»Ø¼¨¤¹¤ë¡£
+
+    <li> @b Mdesignation_ctext
+
+    ¤³¤Î¥Õ¥é¥°¤È @b Mfull_support ¤¬¤¢¤ì¤Ð¡¢Ê¸»ú¥»¥Ã¥È¥ê¥¹¥È¤Ë¸½¤ï¤ì¤Ê¤¤Ê¸»ú¥»¥Ã¥È¤ò
+    G0 ½¸¹ç¤Þ¤¿¤Ï G1 ½¸¹ç¤Ë¡¢¥³¥ó¥Ñ¥¦¥ó¥É¥Æ¥­¥¹¥È¤Î´ð½à¤Ë¤½¤Ã¤Æ»Ø¼¨¤¹¤ë¡£
+
+    <li> @b Mdesignation_ctext_ext
+
+    ¤³¤Î¥Õ¥é¥°¤È @b Mfull_support ¤¬¤¢¤ì¤Ð¡¢Ê¸»ú¥»¥Ã¥È¥ê¥¹¥È¤Ë¸½¤ï¤ì¤Ê¤¤Ê¸»ú¥»¥Ã¥È¤ò
+    G0 ½¸¹ç¤Þ¤¿¤Ï G1 ½¸¹ç¤Ë¡¢¤¢¤ë¤¤¤Ï³ÈÄ¥¥»¥°¥á¥ó¥È¤Ë¥³¥ó¥Ñ¥¦¥ó¥É¥Æ¥­¥¹¥È¤Î´ð½à¤Ë¤½¤Ã¤Æ»Ø¼¨¤¹¤ë¡£
+
+    <li> @b Mlocking_shift
+
+    ¤³¤Î¥Õ¥é¥°¤¬¤¢¤ì¤Ð¡¢¥í¥Ã¥­¥ó¥°¥·¥Õ¥È¤òÍѤ¤¤ë¡£
+
+    <li> @b Msingle_shift
+
+    ¤³¤Î¥Õ¥é¥°¤¬¤¢¤ì¤Ð¡¢¥·¥ó¥°¥ë¥·¥Õ¥È¤òÍѤ¤¤ë¡£
+
+    <li> @b Msingle_shift_7
+
+    ¤³¤Î¥Õ¥é¥°¤¬¤¢¤ì¤Ð¡¢7-bit ¥·¥ó¥°¥ë¥·¥Õ¥È¥³¡¼¥É (0x19) ¤òÍѤ¤¤ë¡£   
+    
+    <li> @b Meuc_tw_shift
+
+    ¤³¤Î¥Õ¥é¥°¤¬¤¢¤ì¤Ð¡¢EUC-TW ¤Ë±è¤Ã¤¿ÆÃÊ̤ʥ·¥Õ¥È¤òÍѤ¤¤ë¡£
+
+    <li> @b Miso_6429
+
+    ¸½»þÅÀ¤Ç¤ÏÍѤ¤¤é¤ì¤Æ¤¤¤Ê¤¤¡£
+
+    <li> @b Mrevision_number
+
+    ¤³¤Î¥Õ¥é¥°¤¬¤¢¤ì¤Ð¡¢revision number ¤ò»ý¤Äʸ»ú¥»¥Ã¥È¤ò»Ø¼¨¤¹¤ëºÝ¤Ë 
+    revision number ¥¨¥¹¥±¡¼¥×¥·¡¼¥¯¥¨¥ó¥¹¤òÍѤ¤¤ë¡£
+
+    <li> @b Mfull_support
+
+    ¤³¤Î¥Õ¥é¥°¤¬¤¢¤ì¤Ð¡¢the International Registry 
+    ¤ËÅÐÏ¿¤µ¤ì¤Æ¤¤¤ëÁ´Ê¸»ú¥»¥Ã¥È¤ò¥µ¥Ý¡¼¥È¤¹¤ë¡£
+
+    </ul>
+
+    <li> ¥­¡¼¤¬ @b Mdesignation ¤ÇÃͤ¬ plist ¤Î»þ
+
+    ¥¿¥¤¥×¤¬ @b Miso_2022 ¤Ê¤é¤Ð¡¢ÃͤϳÆʸ»ú¤ò¤É¤Î¤è¤¦¤Ë»Ø¼¨¤¹¤ë¤«¤ò¼¨¤¹¡£
+    plist ¤Î¥­¡¼¤Ï #Minteger¡¢ÃͤϽ¸¹ç¡Êgraphic register¡Ë
+    ¤ò¼¨¤¹¿ô»ú¤Ç¤¢¤ë¡£NÈÖÌܤÎÍ×ÁǤÎÃͤϡ¢Ê¸»ú¥»¥Ã¥È¥ê¥¹¥È¤Î N 
+    ÈÖÌܤÎʸ»ú¥»¥Ã¥È¤ËÂбþ¤¹¤ë¡£Ãͤ¬ 0..3 ¤Ç¤¢¤ì¤Ð¡¢Ê¸»ú¥»¥Ã¥È¤¬¤¹¤Ç¤Ë 
+    G0..G3 ¤Ë»Ø¼¨ ¤µ¤ì¤Æ¤¤¤ë¡£
+
+    Ãͤ¬Éé(-4..-1) ¤Ç¤¢¤ì¤Ð¡¢½é´ü¾õÂ֤ǤÏʸ»ú¥»¥Ã¥È¤¬¤É¤³¤Ë¤â»Ø¼¨¤µ¤ì¤Æ¤¤¤Ê¤¤¤³¤È¡¢É¬ÍפʺݤˤÏ
+    G0..G3 ¤Î¤½¤ì¤¾¤ì¤Ë»Ø¼¨¤¹¤ë¤³¤È¤ò°ÕÌ£¤¹¤ë¡£
+
+    <li> ¥­¡¼¤¬ @b Minvocation ¤ÇÃͤ¬ plist ¤Î»þ
+
+    ¥¿¥¤¥×¤¬ @b Miso_2022 ¤Ê¤é¤Ð¡¢Ãͤϳƽ¸¹ç¤ò¤É¤Î¤è¤¦¤Ë¸Æ¤Ó½Ð¤¹¤«¤ò¼¨¤¹¡£
+    plist ¤ÎŤµ¤Ï 1 ¤Ê¤¤¤· 2 ¤Ç¤¢¤ë¡£plist ¤Î¥­¡¼¤Ï 
+    #Minteger¡¢ÃͤϽ¸¹ç¡Êgraphic register)¤ò¼¨¤¹¿ô»ú¤Ç¤¢¤ë¡£
+    ºÇ½é¤ÎÍ×ÁǤÎÃͤ¬¿Þ·Áʸ»ú½¸¹çº¸È¾Ì̤˸ƤӽФµ¤ì¤ë½¸¹ç¤ò¼¨¤¹¡£
+    plist ¤ÎŤµ¤¬ 1 ¤Ê¤é¤Ð¡¢±¦È¾Ì̤ˤϲ¿¤â¸Æ¤Ó½Ð¤µ¤ì¤Ê¤¤¡£
+    ¤½¤¦¤Ç¤±¤ì¤Ð¡¢£²¤Ä¤á¤ÎÍ×ÁǤÎÃͤ¬¿Þ·Áʸ»ú½¸¹ç±¦È¾Ì̤˸ƤӽФµ¤ì¤ë½¸¹ç¤ò¼¨¤¹¡£
+
+    <li> ¥­¡¼¤¬ @b Mcode_unit ¤ÇÃͤ¬À°¿ôÃͤλþ
+
+    ¥¿¥¤¥×¤¬ @b Mutf ¤Ê¤é¤Ð¡¢Ãͤϥ³¡¼¥É¥æ¥Ë¥Ã¥È¤Î¥Ó¥Ã¥ÈŤǤ¢¤ê¡¢8, 16,
+    32 ¤Î¤¤¤º¤ì¤«¤Ç¤¢¤ë¡£
+
+    <li> ¥­¡¼¤¬ @b Mbom ¤ÇÃͤ¬¥·¥ó¥Ü¥ë¤Î»þ
+
+    ¥¿¥¤¥×¤¬ @b Mutf ¤Ç¥³¡¼¥É¥æ¥Ë¥Ã¥È¤Î¥Ó¥Ã¥ÈŤ¬ 16 ¤« 32¤Ê¤é¤Ð¡¢ÃͤÏ
+    BOM (Byte Order Mark) ¤ò»ÈÍѤ¹¤ë¤«¤É¤¦¤«¤ò¼¨¤¹¡£Ãͤ¬¥Ç¥Õ¥©¥ë¥ÈÃͤΠ
+    #Mnil ¤Ê¤é¤Ð¡¢»ÈÍѤ·¤Ê¤¤¡£Ãͤ¬ #Mmaybe ¤Ê¤é¤Ð¥Ç¥³¡¼¥É»þ¤Ë BOM 
+    ¤¬¤¢¤ë¤«¤É¤¦¤«¤òÄ´¤Ù¤ë¡£¤½¤ì°Ê³°¤Ê¤é¤Ð»ÈÍѤ¹¤ë¡£
+
+    <li> ¥­¡¼¤¬ @b Mlittle_endian ¤ÇÃͤ¬¥·¥ó¥Ü¥ë¤Î»þ 
+
+    ¥¿¥¤¥×¤¬ @b Mutf ¤Ç¥³¡¼¥É¥æ¥Ë¥Ã¥È¤Î¥Ó¥Ã¥ÈŤ¬ 16 ¤« 32
+    ¤Ê¤é¤Ð¡¢Ãͤϥ¨¥ó¥³¡¼¥É¤¬ little endian ¤«¤É¤¦¤«¤ò¼¨¤¹¡£Ãͤ¬¥Ç¥Õ¥©¥ë¥ÈÃͤÎ
+    #Mnil ¤Ê¤é¤Ð big endian ¤Ç¤¢¤ê¡¢¤½¤¦¤Ç¤Ê¤±¤ì¤Ð little endian ¤Ç¤¢¤ë¡£
+
+    </ul>
+
+    $RESETTER 
+    ¤Ï¤³¤Î¥³¡¼¥É·ÏÍѤΥ³¥ó¥Ð¡¼¥¿¤ò½é´ü¾õÂ֤˥ꥻ¥Ã¥È¤¹¤ë´Ø¿ô¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¡£
+    ¤³¤Î´Ø¿ô¤Ï¥³¥ó¥Ð¡¼¥¿¥ª¥Ö¥¸¥§¥¯¥È¤Ø¤Î¥Ý¥¤¥ó¥¿¤È¤¤¤¦£±°ú¿ô¤ò¤È¤ë¡£
+
+    $DECODER ¤Ï¥Ð¥¤¥ÈÎó¤ò¤³¤Î¥³¡¼¥É·Ï¤Ë½¾¤Ã¤Æ¥Ç¥³¡¼¥É¤¹¤ë´Ø¿ô¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¡£
+    ¤³¤Î´Ø¿ô¤Ï°Ê²¼¤Î£´°ú¿ô¤ò¤È¤ë¡£
+
+       @li ¥Ç¥³¡¼¥É¤¹¤ë¥Ð¥¤¥ÈÎó¤Ø¤Î¥Ý¥¤¥ó¥¿
        @li ¥Ç¥³¡¼¥É¤¹¤Ù¤­¥Ð¥¤¥È¿ô
        @li ¥Ç¥³¡¼¥É·ë²Ì¤Îʸ»ú¤òÉղ乤ë M-text ¤Ø¤Î¥Ý¥¤¥ó¥¿
        @li ¥³¥ó¥Ð¡¼¥¿¥ª¥Ö¥¸¥§¥¯¥È¤Ø¤Î¥Ý¥¤¥ó¥¿
 
        @li ¥Ç¥³¡¼¥É¤¹¤Ù¤­¥Ð¥¤¥È¿ô
        @li ¥Ç¥³¡¼¥É·ë²Ì¤Îʸ»ú¤òÉղ乤ë M-text ¤Ø¤Î¥Ý¥¤¥ó¥¿
        @li ¥³¥ó¥Ð¡¼¥¿¥ª¥Ö¥¸¥§¥¯¥È¤Ø¤Î¥Ý¥¤¥ó¥¿
 
-    $DECODER ¤ÏÀ®¸ù¤·¤¿¤È¤­¤Ë¤Ï0¤ò¡¢¼ºÇÔ¤·¤¿¤È¤­¤Ë¤Ï-1¤òÊÖ¤µ¤Ê¤¯¤Æ¤Ï¤Ê
-    ¤é¤Ê¤¤¡£
+    $DECODER ¤ÏÀ®¸ù¤·¤¿¤È¤­¤Ë¤Ï 0 ¤ò¡¢¼ºÇÔ¤·¤¿¤È¤­¤Ë¤Ï -1 
+    ¤òÊÖ¤µ¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
 
 
-    $ENCODER ¤Ï M-text ¤ò¤³¤Î¥³¡¼¥É·Ï¤Ë½¾¤Ã¤Æ¥¨¥ó¥³¡¼¥É¤¹
-    ¤ë´Ø¿ô¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¡£¤³¤Î´Ø¿ô¤Ï°Ê²¼¤Î6°ú¿ô¤ò¤È¤ë¡£
+    $ENCODER ¤Ï M-text ¤ò¤³¤Î¥³¡¼¥É·Ï¤Ë½¾¤Ã¤Æ¥¨¥ó¥³¡¼¥É¤¹¤ë´Ø¿ô¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¡£
+    ¤³¤Î´Ø¿ô¤Ï°Ê²¼¤Î£¶°ú¿ô¤ò¤È¤ë¡£
 
 
-        @li M-text ¤Ø¤Î¥Ý¥¤¥ó¥¿
+        @li ¥¨¥ó¥³¡¼¥É¤¹¤ëM-text ¤Ø¤Î¥Ý¥¤¥ó¥¿
         @li M-text ¤Î¥¨¥ó¥³¡¼¥É³«»Ï°ÌÃÖ
         @li M-text ¤Î¥¨¥ó¥³¡¼¥É½ªÎ»°ÌÃÖ
         @li À¸À®¤·¤¿¥Ð¥¤¥È¤òÊÝ»ý¤¹¤ë¥á¥â¥êÎΰè¤Ø¤Î¥Ý¥¤¥ó¥¿
         @li ¥á¥â¥êÎΰè¤Î¥µ¥¤¥º
        @li ¥³¥ó¥Ð¡¼¥¿¥ª¥Ö¥¸¥§¥¯¥È¤Ø¤Î¥Ý¥¤¥ó¥¿
 
         @li M-text ¤Î¥¨¥ó¥³¡¼¥É³«»Ï°ÌÃÖ
         @li M-text ¤Î¥¨¥ó¥³¡¼¥É½ªÎ»°ÌÃÖ
         @li À¸À®¤·¤¿¥Ð¥¤¥È¤òÊÝ»ý¤¹¤ë¥á¥â¥êÎΰè¤Ø¤Î¥Ý¥¤¥ó¥¿
         @li ¥á¥â¥êÎΰè¤Î¥µ¥¤¥º
        @li ¥³¥ó¥Ð¡¼¥¿¥ª¥Ö¥¸¥§¥¯¥È¤Ø¤Î¥Ý¥¤¥ó¥¿
 
-    $ENCODER ¤ÏÀ®¸ù¤·¤¿¤È¤­¤Ë¤Ï0¤ò¡¢¼ºÇÔ¤·¤¿¤È¤­¤Ë¤Ï-1¤òÊÖ¤µ¤Ê¤¯¤Æ¤Ï¤Ê
-    ¤é¤Ê¤¤¡£
-
-    $EXTRA_INFO ¤Ï¥³¡¼¥Ç¥£¥°¥·¥¹¥Æ¥à¤Ë´Ø¤¹¤ëÄɲþðÊó¤ò´Þ¤à¥Ç¡¼¥¿¹½Â¤¤Ø
-    ¤Î¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¡£¤³¤Î¥Ç¡¼¥¿¹½Â¤¤Î¥¿¥¤¥×¤Ï $TYPE ¤Ë°Í¸¤¹¤ë¡£
+    $ENCODER ¤ÏÀ®¸ù¤·¤¿¤È¤­¤Ë¤Ï 0 ¤ò¡¢¼ºÇÔ¤·¤¿¤È¤­¤Ë¤Ï -1 
+    ¤òÊÖ¤µ¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
 
 
-    $TYPE ¤¬ #MCODING_TYPE_ISO_2022 ¤Ç¤¢¤ì¤Ð¡¢$EXTRA_INFO ¤Ï @c
-    MCodingInfoISO2022 ¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
-
-    $TYPE ¤¬ #MCODING_TYPE_UTF ¤Ç¤¢¤ì¤Ð¡¢$EXTRA_INFO ¤Ï @c
-    MCodingInfoUTF ¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
-
-    $TYPE ¤¬ #MCODING_TYPE_CHARSET, #MCODING_TYPE_MISC ¤Î¤É¤ì¤«¤Ç
-    ¤¢¤ì¤Ð¡¢$EXTRA_INFO ¤Ï̵»ë¤µ¤ì¤ë¡£
+    $EXTRA_INFO ¤Ï¥³¡¼¥Ç¥£¥°¥·¥¹¥Æ¥à¤Ë´Ø¤¹¤ëÄɲþðÊó¤ò´Þ¤à¥Ç¡¼¥¿¹½Â¤¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¡£
+    ¤³¤Î¥Ç¡¼¥¿¹½Â¤¤Î·¿ $TYPE ¤Ë°Í¸¤¹¤ë¡£
 
     @return  
 
 
     @return  
 
-    ½èÍý¤ËÀ®¸ù¤¹¤ì¤Ð mconv_define_coding () ¤Ï $NAME ¤È¤¤¤¦Ì¾Á°¤Î¥·
-    ¥ó¥Ü¥ë¤òÊÖ¤¹¡£¤³¤Î¥·¥ó¥Ü¥ë¤Ï¡¢¥­¡¼¤¬ $Mcoding ¤Ç¡¢ºî¤é¤ì¤¿¥³¡¼¥É·Ï
-    ¤Ø¤Î¥Ý¥¤¥ó¥¿¤òÃͤȤ¹¤ë¥·¥ó¥Ü¥ë¥×¥í¥Ñ¥Æ¥£¤ò»ý¤Ä¡£ ¥¨¥é¡¼¤¬¸¡½Ð¤µ¤ì
-    ¤¿¾ì¹ç¤Ï Mnil ¤òÊÖ¤·¡¢³°ÉôÊÑ¿ô #merror_code ¤Ë¥¨¥é¡¼¥³¡¼¥É¤òÀßÄꤹ¤ë¡£
+    ½èÍý¤ËÀ®¸ù¤¹¤ì¤Ð mconv_define_coding () ¤Ï $NAME 
+    ¤È¤¤¤¦Ì¾Á°¤Î¥·¥ó¥Ü¥ë¤òÊÖ¤¹¡£ ¥¨¥é¡¼¤¬¸¡½Ð¤µ¤ì¤¿¾ì¹ç¤Ï #Mnil
+    ¤òÊÖ¤·¡¢³°ÉôÊÑ¿ô #merror_code ¤Ë¥¨¥é¡¼¥³¡¼¥É¤òÀßÄꤹ¤ë¡£
       */
 
 /***
       */
 
 /***
@@ -3599,9 +3785,9 @@ MSymbol Mcoding;
     @c MERROR_CODING  */
 
 MSymbol
     @c MERROR_CODING  */
 
 MSymbol
-mconv_define_coding (char *name, MPlist *plist,
+mconv_define_coding (const char *name, MPlist *plist,
                     int (*resetter) (MConverter *),
                     int (*resetter) (MConverter *),
-                    int (*decoder) (unsigned char *, int, MText *,
+                    int (*decoder) (const unsigned char *, int, MText *,
                                     MConverter *),
                     int (*encoder) (MText *, int, int,
                                     unsigned char *, int,
                                     MConverter *),
                     int (*encoder) (MText *, int, int,
                                     unsigned char *, int,
@@ -3807,7 +3993,15 @@ mconv_define_coding (char *name, MPlist *plist,
     The mconv_resolve_coding () function returns $SYMBOL if it
     represents a coding system.  Otherwise, canonicalize $SYMBOL as to
     a coding system name, and if the canonicalized name represents a
     The mconv_resolve_coding () function returns $SYMBOL if it
     represents a coding system.  Otherwise, canonicalize $SYMBOL as to
     a coding system name, and if the canonicalized name represents a
-    coding system, return it.  Otherwise, return Mnil.  */
+    coding system, return it.  Otherwise, return #Mnil.  */
+/***ja
+    @brief ¥³¡¼¥É·Ï¤Î̾Á°¤ò²ò·è¤¹¤ë.
+
+    ´Ø¿ô mconv_resolve_coding () ¤Ï $SYMBOL ¤¬¥³¡¼¥É·Ï¤ò¼¨¤·¤Æ¤¤¤ì¤Ð¤½¤ì¤òÊÖ¤¹¡£
+    ¤½¤¦¤Ç¤Ê¤±¤ì¤Ð¥³¡¼¥É·Ï¤Î̾Á°¤È¤·¤Æ $SYMBOL 
+    ¤òÀµµ¬²½¤·¡¢¤½¤ì¤¬¥³¡¼¥É·Ï¤òɽ¤·¤Æ¤¤¤ì¤ÐÀµµ¬²½¤·¤¿ $SYMBOL ¤òÊÖ¤¹¡£
+    ¤½¤¦¤Ç¤Ê¤±¤ì¤Ð#Mnil ¤òÊÖ¤¹¡£  */
+
 
 
 MSymbol
 
 
 MSymbol
@@ -3827,11 +4021,16 @@ mconv_resolve_coding (MSymbol symbol)
 
 
 /***en
 
 
 /***en
-    @brief List symbols representing a coding system.
+    @brief List symbols representing coding systems.
 
     The mconv_list_codings () function makes an array of symbols
     representing a coding system, stores the pointer to the array in a
     place pointed to by $SYMBOLS, and returns the length of the array.  */
 
     The mconv_list_codings () function makes an array of symbols
     representing a coding system, stores the pointer to the array in a
     place pointed to by $SYMBOLS, and returns the length of the array.  */
+/***ja
+    @brief ¥³¡¼¥É·Ï¤òɽ¤ï¤¹¥·¥ó¥Ü¥ë¤òÎóµó¤¹¤ë.
+
+    ´Ø¿ô mchar_list_codings () ¤Ï¡¢¥³¡¼¥É·Ï¤ò¼¨¤¹¥·¥ó¥Ü¥ë¤òʤ٤¿ÇÛÎó¤òºî¤ê¡¢
+    $SYMBOLS ¤Ç¥Ý¥¤¥ó¥È¤µ¤ì¤¿¾ì½ê¤Ë¤³¤ÎÇÛÎó¤Ø¤Î¥Ý¥¤¥ó¥¿¤òÃÖ¤­¡¢ÇÛÎó¤ÎŤµ¤òÊÖ¤¹¡£ */
 
 int
 mconv_list_codings (MSymbol **symbols)
 
 int
 mconv_list_codings (MSymbol **symbols)
@@ -3843,7 +4042,10 @@ mconv_list_codings (MSymbol **symbols)
   MTABLE_MALLOC ((*symbols), i, MERROR_CODING);
   i = 0;
   MPLIST_DO (plist, coding_definition_list)
   MTABLE_MALLOC ((*symbols), i, MERROR_CODING);
   i = 0;
   MPLIST_DO (plist, coding_definition_list)
-    (*symbols)[i++] = MPLIST_KEY (plist);
+    {
+      MPlist *pl = MPLIST_VAL (plist);
+      (*symbols)[i++] = MPLIST_SYMBOL (pl);
+    }
   for (j = 0; j < coding_list.used; j++)
     if (! mplist_find_by_key (coding_definition_list, 
                              coding_list.codings[j]->name))
   for (j = 0; j < coding_list.used; j++)
     if (! mplist_find_by_key (coding_definition_list, 
                              coding_list.codings[j]->name))
@@ -3857,11 +4059,11 @@ mconv_list_codings (MSymbol **symbols)
     @brief Create a code converter bound to a buffer.
 
     The mconv_buffer_converter () function creates a pointer to a code
     @brief Create a code converter bound to a buffer.
 
     The mconv_buffer_converter () function creates a pointer to a code
-    converter for coding system $CODING.  The code converter is bound
+    converter for coding system $NAME.  The code converter is bound
     to buffer area of $N bytes pointed to by $BUF.  Subsequent
     decodings and encodings are done to/from this buffer area.
 
     to buffer area of $N bytes pointed to by $BUF.  Subsequent
     decodings and encodings are done to/from this buffer area.
 
-    $CODING can be #Mnil.  In this case, a coding system associated
+    $NAME can be #Mnil.  In this case, a coding system associated
     with the current locale (LC_CTYPE) is used.
 
     @return
     with the current locale (LC_CTYPE) is used.
 
     @return
@@ -3869,20 +4071,20 @@ mconv_list_codings (MSymbol **symbols)
     the created code converter.  Otherwise it returns @c NULL and
     assigns an error code to the external variable #merror_code.  */
 
     the created code converter.  Otherwise it returns @c NULL and
     assigns an error code to the external variable #merror_code.  */
 
-/***oldja
-    @brief ¥Ð¥Ã¥Õ¥¡¤Ë·ë¤ÓÉÕ¤±¤é¤ì¤¿¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤òºî¤ë
+/***ja
+    @brief ¥Ð¥Ã¥Õ¥¡¤Ë·ë¤ÓÉÕ¤±¤é¤ì¤¿¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤òºî¤ë.
 
 
-    ´Ø¿ô mconv_buffer_converter () ¤Ï¡¢¥³¡¼¥É·Ï $CODING ÍѤΥ³¡¼¥É¥³¥ó
-    ¥Ð¡¼¥¿¤òºî¤ë¡£¤³¤Î¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤Ï¡¢$BUF ¤Ç¼¨¤µ¤ì¤ëÂ礭¤µ $N ¥Ð
-    ¥¤¥È¤Î¥Ð¥Ã¥Õ¥¡Îΰè¤Ë·ë¤ÓÉÕ¤±¤é¤ì¤ë¡£¤³¤ì°Ê¹ß¤Î¥Ç¥³¡¼¥É¤ª¤è¤Ó
-    ¥¨¥ó¥³¡¼¥É¤Ï¡¢¤³¤Î¥Ð¥Ã¥Õ¥¡Îΰè¤ËÂФ·¤Æ¹Ô¤Ê¤ï¤ì¤ë¡£
+    ´Ø¿ô mconv_buffer_converter () ¤Ï¡¢¥³¡¼¥É·Ï $NAME 
+    ÍѤΥ³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤òºî¤ë¡£¤³¤Î¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤Ï¡¢$BUF ¤Ç¼¨¤µ¤ì¤ëÂ礭¤µ $N 
+    ¥Ð¥¤¥È¤Î¥Ð¥Ã¥Õ¥¡Îΰè¤Ë·ë¤ÓÉÕ¤±¤é¤ì¤ë¡£
+    ¤³¤ì°Ê¹ß¤Î¥Ç¥³¡¼¥É¤ª¤è¤Ó¥¨¥ó¥³¡¼¥É¤Ï¡¢¤³¤Î¥Ð¥Ã¥Õ¥¡Îΰè¤ËÂФ·¤Æ¹Ô¤Ê¤ï¤ì¤ë¡£
 
 
-    $CODING ¤Ï #Mnil ¤Ç¤¢¤Ã¤Æ¤â¤è¤¤¡£¤³¤Î¾ì¹ç¤Ï¸½ºß¤Î¥í¥±¡¼¥ë 
+    $NAME ¤Ï #Mnil ¤Ç¤¢¤Ã¤Æ¤â¤è¤¤¡£¤³¤Î¾ì¹ç¤Ï¸½ºß¤Î¥í¥±¡¼¥ë 
     (LC_CTYPE) ¤Ë´ØÏ¢ÉÕ¤±¤é¤ì¤¿¥³¡¼¥É·Ï¤¬»È¤ï¤ì¤ë¡£
 
     @return
     (LC_CTYPE) ¤Ë´ØÏ¢ÉÕ¤±¤é¤ì¤¿¥³¡¼¥É·Ï¤¬»È¤ï¤ì¤ë¡£
 
     @return
-    ¤â¤·½èÍý¤¬À®¸ù¤¹¤ì¤Ð mconv_buffer_converter () ¤Ï ºî¤é¤ì¤¿¥³¡¼¥É¥³
-    ¥ó¥Ð¡¼¥¿¤òÊÖ¤¹¡£¤½¤¦¤Ç¤Ê¤±¤ì¤Ð @c NULL ¤òÊÖ¤·¡¢³°ÉôÊÑ¿ô #merror_code 
+    ¤â¤·½èÍý¤¬À®¸ù¤¹¤ì¤Ð mconv_buffer_converter () ¤Ï ºîÀ®¤·¤¿¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤òÊÖ¤¹¡£
+    ¤½¤¦¤Ç¤Ê¤±¤ì¤Ð @c NULL ¤òÊÖ¤·¡¢³°ÉôÊÑ¿ô #merror_code 
     ¤Ë¥¨¥é¡¼¥³¡¼¥É¤òÀßÄꤹ¤ë¡£
 
     @latexonly \IPAlabel{mconverter} @endlatexonly  */
     ¤Ë¥¨¥é¡¼¥³¡¼¥É¤òÀßÄꤹ¤ë¡£
 
     @latexonly \IPAlabel{mconverter} @endlatexonly  */
@@ -3895,7 +4097,7 @@ mconv_list_codings (MSymbol **symbols)
     mconv_stream_converter ()  */
 
 MConverter *
     mconv_stream_converter ()  */
 
 MConverter *
-mconv_buffer_converter (MSymbol name, unsigned char *buf, int n)
+mconv_buffer_converter (MSymbol name, const unsigned char *buf, int n)
 {
   MCodingSystem *coding;
   MConverter *converter;
 {
   MCodingSystem *coding;
   MConverter *converter;
@@ -3921,7 +4123,7 @@ mconv_buffer_converter (MSymbol name, unsigned char *buf, int n)
   internal->unread = mtext ();
   internal->work_mt = mtext ();
   mtext__enlarge (internal->work_mt, MAX_UTF8_CHAR_BYTES);
   internal->unread = mtext ();
   internal->work_mt = mtext ();
   mtext__enlarge (internal->work_mt, MAX_UTF8_CHAR_BYTES);
-  internal->buf = buf;
+  internal->buf.in = buf;
   internal->used = 0;
   internal->bufsize = n;
   internal->binding = BINDING_BUFFER;
   internal->used = 0;
   internal->bufsize = n;
   internal->binding = BINDING_BUFFER;
@@ -3934,34 +4136,35 @@ mconv_buffer_converter (MSymbol name, unsigned char *buf, int n)
 /***en
     @brief Create a code converter bound to a stream.
 
 /***en
     @brief Create a code converter bound to a stream.
 
-    The mconv_stream_converter () function create a pointer to a code
-    converter for coding system $CODING.  The code converter is bound
+    The mconv_stream_converter () function creates a pointer to a code
+    converter for coding system $NAME.  The code converter is bound
     to stream $FP.  Subsequent decodings and encodings are done
     to/from this stream.
 
     to stream $FP.  Subsequent decodings and encodings are done
     to/from this stream.
 
-    $CODING can be #Mnil.  In this case, a coding system associated
+    $NAME can be #Mnil.  In this case, a coding system associated
     with the current locale (LC_CTYPE) is used.
 
     with the current locale (LC_CTYPE) is used.
 
-    @return If the operation was successful, mconv_stream_converter ()
+    @return 
+    If the operation was successful, mconv_stream_converter ()
     returns the created code converter.  Otherwise it returns @c NULL
     returns the created code converter.  Otherwise it returns @c NULL
-    and assigns an error code to the external variable @c
-    merror_code.  */
+    and assigns an error code to the external variable 
+    #merror_code.  */
 
 
-/***oldja
-    @brief ¥¹¥È¥ê¡¼¥à¤Ë·ë¤ÓÉÕ¤±¤é¤ì¤¿¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤òºî¤ë
+/***ja
+    @brief ¥¹¥È¥ê¡¼¥à¤Ë·ë¤ÓÉÕ¤±¤é¤ì¤¿¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤òºî¤ë.
 
 
-    ´Ø¿ô mconv_stream_converter () ¤Ï¡¢¥³¡¼¥É·Ï $CODING ÍѤΥ³¡¼¥É¥³¥ó
-    ¥Ð¡¼¥¿¤òºî¤ë¡£¤³¤Î¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤Ï¡¢¥¹¥È¥ê¡¼¥à $FP ¤Ë·ë¤ÓÉÕ¤±¤é
-    ¤ì¤ë¡£¤³¤ì°Ê¹ß¤Î¥Ç¥³¡¼¥É¤ª¤è¤Ó¥¨¥ó¥³¡¼¥É¤Ï¡¢¤³¤Î¥¹¥È¥ê¡¼¥à¤ËÂФ·¤Æ
-    ¹Ô¤Ê¤ï¤ì¤ë¡£
+    ´Ø¿ô mconv_stream_converter () ¤Ï¡¢¥³¡¼¥É·Ï $NAME 
+    ÍѤΥ³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤òºî¤ë¡£¤³¤Î¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤Ï¡¢¥¹¥È¥ê¡¼¥à $FP 
+    ¤Ë·ë¤ÓÉÕ¤±¤é¤ì¤ë¡£
+    ¤³¤ì°Ê¹ß¤Î¥Ç¥³¡¼¥É¤ª¤è¤Ó¥¨¥ó¥³¡¼¥É¤Ï¡¢¤³¤Î¥¹¥È¥ê¡¼¥à¤ËÂФ·¤Æ¹Ô¤Ê¤ï¤ì¤ë¡£
 
 
-    $CODING ¤Ï #Mnil ¤Ç¤¢¤Ã¤Æ¤â¤è¤¤¡£¤³¤Î¾ì¹ç¤Ï¸½ºß¤Î¥í¥±¡¼¥ë 
+    $NAME ¤Ï #Mnil ¤Ç¤¢¤Ã¤Æ¤â¤è¤¤¡£¤³¤Î¾ì¹ç¤Ï¸½ºß¤Î¥í¥±¡¼¥ë 
     (LC_CTYPE) ¤Ë´ØÏ¢ÉÕ¤±¤é¤ì¤¿¥³¡¼¥É·Ï¤¬»È¤ï¤ì¤ë¡£
 
     (LC_CTYPE) ¤Ë´ØÏ¢ÉÕ¤±¤é¤ì¤¿¥³¡¼¥É·Ï¤¬»È¤ï¤ì¤ë¡£
 
-    @return
-    ¤â¤·½èÍý¤¬À®¸ù¤¹¤ì¤Ð¡¢mconv_stream_converter () ¤Ïºî¤é¤ì¤¿¥³¡¼¥É¥³
-    ¥ó¥Ð¡¼¥¿¤òÊÖ¤¹¡£¤½¤¦¤Ç¤Ê¤±¤ì¤Ð @c NULL ¤òÊÖ¤·¡¢³°ÉôÊÑ¿ô #merror_code 
-    ¤Ë¥¨¥é¡¼¥³¡¼¥É¤òÀßÄꤹ¤ë¡£
+    @return 
+    ¤â¤·½èÍý¤¬À®¸ù¤¹¤ì¤Ð¡¢mconv_stream_converter () 
+    ¤ÏºîÀ®¤·¤¿¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤òÊÖ¤¹¡£¤½¤¦¤Ç¤Ê¤±¤ì¤Ð @c NULL 
+    ¤òÊÖ¤·¡¢³°ÉôÊÑ¿ô #merror_code ¤Ë¥¨¥é¡¼¥³¡¼¥É¤òÀßÄꤹ¤ë¡£
 
     @latexonly \IPAlabel{mconverter} @endlatexonly  */
 
 
     @latexonly \IPAlabel{mconverter} @endlatexonly  */
 
@@ -4030,16 +4233,16 @@ mconv_stream_converter (MSymbol name, FILE *fp)
     mconv_reset_converter () returns the result of that function
     applied to $CONVERTER.  Otherwise it returns 0.  */
 
     mconv_reset_converter () returns the result of that function
     applied to $CONVERTER.  Otherwise it returns 0.  */
 
-/***oldja
-    @brief ¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤ò¥ê¥»¥Ã¥È¤¹¤ë
+/***ja
+    @brief ¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤ò¥ê¥»¥Ã¥È¤¹¤ë.
 
 
-    ´Ø¿ô mconv_reset_converter () ¤Ï¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿ $CONVERTER ¤ò½é´ü
-    ¾õÂÖ¤ËÌ᤹¡£
+    ´Ø¿ô mconv_reset_converter () ¤Ï¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿ $CONVERTER 
+    ¤ò½é´ü¾õÂÖ¤ËÌ᤹¡£
 
     @return
     ¤â¤· $CONVERTER->coding ¤Ë¥ê¥»¥Ã¥ÈÍѤδؿô¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤ë¤Ê¤é¤Ð¡¢
 
     @return
     ¤â¤· $CONVERTER->coding ¤Ë¥ê¥»¥Ã¥ÈÍѤδؿô¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤ë¤Ê¤é¤Ð¡¢
-    mconv_reset_converter () ¤Ï¤½¤Î´Ø¿ô¤Ë $CONVERTER ¤òŬÍѤ·¤¿·ë²Ì¤ò
-    ÊÖ¤·¡¢¤½¤¦¤Ç¤Ê¤±¤ì¤Ð0¤òÊÖ¤¹¡£  */
+    mconv_reset_converter () ¤Ï¤½¤Î´Ø¿ô¤Ë $CONVERTER 
+    ¤òŬÍѤ·¤¿·ë²Ì¤òÊÖ¤·¡¢¤½¤¦¤Ç¤Ê¤±¤ì¤Ð0¤òÊÖ¤¹¡£  */
 
 int
 mconv_reset_converter (MConverter *converter)
 
 int
 mconv_reset_converter (MConverter *converter)
@@ -4049,6 +4252,7 @@ mconv_reset_converter (MConverter *converter)
   converter->nchars = converter->nbytes = 0;
   converter->result = MCONVERSION_RESULT_SUCCESS;
   internal->carryover_bytes = 0;
   converter->nchars = converter->nbytes = 0;
   converter->result = MCONVERSION_RESULT_SUCCESS;
   internal->carryover_bytes = 0;
+  internal->used = 0;
   mtext_reset (internal->unread);
   if (internal->coding->resetter)
     return (*internal->coding->resetter) (converter);
   mtext_reset (internal->unread);
   if (internal->coding->resetter)
     return (*internal->coding->resetter) (converter);
@@ -4063,11 +4267,11 @@ mconv_reset_converter (MConverter *converter)
     The mconv_free_converter () function frees the code converter
     $CONVERTER.  */
 
     The mconv_free_converter () function frees the code converter
     $CONVERTER.  */
 
-/***oldja
-    @brief ¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤ò²òÊü¤¹¤ë
+/***ja
+    @brief ¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤ò²òÊü¤¹¤ë.
 
 
-    ´Ø¿ô mconv_free_converter () ¤Ï¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿ $CONVERTER ¤ò²òÊü
-    ¤¹¤ë¡£  */
+    ´Ø¿ô mconv_free_converter () ¤Ï¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿ $CONVERTER 
+    ¤ò²òÊü¤¹¤ë¡£  */
 
 void
 mconv_free_converter (MConverter *converter)
 
 void
 mconv_free_converter (MConverter *converter)
@@ -4093,13 +4297,12 @@ mconv_free_converter (MConverter *converter)
     @return
     This function always returns $CONVERTER.  */
 
     @return
     This function always returns $CONVERTER.  */
 
-/***oldja
-    @brief ¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤Ë¥Ð¥Ã¥Õ¥¡Îΰè¤ò·ë¤ÓÉÕ¤±¤ë
+/***ja
+    @brief ¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤Ë¥Ð¥Ã¥Õ¥¡Îΰè¤ò·ë¤ÓÉÕ¤±¤ë.
 
 
-    ´Ø¿ô mconv_rebind_buffer () ¤Ï¡¢$BUF ¤Ë¤è¤Ã¤Æ»Ø¤µ¤ì¤¿Â礭¤µ $N ¥Ð
-    ¥¤¥È¤Î¥Ð¥Ã¥Õ¥¡Îΰè¤ò¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿ $CONVERTER ¤Ë·ë¤ÓÉÕ¤±¤ë¡£¤³¤ì
-    °Ê¹ß¤Î¥Ç¥³¡¼¥É¤ª¤è¤Ó¥¨¥ó¥³¡¼¥É¤Ï¡¢¤³¤Î¿·¤¿¤Ë·ë¤ÓÉÕ¤±¤é¤ì¤¿¥Ð¥Ã¥Õ¥¡
-    Îΰè¤ËÂФ·¤Æ¹Ô¤Ê¤ï¤ì¤ë¤è¤¦¤Ë¤Ê¤ë¡£
+    ´Ø¿ô mconv_rebind_buffer () ¤Ï¡¢$BUF ¤Ë¤è¤Ã¤Æ»Ø¤µ¤ì¤¿Â礭¤µ $N 
+    ¥Ð¥¤¥È¤Î¥Ð¥Ã¥Õ¥¡Îΰè¤ò¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿ $CONVERTER ¤Ë·ë¤ÓÉÕ¤±¤ë¡£
+    ¤³¤ì°Ê¹ß¤Î¥Ç¥³¡¼¥É¤ª¤è¤Ó¥¨¥ó¥³¡¼¥É¤Ï¡¢¤³¤Î¿·¤¿¤Ë·ë¤ÓÉÕ¤±¤é¤ì¤¿¥Ð¥Ã¥Õ¥¡Îΰè¤ËÂФ·¤Æ¹Ô¤Ê¤ï¤ì¤ë¤è¤¦¤Ë¤Ê¤ë¡£
 
     @return
     ¤³¤Î´Ø¿ô¤Ï¾ï¤Ë $CONVERTER ¤òÊÖ¤¹¡£
 
     @return
     ¤³¤Î´Ø¿ô¤Ï¾ï¤Ë $CONVERTER ¤òÊÖ¤¹¡£
@@ -4111,11 +4314,11 @@ mconv_free_converter (MConverter *converter)
     mconv_rebind_stream () */
 
 MConverter *
     mconv_rebind_stream () */
 
 MConverter *
-mconv_rebind_buffer (MConverter *converter, unsigned char *buf, int n)
+mconv_rebind_buffer (MConverter *converter, const unsigned char *buf, int n)
 {
   MConverterStatus *internal = (MConverterStatus *) converter->internal_info;
 
 {
   MConverterStatus *internal = (MConverterStatus *) converter->internal_info;
 
-  internal->buf = buf;
+  internal->buf.in = buf;
   internal->used = 0;
   internal->bufsize = n;
   internal->binding = BINDING_BUFFER;
   internal->used = 0;
   internal->bufsize = n;
   internal->binding = BINDING_BUFFER;
@@ -4134,12 +4337,12 @@ mconv_rebind_buffer (MConverter *converter, unsigned char *buf, int n)
     @return
     This function always returns $CONVERTER.  */
 
     @return
     This function always returns $CONVERTER.  */
 
-/***oldja
-    @brief ¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤Ë¥¹¥È¥ê¡¼¥à¤ò·ë¤ÓÉÕ¤±¤ë
+/***ja
+    @brief ¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤Ë¥¹¥È¥ê¡¼¥à¤ò·ë¤ÓÉÕ¤±¤ë.
 
     ´Ø¿ô mconv_rebind_stream () ¤Ï¡¢¥¹¥È¥ê¡¼¥à $FP ¤ò¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿ 
 
     ´Ø¿ô mconv_rebind_stream () ¤Ï¡¢¥¹¥È¥ê¡¼¥à $FP ¤ò¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿ 
-    $CONVERTER ¤Ë·ë¤ÓÉÕ¤±¤ë¡£¤³¤ì°Ê¹ß¤Î¥Ç¥³¡¼¥É¤ª¤è¤Ó¥¨¥ó¥³¡¼¥É¤Ï¡¢
-    ¤³¤Î¿·¤¿¤Ë·ë¤ÓÉÕ¤±¤é¤ì¤¿¥¹¥È¥ê¡¼¥à¤ËÂФ·¤Æ¹Ô¤Ê¤ï¤ì¤ë¤è¤¦¤Ë¤Ê¤ë¡£
+    $CONVERTER ¤Ë·ë¤ÓÉÕ¤±¤ë¡£
+    ¤³¤ì°Ê¹ß¤Î¥Ç¥³¡¼¥É¤ª¤è¤Ó¥¨¥ó¥³¡¼¥É¤Ï¡¢¤³¤Î¿·¤¿¤Ë·ë¤ÓÉÕ¤±¤é¤ì¤¿¥¹¥È¥ê¡¼¥à¤ËÂФ·¤Æ¹Ô¤Ê¤ï¤ì¤ë¤è¤¦¤Ë¤Ê¤ë¡£
 
     @return
     ¤³¤Î´Ø¿ô¤Ï¾ï¤Ë $CONVERTER ¤òÊÖ¤¹¡£
 
     @return
     ¤³¤Î´Ø¿ô¤Ï¾ï¤Ë $CONVERTER ¤òÊÖ¤¹¡£
@@ -4175,24 +4378,25 @@ mconv_rebind_stream (MConverter *converter, FILE *fp)
 
     The mconv_decode () function decodes a byte sequence and appends
     the result at the end of M-text $MT.  The source byte sequence is
 
     The mconv_decode () function decodes a byte sequence and appends
     the result at the end of M-text $MT.  The source byte sequence is
-    taken from currently bound the buffer area or the stream.
+    taken from either the buffer area or the stream that is currently
+    bound to $CONVERTER.
 
     @return
     If the operation was successful, mconv_decode () returns updated
     $MT.  Otherwise it returns @c NULL and assigns an error code to
     the external variable #merror_code.  */
 
 
     @return
     If the operation was successful, mconv_decode () returns updated
     $MT.  Otherwise it returns @c NULL and assigns an error code to
     the external variable #merror_code.  */
 
-/***oldja
-    @brief ¥Ð¥¤¥ÈÎó¤ò M-text ¤Ë¥Ç¥³¡¼¥É¤¹¤ë
+/***ja
+    @brief ¥Ð¥¤¥ÈÎó¤ò M-text ¤Ë¥Ç¥³¡¼¥É¤¹¤ë.
 
     ´Ø¿ô mconv_decode () ¤Ï¡¢¥Ð¥¤¥ÈÎó¤ò¥Ç¥³¡¼¥É¤·¤Æ¤½¤Î·ë²Ì¤ò M-text
 
     ´Ø¿ô mconv_decode () ¤Ï¡¢¥Ð¥¤¥ÈÎó¤ò¥Ç¥³¡¼¥É¤·¤Æ¤½¤Î·ë²Ì¤ò M-text
-    $MT ¤ÎËöÈø¤ËÄɲ乤롣¥Ç¥³¡¼¥É¸µ¤Î¥Ð¥¤¥ÈÎó¤Ï¡¢¸½ºß·ë¤ÓÉÕ¤±¤é¤ì¤Æ¤¤¤ë
-    ¥Ð¥Ã¥Õ¥¡Îΰ褢¤ë¤¤¤Ï¥¹¥È¥ê¡¼¥à¤«¤é¼è¤é¤ì¤ë¡£
+    $MT ¤ÎËöÈø¤ËÄɲ乤롣¥Ç¥³¡¼¥É¸µ¤Î¥Ð¥¤¥ÈÎó¤Ï¡¢$CONVERTER 
+    ¤Ë¸½ºß·ë¤ÓÉÕ¤±¤é¤ì¤Æ¤¤¤ë¥Ð¥Ã¥Õ¥¡Îΰ褢¤ë¤¤¤Ï¥¹¥È¥ê¡¼¥à¤«¤é¼è¤é¤ì¤ë¡£
 
     @return
 
     @return
-    ¤â¤·½èÍý¤¬À®¸ù¤¹¤ì¤Ð¡¢mconv_decode () ¤Ï¹¹¿·¤µ¤ì¤¿ $MT ¤òÊÖ¤¹¡£¤½
-    ¤¦¤Ç¤Ê¤±¤ì¤Ð @c NULL ¤òÊÖ¤·¡¢³°ÉôÊÑ¿ô #merror_code ¤Ë¥¨¥é¡¼¥³¡¼¥É¤ò
-    ÀßÄꤹ¤ë¡£  */
+    ¤â¤·½èÍý¤¬À®¸ù¤¹¤ì¤Ð¡¢mconv_decode () ¤Ï¹¹¿·¤µ¤ì¤¿ $MT ¤òÊÖ¤¹¡£
+    ¤½¤¦¤Ç¤Ê¤±¤ì¤Ð @c NULL ¤òÊÖ¤·¡¢³°ÉôÊÑ¿ô #merror_code 
+    ¤Ë¥¨¥é¡¼¥³¡¼¥É¤òÀßÄꤹ¤ë¡£  */
 
 /***
     @errors
 
 /***
     @errors
@@ -4212,6 +4416,9 @@ mconv_decode (MConverter *converter, MText *mt)
 
   M_CHECK_READONLY (mt, NULL);
 
 
   M_CHECK_READONLY (mt, NULL);
 
+  if (mt->format != MTEXT_FORMAT_UTF_8)
+    mtext__adjust_format (mt, MTEXT_FORMAT_UTF_8);
+
   if (! mt->data)
     mtext__enlarge (mt, MAX_UTF8_CHAR_BYTES);
 
   if (! mt->data)
     mtext__enlarge (mt, MAX_UTF8_CHAR_BYTES);
 
@@ -4240,7 +4447,7 @@ mconv_decode (MConverter *converter, MText *mt)
 
   if (internal->binding == BINDING_BUFFER)
     {
 
   if (internal->binding == BINDING_BUFFER)
     {
-      (*internal->coding->decoder) (internal->buf + internal->used,
+      (*internal->coding->decoder) (internal->buf.in + internal->used,
                                    internal->bufsize - internal->used,
                                    mt, converter);
       internal->used += converter->nbytes;
                                    internal->bufsize - internal->used,
                                    mt, converter);
       internal->used += converter->nbytes;
@@ -4311,27 +4518,27 @@ mconv_decode (MConverter *converter, MText *mt)
 /***en
     @brief Decode a buffer area based on a coding system.
 
 /***en
     @brief Decode a buffer area based on a coding system.
 
-    The mconv_decode_buffer () function decodes $N bytes of buffer
+    The mconv_decode_buffer () function decodes $N bytes of the buffer
     area pointed to by $BUF based on the coding system $NAME.  A
     temporary code converter for decoding is automatically created
     and freed.
 
     area pointed to by $BUF based on the coding system $NAME.  A
     temporary code converter for decoding is automatically created
     and freed.
 
-    @return
-    If the operation was successful, mconv_decode_buffer () returns
-    the resulting M-text.  Otherwise it returns NULL and assigns an
-    error code to the external variable #merror_code.  */
+    @return 
+    If the operation was successful, mconv_decode_buffer ()
+    returns the resulting M-text.  Otherwise it returns @c NULL and
+    assigns an error code to the external variable #merror_code.  */
 
 
-/***oldja
-    @brief ¥³¡¼¥É·Ï¤Ë´ð¤Å¤¤¤Æ¥Ð¥Ã¥Õ¥¡Îΰè¤ò¥Ç¥³¡¼¥É¤¹¤ë
+/***ja
+    @brief ¥³¡¼¥É·Ï¤Ë´ð¤Å¤¤¤Æ¥Ð¥Ã¥Õ¥¡Îΰè¤ò¥Ç¥³¡¼¥É¤¹¤ë.
 
 
-    ´Ø¿ô mconv_decode_buffer () ¤Ï¡¢$BUF ¤Ë¤è¤Ã¤Æ»Ø¤µ¤ì¤¿ $N ¥Ð¥¤¥È¤Î
-    ¥Ð¥Ã¥Õ¥¡Îΰè¤ò¡¢¥³¡¼¥É·Ï $NAME ¤Ë´ð¤Å¤¤¤Æ¥Ç¥³¡¼¥É¤¹¤ë¡£¥Ç¥³¡¼¥É¤Ë
-    É¬Íפʥ³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤ÎºîÀ®¤È²òÊü¤Ï¼«Æ°Åª¤Ë¹Ô¤Ê¤ï¤ì¤ë¡£
+    ´Ø¿ô mconv_decode_buffer () ¤Ï¡¢$BUF ¤Ë¤è¤Ã¤Æ»Ø¤µ¤ì¤¿ $N 
+    ¥Ð¥¤¥È¤Î¥Ð¥Ã¥Õ¥¡Îΰè¤ò¡¢¥³¡¼¥É·Ï $NAME ¤Ë´ð¤Å¤¤¤Æ¥Ç¥³¡¼¥É¤¹¤ë¡£
+    ¥Ç¥³¡¼¥É¤ËɬÍפʥ³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤ÎºîÀ®¤È²òÊü¤Ï¼«Æ°Åª¤Ë¹Ô¤Ê¤ï¤ì¤ë¡£
 
     @return
 
     @return
-    ¤â¤·½èÍý¤¬À®¸ù¤¹¤ì¤Ð¡¢mconv_decode_buffer () ¤ÏÆÀ¤é¤ì¤¿ M-text ¤ò
-    ÊÖ¤¹¡£¤½¤¦¤Ç¤Ê¤±¤ì¤Ð @c NULL ¤òÊÖ¤·¡¢³°ÉôÊÑ¿ô #merror_code ¤Ë¥¨¥é¡¼
-    ¥³¡¼¥É¤òÀßÄꤹ¤ë¡£  */
+    ¤â¤·½èÍý¤¬À®¸ù¤¹¤ì¤Ð¡¢mconv_decode_buffer () ¤ÏÆÀ¤é¤ì¤¿ M-text ¤òÊÖ¤¹¡£
+    ¤½¤¦¤Ç¤Ê¤±¤ì¤Ð @c NULL ¤òÊÖ¤·¡¢³°ÉôÊÑ¿ô #merror_code 
+    ¤Ë¥¨¥é¡¼¥³¡¼¥É¤òÀßÄꤹ¤ë¡£  */
 
 /***
     @errors
 
 /***
     @errors
@@ -4341,7 +4548,7 @@ mconv_decode (MConverter *converter, MText *mt)
     mconv_decode (), mconv_decode_stream ()  */
 
 MText *
     mconv_decode (), mconv_decode_stream ()  */
 
 MText *
-mconv_decode_buffer (MSymbol name, unsigned char *buf, int n)
+mconv_decode_buffer (MSymbol name, const unsigned char *buf, int n)
 {
   MConverter *converter = mconv_buffer_converter (name, buf, n);
   MText *mt;
 {
   MConverter *converter = mconv_buffer_converter (name, buf, n);
   MText *mt;
@@ -4369,20 +4576,20 @@ mconv_decode_buffer (MSymbol name, unsigned char *buf, int n)
 
     @return
     If the operation was successful, mconv_decode_stream () returns
 
     @return
     If the operation was successful, mconv_decode_stream () returns
-    the resulting M-text.  Otherwise it returns NULL and assigns an
+    the resulting M-text.  Otherwise it returns @c NULL and assigns an
     error code to the external variable #merror_code.  */
 
     error code to the external variable #merror_code.  */
 
-/***oldja
-    @brief ¥³¡¼¥É·Ï¤Ë´ð¤Å¤¤¤Æ¥¹¥È¥ê¡¼¥àÆþÎϤò¥Ç¥³¡¼¥É¤¹¤ë
+/***ja
+    @brief ¥³¡¼¥É·Ï¤Ë´ð¤Å¤¤¤Æ¥¹¥È¥ê¡¼¥àÆþÎϤò¥Ç¥³¡¼¥É¤¹¤ë.
 
 
-    ´Ø¿ô mconv_decode_stream () ¤Ï¡¢¥¹¥È¥ê¡¼¥à $FP ¤«¤éÆɤ߹þ¤Þ¤ì¤ë¥Ð
-    ¥¤¥ÈÎóÁ´ÂΤò¡¢¥³¡¼¥É·Ï $NAME ¤Ë´ð¤Å¤¤¤Æ¥Ç¥³¡¼¥É¤¹¤ë¡£¥Ç¥³¡¼¥É¤Ëɬ
-    Íפʥ³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤ÎºîÀ®¤È²òÊü¤Ï¼«Æ°Åª¤Ë¹Ô¤Ê¤ï¤ì¤ë¡£
+    ´Ø¿ô mconv_decode_stream () ¤Ï¡¢¥¹¥È¥ê¡¼¥à $FP 
+    ¤«¤éÆɤ߹þ¤Þ¤ì¤ë¥Ð¥¤¥ÈÎóÁ´ÂΤò¡¢¥³¡¼¥É·Ï $NAME 
+    ¤Ë´ð¤Å¤¤¤Æ¥Ç¥³¡¼¥É¤¹¤ë¡£¥Ç¥³¡¼¥É¤ËɬÍפʥ³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤ÎºîÀ®¤È²òÊü¤Ï¼«Æ°Åª¤Ë¹Ô¤Ê¤ï¤ì¤ë¡£
 
     @return
 
     @return
-    ¤â¤·½èÍý¤¬À®¸ù¤¹¤ì¤Ð¡¢mconv_decode_stream () ¤ÏÆÀ¤é¤ì¤¿ M-text ¤òÊÖ
-    ¤¹¡£¤½¤¦¤Ç¤Ê¤±¤ì¤Ð @c NULL ¤òÊÖ¤·¡¢³°ÉôÊÑ¿ô #merror_code ¤Ë¥¨¥é¡¼¥³¡¼
-    ¥É¤òÀßÄꤹ¤ë¡£  */
+    ¤â¤·½èÍý¤¬À®¸ù¤¹¤ì¤Ð¡¢mconv_decode_stream () ¤ÏÆÀ¤é¤ì¤¿ M-text 
+    ¤òÊÖ¤¹¡£¤½¤¦¤Ç¤Ê¤±¤ì¤Ð @c NULL ¤òÊÖ¤·¡¢³°ÉôÊÑ¿ô #merror_code 
+    ¤Ë¥¨¥é¡¼¥³¡¼¥É¤òÀßÄꤹ¤ë¡£  */
 
 /***
     @errors
 
 /***
     @errors
@@ -4422,17 +4629,16 @@ mconv_decode_stream (MSymbol name, FILE *fp)
     number of written bytes.  Otherwise it returns -1 and assigns an
     error code to the external variable #merror_code.  */
 
     number of written bytes.  Otherwise it returns -1 and assigns an
     error code to the external variable #merror_code.  */
 
-/***oldja
-    @brief M-text ¤ò¥Ð¥¤¥ÈÎó¤Ë¥¨¥ó¥³¡¼¥É¤¹¤ë
+/***ja
+    @brief M-text ¤ò¥Ð¥¤¥ÈÎó¤Ë¥¨¥ó¥³¡¼¥É¤¹¤ë.
 
 
-    ´Ø¿ô mconv_encode () ¤Ï¡¢M-text $MT ¤ò¥¨¥ó¥³¡¼¥É¤·¤Æ¡¢¥³¡¼¥É¥³¥ó¥Ð¡¼
-    ¥¿ $CONVERTER ¤Ë¸½ºß·ë¤ÓÉÕ¤±¤é¤ì¤Æ¤¤¤ë¥Ð¥Ã¥Õ¥¡Îΰ褢¤ë¤¤¤Ï¥¹¥È¥ê¡¼
-    ¥à¤Ë½ñ¤­¹þ¤à¡£
+    ´Ø¿ô mconv_encode () ¤Ï¡¢M-text $MT ¤ò¥¨¥ó¥³¡¼¥É¤·¤Æ¡¢¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿
+    $CONVERTER ¤Ë¸½ºß·ë¤ÓÉÕ¤±¤é¤ì¤Æ¤¤¤ë¥Ð¥Ã¥Õ¥¡Îΰ褢¤ë¤¤¤Ï¥¹¥È¥ê¡¼¥à¤ËÆÀ¤é¤ì¤¿¥Ð¥¤¥ÈÎó¤ò½ñ¤­¹þ¤à¡£
 
     @return
     ¤â¤·½èÍý¤¬À®¸ù¤¹¤ì¤Ð¡¢mconv_encode () ¤Ï½ñ¤­¹þ¤Þ¤ì¤¿¥Ð¥¤¥È¿ô¤òÊÖ¤¹¡£
 
     @return
     ¤â¤·½èÍý¤¬À®¸ù¤¹¤ì¤Ð¡¢mconv_encode () ¤Ï½ñ¤­¹þ¤Þ¤ì¤¿¥Ð¥¤¥È¿ô¤òÊÖ¤¹¡£
-    ¤½¤¦¤Ç¤Ê¤±¤ì¤Ð -1 ¤òÊÖ¤·¡¢³°ÉôÊÑ¿ô #merror_code ¤Ë¥¨¥é¡¼¥³¡¼¥É¤òÀßÄê
-    ¤¹¤ë¡£  */
+    ¤½¤¦¤Ç¤Ê¤±¤ì¤Ð -1 ¤òÊÖ¤·¡¢³°ÉôÊÑ¿ô #merror_code 
+    ¤Ë¥¨¥é¡¼¥³¡¼¥É¤òÀßÄꤹ¤ë¡£  */
 
 /***
     @errors
 
 /***
     @errors
@@ -4451,7 +4657,7 @@ mconv_encode (MConverter *converter, MText *mt)
 /*=*/
 
 /***en
 /*=*/
 
 /***en
-    @brief Encode a part of an M-text
+    @brief Encode a part of an M-text.
 
     The mconv_encode_range () function encodes the text between $FROM
     (inclusive) and $TO (exclusive) in M-text $MT and writes the
 
     The mconv_encode_range () function encodes the text between $FROM
     (inclusive) and $TO (exclusive) in M-text $MT and writes the
@@ -4463,18 +4669,18 @@ mconv_encode (MConverter *converter, MText *mt)
     number of written bytes. Otherwise it returns -1 and assigns an
     error code to the external variable #merror_code.  */
 
     number of written bytes. Otherwise it returns -1 and assigns an
     error code to the external variable #merror_code.  */
 
-/***oldja
-    @brief M-text ¤Î°ìÉô¤ò¤ò¥Ð¥¤¥ÈÎó¤Ë¥¨¥ó¥³¡¼¥É¤¹¤ë
+/***ja
+    @brief M-text ¤Î°ìÉô¤ò¥Ð¥¤¥ÈÎó¤Ë¥¨¥ó¥³¡¼¥É¤¹¤ë.
 
 
-    ´Ø¿ô mconv_encode_range () ¤Ï¡¢M-text $MT ¤Î $FROM ¡Ê´Þ¤à¡Ë¤«¤é 
-    $TO ¡Ê´Þ¤Þ¤Ê¤¤¡Ë¤Þ¤Ç¤ÎÈϰϤΥƥ­¥¹¥È¤ò¥¨¥ó¥³¡¼¥É¤·¤Æ¡¢¥³¡¼¥É¥³¥ó¥Ð¡¼
-    ¥¿ $CONVERTER ¤Ë¸½ºß·ë¤ÓÉÕ¤±¤é¤ì¤Æ¤¤¤ë¥Ð¥Ã¥Õ¥¡Îΰ褢¤ë¤¤¤Ï¥¹¥È¥ê¡¼
-    ¥à¤Ë½ñ¤­¹þ¤à¡£
+    ´Ø¿ô mconv_encode_range () ¤Ï¡¢M-text $MT ¤Î $FROM 
+    ¡Ê$FROM ¼«ÂΤâ´Þ¤à¡Ë¤«¤é $TO ¡Ê$TO¼«ÂΤϴޤޤʤ¤¡Ë
+    ¤Þ¤Ç¤ÎÈϰϤΥƥ­¥¹¥È¤ò¥¨¥ó¥³¡¼¥É¤·¤Æ¡¢¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿
+    $CONVERTER ¤Ë¸½ºß·ë¤ÓÉÕ¤±¤é¤ì¤Æ¤¤¤ë¥Ð¥Ã¥Õ¥¡Îΰ褢¤ë¤¤¤Ï¥¹¥È¥ê¡¼¥à¤ËÆÀ¤é¤ì¤¿¥Ð¥¤¥ÈÎó¤ò½ñ¤­¹þ¤à¡£
 
     @return
 
     @return
-    ¤â¤·½èÍý¤¬À®¸ù¤¹¤ì¤Ð¡¢mconv_encode_range () ¤Ï½ñ¤­¹þ¤Þ¤ì¤¿¥Ð¥¤¥È¿ô
-    ¤òÊÖ¤¹¡£¤½¤¦¤Ç¤Ê¤±¤ì¤Ð -1 ¤òÊÖ¤·¡¢³°ÉôÊÑ¿ô #merror_code ¤Ë¥¨¥é¡¼¥³¡¼
-    ¥É¤òÀßÄꤹ¤ë¡£  */
+    ¤â¤·½èÍý¤¬À®¸ù¤¹¤ì¤Ð¡¢mconv_encode_range () 
+    ¤Ï½ñ¤­¹þ¤Þ¤ì¤¿¥Ð¥¤¥È¿ô¤òÊÖ¤¹¡£¤½¤¦¤Ç¤Ê¤±¤ì¤Ð -1 
+    ¤òÊÖ¤·¡¢³°ÉôÊÑ¿ô #merror_code ¤Ë¥¨¥é¡¼¥³¡¼¥É¤òÀßÄꤹ¤ë¡£  */
 
 /***
     @errors
 
 /***
     @errors
@@ -4504,7 +4710,7 @@ mconv_encode_range (MConverter *converter, MText *mt, int from, int to)
   if (internal->binding == BINDING_BUFFER)
     {
       (*internal->coding->encoder) (mt, from, to,
   if (internal->binding == BINDING_BUFFER)
     {
       (*internal->coding->encoder) (mt, from, to,
-                                   internal->buf + internal->used,
+                                   internal->buf.out + internal->used,
                                    internal->bufsize - internal->used,
                                    converter);
       internal->used += converter->nbytes;
                                    internal->bufsize - internal->used,
                                    converter);
       internal->used += converter->nbytes;
@@ -4563,18 +4769,17 @@ mconv_encode_range (MConverter *converter, MText *mt, int from, int to)
     the number of written bytes.  Otherwise it returns -1 and assigns
     an error code to the external variable #merror_code.  */
 
     the number of written bytes.  Otherwise it returns -1 and assigns
     an error code to the external variable #merror_code.  */
 
-/***oldja
-    @brief M-text ¤ò¥¨¥ó¥³¡¼¥É¤·¤Æ¥Ð¥Ã¥Õ¥¡Îΰè¤Ë½ñ¤­¹þ¤à
+/***ja
+    @brief M-text ¤ò¥¨¥ó¥³¡¼¥É¤·¤Æ¥Ð¥Ã¥Õ¥¡Îΰè¤Ë½ñ¤­¹þ¤à.
 
 
-    ´Ø¿ô mconv_encode_buffer () ¤ÏM-text $MT ¤ò¥³¡¼¥É·Ï $NAME ¤Ë´ð¤Å¤¤
-    ¤Æ¥¨¥ó¥³¡¼¥É¤·¡¢ÆÀ¤é¤ì¤¿¥Ð¥¤¥ÈÎó¤ò $BUF ¤Î»Ø¤¹¥Ð¥Ã¥Õ¥¡Îΰè¤Ë½ñ¤­¹þ
-    ¤à¡£$N ¤Ï½ñ¤­¹þ¤àºÇÂç¥Ð¥¤¥È¿ô¤Ç¤¢¤ë¡£¥¨¥ó¥³¡¼¥É¤ËɬÍפʥ³¡¼¥É¥³¥ó
-    ¥Ð¡¼¥¿¤ÎºîÀ®¤È²òÊü¤Ï¼«Æ°Åª¤Ë¹Ô¤Ê¤ï¤ì¤ë¡£
+    ´Ø¿ô mconv_encode_buffer () ¤ÏM-text $MT ¤ò¥³¡¼¥É·Ï $NAME 
+    ¤Ë´ð¤Å¤¤¤Æ¥¨¥ó¥³¡¼¥É¤·¡¢ÆÀ¤é¤ì¤¿¥Ð¥¤¥ÈÎó¤ò $BUF ¤Î»Ø¤¹¥Ð¥Ã¥Õ¥¡Îΰè¤Ë½ñ¤­¹þ¤à¡£
+    $N ¤Ï½ñ¤­¹þ¤àºÇÂç¥Ð¥¤¥È¿ô¤Ç¤¢¤ë¡£
+    ¥¨¥ó¥³¡¼¥É¤ËɬÍפʥ³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤ÎºîÀ®¤È²òÊü¤Ï¼«Æ°Åª¤Ë¹Ô¤Ê¤ï¤ì¤ë¡£
 
     @return
 
     @return
-    ¤â¤·½èÍý¤¬À®¸ù¤¹¤ì¤Ð¡¢mconv_encode_buffer () ¤Ï½ñ¤­¹þ¤Þ¤ì¤¿¥Ð¥¤¥È
-    ¿ô¤òÊÖ¤¹¡£¤½¤¦¤Ç¤Ê¤±¤ì¤Ð-1¤òÊÖ¤·¡¢³°ÉôÊÑ¿ô #merror_code ¤Ë¥¨¥é¡¼¥³¡¼
-    ¥É¤òÀßÄꤹ¤ë¡£  */
+    ¤â¤·½èÍý¤¬À®¸ù¤¹¤ì¤Ð¡¢mconv_encode_buffer () ¤Ï½ñ¤­¹þ¤Þ¤ì¤¿¥Ð¥¤¥È¿ô¤òÊÖ¤¹¡£
+    ¤½¤¦¤Ç¤Ê¤±¤ì¤Ð-1¤òÊÖ¤·¡¢³°ÉôÊÑ¿ô #merror_code ¤Ë¥¨¥é¡¼¥³¡¼¥É¤òÀßÄꤹ¤ë¡£  */
 
 /***
     @errors
 
 /***
     @errors
@@ -4611,17 +4816,17 @@ mconv_encode_buffer (MSymbol name, MText *mt, unsigned char *buf, int n)
     the number of written bytes.  Otherwise it returns -1 and assigns
     an error code to the external variable #merror_code.  */
 
     the number of written bytes.  Otherwise it returns -1 and assigns
     an error code to the external variable #merror_code.  */
 
-/***oldja
-    @brief M-text ¤ò¥¨¥ó¥³¡¼¥É¤·¤Æ¥¹¥È¥ê¡¼¥à¤Ë½ñ¤­¹þ¤à
+/***ja
+    @brief M-text ¤ò¥¨¥ó¥³¡¼¥É¤·¤Æ¥¹¥È¥ê¡¼¥à¤Ë½ñ¤­¹þ¤à.
 
 
-    ´Ø¿ô mconv_encode_stream () ¤ÏM-text $MT ¤ò¥³¡¼¥É·Ï $NAME ¤Ë´ð¤Å¤¤
-    ¤Æ¥¨¥ó¥³¡¼¥É¤·¡¢ÆÀ¤é¤ì¤¿¥Ð¥¤¥ÈÎó¤ò¥¹¥È¥ê¡¼¥à $FP ¤Ë½ñ¤­½Ð¤¹¡£¥¨¥ó
-    ¥³¡¼¥É¤ËɬÍפʥ³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤ÎºîÀ®¤È²òÊü¤Ï¼«Æ°Åª¤Ë¹Ô¤Ê¤ï¤ì¤ë¡£
+    ´Ø¿ô mconv_encode_stream () ¤ÏM-text $MT ¤ò¥³¡¼¥É·Ï $NAME 
+    ¤Ë´ð¤Å¤¤¤Æ¥¨¥ó¥³¡¼¥É¤·¡¢ÆÀ¤é¤ì¤¿¥Ð¥¤¥ÈÎó¤ò¥¹¥È¥ê¡¼¥à $FP 
+    ¤Ë½ñ¤­½Ð¤¹¡£¥¨¥ó¥³¡¼¥É¤ËɬÍפʥ³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤ÎºîÀ®¤È²òÊü¤Ï¼«Æ°Åª¤Ë¹Ô¤Ê¤ï¤ì¤ë¡£
 
     @return
 
     @return
-    ¤â¤·½èÍý¤¬À®¸ù¤¹¤ì¤Ð¡¢mconv_encode_stream () ¤Ï½ñ¤­¹þ¤Þ¤ì¤¿¥Ð¥¤¥È¿ô
-    ¤òÊÖ¤¹¡£¤½¤¦¤Ç¤Ê¤±¤ì¤Ð-1¤òÊÖ¤·¡¢³°ÉôÊÑ¿ô #merror_code ¤Ë¥¨¥é¡¼¥³¡¼¥É
-    ¤òÀßÄꤹ¤ë¡£  */
+    ¤â¤·½èÍý¤¬À®¸ù¤¹¤ì¤Ð¡¢mconv_encode_stream () 
+    ¤Ï½ñ¤­¹þ¤Þ¤ì¤¿¥Ð¥¤¥È¿ô¤òÊÖ¤¹¡£¤½¤¦¤Ç¤Ê¤±¤ì¤Ð -1 
+    ¤òÊÖ¤·¡¢³°ÉôÊÑ¿ô #merror_code ¤Ë¥¨¥é¡¼¥³¡¼¥É¤òÀßÄꤹ¤ë¡£  */
 
 /***
     @errors
 
 /***
     @errors
@@ -4661,19 +4866,19 @@ mconv_encode_stream (MSymbol name, MText *mt, FILE *fp)
     error is detected, it returns @c EOF and assigns an error code to
     #merror_code.  */
 
     error is detected, it returns @c EOF and assigns an error code to
     #merror_code.  */
 
-/***oldja
-    @brief ¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿·Ðͳ¤Ç1ʸ»úÆɤà
+/***ja
+    @brief ¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿·Ðͳ¤Ç°ìʸ»ú¤òÆɤߤ³¤à.
 
 
-    ´Ø¿ô mconv_getc () ¤Ï¡¢¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿ $CONVERTER ¤Ë¸½ºß·ë¤ÓÉÕ¤±
-    ¤é¤ì¤Æ¤¤¤ë¥Ð¥Ã¥Õ¥¡Îΰ褢¤ë¤¤¤Ï¥¹¥È¥ê¡¼¥à¤«¤é1ʸ»ú¤òÆɤ߹þ¤à¡£¥Ð¥¤
-    ¥ÈÎó¤Î¥Ç¥³¡¼¥É¤Ë¤Ï $CONVERTER ¤Î¥Ç¥³¡¼¥À¤¬ÍѤ¤¤é¤ì¤ë¡£$CONVERTER 
-    ¤ÎÆâÉô¾õÂÖ¤ÏɬÍפ˱þ¤¸¤Æ¹¹¿·¤µ¤ì¤ë¡£
+    ´Ø¿ô mconv_getc () ¤Ï¡¢¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿ $CONVERTER 
+    ¤Ë¸½ºß·ë¤ÓÉÕ¤±¤é¤ì¤Æ¤¤¤ë¥Ð¥Ã¥Õ¥¡Îΰ褢¤ë¤¤¤Ï¥¹¥È¥ê¡¼¥à¤«¤éʸ»ú¤ò°ì¤ÄÆɤ߹þ¤à¡£
+    ¥Ð¥¤¥ÈÎó¤Î¥Ç¥³¡¼¥É¤Ë¤Ï $CONVERTER ¤Î¥Ç¥³¡¼¥À¤¬ÍѤ¤¤é¤ì¤ë¡£
+    $CONVERTER ¤ÎÆâÉô¾õÂÖ¤ÏɬÍפ˱þ¤¸¤Æ¹¹¿·¤µ¤ì¤ë¡£
 
     @return
     ½èÍý¤¬À®¸ù¤¹¤ì¤Ð¡¢mconv_getc () ¤ÏÆɤ߹þ¤Þ¤ì¤¿Ê¸»ú¤òÊÖ¤¹¡£ÆþÎϸ»¤¬ 
 
     @return
     ½èÍý¤¬À®¸ù¤¹¤ì¤Ð¡¢mconv_getc () ¤ÏÆɤ߹þ¤Þ¤ì¤¿Ê¸»ú¤òÊÖ¤¹¡£ÆþÎϸ»¤¬ 
-    EOF ¤Ë㤷¤¿¾ì¹ç¤Ï¡¢³°ÉôÊÑ¿ô #merror_code ¤òÊѤ¨¤º¤Ë @c EOF ¤òÊÖ¤¹¡£
-    ¥¨¥é¡¼¤¬¸¡½Ð¤µ¤ì¤¿¾ì¹ç¤Ï @c EOF ¤òÊÖ¤·¡¢#merror_code ¤Ë¥¨¥é¡¼¥³¡¼¥É
-    ¤òÀßÄꤹ¤ë¡£  */
+    EOF ¤Ë㤷¤¿¾ì¹ç¤Ï¡¢³°ÉôÊÑ¿ô #merror_code ¤òÊѤ¨¤º¤Ë @c EOF 
+    ¤òÊÖ¤¹¡£¥¨¥é¡¼¤¬¸¡½Ð¤µ¤ì¤¿¾ì¹ç¤Ï @c EOF ¤òÊÖ¤·¡¢#merror_code 
+    ¤Ë¥¨¥é¡¼¥³¡¼¥É¤òÀßÄꤹ¤ë¡£  */
 
 /***
     @errors
 
 /***
     @errors
@@ -4715,14 +4920,14 @@ mconv_getc (MConverter *converter)
     Otherwise it returns @c EOF and assigns an error code to the
     external variable #merror_code.  */
 
     Otherwise it returns @c EOF and assigns an error code to the
     external variable #merror_code.  */
 
-/***oldja
-    @brief ¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤Ë1ʸ»úÌ᤹
+/***ja
+    @brief ¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤Ë°ìʸ»úÌ᤹.
 
 
-    ´Ø¿ô mconv_ungetc () ¤Ï¡¢¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿ $CONVERTER ¤Ëʸ»ú $C ¤ò
-    ²¡¤·Ì᤹¡£²¡¤·Ì᤻¤ëʸ»ú¿ô¤ËÀ©¸Â¤Ï¤Ê¤¤¡£¤³¤Î¸å¤Ë mconv_getc () ¤ò
-    ¸Æ¤Ó½Ð¤¹¤È¡¢ºÇ¸å¤ËÌᤵ¤ì¤¿Ê¸»ú¤¬ºÇ½é¤ËÆɤޤì¤ë¡£²¡¤·Ìᤵ¤ì¤¿Ê¸»ú¤Ï 
-    $CONVERTER ¤ÎÆâÉô¤ËÃߤ¨¤é¤ì¤ë¤À¤±¤Ç¤¢¤ê¡¢¼ÂºÝ¤ËÆþÎϸ»¤Ë½ñ¤­¹þ¤Þ¤ì
-    ¤ë¤ï¤±¤Ç¤Ï¤Ê¤¤¡£$CONVERTER ¤ÎÆâÉô¾õÂÖ¤ÏɬÍפ˱þ¤¸¤Æ¹¹¿·¤µ¤ì¤ë¡£
+    ´Ø¿ô mconv_ungetc () ¤Ï¡¢¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿ $CONVERTER ¤Ëʸ»ú $C 
+    ¤ò²¡¤·Ì᤹¡£Ìᤵ¤ì¤ëʸ»ú¿ô¤ËÀ©¸Â¤Ï¤Ê¤¤¡£¤³¤Î¸å¤Ç mconv_getc () 
+    ¤ò¸Æ¤Ó½Ð¤·¤¿ºÝ¤Ë¤Ï¡¢ºÇ¸å¤ËÌᤵ¤ì¤¿Ê¸»ú¤¬ºÇ½é¤ËÆɤޤì¤ë¡£Ìᤵ¤ì¤¿Ê¸»ú¤Ï 
+    $CONVERTER ¤ÎÆâÉô¤ËÃߤ¨¤é¤ì¤ë¤À¤±¤Ç¤¢¤ê¡¢¼ÂºÝ¤ËÆþÎϸ»¤Ë½ñ¤­¹þ¤Þ¤ì¤ë¤ï¤±¤Ç¤Ï¤Ê¤¤¡£
+    $CONVERTER ¤ÎÆâÉô¾õÂÖ¤ÏɬÍפ˱þ¤¸¤Æ¹¹¿·¤µ¤ì¤ë¡£
 
     @return
     ½èÍý¤¬À®¸ù¤¹¤ì¤Ð¡¢mconv_ungetc () ¤Ï $C ¤òÊÖ¤¹¡£¤½¤¦¤Ç¤Ê¤±¤ì¤Ð @c
 
     @return
     ½èÍý¤¬À®¸ù¤¹¤ì¤Ð¡¢mconv_ungetc () ¤Ï $C ¤òÊÖ¤¹¡£¤½¤¦¤Ç¤Ê¤±¤ì¤Ð @c
@@ -4764,18 +4969,18 @@ mconv_ungetc (MConverter *converter, int c)
     If an error is detected, it returns @c EOF and assigns
     an error code to the external variable #merror_code.  */
 
     If an error is detected, it returns @c EOF and assigns
     an error code to the external variable #merror_code.  */
 
-/***oldja
-    @brief ¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤ò·Ðͳ¤Ç1ʸ»ú½ñ¤¯
+/***ja
+    @brief ¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤ò·Ðͳ¤·¤Æ°ìʸ»ú½ñ¤­½Ð¤¹.
 
 
-    ´Ø¿ô mconv_putc () ¤Ï¡¢¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿ $CONVERTER ¤Ë¸½ºß·ë¤ÓÉÕ¤±
-    ¤é¤ì¤Æ¤¤¤ë¥Ð¥Ã¥Õ¥¡Îΰ褢¤ë¤¤¤Ï¥¹¥È¥ê¡¼¥à¤Ëʸ»ú $C ¤ò½ñ¤­½Ð¤¹¡£Ê¸»ú
-    ¤Î¥¨¥ó¥³¡¼¥É¤Ë¤Ï $CONVERTER ¤Î¥¨¥ó¥³¡¼¥À¤¬ÍѤ¤¤é¤ì¤ë¡£¼ÂºÝ¤Ë½ñ¤­½Ð
-    ¤µ¤ì¤¿¥Ð¥¤¥È¿ô¤Ï¡¢$CONVERTER ¤Î ¥á¥ó¥Ð¡¼ @c nbytes ¤Ë¥»¥Ã¥È¤µ¤ì¤ë¡£
-    $CONVERTER ¤ÎÆâÉô¾õÂÖ¤ÏɬÍפ˱þ¤¸¤Æ¹¹¿·¤µ¤ì¤ë¡£
+    ´Ø¿ô mconv_putc () ¤Ï¡¢¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿ $CONVERTER 
+    ¤Ë¸½ºß·ë¤ÓÉÕ¤±¤é¤ì¤Æ¤¤¤ë¥Ð¥Ã¥Õ¥¡Îΰ褢¤ë¤¤¤Ï¥¹¥È¥ê¡¼¥à¤Ëʸ»ú $C 
+    ¤ò½ñ¤­½Ð¤¹¡£Ê¸»ú¤Î¥¨¥ó¥³¡¼¥É¤Ë¤Ï $CONVERTER 
+    ¤Î¥¨¥ó¥³¡¼¥À¤¬ÍѤ¤¤é¤ì¤ë¡£¼ÂºÝ¤Ë½ñ¤­½Ð¤µ¤ì¤¿¥Ð¥¤¥È¿ô¤Ï¡¢$CONVERTER ¤Î¥á¥ó¥Ð¡¼
+    @c nbytes ¤Ë¥»¥Ã¥È¤µ¤ì¤ë¡£$CONVERTER ¤ÎÆâÉô¾õÂÖ¤ÏɬÍפ˱þ¤¸¤Æ¹¹¿·¤µ¤ì¤ë¡£
 
     @return
 
     @return
-    ½èÍý¤¬À®¸ù¤¹¤ì¤Ð¡¢mconv_putc () ¤Ï $C ¤òÊÖ¤¹¡£¥¨¥é¡¼¤¬¸¡½Ð¤µ¤ì¤¿¾ì¹ç
-    ¤Ï @c EOF ¤òÊÖ¤·¡¢³°ÉôÊÑ¿ô #merror_code ¤Ë¥¨¥é¡¼¥³¡¼¥É¤òÀßÄꤹ¤ë¡£  */
+    ½èÍý¤¬À®¸ù¤¹¤ì¤Ð¡¢mconv_putc () ¤Ï $C ¤òÊÖ¤¹¡£¥¨¥é¡¼¤¬¸¡½Ð¤µ¤ì¤¿¾ì¹ç¤Ï
+    @c EOF ¤òÊÖ¤·¡¢³°ÉôÊÑ¿ô #merror_code ¤Ë¥¨¥é¡¼¥³¡¼¥É¤òÀßÄꤹ¤ë¡£  */
 
 /***
     @errors
 
 /***
     @errors
@@ -4814,23 +5019,24 @@ mconv_putc (MConverter *converter, int c)
     If the operation was successful, mconv_gets () returns the
     modified $MT.  If it encounters EOF without reading a single
     character, it returns $MT without changing it.  If an error is
     If the operation was successful, mconv_gets () returns the
     modified $MT.  If it encounters EOF without reading a single
     character, it returns $MT without changing it.  If an error is
-    detected, it returns @c NULL and assigns an error code to @c
-    merror_code.  */
+    detected, it returns @c NULL and assigns an error code to 
+    #merror_code.  */
 
 
-/***oldja
-    @brief ¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤ò»È¤Ã¤Æ1¹ÔÆɤà
+/***ja
+    @brief ¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿¤ò»È¤Ã¤Æ°ì¹ÔÆɤ߹þ¤à.
 
 
-    ´Ø¿ô mconv_gets () ¤Ï¡¢¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿ $CONVERTER ¤Ë¸½ºß·ë¤ÓÉÕ¤±
-    ¤é¤ì¤Æ¤¤¤ë¥Ð¥Ã¥Õ¥¡Îΰ褢¤ë¤¤¤Ï¥¹¥È¥ê¡¼¥à¤«¤é1¹Ô¤òÆɤ߹þ¤à¡£¥Ð¥¤¥È
-    Îó¤Î¥Ç¥³¡¼¥É¤Ë¤Ï $CONVERTER ¤Î¥Ç¥³¡¼¥À¤¬ÍѤ¤¤é¤ì¤ë¡£¥Ç¥³¡¼¥É¤µ¤ì¤¿
-    Ê¸»úÎó¤Ï M-text $MT ¤ÎËöÈø¤ËÄɲ䵤ì¤ë¡£¸µ¤Î¥Ð¥¤¥ÈÎó¤Î½ªÃ¼²þ¹Ôʸ»ú
-    ¤ÏÄɲ䵤ì¤Ê¤¤¡£$CONVERTER ¤ÎÆâÉô¾õÂÖ¤ÏɬÍפ˱þ¤¸¤Æ¹¹¿·¤µ¤ì¤ë¡£
+    ´Ø¿ô mconv_gets () ¤Ï¡¢¥³¡¼¥É¥³¥ó¥Ð¡¼¥¿ $CONVERTER 
+    ¤Ë¸½ºß·ë¤ÓÉÕ¤±¤é¤ì¤Æ¤¤¤ë¥Ð¥Ã¥Õ¥¡Îΰ褢¤ë¤¤¤Ï¥¹¥È¥ê¡¼¥à¤«¤é 1 ¹Ô¤òÆɤ߹þ¤à¡£
+    ¥Ð¥¤¥ÈÎó¤Î¥Ç¥³¡¼¥É¤Ë¤Ï $CONVERTER 
+    ¤Î¥Ç¥³¡¼¥À¤¬ÍѤ¤¤é¤ì¤ë¡£¥Ç¥³¡¼¥É¤µ¤ì¤¿Ê¸»úÎó¤Ï M-text $MT 
+    ¤ÎËöÈø¤ËÄɲ䵤ì¤ë¡£¸µ¤Î¥Ð¥¤¥ÈÎó¤Î½ªÃ¼²þ¹Ôʸ»ú¤ÏÄɲ䵤ì¤Ê¤¤¡£
+    $CONVERTER ¤ÎÆâÉô¾õÂÖ¤ÏɬÍפ˱þ¤¸¤Æ¹¹¿·¤µ¤ì¤ë¡£
 
     @return
 
     @return
-    ½èÍý¤¬À®¸ù¤¹¤ì¤Ð¡¢mconv_gets () ¤ÏÊѹ¹¤µ¤ì¤¿ $MT ¤òÊÖ¤¹¡£¤â¤·1ʸ»ú
-    ¤âÆɤޤº¤Ë EOF ¤ËÅö¤¿¤Ã¤¿¾ì¹ç¤Ï¡¢$MT ¤òÊѹ¹¤»¤º¤Ë¤½¤Î¤Þ¤ÞÊÖ¤¹¡£¥¨
-    ¥é¡¼¤¬¸¡½Ð¤µ¤ì¤¿¾ì¹ç¤Ï @c NULL ¤òÊÖ¤·¡¢#merror_code ¤Ë¥¨¥é¡¼¥³¡¼¥É¤ò
-    ÀßÄꤹ¤ë¡£  */
+    ½èÍý¤¬À®¸ù¤¹¤ì¤Ð¡¢mconv_gets () ¤ÏÊѹ¹¤µ¤ì¤¿ $MT
+    ¤òÊÖ¤¹¡£¤â¤·1ʸ»ú¤âÆɤޤº¤Ë EOF ¤ËÁø¶ø¤·¤¿¾ì¹ç¤Ï¡¢$MT 
+    ¤òÊѹ¹¤»¤º¤Ë¤½¤Î¤Þ¤ÞÊÖ¤¹¡£¥¨¥é¡¼¤¬¸¡½Ð¤µ¤ì¤¿¾ì¹ç¤Ï @c NULL ¤òÊÖ¤·¡¢
+    #merror_code ¤Ë¥¨¥é¡¼¥³¡¼¥É¤òÀßÄꤹ¤ë¡£  */
 
 /***
     @errors
 
 /***
     @errors
@@ -4845,6 +5051,9 @@ mconv_gets (MConverter *converter, MText *mt)
   int c;
 
   M_CHECK_READONLY (mt, NULL);
   int c;
 
   M_CHECK_READONLY (mt, NULL);
+  if (mt->format != MTEXT_FORMAT_UTF_8)
+    mtext__adjust_format (mt, MTEXT_FORMAT_UTF_8);
+
   while (1)
     {
       c = mconv_getc (converter);
   while (1)
     {
       c = mconv_getc (converter);
@@ -4853,7 +5062,7 @@ mconv_gets (MConverter *converter, MText *mt)
       mtext_cat_char (mt, c);
     }
   if (c == EOF && converter->result != MCONVERSION_RESULT_SUCCESS)
       mtext_cat_char (mt, c);
     }
   if (c == EOF && converter->result != MCONVERSION_RESULT_SUCCESS)
-    /* mconv_getc () sets merror_code */
+    /* mconv_getc () sets #merror_code */
     return NULL;
   return mt;
 }
     return NULL;
   return mt;
 }