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