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