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