Copyright years udpated.
[m17n/m17n-lib.git] / src / m17n-core.c
index e54b9e2..945745e 100644 (file)
@@ -1,5 +1,5 @@
 /* m17n-core.c -- body of the CORE API.
-   Copyright (C) 2003, 2004, 2005, 2006, 2007
+   Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
      National Institute of Advanced Industrial Science and Technology (AIST)
      Registration Number H15PRO112
 
@@ -26,7 +26,7 @@
 
     <em>API LEVELS</em>
 
-    The API of the m17n library is divided into these four.
+    The API of the m17n library is divided into these five.
 
     <ol>
     <li> CORE API
     of the m17n library.  */
 /***ja
     ¥Þ¥¯¥í #M17NLIB_MAJOR_VERSION ¤Ï m17n 
-    ¥é¥¤¥Ö¥é¥ê¤Î¥á¥¸¥ã¡¼¥Ð¡¼¥¸¥ç¥óÈÖ¹æ¤òÍ¿¤¨¤ë¡£  */
+    ¥é¥¤¥Ö¥é¥ê¤Î¥á¥¸¥ã¡¼¥Ð¡¼¥¸¥ç¥óÈÖ¹æ¤òÍ¿¤¨¤ë.  */
 
 #define M17NLIB_MAJOR_VERSION
 
 
 /***ja
     ¥Þ¥¯¥í #M17NLIB_MINOR_VERSION ¤Ï m17n 
-    ¥é¥¤¥Ö¥é¥ê¤Î¥Þ¥¤¥Ê¡¼¥Ð¡¼¥¸¥ç¥óÈÖ¹æ¤òÍ¿¤¨¤ë¡£  */
+    ¥é¥¤¥Ö¥é¥ê¤Î¥Þ¥¤¥Ê¡¼¥Ð¡¼¥¸¥ç¥óÈÖ¹æ¤òÍ¿¤¨¤ë.  */
 
 #define M17NLIB_MINOR_VERSION
 
 
 /***ja
     ¥Þ¥¯¥í #M17NLIB_PATCH_LEVEL ¤Ï m17n 
-    ¥é¥¤¥Ö¥é¥ê¤Î¥Ñ¥Ã¥Á¥ì¥Ù¥ëÈÖ¹æ¤òÍ¿¤¨¤ë¡£  */
+    ¥é¥¤¥Ö¥é¥ê¤Î¥Ñ¥Ã¥Á¥ì¥Ù¥ëÈÖ¹æ¤òÍ¿¤¨¤ë.  */
 
 #define M17NLIB_PATCH_LEVEL
 
 
 /***ja
     ¥Þ¥¯¥í #M17NLIB_VERSION_NAME ¤Ï m17n 
-    ¥é¥¤¥Ö¥é¥ê¤Î¥Ð¡¼¥¸¥ç¥ó̾¤òʸ»úÎó¤È¤·¤ÆÍ¿¤¨¤ë¡£  */
+    ¥é¥¤¥Ö¥é¥ê¤Î¥Ð¡¼¥¸¥ç¥ó̾¤òʸ»úÎó¤È¤·¤ÆÍ¿¤¨¤ë.  */
 
 #define M17NLIB_VERSION_NAME
 
@@ -434,6 +434,27 @@ report_object_array ()
 
       fprintf (stderr, "%16s %7d %7d %7d\n", array->name,
               array->used, array->used - array->count, array->count);
