*** empty log message ***
[m17n/m17n-lib.git] / src / m17n-core.h
1 /* m17n-core.h -- header file for the CORE API of the m17n library.
2    Copyright (C) 2003, 2004
3      National Institute of Advanced Industrial Science and Technology (AIST)
4      Registration Number H15PRO112
5
6    This file is part of the m17n library.
7
8    The m17n library is free software; you can redistribute it and/or
9    modify it under the terms of the GNU Lesser General Public License
10    as published by the Free Software Foundation; either version 2.1 of
11    the License, or (at your option) any later version.
12
13    The m17n library is distributed in the hope that it will be useful,
14    but WITHOUT ANY WARRANTY; without even the implied warranty of
15    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16    Lesser General Public License for more details.
17
18    You should have received a copy of the GNU Lesser General Public
19    License along with the m17n library; if not, write to the Free
20    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21    02111-1307, USA.  */
22
23 #ifndef _M17N_CORE_H_
24 #define _M17N_CORE_H_
25
26 #ifdef __cplusplus
27 extern "C"
28 {
29 #endif
30
31 /*
32  * Header file for m17n library.
33  */
34
35 /* (C1) Introduction */
36
37 /***en @defgroup m17nIntro Introduction  */
38 /***ja @defgroup m17nIntro ¤Ï¤¸¤á¤Ë  */
39 /*=*/
40
41 #if !defined (FOR_DOXYGEN) || defined (DOXYGEN_INTERNAL_MODULE)
42
43 #define M17NLIB_MAJOR_VERSION 1
44 #define M17NLIB_MINOR_VERSION 1
45 #define M17NLIB_PATCH_LEVEL 0
46 #define M17NLIB_VERSION_NAME "1.1.0"
47
48 extern void m17n_init_core (void);
49 #define M17N_INIT() m17n_init_core ()
50 extern void m17n_fini_core (void);
51 #define M17N_FINI() m17n_fini_core ()
52
53 #endif
54
55 /*=*/
56
57 /*** @ingroup m17nIntro */
58 /***en
59     @brief Enumeration for the status of the m17n library.
60
61     The enum #M17NStatus is used as a return value of the function
62     m17n_status ().  */
63
64 /***ja
65     @brief  m17n ¥é¥¤¥Ö¥é¥ê¤Î¾õÂÖ¤ò¼¨¤¹Îóµó·¿.
66
67     Îóµó·¿ #M17NStatus ¤Ï´Ø¿ô m17n_status () ¤ÎÌá¤êÃͤȤ·¤ÆÍѤ¤¤é¤ì¤ë¡£ */
68
69 enum M17NStatus
70   {
71     /***en No modules is initialized, and all modules are finalized.  */
72     M17N_NOT_INITIALIZED, 
73     /***en Only the modules in CORE API are initialized.  */
74     M17N_CORE_INITIALIZED,
75     /***en Only the modules in CORE and SHELL APIs are initialized.  */
76     M17N_SHELL_INITIALIZED, 
77     /***en All modules are initialized.  */
78     M17N_GUI_INITIALIZED
79   };
80
81 /*=*/
82
83 extern enum M17NStatus m17n_status (void);
84
85 /***en @defgroup m17nCore CORE API  */
86 /***ja @defgroup m17nCore ¥³¥¢ API */
87 /*=*/
88 /*** @ingroup m17nCore */
89 /***en @defgroup m17nObject Managed Object */
90 /***ja @defgroup m17nObject ´ÉÍý²¼¥ª¥Ö¥¸¥§¥¯¥È */
91 /*=*/
92
93 /*** @ingroup m17nObject  */
94 /***en
95     @brief The first member of a managed object.
96
97     When an application program defines a new structure for managed
98     objects, its first member must be of the type @c struct
99     #M17NObjectHead.  Its contents are used by the m17n library, and
100     application programs should never touch them.  */
101 /***ja
102     @brief ´ÉÍý²¼¥ª¥Ö¥¸¥§¥¯¥È¤ÎºÇ½é¤Î¥á¥ó¥Ð.
103
104     ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é¥à¤¬¿·¤·¤¤¹½Â¤ÂΤò´ÉÍý²¼¥ª¥Ö¥¸¥§¥¯¥È¤È¤·¤Æ
105      ÄêµÁ¤¹¤ëºÝ¤Ë¤Ï¡¢ºÇ½é¤Î¥á¥ó¥Ð¤Ï @c #M17NObjectHead ¹½Â¤Âη¿¤Ç¤Ê¤¯
106      ¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£@c #M17NObjectHead ¤ÎÆâÍƤϠm17n ¥é¥¤¥Ö¥é¥ê¤¬»ÈÍѤ¹
107      ¤ë¤Î¤Ç¡¢¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é¥à¤Ï¿¨¤ì¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
108      */
109
110 typedef struct
111 {
112   void *filler[2];
113 } M17NObjectHead;
114
115 /*=*/
116
117 /* Return a newly allocated managed object.  */
118 extern void *m17n_object (int size, void (*freer) (void *));
119
120 /* Increment the reference count of managed object OBJECT.  */
121 extern int m17n_object_ref (void *object);
122
123 /* Decrement the reference count of managed object OBJECT.  */
124 extern int m17n_object_unref (void *object);
125
126 /*=*/
127
128 /* (C2) Symbol handling */
129
130 /*** @ingroup m17nCore */
131 /***en @defgroup m17nSymbol Symbol  */
132 /***ja @defgroup m17nSymbol ¥·¥ó¥Ü¥ë */
133 /*=*/
134
135 /***
136     @ingroup m17nSymbol */
137 /***en
138     @brief Type of symbols.
139
140     The type #MSymbol is for a @e symbol object.  Its internal
141     structure is concealed from application programs.  */
142
143 /***ja
144     @brief ¥·¥ó¥Ü¥ë¤Î·¿Àë¸À.
145
146     #MSymbol ¤Ï¥·¥ó¥Ü¥ë¥ª¥Ö¥¸¥§¥¯¥È¤Î·¿¤Ç¤¢¤ë¡£ÆâÉô¹½Â¤¤Ï¥¢¥×¥ê¥±¡¼¥·¥ç
147     ¥ó¥×¥í¥°¥é¥à¤«¤é¤Ï¸«¤¨¤Ê¤¤¡£  */
148
149 typedef struct MSymbolStruct *MSymbol;
150
151 /*=*/
152
153 /* Predefined symbols. */ 
154 extern MSymbol Mnil;
155 extern MSymbol Mt;
156 extern MSymbol Mstring;
157 extern MSymbol Msymbol;
158 extern MSymbol Mtext;
159
160 /* Return a symbol of name NAME.  */
161 extern MSymbol msymbol (const char *name);
162
163 /* Return a managing key of name NAME.  */
164 extern MSymbol msymbol_as_managing_key (const char *name);
165
166 /* Return a symbol of name NAME if it already exists.  */
167 extern MSymbol msymbol_exist (const char *name);
168
169 /* Return the name of SYMBOL.  */
170 extern char *msymbol_name (MSymbol symbol);
171
172 /* Give SYMBOL KEY property with value VALUE.  */
173 extern int msymbol_put (MSymbol symbol, MSymbol key, void *val);
174
175 /*** Return KEY property value of SYMBOL.  */
176 extern void *msymbol_get (MSymbol symbol, MSymbol key);
177
178 /* 
179  *  (2-1) Property List
180  */
181 /*=*/
182 /*** @ingroup m17nCore */
183 /***en @defgroup m17nPlist Property List */
184 /***ja @defgroup m17nPlist ¥×¥í¥Ñ¥Æ¥£¥ê¥¹¥È */
185 /*=*/
186
187 /***
188     @ingroup m17nPlist */ 
189 /***en
190     @brief Type of property list objects.
191
192     The type #MPlist is for a @e property @e list object.  Its internal
193     structure is concealed from application programs.  */
194
195 /***ja
196     @brief ¥×¥í¥Ñ¥Æ¥£¥ê¥¹¥È¡¦¥ª¥Ö¥¸¥§¥¯¥È¤Î·¿Àë¸À.
197
198     #MPlist ¤Ï @e ¥×¥í¥Ñ¥Æ¥£¥ê¥¹¥È (Property list) ¥ª¥Ö¥¸¥§¥¯¥È¤Î·¿¤Ç¤¢¤ë¡£
199     ÆâÉô¹½Â¤¤Ï¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é¥à¤«¤é¤Ï¸«¤¨¤Ê¤¤¡£  */
200
201 typedef struct MPlist MPlist;
202
203 /*=*/
204
205 extern MSymbol Mplist, Minteger;
206
207 extern MPlist *mplist ();
208
209 extern MPlist *mplist_copy (MPlist *plist);
210
211 extern MPlist *mplist_add (MPlist *plist, MSymbol key, void *val);
212
213 extern MPlist *mplist_push (MPlist *plist, MSymbol key, void *val);
214
215 extern void *mplist_pop (MPlist *plist);
216
217 extern MPlist *mplist_put (MPlist *plist, MSymbol key, void *val);
218
219 extern void *mplist_get (MPlist *plist, MSymbol key);
220
221 extern MPlist *mplist_find_by_key (MPlist *plist, MSymbol key);
222
223 extern MPlist *mplist_find_by_value (MPlist *plist, void *val);
224
225 extern MPlist *mplist_next (MPlist *plist);
226
227 extern MPlist *mplist_set (MPlist *plist, MSymbol key, void *val);
228
229 extern int mplist_length (MPlist *plist);
230
231 extern MSymbol mplist_key (MPlist *plist);
232
233 extern void *mplist_value (MPlist *plist);
234
235 /* (S1) Characters */
236
237 /*=*/
238 /*** @ingroup m17nCore */
239 /***en @defgroup m17nCharacter Character */
240 /***ja @defgroup m17nCharacter Ê¸»ú */
241 /*=*/
242
243 #if !defined (FOR_DOXYGEN) || defined (DOXYGEN_INTERNAL_MODULE)
244 #define MCHAR_MAX 0x3FFFFF
245 /*#define MCHAR_MAX 0x7FFFFFFF*/
246 #endif
247
248 extern MSymbol Mscript;
249 extern MSymbol Mname;
250 extern MSymbol Mcategory;
251 extern MSymbol Mcombining_class;
252 extern MSymbol Mbidi_category;
253 extern MSymbol Msimple_case_folding;
254 extern MSymbol Mcomplicated_case_folding;
255
256 extern MSymbol mchar_define_property (const char *name, MSymbol type);
257
258 extern void *mchar_get_prop (int c, MSymbol key);
259
260 extern int mchar_put_prop (int c, MSymbol key, void *val);
261
262 /* (C3) Handling chartable */
263
264 /*** @ingroup m17nCore */
265 /***en @defgroup m17nChartable Chartable */
266 /***ja @defgroup m17nChartable Ê¸»ú¥Æ¡¼¥Ö¥ë */
267 /*=*/
268 extern MSymbol Mchar_table;
269
270 /***
271     @ingroup m17nChartable */
272 /***en
273     @brief Type of chartables.
274
275     The type #MCharTable is for a @e chartable objects.  Its
276     internal structure is concealed from application programs.  */
277
278 /***ja
279     @brief Ê¸»ú¥Æ¡¼¥Ö¥ë¤Î·¿Àë¸À.
280
281     #MCharTable ¤Ï @e Ê¸»ú¥Æ¡¼¥Ö¥ë (chartable) ¥ª¥Ö¥¸¥§¥¯¥È¤Î·¿¤Ç¤¢¤ë¡£
282     ÆâÉô¹½Â¤¤Ï¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é¥à¤«¤é¤Ï¸«¤¨¤Ê¤¤¡£  */
283
284 typedef struct MCharTable MCharTable;
285 /*=*/
286
287 extern MCharTable *mchartable (MSymbol key, void *default_value);
288
289 extern void *mchartable_lookup (MCharTable *table, int c);
290
291 extern int mchartable_set (MCharTable *table, int c, void *val);
292
293 extern int mchartable_set_range (MCharTable *table, int from, int to,
294                                  void *val);
295
296 extern int mchartable_map (MCharTable *table, void *ignore,
297                            void (*func) (int, int, void *, void *), 
298                            void *func_arg);
299
300 extern void mchartable_range (MCharTable *table, int *from, int *to);
301
302 /*
303  *  (5) Handling M-text.
304  *      "M" of M-text stands for:
305  *      o Multilingual
306  *      o Metamorphic
307  *      o More than string
308  */
309
310 /*** @ingroup m17nCore */
311 /***en @defgroup m17nMtext M-text */
312 /***ja @defgroup m17nMtext M-text */
313 /*=*/
314
315 /*
316  * (5-1) M-text basics
317  */
318 /*=*/
319 /*** @ingroup m17nMtext */
320 /***en
321     @brief Type of @e M-texts.
322
323     The type #MText is for an @e M-text object.  Its internal
324     structure is concealed from application programs.  */
325
326 /***ja
327     @brief @e MText ¤Î·¿Àë¸À.
328
329     #Mtext ¤Ï @e M-text ¥ª¥Ö¥¸¥§¥¯¥È¤Î·¿¤Ç¤¢¤ë¡£
330     ÆâÉô¹½Â¤¤Ï¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é¥à¤«¤é¤Ï¸«¤¨¤Ê¤¤¡£ 
331
332     @latexonly \IPAlabel{MText} @endlatexonly
333     @latexonly \IPAlabel{MText->MPlist} @endlatexonly  */
334
335 typedef struct MText MText;
336
337 /*=*/
338
339 /*** @ingroup m17nMtext */
340 /***en
341     @brief Enumeration for specifying the format of an M-text.
342
343     The enum #MTextFormat is used as an argument of the
344     mtext_from_data () function to specify the format of data from
345     which an M-text is created.  */
346
347 /***ja
348     @brief M-text ¤Î¥Õ¥©¡¼¥Þ¥Ã¥È¤ò»ØÄꤹ¤ëÎóµó·¿.
349
350     Îóµó·¿ #MTextFormat ¤Ï
351     ´Ø¿ô mtext_from_data () ¤Î°ú¿ô¤È¤·¤ÆÍѤ¤¤é¤ì¡¢
352     M-text ¤òÀ¸À®¤¹¤ë¸µ¤È¤Ê¤ë¥Ç¡¼¥¿¤Î¥Õ¥©¡¼¥Þ¥Ã¥È¤ò»ØÄꤹ¤ë¡£  */
353
354 enum MTextFormat
355   {
356     MTEXT_FORMAT_US_ASCII,
357     MTEXT_FORMAT_UTF_8,
358     MTEXT_FORMAT_UTF_16LE,
359     MTEXT_FORMAT_UTF_16BE,
360     MTEXT_FORMAT_UTF_32LE,
361     MTEXT_FORMAT_UTF_32BE,
362     MTEXT_FORMAT_MAX
363   };
364 /*=*/
365
366 extern MText *mtext ();
367
368 /*=*/
369
370 /***en @name Variables: Default Endian of UTF-16 and UTF-32 */
371 /***ja @name ÊÑ¿ô: UTF-16 ¤È UTF-32 ¤Î¥Ç¥Õ¥©¥ë¥È¤Î¥¨¥ó¥Ç¥£¥¢¥ó */
372 /*** @{ */
373 /*=*/
374
375 /*** @ingroup m17nMtext */
376 /***en
377     @brief Variable of value MTEXT_FORMAT_UTF_16LE or MTEXT_FORMAT_UTF_16BE.
378
379     The global variable #MTEXT_FORMAT_UTF_16 is initialized to
380     #MTEXT_FORMAT_UTF_16LE on a "Little Endian" system (storing words
381     with the least significant byte first), and to
382     #MTEXT_FORMAT_UTF_16BE on a "Big Endian" system (storing words
383     with the most significant byte first).  */
384
385 /***ja
386     @brief Ãͤ¬ MTEXT_FORMAT_UTF_16LE ¤« MTEXT_FORMAT_UTF_16BE ¤Ç¤¢¤ëÊÑ¿ô
387
388     Âç°èÊÑ¿ô #MTEXT_FORMAT_UTF_16 ¤Ï¥ê¥È¥ë¡¦¥¨¥ó¥Ç¥£¥¢¥ó¡¦¥·¥¹¥Æ¥à¡Ê¥ï¡¼
389     ¥É¤ò LSB (Least Significant Byte) ¤òÀè¤Ë¤·¤Æ³ÊǼ¡Ë¾å¤Ç¤Ï
390     #MTEXT_FORMAT_UTF_16LE ¤Ë½é´ü²½¤µ¤ì¡¢¥Ó¥Ã¥°¡¦¥¨¥ó¥Ç¥£¥¢¥ó¡¦¥·¥¹¥Æ¥à
391     ¡Ê¥ï¡¼¥É¤ò MSB (Most Significant Byte) ¤òÀè¤Ë¤·¤Æ³ÊǼ¡Ë¾å¤Ç¤Ï
392     #MTEXT_FORMAT_UTF_16BE ¤Ë½é´ü²½¤µ¤ì¤ë¡£  */
393
394 /***
395     @seealso
396     mtext_from_data ()  */
397
398 extern const int MTEXT_FORMAT_UTF_16;
399 /*=*/
400
401 /*** @ingroup m17nMtext */
402 /***en
403     @brief Variable of value MTEXT_FORMAT_UTF_32LE or MTEXT_FORMAT_UTF_32BE.
404
405     The global variable #MTEXT_FORMAT_UTF_32 is initialized to
406     #MTEXT_FORMAT_UTF_32LE on a "Little Endian" system (storing words
407     with the least significant byte first), and to
408     #MTEXT_FORMAT_UTF_32BE on a "Big Endian" system (storing
409     words with the most significant byte first).  */
410
411 /***ja
412     @brief Ãͤ¬ MTEXT_FORMAT_UTF_32LE ¤« MTEXT_FORMAT_UTF_32BE ¤Ç¤¢¤ëÊÑ¿ô
413
414     Âç°èÊÑ¿ô #MTEXT_FORMAT_UTF_32 ¤Ï¥ê¥È¥ë¡¦¥¨¥ó¥Ç¥£¥¢¥ó¡¦¥·¥¹¥Æ¥à¡Ê¥ï¡¼
415     ¥É¤ò LSB (Least Significant Byte) ¤òÀè¤Ë¤·¤Æ³ÊǼ¡Ë¾å¤Ç¤Ï
416     #MTEXT_FORMAT_UTF_32LE ¤Ë½é´ü²½¤µ¤ì¡¢¥Ó¥Ã¥°¡¦¥¨¥ó¥Ç¥£¥¢¥ó¡¦¥·¥¹¥Æ¥à
417     ¡Ê¥ï¡¼¥É¤ò MSB (Most Significant Byte) ¤òÀè¤Ë¤·¤Æ³ÊǼ¡Ë¾å¤Ç¤Ï
418     #MTEXT_FORMAT_UTF_32BE ¤Ë½é´ü²½¤µ¤ì¤ë¡£  */
419
420 /***
421     @seealso
422     mtext_from_data ()  */
423
424 extern const int MTEXT_FORMAT_UTF_32;
425
426 /*=*/
427 /*** @} */
428 /*=*/
429
430 extern MText *mtext_from_data (const void *data, int nitems,
431                                enum MTextFormat format);
432
433 /*=*/
434 /*** @} */
435
436 /*
437  *  (5-2) Functions to manipulate M-texts.  They correspond to string
438  *   manipulating functions in libc.
439  *   In the following functions, mtext_XXX() corresponds to strXXX().
440  */
441
442 extern int mtext_len (MText *mt);
443
444 extern int mtext_ref_char (MText *mt, int pos);
445
446 extern int mtext_set_char (MText *mt, int pos, int c);
447
448 extern MText *mtext_copy (MText *mt1, int pos, MText *mt2, int from, int to);
449
450 extern int mtext_compare (MText *mt1, int from1, int to1,
451                           MText *mt2, int from2, int to2);
452
453 extern int mtext_case_compare (MText *mt1, int from1, int to1,
454                                MText *mt2, int from2, int to2);
455
456 extern int mtext_character (MText *mt, int from, int to, int c);
457
458 extern int mtext_del (MText *mt, int from, int to);
459
460 extern int mtext_ins (MText *mt1, int pos, MText *mt2);
461
462 extern int mtext_ins_char (MText *mt, int pos, int c, int n);
463
464 extern MText *mtext_cat_char (MText *mt, int c);
465
466 extern MText *mtext_duplicate (MText *mt, int from, int to);
467
468 extern MText *mtext_dup (MText *mt);
469
470 extern MText *mtext_cat (MText *mt1, MText *mt2);
471
472 extern MText *mtext_ncat (MText *mt1, MText *mt2, int n);
473
474 extern MText *mtext_cpy (MText *mt1, MText *mt2);
475
476 extern MText *mtext_ncpy (MText *mt1, MText *mt2, int n);
477
478 extern int mtext_chr (MText *mt, int c);
479
480 extern int mtext_rchr (MText *mt, int c);
481
482 extern int mtext_cmp (MText *mt1, MText *mt2);
483
484 extern int mtext_ncmp (MText *mt1, MText *mt2, int n);
485
486 extern int mtext_spn (MText *mt1, MText *mt2);
487
488 extern int mtext_cspn (MText *mt1, MText *mt2);
489
490 extern int mtext_pbrk (MText *mt1, MText *mt2);
491
492 extern int mtext_text (MText *mt1, int pos, MText *mt2);
493
494 extern int mtext_search (MText *mt1, int from, int to, MText *mt2);
495
496 extern MText *mtext_tok (MText *mt, MText *delim, int *pos);
497
498 extern int mtext_casecmp (MText *mt1, MText *mt2);
499
500 extern int mtext_ncasecmp (MText *mt1, MText *mt2, int n);
501
502 /*** @ingroup m17nPlist */
503 extern MPlist *mplist_deserialize (MText *mt);
504
505 /*
506  * (5-3) Text properties
507  */
508 /*=*/
509 /*** @ingroup m17nCore */
510 /***en @defgroup m17nTextProperty Text Property */
511 /***ja @defgroup m17nTextProperty ¥Æ¥­¥¹¥È¥×¥í¥Ñ¥Æ¥£ */
512 /*=*/
513 /*** @ingroup m17nTextProperty */
514 /***en
515     @brief Flag bits to control text property.
516
517     The mtext_property () funciton accepts logical OR of these flag
518     bits as an argument.  They control the behaviour of the created
519     text property as described in the documentation of each flag
520     bit.  */
521
522 /***ja
523     @brief ¥Æ¥­¥¹¥È¥×¥í¥Ñ¥Æ¥£¤òÀ©¸æ¤¹¤ë¥Õ¥é¥°¥Ó¥Ã¥È.
524
525     ´Ø¿ô mtext_property () ¤Ï°Ê²¼¤Î¥Õ¥é¥°¥Ó¥Ã¥È¤ÎÏÀÍý OR ¤ò°ú¿ô¤È¤·¤Æ
526     ¤È¤ë¤³¤È¤¬¤Ç¤­¤ë¡£¥Õ¥é¥°¥Ó¥Ã¥È¤ÏÀ¸À®¤µ¤ì¤¿¥Æ¥­¥¹¥È¥×¥í¥Ñ¥Æ¥£¤Î¿¶Éñ
527     ¤¤¤òÀ©¸æ¤¹¤ë¡£¾ÜºÙ¤Ï³Æ¥Õ¥é¥°¥Ó¥Ã¥È¤ÎÀâÌÀ¤ò»²¾È¡£*/
528
529 enum MTextPropertyControl
530   {
531     /***en If this flag bit is on, an M-text inserted at the start
532         position or at the middle of the text property inherits the
533         text property.  */
534     /***ja ¤³¤Î¥Ó¥Ã¥È¤¬ on ¤Ê¤é¤Ð¡¢¤³¤Î¥Æ¥­¥¹¥È¥×¥í¥Ñ¥Æ¥£¤Î»Ï¤Þ¤ëÅÀ¤¢
535         ¤ë¤¤¤ÏÃæ´Ö¤ËÁÞÆþ¤µ¤ì¤¿ M-text ¤Ï¤³¤Î¥Æ¥­¥¹¥È¥×¥í¥Ñ¥Æ¥£¤ò·Ñ¾µ¤¹¤ë¡£
536         */
537     MTEXTPROP_FRONT_STICKY = 0x01,
538
539     /***en If this flag bit is on, an M-text inserted at the end
540         position or at the middle of the text property inherits the
541         text property.  */
542     /***ja ¤³¤Î¥Ó¥Ã¥È¤¬ on ¤Ê¤é¤Ð¡¢¤³¤Î¥Æ¥­¥¹¥È¥×¥í¥Ñ¥Æ¥£¤Î½ª¤ï¤ëÅÀ¤¢
543         ¤ë¤¤¤ÏÃæ´Ö¤ËÁÞÆþ¤µ¤ì¤¿ M-text ¤Ï¤³¤Î¥Æ¥­¥¹¥È¥×¥í¥Ñ¥Æ¥£¤ò·Ñ¾µ¤¹¤ë¡£
544         */
545     MTEXTPROP_REAR_STICKY = 0x02,
546
547     /***en If this flag bit is on, the text property is removed if a
548         text in its region is modified.  */
549     /***ja ¤³¤Î¥Ó¥Ã¥È¤¬ on ¤Ê¤é¤Ð¡¢¤³¤Î¥Æ¥­¥¹¥È¥×¥í¥Ñ¥Æ¥£¤ÎÈÏ°ÏÆâ¤Î
550         ¥Æ¥­¥¹¥È¤¬Êѹ¹¤µ¤ì¤¿¾ì¹ç¥Æ¥­¥¹¥È¥×¥í¥Ñ¥Æ¥£¤Ï¼è¤ê½ü¤«¤ì¤ë¡£  */
551     MTEXTPROP_VOLATILE_WEAK = 0x04,
552
553     /***en If this flag bit is on, the text property is removed if a
554         text or the other text property in its region is modified.  */
555     /***ja ¤³¤Î¥Ó¥Ã¥È¤¬ on ¤Ê¤é¤Ð¡¢¤³¤Î¥Æ¥­¥¹¥È¥×¥í¥Ñ¥Æ¥£¤ÎÈÏ°ÏÆâ¤Î
556         ¥Æ¥­¥¹¥È¤¢¤ë¤¤¤ÏÊ̤Υƥ­¥¹¥È¥×¥í¥Ñ¥Æ¥£¤¬Êѹ¹¤µ¤ì¤¿¾ì¹ç¤³¤Î¥Æ¥­
557         ¥¹¥È¥×¥í¥Ñ¥Æ¥£¤Ï¼è¤ê½ü¤«¤ì¤ë¡£*/
558     MTEXTPROP_VOLATILE_STRONG = 0x08,
559
560     /***en If this flag bit is on, the text property is not
561         automatically merged with the others.  */
562     /***ja ¤³¤Î¥Ó¥Ã¥È¤¬ on ¤Ê¤é¤Ð¡¢¤³¤Î¥Æ¥­¥¹¥È¥×¥í¥Ñ¥Æ¥£¤Ï¾¤Î¥×¥í¥Ñ
563         ¥Æ¥£¤È¼«Æ°Åª¤Ë¤Ï¥Þ¡¼¥¸¤µ¤ì¤Ê¤¤¡£ */
564     MTEXTPROP_NO_MERGE = 0x10,
565
566     MTEXTPROP_CONTROL_MAX = 0x1F
567   };
568
569 /*=*/
570 extern MSymbol Mtext_prop_serializer;
571 extern MSymbol Mtext_prop_deserializer;
572
573
574 /*** @ingroup m17nTextProperty */
575 /***en
576     @brief Type of serializer functions.
577
578     This is the type of serializer functions.  If the key of a symbol
579     property is #Msymbol_prop_serializer, the value must be of this
580     type.
581
582     @seealso
583     mtext_prop_serialize (), Mtext_prop_serializer
584 */
585 /***ja
586     @brief ¥·¥ê¥¢¥é¥¤¥¶´Ø¿ô¤Î·¿Àë¸À.
587
588     ¥·¥ê¥¢¥é¥¤¥¶´Ø¿ô¤Î·¿¤Ç¤¢¤ë¡£ ¤¢¤ë¥·¥ó¥Ü¥ë¤Î¥×¥í¥Ñ¥Æ¥£¤Î¥­¡¼¤¬ @c
589     #Msymbol_prop_serializer ¤Ç¤¢¤ë¤È¤­¡¢ ÃͤϤ³¤Î·¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
590
591     @seealso
592     Mtext_prop_serialize (), Mtext_prop_serializer
593 */
594
595 typedef MPlist *(*MTextPropSerializeFunc) (void *val);
596
597 /*** @ingroup m17nTextProperty */
598 /***en
599     @brief Type of deserializer functions.
600
601     This is the type of deserializer functions.  If the key of a
602     symbol property is #Msymbol_prop_deserializer, the value must be
603     of this type.
604
605     @seealso
606     Mtext_prop_deserialize (), Mtext_prop_deserializer
607 */
608 /***ja
609     @brief ¥Ç¥·¥ê¥¢¥é¥¤¥¶´Ø¿ô¤Î·¿Àë¸À.
610
611     ¥Ç¥·¥ê¥¢¥é¥¤¥¶´Ø¿ô¤Î·¿¤Ç¤¢¤ë¡£ ¤¢¤ë¥·¥ó¥Ü¥ë¤Î¥×¥í¥Ñ¥Æ¥£¤Î¥­¡¼¤¬ @c
612     #Msymbol_prop_deserializer ¤Ç¤¢¤ë¤È¤­¡¢ ÃͤϤ³¤Î·¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
613
614     @seealso
615     Mtext_prop_deserialize (), Mtext_prop_deserializer
616 */
617 typedef void *(*MTextPropDeserializeFunc) (MPlist *plist);
618
619 extern void *mtext_get_prop (MText *mt, int pos, MSymbol key);
620
621 extern int mtext_get_prop_values (MText *mt, int pos, MSymbol key,
622                                   void **values, int num);
623
624 extern int mtext_get_prop_keys (MText *mt, int pos, MSymbol **keys);
625
626 extern int mtext_put_prop (MText *mt, int from, int to,
627                            MSymbol key, void *val);
628
629 extern int mtext_put_prop_values (MText *mt, int from, int to,
630                                   MSymbol key, void **values, int num);
631
632 extern int mtext_push_prop (MText *mt, int from, int to,
633                             MSymbol key, void *val);
634
635 extern int mtext_pop_prop (MText *mt, int from, int to,
636                            MSymbol key);
637
638 extern int mtext_prop_range (MText *mt, MSymbol key, int pos,
639                              int *from, int *to, int deeper);
640
641 /*=*/
642 /***
643     @ingroup m17nTextProperty */
644 /***en
645     @brief Type of text properties.
646
647     The type #MTextProperty is for a @e text @e property objects.  Its
648     internal structure is concealed from application programs.  */
649 /***ja
650     @brief @c ¥Æ¥­¥¹¥È¥×¥í¥Ñ¥Æ¥£¤Î·¿Àë¸À.
651
652     #MTextProperty ¤Ï @e ¥Æ¥­¥¹¥È¥×¥í¥Ñ¥Æ¥£ ¥ª¥Ö¥¸¥§¥¯¥È¤Î·¿¤Ç¤¢¤ë¡£
653     ÆâÉô¹½Â¤¤Ï¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é¥à¤«¤é¤Ï¸«¤¨¤Ê¤¤¡£  */
654
655 typedef struct MTextProperty MTextProperty;
656
657 /*=*/
658
659 extern MTextProperty *mtext_property (MSymbol key, void *val,
660                                       int control_bits);
661
662 extern MText *mtext_property_mtext (MTextProperty *prop);
663
664 extern MSymbol mtext_property_key (MTextProperty *prop);
665
666 extern void *mtext_property_value (MTextProperty *prop);
667
668 extern int mtext_property_start (MTextProperty *prop);
669
670 extern int mtext_property_end (MTextProperty *prop);
671
672 extern MTextProperty *mtext_get_property (MText *mt, int pos, MSymbol key);
673
674 extern int mtext_get_properties (MText *mt, int pos, MSymbol key,
675                                  MTextProperty **props, int num);
676
677 extern int mtext_attach_property (MText *mt, int from, int to,
678                                   MTextProperty *prop);
679
680 extern int mtext_detach_property (MTextProperty *prop);
681
682 extern int mtext_push_property (MText *mt, int from, int to,
683                                 MTextProperty *prop);
684
685 extern MText *mtext_serialize (MText *mt, int from, int to,
686                                MPlist *property_list);
687
688 extern MText *mtext_deserialize (MText *mt);
689
690 #ifdef __cplusplus
691 }
692 #endif
693
694 #endif /* _M17N_CORE_H_ */
695
696 /*
697   Local Variables:
698   coding: euc-japan
699   End:
700 */