(mflt_dump_gstring): Document it.
[m17n/m17n-lib.git] / src / m17n-core.h
index d0009ee..da5cdf2 100644 (file)
@@ -1,5 +1,5 @@
 /* m17n-core.h -- header file for the CORE API of the m17n library.
-   Copyright (C) 2003, 2004
+   Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
      National Institute of Advanced Industrial Science and Technology (AIST)
      Registration Number H15PRO112
 
 
    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.  */
 
 #ifndef _M17N_CORE_H_
 #define _M17N_CORE_H_
 
 #ifdef __cplusplus
-extern "C"
-{
+#define M17N_BEGIN_HEADER extern "C" {
+#define M17N_END_HEADER }
+#else
+#define M17N_BEGIN_HEADER      /* do nothing */
+#define M17N_END_HEADER                /* do nothing */
 #endif
 
+M17N_BEGIN_HEADER
+
 /*
  * Header file for m17n library.
  */
@@ -38,16 +43,22 @@ extern "C"
 /***ja @defgroup m17nIntro ¤Ï¤¸¤á¤Ë  */
 /*=*/
 
+#if !defined (FOR_DOXYGEN) || defined (DOXYGEN_INTERNAL_MODULE)
+
 #define M17NLIB_MAJOR_VERSION 1
-#define M17NLIB_MINOR_VERSION 1
-#define M17NLIB_PATCH_LEVEL 0
-#define M17NLIB_VERSION_NAME "1.1.0"
+#define M17NLIB_MINOR_VERSION 6
+#define M17NLIB_PATCH_LEVEL 1
+#define M17NLIB_VERSION_NAME "1.6.1"
 
 extern void m17n_init_core (void);
 #define M17N_INIT() m17n_init_core ()
 extern void m17n_fini_core (void);
 #define M17N_FINI() m17n_fini_core ()
 
+extern int merror_code;
+
+#endif
+
 /*=*/
 
 /*** @ingroup m17nIntro */
@@ -78,12 +89,16 @@ enum M17NStatus
 
 extern enum M17NStatus m17n_status (void);
 
-/***en @defgroup m17nCore CORE API  */
-/***ja @defgroup m17nCore ¥³¥¢ API */
+/***en @defgroup m17nCore CORE API
+    @brief API provided by libm17n-core.so */
+/***ja @defgroup m17nCore ¥³¥¢ API
+    @brief libm17n-core.so ¤¬Ä󶡤¹¤ë API */
 /*=*/
 /*** @ingroup m17nCore */
-/***en @defgroup m17nObject Managed Object */
-/***ja @defgroup m17nObject ´ÉÍý²¼¥ª¥Ö¥¸¥§¥¯¥È */
+/***en @defgroup m17nObject Managed Object
+    @brief Objects managed by the reference count */
+/***ja @defgroup m17nObject ´ÉÍý²¼¥ª¥Ö¥¸¥§¥¯¥È
+    @brief »²¾È²ó¿ô¤Ç´ÉÍý¤µ¤ì¤ë¥ª¥Ö¥¸¥§¥¯¥È */
 /*=*/
 
 /*** @ingroup m17nObject  */
@@ -97,14 +112,14 @@ extern enum M17NStatus m17n_status (void);
 /***ja
     @brief ´ÉÍý²¼¥ª¥Ö¥¸¥§¥¯¥È¤ÎºÇ½é¤Î¥á¥ó¥Ð.
 
-    ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é¥à¤¬¿·¤·¤¤¹½Â¤ÂΤò´ÉÍý²¼¥ª¥Ö¥¸¥§¥¯¥È¤È¤·¤Æ
-     ÄêµÁ¤¹¤ëºÝ¤Ë¤Ï¡¢ºÇ½é¤Î¥á¥ó¥Ð¤Ï @c #M17NObjectHead ¹½Â¤Âη¿¤Ç¤Ê¤¯
-     ¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£@c #M17NObjectHead ¤ÎÆâÍƤϠm17n ¥é¥¤¥Ö¥é¥ê¤¬»ÈÍѤ¹
-     ¤ë¤Î¤Ç¡¢¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é¥à¤Ï¿¨¤ì¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
-     */
+    ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é¥à¤¬¿·¤·¤¤¹½Â¤ÂΤò´ÉÍý²¼¥ª¥Ö¥¸¥§¥¯¥È¤È¤·¤ÆÄêµÁ¤¹¤ëºÝ¤Ë¤Ï¡¢ºÇ½é¤Î¥á¥ó¥Ð¤Ï 
+    @c #M17NObjectHead ¹½Â¤Âη¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
+    @c #M17NObjectHead ¤ÎÆâÍƤϠm17n 
+    ¥é¥¤¥Ö¥é¥ê¤¬»ÈÍѤ¹¤ë¤Î¤Ç¡¢¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é¥à¤Ï¿¨¤ì¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£    */
 
 typedef struct
 {
+  /*** Hidden from applications.  */
   void *filler[2];
 } M17NObjectHead;
 
@@ -119,6 +134,43 @@ extern int m17n_object_ref (void *object);
 /* Decrement the reference count of managed object OBJECT.  */
 extern int m17n_object_unref (void *object);
 
+/*** @ingroup m17nCore */
+/***en
+    @brief Generic function type.
+
+    #M17NFunc is a generic function type for setting a function
+    pointer as a value of #MSymbol property or #MPlist.  */
+
+/***ja
+    @brief ÈÆ´Ø¿ô·¿.
+
+    #M17NFunc ¤ÏÈÆ´Ø¿ô·¿¤Ç¤¢¤ê¡¢´Ø¿ô¥Ý¥¤¥ó¥¿¤ò #MSymbol ¥×¥í¥Ñ¥Æ¥£¤ä
+    #MPlist ¤ÎÃͤȤ·¤ÆÀßÄꤹ¤ëºÝÍѤ¤¤ë¡£  */
+
+
+/***
+    @seealso
+    msymbol_put_func (), msymbol_get_func (),
+    mplist_put_func (), mplist_get_func ().  */
+
+typedef void (*M17NFunc) (void);
+
+/*=*/
+
+/*** @ingroup m17nCore */
+/***en
+    @brief Wrapper for a generic function type.
+
+    The macro M17N_FUNC () casts a function to the type #M17NFunc.  */
+
+/***ja
+    @brief ÈÆ´Ø¿ô·¿¤Ø¤Î¥é¥Ã¥Ñ.
+
+    ¥Þ¥¯¥í M17N_FUNC () ¤Ï´Ø¿ô¤ò #M17NFunc ·¿¤Ø¥­¥ã¥¹¥È¤¹¤ë¡£  */
+
+
+#define M17N_FUNC(func) ((M17NFunc) (func))
+
 /*=*/
 
 /* (C2) Symbol handling */
@@ -139,8 +191,8 @@ extern int m17n_object_unref (void *object);
 /***ja
     @brief ¥·¥ó¥Ü¥ë¤Î·¿Àë¸À.
 
-    #MSymbol ¤Ï¥·¥ó¥Ü¥ë¥ª¥Ö¥¸¥§¥¯¥È¤Î·¿¤Ç¤¢¤ë¡£ÆâÉô¹½Â¤¤Ï¥¢¥×¥ê¥±¡¼¥·¥ç
-    ¥ó¥×¥í¥°¥é¥à¤«¤é¤Ï¸«¤¨¤Ê¤¤¡£  */
+    #MSymbol ¤Ï @e ¥·¥ó¥Ü¥ë (symbol) ¥ª¥Ö¥¸¥§¥¯¥È¤Î·¿¤Ç¤¢¤ë¡£
+    ÆâÉô¹½Â¤¤Ï¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é¥à¤«¤é¤Ï¸«¤¨¤Ê¤¤¡£  */
 
 typedef struct MSymbolStruct *MSymbol;
 
@@ -152,6 +204,7 @@ extern MSymbol Mt;
 extern MSymbol Mstring;
 extern MSymbol Msymbol;
 extern MSymbol Mtext;
+extern MSymbol Mcharset;
 
 /* Return a symbol of name NAME.  */
 extern MSymbol msymbol (const char *name);
@@ -159,6 +212,9 @@ extern MSymbol msymbol (const char *name);
 /* Return a managing key of name NAME.  */
 extern MSymbol msymbol_as_managing_key (const char *name);
 
+/* Check if SYMBOL is a managing key.  */
+extern int msymbol_is_managing_key (MSymbol symbol);
+
 /* Return a symbol of name NAME if it already exists.  */
 extern MSymbol msymbol_exist (const char *name);
 
@@ -171,6 +227,10 @@ extern int msymbol_put (MSymbol symbol, MSymbol key, void *val);
 /*** Return KEY property value of SYMBOL.  */
 extern void *msymbol_get (MSymbol symbol, MSymbol key);
 
+extern int msymbol_put_func (MSymbol symbol, MSymbol key, M17NFunc func);
+
+extern M17NFunc msymbol_get_func (MSymbol symbol, MSymbol key);
+
 /* 
  *  (2-1) Property List
  */
@@ -214,6 +274,10 @@ extern MPlist *mplist_put (MPlist *plist, MSymbol key, void *val);
 
 extern void *mplist_get (MPlist *plist, MSymbol key);
 
+extern MPlist *mplist_put_func (MPlist *plist, MSymbol key, M17NFunc func);
+
+extern M17NFunc mplist_get_func (MPlist *plist, MSymbol key);
+
 extern MPlist *mplist_find_by_key (MPlist *plist, MSymbol key);
 
 extern MPlist *mplist_find_by_value (MPlist *plist, void *val);
@@ -236,8 +300,10 @@ extern void *mplist_value (MPlist *plist);
 /***ja @defgroup m17nCharacter Ê¸»ú */
 /*=*/
 
+#if !defined (FOR_DOXYGEN) || defined (DOXYGEN_INTERNAL_MODULE)
 #define MCHAR_MAX 0x3FFFFF
 /*#define MCHAR_MAX 0x7FFFFFFF*/
+#endif
 
 extern MSymbol Mscript;
 extern MSymbol Mname;
@@ -246,6 +312,8 @@ extern MSymbol Mcombining_class;
 extern MSymbol Mbidi_category;
 extern MSymbol Msimple_case_folding;
 extern MSymbol Mcomplicated_case_folding;
+extern MSymbol Mcased, Msoft_dotted, Mcase_mapping;
+extern MSymbol Mblock;
 
 extern MSymbol mchar_define_property (const char *name, MSymbol type);
 
@@ -280,6 +348,10 @@ typedef struct MCharTable MCharTable;
 
 extern MCharTable *mchartable (MSymbol key, void *default_value);
 
+extern int mchartable_min_char (MCharTable *table);
+
+extern int mchartable_max_char (MCharTable *table);
+
 extern void *mchartable_lookup (MCharTable *table, int c);
 
 extern int mchartable_set (MCharTable *table, int c, void *val);
@@ -288,12 +360,13 @@ extern int mchartable_set_range (MCharTable *table, int from, int to,
                                 void *val);
 
 extern int mchartable_map (MCharTable *table, void *ignore,
-                          void (*func) (int from, int to,
-                                        void *val, void *arg), 
+                          void (*func) (int, int, void *, void *), 
                           void *func_arg);
 
 extern void mchartable_range (MCharTable *table, int *from, int *to);
 
+extern MCharTable *mchar_get_prop_table (MSymbol key, MSymbol *type);
+
 /*
  *  (5) Handling M-text.
  *     "M" of M-text stands for:
@@ -342,17 +415,23 @@ typedef struct MText MText;
 /***ja
     @brief M-text ¤Î¥Õ¥©¡¼¥Þ¥Ã¥È¤ò»ØÄꤹ¤ëÎóµó·¿.
 
-    Îóµó·¿ #MTextFormat ¤Ï
-    ´Ø¿ô mtext_from_data () ¤Î°ú¿ô¤È¤·¤ÆÍѤ¤¤é¤ì¡¢
+    Îóµó·¿ #MTextFormat ¤Ï´Ø¿ô
+    mtext_from_data () ¤Î°ú¿ô¤È¤·¤ÆÍѤ¤¤é¤ì¡¢
     M-text ¤òÀ¸À®¤¹¤ë¸µ¤È¤Ê¤ë¥Ç¡¼¥¿¤Î¥Õ¥©¡¼¥Þ¥Ã¥È¤ò»ØÄꤹ¤ë¡£  */
 
 enum MTextFormat
   {
+    /*** US-ASCII encoding */
     MTEXT_FORMAT_US_ASCII,
+    /*** UTF-8 encoding */
     MTEXT_FORMAT_UTF_8,
+    /*** UTF-16LE encoding  */
     MTEXT_FORMAT_UTF_16LE,
+    /*** UTF-16BE encoding  */
     MTEXT_FORMAT_UTF_16BE,
+    /*** UTF-32LE encoding  */
     MTEXT_FORMAT_UTF_32LE,
+    /*** UTF-32BE encoding  */
     MTEXT_FORMAT_UTF_32BE,
     MTEXT_FORMAT_MAX
   };
@@ -360,28 +439,31 @@ enum MTextFormat
 
 extern MText *mtext ();
 
+extern void *mtext_data (MText *mt, enum MTextFormat *fmt, int *nunits,
+                        int *pos_idx, int *unit_idx);
+
 /*=*/
 
-/*** @ingroup m17nMtext */
-/***en @name Variables: System's UTF-16 and UTF-32 types */
-/***ja @name ÊÑ¿ô: ¥·¥¹¥Æ¥à¤Î UTF-16 ¤È UTF-32 ¤Î¥¿¥¤¥× */
+/***en @name Variables: Default Endian of UTF-16 and UTF-32 */
+/***ja @name ÊÑ¿ô: UTF-16 ¤È UTF-32 ¤Î¥Ç¥Õ¥©¥ë¥È¤Î¥¨¥ó¥Ç¥£¥¢¥ó */
 /*** @{ */
 /*=*/
 
+/*** @ingroup m17nMtext */
 /***en
     @brief Variable of value MTEXT_FORMAT_UTF_16LE or MTEXT_FORMAT_UTF_16BE.
 
     The global variable #MTEXT_FORMAT_UTF_16 is initialized to
     #MTEXT_FORMAT_UTF_16LE on a "Little Endian" system (storing words
     with the least significant byte first), and to
-    #MTEXT_FORMAT_UTF_16BE depneding on a "Big Endian" system (storing
-    words with the most significant byte first).  */
+    #MTEXT_FORMAT_UTF_16BE on a "Big Endian" system (storing words
+    with the most significant byte first).  */
 
 /***ja
     @brief Ãͤ¬ MTEXT_FORMAT_UTF_16LE ¤« MTEXT_FORMAT_UTF_16BE ¤Ç¤¢¤ëÊÑ¿ô
 
-    Âç°èÊÑ¿ô #MTEXT_FORMAT_UTF_16 ¤Ï¥ê¥È¥ë¡¦¥¨¥ó¥Ç¥£¥¢¥ó¡¦¥·¥¹¥Æ¥à¡Ê¥ï¡¼
-    ¥É¤ò LSB (Least Significant Byte) ¤òÀè¤Ë¤·¤Æ³ÊǼ¡Ë¾å¤Ç¤Ï
+    Âç°èÊÑ¿ô #MTEXT_FORMAT_UTF_16 ¤Ï¥ê¥È¥ë¡¦¥¨¥ó¥Ç¥£¥¢¥ó¡¦¥·¥¹¥Æ¥à
+    ¡Ê¥ï¡¼¥É¤ò LSB (Least Significant Byte) ¤òÀè¤Ë¤·¤Æ³ÊǼ¡Ë¾å¤Ç¤Ï
     #MTEXT_FORMAT_UTF_16LE ¤Ë½é´ü²½¤µ¤ì¡¢¥Ó¥Ã¥°¡¦¥¨¥ó¥Ç¥£¥¢¥ó¡¦¥·¥¹¥Æ¥à
     ¡Ê¥ï¡¼¥É¤ò MSB (Most Significant Byte) ¤òÀè¤Ë¤·¤Æ³ÊǼ¡Ë¾å¤Ç¤Ï
     #MTEXT_FORMAT_UTF_16BE ¤Ë½é´ü²½¤µ¤ì¤ë¡£  */
