*** empty log message ***
[m17n/m17n-lib.git] / src / m17n-core.c
1 /* m17n-core.c -- body of the CORE API.
2    Copyright (C) 2003, 2004
3      National Institute of Advanced Industrial Science and Technology (AIST)
4      Registration Number H15PRO112
5
6    This file is part of the m17n library.
7
8    The m17n library is free software; you can redistribute it and/or
9    modify it under the terms of the GNU Lesser General Public License
10    as published by the Free Software Foundation; either version 2.1 of
11    the License, or (at your option) any later version.
12
13    The m17n library is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16    Lesser General Public License for more details.
17
18    You should have received a copy of the GNU Lesser General Public
19    License along with the m17n library; if not, write to the Free
20    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21    02111-1307, USA.  */
22
23 /***en
24     @addtogroup m17nIntro
25     @brief Introduction to the m17n library.
26
27     <em>API LEVELS</em>
28
29     The API of the m17n library is divided into these four.
30
31     <ol>
32     <li> CORE API
33
34     It provides basic modules to handle M-texts.  They do not require
35     the m17n database.  To use this API, an application program must
36     include <m17n-core.h> and be linked by -lm17n-core.
37
38     <li> SHELL API
39
40     It provides modules that utilize the m17n database.  They load
41     various kinds of data from the database on demand.  To use this
42     API, an application program must include <m17n.h> and be linked by
43     -lm17n-core -lm17n.  With that, CORE API is also available.
44
45     <li> GUI API
46
47     It provides GUI modules such as drawing and inputting M-texts on a
48     window system.  The API itself is independent on a window system,
49     but the m17n library must be configured to use a specific window
50     system.  Currently, we support only the X Window System.  To use
51     this API, an application program must include <m17n-gui.h> and
52     <m17n-X.h>, and be linked by -lm17n-core -lm17n -lm17n-X.  With
53     that, CORE and SHELL APIs are also available.
54
55     <li> MISC API
56
57     It provides miscellaneous functions to support error handling and
58     debugging.  This API cannot be used by itself, but with one or more
59     APIs listed above.  To use the API, an application program must
60     include <m17n-misc.h> in addition to one of <m17n-core.h>,
61     <m17n.h>, and <m17n-gui.h>.
62
63     </ol>
64
65     See also the section @ref m17n-config "m17n-config(1)".
66
67     <em>ENVIRONMENT VARIABLE</em>
68
69     The m17n library pays attention to these environment variables.
70
71     <ul>
72     <li> @c M17NDIR
73
74     Name of a directory that contains data of the m17n database.  See
75     @ref m17nDatabase for the detail.
76
77     <li> @c MDEBUG_XXXX
78
79     Environment variables whose name start by "MDEBUG_" controls
80     printing of debug information.  See @ref m17nDebug for the detail.
81
82     </ul>
83
84     <em>API NAMING CONVENTION</em>
85
86     The library exports functions, variables, macros, and types.  All
87     of them start by the letter 'm' or 'M' followed by an object name
88     (e.g. "symbol" and "plist", but "mtext" object is given the name
89     "text" to avoid double 'm' at the head) or a module name
90     (e.g. draw, input).
91     
92     <ul>
93
94     <li> functions -- mobject () or mobject_xxx ()
95
96     They start with 'm' followed by lower case object name.  For
97     example, msymbol (), mtext_ref_char (), mdraw_text ().
98
99     <li> non-symbol variables -- mobject, or mobject_xxx
100     
101     The naming convention is the same as functions (e.g. mface_large).
102
103     <li> symbol variables -- Mname
104
105     Variables of type MSymbol start with 'M' followed by their names
106     (e.g. Mlanguage (name is "language"), Miso_2022 (name is
107     "iso-2022").
108
109     <li> macros -- MOBJECT_XXX
110
111     They start by 'M' followed by upper case object names.
112
113     <li> types -- MObject or MObjectXxx
114
115     They start by 'M' followed by capitalized object names (e.g.
116     MConverter, MInputDriver).
117
118     </ul>
119
120   */
121
122 /***ja
123     @addtogroup m17nIntro
124     @brief m17n ¥é¥¤¥Ö¥é¥ê ¥¤¥ó¥È¥í¥À¥¯¥·¥ç¥ó.
125
126     @em API¤Î¥ì¥Ù¥ë
127
128     m17n ¥é¥¤¥Ö¥é¥ê¤Î API ¤Ï°Ê²¼¤Î£´¼ï¤ËʬÎव¤ì¤Æ¤¤¤ë¡£
129
130     <ol>
131     <li> ¥³¥¢ API
132
133     M-text ¤ò°·¤¦¤¿¤á¤Î´ðËÜŪ¤Ê¥â¥¸¥å¡¼¥ë¤òÄ󶡤¹¤ë¡£¤³¤ÎʬÎà¤Î API ¤Ï
134     m17n ¥Ç¡¼¥¿¥Ù¡¼¥¹¤òɬÍפȤ·¤Ê¤¤¡£ÍøÍѤ¹¤ë¤¿¤á¤Ë¤Ï¡¢¥¢¥×¥ê¥±¡¼¥·¥ç
135     ¥ó¥×¥í¥°¥é¥à¤Ï<m17n-core.h> ¤ò include ¤·¡¢ -lm17n-core ¤Ç¥ê¥ó¥¯¤µ
136     ¤ì¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
137
138     <li> ¥·¥§¥ë API
139
140     m17n ¥Ç¡¼¥¿¥Ù¡¼¥¹¤òÍøÍѤ¹¤ë¥â¥¸¥å¡¼¥ë¤òÄ󶡤¹¤ë¡£¥â¥¸¥å¡¼¥ë¤Ï¥Ç¡¼
141     ¥¿¥Ù¡¼¥¹¤«¤éɬÍפ˱þ¤¸¤Æ¿Íͤʥǡ¼¥¿¤ò¥í¡¼¥É¤¹¤ë¡£ÍøÍѤ¹¤ë¤¿¤á¤Ë¤Ï¡¢
142     ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é¥à¤Ï <m17n.h> ¤ò include ¤·¡¢ -lm17n-core
143     -lm17n ¤Ç¥ê¥ó¥¯¤µ¤ì¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£¤³¤¦¤¹¤ë¤³¤È¤Ë¤è¤Ã¤Æ¥³¥¢ API 
144     ¤â»ÈÍѤǤ­¤ë¡£
145
146     <li> GUI API
147
148     M-texts ¤ò¥¦¥£¥ó¥É¥¦¾å¤Çɽ¼¨¤·¤¿¤êÆþÎϤ·¤¿¤ê¤¹¤ë¤È¤¤¤Ã¤¿¡¢¥°¥é¥Õ¥£¥Ã
149     ¥¯¥æ¡¼¥¶¥¤¥ó¥¿¥Õ¥§¡¼¥¹¥â¥¸¥å¡¼¥ë¤òÄ󶡤¹¤ë¡£API ¼«ÂΤϥ¦¥£¥ó¥É¥¦¥·
150     ¥¹¥Æ¥à¤È¤ÏÆÈΩ¤Ç¤¢¤ë¤¬¡¢ m17n ¥é¥¤¥Ö¥é¥ê¤ÏÆÃÄê¤Î¥¦¥£¥ó¥É¥¦¥·¥¹¥Æ¥à
151     ¤ò»ÈÍѤ¹¤ë¤è¤¦¤ËÀßÄꤷ¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£¸½»þÅÀ¤Ç¤Ï¡¢X ¥¦¥£¥ó¥É¥¦¥·
152     ¥¹¥Æ¥à¤À¤±¤¬¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë¡£ÍøÍѤ¹¤ë¤¿¤á¤Ë¤Ï¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×
153     ¥í¥°¥é¥à¤Ï<m17n-gui.h> ¤È <m17n-X.h> ¤ò include ¤·¡¢-lm17n-core
154     -lm17n -lm17n-X ¤Ç¥ê¥ó¥¯¤µ¤ì¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£ ¤³¤¦¤¹¤ë¤³¤È¤Ë¤è¤Ã
155     ¤Æ¥³¥¢ API ¤È¥·¥§¥ë API ¤â»ÈÍѤǤ­¤ë¡£
156
157     <li> ¤½¤Î¾¤Î API
158
159     ¥¨¥é¡¼½èÍý¡¢¥Ç¥Ð¥Ã¥°ÍѤΤ½¤Î¾¤Î´Ø¿ô¤òÄ󶡤¹¤ë¡£¤³¤Î API ¤Ï¤½¤ì¤À
160     ¤±¤Ç¤Ï»ÈÍѤǤ­¤º¡¢¾åµ­¤Î¾¤Î¤â¤Î¤È¶¦¤Ë»È¤¦¡£ÍøÍѤ¹¤ë¤¿¤á¤Ë¤Ï
161     <m17n-core.h>, <m17n.h>, <m17n-gui.h> ¤Î¤¤¤º¤ì¤«¤Ë²Ã¤¨¤Æ¡¢ 
162     <m17n-misc.h> ¤ò include ¤·¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
163
164     </ol>
165
166     @ref m17n-config "m17n-config(1)" Àá¤â»²¾È¡£
167
168     @em ´Ä¶­ÊÑ¿ô
169
170     m17n ¥é¥¤¥Ö¥é¥ê¤Ï¼¡¤Î´Ä¶­ÊÑ¿ô¤ò¹Íθ¤¹¤ë¡£
171
172     <ul>
173     <li> @c M17NDIR
174
175     m17n ¥Ç¡¼¥¿¥Ù¡¼¥¹¤Î¥Ç¡¼¥¿¤ò´Þ¤à¥Ç¥£¥ì¥¯¥È¥ê¤Î̾Á°¡£¾ÜºÙ¤Ï@ref
176     m17nDatabase »²¾È¡£
177
178     <li> @c MDEBUG_XXXX
179
180     "MDEBUG_" ¤Ç»Ï¤Þ¤ë̾Á°¤ò»ý¤Ä´Ä¶­ÊÑ¿ô¤Ï¥Ç¥Ð¥Ã¥°¾ðÊó¤òÀ©¸æ¤¹¤ë¡£¾ÜºÙ
181     ¤Ï@ref m17nDebug »²¾È¡£
182
183     </ul>
184
185     @em API @em ¤Î̿̾µ¬Â§ ¥³¥Þ¥ó¥É
186
187     ¥é¥¤¥Ö¥é¥ê¤Ï¡¢´Ø¿ô¡¢ÊÑ¿ô¡¢¥Þ¥¯¥í¡¢·¿¤ò export ¤¹¤ë¡£¤½¤ì¤é¤Ï'm' ¤Þ
188     ¤¿¤Ï 'M' ¤Î¤¢¤È¤Ë¥ª¥Ö¥¸¥§¥¯¥È̾("symbol" ¤ä "plist" ¤Ê¤É¡£¤¿¤À¤· 
189     "mtext" ¥ª¥Ö¥¸¥§¥¯¥È¤Ï¤Ï¤¸¤á¤Î 'm' ¤Î½ÅÊ£¤òÈò¤±¤ë¤¿¤á "text" ¤òÍÑ
190     ¤¤¤ë¡£) ¤Þ¤¿¤Ï¥â¥¸¥å¡¼¥ë̾(draw, input ¤Ê¤É) ¤ò³¤±¤¿¤â¤Î¤Ç¤¢¤ë¡£
191     
192     <ul>
193
194     <li> ´Ø¿ô -- mobject () ¤Þ¤¿¤Ï mobject_xxx ()
195
196     'm' ¤Î¤¢¤È¤Ë¾®Ê¸»ú¤Ç¥ª¥Ö¥¸¥§¥¯¥È̾¤¬Â³¤¯¡£¤¿¤È¤¨¤Ð¡¢msymbol (),
197      mtext_ref_char (), mdraw_text () ¤Ê¤É¡£
198
199     <li> ¥·¥ó¥Ü¥ë¤Ç¤Ê¤¤ÊÑ¿ô -- mobject,  ¤Þ¤¿¤Ï mobject_xxx
200     
201     ´Ø¿ô¤ÈƱ¤¸Ì¿Ì¾µ¬Â§¤Ë½¾¤¦¡£(¤¿¤È¤¨¤Ð  mface_large)
202
203     <li> ¥·¥ó¥Ü¥ëÊÑ¿ô -- Mname
204
205     MSymbol ·¿ÊÑ¿ô¤Ï¡¢'M' ¤Î¸å¤Ë̾Á°¤¬Â³¤¯¡£¤¿¤È¤¨¤Ð Mlanguage (̾Á°¤Ï 
206     "language"), Miso_2022 (̾Á°¤Ï"iso-2022")¤Ê¤É¡£
207
208     <li> ¥Þ¥¯¥í -- MOBJECT_XXX
209
210     'M' ¤Î¸å¤ËÂçʸ»ú¤Ç¥ª¥Ö¥¸¥§¥¯¥È̾¤¬Â³¤¯¡£
211
212     <li> ¥¿¥¤¥× -- MObject ¤Þ¤¿¤Ï MObjectXxx
213
214     'M' ¤Î¸å¤ËÂçʸ»ú¤Ç»Ï¤á¤Æ¥ª¥Ö¥¸¥§¥¯¥È̾¤ò¤¬Â³¤¯¡£ (¤¿¤È¤¨¤Ð
215     MConverter, MInputDriver)
216
217     </ul>
218     
219     */
220 /*=*/
221 /*** @{ */
222 #ifdef FOR_DOXYGEN
223 /***en
224     The #M17NLIB_MAJOR_VERSION macro gives the major version number
225     of the m17n library.  */
226
227 /***ja
228     ¥Þ¥¯¥í #M17NLIB_MAJOR_VERSION ¤Ï m17n ¥é¥¤¥Ö¥é¥ê¤Î¥á¥¸¥ã¡¼¥Ð¡¼¥¸¥ç
229     ¥óÈÖ¹æ¤òÍ¿¤¨¤ë¡£  */
230
231 #define M17NLIB_MAJOR_VERSION
232
233 /*=*/
234
235 /***en
236     The #M17NLIB_MINOR_VERSION macro gives the minor version number
237     of the m17n library.  */
238
239 /***ja
240     ¥Þ¥¯¥í #M17NLIB_MINOR_VERSION ¤Ï m17n ¥é¥¤¥Ö¥é¥ê¤Î¥Þ¥¤¥Ê¡¼¥Ð¡¼¥¸¥ç
241     ¥óÈÖ¹æ¤òÍ¿¤¨¤ë¡£  */
242
243 #define M17NLIB_MINOR_VERSION
244
245 /*=*/
246
247 /***en
248     The #M17NLIB_PATCH_LEVEL macro gives the patch level number
249     of the m17n library.  */
250
251 /***ja
252     ¥Þ¥¯¥í #M17NLIB_PATCH_LEVEL ¤Ï m17n ¥é¥¤¥Ö¥é¥ê¤Î¥Ñ¥Ã¥Á¥ì¥Ù¥ëÈÖ¹æ¤ò
253     Í¿¤¨¤ë¡£  */
254
255 #define M17NLIB_PATCH_LEVEL
256
257 /*=*/
258
259 /***en
260     The #M17NLIB_VERSION_NAME macro gives the version name of the
261     m17n library as a string.  */
262
263 /***ja
264     ¥Þ¥¯¥í #M17NLIB_VERSION_NAME ¤Ï m17n ¥é¥¤¥Ö¥é¥ê¤Î¥Ð¡¼¥¸¥ç¥ó̾¤ò
265     Ê¸»úÎó¤È¤·¤ÆÍ¿¤¨¤ë¡£  */
266
267 #define M17NLIB_VERSION_NAME
268
269 /*=*/
270
271 /***en
272     @brief Initialize the m17n library.
273
274     The macro M17N_INIT () initializes the m17n library.  This macro
275     must be called before any m17n functions are used.
276
277     If the initialization was successful, the external variable
278     #merror_code is set to 0.  Otherwise it is set to -1.  */
279
280 /***ja
281     @brief m17n ¥é¥¤¥Ö¥é¥ê¤ò½é´ü²½¤¹¤ë.
282
283     ¥Þ¥¯¥í M17N_INIT () ¤Ï m17n ¥é¥¤¥Ö¥é¥ê¤ò½é´ü²½¤¹¤ë¡£m17n ¤Î´Ø¿ô¤ò
284     ÍøÍѤ¹¤ëÁ°¤Ë¡¢¤³¤Î¥Þ¥¯¥í¤ò¤Þ¤º¸Æ¤Ð¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
285     
286     ³°ÉôÊÑ¿ô #merror_code ¤Ï¡¢½é´ü²½¤¬À®¸ù¤¹¤ì¤Ð 0 ¤Ë¡¢¤½¤¦¤Ç¤Ê¤±¤ì¤Ð 
287     -1 ¤ËÀßÄꤵ¤ì¤ë¡£  */
288
289 #define M17N_INIT()
290
291 /*=*/
292
293 /***en
294     @brief Finalize the m17n library.
295
296     The macro M17N_FINI () finalizes the m17n library.  It frees all the
297     memory area used by the m17n library.  Once this macro is
298     called, no m17n functions should be used until the
299     macro M17N_INIT () is called again.  */
300 /***ja
301     @brief m17n ¥é¥¤¥Ö¥é¥ê¤ò½ªÎ»¤¹¤ë. 
302
303     ¥Þ¥¯¥í M17N_FINI () ¤Ï m17n ¥é¥¤¥Ö¥é¥ê¤ò½ªÎ»¤¹¤ë¡£m17n ¥é¥¤¥Ö¥é¥ê
304     ¤¬»È¤Ã¤¿Á´¤Æ¤Î¥á¥â¥êÎΰè¤Ï²òÊü¤µ¤ì¤ë¡£°ìÅÙ¤³¤Î¥Þ¥¯¥í¤¬¸Æ¤Ð¤ì¤¿¤é¡¢
305     ¥Þ¥¯¥í M17N_INIT () ¤¬ºÆÅٸƤФì¤ë¤Þ¤Ç m17n ´Ø¿ô¤Ï»È¤¦¤Ù¤­¤Ç¤Ê¤¤¡£
306  */
307
308 #define M17N_FINI()
309 #endif /* FOR_DOXYGEN */
310 /*=*/
311 /*** @} */ 
312 /*=*/
313
314 #if !defined (FOR_DOXYGEN) || defined (DOXYGEN_INTERNAL_MODULE)
315 /*** @addtogroup m17nInternal
316      @{ */
317
318 #include <config.h>
319 #include <stdio.h>
320 #include <stdlib.h>
321 #include <sys/time.h>
322 #include <sys/resource.h>
323 #include <unistd.h>
324
325 #include "m17n-core.h"
326 #include "m17n-misc.h"
327 #include "internal.h"
328
329 static int core_initialized;
330
331 static void
332 default_error_handler (enum MErrorCode err)
333 {
334   exit (err);
335 }
336
337 static struct timeval time_stack[16];
338 static int time_stack_index;
339
340 static int report_header_printed;
341
342 \f
343 /* Internal API */
344
345 void
346 mdebug__report_object (char *name, M17NObjectArray *array)
347 {
348   if (! (mdebug__flag & MDEBUG_FINI))
349     return;
350   if (! report_header_printed)
351     {
352       fprintf (stderr, "%16s %7s %7s %7s\n",
353                "object", "created", "freed", "alive");
354       fprintf (stderr, "%16s %7s %7s %7s\n",
355                "------", "-------", "-----", "-----");
356       report_header_printed = 1;
357     }
358   fprintf (stderr, "%16s %7d %7d %7d\n", name,
359            array->used, array->used - array->count, array->count);
360   if (array->used > 0)
361     {
362       free (array->objects);
363       array->count = array->used = 0;
364     }
365 }
366
367
368 void *(*mdatabase__finder) (MSymbol tag1, MSymbol tag2,
369                            MSymbol tag3, MSymbol tag4);
370 void *(*mdatabase__loader) (void *);
371
372 int mdebug__flag;
373
374 void
375 mdebug__push_time ()
376 {
377   struct timezone tz;
378
379   gettimeofday (time_stack + time_stack_index++, &tz);
380 }
381
382 void
383 mdebug__pop_time ()
384 {
385   time_stack_index--;
386 }
387
388 void
389 mdebug__print_time ()
390 {
391   struct timeval tv;
392   struct timezone tz;
393   long diff;
394
395   gettimeofday (&tv, &tz);
396   diff = ((tv.tv_sec - time_stack[time_stack_index - 1].tv_sec) * 1000000
397           + (tv.tv_usec - time_stack[time_stack_index - 1].tv_usec));
398   fprintf (stderr, "%8ld ms.", diff);
399   time_stack[time_stack_index - 1] = tv;
400 }
401
402 #define SET_DEBUG_FLAG(env_name, mask)          \
403   do {                                          \
404     char *env_value = getenv (env_name);        \
405                                                 \
406     if (env_value && env_value[0] == '1')       \
407       mdebug__flag |= (mask);                   \
408   } while (0)
409
410
411 \f
412 /* External API */
413
414 /* The following two are actually not exposed to a user but concealed
415    by the macro M17N_INIT (). */
416
417 void
418 m17n_init_core (void)
419 {
420   int mdebug_mask = MDEBUG_INIT;
421
422   if (core_initialized)
423     return;
424
425   merror_code = MERROR_NONE;
426   m17n_memory_full_handler = default_error_handler;
427
428   mdebug__flag = 0;
429   SET_DEBUG_FLAG ("MDEBUG_INIT", MDEBUG_INIT);
430   SET_DEBUG_FLAG ("MDEBUG_FINI", MDEBUG_FINI);
431   SET_DEBUG_FLAG ("MDEBUG_CHARSET", MDEBUG_CHARSET);
432   SET_DEBUG_FLAG ("MDEBUG_CODING", MDEBUG_CODING);
433   SET_DEBUG_FLAG ("MDEBUG_DATABASE", MDEBUG_DATABASE);
434   SET_DEBUG_FLAG ("MDEBUG_FONT", MDEBUG_FONT); 
435   SET_DEBUG_FLAG ("MDEBUG_FONT_FLT", MDEBUG_FONT_FLT);
436   SET_DEBUG_FLAG ("MDEBUG_FONT_OTF", MDEBUG_FONT_OTF);
437   SET_DEBUG_FLAG ("MDEBUG_INPUT", MDEBUG_INPUT);
438
439   MDEBUG_PUSH_TIME ();
440   MDEBUG_PUSH_TIME ();
441   if (msymbol__init () < 0)
442     goto err;
443   MDEBUG_PRINT_TIME ("INIT", (stderr, " to initialize symbol module."));
444   if  (mplist__init () < 0)
445     goto err;
446   MDEBUG_PRINT_TIME ("INIT", (stderr, " to initialize plist module."));
447   if (mtext__init () < 0)
448     goto err;
449   if (mtext__prop_init () < 0)
450     goto err;
451   MDEBUG_PRINT_TIME ("INIT", (stderr, " to initialize mtext module."));
452   if  (mchartable__init () < 0)
453     goto err;
454   MDEBUG_PRINT_TIME ("INIT", (stderr, " to initialize chartable module."));
455
456   mdatabase__finder = NULL;
457   mdatabase__loader = NULL;
458   core_initialized = 1;
459
460  err:
461   MDEBUG_POP_TIME ();
462   MDEBUG_PRINT_TIME ("INIT", (stderr, " to initialize the core modules."));
463   MDEBUG_POP_TIME ();
464 }
465
466 void
467 m17n_fini_core (void)
468 {
469   int mdebug_mask = MDEBUG_FINI;
470
471   if (core_initialized)
472     {
473       MDEBUG_PUSH_TIME ();
474       MDEBUG_PUSH_TIME ();
475       MDEBUG_PRINT_TIME ("FINI", (stderr, " to finalize chartable module."));
476       mchartable__fini ();
477       MDEBUG_PRINT_TIME ("FINI", (stderr, " to finalize textprop module."));
478       mtext__prop_fini ();
479       MDEBUG_PRINT_TIME ("FINI", (stderr, " to finalize mtext module."));
480       mtext__fini ();
481       MDEBUG_PRINT_TIME ("FINI", (stderr, " to finalize symbol module."));
482       msymbol__fini ();
483       MDEBUG_PRINT_TIME ("FINI", (stderr, " to finalize plist module."));
484       mplist__fini ();
485       core_initialized = 0;
486       MDEBUG_POP_TIME ();
487       MDEBUG_PRINT_TIME ("FINI", (stderr, " to finalize the core modules."));
488       MDEBUG_POP_TIME ();
489     }
490   report_header_printed = 0;
491 }
492
493 /*** @} */
494 #endif /* !FOR_DOXYGEN || DOXYGEN_INTERNAL_MODULE */
495 /*=*/
496
497 /***en
498     @addtogroup m17nObject
499     @brief Managed objects are objects managed by the reference count.
500
501     There are some types of m17n objects that are managed by their
502     reference count.  Those objects are called @e managed @e objects.
503     When created, the reference count of a managed object is
504     initialized to one.  The m17n_object_ref () function increments
505     the reference count of a managed object by one, and the
506     m17n_object_unref () function decrements by one.  A managed
507     object is automatically freed when its reference count becomes
508     zero.
509
510     A property whose key is a managing key can have only a managed
511     object as its value.  Such functions as msymbol_put () and
512     mplist_put () pay special attention to such a property.
513
514     In addition to the predefined managed object types, users can
515     define their own managed object types.  See the documentation of
516     the m17n_object () for the details.  */
517 /***ja
518     @addtogroup m17nObject
519     @brief ´ÉÍý²¼¥ª¥Ö¥¸¥§¥¯¥È¤È¤Ï»²¾È¿ô¤Ë¤è¤Ã¤Æ´ÉÍý¤µ¤ì¤Æ¤¤¤ë¥ª¥Ö¥¸¥§¥¯¥È¤Ç¤¢¤ë.
520
521     m17n ¥ª¥Ö¥¸¥§¥¯¥È¤Î¤¢¤ë·¿¤Î¤â¤Î¤Ï¡¢»²¾È¿ô¤Ë¤è¤Ã¤Æ´ÉÍý¤µ¤ì¤Æ¤¤¤ë¡£
522     ¤½¤ì¤é¤Î¥ª¥Ö¥¸¥§¥¯¥È¤Ï @e ´ÉÍý²¼¥ª¥Ö¥¸¥§¥¯¥È ¤È¸Æ¤Ð¤ì¤ë¡£À¸À®¤µ¤ì
523     ¤¿»þÅÀ¤Ç¤Î»²¾È¿ô¤Ï 0 ¤Ë½é´ü²½¤µ¤ì¤Æ¤¤¤ë¡£´Ø¿ô m17n_object_ref () 
524     ¤Ï´ÉÍý²¼¥ª¥Ö¥¸¥§¥¯¥È¤Î»²¾È¿ô¤ò 1 Áý¤ä¤·¡¢´Ø¿ôm17n_object_unref () 
525     ¤Ï 1 ¸º¤é¤¹¡£»²¾È¿ô¤¬ 0 ¤Ë¤Ê¤Ã¤¿´ÉÍý²¼¥ª¥Ö¥¸¥§¥¯¥È¤Ï¼«Æ°Åª¤Ë²òÊü¤µ
526     ¤ì¤ë¡£
527
528     ¥­¡¼¤¬´ÉÍý¥­¡¼¤Ç¤¢¤ë¥×¥í¥Ñ¥Æ¥£¤Ï¡¢ÃͤȤ·¤Æ´ÉÍý²¼¥ª¥Ö¥¸¥§¥¯¥È¤À¤±¤ò
529     ¼è¤ë¡£´Ø¿ô msymbol_put () ¤ä mplist_put () ¤Ê¤É¤Ï¤½¤ì¤é¤Î¥×¥í¥Ñ¥Æ¥£
530     ¤òÆÃÊÌ°·¤¤¤¹¤ë¡£
531
532     ÄêµÁºÑ¤ß´ÉÍý²¼¥ª¥Ö¥¸¥§¥¯¥È¥¿¥¤¥×¤Î¾¤Ë¡¢¥æ¡¼¥¶¤ÏɬÍפʴÉÍý²¼¥ª¥Ö¥¸¥§
533     ¥¯¥È¥¿¥¤¥×¤ò¼«Ê¬¤ÇÄêµÁ¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£¾ÜºÙ¤Ïm17n_object () ¤ÎÀâ
534     ÌÀ¤ò»²¾È¡£  */
535
536 /*** @{  */
537 /*=*/
538 /***en
539     @brief Allocate a managed object.
540
541     The m17n_object () function allocates a new managed object of
542     $SIZE bytes and sets its reference count to 1.  $FREER is the
543     function that is used to free the object when the reference count
544     becomes 0.  If $FREER is NULL, the object is freed by the free ()
545     function.
546
547     The heading bytes of the allocated object is occupied by
548     #M17NObjectHead.  That area is reserved for the m17n library and
549     application programs should never touch it.
550
551     @return
552     This function returns a newly allocated object.
553
554     @errors
555     This function never fails.  */
556
557 /***ja
558     @brief ´ÉÍý²¼¥ª¥Ö¥¸¥§¥¯¥È¤ò³ä¤êÅö¤Æ¤ë.
559
560     ´Ø¿ô m17n_object () ¤Ï$SIZE ¥Ð¥¤¥È¤Î¿·¤·¤¤´ÉÍý²¼¥ª¥Ö¥¸¥§¥¯¥È¤ò³ä¤ê
561     Åö¤Æ¡¢¤½¤Î»²¾È¿ô¤ò 1 ¤È¤¹¤ë¡£ $FREER ¤Ï»²¾È¿ô¤¬ 0 ¤Ë¤Ê¤Ã¤¿ºÝ¤Ë¤½¤Î
562     ¥ª¥Ö¥¸¥§¥¯¥È¤ò²òÊü¤¹¤ë¤¿¤á¤ËÍѤ¤¤é¤ì¤ë´Ø¿ô¤Ç¤¢¤ë¡£$FREER ¤¬ NULL¤Ê
563     ¤é¤Ð¡¢¥ª¥Ö¥¸¥§¥¯¥È¤Ï´Ø¿ô free () ¤Ë¤è¤Ã¤Æ²òÊü¤µ¤ì¤ë¡£
564
565     ³ä¤êÅö¤Æ¤é¤ì¤¿¥ª¥Ö¥¸¥§¥¯¥ÈËÁƬ¤Î¥Ð¥¤¥È¤Ï¡¢#M17NObjectHead ¤¬Àê¤á¤ë¡£ 
566     ¤³¤ÎÎΰè¤Ï m17n ¥é¥¤¥Ö¥é¥ê¤¬»ÈÍѤ¹¤ë¤Î¤Ç¡¢¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é
567     ¥à¤Ï¿¨¤ì¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
568
569     @return
570     ¤³¤Î´Ø¿ô¤Ï¿·¤·¤¯³ä¤êÅö¤Æ¤é¤ì¤¿¥ª¥Ö¥¸¥§¥¯¥È¤òÊÖ¤¹¡£
571
572     @errors
573     ¤³¤Î´Ø¿ô¤Ï¼ºÇÔ¤·¤Ê¤¤¡£    */
574
575 #if EXAMPLE_CODE
576 typedef struct
577 {
578   M17NObjectHead head;
579   int mem1;
580   char *mem2;
581 } MYStruct;
582
583 void
584 my_freer (void *obj)
585 {
586   free (((MYStruct *) obj)->mem2);
587   free (obj);
588 }
589
590 void
591 my_func (MText *mt, MSymbol key, int num, char *str)
592 {
593   MYStruct *st = m17n_object (sizeof (MYStruct), my_freer);
594
595   st->mem1 = num;
596   st->mem2 = strdup (str);
597   /* KEY must be a managing key.   */
598   mtext_put_prop (mt, 0, mtext_len (mt), key, st);
599   /* This sets the reference count of ST back to 1.  */
600   m17n_object_unref (st);
601 }
602 #endif
603
604 void *
605 m17n_object (int size, void (*freer) (void *))
606 {
607   M17NObject *obj = malloc (size);
608
609   obj->ref_count = 1;
610   obj->u.freer = freer;
611   return obj;
612 }
613
614 /*=*/
615
616 /***en
617     @brief Increment the reference count of a managed object.
618
619     The m17n_object_ref () function increments the reference count of
620     the managed object pointed to by $OBJECT.
621
622     @return
623     This function returns the resulting reference count if it fits in
624     a 16-bit unsigned integer (i.e. less than 0x10000).  Otherwise, it
625     return -1.
626
627     @errors
628     This function never fails.  */
629 /***ja
630     @brief ´ÉÍý²¼¥ª¥Ö¥¸¥§¥¯¥È¤Î»²¾È¿ô¤ò 1 Áý¤ä¤¹.
631
632     ´Ø¿ô m17n_object_ref () ¤Ï $OBJECT ¤Ç»Ø¤µ¤ì¤ë´ÉÍý²¼¥ª¥Ö¥¸¥§¥¯¥È¤Î
633     »²¾È¿ô¤ò 1 Áý¤ä¤¹¡£
634
635     @return 
636     ¤³¤Î´Ø¿ô¤Ï¡¢Áý¤ä¤·¤¿»²¾È¿ô¤¬ 16 ¥Ó¥Ã¥È¤ÎÉä¹æ̵¤·À°¿ôÃÍ(¤¹¤Ê¤ï¤Á 
637     0x10000 Ì¤Ëþ)¤Ë¤ª¤µ¤Þ¤ì¤Ð¡¢¤½¤ì¤òÊÖ¤¹¡£¤½¤¦¤Ç¤Ê¤±¤ì¤Ð -1 ¤òÊÖ¤¹¡£
638
639     @errors
640     ¤³¤Î´Ø¿ô¤Ï¼ºÇÔ¤·¤Ê¤¤¡£    */
641
642 int
643 m17n_object_ref (void *object)
644 {
645   M17NObject *obj = (M17NObject *) object;
646   M17NObjectRecord *record;
647   unsigned *count;
648
649   if (! obj->ref_count_extended)
650     {
651       if (++obj->ref_count)
652         return (int) obj->ref_count;
653       MSTRUCT_MALLOC (record, MERROR_OBJECT);
654       record->freer = obj->u.freer;
655       MLIST_INIT1 (record, counts, 1);
656       MLIST_APPEND1 (record, counts, 0, MERROR_OBJECT);
657       obj->u.record = record;
658       obj->ref_count_extended = 1;
659     }
660   else
661     record = obj->u.record;
662
663   count = record->counts;
664   while (*count == 0xFFFFFFFF)
665     *(count++) = 0;
666   (*count)++;
667   if (*count == 0xFFFFFFFF)
668     MLIST_APPEND1 (record, counts, 0, MERROR_OBJECT);
669   return -1;
670 }
671
672 /*=*/
673
674 /***en
675     @brief Decrement the reference count of a managed object.
676
677     The m17n_object_unref () function decrements the reference count
678     of the managed object pointed to by $OBJECT.  When the reference
679     count becomes zero, the object is freed by its freer function.
680
681     @return
682     This function returns the resulting reference count if it fits in
683     a 16-bit unsigned integer (i.e. less than 0x10000).  Otherwise, it
684     returns -1.  Thus, the return value zero means that $OBJECT is
685     freed.
686
687     @errors
688     This function never fails.  */
689 /***ja
690     @brief ´ÉÍý²¼¥ª¥Ö¥¸¥§¥¯¥È¤Î»²¾È¿ô¤ò 1 ¸º¤é¤¹.
691
692     ´Ø¿ô m17n_object_unref () ¤Ï $OBJECT ¤Ç»Ø¤µ¤ì¤ë´ÉÍý²¼¥ª¥Ö¥¸¥§¥¯¥È
693     ¤Î»²¾È¿ô¤ò 1 ¸º¤é¤¹¡£»²¾È¿ô¤¬ 0 ¤Ë¤Ê¤ì¤Ð¡¢¥ª¥Ö¥¸¥§¥¯¥È¤Ï²òÊü´Ø¿ô¤Ë
694     ¤è¤Ã¤Æ²òÊü¤µ¤ì¤ë¡£
695
696     @return 
697     ¤³¤Î´Ø¿ô¤Ï¡¢¸º¤é¤·¤¿»²¾È¿ô¤¬ 16 ¥Ó¥Ã¥È¤ÎÉä¹æ̵¤·À°¿ôÃÍ(¤¹¤Ê¤ï¤Á 
698     0x10000 Ì¤Ëþ)¤Ë¤ª¤µ¤Þ¤ì¤Ð¡¢¤½¤ì¤òÊÖ¤¹¡£¤½¤¦¤Ç¤Ê¤±¤ì¤Ð -1 ¤òÊÖ¤¹¡£
699     ¤Ä¤Þ¤ê¡¢0 ¤¬Ê֤äÆÍ褿¾ì¹ç¤Ï$OBJECT ¤Ï²òÊü¤µ¤ì¤Æ¤¤¤ë¡£
700
701     @errors
702     ¤³¤Î´Ø¿ô¤Ï¼ºÇÔ¤·¤Ê¤¤¡£    */
703 int
704 m17n_object_unref (void *object)
705 {
706   M17NObject *obj = (M17NObject *) object;
707   M17NObjectRecord *record;
708   unsigned *count;
709
710   if (! obj->ref_count_extended)
711     {
712       if (! --obj->ref_count)
713         {
714           if (obj->u.freer)
715             (obj->u.freer) (object);
716           else
717             free (object);
718           return 0;
719         }
720       return (int) obj->ref_count;
721     }
722
723   record = obj->u.record;
724   count = record->counts;
725   while (! *count)
726     *(count++) = 0xFFFFFFFF;
727   (*count)--;
728   if (! record->counts[0])
729     {
730       obj->ref_count_extended = 0;
731       obj->ref_count--;
732       obj->u.freer = record->freer;
733       MLIST_FREE1 (record, counts);
734       free (record);
735     }
736   return -1;
737 }
738
739 /*=*/
740
741 /*** @} */
742
743 /***en
744     @addtogroup m17nError Error handling
745     @brief Error handling of the m17n library.
746
747     There are two types of errors that may happen in a function of
748     the m17n library.
749
750     The first type is argument errors.  When a library function is
751     called with invalid arguments, it returns a value that indicates
752     error and at the same time sets the external variable @e
753     merror_code to a non-zero integer.
754
755     The second type is memory allocation errors.  When the required
756     amount of memory is not available on the system, m17n library
757     functions call a function pointed to by the external variable @c
758     m17n_memory_full_handler.  The default value of the variable is a
759     pointer to the default_error_handle () function, which just calls
760     <tt> exit ()</tt>.  */
761
762 /***ja
763     @addtogroup m17nError ¥¨¥é¡¼½èÍý
764     @brief m17n ¥é¥¤¥Ö¥é¥ê¤Î¥¨¥é¡¼½èÍý.
765
766     m17n ¥é¥¤¥Ö¥é¥ê¤Î´Ø¿ô¤Ç¤Ï¡¢£²¤Ä¤Î¼ïÎà¤Î¥¨¥é¡¼¤¬µ¯¤³¤êÆÀ¤ë¡£
767
768     °ì¤Ä¤Ï°ú¿ô¤Î¥¨¥é¡¼¤Ç¤¢¤ë¡£¥é¥¤¥Ö¥é¥ê¤Î´Ø¿ô¤¬ÂÅÅö¤Ç¤Ê¤¤°ú¿ô¤È¤È¤â¤Ë
769     ¸Æ¤Ð¤ì¤¿¾ì¹ç¡¢¤½¤Î´Ø¿ô¤Ï¥¨¥é¡¼¤ò°ÕÌ£¤¹¤ëÃͤòÊÖ¤·¡¢Æ±»þ¤Ë³°ÉôÊÑ¿ô 
770     #merror_code ¤Ë¥¼¥í¤Ç¤Ê¤¤À°¿ô¤ò¥»¥Ã¥È¤¹¤ë¡£
771
772     ¤â¤¦°ì¤Ä¤Î¼ïÎà¤Ï¥á¥â¥ê³äÅö¤Æ¥¨¥é¡¼¤Ç¤¢¤ë¡£¥·¥¹¥Æ¥à¤¬É¬ÍפÊÎ̤Υá¥â
773     ¥ê¤ò³äÅö¤Æ¤ë¤³¤È¤¬¤Ç¤­¤Ê¤¤¾ì¹ç¡¢¥é¥¤¥Ö¥é¥ê´Ø¿ô¤Ï³°ÉôÊÑ¿ô @c
774     m17n_memory_full_handler ¤¬»Ø¤¹´Ø¿ô¤ò¸Æ¤Ö¡£¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¡¢´Ø¿ô 
775     default_error_handle () ¤ò»Ø¤·¤Æ¤ª¤ê¡¢¤³¤Î´Ø¿ô¤Ïñ¤Ë <tt>exit
776     ()</tt> ¤ò¸Æ¤Ö¡£
777 */
778
779 /*** @{ */
780
781 /*=*/
782
783 /***en 
784     @brief External variable to hold error code of the m17n library.
785
786     The external variable #merror_code holds an error code of the
787     m17n library.  When a library function is called with an invalid
788     argument, it sets this variable to one of @c enum #MErrorCode.
789
790     This variable initially has the value 0.  */
791
792 /***ja 
793     @brief m17n ¥é¥¤¥Ö¥é¥ê¤Î¥¨¥é¡¼¥³¡¼¥É¤òÊÝ»ý¤¹¤ë³°ÉôÊÑ¿ô.
794
795     ³°ÉôÊÑ¿ô #merror_code ¤Ï¡¢m17n ¥é¥¤¥Ö¥é¥ê¤Î¥¨¥é¡¼¥³¡¼¥É¤òÊÝ»ý¤¹¤ë¡£
796     ¥é¥¤¥Ö¥é¥ê´Ø¿ô¤¬ÂÅÅö¤Ç¤Ê¤¤°ú¿ô¤È¤È¤â¤Ë¸Æ¤Ð¤ì¤¿ºÝ¤Ë¤Ï¡¢¤³¤ÎÊÑ¿ô¤ò 
797     @c enum #MErrorCode ¤Î°ì¤Ä¤Ë¥»¥Ã¥È¤¹¤ë¡£
798
799     ¤³¤ÎÊÑ¿ô¤Î½é´üÃͤϠ0 ¤Ç¤¢¤ë¡£  */
800
801 enum MErrorCode merror_code;
802
803 /*=*/
804
805 /***en 
806     @brief Memory allocation error handler.
807
808     The external variable #m17n_memory_full_handler holds a pointer
809     to the function to call when a library function failed to allocate
810     memory.  $ERR is one of @c enum #MErrorCode indicating in which
811     function the error occurred.
812
813     This variable initially points a function that simply calls the
814     <tt>exit </tt>() function with $ERR as an argument.
815
816     An application program that needs a different error handling can
817     change this variable to point a proper function.  */
818
819 /***ja 
820     @brief ¥á¥â¥ê³äÅö¤Æ¥¨¥é¡¼¥Ï¥ó¥É¥é.
821
822     ÊÑ¿ô #m17n_memory_full_handler ¤Ï¡¢¥é¥¤¥Ö¥é¥ê´Ø¿ô¤¬¥á¥â¥ê³äÅö¤Æ
823     ¤Ë¼ºÇÔ¤·¤¿ºÝ¤Ë¸Æ¤Ö¤Ù¤­´Ø¿ô¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤¢¤ë¡£$ERR ¤Ï @c enum
824     #MErrorCode ¤Î¤¤¤º¤ì¤«¤Ç¤¢¤ê¡¢¤É¤Î¥é¥¤¥Ö¥é¥ê´Ø¿ô¤Ç¥¨¥é¡¼¤¬µ¯¤Ã¤¿
825     ¤«¤ò¼¨¤¹¡£
826
827     @anchor test
828
829     ½é´üÀßÄê¤Ç¤Ï¡¢¤³¤ÎÊÑ¿ô¤Ïñ¤Ë <tt>exit ()</tt> ¤ò $ERR ¤ò°ú¿ô¤È¤·¤Æ
830     ¸Æ¤Ö´Ø¿ô¤ò»Ø¤·¤Æ¤¤¤ë¡£
831
832     ¤³¤ì¤È¤Ï°Û¤Ê¤ë¥¨¥é¡¼½èÍý¤òɬÍפȤ¹¤ë¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ï¡¢¤³¤ÎÊÑ¿ô¤ò
833     Å¬Åö¤Ê´Ø¿ô¤ËÀßÄꤹ¤ë¤³¤È¤Ç¡¢ÌÜŪ¤òãÀ®¤Ç¤­¤ë¡£  */
834
835 void (*m17n_memory_full_handler) (enum MErrorCode err);
836
837 /*** @} */
838
839 /*=*/
840
841 /***en
842     @addtogroup m17nDebug
843     @brief Support for m17n library users to debug their programs.
844
845     The m17n library provides the following facilities to support the
846     library users to debug their programs.
847
848     <ul>
849
850     <li> Environment variables to control printing of various
851     information.
852
853     <ul>
854
855     <li> MDEBUG_INIT -- If set to 1, print information about the
856     library initialization on the call of M17N_INIT ().
857
858     <li> MDEBUG_FINI -- If set to 1, print counts of objects that are
859     not yet freed on the call of M17N_FINI ().
860
861     <li> MDEBUG_CHARSET -- If set to 1, print information about
862     charsets being loaded from the m17n database.
863
864     <li> MDEBUG_CODING -- If set to 1, print information about coding
865     systems being loaded from the m17n database.
866
867     <li> MDEBUG_DATABASE -- If set to 1, print information about
868     data being loaded from the m17n database.
869
870     <li> MDEBUG_FONT -- If set to 1, print information about fonts
871     being selected and opened.
872
873     <li> MDEBUG_FONT_FLT -- If set to 1, print information about which
874     command of Font Layout Table are being executed.
875
876     <li> MDEBUG_FONT_OTF -- If set to 1, print information about which
877     feature of OpenType Layout Table are being executed.
878
879     <li> MDEBUG_INPUT -- If set to 1, print information about how an
880     input method is running.
881
882     <li> MDEBUG_ALL -- Setting this variable to 1 is equivalent to
883     setting all the above variables to 1.
884
885     </ul>
886
887     <li> Functions to print various objects in a human readable way.
888     See the documentation of mdebug_dump_XXXX () functions.
889
890     <li> The hook function called on an error.  See the documentation
891     of mdebug_hook ().
892
893     </ul>
894 */
895 /***ja
896     @addtogroup m17nDebug
897     @brief m17n ¥é¥¤¥Ö¥é¥ê¥æ¡¼¥¶¤Î¤¿¤á¤Î¥×¥í¥°¥é¥à¥Ç¥Ð¥Ã¥°¥µ¥Ý¡¼¥È.
898
899     m17n ¥é¥¤¥Ö¥é¥ê¤Ï¡¢¤½¤Î¥æ¡¼¥¶¤¬¼«Ê¬¤Î¥×¥í¥°¥é¥à¤ò¥Ç¥Ð¥Ã¥°¤¹¤ë¤¿¤á
900     ¤Ë¡¢°Ê²¼¤Îµ¡Ç½¤ò¥µ¥Ý¡¼¥È¤·¤Æ¤¤¤ë¡£
901
902     <ul>
903
904     <li> ¤µ¤Þ¤¶¤Þ¤Ê¾ðÊó¤Î¥×¥ê¥ó¥È¤òÀ©¸æ¤¹¤ë´Ä¶­ÊÑ¿ô¡£
905
906     <ul>
907
908     <li> MDEBUG_INIT -- 1 ¤Ê¤é¤Ð¡¢M17N_INIT () ¤¬¸Æ¤Ð¤ì¤¿»þÅÀ¤Ç¡¢¥é¥¤
909     ¥Ö¥é¥ê¤Î½é´ü²½¤Ë´Ø¤¹¤ë¾ðÊó¤ò¥×¥ê¥ó¥È¤¹¤ë¡£
910
911     <li> MDEBUG_FINI -- 1 ¤Ê¤é¤Ð¡¢M17N_FINI () ¤¬¸Æ¤Ð¤ì¤¿»þÅÀ¤Ç¡¢¤Þ¤À
912     ²òÊü¤µ¤ì¤Æ¤¤¤Ê¤¤¥ª¥Ö¥¸¥§¥¯¥È¤Î»²¾È¿ô¤ò¥×¥ê¥ó¥È¤¹¤ë¡£
913
914     <li> MDEBUG_CHARSET -- 1 ¤Ê¤é¤Ð¡¢m17n ¥Ç¡¼¥¿¥Ù¡¼¥¹¤«¤é¥í¡¼¥É¤µ¤ì¤¿
915     Ê¸»ú¥»¥Ã¥È¤Ë¤Ä¤¤¤Æ¤Î¾ðÊó¤ò¥×¥ê¥ó¥È¤¹¤ë¡£
916
917     <li> MDEBUG_CODING --  1 ¤Ê¤é¤Ð¡¢m17n ¥Ç¡¼¥¿¥Ù¡¼¥¹¤«¤é¥í¡¼¥É¤µ¤ì¤¿
918     ¥³¡¼¥É·Ï¤Ë¤Ä¤¤¤Æ¤Î¾ðÊó¤ò¥×¥ê¥ó¥È¤¹¤ë¡£
919
920     <li> MDEBUG_DATABASE -- 1 ¤Ê¤é¤Ð¡¢m17n ¥Ç¡¼¥¿¥Ù¡¼¥¹¤«¤é¥í¡¼¥É¤µ¤ì
921     ¤¿¥Ç¡¼¥¿¤Ë¤Ä¤¤¤Æ¤Î¾ðÊó¤ò¥×¥ê¥ó¥È¤¹¤ë¡£
922
923     <li> MDEBUG_FONT -- 1 ¤Ê¤é¤Ð¡¢ÁªÂò¤µ¤ì¤Æ¥ª¡¼¥×¥ó¤µ¤ì¤¿¥Õ¥©¥ó¥È¤Ë¤Ä
924     ¤¤¤Æ¤Î¾ðÊó¤ò¥×¥ê¥ó¥È¤¹¤ë¡£
925
926     <li> MDEBUG_FONT_FLT -- 1 ¤Ê¤é¤Ð¡¢Font Layout Table ¤Î¤É¤Î¥³¥Þ¥ó¥É
927     ¤¬¼Â¹ÔÃ椫¤Ë¤Ä¤¤¤Æ¤Î¤ò¥×¥ê¥ó¥È¤¹¤ë¡£
928
929     <li> MDEBUG_FONT_OTF -- 1 ¤Ê¤é¤Ð¡¢OpenType Layout Table ¤Î¤É¤Î°À­
930     ¤¬¼Â¹ÔÃ椫¤Ë¤Ä¤¤¤Æ¤Î¤ò¥×¥ê¥ó¥È¤¹¤ë¡£
931
932     <li> MDEBUG_INPUT -- 1 ¤Ê¤é¤Ð¡¢¼Â¹ÔÃæ¤ÎÆþÎϥ᥽¥Ã¥É¤Î¾õÂÖ¤ËÉÕ¤¤¤Æ
933     ¤Î¾ðÊó¤ò¥×¥ê¥ó¥È¤¹¤ë¡£
934
935     <li> MDEBUG_ALL -- 1 ¤Ê¤é¤Ð¡¢¾åµ­¤¹¤Ù¤Æ¤ÎÊÑ¿ô¤ò 1 ¤Ë¤·¤¿¤Î¤ÈƱ¤¸¸ú
936     ²Ì¤ò»ý¤Ä¡£
937
938     </ul>
939
940     <li> ¼ï¡¹¤Î¥ª¥Ö¥¸¥§¥¯¥È¤ò¿Í´Ö¤Ë²ÄÆɤʷÁ¤Ç¥×¥ê¥ó¥È¤¹¤ë´Ø¿ô¡£¾ÜºÙ¤Ï
941     ´Ø¿ô mdebug_dump_XXXX () ¤ÎÀâÌÀ»²¾È¡£
942
943     <li> ¥¨¥é¡¼È¯À¸»þ¤Ë¸Æ¤Ð¤ì¤ë¥Õ¥Ã¥¯´Ø¿ô¡£mdebug_hook () ¤ÎÀâÌÀ»²¾È¡£
944
945     </ul>
946 */
947
948 /*=*/
949 /*** @{ */
950 /*=*/
951
952 /***en
953     @brief Hook function called on an error.
954
955     The mdebug_hook () function is called when an error happens.  It
956     returns -1 without doing anything.  It is useful to set a break
957     point on this function in a debugger.  */ 
958 /***ja
959     @brief ¥¨¥é¡¼¤ÎºÝ¤Ë¸Æ¤Ð¤ì¤ë¥Õ¥Ã¥¯´Ø¿ô.
960
961     ´Ø¿ô mdebug_hook () ¤Ï¥¨¥é¡¼¤¬µ¯¤³¤Ã¤¿ºÝ¤Ë¸Æ¤Ð¤ì¡¢²¿¤â¤»¤º¤Ë-1 ¤ò
962     ÊÖ¤¹¡£¥Ç¥Ð¥Ã¥¬Æâ¤Ç¥Ö¥ì¡¼¥¯¥Ý¥¤¥ó¥È¤òÀßÄꤹ¤ë¤¿¤á¤ËÍѤ¤¤ë¤³¤È¤¬¤Ç¤­
963     ¤ë¡£
964     */ 
965
966 int
967 mdebug_hook ()
968 {
969   return -1;
970 }
971
972 /*=*/
973
974 /*** @} */ 
975
976 /*
977   Local Variables:
978   coding: euc-japan
979   End:
980 */