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