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
6 This file is part of the m17n library.
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.
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.
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
31 #include <m17n-core.h>
39 extern void m17n_init (void);
41 #define M17N_INIT() m17n_init ()
43 extern void m17n_fini (void);
45 #define M17N_FINI() m17n_fini ()
47 /***en @defgroup m17nShell SHELL API */
48 /***ja @defgroup m17nShell SHELL API */
52 * (11) Functions related to the m17n database
55 /*** @ingroup m17nShell */
56 /***en @defgroup m17nDatabase Database */
57 /***ja @defgroup m17nDatabase ¸À¸ì¾ðÊó¥Ç¡¼¥¿¥Ù¡¼¥¹ */
59 /* Directory of an application specific databases. */
60 extern char *mdatabase_dir;
63 @ingroup m17nDatabase */
65 @brief Type of database.
67 The type #MDatabase is for a database object. Its internal
68 structure is concealed from application programs. */
69 /***ja ¥Ç¡¼¥¿¥Ù¡¼¥¹¤Î·¿Àë¸À */
70 typedef struct MDatabase MDatabase;
74 /* Look for a data. */
75 extern MDatabase *mdatabase_find (MSymbol tag1, MSymbol tag2,
76 MSymbol tag3, MSymbol tag4);
78 extern MPlist *mdatabase_list (MSymbol tag0, MSymbol tag1,
79 MSymbol tag2, MSymbol tag3);
82 void *mdatabase_load (MDatabase *mdb);
84 /* Get tags of a data. */
85 extern MSymbol *mdatabase_tag (MDatabase *mdb);
88 extern MDatabase *mdatabase_define (MSymbol tag1, MSymbol tag2,
89 MSymbol tag3, MSymbol tag4,
90 void *(*loader) (MSymbol *, void *),
94 /* (S2) Charset staffs */
96 /*** @ingroup m17nShell */
97 /***en @defgroup m17nCharset Charset */
98 /***ja @defgroup m17nCharset ʸ»ú¥»¥Ã¥È */
100 #define MCHAR_INVALID_CODE 0xFFFFFFFF
102 /* Predefined charsets */
103 extern MSymbol Mcharset_ascii;
104 extern MSymbol Mcharset_iso_8859_1;
105 extern MSymbol Mcharset_unicode;
106 extern MSymbol Mcharset_m17n;
107 extern MSymbol Mcharset_binary;
109 /* Predefined keys for mchar_define_charset (). */
110 extern MSymbol Mmethod;
111 extern MSymbol Mdimension;
112 extern MSymbol Mmin_range;
113 extern MSymbol Mmax_range;
114 extern MSymbol Mmin_code;
115 extern MSymbol Mmax_code;
116 extern MSymbol Mascii_compatible;
117 extern MSymbol Mfinal_byte;
118 extern MSymbol Mrevision;
119 extern MSymbol Mmin_char;
120 extern MSymbol Mmapfile;
121 extern MSymbol Mparents;
122 extern MSymbol Msubset_offset;
123 extern MSymbol Mdefine_coding;
124 extern MSymbol Maliases;
126 /* Methods of a charset. */
127 extern MSymbol Moffset;
129 extern MSymbol Munify;
130 extern MSymbol Msubset;
131 extern MSymbol Msuperset;
134 extern MSymbol Mcharset;
136 extern MSymbol mchar_define_charset (char *name, MPlist *plist);
138 extern MSymbol mchar_resolve_charset (MSymbol symbol);
140 extern int mchar_list_charset (MSymbol **symbols);
142 extern int mchar_decode (MSymbol charset_name, unsigned code);
144 extern unsigned mchar_encode (MSymbol charset_name, int c);
146 extern int mchar_map_charset (MSymbol charset_name,
147 void (*func) (int from, int to, void *arg),
152 /* (S3) code conversion */
154 /*** @ingroup m17nShell */
155 /***en @defgroup m17nConv Code Conversion */
156 /***ja @defgroup m17nConv ¥³¡¼¥ÉÊÑ´¹ */
159 /* Predefined coding systems */
160 extern MSymbol Mcoding_us_ascii;
161 extern MSymbol Mcoding_iso_8859_1;
162 extern MSymbol Mcoding_utf_8;
163 extern MSymbol Mcoding_utf_8_full;
164 extern MSymbol Mcoding_utf_16;
165 extern MSymbol Mcoding_utf_16be;
166 extern MSymbol Mcoding_utf_16le;
167 extern MSymbol Mcoding_utf_32;
168 extern MSymbol Mcoding_utf_32be;
169 extern MSymbol Mcoding_utf_32le;
170 extern MSymbol Mcoding_sjis;
172 /* Parameter keys for mconv_define_coding (). */
173 extern MSymbol Mtype;
174 extern MSymbol Mcharsets;
175 extern MSymbol Mflags;
176 extern MSymbol Mdesignation;
177 extern MSymbol Minvocation;
178 extern MSymbol Mcode_unit;
180 extern MSymbol Mlittle_endian;
182 /* Symbols representing coding system type. */
184 extern MSymbol Miso_2022;
186 /* Symbols appearing in the value of Mfrag parameter. */
187 extern MSymbol Mreset_at_eol;
188 extern MSymbol Mreset_at_cntl;
189 extern MSymbol Meight_bit;
190 extern MSymbol Mlong_form;
191 extern MSymbol Mdesignation_g0;
192 extern MSymbol Mdesignation_g1;
193 extern MSymbol Mdesignation_ctext;
194 extern MSymbol Mdesignation_ctext_ext;
195 extern MSymbol Mlocking_shift;
196 extern MSymbol Msingle_shift;
197 extern MSymbol Msingle_shift_7;
198 extern MSymbol Meuc_tw_shift;
199 extern MSymbol Miso_6429;
200 extern MSymbol Mrevision_number;
201 extern MSymbol Mfull_support;
204 extern MSymbol Mcoding;
205 extern MSymbol Mmaybe;
207 /*** @ingroup m17nConv */
209 @brief Codes that represent the result of code conversion.
211 One of these values is set in @c MConverter-\>result. */
214 @brief ¥³¡¼¥ÉÊÑ´¹¤Î·ë²Ì¤ò¼¨¤¹¥³¡¼¥É
216 ¤³¤ì¤é¤ÎÃͤΤ¦¤Á°ì¤Ä¤¬ @c MConverter-\>result ¤ËÀßÄꤵ¤ì¤ë¡£ */
218 enum MConversionResult
220 /***en Code conversion is successful. */
221 /***ja ¥³¡¼¥ÉÊÑ´¹¤ÏÀ®¸ù¡£ */
222 MCONVERSION_RESULT_SUCCESS,
224 /***en On decoding, the source contains an invalid byte. */
225 /***ja ¥Ç¥³¡¼¥É¤ÎºÝ¡¢¥½¡¼¥¹¤ËÉÔÀµ¤Ê¥Ð¥¤¥È¤¬´Þ¤Þ¤ì¤ë¡£ */
226 MCONVERSION_RESULT_INVALID_BYTE,
228 /***en On encoding, the source contains a character that cannot be
229 encoded by the specified coding system. */
231 /***ja ¥¨¥ó¥³¡¼¥É¤ÎºÝ¡¢¥½¡¼¥¹¤Ë»ØÄê¤Î¥³¡¼¥É·Ï¤Ç
232 ¥¨¥ó¥³¡¼¥É¤Ç¤¤Ê¤¤Ê¸»ú¤¬´Þ¤Þ¤ì¤ë¡£ */
233 MCONVERSION_RESULT_INVALID_CHAR,
235 /***en On decoding, the source ends with an incomplete byte sequence. */
236 /***ja ¥Ç¥³¡¼¥É¤ÎºÝ¡¢¥½¡¼¥¹¤¬ÉÔ´°Á´¤Ê¥Ð¥¤¥ÈÎó¤Ç½ª¤ï¤ë¡£*/
237 MCONVERSION_RESULT_INSUFFICIENT_SRC,
239 /***en On encoding, the destination is too short to store the result. */
240 /***ja ¥¨¥ó¥³¡¼¥É¤ÎºÝ¡¢·ë²Ì¤ò³ÊǼ¤¹¤ëÎΰ褬û¤«¤¹¤®¤ë¡£ */
241 MCONVERSION_RESULT_INSUFFICIENT_DST,
243 /***en An I/O error occurred in the conversion. */
244 /***ja ¥³¡¼¥ÉÊÑ´¹Ãæ¤Ë I/O ¥¨¥é¡¼¤¬µ¯¤³¤Ã¤¿¡£ */
245 MCONVERSION_RESULT_IO_ERROR
249 /*** @ingroup m17nConv */
251 @brief Structure to be used in code conversion.
253 The first three members are to control the conversion. */
256 @brief ¥³¡¼¥ÉÊÑ´¹¤ËÍѤ¤¤é¤ì¤ë¹½Â¤ÂÎ
258 @latexonly \IPAlabel{MConverter} @endlatexonly
264 Set the value to nonzero if the conversion should be lenient.
265 By default, the conversion is strict (i.e. not lenient).
267 If the conversion is strict, the converter stops at the first
268 invalid byte (on decoding) or at the first character not
269 supported by the coding system (on encoding). If this happens,
270 @c MConverter-\>result is set to @c
271 MCONVERSION_RESULT_INVALID_BYTE or @c
272 MCONVERSION_RESULT_INVALID_CHAR accordingly.
274 If the conversion is lenient, on decoding, an invalid byte is
275 kept per se, and on encoding, an invalid character is replaced
276 with "<U+XXXX>" (if the character is a Unicode character) or
277 with "<M+XXXXXX>" (otherwise). */
280 ¸·Ì©¤ÊÊÑ´¹¤¬É¬ÍפǤʤ¤¾ì¹ç¤Ë¤³¤Î¥Õ¥é¥°¥Ó¥Ã¥È¤ò¤¿¤Æ¤ë¡£¥Ç¥Õ¥©
281 ¥ë¥È¤Ç¤Ï¡¢ÊÑ´¹¤Ï¸·Ì©¤Ç¤¢¤ë¡£
283 ÊÑ´¹¤¬¸·Ì©¤È¤Ï¡¢¥Ç¥³¡¼¥É¤ÎºÝ¤Ë¤ÏºÇ½é¤ÎÉÔÀµ¤Ê¥Ð¥¤¥È¤Ç¥³¥ó¥Ð¡¼¥¿
284 ¤¬»ß¤Þ¤ë¤³¤È¡¢¥¨¥ó¥³¡¼¥É¤ÎºÝ¤Ë¤ÏÊÑ´¹¤µ¤ì¤ë¥³¡¼¥É·Ï¤Ç¥µ¥Ý¡¼¥È¤µ
285 ¤ì¤Ê¤¤ºÇ½é¤Îʸ»ú¤Ç¥³¥ó¥Ð¡¼¥¿¤¬»ß¤Þ¤ë¤³¤È¤ò»Ø¤¹¡£¤³¤ì¤é¤Î¾ì¹ç¡¢
286 @c MConverter-\>result ¤Ï¤½¤ì¤¾¤ì@c
287 MCONVERSION_RESULT_INVALID_BYTE ¤«@c
288 MCONVERSION_RESULT_INVALID_CHAR ¤È¤Ê¤ë¡£
290 ÊÑ´¹¤¬¸·Ì©¤Ç¤Ê¤¤¾ì¹ç¤Ë¤Ï¡¢¥Ç¥³¡¼¥É¤ÎºÝ¤ÎÉÔÀµ¤Ê¥Ð¥¤¥È¤Ï¤½¤Î¥Ð¥¤
291 ¥È¤Î¤Þ¤Þ»Ä¤ë¡£¤Þ¤¿¥¨¥ó¥³¡¼¥É¤ÎºÝ¤Ë¤Ï¡¢ÉÔÀµ¤Êʸ»ú¤Ï¥³¡¼¥É·Ï¤´¤È
292 ¤ËÄê¤á¤é¤ì¤¿¥Ç¥Õ¥©¥ë¥È¤Îʸ»ú¤ÈÃÖ¤´¹¤¨¤é¤ì¤ë¡£ */
297 Set the value to nonzero before decoding or encoding the last
298 block of the byte sequence or the character sequence
299 respectively. The value influences the conversion as below.
301 On decoding, in the case that the last few bytes are too short
302 to form a valid byte sequence:
304 If the value is nonzero, the conversion terminates by error
305 (MCONVERSION_RESULT_INVALID_BYTE) at the first byte of the
308 If the value is zero, the conversion terminates successfully.
309 Those bytes are stored in the converter as carryover and are
310 prepended to the byte sequence of the further conversion.
312 On encoding, in the case that the coding system is context
315 If the value is nonzero, the conversion may produce a byte
316 sequence at the end to reset the context to the initial state
317 even if the source characters are zero.
319 If the value is zero, the conversion never produce such a byte
320 sequence at the end. */
323 ʸ»ú¥³¡¼¥ÉÎó¤Î½ªÃ¼Éôʬ¤ò¥¨¥ó¥³¡¼¥É¤¹¤ëºÝ¤Ë¤Ï¡¢¤³¤Î¥Õ¥é¥°¤òΩ¤Æ
324 ¤ë¡£¤³¤Î¾ì¹ç½ÐÎÏ¥³¡¼¥É¥Ý¥¤¥ó¥ÈÎó¤Î¥³¥ó¥Æ¥¯¥¹¥È¤ò¸µ¤ËÌ᤹¤¿¤á¤Î
325 ¿ô¥Ð¥¤¥È¤¬ÉÕ²ÃŪ¤ËÀ¸À®¤µ¤ì¤ë¤³¤È¤¬¤¢¤ë¡£
327 ¤³¤Î¥Õ¥é¥°¤Ï¥Ç¥Õ¥©¥ë¥È¤Ç¤ÏΩ¤Ã¤Æ¤ª¤é¤º¡¢¥³¥ó¥Ð¡¼¥¿¤Ï³¤±¤Æ¾¤Î
328 ʸ»ú¤ò¥¨¥ó¥³¡¼¥É¤¹¤ë¤â¤Î¤È²¾Äꤷ¤Æ¤¤¤ë¡£
330 ¤³¤Î¥Õ¥é¥°¤Ï¥Ç¥³¡¼¥É¤Ë¤Ï´Ø·¸¤·¤Ê¤¤¡£ */
335 If the value is nonzero, it specifies at most how many
336 characters to convert. */
341 The following three members are to report the result of the
345 Number of characters most recently decoded or encoded. */
348 ºÇ¸å¤Ë¥Ç¥³¡¼¥É/¥¨¥ó¥³¡¼¥É¤µ¤ì¤¿Ê¸»ú¿ô */
353 Number of bytes recently decoded or encoded. */
356 ºÇ¸å¤Ë¥Ç¥³¡¼¥É/¥¨¥ó¥³¡¼¥É¤µ¤ì¤¿¥Ð¥¤¥È¿ô */
361 Result code of the conversion. */
364 ¥³¡¼¥ÉÊÑ´¹¤Î·ë²Ì¤ò¼¨¤¹¥³¡¼¥É */
366 enum MConversionResult result;
369 Various information about the status of code conversion. The
370 contents depend on the type of coding system. It is assured
371 that @c status is aligned so that any type of casting is safe
372 and at least 256 bytes of memory space can be used. */
375 ¥³¡¼¥ÉÊÑ´¹¤Î¾õ¶·¤Ë´Ø¤¹¤ë¾ðÊó¡£ÆâÍƤϥ³¡¼¥É·Ï¤Î¥¿¥¤¥×¤Ë¤è¤Ã¤Æ°Û¤Ê
376 ¤ë¡£@c status ¤Ï¤É¤Î¤è¤¦¤Ê·¿¤Ø¤Î¥¥ã¥¹¥È¤ËÂФ·¤Æ¤â°ÂÁ´¤Ê¤è¤¦¤Ë¥á
377 ¥â¥ê¥¢¥é¥¤¥ó¤µ¤ì¤Æ¤ª¤ê¡¢¤Þ¤¿ºÇÄã256¥Ð¥¤¥È¤Î¥á¥â¥êÎΰ褬»È¤¨¤ë¤è
387 This member is for internally use only. An application program
388 should never touch it. */
393 /*** @ingroup m17nConv */
394 /***en @brief Types of coding system */
395 /***ja @brief ¥³¡¼¥É·Ï¤Î¥¿¥¤¥× */
400 A coding system of this type supports charsets directly.
401 The dimension of each charset defines the length of bytes to
402 represent a single character of the charset, and a byte
403 sequence directly represents the code-point of a character.
405 The m17n library provides the default decoding and encoding
406 routines of this type. */
409 ¤³¤Î¥¿¥¤¥×¤Î¥³¡¼¥É·Ï¤Ïʸ»ú¥»¥Ã¥È¤òľÀÜ¥µ¥Ý¡¼¥È¤¹¤ë¡£³Æʸ»ú¥»¥Ã
410 ¥È¤Î¼¡¸µ¤È¤Ï¡¢¤½¤Îʸ»ú¥»¥Ã¥È¤Ç°ìʸ»ú¤òɽ¸½¤¹¤ë¤¿¤á¤ËɬÍפʥХ¤
411 ¥È¿ô¤Ç¤¢¤ê¡¢¥Ð¥¤¥ÈÎó¤Ïʸ»ú¤Î¥³¡¼¥É¥Ý¥¤¥ó¥È¤òľÀÜɽ¤ï¤¹¡£
413 m17n ¥é¥¤¥Ö¥é¥ê¤Ï¤³¤Î¥¿¥¤¥×ÍѤΥǥե©¥ë¥È¤Î¥¨¥ó¥³¡¼¥É¡¿¥Ç¥³¡¼
414 ¥É¥ë¡¼¥Æ¥£¥ó¤òÄ󶡤¹¤ë¡£ */
416 MCODING_TYPE_CHARSET,
419 A coding system of this type supports byte sequences of a
420 UTF (UTF-8, UTF-16, UTF-32) like structure.
422 The m17n library provides the default decoding and encoding
423 routines of this type. */
426 ¤³¤Î¥¿¥¤¥×¤Î¥³¡¼¥É·Ï¤Ï¡¢UTF ·Ï (UTF-8, UTF-16, UTF-32) ¤Î¥Ð¥¤
429 m17n ¥é¥¤¥Ö¥é¥ê¤Ï¤³¤Î¥¿¥¤¥×ÍѤΥǥե©¥ë¥È¤Î¥¨¥ó¥³¡¼¥É¡¿¥Ç¥³¡¼
430 ¥É¥ë¡¼¥Æ¥£¥ó¤òÄ󶡤¹¤ë¡£ */
435 A coding system of this type supports byte sequences of an
436 ISO-2022 like structure. The details of each structure are
437 specified by @c MCodingInfoISO2022 .
439 The m17n library provides decoding and encoding routines of
443 ¤³¤Î¥¿¥¤¥×¤Î¥³¡¼¥É·Ï¤Ï¡¢ISO-2022 ·Ï¤Î¥Ð¥¤¥ÈÎó¤ò¥µ¥Ý¡¼¥È¤¹¤ë¡£
444 ¤³¤ì¤é¤Î¥³¡¼¥É·Ï¤Î¹½Â¤¤Î¾ÜºÙ¤Ï @c MCodingInfoISO2022 ¤Ç»ØÄꤵ
447 m17n ¥é¥¤¥Ö¥é¥ê¤Ï¤³¤Î¥¿¥¤¥×ÍѤΥǥե©¥ë¥È¤Î¥¨¥ó¥³¡¼¥É¡¿¥Ç¥³¡¼
448 ¥É¥ë¡¼¥Æ¥£¥ó¤òÄ󶡤¹¤ë¡£ */
450 MCODING_TYPE_ISO_2022,
453 A coding system of this type is for byte sequences of
454 miscellaneous structures.
456 The m17n library does not provide decoding and encoding
457 routines of this type. They must be provided by the
458 application program. */
461 ¤³¤Î¥¿¥¤¥×¤Î¥³¡¼¥É·Ï¤Ï¡¢¤½¤Î¾¤Î¹½Â¤¤Î¥Ð¥¤¥ÈÎó¤Î¤¿¤á¤Î¤â¤Î¤Ç¤¢
464 m17n ¥é¥¤¥Ö¥é¥ê¤Ï¤³¤Î¥¿¥¤¥×ÍѤΥ¨¥ó¥³¡¼¥É¡¿¥Ç¥³¡¼¥É¥ë¡¼¥Æ¥£¥ó
465 ¤òÄ󶡤·¤Ê¤¤¤Î¤Ç¡¢¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é¥à¦¤Ç¤½¤ì¤é¤ò½àÈ÷¤¹
472 /*** @ingroup m17nConv */
473 /***en @brief Bit-masks to specify the detail of coding system whose type is
474 MCODING_TYPE_ISO_2022. */
476 /***ja @brief MCODING_TYPE_ISO_2022 ¥¿¥¤¥×¤Î¥³¡¼¥É·Ï¤Î¾ÜºÙ¤òɽ¤ï¤¹¥Ó¥Ã¥È¥Þ¥¹
479 enum MCodingFlagISO2022
482 On encoding, reset the invocation and designation status to
483 initial at end of line. */
484 /***ja ¥¨¥ó¥³¡¼¥É¤ÎºÝ¡¢¹ÔËö¤Ç¸Æ¤Ó½Ð¤· (invocation) ¤È»Ø¼¨
485 (designation) ¤Î¾õÂÖ¤ò½é´üÃͤËÌ᤹¡£ */
486 MCODING_ISO_RESET_AT_EOL = 0x1,
489 On encoding, reset the invocation and designation status to
490 initial before any control codes. */
492 ¥¨¥ó¥³¡¼¥É¤ÎºÝ¡¢¤¹¤Ù¤Æ¤ÎÀ©¸æʸ»ú¤ÎÁ°¤Ç¡¢¸Æ¤Ó½Ð¤·
493 (invocation) ¤È»Ø¼¨ (designation) ¤Î¾õÂÖ¤ò½é´üÃͤËÌ᤹¡£ */
494 MCODING_ISO_RESET_AT_CNTL = 0x2,
497 Use the right graphic plane. */
499 ¿Þ·Áʸ»ú½¸¹ç¤Î±¦Â¦¤ò»È¤¦¡£ */
500 MCODING_ISO_EIGHT_BIT = 0x4,
503 Use the non-standard 4 bytes format for designation sequence
504 for charsets JISX0208.1978, GB2312, and JISX0208.1983. */
506 JISX0208.1978, GB2312, JISX0208.1983 ¤Îʸ»ú½¸¹ç¤ËÂФ¹¤ë»Ø¼¨¥·¡¼
507 ¥¯¥¨¥ó¥¹¤È¤·¤Æ¡¢Èóɸ½à¤Î4¥Ð¥¤¥È·Á¼°¤òÍѤ¤¤ë¡£ */
509 MCODING_ISO_LONG_FORM = 0x8,
512 On encoding, unless explicitly specified, designate charsets
515 ¥¨¥ó¥³¡¼¥É¤ÎºÝ¡¢Æä˻ØÄꤵ¤ì¤Ê¤¤¸Â¤ê¡¢Ê¸»ú½¸¹ç¤ò G0 ¤Ë
517 MCODING_ISO_DESIGNATION_G0 = 0x10,
520 On encoding, unless explicitly specified, designate charsets
521 except for ASCII to G1. */
523 ¥¨¥ó¥³¡¼¥É¤ÎºÝ¡¢Æä˻ØÄꤵ¤ì¤Ê¤¤¸Â¤ê¡¢ASCII °Ê³°¤Îʸ»ú½¸¹ç¤ò G1
525 MCODING_ISO_DESIGNATION_G1 = 0x20,
528 On encoding, unless explicitly specified, designate 94-chars
529 charsets to G0, 96-chars charsets to G1. */
531 ¥¨¥ó¥³¡¼¥É¤ÎºÝ¡¢Æä˻ØÄꤵ¤ì¤Ê¤¤¸Â¤ê¡¢94ʸ»ú½¸¹ç¤ò G0
532 ¤Ë¡¢96ʸ»ú½¸¹ç¤ò G1 ¤Ë»Ø¼¨¤¹¤ë¡£*/
533 MCODING_ISO_DESIGNATION_CTEXT = 0x40,
536 On encoding, encode such charsets not conforming to ISO-2022
537 by ESC % / ..., and encode non-supported Unicode characters by
538 ESC % G ... ESC % @@ . On decoding, handle those escape
541 ¥¨¥ó¥³¡¼¥É¤ÎºÝ¡¢ISO-2022 ¤Ë¹çÃפ·¤Ê¤¤Ê¸»ú½¸¹ç¤ò ESC % / ... ¤Ç¥¨
542 ¥ó¥³¡¼¥É¤¹¤ë¡£¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤Ê¤¤ Unicode ʸ»ú¤Ï ESC % G ...
543 ESC % @@ ¤Ç¥¨¥ó¥³¡¼¥É¤¹¤ë¡£
544 ¥Ç¥³¡¼¥É¤ÎºÝ¡¢¤³¤ì¤é¤Î¥¨¥¹¥±¡¼¥×¡¦¥·¡¼¥±¥ó¥¹¤ò²ò¼á¤¹¤ë¡£ */
545 MCODING_ISO_DESIGNATION_CTEXT_EXT = 0x80,
548 Use locking shift. */
550 ¥í¥Ã¥¥ó¥°¥·¥Õ¥È¤ò»È¤¦¡£ */
551 MCODING_ISO_LOCKING_SHIFT = 0x100,
554 Use single shift (SS2 (0x8E or ESC N), SS3 (0x8F or ESC O)). */
556 ¥·¥ó¥°¥ë¥·¥Õ¥È (SS2 or ESC N) ¤ò»È¤¦¡£ */
557 MCODING_ISO_SINGLE_SHIFT = 0x200,
560 Use 7-bit single shift 2 (SS2 (0x19)). */
562 ¥·¥ó¥°¥ë¥·¥Õ¥È (0x19) ¤ò»È¤¦¡£ */
563 MCODING_ISO_SINGLE_SHIFT_7 = 0x400,
566 Use EUC-TW like special shifting. */
568 EUC-TW É÷¤ÎÆÃÊ̤ʥ·¥Õ¥È¤ò»È¤¦¡£ */
569 MCODING_ISO_EUC_TW_SHIFT = 0x800,
572 Use ISO-6429 escape sequences to indicate direction.
573 Not yet implemented. */
575 ISO-6429 ¤Î¥¨¥¹¥±¡¼¥×¥·¡¼¥¯¥¨¥ó¥¹¤ÇÊý¸þ¤ò»Ø¼¨¤¹¤ë¡£ */
576 MCODING_ISO_ISO6429 = 0x1000,
579 On encoding, if a charset has revision number, produce escape
580 sequences to specify the number. */
582 ¥¨¥ó¥³¡¼¥É¤ÎºÝ¡¢Ê¸»ú¥»¥Ã¥È¤Ë revision number ¤¬¤¢¤ì¤Ð¤½
583 ¤ì¤òɽ¤ï¤¹¥¨¥¹¥±¡¼¥×¥·¡¼¥¯¥¨¥ó¥¹¤òÀ¸À®¤¹¤ë¡£ */
584 MCODING_ISO_REVISION_NUMBER = 0x2000,
587 Support all ISO-2022 charsets. */
589 ISO-2022 ¤ÎÁ´Ê¸»ú½¸¹ç¤ò¥µ¥Ý¡¼¥È¤¹¤ë */
590 MCODING_ISO_FULL_SUPPORT = 0x3000,
596 /*** @ingroup m17nConv */
598 @brief Structure for a coding system of type MCODING_TYPE_ISO_2022.
600 Structure for extra information about a coding system of type
601 MCODING_TYPE_ISO_2022. */
604 @brief MCODING_TYPE_ISO_2022 ¥¿¥¤¥×¤Î¥³¡¼¥É·Ï¤ÇɬÍ×
607 @latexonly \IPAlabel{MCodingInfoISO2022} @endlatexonly */
612 Table of numbers of an ISO2022 code extension element invoked
613 to each graphic plane (Graphic Left and Graphic Right). -1
614 means no code extension element is invoked to that plane. */
617 ³Æ¿Þ·Áʸ»úÎΰè (Graphic Left ¤È Graphic Right) ¤Ë¸Æ¤Ó½Ð¤µ¤ì¤Æ¤¤
618 ¤ë¡¢ISO2022 Éä¹ç³ÈÄ¥Í×ÁǤÎÈÖ¹æ¤Î¥Æ¡¼¥Ö¥ë¡£-1 ¤Ï¤½¤ÎÎΰè¤Ë¤É¤ÎÉä
619 ¹ç³ÈÄ¥Í×ÁǤâ¸Æ¤Ó½Ð¤µ¤ì¤Æ¤¤¤Ê¤¤¤³¤È¤ò¼¨¤¹¡£ */
621 int initial_invocation[2];
624 Table of code extension elements. The Nth element corresponds
625 to the Nth charset in $CHARSET_NAMES, which is an argument given
626 to the mconv_define_coding () function.
628 If an element value is 0..3, it specifies a graphic register
629 number to designate the corresponds charset. In addition, the
630 charset is initially designated to that graphic register.
632 If the value is -4..-1, it specifies a graphic register number
633 0..3 respectively to designate the corresponds charset.
634 Initially, the charset is not designated to any graphic
639 Éä¹ç³ÈÄ¥Í×ÁǤΥơ¼¥Ö¥ë¡£NÈÖÌܤÎÍ×ÁǤϡ¢$CHARSET_NAMES ¤Î N ÈÖÌÜ
640 ¤Îʸ»ú¥»¥Ã¥È¤ËÂбþ¤¹¤ë¡£$CHARSET_NAMES ¤Ï´Ø¿ô
641 mconv_define_coding () ¤Î°ú¿ô¤È¤·¤Æ»È¤ï¤ì¤ë¡£
643 Ãͤ¬ 0..3 ¤À¤Ã¤¿¤é¡¢Âбþ¤¹¤ëʸ»ú¥»¥Ã¥È¤ò G0..G3 ¤Î¤½¤ì¤¾¤ì¤Ë»Ø¼¨
644 ¤¹¤ë¤³¤È¤ò°ÕÌ£¤¹¤ë¡£¤µ¤é¤Ë¡¢½é´ü¾õÂ֤Ǥ¹¤Ç¤Ë G0..G3 ¤Ë»Ø¼¨¤µ¤ì¤Æ
647 Ãͤ¬ -4..-1 ¤À¤Ã¤¿¤é¡¢Âбþ¤¹¤ëʸ»ú¥»¥Ã¥È¤ò G0..G3 ¤Î¤½¤ì¤¾¤ì¤Ë»Ø
648 ¼¨¤¹¤ë¤¬¡¢½é´ü¾õÂ֤ǤϤɤ³¤Ë¤â»Ø¼¨¤µ¤ì¤Æ¤¤¤Ê¤¤¤³¤È¤ò°ÕÌ£¤¹¤ë¡£ */
650 char designations[32];
653 Bitwise OR of @c enum @c MCodingFlagISO2022 . */
656 @c enum @c MCodingFlagISO2022 ¤Î¥Ó¥Ã¥Èñ°Ì¤Ç¤ÎÏÀÍý OR */
660 } MCodingInfoISO2022;
663 /*** @ingroup m17nConv */
665 @brief Structure for extra information about a coding system of
666 type #MCODING_TYPE_UTF. */
669 @brief MCODING_TYPE_UTF ¥¿¥¤¥×¤Î¥³¡¼¥É·Ï¤ÇɬÍפÊÉղþðÊóÍѤι½Â¤ÂÎ
671 @latexonly \IPApage{MCodingInfoUTF} @endlatexonly
673 @latexonly \IPAlabel{MCodingInfoUTF} @endlatexonly */
678 Specify bits of a code unit. The value must be 8, 16, or 32. */
682 Specify how to handle the heading BOM (byte order mark). The
683 value must be 0, 1, or 2. The meanings are as follows:
685 0: On decoding, check the first two byte. If they are BOM,
686 decide endian by them. If not, decide endian by the member @c
687 endian. On encoding, produce byte sequence according to
688 @c endian with heading BOM.
690 1: On decoding, do not handle the first two bytes as BOM, and
691 decide endian by @c endian. On encoding, produce byte sequence
692 according to @c endian without BOM.
694 2: On decoding, handle the first two bytes as BOM and decide
695 ending by them. On encoding, produce byte sequence according to
696 @c endian with heading BOM.
698 If <code_unit_bits> is 8, the value has no meaning. */
701 ÀèƬ¤Î BOM (¥Ð¥¤¥È¥ª¡¼¥À¡¼¥Þ¡¼¥¯) ¤Î¼è¤ê°·¤¤¤ò»ØÄꤹ¤ë¡£ÃÍ¤Ï 0,
702 1, 2 ¤Î¤¤¤º¤ì¤«¤Ç¤¢¤ê¡¢¤½¤ì¤¾¤ì¤Î°ÕÌ£¤Ï°Ê²¼¤Î¤è¤¦¤Ë¤Ê¤ë¡£
704 0: ¥Ç¥³¡¼¥É¤ÎºÝ¤ËºÇ½é¤Î2¥Ð¥¤¥È¤òÄ´¤Ù¤ë¡£¤â¤·¤½¤ì¤¬ BOM ¤Ç¤¢¤ì¤Ð¡¢
705 ¥¨¥ó¥Ç¥£¥¢¥ó¤ò¤½¤ì¤ÇȽÄꤹ¤ë¡£¤â¤·ºÇ½é¤Î2¥Ð¥¤¥È¤¬ BOM ¤Ç¤Ê¤±¤ì¤Ð¡¢
706 ¥á¥ó¥Ð @c endian ¤Ë½¾¤Ã¤Æ¥¨¥ó¥Ç¥£¥¢¥ó¤ò·èÄꤹ¤ë¡£¥¨¥ó¥³¡¼¥É¤ÎºÝ
707 ¤Ë¤Ï @c endian ¤Ë½¾¤Ã¤¿¥Ð¥¤¥ÈÎó¤ò BOM ÉÕ¤ÇÀ¸À®¤¹¤ë¡£
709 1: ¥Ç¥³¡¼¥É¤ÎºÝ¡¢ºÇ½é¤Î2¥Ð¥¤¥È¤ò BOM ¤È¤·¤Æ°·¤ï¤Ê¤¤¡£¥¨¥ó
710 ¥Ç¥£¥¢¥ó¤Ï @c endian ¤ÇȽÄꤹ¤ë¡£¥¨¥ó¥³¡¼¥É¤ÎºÝ¤Ë¤Ï¡¢BOM
711 ¤ò½ÐÎϤ»¤º¡¢@c endian ¤Ë±þ¤¸¤¿¥Ð¥¤¥ÈÎó¤òÀ¸À®¤¹¤ë¡£
713 2: ¥Ç¥³¡¼¥É¤ÎºÝ¤ËºÇ½é¤Î2¥Ð¥¤¥È¤ò BOM¤È¤·¤Æ°·¤¤¡¢¤½¤ì¤Ë½¾¤Ã
714 ¤Æ¥¨¥ó¥Ç¥£¥¢¥ó¤òȽÄꤹ¤ë¡£¥¨¥ó¥³¡¼¥É¤ÎºÝ¤Ë¤Ï @c endian ¤Ë
715 ±þ¤¸¤¿¥Ð¥¤¥ÈÎó¤ò BOM ÉÕ¤¤ÇÀ¸À®¤¹¤ë¡£ */
719 Specify the endian type. The value must be 0 or 1. 0 means
720 little endian, and 1 means big endian.
722 If <code_unit_bits> is 8, the value has no meaning. */
724 ¥¨¥ó¥Ç¥£¥¢¥ó¤Î¥¿¥¤¥×¤ò»ØÄꤹ¤ë¡£ÃÍ¤Ï 0 ¤« 1 ¤Ç¤¢¤ê¡¢0 ¤Ê¤é¤Ð¥ê¥È
725 ¥ë¥¨¥ó¥Ç¥£¥¢¥ó¡¢1 ¤Ê¤é¤Ð¥Ó¥Ã¥°¥¨¥ó¥Ç¥£¥¢¥ó¤Ç¤¢¤ë¡£*/
730 extern MSymbol mconv_define_coding (char *name, MPlist *plist,
731 int (*resetter) (MConverter *),
732 int (*decoder) (unsigned char *, int,
733 MText *, MConverter *),
734 int (*encoder) (MText *, int, int,
735 unsigned char *, int,
739 extern MSymbol mconv_resolve_coding (MSymbol symbol);
741 extern int mconv_list_codings (MSymbol **symbols);
743 extern MConverter *mconv_buffer_converter (MSymbol coding, unsigned char *buf,
746 extern MConverter *mconv_stream_converter (MSymbol coding, FILE *fp);
748 extern int mconv_reset_converter (MConverter *converter);
750 extern void mconv_free_converter (MConverter *converter);
752 extern MConverter *mconv_rebind_buffer (MConverter *converter,
753 unsigned char *buf, int n);
755 extern MConverter *mconv_rebind_stream (MConverter *converter, FILE *fp);
757 extern MText *mconv_decode (MConverter *converter, MText *mt);
759 MText *mconv_decode_buffer (MSymbol name, unsigned char *buf, int n);
761 MText *mconv_decode_stream (MSymbol name, FILE *fp);
763 extern int mconv_encode (MConverter *converter, MText *mt);
765 extern int mconv_encode_range (MConverter *converter, MText *mt,
768 extern int mconv_encode_buffer (MSymbol name, MText *mt,
769 unsigned char *buf, int n);
771 extern int mconv_encode_stream (MSymbol name, MText *mt, FILE *fp);
773 extern int mconv_getc (MConverter *converter);
775 extern int mconv_ungetc (MConverter *converter, int c);
777 extern int mconv_putc (MConverter *converter, int c);
779 extern MText *mconv_gets (MConverter *converter, MText *mt);
781 /* (S4) Locale related functions corresponding to libc functions */
783 /*** @ingroup m17nShell */
784 /***en @defgroup m17nLocale Locale */
785 /***ja @defgroup m17nLocale ¥í¥±¡¼¥ë */
789 @brief @c struct @c MLocale
791 The structure @c MLocale is used to hold information about name,
792 language, territory, modifier, codeset, and the corresponding
793 coding system of locales.
795 The contents of this structure are implementation dependent. Its
796 internal structure is concealed from application programs. */
799 @brief @c MLocale ¹½Â¤ÂÎ
801 @c MLocale ¹½Â¤ÂΤϡ¢¥í¥±¡¼¥ë¤Î̾Á°¡¢¸À¸ì¡¢ÃÏ°è¡¢¥â¥Ç¥£¥Õ¥¡¥¤¥¢¡¢
802 ¥³¡¼¥É¥»¥Ã¥È¡¢¤ª¤è¤ÓÂбþ¤¹¤ë¥³¡¼¥É·Ï¤Ë´Ø¤¹¤ë¾ðÊó¤òÊÝ»ý¤¹¤ë¤¿¤á¤ËÍÑ
805 ¤³¤Î¹½Â¤ÂΤÎÆâÍƤϼÂÁõ¤Ë°Í¸¤¹¤ë¡£ ÆâÉô¹½Â¤¤Ï¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í
806 ¥°¥é¥à¤«¤é¤Ï¸«¤¨¤Ê¤¤¡£ */
810 mlocale_get_prop () */
812 typedef struct MLocale MLocale;
816 extern MSymbol Mlanguage;
817 extern MSymbol Mterritory;
818 extern MSymbol Mmodifier;
819 extern MSymbol Mcodeset;
821 extern MLocale *mlocale_set (int category, const char *locale);
823 extern MSymbol mlocale_get_prop (MLocale *locale, MSymbol key);
825 extern int mtext_ftime (MText *mt, const char *format, const struct tm *tm,
828 extern MText *mtext_getenv (const char *name);
830 extern int mtext_putenv (MText *mt);
832 extern int mtext_coll (MText *mt1, MText *mt2);
835 * (9) Miscellaneous functions of libc level (not yet implemented)
839 extern int mtext_width (MText *mt, int n);
840 extern MText *mtext_tolower (MText *mt);
841 extern MText *mtext_toupper (MText *mt);
848 /*** @ingroup m17nShell */
849 /***en @defgroup m17nInputMethod Input Method (basic) */
850 /***ja @defgroup m17nInputMethod ÆþÎϥ᥽¥Ã¥É (´ðËÜ) */
853 /* Struct forward declaration. */
854 typedef struct MInputMethod MInputMethod;
855 typedef struct MInputContext MInputContext;
857 /*** @ingroup m17nInputMethod */
860 @brief Type of input method callback functions.
862 This is the type of callback functions called from input method
863 drivers. #IC is a pointer to an input context, #COMMAND is a name
864 of callback for which the function is called. */
866 typedef void (*MInputCallbackFunc) (MInputContext *ic, MSymbol command);
870 @brief Structure of input method driver.
872 The type @c MInputDriver is the structure of an input driver that
873 contains several functions to handle an input method. */
878 @c MInputDriver ·¿¤Ï¡¢ÆþÎϥ᥽¥Ã¥É¤ò¼è¤ê°·¤¦´Ø¿ô¤ò´Þ¤àÆþÎϥɥ饤¥Ð
881 typedef struct MInputDriver
884 @brief Open an input method.
886 This function opens the input method $IC. It is called from the
887 function minput_open_im () after all member of $IM but <info>
888 set. If opening $IM succeeds, it returns 0. Otherwise, it
889 returns -1. The function can setup $IM->info to keep various
890 information that is referred by the other driver functions. */
893 @brief ÆþÎϥ᥽¥Ã¥É¤ò¥ª¡¼¥×¥ó¤¹¤ë
895 ¤³¤Î´Ø¿ô¤Ï¡¢ÆþÎϥ᥽¥Ã¥É$IM¤ò¥ª¡¼¥×¥ó¤¹¤ë¡£$IM ¤Î<info>°Ê³°¤ÎÁ´
896 ¥á¥ó¥Ð¡¼¤¬¥»¥Ã¥È¤µ¤ì¤¿¸å¤Ç¡¢´Ø¿ô minput_open_im () ¤«¤é¸Æ¤Ð¤ì¤ë¡£
897 $IM ¤ò¥ª¡¼¥×¥ó¤Ç¤¤ì¤Ð 0 ¤ò¡¢¤Ç¤¤Ê¤±¤ì¤Ð -1¤òÊÖ¤¹¡£¤³¤Î´Ø¿ô¤Ï
898 $IM->info ¤òÀßÄꤷ¤Æ¡¢Â¾¤Î¥É¥é¥¤¥Ð´Ø¿ô¤«¤é»²¾È¤µ¤ì¤ë¾ðÊó¤òÊÝ»ý¤¹
902 int (*open_im) (MInputMethod *im);
905 @brief Close an input method.
907 This function closes the input method $IM. It is called from
908 the function minput_close_im (). It frees all memory allocated
909 for $IM->info (if any) after finishing all the tasks of closing
910 the input method. But, the other members of $IM should not be
914 @brief ÆþÎϥ᥽¥Ã¥É¤ò¥¯¥í¡¼¥º¤¹¤ë
916 ¤³¤Î´Ø¿ô¤Ï´Ø¿ô minput_close_im () ¤«¤é¸Æ¤Ð¤ì¡¢ÆþÎϥ᥽¥Ã¥É¤ò¥¯¥í¡¼
917 ¥º¤¹¤ë¡£¡£ÆþÎϥ᥽¥Ã¥É¤Î¥¯¥í¡¼¥º¤¬¤¹¤Ù¤Æ½ªÎ»¤·¤¿»þÅÀ¤Ç¡¢
918 $IM->info ¤Ë³ä¤êÅö¤Æ¤é¤ì¤Æ¤¤¤ë¥á¥â¥ê¤ò(¤¢¤ì¤Ð)³«Êü¤¹¤ë¡£¤¿¤À¤·¡¢
919 $IM ¤Î¾¤Î¥á¥ó¥Ð¤Ë±Æ¶Á¤òÍ¿¤¨¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£ */
921 void (*close_im) (MInputMethod *im);
924 @brief Create an input context.
926 This function creates the input context $IC. It is called from
927 the function minput_create_ic () after all members of $IC but
928 <info> are set. If creating $IC succeeds, it returns 0.
929 Otherwise, it returns -1. The function can setup $IC->info to
930 keep various information that is referred by the other driver
934 @brief ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¤òÀ¸À®¤¹¤ë
936 ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È $IC ¤òÀ¸À®¤¹¤ë´Ø¿ô¡£¤³¤Î´Ø¿ô¤Ï¡¢$IC ¤Î <info>
937 °Ê³°¤ÎÁ´¥á¥ó¥Ð¡¼¤¬¥»¥Ã¥È¤µ¤ì¤¿¸å¤Ç¡¢´Ø¿ô minput_create_ic () ¤«
938 ¤é¸Æ¤Ð¤ì¤ë¡£$IC ¤òÀ¸À®¤Ç¤¤ì¤Ð 0 ¤ò¡¢¤Ç¤¤Ê¤±¤ì¤Ð -1 ¤òÊÖ¤¹¡£¤³
939 ¤Î´Ø¿ô¤Ï $IC->info ¤òÀßÄꤷ¤Æ¡¢Â¾¤Î¥É¥é¥¤¥Ð´Ø¿ô¤«¤é»²¾È¤µ¤ì¤ë¾ð
940 Êó¤òÊÝ»ý¤¹¤ë¤³¤È¤¬¤Ç¤¤ë¡£ */
943 int (*create_ic) (MInputContext *ic);
946 @brief Destroy an input context.
948 This function is called from the function minput_destroy_ic ()
949 and destroys the input context $IC. It frees all memory
950 allocated for $IC->info (if any) after finishing all the tasks
951 of destroying the input method. But, the other members of $IC
952 should not be touched. */
955 @brief ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¤òÇ˲õ¤¹¤ë
957 ´Ø¿ô minput_destroy_ic () ¤«¤é¸Æ¤Ð¤ì¡¢ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È $IC ¤òÇË
958 ²õ¤¹¤ë¡£ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¤ÎÇ˲õ¤¬¤¹¤Ù¤Æ½ªÎ»¤·¤¿»þÅÀ¤Ç¡¢$IC->info
959 ¤Ë³ä¤êÅö¤Æ¤é¤ì¤Æ¤¤¤ë¥á¥â¥ê¤ò(¤¢¤ì¤Ð)³«Êü¤¹¤ë¡£¤¿¤À¤·¡¢$IC ¤Î¾¤Î
960 ¥á¥ó¥Ð¤Ë±Æ¶Á¤òÍ¿¤¨¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£ */
962 void (*destroy_ic) (MInputContext *ic);
965 @brief Filter an input key.
967 This function is called from the function minput_filter () and
968 filters an input key. $KEY and $ARG are the same as what given
971 The task of the function is to handle $KEY, update the internal
972 state of $IC. If $KEY is absorbed by the input method and no
973 text is produced, it returns 1. Otherwise, it returns 0.
975 It may update $IC->status, $IC->preedit, $IC->cursor_pos,
976 $IC->ncandidates, $IC->candidates, and $IC->produced if that is
977 necessary for the member <callback>.
979 The meaning of $ARG depends on the input driver. See the
980 documentation of @c minput_default_driver and @c
981 minput_gui_driver for instance. */
984 @brief ÆþÎÏ¥¤¥Ù¥ó¥È¤¢¤ë¤¤¤ÏÆþÎÏ¥¡¼¤ò¥Õ¥£¥ë¥¿¤¹¤ë
986 ´Ø¿ô minput_filter () ¤«¤é¸Æ¤Ð¤ì¡¢ÆþÎÏ¥¡¼¤ò¥Õ¥£¥ë¥¿¤¹¤ë¡£°ú¿ô
987 $KEY, $ARG ¤Ï´Ø¿ô minput_filter () ¤Î¤â¤Î¤ÈƱ¤¸¡£
989 ¤³¤Î´Ø¿ô¤Ï $KEY ¤ò½èÍý¤·¡¢$IC ¤ÎÆâÉô¾õÂÖ¤ò¥¢¥Ã¥×¥Ç¡¼¥È¤¹¤ë¡£
990 $KEY ¤¬ÆþÎϥ᥽¥Ã¥É¤ËµÛ¼ý¤µ¤ì¤Æ¥Æ¥¥¹¥È¤¬À¸À®¤µ¤ì¤Ê¤«¤Ã¤¿¾ì¹ç¤Ë
991 ¤Ï¡¢ 1 ¤òÊÖ¤¹¡£¤½¤¦¤Ç¤Ê¤±¤ì¤Ð 0 ¤òÊÖ¤¹¡£
993 ¥á¥ó¥Ð <callback> ¤ËɬÍפǤ¢¤ì¤Ð¡¢$IC->status, $IC->preedit,
994 $IC->cursor_pos, $IC->ncandidates, $IC->candidates,
995 $IC->produced ¤ò¥¢¥Ã¥×¥Ç¡¼¥È¤¹¤ë¤³¤È¤¬¤Ç¤¤ë¡£
997 $ARG ¤Î°ÕÌ£¤ÏÆþÎϥɥ饤¥Ð¤Ë°Í¸¤¹¤ë¡£Îã¤Ï @c
998 minput_default_driver ¤Þ¤¿¤Ï @c minput_gui_driver ¤Î¥É¥¥å¥á¥ó¥È
1001 int (*filter) (MInputContext *ic, MSymbol key, void *arg);
1004 @brief Lookup a produced text in an input context
1006 It is called from the function minput_lookup () and looks up a
1007 produced text in the input context $IC. This function
1008 concatenate a text produced by the input key $KEY (if any) to
1009 M-text $MT. If $KEY was correctly handled by the input method
1010 of $IC, it returns 0. Otherwise, it returns 1.
1012 The meaning of $ARG depends on the input driver. See the
1013 documentation of @c minput_default_driver and @c
1014 minput_gui_driver for instance. */
1017 @brief ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¤ÇÀ¸À®¤µ¤ì¤ë¥Æ¥¥¹¥È¤Î³ÍÆÀ
1019 ´Ø¿ô minput_lookup () ¤«¤é¸Æ¤Ð¤ì¡¢ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È $IC ¤ÇÀ¸À®¤µ
1020 ¤ì¤ë¥Æ¥¥¹¥È¤ò¸¡º÷¤¹¤ë¡£ÆþÎÏ¥¡¼ $KEY ¤Ë¤è¤Ã¤ÆÀ¸À®¤µ¤ì¤ë¥Æ¥¥¹¥È
1021 ¤¬¤¢¤ì¤Ð¡¢$IC->produced ¤ËÀßÄꤹ¤ë¡£ $KEY ¤¬ÆþÎϥ᥽¥Ã¥É $IC ¤Ë
1022 ¤è¤Ã¤ÆÀµ¤·¤¯½èÍý¤µ¤ì¤ì¤Ð 0 ¤òÊÖ¤¹¡£¤½¤¦¤Ç¤Ê¤±¤ì¤Ð 1 ¤òÊÖ¤¹¡£
1024 $ARG ¤Î°ÕÌ£¤ÏÆþÎϥɥ饤¥Ð¤Ë°Í¸¤¹¤ë¡£Îã¤Ï @c
1025 minput_default_driver ¤Þ¤¿¤Ï @c minput_gui_driver ¤Î¥É¥¥å¥á¥ó¥È
1028 int (*lookup) (MInputContext *ic, MSymbol key, void *arg, MText *mt);
1031 @brief List of callback functions.
1033 List of callback functions. Keys are one of
1034 #Minput_preedit_start, #Minput_preedit_draw,
1035 #Minput_preedit_done, #Minput_status_start, #Minput_status_draw,
1036 #Minput_status_done, #Minput_candidates_start,
1037 #Minput_candidates_draw, #Minput_candidates_done,
1038 #Minput_set_spot, and #Minput_toggle. Values are functions of
1039 type #MInputCallbackFunc. */
1040 MPlist *callback_list;
1045 extern MInputDriver minput_default_driver;
1047 extern MSymbol Minput_driver;
1049 extern MInputDriver *minput_driver;
1051 /** Symbols for callback commands. */
1052 extern MSymbol Minput_preedit_start;
1053 extern MSymbol Minput_preedit_draw;
1054 extern MSymbol Minput_preedit_done;
1055 extern MSymbol Minput_status_start;
1056 extern MSymbol Minput_status_draw;
1057 extern MSymbol Minput_status_done;
1058 extern MSymbol Minput_candidates_start;
1059 extern MSymbol Minput_candidates_draw;
1060 extern MSymbol Minput_candidates_done;
1061 extern MSymbol Minput_set_spot;
1062 extern MSymbol Minput_toggle;
1065 @brief Structure of input method.
1067 The type @c MInputMethod is the structure of input method
1070 @brief ÆþÎϥ᥽¥Ã¥ÉÍѹ½Â¤ÂÎ
1072 @c MInputMethod ·¿¤Ï¡¢ÆþÎϥ᥽¥Ã¥É¥ª¥Ö¥¸¥§¥¯¥ÈÍѤι½Â¤ÂΤǤ¢¤ë¡£ */
1076 /***en Which language this input method is for. The value is @c
1077 Mnil if the input method is foreign. */
1078 /***ja ¤É¤Î¸À¸ìÍѤÎÆþÎϥ᥽¥Ã¥É¤«¡£ÆþÎϥ᥽¥Ã¥É¤¬³°Éô¤Î¤â¤Î¤Ç¤¢¤ë¾ì
1079 ¹ç¤Ë¤ÏÃͤȤ·¤Æ @c ¤ò»ý¤Ä¡£ */
1082 /***en Name of the input method. If the input method is foreign, it
1083 must has a property of key @c Minput_driver and the value must be a
1084 pointer to a proper input driver. */
1085 /***ja ÆþÎϥ᥽¥Ã¥É¤Î̾Á°¡£³°Éô¥á¥½¥Ã¥É¤Ç¤¢¤ë¾ì¹ç¤Ë¤Ï¡¢@c
1086 Minput_driver ¤ò¥¡¼¤È¤¹¤ë¥×¥í¥Ñ¥Æ¥£¤ò»ý¤Á¡¢¤½¤ÎÃͤÏŬÀÚ¤ÊÆþÎÏ¥É
1087 ¥é¥¤¥Ð¤Ø¤Î¥Ý¥¤¥ó¥¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£*/
1090 /***en Input driver of the input method. */
1091 /***ja ¤½¤ÎÆþÎϥ᥽¥Ã¥ÉÍѤÎÆþÎϥɥ饤¥Ð */
1092 MInputDriver driver;
1094 /***en The argument given to minput_open_im (). */
1095 /***ja minput_open_im () ¤ËÍ¿¤¨¤é¤ì¤ë°ú¿ô */
1098 /***en Pointer to extra information that <driver>.open_im ()
1100 /***ja <driver>.open_im () ¤¬ÀßÄꤹ¤ëÄɲþðÊó¤Ø¤Î¥Ý¥¤¥ó¥¿ */
1107 @brief Structure of input context.
1109 The type @c MInputContext is the structure of input context
1113 @brief ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥ÈÍѹ½Â¤ÂÎ
1115 @c MInputContext ·¿¤Ï¡¢ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¥ª¥Ö¥¸¥§¥¯¥ÈÍѤι½Â¤ÂΤǤ¢
1118 struct MInputContext
1120 /***en Backward pointer to the input method. It is set up be the
1121 function minput_create_ic (). */
1122 /***ja ÆþÎϥ᥽¥Ã¥É¤Ø¤ÎµÕ¥Ý¥¤¥ó¥¿¡£´Ø¿ô minput_create_ic () ¤Ë¤è¤Ã¤Æ
1126 /***en M-text produced by the input method. It is set up by the
1127 function minput_lookup () . */
1128 /***ja ÆþÎϥ᥽¥Ã¥É¤Ë¤è¤Ã¤ÆÀ¸À®¤µ¤ì¤ë M-text¡£´Ø¿ô minput_lookup ()
1129 ¤Ë¤è¤Ã¤ÆÀßÄꤵ¤ì¤ë¡£ */
1132 /***en Argument given to the function minput_create_im (). */
1133 /***ja ´Ø¿ô minput_create_ic () ¤ËÅϤµ¤ì¤ë°ú¿ô */
1136 /***en Flag telling whether the input context is currently active or
1137 inactive. The value is set to 1 (active) when the input context
1138 is created. It can be toggled by the function minput_toggle
1140 /***ja ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¤¬¥¢¥¯¥Æ¥£¥Ö¤«¤É¤¦¤«¤ò¼¨¤¹¥Õ¥é¥°¡£ÆþÎÏ¥³¥ó¥Æ
1141 ¥¯¥¹¥È¤¬À¸À®¤µ¤ì¤¿»þÅÀ¤Ç¤ÏÃÍ¤Ï 1 ¡Ê¥¢¥¯¥Æ¥£¥Ö¡Ë¤Ç¤¢¤ê¡¢´Ø¿ô
1142 minput_toggle () ¤Ë¤è¤Ã¤Æ¥È¥°¥ë¤Ç¤¤ë¡£ */
1146 /***en Spot location and size of the input context. */
1147 /***ja ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¤Î¥¹¥Ý¥Ã¥È¤Î°ÌÃÖ¤ÈÂ礤µ */
1149 /***en X and Y coordinate of the spot. */
1150 /***ja ¥¹¥Ý¥Ã¥È¤Î X, Y ºÂɸ */
1152 /***en Ascent and descent pixels of the line of the spot. */
1153 /***ja ¥¹¥Ý¥Ã¥È¤Î¥¢¥»¥ó¥È¤È¥Ç¥£¥»¥ó¥È¤Î¥Ô¥¯¥»¥ë¿ô */
1154 int ascent, descent;
1156 /***en Font size for preedit text in 1/10 point. */
1159 /***en M-text at the spot, or NULL. */
1161 /***en Character position in <mt> at the spot. */
1165 /***en The usage of the following members depends on the input
1166 driver. The descriptions below are for the input driver of an
1167 internal input method. They are set by the function
1168 <im>->driver.filter (). */
1169 /***ja °Ê²¼¤Î¥á¥ó¥Ð¤Î»ÈÍÑË¡¤ÏÆþÎϥɥ饤¥Ð¤Ë¤è¤Ã¤Æ°Û¤Ê¤ë¡£°Ê²¼¤ÎÀâÌÀ
1170 ¤Ï¡¢ÆâÉôÆþÎϥ᥽¥Ã¥ÉÍѤÎÆþÎϥɥ饤¥Ð¤ËÂФ¹¤ë¤â¤Î¤Ç¤¢¤ë¡£ */
1172 /***en Pointer to extra information that <im>->driver.create_ic ()
1173 setups. It is used to record the internal state of the input
1175 /***ja <im>->driver.create_ic () ¤¬ÀßÄꤹ¤ëÄɲþðÊó¤Ø¤Î¥Ý¥¤¥ó¥¿¡£Æþ
1176 ÎÏ¥³¥ó¥Æ¥¯¥¹¥È¤ÎÆâÉô¾õÂÖ¤òµÏ¿¤¹¤ë¤¿¤á¤ËÍѤ¤¤é¤ì¤ë¡£ */
1179 /***en M-text describing the current status of the input
1181 /***ja ÆþÎÏ¥³¥ó¥Æ¥¯¥¹¥È¤Î¸½ºß¤Î¾õ¶·¤òɽ¤¹ M-text */
1184 /***en The function <im>->driver.filter () sets the value to 1 when
1185 it changes <status>. */
1188 /***en M-text containing the current preedit text. The function
1189 <im>->driver.filter () sets the value. */
1190 /***ja ¸½ºß¤Î preedit ¥Æ¥¥¹¥È¤ò´Þ¤à M-text */
1193 /***en The function <im>->driver.filter () sets the value to 1 when
1194 it changes <preedit>. */
1195 int preedit_changed;
1197 /***en Cursor position of <preedit>. */
1198 /***ja <preedit>¤Î¥«¡¼¥½¥ë°ÌÃÖ */
1201 int cursor_pos_changed;
1203 /***en Array of the current candidate texts. */
1204 /***ja ¸½ºß¤Î¥Æ¥¥¹¥È¸õÊä¤Î¥°¥ë¡¼¥×¤Î¥ê¥¹¥È */
1205 MPlist *candidate_list;
1206 int candidate_index;
1207 int candidate_from, candidate_to;
1210 /***en The function <im>->driver.filter () sets the value to 1 when
1211 it changes one of the above members. */
1212 int candidates_changed;
1219 extern MInputMethod *minput_open_im (MSymbol language, MSymbol name,
1224 extern void minput_close_im (MInputMethod *im);
1226 extern MInputContext *minput_create_ic (MInputMethod *im, void *arg);
1228 extern void minput_destroy_ic (MInputContext *ic);
1230 extern int minput_filter (MInputContext *ic, MSymbol key, void *arg);
1232 extern int minput_lookup (MInputContext *ic, MSymbol key, void *arg,
1235 extern void minput_set_spot (MInputContext *ic, int x, int y,
1236 int ascent, int descent, int fontsize,
1237 MText *mt, int pos);
1239 extern void minput_toggle (MInputContext *ic);
1241 extern MSymbol minput_char_to_key (int c);
1245 extern MInputMethod *mdebug_dump_im (MInputMethod *im, int indent);
1251 #endif /* _M17N_H_ */