(Mdetail_text, minput_get_description, minput_get_commands)
[m17n/m17n-lib.git] / src / input.c
index 6de2311..928da5b 100644 (file)
 
 /***en
     @addtogroup m17nInputMethod
-    @brief API for Input method
+    @brief API for Input method.
 
     An input method is an object to enable inputting various
     characters.  An input method is identified by a pair of symbols,
-    LANGUAGE and NAME.  This pair decides an input driver of the input
-    method.  An input driver is a set of functions for handling the
-    input method.  There are two kinds of input methods; internal one
-    and foreign one.
+    LANGUAGE and NAME.  This pair decides a input method driver of the
+    input method.  An input method driver is a set of functions for
+    handling the input method.  There are two kinds of input methods;
+    internal one and foreign one.
 
     <ul>
-
     <li> Internal Input Method
 
     An internal input method has non @c Mnil LANGUAGE, and the body is
     GUI use.  Those driver utilize the input processing engine
     provided by the m17n library itself.  The m17n database may
     provides an input method that is not only for a specific language.
-    The database uses @c Mt as the language of such an input method.
+    The database uses @c Mt as LANGUAGE of such an input method.
 
     An internal input method accepts an input key which is a symbol
     associated with an input event.  As there is no way for the @c
     m17n @c library to know how input events are represented in an
-    application program, a application programmer have to convert an
+    application program, an application programmer have to convert an
     input event to an input key by himself.  See the documentation of
     the function minput_event_to_key () for the detail.
 
     defined in an external resources (e.g. XIM of X Window System).
     For this kind of input methods, the symbol NAME must have a
     property of key @c Minput_driver, and the value must be a pointer
-    to an input driver.  So, by preparing a proper input 
+    to an input method driver.  Therefore, by preparing a proper
     driver, any kind of input method can be treated in the framework
     of the @c m17n @c library.
 
-    For convenience, the m17n-X library provides an input driver that
-    enables the input style of OverTheSpot for XIM, and stores @c
-    Minput_driver property of the symbol @c Mxim with a pointer to
-    that driver.  See the documentation of m17n GUI API for the
-    detail.
+    For convenience, the m17n-X library provides an input method
+    driver that enables the input style of OverTheSpot for XIM, and
+    stores @c Minput_driver property of the symbol @c Mxim with a
+    pointer to the driver.  See the documentation of m17n GUI API for
+    the detail.
 
     </ul>
 
     PROCESSING FLOW
 
-    The typical processing flow of handling an input method is: open
-    an input method, create an input context for the input method,
-    filter an input key, and looking up a produced text in the input
-    context.  */
+    The typical processing flow of handling an input method is: 
 
-/*=*/
+     @li open an input method
+     @li create an input context for the input method
+     @li filter an input key
+     @li look up a produced text in the input context  */
 
