(config_command): Set NAME before using it.
[m17n/m17n-lib.git] / src / m17n.h
1 /* m17n.h -- header file for the SHELL API of the m17n library.
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., 51 Franklin Street, Fifth Floor,
21    02111-1307, USA.  */
22
23 #ifndef _M17N_H_
24 #define _M17N_H_
25
26 #include <stdio.h>
27 #include <stdlib.h>
28 #include <time.h>
29
30 #ifndef _M17N_CORE_H_
31 #include <m17n-core.h>
32 #endif
33
34 #ifdef __cplusplus
35 extern "C"
36 {
37 #endif
38
39 #if !defined (FOR_DOXYGEN) || defined (DOXYGEN_INTERNAL_MODULE)
40 extern void m17n_init (void);
41 #undef M17N_INIT
42 #define M17N_INIT() m17n_init ()
43
44 extern void m17n_fini (void);
45 #undef M17N_FINI
46 #define M17N_FINI() m17n_fini ()
47 #endif
48
49 /***en @defgroup m17nShell SHELL API */
50 /***ja @defgroup m17nShell ¥·¥§¥ë API */
51 /*=*/
52
53 /*
54  *  (11) Functions related to the m17n database
55  */
56 /*=*/
57
58 /*** @ingroup m17nShell */
59 /***en @defgroup m17nDatabase Database */
60 /***ja @defgroup m17nDatabase ¥Ç¡¼¥¿¥Ù¡¼¥¹ */
61 /*=*/
62
63 /* Directory of an application specific databases.  */
64 extern char *mdatabase_dir;
65 /*=*/
66 /***
67     @ingroup m17nDatabase  */ 
68 /***en
69     @brief Type of database.
70
71     The type #MDatabase is for a database object.  Its internal
72     structure is concealed from an application program.  */
73 /***ja 
74     @brief ¥Ç¡¼¥¿¥Ù¡¼¥¹¤Î·¿Àë¸À.
75
76     #MDatabase ·¿¤Ï¥Ç¡¼¥¿¥Ù¡¼¥¹¥ª¥Ö¥¸¥§¥¯¥ÈÍѤι½Â¤ÂΤǤ¢¤ë¡£
77     ÆâÉô¹½Â¤¤Ï¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é¥à¤«¤é¤Ï¸«¤¨¤Ê¤¤¡£
78     */
79
80 typedef struct MDatabase MDatabase;
81
82 /*=*/
83
84 /* Look for a data.  */
85 extern MDatabase *mdatabase_find (MSymbol tag1, MSymbol tag2,
86                                   MSymbol tag3, MSymbol tag4);
87
88 extern MPlist *mdatabase_list (MSymbol tag0, MSymbol tag1,
89                                MSymbol tag2, MSymbol tag3);
90
91 /* Load a data.  */
92 void *mdatabase_load (MDatabase *mdb);
93
94 /* Get tags of a data.  */
95 extern MSymbol *mdatabase_tag (MDatabase *mdb);
96
97 /* Define a data.  */
98 extern MDatabase *mdatabase_define (MSymbol tag1, MSymbol tag2,
99                                     MSymbol tag3, MSymbol tag4,
100                                     void *(*loader) (MSymbol *, void *),
101                                     void *extra_info);
102
103 /*=*/
104 /* (S2) Charset staffs */
105 /*=*/
106
107 /*** @ingroup m17nShell */
108 /***en @defgroup m17nCharset Charset */
109 /***ja @defgroup m17nCharset Ê¸»ú¥»¥Ã¥È */
110 /*=*/
111
112 #if !defined (FOR_DOXYGEN) || defined (DOXYGEN_INTERNAL_MODULE)
113 #define MCHAR_INVALID_CODE 0xFFFFFFFF
114 #endif
115
116 /* Predefined charsets */ 
117 extern MSymbol Mcharset_ascii;
118 extern MSymbol Mcharset_iso_8859_1;
119 extern MSymbol Mcharset_unicode;
120 extern MSymbol Mcharset_m17n;
121 extern MSymbol Mcharset_binary;
122
123 /* Predefined keys for mchar_define_charset ().  */ 
124 extern MSymbol Mmethod;
125 extern MSymbol Mdimension;
126 extern MSymbol Mmin_range;
127 extern MSymbol Mmax_range;
128 extern MSymbol Mmin_code;
129 extern MSymbol Mmax_code;
130 extern MSymbol Mascii_compatible;
131 extern MSymbol Mfinal_byte;
132 extern MSymbol Mrevision;
133 extern MSymbol Mmin_char;
134 extern MSymbol Mmapfile;
135 extern MSymbol Mparents;
136 extern MSymbol Msubset_offset;
137 extern MSymbol Mdefine_coding;
138 extern MSymbol Maliases;
139
140 /* Methods of a charset.  */
141 extern MSymbol Moffset;
142 extern MSymbol Mmap;
143 extern MSymbol Munify;
144 extern MSymbol Msubset;
145 extern MSymbol Msuperset;
146
147 /* etc. */
148 extern MSymbol Mcharset;
149
150 extern MSymbol mchar_define_charset (const char *name, MPlist *plist);
151
152 extern MSymbol mchar_resolve_charset (MSymbol symbol);
153
154 extern int mchar_list_charset (MSymbol **symbols);
155
156 extern int mchar_decode (MSymbol charset_name, unsigned code);
157
158 extern unsigned mchar_encode (MSymbol charset_name, int c);
159
160 extern int mchar_map_charset (MSymbol charset_name,
161                               void (*func) (int from, int to, void *arg),
162                               void *func_arg);
163
164 /*=*/
165
166 /* (S3) code conversion */
167 /*=*/
168 /*** @ingroup m17nShell */
169 /***en @defgroup m17nConv Code Conversion */
170 /***ja @defgroup m17nConv ¥³¡¼¥ÉÊÑ´¹ */
171 /*=*/
172
173 /* Predefined coding systems */
174 extern MSymbol Mcoding_us_ascii;
175 extern MSymbol Mcoding_iso_8859_1;
176 extern MSymbol Mcoding_utf_8;
177 extern MSymbol Mcoding_utf_8_full;
178 extern MSymbol Mcoding_utf_16;
179 extern MSymbol Mcoding_utf_16be;
180 extern MSymbol Mcoding_utf_16le;
181 extern MSymbol Mcoding_utf_32;
182 extern MSymbol Mcoding_utf_32be;
183 extern MSymbol Mcoding_utf_32le;
184 extern MSymbol Mcoding_sjis;
185
186 /* Parameter keys for mconv_define_coding ().  */
187 extern MSymbol Mtype;
188 extern MSymbol Mcharsets;
189 extern MSymbol Mflags;
190 extern MSymbol Mdesignation;
191 extern MSymbol Minvocation;
192 extern MSymbol Mcode_unit;
193 extern MSymbol Mbom;
194 extern MSymbol Mlittle_endian;
195
196 /* Symbols representing coding system type.  */
197 extern MSymbol Mutf;
198 extern MSymbol Miso_2022;
199
200 /* Symbols appearing in the value of Mfrag parameter.  */
201 extern MSymbol Mreset_at_eol;
202 extern MSymbol Mreset_at_cntl;
203 extern MSymbol Meight_bit;
204 extern MSymbol Mlong_form;
205 extern MSymbol Mdesignation_g0;
206 extern MSymbol Mdesignation_g1;
207 extern MSymbol Mdesignation_ctext;
208 extern MSymbol Mdesignation_ctext_ext;
209 extern MSymbol Mlocking_shift;
210 extern MSymbol Msingle_shift;
211 extern MSymbol Msingle_shift_7;
212 extern MSymbol Meuc_tw_shift;
213 extern MSymbol Miso_6429;
214 extern MSymbol Mrevision_number;
215 extern MSymbol Mfull_support;
216
217 /* etc */
218 extern MSymbol Mcoding;
219 extern MSymbol Mmaybe;
220
221 /*** @ingroup m17nConv */
222 /***en
223     @brief Codes that represent the result of code conversion.
224
225     One of these values is set in @c MConverter-\>result.   */
226
227 /***ja
228     @brief ¥³¡¼¥ÉÊÑ´¹¤Î·ë²Ì¤ò¼¨¤¹¥³¡¼¥É.
229
230     ¤³¤ì¤é¤ÎÃͤΤ¦¤Á°ì¤Ä¤¬ @c MConverter-\>result ¤ËÀßÄꤵ¤ì¤ë¡£  */
231
232 enum MConversionResult
233   {
234     /***en Code conversion is successful. */
235     /***ja ¥³¡¼¥ÉÊÑ´¹¤ÏÀ®¸ù. */
236     MCONVERSION_RESULT_SUCCESS,
237
238     /***en On decoding, the source contains an invalid byte. */
239     /***ja ¥Ç¥³¡¼¥É»þ¡¢¥½¡¼¥¹¤ËÉÔÀµ¤Ê¥Ð¥¤¥È¤¬´Þ¤Þ¤ì¤Æ¤¤¤ë. */
240     MCONVERSION_RESULT_INVALID_BYTE,
241
242     /***en On encoding, the source contains a character that cannot be
243         encoded by the specified coding system. */
244     /***ja ¥¨¥ó¥³¡¼¥É»þ¡¢»ØÄê¤Î¥³¡¼¥É·Ï¤Ç¥¨¥ó¥³¡¼¥É¤Ç¤­¤Ê¤¤Ê¸»ú¤¬¥½¡¼¥¹¤Ë´Þ¤Þ¤ì¤Æ¤¤¤ë. */
245     MCONVERSION_RESULT_INVALID_CHAR,
246
247     /***en On decoding, the source ends with an incomplete byte sequence. */
248     /***ja ¥Ç¥³¡¼¥É»þ¡¢ÉÔ´°Á´¤Ê¥Ð¥¤¥ÈÎó¤Ç¥½¡¼¥¹¤¬½ª¤ï¤Ã¤Æ¤¤¤ë¡£*/
249     MCONVERSION_RESULT_INSUFFICIENT_SRC,
250
251     /***en On encoding, the destination is too short to store the result. */
252     /***ja ¥¨¥ó¥³¡¼¥É»þ¡¢·ë²Ì¤ò³ÊǼ¤¹¤ëÎΰ褬û¤«¤¹¤®¤ë¡£ */
253     MCONVERSION_RESULT_INSUFFICIENT_DST,
254
255     /***en An I/O error occurred in the conversion.  */
256     /***ja ¥³¡¼¥ÉÊÑ´¹Ãæ¤Ë I/O ¥¨¥é¡¼¤¬µ¯¤³¤Ã¤¿¡£  */
257     MCONVERSION_RESULT_IO_ERROR
258   };
259 /*=*/
260
261 /*** @ingroup m17nConv */
262 /***en
263     @brief Structure to be used in code conversion.
264
265     Structure to be used in code conversion.  The first three members
266     are to control the conversion.  */
267
268 /***ja
269     @brief ¥³¡¼¥ÉÊÑ´¹¤ËÍѤ¤¤é¤ì¤ë¹½Â¤ÂÎ.
270
271     ¥³¡¼¥ÉÊÑ´¹¤ËÍѤ¤¤é¤ì¤ë¹½Â¤ÂΡ£ºÇ½é¤Î£³¤Ä¤Î¥á¥ó¥Ð¤ÏÊÑ´¹¤òÀ©¸æ¤¹¤ë¡£
272
273     @latexonly \IPAlabel{MConverter} @endlatexonly  
274 */
275
276 typedef struct
277 {
278   /***en
279       Set the value to nonzero if the conversion should be lenient.
280       By default, the conversion is strict (i.e. not lenient).
281
282       If the conversion is strict, the converter stops at the first
283       invalid byte (on decoding) or at the first character not
284       supported by the coding system (on encoding).  If this happens,
285       @c MConverter-\>result is set to @c
286       MCONVERSION_RESULT_INVALID_BYTE or @c
287       MCONVERSION_RESULT_INVALID_CHAR accordingly.
288
289       If the conversion is lenient, on decoding, an invalid byte is
290       kept per se, and on encoding, an invalid character is replaced
291       with "<U+XXXX>" (if the character is a Unicode character) or
292       with "<M+XXXXXX>" (otherwise).  */
293
294   /***ja 
295       ¸·Ì©¤ÊÊÑ´¹¤¬É¬ÍפǤʤ¤¾ì¹ç¤ËÃͤò 0 °Ê³°¤Ë¤¹¤ë¡£
296       ¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¡¢ÊÑ´¹¤Ï¸·Ì©¤Ç¤¢¤ë¡£
297
298       ÊÑ´¹¤¬¸·Ì©¤È¤Ï¡¢¥Ç¥³¡¼¥É¤ÎºÝ¤Ë¤ÏºÇ½é¤ÎÉÔÀµ¤Ê¥Ð¥¤¥È¤Ç¥³¥ó¥Ð¡¼¥¿¤¬»ß¤Þ¤ë¤³¤È¡¢
299       ¥¨¥ó¥³¡¼¥É¤ÎºÝ¤Ë¤ÏÊÑ´¹¤µ¤ì¤ë¥³¡¼¥É·Ï¤Ç¥µ¥Ý¡¼¥È¤µ¤ì¤Ê¤¤ºÇ½é¤Îʸ»ú¤Ç¥³¥ó¥Ð¡¼¥¿¤¬»ß¤Þ¤ë¤³¤È¤ò»Ø¤¹¡£
300       ¤³¤ì¤é¤Î¾ì¹ç¡¢@c MConverter-\>result ¤Ï¤½¤ì¤¾¤ì @c
301       MCONVERSION_RESULT_INVALID_BYTE ¤«@c
302       MCONVERSION_RESULT_INVALID_CHAR ¤È¤Ê¤ë¡£
303
304       ÊÑ´¹¤¬¸·Ì©¤Ç¤Ê¤¤¾ì¹ç¤Ë¤Ï¡¢¥Ç¥³¡¼¥É¤ÎºÝ¤ÎÉÔÀµ¤Ê¥Ð¥¤¥È¤Ï¤½¤Î¥Ð¥¤¥È¤Î¤Þ¤Þ»Ä¤ë¡£
305       ¤Þ¤¿¥¨¥ó¥³¡¼¥É¤ÎºÝ¤Ë¤Ï¡¢ÉÔÀµ¤Êʸ»ú¤¬ Unicode Ê¸»ú¤Î¾ì¹ç¤Ë¤Ï "<U+XXXX>"
306       ¤Ë¡¢¤½¤¦¤Ç¤Ê¤¤¾ì¹ç¤Ë¤Ï "<M+XXXXXX>" ¤ËÃÖ¤­´¹¤¨¤é¤ì¤ë¡£  */
307
308   int lenient;
309
310   /***en
311       Set the value to nonzero before decoding or encoding the last
312       block of the byte sequence or the character sequence
313       respectively.  The value influences the conversion as below.
314
315       On decoding, in the case that the last few bytes are too short
316       to form a valid byte sequence:
317
318         If the value is nonzero, the conversion terminates by error
319         (MCONVERSION_RESULT_INVALID_BYTE) at the first byte of the
320         sequence.
321
322         If the value is zero, the conversion terminates successfully.
323         Those bytes are stored in the converter as carryover and are
324         prepended to the byte sequence of the further conversion.
325
326       On encoding, in the case that the coding system is context
327       dependent:
328
329         If the value is nonzero, the conversion may produce a byte
330         sequence at the end to reset the context to the initial state
331         even if the source characters are zero.
332
333         If the value is zero, the conversion never produce such a byte
334         sequence at the end.  */
335
336 /***ja 
337
338      ¥Ð¥¤¥ÈÎó¤Î½ªÃ¼¤Î¥Ö¥í¥Ã¥¯¤ò¥Ç¥³¡¼¥É¤¹¤ëºÝ¡¢¤Þ¤¿¤Ïʸ»úÎó¤Î½ªÃ¼¤Î¥Ö¥í¥Ã¥¯¤ò¥¨¥ó¥³¡¼¥É¤¹¤ëºÝ¤Ï¡¢Ãͤò
339      0 °Ê³°¤Ë¤¹¤ë¡£¤³¤ÎÃͤϰʲ¼¤Î¤è¤¦¤ËÊÑ´¹¤Ë±Æ¶Á¤¹¤ë¡£
340
341      ¥Ç¥³¡¼¥Ç¥£¥ó¥°¤ÎºÝ¤ËºÇ¸å¤Î¿ô¥Ð¥¤¥È¤¬Àµ¤·¤¤¥Ð¥¤¥È¥·¡¼¥¯¥¨¥ó¥¹¤ò·ÁÀ®¤¹¤ë¤Ë¤Ïû¤¹¤®¤ë¾ì¹ç¡§
342
343        Ãͤ¬ 0 ¤Ç¤Ê¤±¤ì¤Ð¡¢ÊÑ´¹¤Ï¤½¤Î¥·¡¼¥¯¥¨¥ó¥¹¤ÎºÇ½é¤Î¥Ð¥¤¥È¤Ë¤ª¤¤¤Æ¡¢¥¨¥é¡¼
344        (MCONVERSION_RESULT_INVALID_BYTE) ¤Ç½ª¤ë¡£
345
346        Ãͤ¬ 0 ¤Ê¤é¤Ð¡¢ÊÑ´¹¤ÏÀ®¸ù¤·¤Æ½ª¤ë¡£
347        ÌäÂê¤Î¿ô¥Ð¥¤¥È¤Ï¥­¥ã¥ê¡¼¥ª¡¼¥Ð¤È¤·¤Æ¥³¥ó¥Ð¡¼¥¿¤ËÊÝ»ý¤µ¤ì¡¢ÊÑ´¹¤Î³¤­¤ò¹Ô¤¦ºÝ¤ËÊÑ´¹¤¹¤ë¥Ð¥¤¥ÈÎó¤ÎÁ°¤ËÉÕ¤±¤é¤ì¤ë¡£
348
349      ¥¨¥ó¥³¡¼¥Ç¥£¥ó¥°¤ÎºÝ¤Ë¥³¡¼¥É·Ï¤¬Ê¸Ì®°Í¸¤Î¾ì¹ç¡¢
350
351        Ãͤ¬ 0 ¤Ç¤Ê¤±¤ì¤Ð¡¢¥³¥ó¥Æ¥­¥¹¥È¤òºÇ½é¤ËÌ᤹¤¿¤á¤Î¥Ð¥¤¥ÈÎ󤬥½¡¼¥¹¤Îʸ»ú¤È¤«¤«¤ï¤ê¤Ê¤¯ÊÑ´¹¤Î·ë²ÌÀ¸À®¤µ¤ì¤ë¤³¤È¤¬¤¢¤ë¡£
352
353        Ãͤ¬ 0 ¤Ê¤é¤Ð¡¢¤½¤Î¤è¤¦¤Ê¥Ð¥¤¥ÈÎó¤ÏÀ¸À®¤µ¤ì¤Ê¤¤¡£
354
355          */
356
357   int last_block;
358
359   /***en
360       If the value is nonzero, it specifies at most how many
361       characters to convert.  */
362   /***ja
363       0 ¤Ç¤Ê¤±¤ì¤Ð¡¢ÊÑ´¹¤µ¤ì¤ëºÇÂç¤Îʸ»ú¿ô¤ò»ØÄꤹ¤ë¡£
364       */
365
366   unsigned at_most;
367
368   /***en
369       The following three members are to report the result of the
370       conversion.  */
371   /***ja
372       °Ê²¼¤Î£³¤Ä¤Î¥á¥ó¥Ð¤ÏÊÑ´¹¤Î·ë²Ì¤òɽ¤¹¤¿¤á¤Î¤â¤Î¤Ç¤¢¤ë¡£  */
373
374   /***en
375       Number of characters most recently decoded or encoded. */
376   /***ja
377       ºÇ¶á¤Ë¥Ç¥³¡¼¥É/¥¨¥ó¥³¡¼¥É¤µ¤ì¤¿Ê¸»ú¿ô¡£ */
378
379   int nchars;
380
381   /***en
382       Number of bytes recently decoded or encoded. */
383
384   /***ja
385       ºÇ¶á¤Ë¥Ç¥³¡¼¥É/¥¨¥ó¥³¡¼¥É¤µ¤ì¤¿¥Ð¥¤¥È¿ô¡£ */
386
387   int nbytes;
388
389   /***en
390       Result code of the conversion. */
391
392   /***ja
393       ¥³¡¼¥ÉÊÑ´¹¤Î·ë²Ì¤ò¼¨¤¹¥³¡¼¥É¡£ */
394
395   enum MConversionResult result;
396
397   /***en
398       Various information about the status of code conversion.  The
399       contents depend on the type of coding system.  It is assured
400       that @c status is aligned so that any type of casting is safe
401       and at least 256 bytes of memory space can be used.  */
402
403   /***ja
404       ¥³¡¼¥ÉÊÑ´¹¤Î¾õ¶·¤Ë´Ø¤¹¤ë¼ï¡¹¤Î¾ðÊó¡£ÆâÍƤϥ³¡¼¥É·Ï¤Î¥¿¥¤¥×¤Ë¤è¤Ã¤Æ°Û¤Ê¤ë¡£
405       @c status ¤Ï¤É¤Î¤è¤¦¤Ê·¿¤Ø¤Î¥­¥ã¥¹¥È¤ËÂФ·¤Æ¤â°ÂÁ´¤Ê¤è¤¦¤Ë¥á¥â¥ê¥¢¥é¥¤¥ó¤µ¤ì¤Æ¤ª¤ê¡¢¤Þ¤¿ºÇÄã256¥Ð¥¤¥È¤Î¥á¥â¥êÎΰ褬»È¤¨¤ë¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤ë¡£  */
406
407   union {
408     void *ptr;
409     double dbl;
410     char c[256];
411   } status;
412
413   /***en
414       This member is for internally use only.  An application program
415       should never touch it.  */
416   /***ja ¤³¤Î¥á¥ó¥Ð¤ÏÆâÉôŪ¤Ë»ÈÍѤµ¤ì¡¢¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é¥à¤Ï¿¨¤ì¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£ */
417   void *internal_info;
418 } MConverter;
419 /*=*/
420
421 /*** @ingroup m17nConv */
422 /***en 
423     @brief Types of coding system.  */
424 /***ja 
425     @brief ¥³¡¼¥É·Ï¤Î¥¿¥¤¥×.  */
426
427 enum MCodingType
428   {
429     /***en
430         A coding system of this type supports charsets directly.
431         The dimension of each charset defines the length of bytes to
432         represent a single character of the charset, and a byte
433         sequence directly represents the code-point of a character.
434
435         The m17n library provides the default decoding and encoding
436         routines of this type.  */
437
438     /***ja
439         ¤³¤Î¥¿¥¤¥×¤Î¥³¡¼¥É·Ï¤Ïʸ»ú¥»¥Ã¥È¤òľÀÜ¥µ¥Ý¡¼¥È¤¹¤ë¡£
440         ³Æʸ»ú¥»¥Ã¥È¤Î¼¡¸µ¤È¤Ï¡¢¤½¤Îʸ»ú¥»¥Ã¥È¤Ç°ìʸ»ú¤òɽ¸½¤¹¤ë¤¿¤á¤ËɬÍפʥХ¤¥È¿ô¤Ç¤¢¤ê¡¢¥Ð¥¤¥ÈÎó¤Ïʸ»ú¤Î¥³¡¼¥É¥Ý¥¤¥ó¥È¤òľÀÜɽ¤¹¡£
441
442         m17n ¥é¥¤¥Ö¥é¥ê¤Ï¤³¤Î¥¿¥¤¥×ÍѤΥǥե©¥ë¥È¤Î¥¨¥ó¥³¡¼¥É¡¿¥Ç¥³¡¼¥É¥ë¡¼¥Æ¥£¥ó¤òÄ󶡤¹¤ë¡£  */
443
444     MCODING_TYPE_CHARSET,
445
446     /***en
447         A coding system of this type supports byte sequences of a
448         UTF (UTF-8, UTF-16, UTF-32) like structure.
449
450         The m17n library provides the default decoding and encoding
451         routines of this type.  */
452
453     /***ja
454         ¤³¤Î¥¿¥¤¥×¤Î¥³¡¼¥É·Ï¤Ï¡¢UTF ·Ï (UTF-8, UTF-16, UTF-32) ¤Î¥Ð¥¤¥ÈÎó¤ò¥µ¥Ý¡¼¥È¤¹¤ë¡£
455
456         m17n ¥é¥¤¥Ö¥é¥ê¤Ï¤³¤Î¥¿¥¤¥×ÍѤΥǥե©¥ë¥È¤Î¥¨¥ó¥³¡¼¥É¡¿¥Ç¥³¡¼¥É¥ë¡¼¥Æ¥£¥ó¤òÄ󶡤¹¤ë¡£  */
457
458     MCODING_TYPE_UTF,
459
460     /***en
461         A coding system of this type supports byte sequences of an
462         ISO-2022 like structure.  The details of each structure are
463         specified by @c MCodingInfoISO2022 .
464
465         The m17n library provides decoding and encoding routines of
466         this type.  */
467
468     /***ja 
469         ¤³¤Î¥¿¥¤¥×¤Î¥³¡¼¥É·Ï¤Ï¡¢ISO-2022 ·Ï¤Î¥Ð¥¤¥ÈÎó¤ò¥µ¥Ý¡¼¥È¤¹¤ë¡£
470         ³Æ¥³¡¼¥É·Ï¤Î¹½Â¤¤Î¾ÜºÙ¤Ï @c MCodingInfoISO2022 ¤Ç»ØÄꤵ¤ì¤ë¡£
471
472         m17n ¥é¥¤¥Ö¥é¥ê¤Ï¤³¤Î¥¿¥¤¥×ÍѤΥǥե©¥ë¥È¤Î¥¨¥ó¥³¡¼¥É¡¿¥Ç¥³¡¼¥É¥ë¡¼¥Æ¥£¥ó¤òÄ󶡤¹¤ë¡£  */
473
474     MCODING_TYPE_ISO_2022,
475
476     /***en
477         A coding system of this type is for byte sequences of
478         miscellaneous structures.
479
480         The m17n library does not provide decoding and encoding
481         routines of this type.  They must be provided by the
482         application program.  */
483
484     /***ja
485         ¤³¤Î¥¿¥¤¥×¤Î¥³¡¼¥É·Ï¤Ï¡¢¤½¤Î¾¤Î¹½Â¤¤Î¥Ð¥¤¥ÈÎó¤Î¤¿¤á¤Î¤â¤Î¤Ç¤¢¤ë¡£
486
487         m17n ¥é¥¤¥Ö¥é¥ê¤Ï¤³¤Î¥¿¥¤¥×ÍѤΥ¨¥ó¥³¡¼¥É¡¿¥Ç¥³¡¼¥É¥ë¡¼¥Æ¥£¥ó¤òÄ󶡤·¤Ê¤¤¤Î¤Ç¡¢¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é¥à¦¤Ç½àÈ÷¤¹¤ëɬÍפ¬¤¢¤ë¡£  */
488
489     MCODING_TYPE_MISC
490   };
491 /*=*/
492
493 /*** @ingroup m17nConv */
494 /***en 
495     @brief  Bit-masks to specify the detail of coding system whose type is MCODING_TYPE_ISO_2022.  */
496 /***ja 
497     @brief MCODING_TYPE_ISO_2022 ¥¿¥¤¥×¤Î¥³¡¼¥É·Ï¤Î¾ÜºÙ¤òɽ¤ï¤¹¥Ó¥Ã¥È¥Þ¥¹¥¯.  */
498
499 enum MCodingFlagISO2022
500   {
501     /***en
502         On encoding, reset the invocation and designation status to
503         initial at end of line.  */
504     /***ja ¥¨¥ó¥³¡¼¥É¤ÎºÝ¡¢¹ÔËö¤Ç¸Æ¤Ó½Ð¤· (invocation) ¤È»Ø¼¨
505         (designation) ¤Î¾õÂÖ¤ò½é´üÃͤËÌ᤹¡£   */
506     MCODING_ISO_RESET_AT_EOL =          0x1,
507
508     /***en
509         On encoding, reset the invocation and designation status to
510         initial before any control codes.  */
511     /***ja
512         ¥¨¥ó¥³¡¼¥É¤ÎºÝ¡¢¤¹¤Ù¤Æ¤ÎÀ©¸æʸ»ú¤ÎÁ°¤Ç¡¢¸Æ¤Ó½Ð¤·
513         (invocation) ¤È»Ø¼¨ (designation) ¤Î¾õÂÖ¤ò½é´üÃͤËÌ᤹¡£        */
514     MCODING_ISO_RESET_AT_CNTL =         0x2,
515
516     /***en
517         Use the right graphic plane.  */
518     /***ja
519         ¿Þ·Áʸ»ú½¸¹ç¤Î±¦Â¦¤ò»È¤¦¡£  */
520     MCODING_ISO_EIGHT_BIT =             0x4,
521
522     /***en
523         Use the non-standard 4 bytes format for designation sequence
524         for charsets JISX0208-1978, GB2312, and JISX0208-1983.  */
525     /***ja
526         JISX0208-1978, GB2312, JISX0208-1983 
527         ¤Îʸ»ú½¸¹ç¤ËÂФ¹¤ë»Ø¼¨¥·¡¼¥¯¥¨¥ó¥¹¤È¤·¤Æ¡¢Èóɸ½à¤Î4¥Ð¥¤¥È·Á¼°¤òÍѤ¤¤ë¡£ */
528
529     MCODING_ISO_LONG_FORM =             0x8,
530
531     /***en
532         On encoding, unless explicitly specified, designate charsets
533         to G0.  */
534     /***ja 
535         ¥¨¥ó¥³¡¼¥É¤ÎºÝ¡¢Æä˻ØÄꤵ¤ì¤Ê¤¤¸Â¤ê¡¢Ê¸»ú½¸¹ç¤ò G0 
536         ¤Ë»Ø¼¨¤¹¤ë¡£*/
537     MCODING_ISO_DESIGNATION_G0 =                0x10,
538
539     /***en
540         On encoding, unless explicitly specified, designate charsets
541         except for ASCII to G1.  */
542     /***ja
543         ¥¨¥ó¥³¡¼¥É¤ÎºÝ¡¢Æä˻ØÄꤵ¤ì¤Ê¤¤¸Â¤ê¡¢ASCII °Ê³°¤Îʸ»ú½¸¹ç¤ò 
544         G1 ¤Ë»Ø¼¨¤¹¤ë¡£*/
545     MCODING_ISO_DESIGNATION_G1 =                0x20,
546
547     /***en
548         On encoding, unless explicitly specified, designate 94-chars
549         charsets to G0, 96-chars charsets to G1.  */
550     /***ja
551         ¥¨¥ó¥³¡¼¥É¤ÎºÝ¡¢Æä˻ØÄꤵ¤ì¤Ê¤¤¸Â¤ê¡¢94ʸ»ú½¸¹ç¤ò G0 
552         ¤Ë¡¢96ʸ»ú½¸¹ç¤ò G1 ¤Ë»Ø¼¨¤¹¤ë¡£*/
553     MCODING_ISO_DESIGNATION_CTEXT =     0x40,
554
555     /***en
556         On encoding, encode such charsets not conforming to ISO-2022
557         by ESC % / ..., and encode non-supported Unicode characters by
558         ESC % G ... ESC % @@ .  On decoding, handle those escape
559         sequences.  */
560     /***ja
561         ¥¨¥ó¥³¡¼¥É¤ÎºÝ¡¢ISO-2022 ¤Ë¹çÃפ·¤Ê¤¤Ê¸»ú½¸¹ç¤ò ESC % / ... 
562         ¤Ç¥¨¥ó¥³¡¼¥É¤¹¤ë¡£¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Ê¤¤ Unicode Ê¸»ú¤Ï ESC % G ...
563         ESC % @@ ¤Ç¥¨¥ó¥³¡¼¥É¤¹¤ë¡£
564         ¥Ç¥³¡¼¥É¤ÎºÝ¡¢¤³¤ì¤é¤Î¥¨¥¹¥±¡¼¥×¡¦¥·¡¼¥±¥ó¥¹¤ò²ò¼á¤¹¤ë¡£  */
565     MCODING_ISO_DESIGNATION_CTEXT_EXT = 0x80,
566
567     /***en
568         Use locking shift.  */
569     /***ja
570         ¥í¥Ã¥­¥ó¥°¥·¥Õ¥È¤ò»È¤¦¡£  */
571     MCODING_ISO_LOCKING_SHIFT = 0x100,
572
573     /***en
574         Use single shift (SS2 (0x8E or ESC N), SS3 (0x8F or ESC O)).  */
575     /***ja
576         ¥·¥ó¥°¥ë¥·¥Õ¥È (SS2 (0x8E or ESC N), SS3 (0x8F or ESC O)) ¤ò»È¤¦¡£  */
577     MCODING_ISO_SINGLE_SHIFT =  0x200,
578
579     /***en
580         Use 7-bit single shift 2 (SS2 (0x19)).  */
581     /***ja
582         7¥Ó¥Ã¥È¥·¥ó¥°¥ë¥·¥Õ¥È 2 (SS2 (0x19)) ¤ò»È¤¦¡£  */
583     MCODING_ISO_SINGLE_SHIFT_7 =        0x400,
584
585     /***en
586         Use EUC-TW like special shifting.  */
587     /***ja
588         EUC-TW É÷¤ÎÆÃÊ̤ʥ·¥Õ¥È¤ò»È¤¦¡£  */
589     MCODING_ISO_EUC_TW_SHIFT =  0x800,
590
591     /***en
592         Use ISO-6429 escape sequences to indicate direction.
593         Not yet implemented.  */
594     /***ja
595         ISO-6429 ¤Î¥¨¥¹¥±¡¼¥×¥·¡¼¥¯¥¨¥ó¥¹¤ÇÊý¸þ¤ò»Ø¼¨¤¹¤ë¡£Ì¤¼ÂÁõ¡£ */
596     MCODING_ISO_ISO6429 =               0x1000,
597
598     /***en
599         On encoding, if a charset has revision number, produce escape
600         sequences to specify the number.  */
601     /***ja
602         ¥¨¥ó¥³¡¼¥É¤ÎºÝ¡¢Ê¸»ú¥»¥Ã¥È¤Ë revision number 
603         ¤¬¤¢¤ì¤Ð¤½¤ì¤òɽ¤ï¤¹¥¨¥¹¥±¡¼¥×¥·¡¼¥¯¥¨¥ó¥¹¤òÀ¸À®¤¹¤ë¡£        */
604     MCODING_ISO_REVISION_NUMBER =       0x2000,
605
606     /***en
607         Support all ISO-2022 charsets.  */
608     /***ja
609         ISO-2022 ¤ÎÁ´Ê¸»ú½¸¹ç¤ò¥µ¥Ý¡¼¥È¤¹¤ë¡£  */
610     MCODING_ISO_FULL_SUPPORT =          0x3000,
611
612     MCODING_ISO_FLAG_MAX
613   };
614 /*=*/
615
616 /*** @ingroup m17nConv */
617 /***en
618     @brief Structure for a coding system of type #MCODING_TYPE_ISO_2022.
619
620     Structure for extra information about a coding system of type
621     MCODING_TYPE_ISO_2022.  */
622
623 /***ja 
624     @brief #MCODING_TYPE_ISO_2022 ¥¿¥¤¥×¤Î¥³¡¼¥É·Ï¤ÇɬÍפÊÉղþðÊóÍѹ½Â¤ÂÎ.
625
626     MCODING_TYPE_ISO_2022 ¥¿¥¤¥×¤Î¥³¡¼¥É·Ï¤ÇɬÍפÊÉղþðÊóÍѤòÊÝ»ý¤¹¤ë¤¿¤á¤Î¹½Â¤ÂΡ£
627
628     @latexonly \IPAlabel{MCodingInfoISO2022} @endlatexonly  */
629
630 typedef struct
631 {
632   /***en
633       Table of numbers of an ISO2022 code extension element invoked
634       to each graphic plane (Graphic Left and Graphic Right).  -1
635       means no code extension element is invoked to that plane.  */
636
637   /***ja
638       ³Æ¿Þ·Áʸ»úÎΰè (Graphic Left ¤È Graphic Right) ¤Ë¸Æ¤Ó½Ð¤µ¤ì¤Æ¤¤¤ë¡¢
639       ISO2022 Éä¹ç³ÈÄ¥Í×ÁǤÎÈÖ¹æ¤Î¥Æ¡¼¥Ö¥ë¡£-1 
640       ¤Ï¤½¤ÎÎΰè¤Ë¤É¤ÎÉä¹ç³ÈÄ¥Í×ÁǤâ¸Æ¤Ó½Ð¤µ¤ì¤Æ¤¤¤Ê¤¤¤³¤È¤ò¼¨¤¹¡£   */
641
642   int initial_invocation[2];
643
644   /***en
645       Table of code extension elements.  The Nth element corresponds
646       to the Nth charset in $CHARSET_NAMES, which is an argument given
647       to the mconv_define_coding () function.
648
649       If an element value is 0..3, it specifies a graphic register
650       number to designate the corresponds charset.  In addition, the
651       charset is initially designated to that graphic register.
652
653       If the value is -4..-1, it specifies a graphic register number
654       0..3 respectively to designate the corresponds charset.
655       Initially, the charset is not designated to any graphic
656       register.  */
657
658   /***ja
659       Éä¹ç³ÈÄ¥Í×ÁǤΥơ¼¥Ö¥ë¡£NÈÖÌܤÎÍ×ÁǤϡ¢$CHARSET_NAMES ¤Î N 
660       ÈÖÌܤÎʸ»ú¥»¥Ã¥È¤ËÂбþ¤¹¤ë¡£$CHARSET_NAMES ¤Ï´Ø¿ô 
661       mconv_define_coding () ¤Î°ú¿ô¤È¤Ê¤ë¡£
662
663       Ãͤ¬ 0..3 ¤À¤Ã¤¿¤é¡¢Âбþ¤¹¤ëʸ»ú¥»¥Ã¥È¤ò G0..G3 
664       ¤Î¤½¤ì¤¾¤ì¤Ë»Ø¼¨¤¹¤ë¤³¤È¡¢¤Þ¤¿½é´ü¾õÂ֤Ǥ¹¤Ç¤Ë G0..G3
665       ¤Ë»Ø¼¨¤µ¤ì¤Æ¤¤¤ë¤³¤È¤ò°ÕÌ£¤¹¤ë¡£
666
667       Ãͤ¬ -4..-1 ¤À¤Ã¤¿¤é¡¢Âбþ¤¹¤ëʸ»ú¥»¥Ã¥È¤ò G0..G3 
668       ¤Î¤½¤ì¤¾¤ì¤Ë»Ø¼¨¤¹¤ë¤³¤È¡¢¤·¤«¤·½é´ü¾õÂ֤ǤϤɤ³¤Ë¤â»Ø¼¨¤µ¤ì¤Æ¤¤¤Ê¤¤¤³¤È¤ò°ÕÌ£¤¹¤ë¡£
669         */
670
671   char designations[32];
672
673   /***en
674       Bitwise OR of @c enum @c MCodingFlagISO2022 .  */
675
676   /***ja
677       @c enum @c MCodingFlagISO2022 ¤Î¥Ó¥Ã¥Èñ°Ì¤Ç¤ÎÏÀÍý OR  */
678
679   unsigned flags;
680
681 } MCodingInfoISO2022;
682 /*=*/
683
684 /*** @ingroup m17nConv */
685 /***en
686     @brief Structure for extra information about a coding system of type #MCODING_TYPE_UTF.
687     */
688
689 /***ja
690     @brief #MCODING_TYPE_UTF ¥¿¥¤¥×¤Î¥³¡¼¥É·Ï¤ÇɬÍפÊÉղþðÊóÍѤι½Â¤ÂÎ.
691
692     @latexonly \IPApage{MCodingInfoUTF} @endlatexonly
693
694     @latexonly \IPAlabel{MCodingInfoUTF} @endlatexonly  */
695
696 typedef struct
697 {
698   /***en
699       Specify bits of a code unit.  The value must be 8, 16, or 32.  */
700   /***ja
701       ¥³¡¼¥ÉĹ¡Ê¥Ó¥Ã¥È¿ô¡Ë¤Î»ØÄê¡£ÃͤϠ8, 16, 32 ¤Î¤¤¤º¤ì¤«¡£  */
702   int code_unit_bits;
703
704   /***en
705       Specify how to handle the heading BOM (byte order mark).  The
706       value must be 0, 1, or 2.  The meanings are as follows:
707
708       0: On decoding, check the first two byte.  If they are BOM,
709       decide endian by them. If not, decide endian by the member @c
710       endian.  On encoding, produce byte sequence according to
711       @c endian with heading BOM.
712
713       1: On decoding, do not handle the first two bytes as BOM, and
714       decide endian by @c endian.  On encoding, produce byte sequence
715       according to @c endian without BOM.
716
717       2: On decoding, handle the first two bytes as BOM and decide
718       ending by them.  On encoding, produce byte sequence according to
719       @c endian with heading BOM.
720
721       If <code_unit_bits> is 8, the value has no meaning.  */
722
723   /***ja
724       ÀèƬ¤Î BOM (¥Ð¥¤¥È¥ª¡¼¥À¡¼¥Þ¡¼¥¯) ¤Î¼è¤ê°·¤¤¤ò»ØÄꤹ¤ë¡£ÃͤϠ0,
725       1, 2 ¤Î¤¤¤º¤ì¤«¤Ç¤¢¤ê¡¢¤½¤ì¤¾¤ì¤Î°ÕÌ£¤Ï°Ê²¼¤Î¤è¤¦¤Ë¤Ê¤ë¡£
726
727       0: ¥Ç¥³¡¼¥É¤ÎºÝ¤ËºÇ½é¤Î 2 ¥Ð¥¤¥È¤òÄ´¤Ù¤ë¡£¤â¤·¤½¤ì¤¬ BOM 
728       ¤Ç¤¢¤ì¤Ð¡¢¥¨¥ó¥Ç¥£¥¢¥ó¤ò¤½¤ì¤ÇȽÄꤹ¤ë¡£¤½¤¦¤Ç¤Ê¤±¤ì¤Ð¡¢¥á¥ó¥Ð @c
729       endian ¤Ë½¾¤Ã¤Æ¥¨¥ó¥Ç¥£¥¢¥ó¤ò·èÄꤹ¤ë¡£¥¨¥ó¥³¡¼¥É¤ÎºÝ¤Ë¤Ï @c
730       endian ¤Ë½¾¤Ã¤¿¥Ð¥¤¥ÈÎó¤òÀèƬ¤Ë BOM ÉÕ¤ÇÀ¸À®¤¹¤ë¡£
731
732       1: ¥Ç¥³¡¼¥É¤ÎºÝ¡¢ºÇ½é¤Î 2 ¥Ð¥¤¥È¤ò BOM ¤È¤·¤Æ°·¤ï¤º¡¢¥¨¥ó¥Ç¥£¥¢¥ó¤Ï
733       @c endian ¤ÇȽÄꤹ¤ë¡£¥¨¥ó¥³¡¼¥É¤ÎºÝ¤Ë¤Ï¡¢BOM ¤ò½ÐÎϤ»¤º¡¢
734       @c endian ¤Ë±þ¤¸¤¿¥Ð¥¤¥ÈÎó¤òÀ¸À®¤¹¤ë¡£
735
736       2: ¥Ç¥³¡¼¥É¤ÎºÝ¤ËºÇ½é¤Î2¥Ð¥¤¥È¤ò BOM¤È¤·¤Æ°·¤¤¡¢¤½¤ì¤Ë½¾¤Ã¤Æ¥¨¥ó¥Ç¥£¥¢¥ó¤òȽÄꤹ¤ë¡£
737       ¥¨¥ó¥³¡¼¥É¤ÎºÝ¤Ë¤Ï @c endian ¤Ë±þ¤¸¤¿¥Ð¥¤¥ÈÎó¤òÀèƬ¤Ë BOM ÉÕ¤­¤ÇÀ¸À®¤¹¤ë¡£  */
738   int bom;
739
740   /***en
741       Specify the endian type.  The value must be 0 or 1.  0 means
742       little endian, and 1 means big endian.
743
744       If <code_unit_bits> is 8, the value has no meaning.  */
745   /***ja
746       ¥¨¥ó¥Ç¥£¥¢¥ó¤Î¥¿¥¤¥×¤ò»ØÄꤹ¤ë¡£ÃͤϠ0 ¤« 1 ¤Ç¤¢¤ê¡¢0 
747       ¤Ê¤é¤Ð¥ê¥È¥ë¥¨¥ó¥Ç¥£¥¢¥ó¡¢1 ¤Ê¤é¤Ð¥Ó¥Ã¥°¥¨¥ó¥Ç¥£¥¢¥ó¤Ç¤¢¤ë¡£
748
749       <code_unit_bits> ¤¬ 8 ¤Î¾ì¹ç¤Ë¤Ï¡¢¤³¤ÎÃͤϰÕÌ£¤ò»ý¤¿¤Ê¤¤¡£
750   */
751   int endian;
752 } MCodingInfoUTF;
753 /*=*/
754
755 extern MSymbol mconv_define_coding (const char *name, MPlist *plist,
756                                     int (*resetter) (MConverter *),
757                                     int (*decoder) (const unsigned char *, int,
758                                                     MText *, MConverter *),
759                                     int (*encoder) (MText *, int, int,
760                                                     unsigned char *, int,
761                                                     MConverter *),
762                                     void *extra_info);
763
764 extern MSymbol mconv_resolve_coding (MSymbol symbol);
765
766 extern int mconv_list_codings (MSymbol **symbols);
767
768 extern MConverter *mconv_buffer_converter (MSymbol coding,
769                                            const unsigned char *buf,
770                                            int n);
771
772 extern MConverter *mconv_stream_converter (MSymbol coding, FILE *fp);
773
774 extern int mconv_reset_converter (MConverter *converter);
775
776 extern void mconv_free_converter (MConverter *converter);
777
778 extern MConverter *mconv_rebind_buffer (MConverter *converter,
779                                         const unsigned char *buf, int n);
780
781 extern MConverter *mconv_rebind_stream (MConverter *converter, FILE *fp);
782
783 extern MText *mconv_decode (MConverter *converter, MText *mt);
784
785 MText *mconv_decode_buffer (MSymbol name, const unsigned char *buf, int n);
786
787 MText *mconv_decode_stream (MSymbol name, FILE *fp);   
788
789 extern int mconv_encode (MConverter *converter, MText *mt);
790
791 extern int mconv_encode_range (MConverter *converter, MText *mt,
792                                int from, int to);
793
794 extern int mconv_encode_buffer (MSymbol name, MText *mt,
795                                 unsigned char *buf, int n);
796
797 extern int mconv_encode_stream (MSymbol name, MText *mt, FILE *fp);
798
799 extern int mconv_getc (MConverter *converter);
800
801 extern int mconv_ungetc (MConverter *converter, int c);
802
803 extern int mconv_putc (MConverter *converter, int c);
804
805 extern MText *mconv_gets (MConverter *converter, MText *mt);
806
807 /* (S4) Locale related functions corresponding to libc functions */
808 /*=*/
809 /*** @ingroup m17nShell */
810 /***en @defgroup m17nLocale Locale */
811 /***ja @defgroup m17nLocale ¥í¥±¡¼¥ë */
812 /*=*/
813
814 /*** @ingroup m17nLocale */
815 /***en
816     @brief @c struct @c MLocale.
817
818     The structure @c MLocale is used to hold information about name,
819     language, territory, modifier, codeset, and the corresponding
820     coding system of locales.
821
822     The contents of this structure are implementation dependent.  Its
823     internal structure is concealed from application programs.  */
824
825 /***ja
826     @brief @c MLocale ¹½Â¤ÂÎ.
827
828     @c MLocale ¹½Â¤ÂΤϡ¢¥í¥±¡¼¥ë¤Î̾Á°¡¢¸À¸ì¡¢ÃÏ°è¡¢¥â¥Ç¥£¥Õ¥¡¥¤¥¢¡¢¥³¡¼¥É¥»¥Ã¥È¡¢¤ª¤è¤ÓÂбþ¤¹¤ë¥³¡¼¥É·Ï¤Ë´Ø¤¹¤ë¾ðÊó¤òÊÝ»ý¤¹¤ë¤¿¤á¤ËÍѤ¤¤é¤ì¤ë¡£
829
830     ¤³¤Î¹½Â¤ÂΤÎÆâÍƤϼÂÁõ¤Ë°Í¸¤¹¤ë¡£ 
831     ÆâÉô¹½Â¤¤Ï¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é¥à¤«¤é¤Ï¸«¤¨¤Ê¤¤¡£  */
832
833 /***
834     @seealso
835     mlocale_get_prop () */
836
837 typedef struct MLocale MLocale;
838
839 /*=*/
840
841 extern MSymbol Miso639_1, Miso639_2;
842 extern MSymbol Mterritory;
843 extern MSymbol Mmodifier;
844 extern MSymbol Mcodeset;
845
846 extern MPlist *mlanguage_list (void);
847
848 extern MSymbol mlanguage_code (MSymbol language, int len);
849
850 extern MPlist *mlanguage_name_list (MSymbol language, MSymbol target);
851
852 extern MText *mlanguage_text (MSymbol language);
853
854 extern MPlist *mscript_list (void);
855
856 extern MPlist *mscript_language_list (MSymbol script);
857
858 extern MSymbol mlanguage_name (MSymbol language);
859
860 extern MLocale *mlocale_set (int category, const char *locale);
861
862 extern MSymbol mlocale_get_prop (MLocale *locale, MSymbol key);
863
864 extern int mtext_ftime (MText *mt, const char *format, const struct tm *tm,
865                         MLocale *locale);
866
867 extern MText *mtext_getenv (const char *name);
868
869 extern int mtext_putenv (MText *mt);
870
871 extern int mtext_coll (MText *mt1, MText *mt2);
872
873 /*
874  *  (9) Miscellaneous functions of libc level (not yet implemented)
875  */
876
877 /*
878 extern int mtext_width (MText *mt, int n);
879 extern MText *mtext_tolower (MText *mt);
880 extern MText *mtext_toupper (MText *mt);
881 */
882
883 /*
884  *  (10) Input method
885  */
886 /*=*/
887 /*** @ingroup m17nShell */
888 /***en @defgroup m17nInputMethod Input Method (basic) */
889 /***ja @defgroup m17nInputMethod ÆþÎϥ᥽¥Ã¥É (´ðËÜÉôʬ) */
890 /*=*/
891
892 /*** @addtogroup m17nInputMethod 
893      @{ */
894
895 /* Struct forward declaration.  */
896 typedef struct MInputMethod MInputMethod;
897 typedef struct MInputContext MInputContext;
898
899 /***en
900     @brief Type of input method callback functions.
901
902     This is the type of callback functions called from input method
903     drivers.  #IC is a pointer to an input context, #COMMAND is a name
904     of callback for which the function is called.   */
905 /***ja
906     @brief ÆþÎϥ᥽¥Ã¥É¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤Î·¿Àë¸À.
907
908     ÆþÎϥ᥽¥Ã¥É¤«¤é¸Æ¤Ð¤ì¤ë¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤Î·¿¤Ç¤¢¤ë¡£#IC 
909     ¤ÏÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¤Ø¤Î¥Ý¥¤¥ó¥¿¡¢#COMMAND ¤Ï´Ø¿ô¤¬¸Æ¤Ð¤ì¤ë¥³¡¼¥ë¥Ð¥Ã¥¯¤Î̾Á°¤Ç¤¢¤ë¡£  */
910
911 typedef void (*MInputCallbackFunc) (MInputContext *ic, MSymbol command);
912 /*=*/
913
914 /***en
915     @brief Structure of input method driver.
916
917     The type @c MInputDriver is the structure of an input method driver that
918     contains several functions to handle an input method.  */
919
920 /***ja
921     @brief ÆþÎϥɥ饤¥ÐÍѹ½Â¤ÂÎ.
922
923     @c MInputDriver ¤Ï¡¢ÆþÎϥ᥽¥Ã¥É¤ò¼è¤ê°·¤¦´Ø¿ô¤ò´Þ¤àÆþÎϥ᥽¥Ã¥É¥É¥é¥¤¥Ð¤Î¹½Â¤ÂΤη¿¤Ç¤¢¤ë¡£  */
924
925 typedef struct MInputDriver
926 {
927   /***en
928       @brief Open an input method.
929
930       This function opens the input method $IM.  It is called from the
931       function minput_open_im () after all member of $IM but <info>
932       set.  If opening $IM succeeds, it returns 0.  Otherwise, it
933       returns -1.  The function can setup $IM->info to keep various
934       information that is referred by the other driver functions.  */
935
936   /***ja
937       @brief ÆþÎϥ᥽¥Ã¥É¤ò¥ª¡¼¥×¥ó¤¹¤ë.
938
939       ¤³¤Î´Ø¿ô¤Ï¡¢ÆþÎϥ᥽¥Ã¥É $IM ¤ò¥ª¡¼¥×¥ó¤¹¤ë¡£$IM ¤Î <info> 
940       °Ê³°¤ÎÁ´¥á¥ó¥Ð¡¼¤¬¥»¥Ã¥È¤µ¤ì¤¿¸å¤Ç¡¢´Ø¿ô minput_open_im () 
941       ¤«¤é¸Æ¤Ð¤ì¤ë¡£$IM ¤ò¥ª¡¼¥×¥ó¤Ç¤­¤ì¤Ð 0 ¤ò¡¢¤Ç¤­¤Ê¤±¤ì¤Ð -1¤òÊÖ¤¹¡£
942       ¤³¤Î´Ø¿ô¤Ï $IM->info 
943       ¤òÀßÄꤷ¤Æ¡¢Â¾¤Î¥É¥é¥¤¥Ð´Ø¿ô¤«¤é»²¾È¤µ¤ì¤ë¾ðÊó¤òÊÝ»ý¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
944       */
945
946   int (*open_im) (MInputMethod *im);
947
948   /***en
949       @brief Close an input method.
950
951       This function closes the input method $IM.  It is called from
952       the function minput_close_im ().  It frees all memory allocated
953       for $IM->info (if any) after finishing all the tasks of closing
954       the input method.  But, the other members of $IM should not be
955       touched.  */
956
957   /***ja
958       @brief ÆþÎϥ᥽¥Ã¥É¤ò¥¯¥í¡¼¥º¤¹¤ë.
959
960       ¤³¤Î´Ø¿ô¤Ï¡¢ÆþÎϥ᥽¥Ã¥É $IM ¤ò¥¯¥í¡¼¥º¤¹¤ë¡£´Ø¿ô 
961       minput_close_im () ¤«¤é¸Æ¤Ð¤ì¤ë¡£
962       ÆþÎϥ᥽¥Ã¥É¤Î¥¯¥í¡¼¥º¤¬¤¹¤Ù¤Æ½ªÎ»¤·¤¿»þÅÀ¤Ç¡¢¤³¤Î´Ø¿ô¤Ï$IM->info 
963       ¤Ë³ä¤êÅö¤Æ¤é¤ì¤Æ¤¤¤ë¥á¥â¥ê¤ò(¤¢¤ì¤Ð)¤¹¤Ù¤Æ³«Êü¤¹¤ë¡£
964       ¤¿¤À¤·¡¢$IM ¤Î¾¤Î¥á¥ó¥Ð¤Ë±Æ¶Á¤òÍ¿¤¨¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
965         */
966
967   void (*close_im) (MInputMethod *im);
968
969   /***en
970       @brief Create an input context.
971
972       This function creates the input context $IC.  It is called from
973       the function minput_create_ic () after all members of $IC but
974       <info> are set.  If creating $IC succeeds, it returns 0.
975       Otherwise, it returns -1.  The function can setup $IC->info to
976       keep various information that is referred by the other driver
977       functions.  */
978
979   /***ja
980       @brief ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¤òÀ¸À®¤¹¤ë.
981
982       ¤³¤Î´Ø¿ô¤ÏÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È $IC ¤òÀ¸À®¤¹¤ë¡£
983       $IC ¤Î <info> °Ê³°¤ÎÁ´¥á¥ó¥Ð¡¼¤¬¥»¥Ã¥È¤µ¤ì¤¿¸å¤Ç¡¢´Ø¿ô
984       minput_create_ic () ¤«¤é¸Æ¤Ð¤ì¤ë¡£
985       $IC ¤òÀ¸À®¤Ç¤­¤ì¤Ð 0 ¤ò¡¢¤Ç¤­¤Ê¤±¤ì¤Ð -1 ¤òÊÖ¤¹¡£
986       ¤³¤Î´Ø¿ô¤Ï $IC->info ¤òÀßÄꤷ¤Æ¡¢Â¾¤Î¥É¥é¥¤¥Ð´Ø¿ô¤«¤é»²¾È¤µ¤ì¤ë¾ðÊó¤òÊÝ»ý¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£  */
987
988
989   int (*create_ic) (MInputContext *ic);
990
991   /***en
992       @brief Destroy an input context.
993
994       This function is called from the function minput_destroy_ic ()
995       and destroys the input context $IC.  It frees all memory
996       allocated for $IC->info (if any) after finishing all the tasks
997       of destroying the input method.  But, the other members of $IC
998       should not be touched.  */
999
1000   /***ja
1001       @brief ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¤òÇ˲õ¤¹¤ë.
1002
1003       ´Ø¿ô minput_destroy_ic () ¤«¤é¸Æ¤Ð¤ì¡¢ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È $IC 
1004       ¤òÇ˲õ¤¹¤ë¡£ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¤ÎÇ˲õ¤¬¤¹¤Ù¤Æ½ªÎ»¤·¤¿»þÅÀ¤Ç¡¢$IC->info 
1005       ¤Ë³ä¤êÅö¤Æ¤é¤ì¤Æ¤¤¤ë¥á¥â¥ê¤ò(¤¢¤ì¤Ð)¤¹¤Ù¤Æ³«Êü¤¹¤ë¡£¤¿¤À¤·¡¢$IC 
1006       ¤Î¾¤Î¥á¥ó¥Ð¤Ë±Æ¶Á¤òÍ¿¤¨¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£  */
1007
1008   void (*destroy_ic) (MInputContext *ic);
1009
1010   /***en
1011       @brief Filter an input key.
1012
1013       This function is called from the function minput_filter () and
1014       filters an input key.  $KEY and $ARG are the same as what given
1015       to minput_filter ().
1016
1017       The task of the function is to handle $KEY, update the internal
1018       state of $IC.  If $KEY is absorbed by the input method and no
1019       text is produced, it returns 1.  Otherwise, it returns 0.
1020
1021       It may update $IC->status, $IC->preedit, $IC->cursor_pos,
1022       $IC->ncandidates, $IC->candidates, and $IC->produced if that is
1023       necessary for the member <callback>.
1024
1025       The meaning of $ARG depends on the input method river.  See the
1026       documentation of @c minput_default_driver and @c
1027       minput_gui_driver for instance.  */
1028
1029   /***ja
1030       @brief ÆþÎÏ¥­¡¼¤ò¥Õ¥£¥ë¥¿¤¹¤ë.
1031
1032       ´Ø¿ô minput_filter () ¤«¤é¸Æ¤Ð¤ì¡¢ÆþÎÏ¥­¡¼¤ò¥Õ¥£¥ë¥¿¤¹¤ë¡£°ú¿ô 
1033       $KEY, $ARG ¤Ï´Ø¿ô minput_filter () ¤Î¤â¤Î¤ÈƱ¤¸¡£
1034
1035       ¤³¤Î´Ø¿ô¤Ï $KEY ¤ò½èÍý¤·¡¢$IC ¤ÎÆâÉô¾õÂÖ¤ò¹¹¿·¤¹¤ë¡£ $KEY 
1036       ¤¬ÆþÎϥ᥽¥Ã¥É¤ËµÛ¼ý¤µ¤ì¤Æ¥Æ¥­¥¹¥È¤¬À¸À®¤µ¤ì¤Ê¤«¤Ã¤¿¾ì¹ç¤Ë¤Ï¡¢ 
1037       1 ¤òÊÖ¤¹¡£¤½¤¦¤Ç¤Ê¤±¤ì¤Ð 0 ¤òÊÖ¤¹¡£
1038
1039       ¥á¥ó¥Ð <callback> ¤ËɬÍפǤ¢¤ì¤Ð¡¢$IC->status, $IC->preedit,
1040       $IC->cursor_pos, $IC->ncandidates, $IC->candidates,
1041       $IC->produced ¤ò¹¹¿·¤Ç¤­¤ë¡£
1042
1043       $ARG ¤Î°ÕÌ£¤ÏÆþÎϥ᥽¥Ã¥É¥É¥é¥¤¥Ð¤Ë°Í¸¤¹¤ë¡£Îã¤Ï @c
1044       minput_default_driver ¤Þ¤¿¤Ï @c minput_gui_driver 
1045       ¤ÎÀâÌÀ¤ò»²¾È¤Î¤³¤È¡£ */
1046
1047   int (*filter) (MInputContext *ic, MSymbol key, void *arg);
1048
1049   /***en
1050       @brief  Lookup a produced text in an input context.
1051
1052       It is called from the function minput_lookup () and looks up a
1053       produced text in the input context $IC.  This function
1054       concatenate a text produced by the input key $KEY (if any) to
1055       M-text $MT.  If $KEY was correctly handled by the input method
1056       of $IC, it returns 0.  Otherwise, it returns 1.
1057
1058       The meaning of $ARG depends on the input method driver.  See the
1059       documentation of @c minput_default_driver and @c
1060       minput_gui_driver for instance.  */
1061
1062   /***ja
1063       @brief ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¤ÇÀ¸À®¤µ¤ì¤ë¥Æ¥­¥¹¥È¤Î³ÍÆÀ.
1064
1065       ´Ø¿ô minput_lookup () ¤«¤é¸Æ¤Ð¤ì¡¢ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È $IC 
1066       ¤ÇÀ¸À®¤µ¤ì¤ë¥Æ¥­¥¹¥È¤ò¸¡º÷¤¹¤ë¡£ÆþÎÏ¥­¡¼ $KEY 
1067       ¤Ë¤è¤Ã¤ÆÀ¸À®¤µ¤ì¤ë¥Æ¥­¥¹¥È¤¬¤¢¤ì¤Ð¡¢M-text $MT ¤ËÄɲ乤롣 $KEY
1068       ¤¬ÆþÎϥ᥽¥Ã¥É $IC ¤Ë¤è¤Ã¤ÆÀµ¤·¤¯½èÍý¤µ¤ì¤ì¤Ð 0 ¤òÊÖ¤¹¡£¤½¤¦¤Ç¤Ê¤±¤ì¤Ð 1 ¤òÊÖ¤¹¡£
1069
1070       $ARG ¤Î°ÕÌ£¤ÏÆþÎϥ᥽¥Ã¥É¥É¥é¥¤¥Ð¤Ë°Í¸¤¹¤ë¡£Îã¤Ï @c
1071       minput_default_driver ¤Þ¤¿¤Ï @c minput_gui_driver ¤ÎÀâÌÀ¤ò»²¾È¤Î
1072       ¤³¤È¡£ */
1073
1074   int (*lookup) (MInputContext *ic, MSymbol key, void *arg, MText *mt);
1075
1076   /***en
1077       @brief List of callback functions.
1078
1079       List of callback functions.  Keys are one of
1080       #Minput_preedit_start, #Minput_preedit_draw,
1081       #Minput_preedit_done, #Minput_status_start, #Minput_status_draw,
1082       #Minput_status_done, #Minput_candidates_start,
1083       #Minput_candidates_draw, #Minput_candidates_done,
1084       #Minput_set_spot, #Minput_toggle, #Minput_reset,
1085       #Minput_get_surrounding_text, #Minput_delete_surrounding_text.
1086       Values are functions of type #MInputCallbackFunc.  */
1087   /***ja
1088       @brief ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤Î¥ê¥¹¥È.
1089
1090       ¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤Î¥ê¥¹¥È¡£¥­¡¼¤Ï¼¡¤Î¤¤¤º¤ì¤«¡£
1091       #Minput_preedit_start, #Minput_preedit_draw,
1092       #Minput_preedit_done, #Minput_status_start, #Minput_status_draw,
1093       #Minput_status_done, #Minput_candidates_start,
1094       #Minput_candidates_draw, #Minput_candidates_done,
1095       #Minput_set_spot, #Minput_toggle, #Minput_reset,
1096       #Minput_get_surrounding_text, #Minput_delete_surrounding_text¡£
1097       ÃͤÏ#MInputCallbackFunc ·¿¤Î´Ø¿ô¡£  */
1098   MPlist *callback_list;
1099
1100 } MInputDriver;
1101 /*=*/
1102
1103 extern MInputDriver minput_default_driver;
1104
1105 extern MSymbol Minput_driver;
1106
1107 extern MInputDriver *minput_driver;
1108
1109 /** Symbols for callback commands.  */
1110 extern MSymbol Minput_preedit_start;
1111 extern MSymbol Minput_preedit_draw;
1112 extern MSymbol Minput_preedit_done;
1113 extern MSymbol Minput_status_start;
1114 extern MSymbol Minput_status_draw;
1115 extern MSymbol Minput_status_done;
1116 extern MSymbol Minput_candidates_start;
1117 extern MSymbol Minput_candidates_draw;
1118 extern MSymbol Minput_candidates_done;
1119 extern MSymbol Minput_set_spot;
1120 extern MSymbol Minput_toggle;
1121 extern MSymbol Minput_reset;
1122 extern MSymbol Minput_get_surrounding_text;
1123 extern MSymbol Minput_delete_surrounding_text;
1124
1125 /** Symbols for special input key event.  */
1126 extern MSymbol Minput_focus_move;
1127 extern MSymbol Minput_focus_in;
1128 extern MSymbol Minput_focus_out;
1129
1130 /** Symbols describing input method command/variable.  */
1131 extern MSymbol Minherited;
1132 extern MSymbol Mcustomized;
1133 extern MSymbol Mconfigured;
1134
1135 /***en
1136     @brief Structure of input method.
1137
1138     The type @c MInputMethod is the structure of input method
1139     objects.  */
1140 /***ja
1141     @brief ÆþÎϥ᥽¥Ã¥É¤Î¹½Â¤ÂÎ.
1142
1143     @c MInputMethod ¤Ï¡¢ÆþÎϥ᥽¥Ã¥É¥ª¥Ö¥¸¥§¥¯¥ÈÍѤι½Â¤ÂΤη¿¤Ç¤¢¤ë¡£  */
1144
1145 struct MInputMethod
1146 {
1147   /***en Which language this input method is for.  The value is @c
1148       Mnil if the input method is foreign.  */
1149   /***ja ¤É¤Î¸À¸ìÍѤÎÆþÎϥ᥽¥Ã¥É¤«¡£
1150       ÆþÎϥ᥽¥Ã¥É¤¬³°Éô¤Î¤â¤Î¤Ç¤¢¤ë¾ì¹ç¤ÎÃͤϠ@c Mnil ¡£  */
1151   MSymbol language;
1152
1153   /***en Name of the input method.  If the input method is foreign, it
1154       must has a property of key @c Minput_driver and the value must be a
1155       pointer to a proper input method driver.  */
1156   /***ja ÆþÎϥ᥽¥Ã¥É¤Î̾Á°¡£³°Éô¥á¥½¥Ã¥É¤Ç¤¢¤ë¾ì¹ç¤Ë¤Ï¡¢@c
1157       Minput_driver ¤ò¥­¡¼¤È¤¹¤ë¥×¥í¥Ñ¥Æ¥£¤ò»ý¤Á¡¢¤½¤ÎÃͤÏŬÀÚ¤ÊÆþÎϥ᥽¥Ã¥É¥É¥é¥¤¥Ð¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£*/
1158   MSymbol name;
1159
1160   /***en Input method driver of the input method.  */
1161   /***ja ¤½¤ÎÆþÎϥ᥽¥Ã¥ÉÍѤÎÆþÎϥ᥽¥Ã¥É¥É¥é¥¤¥Ð¡£  */
1162   MInputDriver driver;
1163
1164   /***en The argument given to minput_open_im (). */
1165   /***ja minput_open_im () ¤ËÅϤµ¤ì¤ë°ú¿ô¡£  */
1166   void *arg;
1167
1168   /***en Pointer to extra information that <driver>.open_im ()
1169       setups. */
1170   /***ja <driver>.open_im () ¤¬ÀßÄꤹ¤ëÄɲþðÊó¤Ø¤Î¥Ý¥¤¥ó¥¿¡£ */
1171   void *info;
1172 };
1173
1174 /*=*/
1175
1176 /***en
1177     @brief Bit-masks to specify how candidates of input method is changed.  */
1178
1179 /***ja
1180     @brief ÆþÎϥ᥽¥Ã¥É¤ÎÆþÎϸõÊ䤬¤É¤¦Êѹ¹¤µ¤ì¤¿¤«¤ò¼¨¤¹¥Ó¥Ã¥È¥Þ¥¹¥¯.  */
1181
1182 enum MInputCandidatesChanged
1183   {
1184     MINPUT_CANDIDATES_LIST_CHANGED = 1,
1185     MINPUT_CANDIDATES_INDEX_CHANGED = 2,
1186     MINPUT_CANDIDATES_SHOW_CHANGED = 4,
1187     MINPUT_CANDIDATES_CHANGED_MAX
1188   };
1189
1190
1191 /*=*/
1192
1193 /***en
1194     @brief Structure of input context.
1195
1196     The type @c MInputContext is the structure of input context
1197     objects.  */
1198
1199 /***ja
1200     @brief ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥ÈÍѹ½Â¤ÂÎ.
1201
1202     @c MInputContext ¤Ï¡¢ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¥ª¥Ö¥¸¥§¥¯¥ÈÍѤι½Â¤ÂΤη¿¤Ç¤¢¤ë¡£  */
1203
1204 struct MInputContext
1205 {
1206   /***en Backward pointer to the input method.  It is set up be the
1207       function minput_create_ic ().  */
1208   /***ja ÆþÎϥ᥽¥Ã¥É¤Ø¤ÎµÕ¥Ý¥¤¥ó¥¿¡£´Ø¿ô minput_create_ic () 
1209       ¤Ë¤è¤Ã¤ÆÀßÄꤵ¤ì¤ë¡£  */ 
1210   MInputMethod *im;
1211
1212   /***en M-text produced by the input method.  It is set up by the
1213       function minput_lookup () .  */
1214   /***ja ÆþÎϥ᥽¥Ã¥É¤Ë¤è¤Ã¤ÆÀ¸À®¤µ¤ì¤ë M-text¡£´Ø¿ô minput_lookup () 
1215       ¤Ë¤è¤Ã¤ÆÀßÄꤵ¤ì¤ë¡£  */
1216   MText *produced;
1217
1218   /***en Argument given to the function minput_create_im (). */
1219   /***ja ´Ø¿ô minput_create_ic () ¤ËÅϤµ¤ì¤ë°ú¿ô¡£ */
1220   void *arg;
1221
1222   /***en Flag telling whether the input context is currently active or
1223       inactive.  The value is set to 1 (active) when the input context
1224       is created.  It is toggled by the function minput_toggle ().  */
1225   /***ja ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¤¬¥¢¥¯¥Æ¥£¥Ö¤«¤É¤¦¤«¤ò¼¨¤¹¥Õ¥é¥°¡£
1226       ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¤¬À¸À®¤µ¤ì¤¿»þÅÀ¤Ç¤ÏÃͤϠ1 ¡Ê¥¢¥¯¥Æ¥£¥Ö¡Ë¤Ç¤¢¤ê¡¢´Ø¿ô 
1227       minput_toggle () ¤Ë¤è¤Ã¤Æ¥È¥°¥ë¤µ¤ì¤ë¡£  */
1228   int active;
1229
1230   /***en Spot location and size of the input context.  */
1231   /***ja ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¤Î¥¹¥Ý¥Ã¥È¤Î°ÌÃÖ¤ÈÂ礭¤µ.  */
1232   struct {
1233     /***en X and Y coordinate of the spot.  */
1234     /***ja ¥¹¥Ý¥Ã¥È¤Î X, Y ºÂɸ.  */
1235     int x, y;
1236
1237     /***en Ascent and descent pixels of the line of the spot.  */
1238     /***ja ¥¹¥Ý¥Ã¥È¤Î¥¢¥»¥ó¥È¤È¥Ç¥£¥»¥ó¥È¤Î¥Ô¥¯¥»¥ë¿ô.  */
1239     int ascent, descent;
1240
1241     /***en Font size for preedit text in 1/10 point.  */
1242     /***ja preedit ¥Æ¥­¥¹¥ÈÍѤΥե©¥ó¥È¥µ¥¤¥º (1/10 ¥Ý¥¤¥ó¥Èñ°Ì).  */
1243     int fontsize;
1244
1245     /***en M-text at the spot, or NULL.  */
1246     /***ja ¥¹¥Ý¥Ã¥È¾å¤Î M-text¡¢¤Þ¤¿¤Ï NULL.  */
1247     MText *mt;
1248
1249     /***en Character position in <mt> at the spot.  */
1250     /***ja <mt> ¤Ë¤ª¤±¤ë¥¹¥Ý¥Ã¥È¤Îʸ»ú°ÌÃÖ.  */
1251     int pos;
1252   } spot;
1253
1254   /***en The usage of the following members depends on the input
1255       method driver.  The descriptions below are for the driver of an
1256       internal input method.  They are set by the function
1257       <im>->driver.filter ().  */
1258   /***ja °Ê²¼¤Î¥á¥ó¥Ð¤Î»ÈÍÑË¡¤ÏÆþÎϥ᥽¥Ã¥É¥É¥é¥¤¥Ð¤Ë¤è¤Ã¤Æ°Û¤Ê¤ë¡£
1259       °Ê²¼¤ÎÀâÌÀ¤Ï¡¢ÆâÉôÆþÎϥ᥽¥Ã¥ÉÍѤÎÆþÎϥɥ饤¥Ð¤ËÂФ¹¤ë¤â¤Î¤Ç¤¢¤ë¡£
1260       ¤³¤ì¤é¤Ï´Ø¿ô <im>->driver.filter () ¤Ë¤è¤Ã¤ÆÀßÄꤵ¤ì¤ë¡£  */
1261
1262   /***en Pointer to extra information that <im>->driver.create_ic ()
1263       setups.  It is used to record the internal state of the input
1264       context.  */
1265   /***ja <im>->driver.create_ic () ¤¬ÀßÄꤹ¤ëÄɲþðÊó¤Ø¤Î¥Ý¥¤¥ó¥¿¡£
1266       ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¤ÎÆâÉô¾õÂÖ¤òµ­Ï¿¤¹¤ë¤¿¤á¤ËÍѤ¤¤é¤ì¤ë¡£ */
1267   void *info;
1268
1269   /***en M-text describing the current status of the input
1270       context.  */
1271   /***ja ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¤Î¸½ºß¤Î¾õÂÖ¤òɽ¤¹ M-text  */
1272   MText *status;
1273
1274   /***en The function <im>->driver.filter () sets the value to 1 when
1275       it changes <status>.  */
1276   /***ja ´Ø¿ô <im>->driver.filter () ¤Ï¡¢<status> ¤òÊѤ¨¤¿ºÝ¤Ë¤³¤ÎÃͤò 1 
1277       ¤ËÀßÄꤹ¤ë¡£  */
1278   int status_changed;
1279
1280   /***en M-text containing the current preedit text.  The function
1281       <im>->driver.filter () sets the value.  */
1282   /***ja ¸½ºß¤Î preedit ¥Æ¥­¥¹¥È¤ò´Þ¤à M-text¡£´Ø¿ô 
1283       <im>->driver.filter () ¤Ë¤è¤Ã¤ÆÀßÄꤵ¤ì¤ë¡£  */ 
1284   MText *preedit;
1285
1286   /***en The function <im>->driver.filter () sets the value to 1 when
1287       it changes <preedit>.  */
1288   /***ja ´Ø¿ô <im>->driver.filter () ¤Ï¡¢<preedit> ¤òÊѤ¨¤¿ºÝ¤Ë¤³¤ÎÃͤò 
1289       1 ¤ËÀßÄꤹ¤ë¡£  */
1290   int preedit_changed;
1291
1292   /***en Cursor position of <preedit>.  */
1293   /***ja <preedit>¤Î¥«¡¼¥½¥ë°ÌÃÖ  */
1294   int cursor_pos;
1295
1296   /***en The function <im>->driver.filter () sets the value to 1 when
1297       it changes <cursor_pos>.  */
1298   /***ja ´Ø¿ô <im>->driver.filter () ¤Ï¡¢<cursor_pos> ¤òÊѤ¨¤¿ºÝ¤Ë¤³¤ÎÃͤò 
1299       1 ¤ËÀßÄꤹ¤ë¡£  */
1300   int cursor_pos_changed;
1301
1302   /***en Plist of the current candidate groups.  Each element is an
1303       M-text or a plist.  If an element is an M-text (i.e. the key is Mtext),
1304       candidates in that group are characters in the M-text.  If it is
1305       a plist (i.e. the key is Mplist), each element is an M-text, and
1306       candidates in that group are those M-texts.  */
1307   /***ja ¸½ºß¤Î¸õÊ䥰¥ë¡¼¥×¤Î Plist ¡£³ÆÍ×ÁǤϠM-text ¤« plist ¤Ç¤¢¤ë¡£
1308       Í×ÁǤ¬ M-text ¤Î¾ì¹ç¡Ê¥­¡¼¤¬ Mtext ¤Ç¤¢¤ë¾ì¹ç¡Ë¤Ë¤Ï¡¢¤½¤Î¥°¥ë¡¼¥×¤Î¸õÊä¤Ï¤½¤Î 
1309       M-text Ãæ¤Î³Æʸ»ú¤Ç¤¢¤ë¡£ Í×ÁǤ¬ plist ¤Î¾ì¹ç¡Ê¥­¡¼¤¬ Mplist
1310       ¤Ç¤¢¤ë¾ì¹ç¡Ë¤Ë¤Ï¡¢¤½¤Î¥ê¥¹¥È¤Î³ÆÍ×ÁǤϠM-text ¤Ç¤¢¤ê¡¢¤½¤ì¤é¤¬¤½¤Î¥°¥ë¡¼¥×¤Î¸õÊä¤È¤Ê¤ë¡£  */
1311   MPlist *candidate_list;
1312
1313   /***en Index number of the currently selected candidate in all the
1314       candidates. The index of the first candidate is 0.  If the
1315       number is 8, and the first candidate group contains 7
1316       candidates, the currently selected candidate is the second element of the
1317       second candidate group.  */
1318   /***ja ¸½ºßÁªÂò¤µ¤ì¤Æ¤¤¤ë¸õÊ䤬Á´¸õÊäÃæ¤Ç²¿ÈÖÌܤ«¤ò¤ò¼¨¤¹¥¤¥ó¥Ç¥Ã¥¯¥¹¡£
1319       ºÇ½é¤Î¸õÊä¤Î¥¤¥ó¥Ç¥Ã¥¯¥¹¤Ï 0¡£ºÇ½é¤Î¸õÊ䥰¥ë¡¼¥×¤Ë¼·¤Ä¤Î¸õÊ䤬´Þ¤Þ¤ì¤Æ¤ª¤ê¡¢¤³¤ÎÃͤ¬
1320       8 ¤Ê¤é¤Ð¡¢¸½ºß¤Î¸õÊä¤ÏÆóÈÖÌܤθõÊ䥰¥ë¡¼¥×¤ÎÆóÈÖÌܤÎÍ×ÁǤȤ¤¤¦¤³¤È¤Ë¤Ê¤ë¡£
1321       */
1322   int candidate_index;
1323
1324   /***en Start and the end positions of the preedit text where
1325        <candidate_list> corresponds to.  */
1326   /***ja preedit ¥Æ¥­¥¹¥ÈÃæ¤Ç¡¢<candidate_list>¤ËÂбþ¤¹¤ëºÇ½é¤ÈºÇ¸å¤Î°ÌÃÖ¡£
1327        */
1328   int candidate_from, candidate_to;
1329
1330   /***en Flag telling whether the current candidate group must be
1331       shown or not.  The function <im>->driver.filter () sets the
1332       value to 1 when an input method required to show candidates, and
1333       sets the value to 0 otherwise.  */
1334   /***ja ¸½ºß¤Î¸õÊ䥰¥ë¡¼¥×¤òɽ¼¨¤¹¤ë¤«¤É¤¦¤«¤ò¼¨¤¹¥Õ¥é¥°¡£
1335       ´Ø¿ô <im>->driver.filter () ¤Ï¡¢ÆþÎϥ᥽¥Ã¥É¤¬¸õÊä¤Îɽ¼¨¤òÍ׵ᤷ¤¿»þ¤³¤ÎÃͤò
1336       1 ¤Ë¡¢¤½¤ì°Ê³°¤Î»þ 0 ¤ËÀßÄꤹ¤ë¡£  */
1337   int candidate_show;
1338
1339   /***en The function <im>->driver.filter () sets the value to bitwise
1340       OR of @c enum @c MInputCandidatesChanged when it changed any of
1341       the above members (<candidate_XXX>), and sets the value to 0
1342       otherwise.  */
1343   /***ja ´Ø¿ô <im>->driver.filter () ¤Ï¡¢¾åµ­¤Î¥á¥ó¥Ð <candidate_XXX>
1344       ¤Î£±¤Ä¤Ç¤âÊѹ¹¤·¤¿ºÝ¤Ë¤Ï¡¢¤³¤ÎÃͤò @c enum @c
1345       MInputCandidatesChanged ¤Î¥Ó¥Ã¥Èñ°Ì¤Ç¤ÎÏÀÍý OR ¤ËÀßÄꤹ¤ë¡£¤½¤¦
1346       ¤Ç¤Ê¤±¤ì¤Ð 0 ¤ËÀßÄꤹ¤ë¡£ */
1347   int candidates_changed;
1348
1349   /***en Plist that can be freely used by <im>->driver functions.
1350       The driver of internal input method uses it to exchange extra
1351       arguments and result for callback functions.  The function
1352       <im>->driver.create_ic () sets this to an empty plist, and the
1353       function <im>->driver.destroy_ic () frees it by using
1354       m17n_object_unref ().  */
1355   /***ja <im>->driver ¤Î´Ø¿ô·²¤Ë¤è¤Ã¤Æ¼«Í³¤Ë»ÈÍѤǤ­¤ë plist¡£
1356       ÆâÉôÆþÎϥ᥽¥Ã¥ÉÍѥɥ饤¥Ð¤Ï¤³¤ì¤ò¥³¡¼¥ë¥Ð¥Ã¥¯´Ø¿ô¤È¤Î°ú¿ô¤äÊÖÃÍ
1357       ¤Î¼õÅϤ·¤Ë»ÈÍѤ¹¤ë¡£´Ø¿ô <im>->driver.create_ic () ¤Ï¤³¤Î plist
1358       ¤ò¶õ¤ËÀßÄꤹ¤ë¡£´Ø¿ô<im>->driver.destroy_ic () ¤Ï
1359       m17n_object_unref () ¤òÍѤ¤¤Æ¤³¤Î plist ¤ò²òÊü¤¹¤ë¡£  */
1360   MPlist *plist;
1361 };
1362
1363 /*=*/
1364
1365 extern MInputMethod *minput_open_im (MSymbol language, MSymbol name,
1366                                      void *arg);
1367
1368 /*=*/
1369
1370 extern void minput_close_im (MInputMethod *im);
1371
1372 extern MInputContext *minput_create_ic (MInputMethod *im, void *arg);
1373
1374 extern void minput_destroy_ic (MInputContext *ic);
1375
1376 extern int minput_filter (MInputContext *ic, MSymbol key, void *arg);
1377
1378 extern int minput_lookup (MInputContext *ic, MSymbol key, void *arg,
1379                           MText *mt);
1380 extern void minput_set_spot (MInputContext *ic, int x, int y, int ascent,
1381                              int descent, int fontsize, MText *mt, int pos);
1382 extern void minput_toggle (MInputContext *ic);
1383
1384 extern void minput_reset_ic (MInputContext *ic);
1385
1386 extern MText *minput_get_description (MSymbol language, MSymbol name);
1387
1388 extern MPlist *minput_get_title_icon (MSymbol language, MSymbol name);
1389
1390 extern MPlist *minput_get_command (MSymbol language, MSymbol name,
1391                                    MSymbol command);
1392 extern int minput_config_command (MSymbol language, MSymbol name,
1393                                   MSymbol command, MPlist *keyseq);
1394 extern MPlist *minput_get_variable (MSymbol language, MSymbol name,
1395                                     MSymbol variable);
1396 extern int minput_config_variable (MSymbol language, MSymbol name,
1397                                    MSymbol variable, MPlist *value);
1398 extern char *minput_config_file (void);
1399
1400 extern int minput_save_config (void);
1401
1402 extern int minput_callback (MInputContext *ic, MSymbol command);
1403
1404 /* obsolete functions */
1405 extern MPlist *minput_get_commands (MSymbol language, MSymbol name);
1406
1407 extern int minput_assign_command_keys (MSymbol language, MSymbol name,
1408                                        MSymbol command, MPlist *keys);
1409 extern MPlist *minput_get_variables (MSymbol language, MSymbol name);
1410
1411 extern int minput_set_variable (MSymbol language, MSymbol name,
1412                                 MSymbol variable, void *value);
1413 /*=*/
1414 /***     @} */
1415
1416 extern MInputMethod *mdebug_dump_im (MInputMethod *im, int indent);
1417
1418
1419 #ifdef __cplusplus
1420 }
1421 #endif
1422
1423 #endif /* _M17N_H_ */
1424
1425 /*
1426   Local Variables:
1427   coding: euc-japan
1428   End:
1429 */