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
3 National Institute of Advanced Industrial Science and Technology (AIST)
4 Registration Number H15PRO112
6 This file is part of the m17n library.
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.
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.
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,
27 #define M17N_BEGIN_HEADER extern "C" {
28 #define M17N_END_HEADER }
30 #define M17N_BEGIN_HEADER /* do nothing */
31 #define M17N_END_HEADER /* do nothing */
37 * Header file for m17n library.
40 /* (C1) Introduction */
42 /***en @defgroup m17nIntro Introduction */
43 /***ja @defgroup m17nIntro ¤Ï¤¸¤á¤Ë */
46 #if !defined (FOR_DOXYGEN) || defined (DOXYGEN_INTERNAL_MODULE)
48 #define M17NLIB_MAJOR_VERSION 1
49 #define M17NLIB_MINOR_VERSION 6
50 #define M17NLIB_PATCH_LEVEL 1
51 #define M17NLIB_VERSION_NAME "1.6.1"
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 ()
58 extern int merror_code;
64 /*** @ingroup m17nIntro */
66 @brief Enumeration for the status of the m17n library.
68 The enum #M17NStatus is used as a return value of the function
72 @brief m17n ¥é¥¤¥Ö¥é¥ê¤Î¾õÂÖ¤ò¼¨¤¹Îóµó·¿.
74 Îóµó·¿ #M17NStatus ¤Ï´Ø¿ô m17n_status () ¤ÎÌá¤êÃͤȤ·¤ÆÍѤ¤¤é¤ì¤ë¡£ */
78 /***en No modules is initialized, and all modules are finalized. */
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. */
90 extern enum M17NStatus m17n_status (void);
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 */
97 /*** @ingroup m17nCore */
98 /***en @defgroup m17nObject Managed Object
99 @brief Objects managed by the reference count */
100 /***ja @defgroup m17nObject ´ÉÍý²¼¥ª¥Ö¥¸¥§¥¯¥È
101 @brief »²¾È²ó¿ô¤Ç´ÉÍý¤µ¤ì¤ë¥ª¥Ö¥¸¥§¥¯¥È */
104 /*** @ingroup m17nObject */
106 @brief The first member of a managed object.
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. */
113 @brief ´ÉÍý²¼¥ª¥Ö¥¸¥§¥¯¥È¤ÎºÇ½é¤Î¥á¥ó¥Ð.
115 ¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é¥à¤¬¿·¤·¤¤¹½Â¤ÂΤò´ÉÍý²¼¥ª¥Ö¥¸¥§¥¯¥È¤È¤·¤ÆÄêµÁ¤¹¤ëºÝ¤Ë¤Ï¡¢ºÇ½é¤Î¥á¥ó¥Ð¤Ï
116 @c #M17NObjectHead ¹½Â¤Âη¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
117 @c #M17NObjectHead ¤ÎÆâÍÆ¤Ï m17n
118 ¥é¥¤¥Ö¥é¥ê¤¬»ÈÍѤ¹¤ë¤Î¤Ç¡¢¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é¥à¤Ï¿¨¤ì¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£ */
122 /*** Hidden from applications. */
128 /* Return a newly allocated managed object. */
129 extern void *m17n_object (int size, void (*freer) (void *));
131 /* Increment the reference count of managed object OBJECT. */
132 extern int m17n_object_ref (void *object);
134 /* Decrement the reference count of managed object OBJECT. */
135 extern int m17n_object_unref (void *object);
137 /*** @ingroup m17nCore */
139 @brief Generic function type.
141 #M17NFunc is a generic function type for setting a function
142 pointer as a value of #MSymbol property or #MPlist. */
147 #M17NFunc ¤ÏÈÆ´Ø¿ô·¿¤Ç¤¢¤ê¡¢´Ø¿ô¥Ý¥¤¥ó¥¿¤ò #MSymbol ¥×¥í¥Ñ¥Æ¥£¤ä
148 #MPlist ¤ÎÃͤȤ·¤ÆÀßÄꤹ¤ëºÝÍѤ¤¤ë¡£ */
153 msymbol_put_func (), msymbol_get_func (),
154 mplist_put_func (), mplist_get_func (). */
156 typedef void (*M17NFunc) (void);
160 /*** @ingroup m17nCore */
162 @brief Wrapper for a generic function type.
164 The macro M17N_FUNC () casts a function to the type #M17NFunc. */
167 @brief ÈÆ´Ø¿ô·¿¤Ø¤Î¥é¥Ã¥Ñ.
169 ¥Þ¥¯¥í M17N_FUNC () ¤Ï´Ø¿ô¤ò #M17NFunc ·¿¤Ø¥¥ã¥¹¥È¤¹¤ë¡£ */
172 #define M17N_FUNC(func) ((M17NFunc) (func))
176 /* (C2) Symbol handling */
178 /*** @ingroup m17nCore */
179 /***en @defgroup m17nSymbol Symbol */
180 /***ja @defgroup m17nSymbol ¥·¥ó¥Ü¥ë */
184 @ingroup m17nSymbol */
186 @brief Type of symbols.
188 The type #MSymbol is for a @e symbol object. Its internal
189 structure is concealed from application programs. */
192 @brief ¥·¥ó¥Ü¥ë¤Î·¿Àë¸À.
194 #MSymbol ¤Ï @e ¥·¥ó¥Ü¥ë (symbol) ¥ª¥Ö¥¸¥§¥¯¥È¤Î·¿¤Ç¤¢¤ë¡£
195 ÆâÉô¹½Â¤¤Ï¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é¥à¤«¤é¤Ï¸«¤¨¤Ê¤¤¡£ */
197 typedef struct MSymbolStruct *MSymbol;
201 /* Predefined symbols. */
204 extern MSymbol Mstring;
205 extern MSymbol Msymbol;
206 extern MSymbol Mtext;
207 extern MSymbol Mcharset;
209 /* Return a symbol of name NAME. */
210 extern MSymbol msymbol (const char *name);
212 /* Return a managing key of name NAME. */
213 extern MSymbol msymbol_as_managing_key (const char *name);
215 /* Check if SYMBOL is a managing key. */
216 extern int msymbol_is_managing_key (MSymbol symbol);
218 /* Return a symbol of name NAME if it already exists. */
219 extern MSymbol msymbol_exist (const char *name);
221 /* Return the name of SYMBOL. */
222 extern char *msymbol_name (MSymbol symbol);
224 /* Give SYMBOL KEY property with value VALUE. */
225 extern int msymbol_put (MSymbol symbol, MSymbol key, void *val);
227 /*** Return KEY property value of SYMBOL. */
228 extern void *msymbol_get (MSymbol symbol, MSymbol key);
230 extern int msymbol_put_func (MSymbol symbol, MSymbol key, M17NFunc func);
232 extern M17NFunc msymbol_get_func (MSymbol symbol, MSymbol key);
235 * (2-1) Property List
238 /*** @ingroup m17nCore */
239 /***en @defgroup m17nPlist Property List */
240 /***ja @defgroup m17nPlist ¥×¥í¥Ñ¥Æ¥£¥ê¥¹¥È */
244 @ingroup m17nPlist */
246 @brief Type of property list objects.
248 The type #MPlist is for a @e property @e list object. Its internal
249 structure is concealed from application programs. */
252 @brief ¥×¥í¥Ñ¥Æ¥£¥ê¥¹¥È¡¦¥ª¥Ö¥¸¥§¥¯¥È¤Î·¿Àë¸À.
254 #MPlist ¤Ï @e ¥×¥í¥Ñ¥Æ¥£¥ê¥¹¥È (Property list) ¥ª¥Ö¥¸¥§¥¯¥È¤Î·¿¤Ç¤¢¤ë¡£
255 ÆâÉô¹½Â¤¤Ï¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é¥à¤«¤é¤Ï¸«¤¨¤Ê¤¤¡£ */
257 typedef struct MPlist MPlist;
261 extern MSymbol Mplist, Minteger;
263 extern MPlist *mplist ();
265 extern MPlist *mplist_copy (MPlist *plist);
267 extern MPlist *mplist_add (MPlist *plist, MSymbol key, void *val);
269 extern MPlist *mplist_push (MPlist *plist, MSymbol key, void *val);
271 extern void *mplist_pop (MPlist *plist);
273 extern MPlist *mplist_put (MPlist *plist, MSymbol key, void *val);
275 extern void *mplist_get (MPlist *plist, MSymbol key);
277 extern MPlist *mplist_put_func (MPlist *plist, MSymbol key, M17NFunc func);
279 extern M17NFunc mplist_get_func (MPlist *plist, MSymbol key);
281 extern MPlist *mplist_find_by_key (MPlist *plist, MSymbol key);
283 extern MPlist *mplist_find_by_value (MPlist *plist, void *val);
285 extern MPlist *mplist_next (MPlist *plist);
287 extern MPlist *mplist_set (MPlist *plist, MSymbol key, void *val);
289 extern int mplist_length (MPlist *plist);
291 extern MSymbol mplist_key (MPlist *plist);
293 extern void *mplist_value (MPlist *plist);
295 /* (S1) Characters */
298 /*** @ingroup m17nCore */
299 /***en @defgroup m17nCharacter Character */
300 /***ja @defgroup m17nCharacter ʸ»ú */
303 #if !defined (FOR_DOXYGEN) || defined (DOXYGEN_INTERNAL_MODULE)
304 #define MCHAR_MAX 0x3FFFFF
305 /*#define MCHAR_MAX 0x7FFFFFFF*/
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;
318 extern MSymbol mchar_define_property (const char *name, MSymbol type);
320 extern void *mchar_get_prop (int c, MSymbol key);
322 extern int mchar_put_prop (int c, MSymbol key, void *val);
324 /* (C3) Handling chartable */
326 /*** @ingroup m17nCore */
327 /***en @defgroup m17nChartable Chartable */
328 /***ja @defgroup m17nChartable ʸ»ú¥Æ¡¼¥Ö¥ë */
330 extern MSymbol Mchar_table;
333 @ingroup m17nChartable */
335 @brief Type of chartables.
337 The type #MCharTable is for a @e chartable objects. Its
338 internal structure is concealed from application programs. */
341 @brief ʸ»ú¥Æ¡¼¥Ö¥ë¤Î·¿Àë¸À.
343 #MCharTable ¤Ï @e ʸ»ú¥Æ¡¼¥Ö¥ë (chartable) ¥ª¥Ö¥¸¥§¥¯¥È¤Î·¿¤Ç¤¢¤ë¡£
344 ÆâÉô¹½Â¤¤Ï¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é¥à¤«¤é¤Ï¸«¤¨¤Ê¤¤¡£ */
346 typedef struct MCharTable MCharTable;
349 extern MCharTable *mchartable (MSymbol key, void *default_value);
351 extern int mchartable_min_char (MCharTable *table);
353 extern int mchartable_max_char (MCharTable *table);
355 extern void *mchartable_lookup (MCharTable *table, int c);
357 extern int mchartable_set (MCharTable *table, int c, void *val);
359 extern int mchartable_set_range (MCharTable *table, int from, int to,
362 extern int mchartable_map (MCharTable *table, void *ignore,
363 void (*func) (int, int, void *, void *),
366 extern void mchartable_range (MCharTable *table, int *from, int *to);
368 extern MCharTable *mchar_get_prop_table (MSymbol key, MSymbol *type);
371 * (5) Handling M-text.
372 * "M" of M-text stands for:
378 /*** @ingroup m17nCore */
379 /***en @defgroup m17nMtext M-text */
380 /***ja @defgroup m17nMtext M-text */
384 * (5-1) M-text basics
387 /*** @ingroup m17nMtext */
389 @brief Type of @e M-texts.
391 The type #MText is for an @e M-text object. Its internal
392 structure is concealed from application programs. */
395 @brief @e MText ¤Î·¿Àë¸À.
397 #Mtext ¤Ï @e M-text ¥ª¥Ö¥¸¥§¥¯¥È¤Î·¿¤Ç¤¢¤ë¡£
398 ÆâÉô¹½Â¤¤Ï¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é¥à¤«¤é¤Ï¸«¤¨¤Ê¤¤¡£
400 @latexonly \IPAlabel{MText} @endlatexonly
401 @latexonly \IPAlabel{MText->MPlist} @endlatexonly */
403 typedef struct MText MText;
407 /*** @ingroup m17nMtext */
409 @brief Enumeration for specifying the format of an M-text.
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. */
416 @brief M-text ¤Î¥Õ¥©¡¼¥Þ¥Ã¥È¤ò»ØÄꤹ¤ëÎóµó·¿.
418 Îóµó·¿ #MTextFormat ¤Ï´Ø¿ô
419 mtext_from_data () ¤Î°ú¿ô¤È¤·¤ÆÍѤ¤¤é¤ì¡¢
420 M-text ¤òÀ¸À®¤¹¤ë¸µ¤È¤Ê¤ë¥Ç¡¼¥¿¤Î¥Õ¥©¡¼¥Þ¥Ã¥È¤ò»ØÄꤹ¤ë¡£ */
424 /*** US-ASCII encoding */
425 MTEXT_FORMAT_US_ASCII,
426 /*** UTF-8 encoding */
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,
440 extern MText *mtext ();
442 extern void *mtext_data (MText *mt, enum MTextFormat *fmt, int *nunits,
443 int *pos_idx, int *unit_idx);
447 /***en @name Variables: Default Endian of UTF-16 and UTF-32 */
448 /***ja @name ÊÑ¿ô: UTF-16 ¤È UTF-32 ¤Î¥Ç¥Õ¥©¥ë¥È¤Î¥¨¥ó¥Ç¥£¥¢¥ó */
452 /*** @ingroup m17nMtext */
454 @brief Variable of value MTEXT_FORMAT_UTF_16LE or MTEXT_FORMAT_UTF_16BE.
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). */
463 @brief Ãͤ¬ MTEXT_FORMAT_UTF_16LE ¤« MTEXT_FORMAT_UTF_16BE ¤Ç¤¢¤ëÊÑ¿ô
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 ¤Ë½é´ü²½¤µ¤ì¤ë¡£ */
473 mtext_from_data () */
475 extern const enum MTextFormat MTEXT_FORMAT_UTF_16;
478 /*** @ingroup m17nMtext */
480 @brief Variable of value MTEXT_FORMAT_UTF_32LE or MTEXT_FORMAT_UTF_32BE.
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). */
489 @brief Ãͤ¬ MTEXT_FORMAT_UTF_32LE ¤« MTEXT_FORMAT_UTF_32BE ¤Ç¤¢¤ëÊÑ¿ô
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 ¤Ë½é´ü²½¤µ¤ì¤ë¡£ */
499 mtext_from_data () */
501 extern const int MTEXT_FORMAT_UTF_32;
507 extern MText *mtext_from_data (const void *data, int nitems,
508 enum MTextFormat format);
513 extern MSymbol Mlanguage;
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().
521 extern int mtext_len (MText *mt);
523 extern int mtext_ref_char (MText *mt, int pos);
525 extern int mtext_set_char (MText *mt, int pos, int c);
527 extern MText *mtext_copy (MText *mt1, int pos, MText *mt2, int from, int to);
529 extern int mtext_compare (MText *mt1, int from1, int to1,
530 MText *mt2, int from2, int to2);
532 extern int mtext_case_compare (MText *mt1, int from1, int to1,
533 MText *mt2, int from2, int to2);
535 extern int mtext_character (MText *mt, int from, int to, int c);
537 extern int mtext_del (MText *mt, int from, int to);
539 extern int mtext_ins (MText *mt1, int pos, MText *mt2);
541 extern int mtext_insert (MText *mt1, int pos, MText *mt2, int from, int to);
543 extern int mtext_ins_char (MText *mt, int pos, int c, int n);
545 extern int mtext_replace (MText *mt1, int from1, int to1,
546 MText *mt2, int from2, int to2);
548 extern MText *mtext_cat_char (MText *mt, int c);
550 extern MText *mtext_duplicate (MText *mt, int from, int to);
552 extern MText *mtext_dup (MText *mt);
554 extern MText *mtext_cat (MText *mt1, MText *mt2);
556 extern MText *mtext_ncat (MText *mt1, MText *mt2, int n);
558 extern MText *mtext_cpy (MText *mt1, MText *mt2);
560 extern MText *mtext_ncpy (MText *mt1, MText *mt2, int n);
562 extern int mtext_chr (MText *mt, int c);
564 extern int mtext_rchr (MText *mt, int c);
566 extern int mtext_cmp (MText *mt1, MText *mt2);
568 extern int mtext_ncmp (MText *mt1, MText *mt2, int n);
570 extern int mtext_spn (MText *mt1, MText *mt2);
572 extern int mtext_cspn (MText *mt1, MText *mt2);
574 extern int mtext_pbrk (MText *mt1, MText *mt2);
576 extern int mtext_text (MText *mt1, int pos, MText *mt2);
578 extern int mtext_search (MText *mt1, int from, int to, MText *mt2);
580 extern MText *mtext_tok (MText *mt, MText *delim, int *pos);
582 extern int mtext_casecmp (MText *mt1, MText *mt2);
584 extern int mtext_ncasecmp (MText *mt1, MText *mt2, int n);
586 extern int mtext_lowercase (MText *mt);
588 extern int mtext_titlecase (MText *mt);
590 extern int mtext_uppercase (MText *mt);
592 /*** @ingroup m17nMtext */
594 @brief Enumeration for specifying a set of line breaking option.
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. */
600 enum MTextLineBreakOption
602 /***en Specify the legacy support for space character as base for
603 combining marks. See the section 8.3 of UAX#14. */
605 /***en Specify to use space characters for line breaking Korean
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,
614 extern int mtext_line_break (MText *mt, int pos, int option, int *after);
616 /*** @ingroup m17nPlist */
617 extern MPlist *mplist_deserialize (MText *mt);
620 * (5-3) Text properties
623 /*** @ingroup m17nCore */
624 /***en @defgroup m17nTextProperty Text Property */
625 /***ja @defgroup m17nTextProperty ¥Æ¥¥¹¥È¥×¥í¥Ñ¥Æ¥£ */
627 /*** @ingroup m17nTextProperty */
629 @brief Flag bits to control text property.
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
637 @brief ¥Æ¥¥¹¥È¥×¥í¥Ñ¥Æ¥£¤òÀ©¸æ¤¹¤ë¥Õ¥é¥°¥Ó¥Ã¥È.
639 ´Ø¿ô mtext_property () ¤Ï°Ê²¼¤Î¥Õ¥é¥°¥Ó¥Ã¥È¤ÎÏÀÍý
640 OR ¤ò°ú¿ô¤È¤·¤Æ¤È¤ë¤³¤È¤¬¤Ç¤¤ë¡£
641 ¥Õ¥é¥°¥Ó¥Ã¥È¤ÏÀ¸À®¤µ¤ì¤¿¥Æ¥¥¹¥È¥×¥í¥Ñ¥Æ¥£¤Î¿¶Éñ¤¤¤òÀ©¸æ¤¹¤ë¡£
642 ¾ÜºÙ¤Ï³Æ¥Õ¥é¥°¥Ó¥Ã¥È¤ÎÀâÌÀ¤ò»²¾È¡£*/
644 enum MTextPropertyControl
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
649 /***ja ¤³¤Î¥Ó¥Ã¥È¤¬ on ¤Ê¤é¤Ð¡¢¤³¤Î¥Æ¥¥¹¥È¥×¥í¥Ñ¥Æ¥£¤Î»Ï¤Þ¤ëÅÀ¤¢¤ë¤¤¤ÏÃæ´Ö¤ËÁÞÆþ¤µ¤ì¤¿
650 M-text ¤Ï¤³¤Î¥Æ¥¥¹¥È¥×¥í¥Ñ¥Æ¥£¤ò·Ñ¾µ¤¹¤ë¡£
652 MTEXTPROP_FRONT_STICKY = 0x01,
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
657 /***ja ¤³¤Î¥Ó¥Ã¥È¤¬ on ¤Ê¤é¤Ð¡¢¤³¤Î¥Æ¥¥¹¥È¥×¥í¥Ñ¥Æ¥£¤Î½ª¤ï¤ëÅÀ¤¢¤ë¤¤¤ÏÃæ´Ö¤ËÁÞÆþ¤µ¤ì¤¿
658 M-text ¤Ï¤³¤Î¥Æ¥¥¹¥È¥×¥í¥Ñ¥Æ¥£¤ò·Ñ¾µ¤¹¤ë¡£
660 MTEXTPROP_REAR_STICKY = 0x02,
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,
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,
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,
678 MTEXTPROP_CONTROL_MAX = 0x1F
682 extern MSymbol Mtext_prop_serializer;
683 extern MSymbol Mtext_prop_deserializer;
686 /*** @ingroup m17nTextProperty */
688 @brief Type of serializer functions.
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
695 mtext_serialize (), #Mtext_prop_serializer
698 @brief ¥·¥ê¥¢¥é¥¤¥¶´Ø¿ô¤Î·¿Àë¸À.
700 ¥·¥ê¥¢¥é¥¤¥¶´Ø¿ô¤Î·¿¤Ç¤¢¤ë¡£ ¤¢¤ë¥·¥ó¥Ü¥ë¤Î¥×¥í¥Ñ¥Æ¥£¤Î¥¡¼¤¬ @c
701 #Mtext_prop_serializer ¤Ç¤¢¤ë¤È¤¡¢ ÃͤϤ³¤Î·¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
704 mtext_serialize (), #Mtext_prop_serializer
707 typedef MPlist *(*MTextPropSerializeFunc) (void *val);
709 /*** @ingroup m17nTextProperty */
711 @brief Type of deserializer functions.
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
718 mtext_deserialize (), #Mtext_prop_deserializer
721 @brief ¥Ç¥·¥ê¥¢¥é¥¤¥¶´Ø¿ô¤Î·¿Àë¸À.
723 ¥Ç¥·¥ê¥¢¥é¥¤¥¶´Ø¿ô¤Î·¿¤Ç¤¢¤ë¡£ ¤¢¤ë¥·¥ó¥Ü¥ë¤Î¥×¥í¥Ñ¥Æ¥£¤Î¥¡¼¤¬ @c
724 #Mtext_prop_deserializer ¤Ç¤¢¤ë¤È¤¡¢ ÃͤϤ³¤Î·¿¤Ç¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£
727 Mtext_prop_deserialize (), Mtext_prop_deserializer
729 typedef void *(*MTextPropDeserializeFunc) (MPlist *plist);
731 extern void *mtext_get_prop (MText *mt, int pos, MSymbol key);
733 extern int mtext_get_prop_values (MText *mt, int pos, MSymbol key,
734 void **values, int num);
736 extern int mtext_get_prop_keys (MText *mt, int pos, MSymbol **keys);
738 extern int mtext_put_prop (MText *mt, int from, int to,
739 MSymbol key, void *val);
741 extern int mtext_put_prop_values (MText *mt, int from, int to,
742 MSymbol key, void **values, int num);
744 extern int mtext_push_prop (MText *mt, int from, int to,
745 MSymbol key, void *val);
747 extern int mtext_pop_prop (MText *mt, int from, int to,
750 extern int mtext_prop_range (MText *mt, MSymbol key, int pos,
751 int *from, int *to, int deeper);
755 @ingroup m17nTextProperty */
757 @brief Type of text properties.
759 The type #MTextProperty is for a @e text @e property objects. Its
760 internal structure is concealed from application programs. */
762 @brief @c ¥Æ¥¥¹¥È¥×¥í¥Ñ¥Æ¥£¤Î·¿Àë¸À.
764 #MTextProperty ¤Ï @e ¥Æ¥¥¹¥È¥×¥í¥Ñ¥Æ¥£ ¥ª¥Ö¥¸¥§¥¯¥È¤Î·¿¤Ç¤¢¤ë¡£
765 ÆâÉô¹½Â¤¤Ï¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é¥à¤«¤é¤Ï¸«¤¨¤Ê¤¤¡£ */
767 typedef struct MTextProperty MTextProperty;
771 extern MTextProperty *mtext_property (MSymbol key, void *val,
774 extern MText *mtext_property_mtext (MTextProperty *prop);
776 extern MSymbol mtext_property_key (MTextProperty *prop);
778 extern void *mtext_property_value (MTextProperty *prop);
780 extern int mtext_property_start (MTextProperty *prop);
782 extern int mtext_property_end (MTextProperty *prop);
784 extern MTextProperty *mtext_get_property (MText *mt, int pos, MSymbol key);
786 extern int mtext_get_properties (MText *mt, int pos, MSymbol key,
787 MTextProperty **props, int num);
789 extern int mtext_attach_property (MText *mt, int from, int to,
790 MTextProperty *prop);
792 extern int mtext_detach_property (MTextProperty *prop);
794 extern int mtext_push_property (MText *mt, int from, int to,
795 MTextProperty *prop);
797 extern MText *mtext_serialize (MText *mt, int from, int to,
798 MPlist *property_list);
800 extern MText *mtext_deserialize (MText *mt);
802 /*** @ingroup m17nCore */
803 /***en @defgroup m17nDatabase Database */
804 /***ja @defgroup m17nDatabase ¥Ç¡¼¥¿¥Ù¡¼¥¹ */
807 /* Directory of an application specific databases. */
808 extern char *mdatabase_dir;
811 @ingroup m17nDatabase */
813 @brief Type of database.
815 The type #MDatabase is for a database object. Its internal
816 structure is concealed from an application program. */
818 @brief ¥Ç¡¼¥¿¥Ù¡¼¥¹¤Î·¿Àë¸À.
820 #MDatabase ·¿¤Ï¥Ç¡¼¥¿¥Ù¡¼¥¹¥ª¥Ö¥¸¥§¥¯¥ÈÍѤι½Â¤ÂΤǤ¢¤ë¡£
821 ÆâÉô¹½Â¤¤Ï¥¢¥×¥ê¥±¡¼¥·¥ç¥ó¥×¥í¥°¥é¥à¤«¤é¤Ï¸«¤¨¤Ê¤¤¡£
824 typedef struct MDatabase MDatabase;
828 /* Look for a data. */
829 extern MDatabase *mdatabase_find (MSymbol tag1, MSymbol tag2,
830 MSymbol tag3, MSymbol tag4);
832 extern MPlist *mdatabase_list (MSymbol tag0, MSymbol tag1,
833 MSymbol tag2, MSymbol tag3);
836 void *mdatabase_load (MDatabase *mdb);
838 /* Get tags of a data. */
839 extern MSymbol *mdatabase_tag (MDatabase *mdb);
842 extern MDatabase *mdatabase_define (MSymbol tag1, MSymbol tag2,
843 MSymbol tag3, MSymbol tag4,
844 void *(*loader) (MSymbol *, void *),
849 #endif /* _M17N_CORE_H_ */