-/***oldja
+/*=*/
+/***ja
     @addtogroup m17nInputMethod
-    @brief ÆþÎϥ᥽¥Ã¥ÉÍÑAPI
+    @brief ÆþÎϥ᥽¥Ã¥ÉÍÑAPI.
 
     ÆþÎϥ᥽¥Ã¥É¤Ï¿ÍͤÊʸ»ú¤òÆþÎϤ¹¤ë¤¿¤á¤Î¥ª¥Ö¥¸¥§¥¯¥È¤Ç¤¢¤ë¡£ÆþÎÏ¥á
     ¥½¥Ã¥É¤Ï¥·¥ó¥Ü¥ë LANGUAGE ¤È NAME ¤ÎÁȤˤè¤Ã¤Æ¼±Ê̤µ¤ì¡¢¤³¤ÎÁȤˤè¤Ã
-    ¤ÆÆþÎϥɥ饤¥Ð¤¬·è¤Þ¤ë¡£ÆþÎϥɥ饤¥Ð¤È¤Ï»ØÄê¤ÎÆþÎϥ᥽¥Ã¥É¤ò°·¤¦¤¿
-    ¤á¤Î´Ø¿ô¤Î½¸¤Þ¤ê¤Ç¤¢¤ë¡£
-
-    ÆþÎϥ᥽¥Ã¥É¤Ë¤ÏÆâÉô¥á¥½¥Ã¥É¤È³°Éô¥á¥½¥Ã¥É¤ÎÆóÄ̤꤬¤¢¤ë¡£
+    ¤ÆÆþÎϥ᥽¥Ã¥É¥É¥é¥¤¥Ð¤¬·è¤Þ¤ë¡£ÆþÎϥ᥽¥Ã¥É¥É¥é¥¤¥Ð¤È¤Ï¤¢¤ëÆþÎÏ¥á
+    ¥½¥Ã¥É¤ò°·¤¦¤¿¤á¤Î´Ø¿ô¤Î½¸¤Þ¤ê¤Ç¤¢¤ë¡£ ÆþÎϥ᥽¥Ã¥É¤Ë¤ÏÆâÉô¥á¥½¥Ã
+    ¥É¤È³°Éô¥á¥½¥Ã¥É¤ÎÆóÄ̤꤬¤¢¤ë¡£
 
-    ÆâÉôÆþÎϥ᥽¥Ã¥É
+    <ul> 
+    <li> ÆâÉôÆþÎϥ᥽¥Ã¥É
 
     ÆâÉôÆþÎϥ᥽¥Ã¥É¤Ï LANGUAGE ¤¬ @c Mnil °Ê³°¤Î¤â¤Î¤Ç¤¢¤ê¡¢ËÜÂΤÏ
-    m17n ¸À¸ì¾ðÊó¥Ù¡¼¥¹¤Ë <Minput_method, LANGUAGE, NAME>¤È¤¤¤¦¥¿¥°ÉÕ
-    ¤­¤ÇÄêµÁ¤µ¤ì¤Æ¤¤¤ë¡£¤³¤Î¼ï¤ÎÆþÎϥ᥽¥Ã¥É¤ËÂФ·¤Æ¡¢m17n¥é¥¤¥Ö¥é¥ê¤Ë
-    ¤ÏCUIÍѤÈGUIÍѤ½¤ì¤¾¤ì¤ÎÆþÎϥɥ饤¥Ð¤¬¤¢¤é¤«¤¸¤á½àÈ÷¤µ¤ì¤Æ¤¤¤ë¡£¤³
-    ¤ì¤é¤Î¥É¥é¥¤¥Ð¤Ïm17n¥é¥¤¥Ö¥é¥ê¼«¿È¤ÎÆþÎϽèÍý¥¨¥ó¥¸¥ó¤òÍøÍѤ¹¤ë¡£
-
-    ÆâÉôÆþÎϥ᥽¥Ã¥É¤Ï¡¢¥æ¡¼¥¶¤ÎÆþÎÏ¥¤¥Ù¥ó¥È¤ËÂбþ¤·¤¿ÆþÎÏ¥­¡¼¤ò¼õ¤±¼è
-    ¤ë¡£ÆþÎÏ¥­¡¼¤Ï¥·¥ó¥Ü¥ë¤Ç¤¢¤ë¡£@c m17n @c ¥é¥¤¥Ö¥é¥ê ¤ÏÆþÎÏ¥¤¥Ù¥ó¥È
-    ¤¬¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¡¦¥×¥í¥°¥é¥à¤Ç¤É¤Î¤è¤¦¤Ëɽ¸½¤µ¤ì¤Æ¤¤¤ë¤«¤òÃΤë½Ñ
-    ¤ò»ý¤¿¤Ê¤¤¤Î¤Ç¡¢ÆþÎÏ¥¤¥Ù¥ó¥È¤«¤éÆþÎÏ¥­¡¼¤Ø¤ÎÊÑ´¹¤Ï¥×¥í¥°¥é¥Þ¤ÎÀÕǤ
-    ¤Ç¹Ô¤ï¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£¾ÜºÙ¤Ë¤Ä¤¤¤Æ¤Ï´Ø¿ô minput_event_to_key () 
-    ¤Î¥É¥­¥å¥á¥ó¥È¤ò»²¾È¤Î¤³¤È¡£
-
-    ³°ÉôÆþÎϥ᥽¥Ã¥É
-
-    ³°ÉôÆþÎϥ᥽¥Ã¥É¤Ï LANGUAGE ¤¬ @c Mnil ¤Î¤â¤Î¤Ç¤¢¤ê¡¢¤ÇËÜÂΤϳ°Éô
-    ¤Î¥ê¥½¡¼¥¹¤È¤·¤ÆÄêµÁ¤µ¤ì¤ë¡£¡Ê¤¿¤È¤¨¤ÐX Window System ¤ÎXIM ¤Ê¤É¡£) 
-    ¤³¤Î¼ï¤ÎÆþÎϥ᥽¥Ã¥É¤Ç¤Ï¥·¥ó¥Ü¥ë NAME ¤Ï@c Minput_driver ¤ò¥­¡¼¤È
-    ¤¹¤ë¥×¥í¥Ñ¥Æ¥£¤ò»ý¤Á¡¢¤½¤ÎÃͤÏÆþÎϥɥ饤¥Ð¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê
-    ¤é¤Ê¤¤¡£¤·¤¿¤¬¤Ã¤Æ¡¢Å¬ÀÚ¤ÊÆþÎϥɥ饤¥Ð¤ò½àÈ÷¤¹¤ë¤³¤È¤Ë¤è¤Ã¤Æ¡¢¤¤¤«
-    ¤Ê¤ëÆþÎϥ᥽¥Ã¥É¤â @c m17n @c ¥é¥¤¥Ö¥é¥ê¤ÎÏÈÁȤÎÃæ¤Ç°·¤¦»ö¤¬¤Ç¤­¤ë¡£
-
-    ´Êñ¤Î¤¿¤á¡¢m17n X ¥é¥¤¥Ö¥é¥ê¤ÏXIM ¤Î OverTheSpot ¤ÎÆþÎÏ¥¹¥¿¥¤¥ë¤ò
-    ¼Â¸½¤¹¤ëÆþÎϥɥ饤¥Ð¤òÄ󶡤·¤Æ¤¤¤ë¡£¤Þ¤¿¥·¥ó¥Ü¥ë @c Mxim ¤Î @c
+    m17n ¥Ç¡¼¥¿¥Ù¡¼¥¹¤Ë <Minput_method, LANGUAGE, NAME>¤È¤¤¤¦¥¿¥°ÉÕ¤­
+    ¤ÇÄêµÁ¤µ¤ì¤Æ¤¤¤ë¡£¤³¤Î¼ï¤ÎÆþÎϥ᥽¥Ã¥É¤ËÂФ·¤Æ¡¢m17n ¥é¥¤¥Ö¥é¥ê¤Ë
+    ¤ÏCUIÍѤÈGUIÍѤ½¤ì¤¾¤ì¤ÎÆþÎϥ᥽¥Ã¥É¥É¥é¥¤¥Ð¤¬¤¢¤é¤«¤¸¤á½àÈ÷¤µ¤ì¤Æ
+    ¤¤¤ë¡£¤³¤ì¤é¤Î¥É¥é¥¤¥Ð¤Ïm17n¥é¥¤¥Ö¥é¥ê¼«¿È¤ÎÆþÎϽèÍý¥¨¥ó¥¸¥ó¤òÍøÍÑ
+    ¤¹¤ë¡£m17n ¥Ç¡¼¥¿¥Ù¡¼¥¹¤Ë¤Ï¡¢ÆÃÄê¤Î¸À¸ìÀìÍѤǤʤ¤ÆþÎϥ᥽¥Ã¥É¤âÄê
+    µÁ¤¹¤ë¤³¤È¤¬¤Ç¤­¡¢¤½¤Î¤è¤¦¤ÊÆþÎϥ᥽¥Ã¥É¤Î LANGUAGE ¤Ï @c Mt ¤Ç¤¢
+    ¤ë¡£
+
+    ÆâÉôÆþÎϥ᥽¥Ã¥É¤Ï¡¢¥æ¡¼¥¶¤ÎÆþÎÏ¥¤¥Ù¥ó¥È¤ËÂбþ¤·¤¿¥·¥ó¥Ü¥ë¤Ç¤¢¤ëÆþ
+    ÎÏ¥­¡¼¤ò¼õ¤±¼è¤ë¡£@c m17n @c ¥é¥¤¥Ö¥é¥ê ¤ÏÆþÎÏ¥¤¥Ù¥ó¥È¤¬¥¢¥×¥ê¥±¡¼
+    ¥·¥ç¥ó¥×¥í¥°¥é¥à¤Ç¤É¤¦É½¸½¤µ¤ì¤Æ¤¤¤ë¤«¤òÃΤë½Ñ¤ò»ý¤¿¤Ê¤¤¤Î¤Ç¡¢ÆþÎÏ
+    ¥¤¥Ù¥ó¥È¤«¤éÆþÎÏ¥­¡¼¤Ø¤ÎÊÑ´¹¤Ï¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é¥Þ¤ÎÀÕǤ¤Ç¹Ô
+    ¤ï¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£¾ÜºÙ¤Ë¤Ä¤¤¤Æ¤Ï´Ø¿ô minput_event_to_key () ¤ÎÀâ
+    ÌÀ¤ò»²¾È¡£
+
+    <li> ³°ÉôÆþÎϥ᥽¥Ã¥É
+
+    ³°ÉôÆþÎϥ᥽¥Ã¥É¤Ï LANGUAGE ¤¬ @c Mnil ¤Î¤â¤Î¤Ç¤¢¤ê¡¢ËÜÂΤϳ°Éô¤Î
+    ¥ê¥½¡¼¥¹¤È¤·¤ÆÄêµÁ¤µ¤ì¤ë¡£¡Ê¤¿¤È¤¨¤ÐX Window System ¤ÎXIM ¤Ê¤É¡£) 
+    ¤³¤Î¼ï¤ÎÆþÎϥ᥽¥Ã¥É¤Ç¤Ï¡¢¥·¥ó¥Ü¥ë NAME ¤Ï@c Minput_driver ¤ò¥­¡¼
+    ¤È¤¹¤ë¥×¥í¥Ñ¥Æ¥£¤ò»ý¤Á¡¢¤½¤ÎÃͤÏÆþÎϥ᥽¥Ã¥É¥É¥é¥¤¥Ð¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç
+    ¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£¤·¤¿¤¬¤Ã¤Æ¡¢Å¬Àڤʥɥ饤¥Ð¤ò½àÈ÷¤¹¤ë¤³¤È¤Ë¤è¤Ã¤Æ¡¢
+    ¤¤¤«¤Ê¤ë¼ïÎà¤ÎÆþÎϥ᥽¥Ã¥É¤â @c m17n @c ¥é¥¤¥Ö¥é¥ê ¤ÎÏÈÁȤÎÃæ¤Ç°·
+    ¤¦»ö¤¬¤Ç¤­¤ë¡£
+
+    ÍøÊØÀ­¤Î¤¿¤á¡¢m17n X ¥é¥¤¥Ö¥é¥ê¤Ï XIM ¤Î OverTheSpot ¤ÎÆþÎÏ¥¹¥¿¥¤¥ë
+    ¤ò¼Â¸½¤¹¤ëÆþÎϥ᥽¥Ã¥É¥É¥é¥¤¥Ð¤òÄ󶡤·¡¢¤Þ¤¿¥·¥ó¥Ü¥ë @c Mxim ¤Î @c
     Minput_driver ¥×¥í¥Ñ¥Æ¥£¤ÎÃͤȤ·¤Æ¤½¤Î¥É¥é¥¤¥Ð¤Ø¤Î¥Ý¥¤¥ó¥¿¤òÊÝ»ý¤·
-    ¤Æ¤¤¤ë¡£¾ÜºÙ¤Ë¤Ä¤¤¤Æ¤Ïm17n-win API ¤Î¥É¥­¥å¥á¥ó¥È¤ò»²¾È¤Î¤³¤È¡£
+    ¤Æ¤¤¤ë¡£¾ÜºÙ¤Ë¤Ä¤¤¤Æ¤Ï m17n GUI API ¤Î¥É¥­¥å¥á¥ó¥È¤ò»²¾È¤Î¤³¤È¡£
+
+    </ul> 
 
     ½èÍý¤Îή¤ì
 
-    ÆþÎϥ᥽¥Ã¥É½èÍý¤Îŵ·¿Åª¤Ê½èÍý¤Ï°Ê²¼¤Î¤è¤¦¤Ë¤Ê¤ë¡£ÆþÎϥ᥽¥Ã¥É¤Î¥ª¡¼
-    ¥×¥ó¡¢¤½¤ÎÆþÎϥ᥽¥Ã¥É¤ÎÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¤ÎÀ¸À®¡¢ÆþÎÏ¥¤¥Ù¥ó¥È¤Î¥Õ¥£
-    ¥ë¥¿¡¢ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¤Ç¤ÎÀ¸À®¥Æ¥­¥¹¥È¤Î¸¡º÷¡£     */
+    ÆþÎϥ᥽¥Ã¥É½èÍý¤Îŵ·¿Åª¤Ê½èÍý¤Ï°Ê²¼¤Î¤è¤¦¤Ë¤Ê¤ë¡£
+    
+    @li ÆþÎϥ᥽¥Ã¥É¤Î¥ª¡¼¥×¥ó
+    @li ¤½¤ÎÆþÎϥ᥽¥Ã¥É¤ÎÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¤ÎÀ¸À®
+    @li ÆþÎÏ¥¤¥Ù¥ó¥È¤Î¥Õ¥£¥ë¥¿
+    @li ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¤Ç¤ÎÀ¸À®¥Æ¥­¥¹¥È¤Î¸¡º÷     */
 
 /*=*/
 
 
 #include <stdio.h>
 #include <string.h>
-#include <dlfcn.h>
 
 #include "config.h"
+
+#ifdef HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
 #include "m17n-gui.h"
 #include "m17n-misc.h"
 #include "internal.h"
 #include "symbol.h"
 #include "plist.h"
 
+static int mdebug_mask = MDEBUG_INPUT;
+
 static MSymbol Minput_method;
 
 /** Symbols to load an input method data.  */
@@ -224,7 +239,7 @@ integer_value (MInputContext *ic, MPlist *arg)
   MInputContextInfo *ic_info = (MInputContextInfo *) ic->info;
   int code;
   MText *preedit = ic->preedit;