@@ -390,23 +472,24 @@ extern MText *mtext ();
     @seealso
     mtext_from_data ()  */
 
-extern const int MTEXT_FORMAT_UTF_16;
+extern const enum MTextFormat MTEXT_FORMAT_UTF_16;
 /*=*/
 
+/*** @ingroup m17nMtext */
 /***en
     @brief Variable of value MTEXT_FORMAT_UTF_32LE or MTEXT_FORMAT_UTF_32BE.
 
     The global variable #MTEXT_FORMAT_UTF_32 is initialized to
     #MTEXT_FORMAT_UTF_32LE on a "Little Endian" system (storing words
     with the least significant byte first), and to
-    #MTEXT_FORMAT_UTF_32BE depneding on a "Big Endian" system (storing
+    #MTEXT_FORMAT_UTF_32BE on a "Big Endian" system (storing
     words with the most significant byte first).  */
 
 /***ja
     @brief Ãͤ¬ MTEXT_FORMAT_UTF_32LE ¤« MTEXT_FORMAT_UTF_32BE ¤Ç¤¢¤ëÊÑ¿ô
 
-    Âç°èÊÑ¿ô #MTEXT_FORMAT_UTF_32 ¤Ï¥ê¥È¥ë¡¦¥¨¥ó¥Ç¥£¥¢¥ó¡¦¥·¥¹¥Æ¥à¡Ê¥ï¡¼
-    ¥É¤ò LSB (Least Significant Byte) ¤òÀè¤Ë¤·¤Æ³ÊǼ¡Ë¾å¤Ç¤Ï
+    Âç°èÊÑ¿ô #MTEXT_FORMAT_UTF_32 ¤Ï¥ê¥È¥ë¡¦¥¨¥ó¥Ç¥£¥¢¥ó¡¦¥·¥¹¥Æ¥à
+    ¡Ê¥ï¡¼¥É¤ò LSB (Least Significant Byte) ¤òÀè¤Ë¤·¤Æ³ÊǼ¡Ë¾å¤Ç¤Ï
     #MTEXT_FORMAT_UTF_32LE ¤Ë½é´ü²½¤µ¤ì¡¢¥Ó¥Ã¥°¡¦¥¨¥ó¥Ç¥£¥¢¥ó¡¦¥·¥¹¥Æ¥à
     ¡Ê¥ï¡¼¥É¤ò MSB (Most Significant Byte) ¤òÀè¤Ë¤·¤Æ³ÊǼ¡Ë¾å¤Ç¤Ï
     #MTEXT_FORMAT_UTF_32BE ¤Ë½é´ü²½¤µ¤ì¤ë¡£  */