+      if (array->count > 0)
+       {
+         int i;
+         for (i = 0; i < array->used && ! array->objects[i]; i++);
+
+         if (strcmp (array->name, "M-text") == 0)
+           {
+             MText *mt = (MText *) array->objects[i];
+
+             if (mt->format <= MTEXT_FORMAT_UTF_8)
+               fprintf (stderr, "\t\"%s\"\n", (char *) mt->data);
+           }
+         else if (strcmp (array->name, "Plist") == 0)
+           {
+             MPlist *plist = (MPlist *) array->objects[i];
+
+             mdebug_dump_plist (plist, 8);
+             fprintf (stderr, "\n");
+           }
+       }
+
       if (array->used > 0)
        {
          free (array->objects);
@@ -566,9 +587,12 @@ m17n_init_core (void)
   SET_DEBUG_FLAG ("MDEBUG_CODING", MDEBUG_CODING);
   SET_DEBUG_FLAG ("MDEBUG_DATABASE", MDEBUG_DATABASE);
   SET_DEBUG_FLAG ("MDEBUG_FONT", MDEBUG_FONT); 
-  SET_DEBUG_FLAG ("MDEBUG_FONT_FLT", MDEBUG_FONT_FLT);
-  SET_DEBUG_FLAG ("MDEBUG_FONT_OTF", MDEBUG_FONT_OTF);
+  SET_DEBUG_FLAG ("MDEBUG_FLT", MDEBUG_FLT);
+  SET_DEBUG_FLAG ("MDEBUG_FONTSET", MDEBUG_FONTSET);
   SET_DEBUG_FLAG ("MDEBUG_INPUT", MDEBUG_INPUT);
+  /* for backward compatibility... */
+  SET_DEBUG_FLAG ("MDEBUG_FONT_FLT", MDEBUG_FLT);
+  SET_DEBUG_FLAG ("MDEBUG_FONT_OTF", MDEBUG_FLT);
   {
     char *env_value = getenv ("MDEBUG_OUTPUT_FILE");
 
@@ -936,7 +960,7 @@ m17n_object_unref (void *object)
 /*** @} */
 
 /***en
-    @addtogroup m17nError Error handling
+    @addtogroup m17nError Error Handling
     @brief Error handling of the m17n library.
 
     There are two types of errors that may happen in a function of
@@ -1064,11 +1088,9 @@ void (*m17n_memory_full_handler) (enum MErrorCode err);
     <li> MDEBUG_FONT -- If set to 1, print information about fonts
     being selected and opened.
 
-    <li> MDEBUG_FONT_FLT -- If set to 1, print information about which
-    command of Font Layout Table are being executed.
-
-    <li> MDEBUG_FONT_OTF -- If set to 1, print information about which
-    feature of OpenType Layout Table are being executed.
+    <li> MDEBUG_FLT -- If set to 1, 2, or 3, print information about
+    which command of Font Layout Table are being executed.  The bigger
+    number prints the more detailed information.
 
     <li> MDEBUG_INPUT -- If set to 1, print information about how an
     input method is running.
@@ -1113,15 +1135,15 @@ void (*m17n_memory_full_handler) (enum MErrorCode err);
     <li> MDEBUG_DATABASE -- 1 ¤Ê¤é¤Ð¡¢m17n
     ¥Ç¡¼¥¿¥Ù¡¼¥¹¤«¤é¥í¡¼¥É¤µ¤ì¤¿¥Ç¡¼¥¿¤Ë¤Ä¤¤¤Æ¤Î¾ðÊó¤ò¥×¥ê¥ó¥È¤¹¤ë¡£
 
-    <li> MDEBUG_FONT -- 1 ¤Ê¤é¤Ð¡¢ÁªÂò¤µ¤ì¤Æ¥ª¡¼¥×¥ó¤µ¤ì¤¿¥Õ¥©¥ó¥È¤Ë¤Ä¤¤¤Æ¤Î¾ðÊó¤ò¥×¥ê¥ó¥È¤¹¤ë¡£
-
-    <li> MDEBUG_FONT_FLT -- 1 ¤Ê¤é¤Ð¡¢Font Layout Table 
-    ¤Î¤É¤Î¥³¥Þ¥ó¥É¤¬¼Â¹ÔÃ椫¤Ë¤Ä¤¤¤Æ¤Î¤ò¥×¥ê¥ó¥È¤¹¤ë¡£
+    <li> MDEBUG_FONT -- 1 ¤Ê¤é¤Ð¡¢ÁªÂò¤µ¤ì¤Æ¥ª¡¼¥×¥ó¤µ¤ì¤¿¥Õ¥©¥ó¥È¤Ë¤Ä
+    ¤¤¤Æ¤Î¾ðÊó¤ò¥×¥ê¥ó¥È¤¹¤ë¡£
 
-    <li> MDEBUG_FONT_OTF -- 1 ¤Ê¤é¤Ð¡¢OpenType Layout Table 
-    ¤Î¤É¤Î°À­¤¬¼Â¹ÔÃ椫¤Ë¤Ä¤¤¤Æ¤Î¤ò¥×¥ê¥ó¥È¤¹¤ë¡£
+    <li> MDEBUG_FLT -- 1¡¢2¡¢¤â¤·¤¯¤Ï 3 ¤Ê¤é¤Ð¡¢Font Layout Table ¤Î¤É
+    ¤Î¥³¥Þ¥ó¥É¤¬¼Â¹ÔÃ椫¤Ë¤Ä¤¤¤Æ¤Î¤ò¥×¥ê¥ó¥È¤¹¤ë¡£¤è¤êÂ礭¤ÊÃÍÄø¤è¤ê¾Ü
+    ¤·¤¤¾ðÊó¤ò¥×¥ê¥ó¥È¤¹¤ë¡£
 
-    <li> MDEBUG_INPUT -- 1 ¤Ê¤é¤Ð¡¢¼Â¹ÔÃæ¤ÎÆþÎϥ᥽¥Ã¥É¤Î¾õÂÖ¤ËÉÕ¤¤¤Æ¤Î¾ðÊó¤ò¥×¥ê¥ó¥È¤¹¤ë¡£
+    <li> MDEBUG_INPUT -- 1 ¤Ê¤é¤Ð¡¢¼Â¹ÔÃæ¤ÎÆþÎϥ᥽¥Ã¥É¤Î¾õÂÖ¤ËÉÕ¤¤¤Æ¤Î
+    ¾ðÊó¤ò¥×¥ê¥ó¥È¤¹¤ë¡£
 
     <li> MDEBUG_ALL -- 1 ¤Ê¤é¤Ð¡¢¾åµ­¤¹¤Ù¤Æ¤ÎÊÑ¿ô¤ò 1 
     ¤Ë¤·¤¿¤Î¤ÈƱ¤¸¸ú²Ì¤ò»ý¤Ä¡£