-  int len = mtext_nbytes (preedit);
+  int len = mtext_nchars (preedit);
 
   if (MPLIST_INTEGER_P (arg))
     return MPLIST_INTEGER (arg);
@@ -241,7 +256,7 @@ integer_value (MInputContext *ic, MPlist *arg)
     code = ic->cursor_pos + 1;
   else if (code == '<')
     code = 0;
-  else if (code == '<')
+  else if (code == '>')
     code = len;
   return (code >= 0 && code < len ? mtext_ref_char (preedit, code) : -1);
 }
@@ -677,8 +692,6 @@ load_input_method (MSymbol language, MSymbol name, MPlist *plist,
   MPlist *macros = NULL;
   MPlist *elt;
 
-  if (! MPLIST_PLIST_P (plist))
-    MERROR (MERROR_IM, -1);
   for (; MPLIST_PLIST_P (plist); plist = MPLIST_NEXT (plist))
     {
       elt = MPLIST_PLIST (plist);
@@ -738,9 +751,12 @@ load_input_method (MSymbol language, MSymbol name, MPlist *plist,
        }
     }
 
-  MPLIST_DO (elt, maps)
-    M17N_OBJECT_UNREF (MPLIST_VAL (elt));
-  M17N_OBJECT_UNREF (maps);
+  if (maps)
+    {
+      MPLIST_DO (elt, maps)
+       M17N_OBJECT_UNREF (MPLIST_VAL (elt));
+      M17N_OBJECT_UNREF (maps);
+    }
   if (! title)
     title = mtext_from_data (MSYMBOL_NAME (name), MSYMBOL_NAMELEN (name),
                             MTEXT_FORMAT_US_ASCII);
@@ -798,7 +814,7 @@ shift_state (MInputContext *ic, MSymbol state_name)
 {
   MInputMethodInfo *im_info = (MInputMethodInfo *) ic->im->info;
   MInputContextInfo *ic_info = (MInputContextInfo *) ic->info;
-  MIMState *state = ic_info->state;
+  MIMState *state;
 
   /* Find a state to shift to.  If not found, shift to the initial
      state.  */
@@ -806,6 +822,8 @@ shift_state (MInputContext *ic, MSymbol state_name)
   if (! state)
     state = (MIMState *) MPLIST_VAL (im_info->states);
 
+  MDEBUG_PRINT1 ("\n[IM] state-shift (%s)", MSYMBOL_NAME (state->name));
+
   /* Enter the new state.  */
   ic_info->state = state;
   ic_info->map = state->map;
@@ -820,6 +838,16 @@ shift_state (MInputContext *ic, MSymbol state_name)
       mtext_put_prop_values (ic->preedit, 0, mtext_nchars (ic->preedit),
                             Mcandidate_index, NULL, 0);
       mtext_cat (ic->produced, ic->preedit);
+      if ((mdebug__flag & mdebug_mask)
+         && mtext_nchars (ic->produced) > 0)
+       {
+         int i;
+
+         MDEBUG_PRINT (" (produced");
+           for (i = 0; i < mtext_nchars (ic->produced); i++)
+             MDEBUG_PRINT1 (" U+%04X", mtext_ref_char (ic->produced, i));
+         MDEBUG_PRINT (")");
+       }
       mtext_reset (ic->preedit);
       ic->candidate_list = NULL;
       ic->candidate_show = 0;
@@ -843,9 +871,17 @@ shift_state (MInputContext *ic, MSymbol state_name)
   if (ic_info->key_head == ic_info->used
       && ic_info->map == ic_info->state->map
       && ic_info->map->map_actions)
-    take_action_list (ic, ic_info->map->map_actions);
+    {
+      MDEBUG_PRINT (" init-actions:");
+      take_action_list (ic, ic_info->map->map_actions);
+    }
 }
 
+/* Find a candidate group that contains a candidate number INDEX from
+   PLIST.  Set START_INDEX to the first candidate number of the group,
+   END_INDEX to the last candidate number plus 1, GROUP_INDEX to the
+   candidate group number if they are non-NULL.  If INDEX is -1, find
+   the last candidate group.  */
 
 static MPlist *
 find_candidates_group (MPlist *plist, int index,
@@ -859,7 +895,8 @@ find_candidates_group (MPlist *plist, int index,
        len = mtext_nchars (MPLIST_MTEXT (plist));
       else
        len = mplist_length (MPLIST_PLIST (plist));
-      if (i + len > index)
+      if (index < 0 ? MPLIST_TAIL_P (MPLIST_NEXT (plist))
+         : i + len > index)
        {
          if (start_index)
            *start_index = i;
@@ -954,7 +991,7 @@ new_index (MInputContext *ic, int current, int limit, MSymbol sym, MText *mt)
 }
 
 static void
-udpate_candidate (MInputContext *ic, MTextProperty *prop, int idx)
+update_candidate (MInputContext *ic, MTextProperty *prop, int idx)
 {
   int from = mtext_property_start (prop);
   int to = mtext_property_end (prop);
@@ -1018,6 +1055,7 @@ take_action_list (MInputContext *ic, MPlist *action_list)
          args = MPLIST_NEXT (action);
        }
 
+      MDEBUG_PRINT1 (" %s", MSYMBOL_NAME (name));
       if (name == Minsert)
        {
          if (MPLIST_MTEXT_P (args))
@@ -1088,9 +1126,14 @@ take_action_list (MInputContext *ic, MPlist *action_list)
                                     end - start - 1, MPLIST_SYMBOL (args),
                                     NULL)
                        : MPLIST_INTEGER (args)));
-             if (idx < 0
-                 || (idx >= end
-                     && MPLIST_TAIL_P (MPLIST_NEXT (group))))
+             if (idx < 0)
+               {
+                 find_candidates_group (mtext_property_value (prop), -1,
+                                        NULL, &end, NULL);
+                 idx = end - 1;
+               }
+             else if (idx >= end
+                      && MPLIST_TAIL_P (MPLIST_NEXT (group)))
                idx = 0;
            }
          else
@@ -1123,7 +1166,7 @@ take_action_list (MInputContext *ic, MPlist *action_list)
                ingroup_index = len - 1;
              idx += ingroup_index;
            }
-         udpate_candidate (ic, prop, idx);
+         update_candidate (ic, prop, idx);
        }
       else if (name == Mshow)
        ic->candidate_show = 1;
@@ -1276,12 +1319,13 @@ take_action_list (MInputContext *ic, MPlist *action_list)
          else
            val1 /= val2;
          mplist_put (ic_info->vars, sym, (void *) val1);
+         MDEBUG_PRINT2 ("(%s=%d)", MSYMBOL_NAME (sym), val1);
        }
       else if (name == Mequal || name == Mless || name == Mgreater)
        {
          int val1, val2;
          MPlist *actions1, *actions2;
-         int ret;
+         int ret = 0;
 
          val1 = integer_value (ic, args);
          args = MPLIST_NEXT (args);
@@ -1351,6 +1395,9 @@ handle_key (MInputContext *ic)
   MSymbol key = ic_info->keys[ic_info->key_head];
   int i;
 
+  MDEBUG_PRINT2 ("[IM] handle `%s' in state %s", 
+                MSYMBOL_NAME (key), MSYMBOL_NAME (ic_info->state->name));
+
   if (map->submaps)
     {
       submap = mplist_get (map->submaps, key);
@@ -1360,12 +1407,14 @@ handle_key (MInputContext *ic)
 
   if (submap)
     {
+      MDEBUG_PRINT (" submap-found");
       mtext_cpy (ic->preedit, ic_info->preedit_saved);
       ic->cursor_pos = ic_info->state_pos;
       ic_info->key_head++;
       ic_info->map = map = submap;
       if (map->map_actions)
        {
+         MDEBUG_PRINT (" map-actions:");
          if (take_action_list (ic, map->map_actions) < 0)
            return -1;
        }
@@ -1388,6 +1437,7 @@ handle_key (MInputContext *ic)
        {
          if (map->branch_actions)
            {
+             MDEBUG_PRINT (" branch-actions:");
              if (take_action_list (ic, map->branch_actions) < 0)
                return -1;
            }
@@ -1396,6 +1446,7 @@ handle_key (MInputContext *ic)
          if (ic_info->map != ic_info->state->map)
            shift_state (ic, ic_info->state->name);
        }
+      MDEBUG_PRINT ("\n");
     }
   else
     {
@@ -1404,14 +1455,20 @@ handle_key (MInputContext *ic)
       /* If MAP is the root map of the initial state, it means that
         the current input method can not handle KEY.  */
       if (map == ((MIMState *) MPLIST_VAL (im_info->states))->map)
-       return -1;
+       {
+         MDEBUG_PRINT (" unhandled\n");
+         return -1;
+       }
 
       if (map != ic_info->state->map)
        {
          /* If MAP is not the root map... */
          /* If MAP has branch actions, perform them.  */
          if (map->branch_actions)
-           take_action_list (ic, map->branch_actions);
+           {
+             MDEBUG_PRINT (" branch-actions:");
+             take_action_list (ic, map->branch_actions);
+           }
          /* If MAP is still not the root map, shift to the current
             state. */
          if (ic_info->map != ic_info->state->map)
@@ -1419,7 +1476,10 @@ handle_key (MInputContext *ic)
              shift_state (ic, ic_info->state->name);
              /* If MAP has branch_actions, perform them.  */
              if (ic_info->map->branch_actions)
-               take_action_list (ic, ic_info->map->branch_actions);
+               {
+                 MDEBUG_PRINT (" init-actions:");
+                 take_action_list (ic, ic_info->map->branch_actions);
+               }
            }
        }
       else
@@ -1427,33 +1487,42 @@ handle_key (MInputContext *ic)
          /* MAP is the root map, perform branch actions (if any) or
             shift to the initial state.  */
          if (map->branch_actions)
-           take_action_list (ic, map->branch_actions);
+           {
+             MDEBUG_PRINT (" branch-actions:");
+             take_action_list (ic, map->branch_actions);
+           }
          else
            shift_state (ic,
                         ((MIMState *) MPLIST_VAL (im_info->states))->name);
        }
+      MDEBUG_PRINT ("\n");
     }
   return 0;
 }
 
 static void