@@ -417,15 +500,17 @@ extern const int MTEXT_FORMAT_UTF_16;
 
 extern const int MTEXT_FORMAT_UTF_32;
 
+/*=*/
 /*** @} */
-
 /*=*/
 
 extern MText *mtext_from_data (const void *data, int nitems,
                               enum MTextFormat format);
 
-
 /*=*/
+/*** @} */
+
+extern MSymbol Mlanguage;
 
 /*
  *  (5-2) Functions to manipulate M-texts.  They correspond to string
@@ -453,8 +538,13 @@ extern int mtext_del (MText *mt, int from, int to);
 
 extern int mtext_ins (MText *mt1, int pos, MText *mt2);
 
+extern int mtext_insert (MText *mt1, int pos, MText *mt2, int from, int to);
+
 extern int mtext_ins_char (MText *mt, int pos, int c, int n);
 
+extern int mtext_replace (MText *mt1, int from1, int to1,
+                         MText *mt2, int from2, int to2);
+
 extern MText *mtext_cat_char (MText *mt, int c);
 
 extern MText *mtext_duplicate (MText *mt, int from, int to);
@@ -493,6 +583,36 @@ extern int mtext_casecmp (MText *mt1, MText *mt2);
 
 extern int mtext_ncasecmp (MText *mt1, MText *mt2, int n);
 
+extern int mtext_lowercase (MText *mt);
+
+extern int mtext_titlecase (MText *mt);
+
+extern int mtext_uppercase (MText *mt);
+
+/*** @ingroup m17nMtext */
+/***en
+    @brief Enumeration for specifying a set of line breaking option.
+
+    The enum #MTextLineBreakOption is to control the line breaking
+    algorithm of the function mtext_line_break () by specifying
+    logical-or of the members in the arg @e option.  */
+
+enum MTextLineBreakOption
+  {
+    /***en Specify the legacy support for space character as base for
+       combining marks.  See the section 8.3 of UAX#14. */
+    MTEXT_LBO_SP_CM = 1,
+    /***en Specify to use space characters for line breaking Korean
+       text.  */
+    MTEXT_LBO_KOREAN_SP = 2,
+    /***en Specify to treat characters of ambiguous line-breaking
+       class as of ideographic line-breaking class.  */
+    MTEXT_LBO_AI_AS_ID = 4,
+    MTEXT_LBO_MAX
+  };
+
+extern int mtext_line_break (MText *mt, int pos, int option, int *after);
+
 /*** @ingroup m17nPlist */
 extern MPlist *mplist_deserialize (MText *mt);
 
