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