-reset_ic (MInputContext *ic)
+reset_ic (MInputContext *ic, MSymbol ignore)
 {
   MInputMethodInfo *im_info = (MInputMethodInfo *) ic->im->info;
   MInputContextInfo *ic_info = (MInputContextInfo *) ic->info;
 
+  if (im_info->states)
+    /* Shift to the initial state.  */
+    shift_state (ic, Mnil);
+  else
+    ic_info->state = NULL;
   MLIST_RESET (ic_info);
-  ic_info->state = (MIMState *) MPLIST_VAL (im_info->states);
-  ic_info->map = ic_info->state->map;
+  ic_info->map = ic_info->state ? ic_info->state->map : NULL;
   ic_info->state_key_head = ic_info->key_head = 0;
+  ic_info->key_unhandled = 0;
   ic->cursor_pos = ic_info->state_pos = 0;
-  ic->status = ic_info->state->title;
+  ic->status = ic_info->state ? ic_info->state->title : NULL;
   if (! ic->status)
     ic->status = im_info->title;
   ic->candidate_list = NULL;
   ic->candidate_show = 0;
   ic->status_changed = ic->preedit_changed = ic->candidates_changed = 1;
-  if (ic_info->map->map_actions)
+  if (ic_info->map && ic_info->map->map_actions)
     take_action_list (ic, ic_info->map->map_actions);
 }
 
@@ -1562,7 +1631,7 @@ create_ic (MInputContext *ic)
        }
       M17N_OBJECT_UNREF (func_args);
     }
-  reset_ic (ic);
+  reset_ic (ic, Mnil);
   return 0;
 }
 
@@ -1609,6 +1678,11 @@ filter (MInputContext *ic, MSymbol key, void *arg)
   MInputContextInfo *ic_info = (MInputContextInfo *) ic->info;
   int i = 0;
 
+  if (! ic_info->state)
+    {
+      ic_info->key_unhandled = 1;
+      return 0;
+    }
   mtext_reset (ic->produced);
   ic->status_changed = ic->preedit_changed = ic->candidates_changed = 0;
   MLIST_APPEND1 (ic_info, keys, key, MERROR_IM);
@@ -1618,7 +1692,7 @@ filter (MInputContext *ic, MSymbol key, void *arg)
       {
        /* KEY was not handled.  Reset the status and break the
           loop.  */
-       reset_ic (ic);
+       reset_ic (ic, Mnil);
        /* This forces returning 1.  */
        ic_info->key_unhandled = 1;
        break;
@@ -1626,7 +1700,7 @@ filter (MInputContext *ic, MSymbol key, void *arg)
     if (i++ == 100)
       {
        mdebug_hook ();
-       reset_ic (ic);
+       reset_ic (ic, Mnil);
        ic_info->key_unhandled = 1;
        break;
       }
@@ -1775,6 +1849,7 @@ minput__init ()
   Minput_candidates_draw = msymbol ("input-candidates-draw");
   Minput_set_spot = msymbol ("input-set-spot");
   Minput_toggle = msymbol ("input-toggle");
+  Minput_reset = msymbol ("input-reset");
 
   Mcandidate_list = msymbol_as_managing_key ("  candidate-list");
   Mcandidate_index = msymbol ("  candidate-index");
@@ -1820,7 +1895,9 @@ minput__init ()
   minput_default_driver.destroy_ic = destroy_ic;
   minput_default_driver.filter = filter;
   minput_default_driver.lookup = lookup;
-  minput_default_driver.callback_list = NULL;
+  minput_default_driver.callback_list = mplist ();
+  mplist_put (minput_default_driver.callback_list, Minput_reset,
+             (void *) reset_ic);
   minput_driver = &minput_default_driver;
   return 0;
 }
@@ -1878,7 +1955,13 @@ minput__char_to_key (int c)
 
     These are the predefined symbols that are used as the @c COMMAND
     argument of callback functions of an input method driver (see
-    #MInputDriver::callback_list).  */ 
+    #MInputDriver::callback_list ).  */ 
+/***ja
+    @name ÊÑ¿ô¡§ ¥³¡¼¥ë¥Ð¥Ã¥¯¥³¥Þ¥ó¥ÉÍÑÄêµÁºÑ¤ß¥·¥ó¥Ü¥ë.
+
+    ÆþÎϥ᥽¥Ã¥É¥É¥é¥¤¥Ð¤Î¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤Ë¤ª¤¤¤Æ @c COMMAND °ú¿ô¤È¤·
+    ¤ÆÍѤ¤¤é¤ì¤ëÄêµÁºÑ¤ß¥·¥ó¥Ü¥ë (#MInputDriver::callback_list »²¾È)¡£
+      */ 
 /*** @{ */ 
 /*=*/
 
@@ -1893,17 +1976,18 @@ MSymbol Minput_candidates_done;
 MSymbol Minput_candidates_draw;
 MSymbol Minput_set_spot;
 MSymbol Minput_toggle;
+MSymbol Minput_reset;
 /*** @} */
 /*=*/
 
 /***en
-    @brief The default input driver for internal input methods.
+    @brief The default driver for internal input methods.
 
     The variable #minput_default_driver is the default driver for
     internal input methods.
 
     The member MInputDriver::open_im () searches the m17n database for
-    an input method that matches the tag \<#Minput_method, $LANGUAGE,
+    an input method that matches the tag \< #Minput_method, $LANGUAGE,
     $NAME\> and loads it.
 
     The member MInputDriver::callback_list () is @c NULL.  Thus, it is
@@ -1918,34 +2002,46 @@ MSymbol Minput_toggle;
     dependent arguments $ARG of the functions whose name begin with
     "minput_" are all ignored.  */
 
-/***oldja
-    @brief ÆâÉôÆþÎϥ᥽¥Ã¥ÉÍѥǥե©¥ë¥ÈÆþÎϥɥ饤¥Ð
+/***ja
+    @brief ÆâÉôÆþÎϥ᥽¥Ã¥ÉÍѥǥե©¥ë¥È¥É¥é¥¤¥Ð.
+
+    ÆþÎϥɥ饤¥Ð #minput_default_driver ¤ÏÆâÉôÆþÎϥ᥽¥Ã¥ÉÍѤΥǥե©¥ë
+    ¥È¤Î¥É¥é¥¤¥Ð¤Ç¤¢¤ë¡£
 
-    ÆþÎϥɥ饤¥Ð minput_default_driver ¤ÏÆâÉôÆþÎϥ᥽¥Ã¥ÉÍѤΥǥե©¥ë
-    ¥È¤ÎÆþÎϥɥ饤¥Ð¤Ç¤¢¤ë¡£
+    ¥á¥ó¥Ð MInputDriver::open_im () ¤Ï m17n ¥Ç¡¼¥¿¥Ù¡¼¥¹Ã椫¤é¥¿¥° 
+    \< #Minput_method, $LANGUAGE, $NAME\> ¤Ë¹çÃפ¹¤ëÆþÎϥ᥽¥Ã¥É¤òõ¤·¡¢
+    ¤½¤ì¤ò¥í¡¼¥É¤¹¤ë¡£
 
-    ¤³¤Î¥É¥é¥¤¥Ð¤Î <callback> ¥á¥ó¥Ð¤Ï @c NULL ¤Ê¤Î¤Ç¡¢¥×¥í¥°¥é¥Þ¦¤Ç
-    ÀÕǤ¤ò»ý¤Ã¤Æ, Å¬Àڤʥ³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤ËÀßÄꤷ¡¢Preedit ¥Æ¥­¥¹¥È,
-    Status ¥Æ¥­¥¹¥È¤¬¥æ¡¼¥¶¤Ëɽ¼¨¤Ç¤­¤ë¤è¤¦¤Ë¤·¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
+    ¥á¥ó¥Ð MInputDriver::callback_list () ¤Ï @c NULL ¤Ê¤Î¤Ç¡¢¥×¥í¥°¥é
+    ¥Þ¦¤ÇÀÕǤ¤ò»ý¤Ã¤Æ, Å¬Àڤʥ³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤Î plist ¤ËÀßÄꤷ¤Ê¤¯¤Æ
+    ¤Ï¤Ê¤é¤Ê¤¤¡£¤µ¤â¤Ê¤¤¤È¡¢preedit ¥Æ¥­¥¹¥È¤Ê¤É¤Î¥Õ¥£¡¼¥É¥Ð¥Ã¥¯¾ðÊó¤¬
+    ¥æ¡¼¥¶¤Ëɽ¼¨¤µ¤ì¤Ê¤¤¡£
 
-    ´Ø¿ô M17N_INIT () ¤ÏÊÑ¿ô @c minput_driver ¤ò¤³¤Î¥É¥é¥¤¥Ð¤Ø¤Î¥Ý¥¤¥ó
+    ¥Þ¥¯¥í M17N_INIT () ¤ÏÊÑ¿ô #minput_driver ¤ò¤³¤Î¥É¥é¥¤¥Ð¤Ø¤Î¥Ý¥¤¥ó
     ¥¿¤ËÀßÄꤷ¡¢Á´¤Æ¤ÎÆâÉôÆþÎϥ᥽¥Ã¥É¤¬¤³¤Î¥É¥é¥¤¥Ð¤ò»È¤¦¤è¤¦¤Ë¤¹¤ë¡£
 
     ¤·¤¿¤¬¤Ã¤Æ¡¢@c minput_driver ¤¬¥Ç¥Õ¥©¥ë¥ÈÃͤΤޤޤǤ¢¤ì¤Ð¡¢minput_ 
-    ¤Ç»Ï¤Þ¤ë°Ê²¼¤Î´Ø¿ô·²¤Î¥É¥é¥¤¥Ð¤Ë°Í¸¤¹¤ë°ú¿ô $ARG ¤Ï¤É¤ì¤â̵»ë¤µ¤ì
-    ¤ë¡£  */
+    ¤Ç»Ï¤Þ¤ë´Ø¿ô¤Î¥É¥é¥¤¥Ð¤Ë°Í¸¤¹¤ë°ú¿ô $ARG ¤Ï¤¹¤Ù¤Æ̵»ë¤µ¤ì¤ë¡£  */
 
 MInputDriver minput_default_driver;
 /*=*/
 
 /***en
-    @brief The input driver for internal input methods.
+    @brief The driver for internal input methods.
 
     The variable #minput_driver is a pointer to the input method
     driver that is used by internal input methods.  The macro
     M17N_INIT () initializes it to a pointer to #minput_default_driver
-    (if <m17n.h> is included) or to #minput_gui_driver (if
-    <m17n-gui.h> is included).  */ 
+    (if <m17n<EM></EM>.h> is included) or to #minput_gui_driver (if
+    <m17n-gui<EM></EM>.h> is included).  */ 
+/***ja
+    @brief ÆâÉôÆþÎϥ᥽¥Ã¥ÉÍѥɥ饤¥Ð.
+
+    ÊÑ¿ô #minput_driver ¤ÏÆâÉôÆþÎϥ᥽¥Ã¥É¤Ë¤è¤Ã¤Æ»ÈÍѤµ¤ì¤Æ¤¤¤ëÆþÎÏ¥á
+    ¥½¥Ã¥É¥É¥é¥¤¥Ð¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¡£¥Þ¥¯¥í M17N_INIT () ¤Ï¤³¤Î¥Ý¥¤¥ó
+    ¥¿¤ò #minput_default_driver (<m17n<EM></EM>.h> ¤¬´Þ¤Þ¤ì¤ë»þ) ¤Þ¤¿¤Ï
+    #minput_gui_driver ( <m17n-gui<EM></EM>.h> ¤¬´Þ¤Þ¤ì¤ë»þ) ¤Ë½é´ü²½¤¹
+    ¤ë¡£  */ 
 
 MInputDriver *minput_driver;
 
