1 /* m17n-core.h -- header file for the CORE 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_CORE_H_
24 #define _M17N_CORE_H_
25 
26 #ifdef __cplusplus
27 #define M17N_BEGIN_HEADER extern "C" {
28 #define M17N_END_HEADER }
29 #else
30 #define M17N_BEGIN_HEADER	/* do nothing */
31 #define M17N_END_HEADER		/* do nothing */
32 #endif
33 
34 M17N_BEGIN_HEADER
35 
36 /*
37  * Header file for m17n library.
38  */
39 
40 /* (C1) Introduction */
41 
42 /***en @defgroup m17nIntro Introduction  */
43 /***ja @defgroup m17nIntro �Ϥ����  */
44 /*=*/
45 
46 #if !defined (FOR_DOXYGEN) || defined (DOXYGEN_INTERNAL_MODULE)
47 
48 #define M17NLIB_MAJOR_VERSION 1
49 #define M17NLIB_MINOR_VERSION 8
50 #define M17NLIB_PATCH_LEVEL 0
51 #define M17NLIB_VERSION_NAME "1.8.0"
52 
53 extern void m17n_init_core (void);
54 #define M17N_INIT() m17n_init_core ()
55 extern void m17n_fini_core (void);
56 #define M17N_FINI() m17n_fini_core ()
57 
58 extern int merror_code;
59 
60 #endif
61 
62 /*=*/
63 
64 /*** @ingroup m17nIntro */
65 /***en
66     @brief Enumeration for the status of the m17n library.
67 
68     The enum #M17NStatus is used as a return value of the function
69     m17n_status ().  */
70 
71 /***ja
72     @brief  m17n �饤�֥��ξ��֤������.
73 
74     ��� #M17NStatus �ϴؿ� m17n_status () ������ͤȤ����Ѥ����롣 */
75 
76 enum M17NStatus
77   {
78     /***en No modules is initialized, and all modules are finalized.  */
79     M17N_NOT_INITIALIZED,
80     /***en Only the modules in CORE API are initialized.  */
81     M17N_CORE_INITIALIZED,
82     /***en Only the modules in CORE and SHELL APIs are initialized.  */
83     M17N_SHELL_INITIALIZED,
84     /***en All modules are initialized.  */
85     M17N_GUI_INITIALIZED
86   };
87 
88 /*=*/
89 
90 extern enum M17NStatus m17n_status (void);
91 
92 /***en @defgroup m17nCore CORE API
93     @brief API provided by libm17n-core.so */
94 /***ja @defgroup m17nCore ���� API
95     @brief libm17n-core.so �������� API */
96 /*=*/
97 /*** @ingroup m17nCore */
98 /***en @defgroup m17nObject Managed Object
99     @brief Objects managed by the reference count */
100 /***ja @defgroup m17nObject ���������֥�������
101     @brief ���Ȳ���Ǵ�������륪�֥������� */
102 /*=*/
103 
104 /*** @ingroup m17nObject  */
105 /***en
106     @brief The first member of a managed object.
107 
108     When an application program defines a new structure for managed
109     objects, its first member must be of the type @c struct
110     #M17NObjectHead.  Its contents are used by the m17n library, and
111     application programs should never touch them.  */
112 /***ja
113     @brief ���������֥������Ȥκǽ�Υ���.
114 
115     ���ץꥱ�������ץ���ब��������¤�Τ���������֥������ȤȤ����������ݤˤϡ��ǽ�Υ��Ф�
116     @c #M17NObjectHead ��¤�η��Ǥʤ��ƤϤʤ�ʤ���
117     @c #M17NObjectHead �����Ƥ� m17n
118     �饤�֥�꤬���Ѥ���Τǡ����ץꥱ�������ץ����Ͽ���ƤϤʤ�ʤ���    */
119 
120 typedef struct
121 {
122   /*** Hidden from applications.  */
123   void *filler[2];
124 } M17NObjectHead;
125 
126 /*=*/
127 
128 /* Return a newly allocated managed object.  */
129 extern void *m17n_object (int size, void (*freer) (void *));
130 
131 /* Increment the reference count of managed object OBJECT.  */
132 extern int m17n_object_ref (void *object);
133 
134 /* Decrement the reference count of managed object OBJECT.  */
135 extern int m17n_object_unref (void *object);
136 
137 /*** @ingroup m17nCore */
138 /***en
139     @brief Generic function type.
140 
141     #M17NFunc is a generic function type for setting a function
142     pointer as a value of #MSymbol property or #MPlist.  */
143 
144 /***ja
145     @brief �ƴؿ���.
146 
147     #M17NFunc ���ƴؿ����Ǥ��ꡢ�ؿ��ݥ����� #MSymbol �ץ�ѥƥ���
148     #MPlist ���ͤȤ������ꤹ����Ѥ��롣  */
149 
150 
151 /***
152     @seealso
153     msymbol_put_func (), msymbol_get_func (),
154     mplist_put_func (), mplist_get_func ().  */
155 
156 typedef void (*M17NFunc) (void);
157 
158 /*=*/
159 
160 /*** @ingroup m17nCore */
161 /***en
162     @brief Wrapper for a generic function type.
163 
164     The macro M17N_FUNC () casts a function to the type #M17NFunc.  */
165 
166 /***ja
167     @brief �ƴؿ����ؤΥ�å�.
168 
169     �ޥ��� M17N_FUNC () �ϴؿ��� #M17NFunc ���إ��㥹�Ȥ��롣  */
170 
171 
172 #define M17N_FUNC(func) ((M17NFunc) (func))
173 
174 /*=*/
175 
176 /* (C2) Symbol handling */
177 
178 /*** @ingroup m17nCore */
179 /***en @defgroup m17nSymbol Symbol  */
180 /***ja @defgroup m17nSymbol ����ܥ� */
181 /*=*/
182 
183 /***
184     @ingroup m17nSymbol */
185 /***en
186     @brief Type of symbols.
187 
188     The type #MSymbol is for a @e symbol object.  Its internal
189     structure is concealed from application programs.  */
190 
191 /***ja
192     @brief ����ܥ�η����.
193 
194     #MSymbol �� @e ����ܥ� (symbol) ���֥������Ȥη��Ǥ��롣
195     ������¤�ϥ��ץꥱ�������ץ���फ��ϸ����ʤ���  */
196 
197 typedef struct MSymbolStruct *MSymbol;
198 
199 /*=*/
200 
201 /* Predefined symbols. */
202 extern MSymbol Mnil;
203 extern MSymbol Mt;
204 extern MSymbol Mstring;
205 extern MSymbol Msymbol;
206 extern MSymbol Mtext;
207 extern MSymbol Mcharset;
208 
209 /* Return a symbol of name NAME.  */
210 extern MSymbol msymbol (const char *name);
211 
212 /* Return a managing key of name NAME.  */
213 extern MSymbol msymbol_as_managing_key (const char *name);
214 
215 /* Check if SYMBOL is a managing key.  */
216 extern int msymbol_is_managing_key (MSymbol symbol);
217 
218 /* Return a symbol of name NAME if it already exists.  */
219 extern MSymbol msymbol_exist (const char *name);
220 
221 /* Return the name of SYMBOL.  */
222 extern char *msymbol_name (MSymbol symbol);
223 
224 /* Give SYMBOL KEY property with value VALUE.  */
225 extern int msymbol_put (MSymbol symbol, MSymbol key, void *val);
226 
227 /*** Return KEY property value of SYMBOL.  */
228 extern void *msymbol_get (MSymbol symbol, MSymbol key);
229 
230 extern int msymbol_put_func (MSymbol symbol, MSymbol key, M17NFunc func);
231 
232 extern M17NFunc msymbol_get_func (MSymbol symbol, MSymbol key);
233 
234 /*
235  *  (2-1) Property List
236  */
237 /*=*/
238 /*** @ingroup m17nCore */
239 /***en @defgroup m17nPlist Property List */
240 /***ja @defgroup m17nPlist �ץ�ѥƥ��ꥹ�� */
241 /*=*/
242 
243 /***
244     @ingroup m17nPlist */
245 /***en
246     @brief Type of property list objects.
247 
248     The type #MPlist is for a @e property @e list object.  Its internal
249     structure is concealed from application programs.  */
250 
251 /***ja
252     @brief �ץ�ѥƥ��ꥹ�ȡ����֥������Ȥη����.
253 
254     #MPlist �� @e �ץ�ѥƥ��ꥹ�� (Property list) ���֥������Ȥη��Ǥ��롣
255     ������¤�ϥ��ץꥱ�������ץ���फ��ϸ����ʤ���  */
256 
257 typedef struct MPlist MPlist;
258 
259 /*=*/
260 
261 extern MSymbol Mplist, Minteger;
262 
263 extern MPlist *mplist ();
264 
265 extern MPlist *mplist_copy (MPlist *plist);
266 
267 extern MPlist *mplist_add (MPlist *plist, MSymbol key, void *val);
268 
269 extern MPlist *mplist_push (MPlist *plist, MSymbol key, void *val);
270 
271 extern void *mplist_pop (MPlist *plist);
272 
273 extern MPlist *mplist_put (MPlist *plist, MSymbol key, void *val);
274 
275 extern void *mplist_get (MPlist *plist, MSymbol key);
276 
277 extern MPlist *mplist_put_func (MPlist *plist, MSymbol key, M17NFunc func);
278 
279 extern M17NFunc mplist_get_func (MPlist *plist, MSymbol key);
280 
281 extern MPlist *mplist_find_by_key (MPlist *plist, MSymbol key);
282 
283 extern MPlist *mplist_find_by_value (MPlist *plist, void *val);
284 
285 extern MPlist *mplist_next (MPlist *plist);
286 
287 extern MPlist *mplist_set (MPlist *plist, MSymbol key, void *val);
288 
289 extern int mplist_length (MPlist *plist);
290 
291 extern MSymbol mplist_key (MPlist *plist);
292 
293 extern void *mplist_value (MPlist *plist);
294 
295 /* (S1) Characters */
296 
297 /*=*/
298 /*** @ingroup m17nCore */
299 /***en @defgroup m17nCharacter Character */
300 /***ja @defgroup m17nCharacter ʸ�� */
301 /*=*/
302 
303 #if !defined (FOR_DOXYGEN) || defined (DOXYGEN_INTERNAL_MODULE)
304 #define MCHAR_MAX 0x3FFFFF
305 /*#define MCHAR_MAX 0x7FFFFFFF*/
306 #endif
307 
308 extern MSymbol Mscript;
309 extern MSymbol Mname;
310 extern MSymbol Mcategory;
311 extern MSymbol Mcombining_class;
312 extern MSymbol Mbidi_category;
313 extern MSymbol Msimple_case_folding;
314 extern MSymbol Mcomplicated_case_folding;
315 extern MSymbol Mcased, Msoft_dotted, Mcase_mapping;
316 extern MSymbol Mblock;
317 
318 extern MSymbol mchar_define_property (const char *name, MSymbol type);
319 
320 extern void *mchar_get_prop (int c, MSymbol key);
321 
322 extern int mchar_put_prop (int c, MSymbol key, void *val);
323 
324 /* (C3) Handling chartable */
325 
326 /*** @ingroup m17nCore */
327 /***en @defgroup m17nChartable Chartable */
328 /***ja @defgroup m17nChartable ʸ���ơ��֥� */
329 /*=*/
330 extern MSymbol Mchar_table;
331 
332 /***
333     @ingroup m17nChartable */
334 /***en
335     @brief Type of chartables.
336 
337     The type #MCharTable is for a @e chartable objects.  Its
338     internal structure is concealed from application programs.  */
339 
340 /***ja
341     @brief ʸ���ơ��֥�η����.
342 
343     #MCharTable �� @e ʸ���ơ��֥� (chartable) ���֥������Ȥη��Ǥ��롣
344     ������¤�ϥ��ץꥱ�������ץ���फ��ϸ����ʤ���  */
345 
346 typedef struct MCharTable MCharTable;
347 /*=*/
348 
349 extern MCharTable *mchartable (MSymbol key, void *default_value);
350 
351 extern int mchartable_min_char (MCharTable *table);
352 
353 extern int mchartable_max_char (MCharTable *table);
354 
355 extern void *mchartable_lookup (MCharTable *table, int c);
356 
357 extern int mchartable_set (MCharTable *table, int c, void *val);
358 
359 extern int mchartable_set_range (MCharTable *table, int from, int to,
360 				 void *val);
361 
362 extern int mchartable_map (MCharTable *table, void *ignore,
363 			   void (*func) (int, int, void *, void *),
364 			   void *func_arg);
365 
366 extern void mchartable_range (MCharTable *table, int *from, int *to);
367 
368 extern MCharTable *mchar_get_prop_table (MSymbol key, MSymbol *type);
369 
370 /*
371  *  (5) Handling M-text.
372  *	"M" of M-text stands for:
373  *	o Multilingual
374  *	o Metamorphic
375  *	o More than string
376  */
377 
378 /*** @ingroup m17nCore */
379 /***en @defgroup m17nMtext M-text */
380 /***ja @defgroup m17nMtext M-text */
381 /*=*/
382 
383 /*
384  * (5-1) M-text basics
385  */
386 /*=*/
387 /*** @ingroup m17nMtext */
388 /***en
389     @brief Type of @e M-texts.
390 
391     The type #MText is for an @e M-text object.  Its internal
392     structure is concealed from application programs.  */
393 
394 /***ja
395     @brief @e MText �η����.
396 
397     #Mtext �� @e M-text ���֥������Ȥη��Ǥ��롣
398     ������¤�ϥ��ץꥱ�������ץ���फ��ϸ����ʤ���
399 
400     @latexonly \IPAlabel{MText} @endlatexonly
401     @latexonly \IPAlabel{MText->MPlist} @endlatexonly  */
402 
403 typedef struct MText MText;
404 
405 /*=*/
406 
407 /*** @ingroup m17nMtext */
408 /***en
409     @brief Enumeration for specifying the format of an M-text.
410 
411     The enum #MTextFormat is used as an argument of the
412     mtext_from_data () function to specify the format of data from
413     which an M-text is created.  */
414 
415 /***ja
416     @brief M-text �Υե����ޥåȤ���ꤹ�����.
417 
418     ��� #MTextFormat �ϴؿ�
419     mtext_from_data () �ΰ����Ȥ����Ѥ���졢
420     M-text ���������븵�Ȥʤ�ǡ����Υե����ޥåȤ���ꤹ�롣  */
421 
422 enum MTextFormat
423   {
424     /*** US-ASCII encoding */
425     MTEXT_FORMAT_US_ASCII,
426     /*** UTF-8 encoding */
427     MTEXT_FORMAT_UTF_8,
428     /*** UTF-16LE encoding  */
429     MTEXT_FORMAT_UTF_16LE,
430     /*** UTF-16BE encoding  */
431     MTEXT_FORMAT_UTF_16BE,
432     /*** UTF-32LE encoding  */
433     MTEXT_FORMAT_UTF_32LE,
434     /*** UTF-32BE encoding  */
435     MTEXT_FORMAT_UTF_32BE,
436     MTEXT_FORMAT_MAX
437   };
438 /*=*/
439 
440 extern MText *mtext ();
441 
442 extern void *mtext_data (MText *mt, enum MTextFormat *fmt, int *nunits,
443 			 int *pos_idx, int *unit_idx);
444 
445 /*=*/
446 
447 /***en @name Variables: Default Endian of UTF-16 and UTF-32 */
448 /***ja @name �ѿ�: UTF-16 �� UTF-32 �Υǥե���ȤΥ���ǥ����� */
449 /*** @{ */
450 /*=*/
451 
452 /*** @ingroup m17nMtext */
453 /***en
454     @brief Variable of value MTEXT_FORMAT_UTF_16LE or MTEXT_FORMAT_UTF_16BE.
455 
456     The global variable #MTEXT_FORMAT_UTF_16 is initialized to
457     #MTEXT_FORMAT_UTF_16LE on a "Little Endian" system (storing words
458     with the least significant byte first), and to
459     #MTEXT_FORMAT_UTF_16BE on a "Big Endian" system (storing words
460     with the most significant byte first).  */
461 
462 /***ja
463     @brief �ͤ� MTEXT_FORMAT_UTF_16LE �� MTEXT_FORMAT_UTF_16BE �Ǥ����ѿ�
464 
465     ����ѿ� #MTEXT_FORMAT_UTF_16 �ϥ�ȥ롦����ǥ����������ƥ�
466     �ʥ�ɤ� LSB (Least Significant Byte) ����ˤ��Ƴ�Ǽ�˾�Ǥ�
467     #MTEXT_FORMAT_UTF_16LE �˽�������졢�ӥå�������ǥ����������ƥ�
468     �ʥ�ɤ� MSB (Most Significant Byte) ����ˤ��Ƴ�Ǽ�˾�Ǥ�
469     #MTEXT_FORMAT_UTF_16BE �˽��������롣  */
470 
471 /***
472     @seealso
473     mtext_from_data ()  */
474 
475 extern const enum MTextFormat MTEXT_FORMAT_UTF_16;
476 /*=*/
477 
478 /*** @ingroup m17nMtext */
479 /***en
480     @brief Variable of value MTEXT_FORMAT_UTF_32LE or MTEXT_FORMAT_UTF_32BE.
481 
482     The global variable #MTEXT_FORMAT_UTF_32 is initialized to
483     #MTEXT_FORMAT_UTF_32LE on a "Little Endian" system (storing words
484     with the least significant byte first), and to
485     #MTEXT_FORMAT_UTF_32BE on a "Big Endian" system (storing
486     words with the most significant byte first).  */
487 
488 /***ja
489     @brief �ͤ� MTEXT_FORMAT_UTF_32LE �� MTEXT_FORMAT_UTF_32BE �Ǥ����ѿ�
490 
491     ����ѿ� #MTEXT_FORMAT_UTF_32 �ϥ�ȥ롦����ǥ����������ƥ�
492     �ʥ�ɤ� LSB (Least Significant Byte) ����ˤ��Ƴ�Ǽ�˾�Ǥ�
493     #MTEXT_FORMAT_UTF_32LE �˽�������졢�ӥå�������ǥ����������ƥ�
494     �ʥ�ɤ� MSB (Most Significant Byte) ����ˤ��Ƴ�Ǽ�˾�Ǥ�
495     #MTEXT_FORMAT_UTF_32BE �˽��������롣  */
496 
497 /***
498     @seealso
499     mtext_from_data ()  */
500 
501 extern const int MTEXT_FORMAT_UTF_32;
502 
503 /*=*/
504 /*** @} */
505 /*=*/
506 
507 extern MText *mtext_from_data (const void *data, int nitems,
508 			       enum MTextFormat format);
509 
510 /*=*/
511 /*** @} */
512 
513 extern MSymbol Mlanguage;
514 
515 /*
516  *  (5-2) Functions to manipulate M-texts.  They correspond to string
517  *   manipulating functions in libc.
518  *   In the following functions, mtext_XXX() corresponds to strXXX().
519  */
520 
521 extern int mtext_len (MText *mt);
522 
523 extern int mtext_ref_char (MText *mt, int pos);
524 
525 extern int mtext_set_char (MText *mt, int pos, int c);
526 
527 extern MText *mtext_copy (MText *mt1, int pos, MText *mt2, int from, int to);
528 
529 extern int mtext_compare (MText *mt1, int from1, int to1,
530 			  MText *mt2, int from2, int to2);
531 
532 extern int mtext_case_compare (MText *mt1, int from1, int to1,
533 			       MText *mt2, int from2, int to2);
534 
535 extern int mtext_character (MText *mt, int from, int to, int c);
536 
537 extern int mtext_del (MText *mt, int from, int to);
538 
539 extern int mtext_ins (MText *mt1, int pos, MText *mt2);
540 
541 extern int mtext_insert (MText *mt1, int pos, MText *mt2, int from, int to);
542 
543 extern int mtext_ins_char (MText *mt, int pos, int c, int n);
544 
545 extern int mtext_replace (MText *mt1, int from1, int to1,
546 			  MText *mt2, int from2, int to2);
547 
548 extern MText *mtext_cat_char (MText *mt, int c);
549 
550 extern MText *mtext_duplicate (MText *mt, int from, int to);
551 
552 extern MText *mtext_dup (MText *mt);
553 
554 extern MText *mtext_cat (MText *mt1, MText *mt2);
555 
556 extern MText *mtext_ncat (MText *mt1, MText *mt2, int n);
557 
558 extern MText *mtext_cpy (MText *mt1, MText *mt2);
559 
560 extern MText *mtext_ncpy (MText *mt1, MText *mt2, int n);
561 
562 extern int mtext_chr (MText *mt, int c);
563 
564 extern int mtext_rchr (MText *mt, int c);
565 
566 extern int mtext_cmp (MText *mt1, MText *mt2);
567 
568 extern int mtext_ncmp (MText *mt1, MText *mt2, int n);
569 
570 extern int mtext_spn (MText *mt1, MText *mt2);
571 
572 extern int mtext_cspn (MText *mt1, MText *mt2);
573 
574 extern int mtext_pbrk (MText *mt1, MText *mt2);
575 
576 extern int mtext_text (MText *mt1, int pos, MText *mt2);
577 
578 extern int mtext_search (MText *mt1, int from, int to, MText *mt2);
579 
580 extern MText *mtext_tok (MText *mt, MText *delim, int *pos);
581 
582 extern int mtext_casecmp (MText *mt1, MText *mt2);
583 
584 extern int mtext_ncasecmp (MText *mt1, MText *mt2, int n);
585 
586 extern int mtext_lowercase (MText *mt);
587 
588 extern int mtext_titlecase (MText *mt);
589 
590 extern int mtext_uppercase (MText *mt);
591 
592 /*** @ingroup m17nMtext */
593 /***en
594     @brief Enumeration for specifying a set of line breaking option.
595 
596     The enum #MTextLineBreakOption is to control the line breaking
597     algorithm of the function mtext_line_break () by specifying
598     logical-or of the members in the arg @e option.  */
599 
600 enum MTextLineBreakOption
601   {
602     /***en Specify the legacy support for space character as base for
603        combining marks.  See the section 8.3 of UAX#14. */
604     MTEXT_LBO_SP_CM = 1,
605     /***en Specify to use space characters for line breaking Korean
606 	text.  */
607     MTEXT_LBO_KOREAN_SP = 2,
608     /***en Specify to treat characters of ambiguous line-breaking
609 	class as of ideographic line-breaking class.  */
610     MTEXT_LBO_AI_AS_ID = 4,
611     MTEXT_LBO_MAX
612   };
613 
614 extern int mtext_line_break (MText *mt, int pos, int option, int *after);
615 
616 /*** @ingroup m17nPlist */
617 extern MPlist *mplist_deserialize (MText *mt);
618 
619 /*
620  * (5-3) Text properties
621  */
622 /*=*/
623 /*** @ingroup m17nCore */
624 /***en @defgroup m17nTextProperty Text Property */
625 /***ja @defgroup m17nTextProperty �ƥ����ȥץ�ѥƥ� */
626 /*=*/
627 /*** @ingroup m17nTextProperty */
628 /***en
629     @brief Flag bits to control text property.
630 
631     The mtext_property () function accepts logical OR of these flag
632     bits as an argument.  They control the behaviour of the created
633     text property as described in the documentation of each flag
634     bit.  */
635 
636 /***ja
637     @brief �ƥ����ȥץ�ѥƥ������椹��ե饰�ӥå�.
638 
639     �ؿ� mtext_property () �ϰʲ��Υե饰�ӥåȤ�����
640     OR ������Ȥ��ƤȤ뤳�Ȥ��Ǥ��롣
641     �ե饰�ӥåȤ��������줿�ƥ����ȥץ�ѥƥ��ο��������椹�롣
642     �ܺ٤ϳƥե饰�ӥåȤ��������ȡ�*/
643 
644 enum MTextPropertyControl
645   {
646     /***en If this flag bit is on, an M-text inserted at the start
647 	position or at the middle of the text property inherits the
648 	text property.  */
649     /***ja ���ΥӥåȤ� on �ʤ�С����Υƥ����ȥץ�ѥƥ��λϤޤ������뤤����֤��������줿
650 	M-text �Ϥ��Υƥ����ȥץ�ѥƥ���Ѿ����롣
651 	*/
652     MTEXTPROP_FRONT_STICKY = 0x01,
653 
654     /***en If this flag bit is on, an M-text inserted at the end
655 	position or at the middle of the text property inherits the
656 	text property.  */
657     /***ja ���ΥӥåȤ� on �ʤ�С����Υƥ����ȥץ�ѥƥ��ν���������뤤����֤��������줿
658 	M-text �Ϥ��Υƥ����ȥץ�ѥƥ���Ѿ����롣
659 	*/
660     MTEXTPROP_REAR_STICKY = 0x02,
661 
662     /***en If this flag bit is on, the text property is removed if a
663 	text in its region is modified.  */
664     /***ja ���ΥӥåȤ� on �ʤ�С����Υƥ����ȥץ�ѥƥ����ϰ���Υƥ����Ȥ��ѹ����줿���ƥ����ȥץ�ѥƥ��ϼ�������롣  */
665     MTEXTPROP_VOLATILE_WEAK = 0x04,
666 
667     /***en If this flag bit is on, the text property is removed if a
668 	text or the other text property in its region is modified.  */
669     /***ja ���ΥӥåȤ� on �ʤ�С����Υƥ����ȥץ�ѥƥ����ϰ���Υƥ����Ȥ��뤤���̤Υƥ����ȥץ�ѥƥ����ѹ����줿��礳�Υƥ�
670 	���ȥץ�ѥƥ��ϼ�������롣*/
671     MTEXTPROP_VOLATILE_STRONG = 0x08,
672 
673     /***en If this flag bit is on, the text property is not
674 	automatically merged with the others.  */
675     /***ja ���ΥӥåȤ� on �ʤ�С����Υƥ����ȥץ�ѥƥ���¾�Υץ�ѥƥ��ȼ�ưŪ�ˤϥޡ�������ʤ��� */
676     MTEXTPROP_NO_MERGE = 0x10,
677 
678     MTEXTPROP_CONTROL_MAX = 0x1F
679   };
680 
681 /*=*/
682 extern MSymbol Mtext_prop_serializer;
683 extern MSymbol Mtext_prop_deserializer;
684 
685 
686 /*** @ingroup m17nTextProperty */
687 /***en
688     @brief Type of serializer functions.
689 
690     This is the type of serializer functions.  If the key of a symbol
691     property is #Mtext_prop_serializer, the value must be of this
692     type.
693 
694     @seealso
695     mtext_serialize (), #Mtext_prop_serializer
696 */
697 /***ja
698     @brief ���ꥢ�饤���ؿ��η����.
699 
700     ���ꥢ�饤���ؿ��η��Ǥ��롣 ���륷��ܥ�Υץ�ѥƥ��Υ����� @c
701     #Mtext_prop_serializer �Ǥ���Ȥ��� �ͤϤ��η��Ǥʤ��ƤϤʤ�ʤ���
702 
703     @seealso
704     mtext_serialize (), #Mtext_prop_serializer
705 */
706 
707 typedef MPlist *(*MTextPropSerializeFunc) (void *val);
708 
709 /*** @ingroup m17nTextProperty */
710 /***en
711     @brief Type of deserializer functions.
712 
713     This is the type of deserializer functions.  If the key of a
714     symbol property is #Mtext_prop_deserializer, the value must be of
715     this type.
716 
717     @seealso
718     mtext_deserialize (), #Mtext_prop_deserializer
719 */
720 /***ja
721     @brief �ǥ��ꥢ�饤���ؿ��η����.
722 
723     �ǥ��ꥢ�饤���ؿ��η��Ǥ��롣 ���륷��ܥ�Υץ�ѥƥ��Υ����� @c
724     #Mtext_prop_deserializer �Ǥ���Ȥ��� �ͤϤ��η��Ǥʤ��ƤϤʤ�ʤ���
725 
726     @seealso
727     Mtext_prop_deserialize (), Mtext_prop_deserializer
728 */
729 typedef void *(*MTextPropDeserializeFunc) (MPlist *plist);
730 
731 extern void *mtext_get_prop (MText *mt, int pos, MSymbol key);
732 
733 extern int mtext_get_prop_values (MText *mt, int pos, MSymbol key,
734 				  void **values, int num);
735 
736 extern int mtext_get_prop_keys (MText *mt, int pos, MSymbol **keys);
737 
738 extern int mtext_put_prop (MText *mt, int from, int to,
739 			   MSymbol key, void *val);
740 
741 extern int mtext_put_prop_values (MText *mt, int from, int to,
742 				  MSymbol key, void **values, int num);
743 
744 extern int mtext_push_prop (MText *mt, int from, int to,
745 			    MSymbol key, void *val);
746 
747 extern int mtext_pop_prop (MText *mt, int from, int to,
748 			   MSymbol key);
749 
750 extern int mtext_prop_range (MText *mt, MSymbol key, int pos,
751 			     int *from, int *to, int deeper);
752 
753 /*=*/
754 /***
755     @ingroup m17nTextProperty */
756 /***en
757     @brief Type of text properties.
758 
759     The type #MTextProperty is for a @e text @e property objects.  Its
760     internal structure is concealed from application programs.  */
761 /***ja
762     @brief @c �ƥ����ȥץ�ѥƥ��η����.
763 
764     #MTextProperty �� @e �ƥ����ȥץ�ѥƥ� ���֥������Ȥη��Ǥ��롣
765     ������¤�ϥ��ץꥱ�������ץ���फ��ϸ����ʤ���  */
766 
767 typedef struct MTextProperty MTextProperty;
768 
769 /*=*/
770 
771 extern MTextProperty *mtext_property (MSymbol key, void *val,
772 				      int control_bits);
773 
774 extern MText *mtext_property_mtext (MTextProperty *prop);
775 
776 extern MSymbol mtext_property_key (MTextProperty *prop);
777 
778 extern void *mtext_property_value (MTextProperty *prop);
779 
780 extern int mtext_property_start (MTextProperty *prop);
781 
782 extern int mtext_property_end (MTextProperty *prop);
783 
784 extern MTextProperty *mtext_get_property (MText *mt, int pos, MSymbol key);
785 
786 extern int mtext_get_properties (MText *mt, int pos, MSymbol key,
787 				 MTextProperty **props, int num);
788 
789 extern int mtext_attach_property (MText *mt, int from, int to,
790 				  MTextProperty *prop);
791 
792 extern int mtext_detach_property (MTextProperty *prop);
793 
794 extern int mtext_push_property (MText *mt, int from, int to,
795 				MTextProperty *prop);
796 
797 extern MText *mtext_serialize (MText *mt, int from, int to,
798 			       MPlist *property_list);
799 
800 extern MText *mtext_deserialize (MText *mt);
801 
802 /*** @ingroup m17nCore */
803 /***en @defgroup m17nDatabase Database */
804 /***ja @defgroup m17nDatabase �ǡ����١��� */
805 /*=*/
806 
807 /* Directory of an application specific databases.  */
808 extern char *mdatabase_dir;
809 /*=*/
810 /***
811     @ingroup m17nDatabase  */
812 /***en
813     @brief Type of database.
814 
815     The type #MDatabase is for a database object.  Its internal
816     structure is concealed from an application program.  */
817 /***ja
818     @brief �ǡ����١����η����.
819 
820     #MDatabase ���ϥǡ����١������֥��������Ѥι�¤�ΤǤ��롣
821     ������¤�ϥ��ץꥱ�������ץ���फ��ϸ����ʤ���
822     */
823 
824 typedef struct MDatabase MDatabase;
825 
826 /*=*/
827 
828 /* Look for a data.  */
829 extern MDatabase *mdatabase_find (MSymbol tag1, MSymbol tag2,
830 				  MSymbol tag3, MSymbol tag4);
831 
832 extern MPlist *mdatabase_list (MSymbol tag0, MSymbol tag1,
833 			       MSymbol tag2, MSymbol tag3);
834 
835 /* Load a data.  */
836 void *mdatabase_load (MDatabase *mdb);
837 
838 /* Get tags of a data.  */
839 extern MSymbol *mdatabase_tag (MDatabase *mdb);
840 
841 /* Define a data.  */
842 extern MDatabase *mdatabase_define (MSymbol tag1, MSymbol tag2,
843 				    MSymbol tag3, MSymbol tag4,
844 				    void *(*loader) (MSymbol *, void *),
845 				    void *extra_info);
846 
847 M17N_END_HEADER
848 
849 #endif /* _M17N_CORE_H_ */
850 
851 /*
852   Local Variables:
853   coding: euc-japan
854   End:
855 */
856