2021dbadeebf564a01a85e9867f4cf3c62d014eb
[m17n/m17n-lib.git] / src / m17n-misc.h
1 /* m17n-misc.h -- header file for the MISC API.
2    Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
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., 51 Franklin Street, Fifth Floor,
21    02111-1307, USA.  */
22
23 #ifndef _M17N_ERR_H_
24 #define _M17N_ERR_H_
25
26 #ifndef _M17N_CORE_H_
27 #include <m17n-core.h>
28 #endif
29
30 M17N_BEGIN_HEADER
31
32 /*** @defgroup m17nMisc MISC API */
33 /***en @brief Miscellaneous API */
34 /***ja @brief ¤½¤Î¾¤Î API */
35 /*=*/
36 /*** @ingroup m17nMisc  */
37 /***en @defgroup m17nError Error Handling */
38 /***ja @defgroup m17nError ¥¨¥é¡¼½èÍý  */
39 /*=*/
40
41 /*** @ingroup m17nError */
42 /***en 
43     @brief Enumeration for error code of the m17n library.
44
45     Enumeration for error code of the m17n library.
46
47     When a library function is called with an invalid argument, it
48     sets the external variable #merror_code to one of these values.
49     All the error codes are positive integers.
50
51     When a memory allocation error happens, the function pointed to by
52     the external variable #m17n_memory_full_handler is called with one
53     of these values as an argument.  */
54
55 /***ja 
56     @brief m17n ¥é¥¤¥Ö¥é¥ê¥¨¥é¡¼¥³¡¼¥É¤ÎÎóµó.
57
58     m17n ¥é¥¤¥Ö¥é¥ê¥¨¥é¡¼¥³¡¼¥É¤ÎÎóµó
59
60     ¥é¥¤¥Ö¥é¥ê¤Î´Ø¿ô¤¬ÂÅÅö¤Ç¤Ê¤¤°ú¿ô¤È¤È¤â¤Ë¸Æ¤Ð¤ì¤¿¾ì¹ç¤Ë¤Ï¡¢ÊÑ¿ô 
61     #merror_code ¤ò¤³¤ì¤é¤ÎÃͤΤɤ줫¤Ë¥»¥Ã¥È¤¹¤ë¡£¤¹¤Ù¤Æ¤Î¥¨¥é¡¼¥³¡¼¥É¤ÏÀµ¤ÎÀ°¿ô¤Ç¤¢¤ë¡£
62
63     ¥á¥â¥ê³äÅö¤Æ¥¨¥é¡¼¤ÎºÝ¤Ë¤Ï¡¢³°ÉôÊÑ¿ô #m17n_memory_full_handler 
64     ¤Î»Ø¤¹´Ø¿ô¤¬¡¢¤³¤ì¤é¤ÎÃͤΤ¦¤Á¤Î¤É¤ì¤«¤ò°ú¿ô¤È¤·¤Æ¸Æ¤Ð¤ì¤ë¡£
65     */
66
67 enum MErrorCode
68   {
69     MERROR_NONE,
70     MERROR_OBJECT,
71     MERROR_SYMBOL,
72     MERROR_MTEXT,
73     MERROR_TEXTPROP,
74     MERROR_CHAR,
75     MERROR_CHARTABLE,
76     MERROR_CHARSET,
77     MERROR_CODING,
78     MERROR_RANGE,
79     MERROR_LANGUAGE,
80     MERROR_LOCALE,
81     MERROR_PLIST,
82     MERROR_MISC,
83     MERROR_WIN,
84     MERROR_X,
85     MERROR_FRAME,
86     MERROR_FACE,
87     MERROR_DRAW,
88     MERROR_FLT,
89     MERROR_FONT,
90     MERROR_FONTSET,
91     MERROR_FONT_OTF,
92     MERROR_FONT_X,
93     MERROR_FONT_FT,
94     MERROR_IM,
95     MERROR_DB,
96     MERROR_IO,
97     MERROR_DEBUG,
98     MERROR_MEMORY,
99     MERROR_GD,
100     MERROR_MAX
101   };
102
103 /*=*/
104
105 extern void (*m17n_memory_full_handler) (enum MErrorCode err);
106
107 /*=*/
108 /*** @ingroup m17nMisc  */
109 /***en @defgroup m17nDebug Debugging */
110 /***ja @defgroup m17nDebug ¥Ç¥Ð¥Ã¥°¥µ¥Ý¡¼¥È */
111 /*=*/
112
113 extern int mdebug_hook (void);
114
115 extern MSymbol mdebug_dump_symbol (MSymbol sym, int indent);
116 extern MSymbol mdebug_dump_all_symbols (int indent);
117 extern MPlist *mdebug_dump_plist (MPlist *plist, int indent);
118 extern MText *mdebug_dump_mtext (MText *mt, int fullp, int indent);
119 extern MCharTable *mdebug_dump_chartab (MCharTable *table, int indent);
120
121 #ifdef DOXYGEN_INTERNAL_MODULE
122 /***en @defgroup m17nInternal Internal */
123 /***ja @defgroup m17nInternal Internal */
124 #endif
125
126 M17N_END_HEADER
127
128 #endif /* _M17N_ERR_H_ */
129
130 /*
131   Local Variables:
132   coding: euc-japan
133   End:
134 */