@@ -1960,49 +2056,43 @@ MSymbol Minput_driver;
     language $LANGUAGE and name $NAME, and returns a pointer to the
     input method object newly allocated.
 
-    This function at first decides an input driver for the input
-    method as below.
+    This function at first decides an driver for the input method as
+    below.
 
-    If $LANGUAGE is not #Mnil, an input driver pointed by the variable
+    If $LANGUAGE is not #Mnil, the driver pointed by the variable
     #minput_driver is used.
 
     If $LANGUAGE is #Mnil and $NAME has #Minput_driver property, the
-    input driver pointed to by the property value is used to open the
-    input method.  If $NAME has no such property, @c NULL is returned.
+    driver pointed to by the property value is used to open the input
+    method.  If $NAME has no such property, @c NULL is returned.
 
-    Then, the member MInputDriver::open_im () of the input driver is
+    Then, the member MInputDriver::open_im () of the driver is
     called.  
 
     $ARG is set in the member @c arg of the structure MInputMethod so
-    that the input driver can refer to it.  */
+    that the driver can refer to it.  */
 
-/***oldja
-    @brief ÆþÎϥ᥽¥Ã¥É¤ò¥ª¡¼¥×¥ó¤¹¤ë     
+/***ja
+    @brief ÆþÎϥ᥽¥Ã¥É¤ò¥ª¡¼¥×¥ó¤¹¤ë.
 
-    ´Ø¿ô mim_open () ¤Ï¸À¸ì $LANGUAGE ¤È̾Á° $NAME ¤ËŬ¹ç¤¹¤ëÆþÎϥ᥽¥Ã
-    ¥É¤ò¥ª¡¼¥×¥ó¤·¡¢¤½¤Î¿·¤¿¤Ë³ä¤êÅö¤Æ¤é¤ì¤¿ÆþÎϥ᥽¥Ã¥É¤Ø¤Î¥Ý¥¤¥ó¥¿¤òÊÖ¤¹¡£
+    ´Ø¿ô minput_open_im () ¤Ï¸À¸ì $LANGUAGE ¤È̾Á° $NAME ¤Ë¹çÃפ¹¤ëÆþ
+    Îϥ᥽¥Ã¥É¤ò¥ª¡¼¥×¥ó¤·¡¢¿·¤¿¤Ë³ä¤êÅö¤Æ¤é¤ì¤¿ÆþÎϥ᥽¥Ã¥É¥ª¥Ö¥¸¥§¥¯
+    ¥È¤Ø¤Î¥Ý¥¤¥ó¥¿¤òÊÖ¤¹¡£
+    
+    ¤³¤Î´Ø¿ô¤Ï¡¢¤Þ¤ºÆþÎϥ᥽¥Ã¥ÉÍѤΥɥ饤¥Ð¤ò°Ê²¼¤Î¤è¤¦¤Ë¤·¤Æ·èÄꤹ¤ë¡£
 
-    $LANGUAGE ¤¬ #Mnil ¤Ç¤Ê¤±¤ì¤Ð¡¢m17n ¸À¸ì¾ðÊó¥Ù¡¼¥¹Ã椫¤é \<@c
-    Minput_method, $LANGUAGE, $NAME \> ¤È¤¤¤¦¥¿¥°¤ËŬ¹ç¤¹¤ëÆþÎϥ᥽¥Ã
-    ¥É¤òõ¤¹¡£¸«¤Ä¤«¤Ã¤¿¾ì¹ç¤Ï¡¢ÊÑ¿ô #minput_driver ¤Ç¥Ý¥¤¥ó¥È¤µ¤ì¤Æ
-    ¤¤¤ëÆþÎϥɥ饤¥Ð¤òÍѤ¤¤Æ¤½¤ÎÆþÎϥ᥽¥Ã¥É¤ò¥ª¡¼¥×¥ó¤¹¤ë¡£¸«¤Ä¤«¤é¤Ê
-    ¤¤¾ì¹ç¤ä¥ª¡¼¥×¥ó¤Ç¤­¤Ê¤«¤Ã¤¿¾ì¹ç¤Ë¤Ï @c NULL ¤òÊÖ¤¹¡£
+    $LANGUAGE ¤¬ #Mnil ¤Ç¤Ê¤±¤ì¤Ð¡¢ÊÑ¿ô #minput_driver ¤Ç»Ø¤µ¤ì¤Æ¤¤¤ë
+    ¥É¥é¥¤¥Ð¤òÍѤ¤¤ë¡£
 
-    ÊÑ¿ô #minput_driver ¤Ï¡¢#minput_default_driver ¤« @c
-    minput_gui_driver ¤Î¤É¤Á¤é¤«¤ò¥Ý¥¤¥ó¥È¤·¤Æ¤¤¤ë¡£Á°¼Ô¤Ï CUI ÍѤǤ¢
-    ¤ê¡¢´Ø¿ôm17n_initialize () ¤ò¸Æ¤Ö¤³¤È¤Ë¤è¤Ã¤Æ #minput_driver ¤¬ 
-    #minput_default_driver ¤ò¥Ý¥¤¥ó¥È¤¹¤ë¤è¤¦¤Ë¤Ê¤ë¡£¸å¼Ô¤Ï GUI ÍѤÇ
-    ¤¢¤ê¡¢´Ø¿ô m17n_initialize_win () ¤Ë¤è¤Ã¤Æ¥Ý¥¤¥ó¥È¤µ¤ì¤ë¡£¾ÜºÙ¤Ë¤Ä
-    ¤¤¤Æ¤Ï¤³¤ì¤é¤ÎÊÑ¿ô¤Î¥É¥­¥å¥á¥ó¥È¤ò»²¾È¤Î¤³¤È¡£
+    $LANGUAGE ¤¬ #Mnil ¤Ç¤¢¤ê¡¢$NAME ¤¬ #Minput_driver ¥×¥í¥Ñ¥Æ¥£¤ò»ý
+    ¤Ä¾ì¹ç¤Ë¤Ï¡¢¤½¤Î¥×¥í¥Ñ¥Æ¥£¤ÎÃͤǻؤµ¤ì¤Æ¤¤¤ëÆþÎϥɥ饤¥Ð¤òÍѤ¤¤ÆÆþ
+    Îϥ᥽¥Ã¥É¤ò¥ª¡¼¥×¥ó¤¹¤ë¡£$NAME ¤Ë¤½¤Î¤è¤¦¤Ê¥×¥í¥Ñ¥Æ¥£¤¬Ìµ¤«¤Ã¤¿¾ì
+    ¹ç¤Ï @c NULL ¤òÊÖ¤¹¡£
 
-    $LANGUAGE ¤¬ #Mnil ¤Ç¤¢¤ê¡¢$NAME ¤¬ #Minput_driver ¤ò¥­¡¼¤È¤¹
-    ¤ë¥×¥í¥Ñ¥Æ¥£¤ò»ý¤Ä¾ì¹ç¤Ë¤Ï¡¢¤½¤Î¥×¥í¥Ñ¥Æ¥£¤ÎÃͤǥݥ¤¥ó¥È¤µ¤ì¤Æ¤¤¤ë
-    ÆþÎϥɥ饤¥Ð¤òÍѤ¤¤ÆÆþÎϥ᥽¥Ã¥É¤ò¥ª¡¼¥×¥ó¤¹¤ë¡£$NAME ¤Ë¤½¤Î¤è¤¦¤Ê
-    ¥×¥í¥Ñ¥Æ¥£¤¬Ìµ¤«¤Ã¤¿¾ì¹ç¤ä¥ª¡¼¥×¥ó¤Ç¤­¤Ê¤«¤Ã¤¿¾ì¹ç¤Ë¤Ï @c NULL ¤ò
-    ÊÖ¤¹¡£
+    ¼¡¤¤¤Ç¡¢¥É¥é¥¤¥Ð¤Î¥á¥ó¥Ð MInputDriver::open_im () ¤¬¸Æ¤Ð¤ì¤ë¡£
 
-    $ARG ¤Ï¡¢ÆþÎϥɥ饤¥Ð¤¬»²¾È¤Ç¤­¤ë¤è¤¦¤Ë¡¢¹½Â¤ÂΠMInputMethod ¤Î¥á
-    ¥ó¥Ð @c arg ¤Ë¥»¥Ã¥È¤µ¤ì¤ë¡£
+    $ARG ¤Ï¡¢¥É¥é¥¤¥Ð¤¬»²¾È¤Ç¤­¤ë¤è¤¦¤Ë¡¢¹½Â¤ÂΠMInputMethod ¤Î¥á¥ó¥Ð 
+    @c arg ¤ËÀßÄꤵ¤ì¤ë¡£
 
     @latexonly \IPAlabel{minput_open} @endlatexonly
 
@@ -2044,8 +2134,8 @@ minput_open_im (MSymbol language, MSymbol name, void *arg)
     The minput_close_im () function closes the input method $IM, which
     must have been created by minput_open_im ().  */
 
