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