@@ -508,7 +628,7 @@ extern MPlist *mplist_deserialize (MText *mt);
 /***en
     @brief Flag bits to control text property.
 
-    The mtext_property () funciton accepts logical OR of these flag
+    The mtext_property () function accepts logical OR of these flag
     bits as an argument.  They control the behaviour of the created
     text property as described in the documentation of each flag
     bit.  */
@@ -516,45 +636,43 @@ extern MPlist *mplist_deserialize (MText *mt);
 /***ja
     @brief ¥Æ¥­¥¹¥È¥×¥í¥Ñ¥Æ¥£¤òÀ©¸æ¤¹¤ë¥Õ¥é¥°¥Ó¥Ã¥È.
 
-    ´Ø¿ô mtext_property () ¤Ï°Ê²¼¤Î¥Õ¥é¥°¥Ó¥Ã¥È¤ÎÏÀÍý OR ¤ò°ú¿ô¤È¤·¤Æ
-    ¤È¤ë¤³¤È¤¬¤Ç¤­¤ë¡£¥Õ¥é¥°¥Ó¥Ã¥È¤ÏÀ¸À®¤µ¤ì¤¿¥Æ¥­¥¹¥È¥×¥í¥Ñ¥Æ¥£¤Î¿¶Éñ
-    ¤¤¤òÀ©¸æ¤¹¤ë¡£¾ÜºÙ¤Ï³Æ¥Õ¥é¥°¥Ó¥Ã¥È¤ÎÀâÌÀ¤ò»²¾È¡£*/
+    ´Ø¿ô mtext_property () ¤Ï°Ê²¼¤Î¥Õ¥é¥°¥Ó¥Ã¥È¤ÎÏÀÍý
+    OR ¤ò°ú¿ô¤È¤·¤Æ¤È¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
+    ¥Õ¥é¥°¥Ó¥Ã¥È¤ÏÀ¸À®¤µ¤ì¤¿¥Æ¥­¥¹¥È¥×¥í¥Ñ¥Æ¥£¤Î¿¶Éñ¤¤¤òÀ©¸æ¤¹¤ë¡£
+    ¾ÜºÙ¤Ï³Æ¥Õ¥é¥°¥Ó¥Ã¥È¤ÎÀâÌÀ¤ò»²¾È¡£*/
 
 enum MTextPropertyControl
   {
     /***en If this flag bit is on, an M-text inserted at the start
        position or at the middle of the text property inherits the
        text property.  */
-    /***ja ¤³¤Î¥Ó¥Ã¥È¤¬ on ¤Ê¤é¤Ð¡¢¤³¤Î¥Æ¥­¥¹¥È¥×¥í¥Ñ¥Æ¥£¤Î»Ï¤Þ¤ëÅÀ¤¢
-       ¤ë¤¤¤ÏÃæ´Ö¤ËÁÞÆþ¤µ¤ì¤¿ M-text ¤Ï¤³¤Î¥Æ¥­¥¹¥È¥×¥í¥Ñ¥Æ¥£¤ò·Ñ¾µ¤¹¤ë¡£
+    /***ja ¤³¤Î¥Ó¥Ã¥È¤¬ on ¤Ê¤é¤Ð¡¢¤³¤Î¥Æ¥­¥¹¥È¥×¥í¥Ñ¥Æ¥£¤Î»Ï¤Þ¤ëÅÀ¤¢¤ë¤¤¤ÏÃæ´Ö¤ËÁÞÆþ¤µ¤ì¤¿
+       M-text ¤Ï¤³¤Î¥Æ¥­¥¹¥È¥×¥í¥Ñ¥Æ¥£¤ò·Ñ¾µ¤¹¤ë¡£
        */
     MTEXTPROP_FRONT_STICKY = 0x01,
 
     /***en If this flag bit is on, an M-text inserted at the end
        position or at the middle of the text property inherits the
        text property.  */
-    /***ja ¤³¤Î¥Ó¥Ã¥È¤¬ on ¤Ê¤é¤Ð¡¢¤³¤Î¥Æ¥­¥¹¥È¥×¥í¥Ñ¥Æ¥£¤Î½ª¤ï¤ëÅÀ¤¢
-       ¤ë¤¤¤ÏÃæ´Ö¤ËÁÞÆþ¤µ¤ì¤¿ M-text ¤Ï¤³¤Î¥Æ¥­¥¹¥È¥×¥í¥Ñ¥Æ¥£¤ò·Ñ¾µ¤¹¤ë¡£
+    /***ja ¤³¤Î¥Ó¥Ã¥È¤¬ on ¤Ê¤é¤Ð¡¢¤³¤Î¥Æ¥­¥¹¥È¥×¥í¥Ñ¥Æ¥£¤Î½ª¤ï¤ëÅÀ¤¢¤ë¤¤¤ÏÃæ´Ö¤ËÁÞÆþ¤µ¤ì¤¿
+       M-text ¤Ï¤³¤Î¥Æ¥­¥¹¥È¥×¥í¥Ñ¥Æ¥£¤ò·Ñ¾µ¤¹¤ë¡£
        */
     MTEXTPROP_REAR_STICKY = 0x02,
 
     /***en If this flag bit is on, the text property is removed if a
        text in its region is modified.  */
-    /***ja ¤³¤Î¥Ó¥Ã¥È¤¬ on ¤Ê¤é¤Ð¡¢¤³¤Î¥Æ¥­¥¹¥È¥×¥í¥Ñ¥Æ¥£¤ÎÈÏ°ÏÆâ¤Î
-       ¥Æ¥­¥¹¥È¤¬Êѹ¹¤µ¤ì¤¿¾ì¹ç¥Æ¥­¥¹¥È¥×¥í¥Ñ¥Æ¥£¤Ï¼è¤ê½ü¤«¤ì¤ë¡£  */
+    /***ja ¤³¤Î¥Ó¥Ã¥È¤¬ on ¤Ê¤é¤Ð¡¢¤³¤Î¥Æ¥­¥¹¥È¥×¥í¥Ñ¥Æ¥£¤ÎÈÏ°ÏÆâ¤Î¥Æ¥­¥¹¥È¤¬Êѹ¹¤µ¤ì¤¿¾ì¹ç¥Æ¥­¥¹¥È¥×¥í¥Ñ¥Æ¥£¤Ï¼è¤ê½ü¤«¤ì¤ë¡£  */
     MTEXTPROP_VOLATILE_WEAK = 0x04,
 
     /***en If this flag bit is on, the text property is removed if a
        text or the other text property in its region is modified.  */
-    /***ja ¤³¤Î¥Ó¥Ã¥È¤¬ on ¤Ê¤é¤Ð¡¢¤³¤Î¥Æ¥­¥¹¥È¥×¥í¥Ñ¥Æ¥£¤ÎÈÏ°ÏÆâ¤Î
-       ¥Æ¥­¥¹¥È¤¢¤ë¤¤¤ÏÊ̤Υƥ­¥¹¥È¥×¥í¥Ñ¥Æ¥£¤¬Êѹ¹¤µ¤ì¤¿¾ì¹ç¤³¤Î¥Æ¥­
+    /***ja ¤³¤Î¥Ó¥Ã¥È¤¬ on ¤Ê¤é¤Ð¡¢¤³¤Î¥Æ¥­¥¹¥È¥×¥í¥Ñ¥Æ¥£¤ÎÈÏ°ÏÆâ¤Î¥Æ¥­¥¹¥È¤¢¤ë¤¤¤ÏÊ̤Υƥ­¥¹¥È¥×¥í¥Ñ¥Æ¥£¤¬Êѹ¹¤µ¤ì¤¿¾ì¹ç¤³¤Î¥Æ¥­
        ¥¹¥È¥×¥í¥Ñ¥Æ¥£¤Ï¼è¤ê½ü¤«¤ì¤ë¡£*/
     MTEXTPROP_VOLATILE_STRONG = 0x08,
 
     /***en If this flag bit is on, the text property is not
        automatically merged with the others.  */
-    /***ja ¤³¤Î¥Ó¥Ã¥È¤¬ on ¤Ê¤é¤Ð¡¢¤³¤Î¥Æ¥­¥¹¥È¥×¥í¥Ñ¥Æ¥£¤Ï¾¤Î¥×¥í¥Ñ
-       ¥Æ¥£¤È¼«Æ°Åª¤Ë¤Ï¥Þ¡¼¥¸¤µ¤ì¤Ê¤¤¡£ */
+    /***ja ¤³¤Î¥Ó¥Ã¥È¤¬ on ¤Ê¤é¤Ð¡¢¤³¤Î¥Æ¥­¥¹¥È¥×¥í¥Ñ¥Æ¥£¤Ï¾¤Î¥×¥í¥Ñ¥Æ¥£¤È¼«Æ°Åª¤Ë¤Ï¥Þ¡¼¥¸¤µ¤ì¤Ê¤¤¡£ */
     MTEXTPROP_NO_MERGE = 0x10,
 
     MTEXTPROP_CONTROL_MAX = 0x1F
@@ -570,20 +688,20 @@ extern MSymbol Mtext_prop_deserializer;
     @brief Type of serializer functions.
 
     This is the type of serializer functions.  If the key of a symbol
-    property is #Msymbol_prop_serializer, the value must be of this
+    property is #Mtext_prop_serializer, the value must be of this
     type.
 
     @seealso
-    mtext_prop_serialize (), Mtext_prop_serializer
+    mtext_serialize (), #Mtext_prop_serializer
 */
 /***ja
     @brief ¥·¥ê¥¢¥é¥¤¥¶´Ø¿ô¤Î·¿Àë¸À.
 
     ¥·¥ê¥¢¥é¥¤¥¶´Ø¿ô¤Î·¿¤Ç¤¢¤ë¡£ ¤¢¤ë¥·¥ó¥Ü¥ë¤Î¥×¥í¥Ñ¥Æ¥£¤Î¥­¡¼¤¬ @c
-    #Msymbol_prop_serializer ¤Ç¤¢¤ë¤È¤­¡¢ ÃͤϤ³¤Î·¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
+    #Mtext_prop_serializer ¤Ç¤¢¤ë¤È¤­¡¢ ÃͤϤ³¤Î·¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
 
     @seealso
-    Mtext_prop_serialize (), Mtext_prop_serializer
+    mtext_serialize (), #Mtext_prop_serializer
 */
 
 typedef MPlist *(*MTextPropSerializeFunc) (void *val);
@@ -593,17 +711,17 @@ typedef MPlist *(*MTextPropSerializeFunc) (void *val);
     @brief Type of deserializer functions.
 
     This is the type of deserializer functions.  If the key of a
-    symbol property is #Msymbol_prop_deserializer, the value must be
-    of this type.
+    symbol property is #Mtext_prop_deserializer, the value must be of
+    this type.
 
     @seealso
-    Mtext_prop_deserialize (), Mtext_prop_deserializer
+    mtext_deserialize (), #Mtext_prop_deserializer
 */
 /***ja
     @brief ¥Ç¥·¥ê¥¢¥é¥¤¥¶´Ø¿ô¤Î·¿Àë¸À.
 
     ¥Ç¥·¥ê¥¢¥é¥¤¥¶´Ø¿ô¤Î·¿¤Ç¤¢¤ë¡£ ¤¢¤ë¥·¥ó¥Ü¥ë¤Î¥×¥í¥Ñ¥Æ¥£¤Î¥­¡¼¤¬ @c
-    #Msymbol_prop_deserializer ¤Ç¤¢¤ë¤È¤­¡¢ ÃͤϤ³¤Î·¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
+    #Mtext_prop_deserializer ¤Ç¤¢¤ë¤È¤­¡¢ ÃͤϤ³¤Î·¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
 
     @seealso
     Mtext_prop_deserialize (), Mtext_prop_deserializer
@@ -629,10 +747,6 @@ extern int mtext_push_prop (MText *mt, int from, int to,
 extern int mtext_pop_prop (MText *mt, int from, int to,
                           MSymbol key);
 
-extern int mtext_change_prop (MText *mt, int from, int to,
-                             MSymbol key,
-                             int (*func) (int, void ***, int *));
-
 extern int mtext_prop_range (MText *mt, MSymbol key, int pos,
                             int *from, int *to, int deeper);
 
@@ -685,9 +799,52 @@ extern MText *mtext_serialize (MText *mt, int from, int to,
 
 extern MText *mtext_deserialize (MText *mt);
 
-#ifdef __cplusplus
-}
-#endif
+/*** @ingroup m17nCore */
+/***en @defgroup m17nDatabase Database */
+/***ja @defgroup m17nDatabase ¥Ç¡¼¥¿¥Ù¡¼¥¹ */
+/*=*/
+
+/* Directory of an application specific databases.  */
+extern char *mdatabase_dir;
+/*=*/
+/***
+    @ingroup m17nDatabase  */ 
+/***en
+    @brief Type of database.
+
+    The type #MDatabase is for a database object.  Its internal
+    structure is concealed from an application program.  */
+/***ja 
+    @brief ¥Ç¡¼¥¿¥Ù¡¼¥¹¤Î·¿Àë¸À.
+
+    #MDatabase ·¿¤Ï¥Ç¡¼¥¿¥Ù¡¼¥¹¥ª¥Ö¥¸¥§¥¯¥ÈÍѤι½Â¤ÂΤǤ¢¤ë¡£
+    ÆâÉô¹½Â¤¤Ï¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é¥à¤«¤é¤Ï¸«¤¨¤Ê¤¤¡£
+    */
+
+typedef struct MDatabase MDatabase;
+
+/*=*/
+
+/* Look for a data.  */
+extern MDatabase *mdatabase_find (MSymbol tag1, MSymbol tag2,
+                                 MSymbol tag3, MSymbol tag4);
+
+extern MPlist *mdatabase_list (MSymbol tag0, MSymbol tag1,
+                              MSymbol tag2, MSymbol tag3);
+
+/* Load a data.  */
+void *mdatabase_load (MDatabase *mdb);
+
+/* Get tags of a data.  */
+extern MSymbol *mdatabase_tag (MDatabase *mdb);
+
+/* Define a data.  */
+extern MDatabase *mdatabase_define (MSymbol tag1, MSymbol tag2,
+                                   MSymbol tag3, MSymbol tag4,
+                                   void *(*loader) (MSymbol *, void *),
+                                   void *extra_info);
+
+M17N_END_HEADER
 
 #endif /* _M17N_CORE_H_ */