-/***oldja
-    @brief ÆþÎϥ᥽¥Ã¥É¤ò¥¯¥í¡¼¥º¤¹¤ë
+/***ja
+    @brief ÆþÎϥ᥽¥Ã¥É¤ò¥¯¥í¡¼¥º¤¹¤ë.
 
     ´Ø¿ô minput_close_im () ¤Ï¡¢ÆþÎϥ᥽¥Ã¥É $IM ¤ò¥¯¥í¡¼¥º¤¹¤ë¡£¤³¤Î
     ÆþÎϥ᥽¥Ã¥É $IM ¤Ï minput_open_im () ¤Ë¤è¤Ã¤Æºî¤é¤ì¤¿¤â¤Î¤Ç¤Ê¤±¤ì
@@ -2073,15 +2163,19 @@ minput_close_im (MInputMethod *im)
     If an input context is successfully created, minput_create_ic ()
     returns a pointer to it.  Otherwise it returns @c NULL.  */
 
-/***oldja
-    @brief ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¤òÀ¸À®¤¹¤ë
+/***ja
+    @brief ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¤òÀ¸À®¤¹¤ë.
 
     ´Ø¿ô minput_create_ic () ¤ÏÆþÎϥ᥽¥Ã¥É $IM ¤ËÂбþ¤¹¤ëÆþÎÏ¥³¥ó¥Æ¥¯
-    ¥¹¥È¥ª¥Ö¥¸¥§¥¯¥È¤òÀ¸À®¤¹¤ë¡£
+    ¥¹¥È¥ª¥Ö¥¸¥§¥¯¥È¤òÀ¸À®¤·¡¢ #Minput_preedit_start,
+    #Minput_status_start, #Minput_status_draw ¤ËÂбþ¤¹¤ë¥³¡¼¥ë¥Ð¥Ã¥¯´Ø
+    ¿ô¤ò¤³¤Î½ç¤Ë¸Æ¤Ö¡£
 
     @return
-    ½èÍý¤¬À®¸ù¤·¤¿¾ì¹ç¡¢minput_create_ic () ¤ÏÀ¸À®¤·¤¿ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È
-    ¤Ø¤Î¥Ý¥¤¥ó¥¿¤òÊÖ¤¹¡£¼ºÇÔ¤·¤¿¾ì¹ç¤Ï @c NULL ¤òÊÖ¤¹¡£  */
+
+    ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¤¬À¸À®¤µ¤ì¤¿¾ì¹ç¡¢minput_create_ic () ¤Ï¤½¤ÎÆþÎÏ¥³
+    ¥ó¥Æ¥¯¥¹¥È¤Ø¤Î¥Ý¥¤¥ó¥¿¤òÊÖ¤¹¡£¼ºÇÔ¤·¤¿¾ì¹ç¤Ï @c NULL ¤òÊÖ¤¹¡£
+      */
 
 MInputContext *
 minput_create_ic (MInputMethod *im, void *arg)
@@ -2124,14 +2218,17 @@ minput_create_ic (MInputMethod *im, void *arg)
     The minput_destroy_ic () function destroys the input context $IC,
     which must have been created by minput_create_ic ().  It calls
     callback functions corresponding to #Minput_preedit_done,
-    #Minput_status_done, and #Mcandidate_done in this order.  */
+    #Minput_status_done, and #Minput_candidates_done in this order.  */
 
-/***oldja
-    @brief ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¤òÇ˲õ¤¹¤ë
+/***ja
+    @brief ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¤òÇ˲õ¤¹¤ë.
 
     ´Ø¿ô minput_destroy_ic () ¤Ï¡¢ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È $IC ¤òÇ˲õ¤¹¤ë¡£¤³
     ¤ÎÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¤Ï minput_create_ic () ¤Ë¤è¤Ã¤Æºî¤é¤ì¤¿¤â¤Î¤Ç¤Ê
-    ¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£  */
+    ¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£¤³¤Î´Ø¿ô¤Ï#Minput_preedit_done,
+    #Minput_status_done, #Minput_candidates_done ¤ËÂбþ¤¹¤ë¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤ò
+    ¤³¤Î½ç¤Ë¸Æ¤Ö¡£
+  */
 
 void
 minput_destroy_ic (MInputContext *ic)
@@ -2156,26 +2253,29 @@ minput_destroy_ic (MInputContext *ic)
 
     The minput_filter () function filters input key $KEY according to
     input context $IC, and calls callback functions corresponding to
-    #Minput_preedit_draw, #Minput_status_draw, and #Mcandidate_draw if
-    the preedit text, the status, and the current candidate are
-    changed respectively.
+    #Minput_preedit_draw, #Minput_status_draw, and
+    #Minput_candidates_draw if the preedit text, the status, and the
+    current candidate are changed respectively.
 
     @return
     If $KEY is filtered out, this function returns 1.  In that case,
     the caller should discard the key.  Otherwise, it returns 0, and
     the caller should handle the key, for instance, by calling the
-    function minput_lookup () with the same $KEY.  */
+    function minput_lookup () with the same key.  */
 
-/***oldja
-    @brief ÆþÎÏ¥­¡¼¤Î¥Õ¥£¥ë¥¿¥ê¥ó¥°¤ò¤¹¤ë
+/***ja
+    @brief ÆþÎÏ¥­¡¼¤ò¥Õ¥£¥ë¥¿¤¹¤ë.
 
     ´Ø¿ô minput_filter () ¤ÏÆþÎÏ¥­¡¼ $KEY ¤òÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È $IC ¤Ë±þ
-    ¤¸¤Æ¥Õ¥£¥ë¥¿¥ê¥ó¥°¤¹¤ë¡£
+    ¤¸¤Æ¥Õ¥£¥ë¥¿¤·¡¢preedit ¥Æ¥­¥¹¥È¡¢¥¹¥Æ¡¼¥¿¥¹¡¢¸½»þÅÀ¤Ç¤Î¸õÊ䤬ÊѲ½
+    ¤·¤¿ºÝ¤Ë¤Ï¤½¤ì¤¾¤ì#Minput_preedit_draw, #Minput_status_draw,
+    #Minput_candidates_draw ¤ËÂбþ¤¹¤ë¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤ò¸Æ¤Ö¡£
 
-    ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È $IC ¤ÎÆþÎϥ᥽¥Ã¥É¤¬ÆþÎÏ¥­¡¼¤ò¥Õ¥£¥ë¥¿¤¹¤ì¤Ð¡¢¤³
-    ¤Î´Ø¿ô¤Ï 1 ¤òÊÖ¤¹¡£¤³¤Î¾ì¹ç¸Æ¤Ó½Ð¤·Â¦¤Ï¤³¤Î¥­¡¼¤ò¼Î¤Æ¤ë¤Ù¤­¤Ç¤¢¤ë¡£
-    ¤½¤¦¤Ç¤Ê¤±¤ì¤Ð 0 ¤òÊÖ¤·¡¢¸Æ¤Ó½Ð¤·Â¦¤¬¡¢¤¿¤È¤¨¤ÐƱ¤¸ $KEY ¤Ç´Ø¿ô 
-    minput_lookup () ¤ò¸Æ¤Ö¤Ê¤É¤·¤Æ¡¢¤³¤Î¥­¡¼¤ò½èÍý¤¹¤ë¡£
+    @return 
+    $KEY ¤¬¥Õ¥£¥ë¥¿¤µ¤ì¤ì¤Ð¡¢¤³¤Î´Ø¿ô¤Ï 1 ¤òÊÖ¤¹¡£¤³¤Î¾ì¹ç¸Æ¤Ó
+    ½Ð¤·Â¦¤Ï¤³¤Î¥­¡¼¤ò¼Î¤Æ¤ë¤Ù¤­¤Ç¤¢¤ë¡£¤½¤¦¤Ç¤Ê¤±¤ì¤Ð 0 ¤òÊÖ¤·¡¢¸Æ¤Ó
+    ½Ð¤·Â¦¤Ï¡¢¤¿¤È¤¨¤ÐƱ¤¸¥­¡¼¤Ç´Ø¿ô minput_lookup () ¤ò¸Æ¤Ö¤Ê¤É¤·¤Æ¡¢
+    ¤³¤Î¥­¡¼¤ò½èÍý¤¹¤ë¡£
 
     @latexonly \IPAlabel{minput_filter} @endlatexonly
 */
@@ -2198,7 +2298,6 @@ minput_filter (MInputContext *ic, MSymbol key, void *arg)
        minput__callback (ic, Minput_status_draw);
       if (ic->candidates_changed)
        minput__callback (ic, Minput_candidates_draw);
-      ic->preedit_changed = ic->status_changed = ic->candidates_changed = 0;
     }
 
   return ret;
@@ -2216,31 +2315,29 @@ minput_filter (MInputContext *ic, MSymbol key, void *arg)
     If a text was produced by the input method, it is concatenated
     to M-text $MT.
 
-    This function calls #MInputDriver::lookup.
+    This function calls #MInputDriver::lookup .
 
     @return
     If $KEY was correctly handled by the input method, this function
     returns 0.  Otherwise, returns -1, even in that case, some text
     may be produced in $MT.  */
 
-/***oldja
-    @brief ÆþÎϥ᥽¥Ã¥É¤¬ºî¤Ã¤¿¥Æ¥­¥¹¥È¤Î³ÍÆÀ
+/***ja
+    @brief ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥ÈÃæ¤Î¥Æ¥­¥¹¥È¤Î¸¡º÷.
 
-    ´Ø¿ô minput_lookup () ¤ÏÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È $IC Ãæ¤Î¥Æ¥­¥¹¥È¤ò³ÍÆÀ¤¹
+    ´Ø¿ô minput_lookup () ¤ÏÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È $IC Ãæ¤Î¥Æ¥­¥¹¥È¤ò¸¡º÷¤¹
     ¤ë¡£$KEY ¤Ï´Ø¿ôminput_filter () ¤Ø¤ÎľÁ°¤Î¸Æ¤Ó½Ð¤·¤ËÍѤ¤¤é¤ì¤¿¤â¤Î
     ¤ÈƱ¤¸¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
 
-    ¥Æ¥­¥¹¥È¤¬ÆþÎϥ᥽¥Ã¥É¤Ë¤è¤Ã¤ÆÀ¸À®¤µ¤ì¤Æ¤¤¤ì¤Ð¡¢$IC->produced ¤ËÊÝ
-    »ý¤µ¤ì¤Æ¤¤¤ë¡£
+    ¥Æ¥­¥¹¥È¤¬ÆþÎϥ᥽¥Ã¥É¤Ë¤è¤Ã¤ÆÀ¸À®¤µ¤ì¤Æ¤¤¤ì¤Ð¡¢¥Æ¥­¥¹¥È¤Ï M-text
+    $MT ¤ËÏ¢·ë¤µ¤ì¤ë¡£
 
-     ¤³¤Î´Ø¿ô¤Ï¡¢X ¥¦¥£¥ó¥É¥¦¤Î <tt>XLookupString ()</tt> ¡¢
-    <tt>XmbLookupString ()</tt> ¡¢<tt>XwcLookupString ()</tt> ¤ËÂбþ¤¹
-    ¤ë¡£
+    ¤³¤Î´Ø¿ô¤Ï¡¢#MInputDriver::lookup ¤ò¸Æ¤Ö¡£
 
-    @return
-    $KEY ¤¬ÆþÎϥ᥽¥Ã¥É¤Ë¤è¤Ã¤ÆŬÀڤ˽èÍý¤Ç¤­¤Æ¤¤¤ì¤Ð¡¢¤³¤Î´Ø¿ô¤Ï 0 ¤ò
-    ÊÖ¤¹¡£¤½¤¦¤Ç¤Ê¤±¤ì¤Ð -1 ¤òÊÖ¤·¡¢¤³¤Î¾ì¹ç¤Ç¤â$IC->produced ¤Ë²¿¤é¤«
-    ¤Î¥Æ¥­¥¹¥È¤¬À¸À®¤µ¤ì¤Æ¤¤¤ë¤³¤È¤¬¤¢¤ë¡£
+    @return 
+    $KEY ¤¬ÆþÎϥ᥽¥Ã¥É¤Ë¤è¤Ã¤ÆŬÀڤ˽èÍý¤Ç¤­¤ì¤Ð¡¢¤³¤Î´Ø¿ô¤Ï 0 ¤òÊÖ¤¹¡£
+    ¤½¤¦¤Ç¤Ê¤±¤ì¤Ð -1 ¤òÊÖ¤¹¡£¤³¤Î¾ì¹ç¤Ç¤â $MT ¤Ë²¿¤é¤«¤Î¥Æ¥­¥¹¥È¤¬À¸
+    À®¤µ¤ì¤Æ¤¤¤ë¤³¤È¤¬¤¢¤ë¡£
 
     @latexonly \IPAlabel{minput_lookup} @endlatexonly  */
 
@@ -2255,34 +2352,40 @@ minput_lookup (MInputContext *ic, MSymbol key, void *arg, MText *mt)
     @brief Set the spot of the input context.
 
     The minput_set_spot () function set the spot of input context $IC
-    to coordinate ($X, $Y) with the height $ASCENT and $DESCENT.
+    to coordinate ($X, $Y ) with the height $ASCENT and $DESCENT .
+    The semantics of these values depend on the input method driver.
     $FONTSIZE specfies the fontsize of a preedit text in 1/10 point.
-    The semantics of these values depend on the input driver.
 
-    For instance, an input driver designed to work in CUI environment
-    may use $X and $Y as column and row numbers, and ignore $ASCENT
-    and $DESCENT.  An input driver designed to work on a window system
-    may treat $X and $Y as pixel offsets relative to the origin of the
+    For instance, an driver designed to work in CUI environment may
+    use $X and $Y as column and row numbers, and ignore $ASCENT and
+    $DESCENT .  An driver designed to work on a window system may
+    treat $X and $Y as pixel offsets relative to the origin of the
     client window, and treat $ASCENT and $DESCENT as ascent and
-    descent pixels of a line at ($X . $Y).
+    descent pixels of a line at ($X . $Y ).
 
     $MT and $POS is an M-text and a character position at the spot.
-    $MT may be NULL, in which case, the input method can't get
+    $MT may be @c NULL, in which case, the input method cannot get
     information about the text around the spot.  */
 
-/***oldja
+/***ja
     @brief ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¤Î¥¹¥Ý¥Ã¥È¤òÀßÄꤹ¤ë
 
     ´Ø¿ô minput_set_spot () ¤Ï¡¢ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È $IC ¤Î¥¹¥Ý¥Ã¥È¤ò¡¢ºÂ
-    É¸ ($X, $Y)¤Ë ¡¢¹â¤µ $ASCENT¡¢$DESCENT ¤ÇÀßÄꤹ¤ë¡£¤³¤ì¤é¤ÎÃͤΰÕ
-    Ì£¤ÏÆþÎϥɥ饤¥Ð¤Ë°Í¸¤¹¤ë¡£
-
-    ¤¿¤È¤¨¤Ð CUI ´Ä¶­¤ÇÆ°ºî¤¹¤ëÆþÎϥɥ饤¥Ð¤Ï $X, $Y ¤ò¤½¤ì¤¾¤ìÎó¤È¹Ô
-    ¤ÎÈÖ¹æ¤È¤·¤ÆÍѤ¤¡¢$ASCENT¡¢$DESCENT ¤ò̵»ë¤¹¤ë¤«¤â¤·¤ì¤Ê¤¤¡£ ¤Þ¤¿
-    ¥¦¥£¥ó¥É¥¦¥·¥¹¥Æ¥àÍѤÎÆþÎϥɥ饤¥Ð¤Ï $X,$Y ¤ò¥¯¥é¥¤¥¢¥ó¥È¥¦¥£¥ó¥É
-    ¥¦¤Î¸¶ÅÀ¤«¤é¤Î¥ª¥Õ¥»¥Ã¥È¤ò¥Ô¥¯¥»¥ëñ°Ì¤Çɽ¤·¤¿¤â¤Î¤È¤·¤Æ°·¤¤¡¢
-    $ASCENT ¤È $DESCENT ¤ò ($X . $Y) ¤ÎÎó¤Î¥¢¥»¥ó¥È¤È¥Ç¥£¥»¥ó¥È¤ò¥Ô¥¯
-    ¥»¥ëñ°Ì¤Çɽ¤·¤¿¤â¤Î¤È¤·¤Æ°·¤¦¤«¤â¤·¤ì¤Ê¤¤¡£  */
+    É¸ ($X, $Y )¤Ë ¡¢¹â¤µ $ASCENT¡¢ $DESCENT ¤ÇÀßÄꤹ¤ë¡£ ¤³¤ì¤é¤ÎÃͤÎ
+    °ÕÌ£¤ÏÆþÎϥ᥽¥Ã¥É¥É¥é¥¤¥Ð¤Ë°Í¸¤¹¤ë¡£$FONTSIZE ¤Ïpreedit ¥Æ¥­¥¹¥È
+    ¤Î¥Õ¥©¥ó¥È¥µ¥¤¥º¤ò 1/10 ¥Ý¥¤¥ó¥Èñ°Ì¤Ç»ØÄꤹ¤ë¡£
+
+    ¤¿¤È¤¨¤Ð CUI ´Ä¶­¤ÇÆ°ºî¤¹¤ë¥É¥é¥¤¥Ð¤Ï $X ¤È $Y ¤ò¤½¤ì¤¾¤ìÎó¤È¹Ô¤Î
+    ÈÖ¹æ¤È¤·¤ÆÍѤ¤¡¢$ASCENT ¤È $DESCENT ¤ò̵»ë¤¹¤ë¤«¤â¤·¤ì¤Ê¤¤¡£ ¤Þ¤¿
+    ¥¦¥£¥ó¥É¥¦¥·¥¹¥Æ¥àÍѤΥɥ饤¥Ð¤Ï $X ¤È $Y ¤ò¥¯¥é¥¤¥¢¥ó¥È¥¦¥£¥ó¥É¥¦
+    ¤Î¸¶ÅÀ¤«¤é¤Î¥ª¥Õ¥»¥Ã¥È¤ò¥Ô¥¯¥»¥ëñ°Ì¤Çɽ¤·¤¿¤â¤Î¤È¤·¤Æ°·¤¤¡¢
+    $ASCENT ¤È $DESCENT ¤ò ($X . $Y ) ¤ÎÎó¤Î¥¢¥»¥ó¥È¤È¥Ç¥£¥»¥ó¥È¤ò¥Ô¥¯
+    ¥»¥ëñ°Ì¤Çɽ¤·¤¿¤â¤Î¤È¤·¤Æ°·¤¦¤«¤â¤·¤ì¤Ê¤¤¡£
+
+    $MT ¤È $POS ¤Ï¤½¤Î¥¹¥Ý¥Ã¥È¤Î M-text ¤Èʸ»ú°ÌÃ֤Ǥ¢¤ë¡£$MT ¤Ï @c
+    NULL ¤Ç¤â¤è¤¯¡¢¤½¤Î¾ì¹ç¤Ë¤ÏÆþÎϥ᥽¥Ã¥É¤Ï¥¹¥Ý¥Ã¥È¼þÊդΥƥ­¥¹¥È¤Ë
+    ´Ø¤¹¤ë¾ðÊó¤òÆÀ¤ë¤³¤È¤¬¤Ç¤­¤Ê¤¤¡£
+    */
 
 void
 minput_set_spot (MInputContext *ic, int x, int y,
@@ -2306,6 +2409,12 @@ minput_set_spot (MInputContext *ic, int x, int y,
 
     The minput_toggle () function toggles the input method associated
     with the input context $IC.  */
+/***ja
+    @brief ÆþÎϥ᥽¥Ã¥É¤òÀÚÂؤ¨¤ë.
+
+    ´Ø¿ô minput_toggle () ¤ÏÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È $IC ¤ËÂбþÉÕ¤±¤é¤ì¤¿ÆþÎÏ
+    ¥á¥½¥Ã¥É¤ò¥È¥°¥ë¤¹¤ë¡£
+    */
 
 void
 minput_toggle (MInputContext *ic)
@@ -2315,6 +2424,32 @@ minput_toggle (MInputContext *ic)
   ic->active = ! ic->active;
 }
 
+/***en
+    @brief Reset an input context.
+
+    The minput_reset_ic () function resets the input context $IC by
+    calling a callback functions corresponding to #Minput_reset.  It
+    actually shifts the state to the initial one, and thus the current
+    preediting text (if any) is committed.  If necessary, a program
+    can extract that text by calling minput_lookup () just after the
+    call of minput_reset_ic ().  In that case, the arguments @c KEY
+    and @c ARG of minput_lookup () are ignored.  */
+/***ja
+    @brief ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¤ò¥ê¥»¥Ã¥È¤¹¤ë.
+
+    ´Ø¿ô minput_reset_ic () ¤Ï #Minput_reset ¤ËÂбþ¤¹¤ë¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô
+    ¤ò¸Æ¤Ö¤³¤È¤Ë¤è¤Ã¤ÆÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È $IC ¤ò¥ê¥»¥Ã¥È¤¹¤ë¡£¤³¤ì¤Ï¼ÂºÝ¤Ï
+    ÆþÎϥ᥽¥Ã¥É¤ò½é´ü¾õÂ֤˥·¥Õ¥È¤µ¤»¤ë¡£¤·¤¿¤¬¤Ã¤Æ¡¢¤â¤·¸½ºßÆþÎÏÃæ¤Î
+    ¥Æ¥­¥¹¥È¤¬¤¢¤ì¤Ð¡¢¤½¤ì¤Ï¥³¥ß¥Ã¥È¤µ¤ì¤ë¡£É¬Íפʤ饢¥×¥ê¥±¡¼¥·¥ç¥ó¥×
+    ¥í¥°¥é¥à¤Ï minput_lookup () ¤òÆɤó¤Ç¤½¤Î¥Æ¥­¥¹¥È¤ò¼è¤ê½Ð¤»¤ë¡£¤½¤Î
+    ºÝ¡¢minput_lookup () ¤Î°ú¿ô @c KEY ¤È @c ARG ¤Ï̵»ë¤µ¤ì¤ë¡£ */
+void
+minput_reset_ic (MInputContext *ic)
+{
+  if (ic->im->driver.callback_list)
+    minput__callback (ic, Minput_reset);
+}
+
 
 /*** @} */
 /*=*/
@@ -2324,7 +2459,7 @@ minput_toggle (MInputContext *ic)
 /*=*/
 
 /***en
-    @brief Dump an input method
+    @brief Dump an input method.
 
     The mdebug_dump_im () function prints the input method $IM in a
     human readable way to the stderr.  $INDENT specifies how many
@@ -2332,6 +2467,14 @@ minput_toggle (MInputContext *ic)
 
     @return
     This function returns $IM.  */
+/***ja
+    @brief ÆþÎϥ᥽¥Ã¥É¤ò¥À¥ó¥×¤¹¤ë.
+
+    ´Ø¿ô mdebug_dump_im () ¤ÏÆþÎϥ᥽¥Ã¥É $IM ¤ò stderr ¤Ë¿Í´Ö¤Ë²ÄÆɤÊ
+    ·Á¤Ç°õºþ¤¹¤ë¡£$INDENT ¤Ï£²¹ÔÌܰʹߤΥ¤¥ó¥Ç¥ó¥È¤ò»ØÄꤹ¤ë¡£
+
+    @return
+    ¤³¤Î´Ø¿ô¤Ï $IM ¤òÊÖ¤¹¡£  */
 
 MInputMethod *
 mdebug_dump_im (MInputMethod *im, int indent)