1 /* character.c -- character module.
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,
24 @addtogroup m17nCharacter
25 @brief Character objects and API for them.
27 The m17n library represents a @e character by a character code (an
28 integer). The minimum character code is @c 0. The maximum
29 character code is defined by the macro #MCHAR_MAX. It is
30 assured that #MCHAR_MAX is not smaller than @c 0x3FFFFF (22
33 Characters @c 0 to @c 0x10FFFF are equivalent to the Unicode
34 characters of the same code values.
36 A character can have zero or more properties called @e character
37 @e properties. A character property consists of a @e key and a
38 @e value, where key is a symbol and value is anything that can be
39 cast to <tt>(void *)</tt>. "The character property that belongs
40 to character C and whose key is K" may be shortened to "the K
44 @addtogroup m17nCharacter
45 @brief ʸ»ú¥ª¥Ö¥¸¥§¥¯¥È¤È¤½¤ì¤Ë´Ø¤¹¤ë API.
47 m17n ¥é¥¤¥Ö¥é¥ê¤Ï @e ʸ»ú ¤òʸ»ú¥³¡¼¥É¡ÊÀ°¿ô¡Ë¤Çɽ¸½¤¹¤ë¡£
48 ºÇ¾®¤Îʸ»ú¥³¡¼¥É¤Ï @c 0 ¤Ç¤¢¤ê¡¢ºÇÂç¤Îʸ»ú¥³¡¼¥É¤Ï¥Þ¥¯¥í #MCHAR_MAX
49 ¤Ë¤è¤Ã¤ÆÄêµÁ¤µ¤ì¤Æ¤¤¤ë¡£#MCHAR_MAX ¤Ï @c 0x3FFFFF¡Ê22¥Ó¥Ã¥È¡Ë
50 °Ê¾å¤Ç¤¢¤ë¤³¤È¤¬Êݾڤµ¤ì¤Æ¤¤¤ë¡£
52 @c 0 ¤«¤é @c 0x10FFFF ¤Þ¤Ç¤Îʸ»ú¤Ï¡¢¤½¤ì¤ÈƱ¤¸Ãͤò»ý¤Ä Unicode
53 ¤Îʸ»ú¤Ë³ä¤êÅö¤Æ¤é¤ì¤Æ¤¤¤ë¡£
55 ³Æʸ»ú¤Ï @e ʸ»ú¥×¥í¥Ñ¥Æ¥£ ¤È¸Æ¤Ö¥×¥í¥Ñ¥Æ¥£¤ò 0 ¸Ä°Ê¾å»ý¤Ä¤³¤È¤¬¤Ç¤¤ë¡£
56 ʸ»ú¥×¥í¥Ñ¥Æ¥£¤Ï @e ¥¡¼ ¤È @e ÃÍ ¤«¤é¤Ê¤ë¡£
57 ¥¡¼¤Ï¥·¥ó¥Ü¥ë¤Ç¤¢¤ê¡¢ÃÍ¤Ï <tt>(void *)</tt> ·¿¤Ë¥¥ã¥¹¥È¤Ç¤¤ë¤â¤Î¤Ê¤é²¿¤Ç¤â¤è¤¤¡£
58 ¡Öʸ»ú C ¤Îʸ»ú¥×¥í¥Ñ¥Æ¥£¤Î¤¦¤Á¥¡¼¤¬ K ¤Ç¤¢¤ë¤â¤Î¡×¤ò´Êñ¤Ë¡Öʸ»ú C
59 ¤Î K ¥×¥í¥Ñ¥Æ¥£¡×¤È¸Æ¤Ö¤³¤È¤¬¤¢¤ë¡£ */
62 #if !defined (FOR_DOXYGEN) || defined (DOXYGEN_INTERNAL_MODULE)
63 /*** @addtogroup m17nInternal
73 #include "m17n-core.h"
74 #include "m17n-misc.h"
84 static MPlist *char_prop_list;
87 free_string (int from, int to, void *str, void *arg)
98 Mname = msymbol ("name");
99 Mcategory = msymbol ("category");
100 Mcombining_class = msymbol ("combining-class");
101 Mbidi_category = msymbol ("bidirectional-category");
102 Msimple_case_folding = msymbol ("simple-case-folding");
103 Mcomplicated_case_folding = msymbol ("complicated-case-folding");
104 Mcased = msymbol ("cased");
105 Msoft_dotted = msymbol ("soft-dotted");
106 Mcase_mapping = msymbol ("case-mapping");
107 Mblock = msymbol ("block");
108 Mscript = msymbol ("script");
120 for (p = char_prop_list; mplist_key (p) != Mnil; p = mplist_next (p))
122 MCharPropRecord *record = mplist_value (p);
126 if (record->type == Mstring)
127 mchartable_map (record->table, NULL, free_string, NULL);
128 M17N_OBJECT_UNREF (record->table);
132 M17N_OBJECT_UNREF (char_prop_list);
137 mchar__define_prop (MSymbol key, MSymbol type, void *mdb)
139 MCharPropRecord *record;
142 record = mplist_get (char_prop_list, key);
144 char_prop_list = mplist (), record = NULL;
148 M17N_OBJECT_UNREF (record->table);
152 MSTRUCT_CALLOC (record, MERROR_CHAR);
153 mplist_put (char_prop_list, key, record);
160 record->table = NULL;
164 void *default_value = NULL;
166 if (type == Minteger)
167 default_value = (void *) -1;
168 record->table = mchartable (type, default_value);
174 #endif /* !FOR_DOXYGEN || DOXYGEN_INTERNAL_MODULE */
178 /*** @addtogroup m17nCharacter
184 @brief Maximum character code.
186 The macro #MCHAR_MAX gives the maximum character code. */
189 @brief ʸ»ú¥³¡¼¥É¤ÎºÇÂçÃÍ.
191 ¥Þ¥¯¥í #MCHAR_MAX ¤Ïʸ»ú¥³¡¼¥É¤ÎºÇÂçÃͤòɽ¤¹¡£ */
195 #endif /* FOR_DOXYGEN */
198 @name Variables: Keys of character properties
200 These symbols are used as keys of character properties. */
203 @ingroup m17nCharacter
204 @name ÊÑ¿ô: ʸ»ú¥×¥í¥Ñ¥Æ¥£¤Î¥¡¼
206 ¤³¤ì¤é¤Î¥·¥ó¥Ü¥ë¤Ïʸ»ú¥×¥í¥Ñ¥Æ¥£¤Î¥¡¼¤È¤·¤Æ»È¤ï¤ì¤ë¡£*/
212 @brief Key for script.
214 The symbol #Mscript has the name <tt>"script"</tt> and is used as the key
215 of a character property. The value of such a property is a symbol
216 representing the script to which the character belongs.
218 Each symbol that represents a script has one of the names listed in
219 the <em>Unicode Technical Report #24</em>. */
222 @brief ¥¹¥¯¥ê¥×¥È¤òɽ¤ï¤¹¥¡¼.
224 ¥·¥ó¥Ü¥ë #Mscript ¤Ï <tt>"script"</tt>
225 ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Á¡¢Ê¸»ú¥×¥í¥Ñ¥Æ¥£¤Î¥¡¼¤È¤·¤Æ»È¤ï¤ì¤ë¡£
226 ¤³¤Î¥×¥í¥Ñ¥Æ¥£¤ÎÃͤϡ¢¤³¤Îʸ»ú¤Î°¤¹¤ë¥¹¥¯¥ê¥×¥È¤òɽ¤ï¤¹¥·¥ó¥Ü¥ë¤Ç¤¢¤ë¡£
228 ¥¹¥¯¥ê¥×¥È¤òɽ¤ï¤¹¥·¥ó¥Ü¥ë¤Î̾Á°¤Ï¡¢<em>Unicode Technical Report
229 #24</em> ¤Ë¥ê¥¹¥È¤µ¤ì¤Æ¤¤¤ë¤â¤Î¤Î¤¤¤º¤ì¤«¤Ç¤¢¤ë¡£ */
236 @brief Key for character name.
238 The symbol #Mname has the name <tt>"name"</tt> and is used as
239 the key of a character property. The value of such a property is a
240 C-string representing the name of the character. */
243 @brief ̾Á°¤òɽ¤ï¤¹¥¡¼.
245 ¥·¥ó¥Ü¥ë #Mname ¤Ï <tt>"name"</tt>
246 ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Á¡¢Ê¸»ú¥×¥í¥Ñ¥Æ¥£¤Î¥¡¼¤È¤·¤Æ»È¤ï¤ì¤ë¡£
247 ¤³¤Î¥×¥í¥Ñ¥Æ¥£¤ÎÃͤϤ½¤Îʸ»ú¤Î̾Á°¤òɽ¤ï¤¹ C ¤Îʸ»úÎó¤Ç¤¢¤ë¡£ */
254 @brief Key for general category.
256 The symbol #Mcategory has the name <tt>"category"</tt> and is
257 used as the key of a character property. The value of such a
258 property is a symbol representing the <em>general category</em> of
261 Each symbol that represents a general category has one of the
262 names listed as abbreviations for <em>General Category</em> in
266 @brief °ìÈÌ¥«¥Æ¥´¥ê¤òɽ¤ï¤¹¥¡¼.
268 ¥·¥ó¥Ü¥ë #Mcategory ¤Ï <tt>"category"</tt>
269 ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Á¡¢Ê¸»ú¥×¥í¥Ñ¥Æ¥£¤Î¥¡¼¤È¤·¤Æ»È¤ï¤ì¤ë¡£
270 ¤³¤Î¥×¥í¥Ñ¥Æ¥£¤ÎÃͤϡ¢Âбþ¤¹¤ë <em>°ìÈÌ¥«¥Æ¥´¥ê</em> ¤òɽ¤ï¤¹¥·¥ó¥Ü¥ë¤Ç¤¢¤ë¡£
272 °ìÈÌ¥«¥Æ¥´¥ê¤òɽ¤ï¤¹¥·¥ó¥Ü¥ë¤Î̾Á°¤Ï¡¢<em>General Category</em>
273 ¤Î¾Êά·Á¤È¤·¤Æ Unicode ¤ËÄêµÁ¤µ¤ì¤Æ¤¤¤ë¤â¤Î¤Ç¤¢¤ë¡£ */
280 @brief Key for canonical combining class.
282 The symbol #Mcombining_class has the name
283 <tt>"combining-class"</tt> and is used as the key of a character
284 property. The value of such a property is an integer that
285 represents the <em>canonical combining class</em> of the character.
287 The meaning of each integer that represents a canonical combining
288 class is identical to the one defined in Unicode. */
291 @brief ɸ½à·ë¹ç¥¯¥é¥¹¤òɽ¤ï¤¹¥¡¼.
293 ¥·¥ó¥Ü¥ë #Mcombining_class ¤Ï <tt>"combining-class"</tt>
294 ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Á¡¢Ê¸»ú¥×¥í¥Ñ¥Æ¥£¤Î¥¡¼¤È¤·¤Æ»È¤ï¤ì¤ë¡£
295 ¤³¤Î¥×¥í¥Ñ¥Æ¥£¤ÎÃͤϡ¢Âбþ¤¹¤ë @e ɸ½à·ë¹ç¥¯¥é¥¹ ¤òɽ¤ï¤¹À°¿ô¤Ç¤¢¤ë¡£
297 ɸ½à·ë¹ç¥¯¥é¥¹¤òɽ¤ï¤¹À°¿ô¤Î°ÕÌ£¤Ï¡¢Unicode
298 ¤ËÄêµÁ¤µ¤ì¤Æ¤¤¤ë¤â¤Î¤ÈƱ¤¸¤Ç¤¢¤ë¡£ */
300 MSymbol Mcombining_class;
304 @brief Key for bidi category.
306 The symbol #Mbidi_category has the name <tt>"bidi-category"</tt>
307 and is used as the key of a character property. The value of such
308 a property is a symbol that represents the <em>bidirectional
309 category</em> of the character.
311 Each symbol that represents a bidirectional category has one of
312 the names listed as types of <em>Bidirectional Category</em> in
316 @brief ÁÐÊý¸þ¥«¥Æ¥´¥ê¤òɽ¤ï¤¹¥¡¼.
318 ¥·¥ó¥Ü¥ë #Mbidi_category ¤Ï <tt>"bidi-category"</tt>
319 ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Á¡¢Ê¸»ú¥×¥í¥Ñ¥Æ¥£¤Î¥¡¼¤È¤·¤Æ»È¤ï¤ì¤ë¡£
320 ¤³¤Î¥×¥í¥Ñ¥Æ¥£¤ÎÃͤϡ¢Âбþ¤¹¤ë @e ÁÐÊý¸þ¥«¥Æ¥´¥ê ¤òɽ¤ï¤¹¥·¥ó¥Ü¥ë¤Ç¤¢¤ë¡£
322 ÁÐÊý¸þ¥«¥Æ¥´¥ê¤òɽ¤ï¤¹¥·¥ó¥Ü¥ë¤Î̾Á°¤Ï¡¢<em>Bidirectional
323 Category</em> ¤Î·¿¤È¤·¤Æ Unicode ¤ËÄêµÁ¤µ¤ì¤Æ¤¤¤ë¤â¤Î¤Ç¤¢¤ë¡£ */
325 MSymbol Mbidi_category;
329 @brief Key for corresponding single lowercase character.
331 The symbol #Msimple_case_folding has the name
332 <tt>"simple-case-folding"</tt> and is used as the key of a
333 character property. The value of such a property is the
334 corresponding single lowercase character that is used when
335 comparing M-texts ignoring cases.
337 If a character requires a complicated comparison (i.e. cannot be
338 compared by simply mapping to another single character), the value
339 of such a property is @c 0xFFFF. In this case, the character has
340 another property whose key is #Mcomplicated_case_folding. */
343 @brief Âбþ¤¹¤ë¾®Ê¸»ú°ìʸ»ú¤òɽ¤ï¤¹¥¡¼.
345 ¥·¥ó¥Ü¥ë #Msimple_case_folding ¤Ï <tt>"simple-case-folding"</tt>
346 ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Á¡¢Ê¸»ú¥×¥í¥Ñ¥Æ¥£¤Î¥¡¼¤È¤·¤Æ»È¤ï¤ì¤ë¡£
347 ¤³¤Î¥×¥í¥Ñ¥Æ¥£¤ÎÃͤϡ¢Âбþ¤¹¤ë¾®Ê¸»ú°ìʸ»ú¤Ç¤¢¤ê¡¢Âçʸ»ú¡¿¾®Ê¸»ú¤Î¶èÊ̤ò̵»ë¤·¤¿Ê¸»úÎóÈæ³Ó¤ÎºÝ¤Ë»È¤ï¤ì¤ë¡£
349 Ê£»¨¤ÊÈæ³ÓÊýË¡¤òɬÍפȤ¹¤ëʸ»ú¤Ç¤¢¤Ã¤¿¾ì¹ç
350 ¡ÊÊ̤ΰìʸ»ú¤ÈÂбþÉÕ¤±¤ë¤³¤È¤Ë¤è¤Ã¤ÆÈæ³Ó¤Ç¤¤Ê¤¤¾ì¹ç¡Ë¡¢¤³¤Î¥×¥í¥Ñ¥Æ¥£¤ÎÃͤÏ
351 @c 0xFFFF ¤Ë¤Ê¤ë¡£¤³¤Î¾ì¹ç¤½¤Îʸ»ú¤Ï¡¢#Mcomplicated_case_folding
352 ¤È¤¤¤¦¥¡¼¤Îʸ»ú¥×¥í¥Ñ¥Æ¥£¤ò»ý¤Ä¡£ */
354 MSymbol Msimple_case_folding;
358 @brief Key for corresponding multiple lowercase characters.
360 The symbol #Mcomplicated_case_folding has the name
361 <tt>"complicated-case-folding"</tt> and is used as the key of a
362 character property. The value of such a property is the
363 corresponding M-text that contains a sequence of lowercase
364 characters to be used for comparing M-texts ignoring case. */
367 @brief Âбþ¤¹¤ë¾®Ê¸»ú¤ÎÎó¤òɽ¤ï¤¹¥¡¼.
369 ¥·¥ó¥Ü¥ë #Mcomplicated_case_folding ¤Ï
370 <tt>"complicated-case-folding"</tt>
371 ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Á¡¢Ê¸»ú¥×¥í¥Ñ¥Æ¥£¤Î¥¡¼¤È¤·¤Æ»È¤ï¤ì¤ë¡£
372 ¤³¤Î¥×¥í¥Ñ¥Æ¥£¤ÎÃͤϡ¢Âбþ¤¹¤ë¾®Ê¸»úÎ󤫤é¤Ê¤ë M-text ¤Ç¤¢¤ê¡¢Âçʸ»ú¡¿¾®Ê¸»ú¤Î¶èÊ̤ò̵»ë¤·¤¿Ê¸»úÎóÈæ³Ó¤ÎºÝ¤Ë»È
376 MSymbol Mcomplicated_case_folding;
380 @brief Key for values used in case operation.
382 The symbol #Mcased has the name <tt>"cased"</tt> and is used as
383 the key of charater property. The value of such a property is an
384 integer value 1, 2, or 3 representing "cased", "case-ignorable",
385 and both of them respective. See the Unicode Standard 5.0
386 (Section 3.13 Default Case Algorithm) for the detail.
390 @brief Case ½èÍý¤ËÍѤ¤¤é¤ì¤ëÃͤΥ¡¼.
392 ¥·¥ó¥Ü¥ë #Mcased ¤Ï¡¢<tt>"cased"</tt> ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Á¡¢Ê¸»ú¥×¥í¥Ñ
393 ¥Æ¥£¤Î¥¡¼¤È¤·¤Æ»È¤ï¤ì¤ë¡£¤³¤Î¥×¥í¥Ñ¥Æ¥£¤ÎÃͤÏÀ°¿ôÃÍ 1, 2, 3 ¤Î¤¤¤º
394 ¤ì¤«¤Ç¤¢¤ê¡¢¤½¤ì¤¾¤ì "cased", "case-ignorable", ¤½¤ÎξÊý¤ò°ÕÌ£¤¹¤ë¡£
395 ¾ÜºÙ¤Ë¤Ä¤¤¤Æ¤Ï¡¢the Unicode Standard 5.0 (Section 3.13 Default
396 Case Algorithm) »²¾È¡£
402 @brief Key for values used in case operation.
404 The symbol #Msoft_dotted has the name <tt>"soft-dotted"</tt> and
405 is used as the key of charater property. The value of such a
406 property is #Mt if a character has "Soft_Dotted" property, and
407 #Mnil otherwise. See the Unicode Standard 5.0 (Section 3.13
408 Default Case Algorithm) for the detail. */
411 @brief Case ½èÍý¤ËÍѤ¤¤é¤ì¤ëÃͤΥ¡¼.
413 ¥·¥ó¥Ü¥ë #Msoft_dotted ¤Ï¡¢<tt>"soft-dotted"</tt> ¤È¤¤¤¦Ì¾Á°¤ò»ý¤Á¡¢
414 ʸ»ú¥×¥í¥Ñ¥Æ¥£¤Î¥¡¼¤È¤·¤Æ»È¤ï¤ì¤ë¡£¤³¤Î¥×¥í¥Ñ¥Æ¥£¤ÎÃͤϡ¢Ê¸»ú¤¬
415 "Soft_Dotted"¥×¥í¥Ñ¥Æ¥£¤ò»ý¤Ä¾ì¹ç¤Ë¤Ï #Mt, ¤½¤¦¤Ç¤Ê¤±¤ì¤Ð #Mnil ¤Ç
416 ¤¢¤ë¡£ ¾ÜºÙ¤Ë¤Ä¤¤¤Æ¤Ï¡¢the Unicode Standard 5.0 (Section 3.13
417 Default Case Algorithm) »²¾È¡£
419 MSymbol Msoft_dotted;
423 @brief Key for values used in case operation.
425 The symbol #Mcase_mapping has the name <tt>"case-mapping"</tt> and
426 is used as the key of charater property. The value of such a
427 property is a plist of three M-Texts; lower, title, and upper of
428 the corresponding character. See the Unicode Standard 5.0
429 (Section 5.18 Case Mappings) for the detail. */
432 @brief Case ½èÍý¤ËÍѤ¤¤é¤ì¤ëÃͤΥ¡¼.
434 ¥·¥ó¥Ü¥ë #Mcase_mapping ¤Ï¡¢<tt>"case-mapping"</tt> ¤È¤¤¤¦Ì¾Á°¤ò¤â
435 ¤Á¡¢Ê¸»ú¥×¥í¥Ñ¥Æ¥£¤Î¥¡¼¤È¤·¤Æ»È¤ï¤ì¤ë¡£¤³¤Î¥×¥í¥Ñ¥Æ¥£¤ÎÃͤϡ¢£³¤Ä
436 ¤Î M-text¡¢¤¹¤Ê¤ï¤Á¤½¤Îʸ»ú¤Î lower, title, ¤È upper¤«¤é¤Ê¤ë plist
437 ¤Ç¤¢¤ë¡£ ¾ÜºÙ¤Ë¤Ä¤¤¤Æ¤Ï¡¢the Unicode Standard 5.0 (Section 3.13
438 Default Case Algorithm) »²¾È¡£
440 MSymbol Mcase_mapping;
444 @brief Key for script block name.
446 The symbol #Mblock the name <tt>"block"</tt> and is used as the
447 key of charater property. The value of such a property is a
448 symbol representing a script block of the corresponding
451 @brief ¥¹¥¯¥ê¥×¥È¥Ö¥í¥Ã¥¯Ì¾¤òɽ¤¹¥¡¼.
453 ¥·¥ó¥Ü¥ë #Mblock ¤Ï¡¢<tt>"block"</tt> ¤È¤¤¤¦Ì¾Á°¤ò¤â¤Á¡¢Ê¸»ú¥×¥í¥Ñ
454 ¥Æ¥£¤Î¥¡¼¤È¤·¤Æ»È¤ï¤ì¤ë¡£¤³¤Î¥×¥í¥Ñ¥Æ¥£¤ÎÃͤϡ¢¤½¤Îʸ»ú¤Î¥¹¥¯¥ê¥×
455 ¥È¥Ö¥í¥Ã¥¯Ì¾¤òɽ¤¹¥·¥ó¥Ü¥ë¤Ç¤¢¤ë¡£*/
462 @brief Define a character property.
464 The mchar_define_property () function searches the m17n database
465 for a data whose tags are \<#Mchar_table, $TYPE, $SYM \>.
466 Here, $SYM is a symbol whose name is $NAME. $TYPE must be
467 #Mstring, #Mtext, #Msymbol, #Minteger, or #Mplist.
470 If the operation was successful, mchar_define_property () returns
471 $SYM. Otherwise it returns #Mnil. */
474 @brief ʸ»ú¥×¥í¥Ñ¥Æ¥£¤òÄêµÁ¤¹¤ë.
476 ´Ø¿ô mchar_define_property () ¤Ï¡¢ \<#Mchar_table, $TYPE, $SYM \>
477 ¤È¤¤¤¦¥¿¥°¤ò»ý¤Ã¤¿¥Ç¡¼¥¿¥Ù¡¼¥¹¤ò m17n ¸À¸ì¾ðÊó¥Ù¡¼¥¹¤«¤éõ¤¹¡£
478 ¤³¤³¤Ç $SYM ¤Ï $NAME ¤È¤¤¤¦Ì¾Á°¤Î¥·¥ó¥Ü¥ë¤Ç¤¢¤ë¡£$TYPE ¤Ï#Mstring,
479 #Mtext, #Msymbol, #Minteger, #Mplist ¤Î¤¤¤º¤ì¤«¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
482 ½èÍý¤ËÀ®¸ù¤¹¤ì¤Ð mchar_define_property () ¤Ï$SYM ¤òÊÖ¤¹¡£
483 ¼ºÇÔ¤·¤¿¾ì¹ç¤Ï #Mnil ¤òÊÖ¤¹¡£ */
490 mchar_get_prop (), mchar_put_prop () */
493 mchar_define_property (const char *name, MSymbol type)
495 MSymbol key = msymbol (name);
498 mdb = mdatabase_find (Mchar_table, type, key, Mnil);
501 mchar__define_prop (key, type, mdb);
508 @brief Get the value of a character property.
510 The mchar_get_prop () function searches character $C for the
511 character property whose key is $KEY.
514 If the operation was successful, mchar_get_prop () returns the
515 value of the character property. Otherwise it returns @c
519 @brief ʸ»ú¥×¥í¥Ñ¥Æ¥£¤ÎÃͤòÆÀ¤ë.
521 ´Ø¿ô mchar_get_prop () ¤Ï¡¢Ê¸»ú $C ¤Îʸ»ú¥×¥í¥Ñ¥Æ¥£¤Î¤¦¤Á¥¡¼¤¬
522 $KEY ¤Ç¤¢¤ë¤â¤Î¤òõ¤¹¡£
525 ½èÍý¤¬À®¸ù¤¹¤ì¤Ð mchar_get_prop () ¤Ï¸«¤Ä¤«¤Ã¤¿¥×¥í¥Ñ¥Æ¥£¤ÎÃͤòÊÖ¤¹¡£
526 ¼ºÇÔ¤·¤¿¾ì¹ç¤Ï @c NULL ¤òÊÖ¤¹¡£
528 @latexonly \IPAlabel{mchar_get_prop} @endlatexonly
532 @c MERROR_SYMBOL, @c MERROR_DB
535 mchar_define_property (), mchar_put_prop () */
538 mchar_get_prop (int c, MSymbol key)
540 MCharPropRecord *record;
542 if (! char_prop_list)
544 record = mplist_get (char_prop_list, key);
549 record->table = mdatabase_load (record->mdb);
551 MERROR (MERROR_DB, NULL);
554 return mchartable_lookup (record->table, c);
560 @brief Set the value of a character property.
562 The mchar_put_prop () function searches character $C for the
563 character property whose key is $KEY and assigns $VAL to the value
564 of the found property.
567 If the operation was successful, mchar_put_prop () returns 0.
568 Otherwise, it returns -1. */
570 @brief ʸ»ú¥×¥í¥Ñ¥Æ¥£¤ÎÃͤòÀßÄꤹ¤ë.
572 ´Ø¿ô mchar_put_prop () ¤Ï¡¢Ê¸»ú $C ¤Îʸ»ú¥×¥í¥Ñ¥Æ¥£¤Î¤¦¤Á¥¡¼¤¬ $KEY
573 ¤Ç¤¢¤ë¤â¤Î¤òõ¤·¡¢¤½¤ÎÃͤȤ·¤Æ $VAL ¤òÀßÄꤹ¤ë¡£
576 ½èÍý¤¬À®¸ù¤¹¤ì¤Ð mchar_put_prop () ¤Ï0¤òÊÖ¤¹¡£¼ºÇÔ¤·¤¿¾ì¹ç¤Ï-1¤òÊÖ¤¹¡£ */
579 @c MERROR_SYMBOL, @c MERROR_DB
582 mchar_define_property (), mchar_get_prop () */
585 mchar_put_prop (int c, MSymbol key, void *val)
587 MCharPropRecord *record;
589 if (! char_prop_list)
590 MERROR (MERROR_CHAR, -1);
591 record = mplist_get (char_prop_list, key);
596 record->table = mdatabase_load (record->mdb);
598 MERROR (MERROR_DB, -1);
601 return mchartable_set (record->table, c, val);
607 @brief Get the char-table for a character property.
609 The mchar_get_prop_table () function returns a char-table that
610 contains the character property whose key is $KEY. If $TYPE is
611 not NULL, this function stores the type of the property in the
612 place pointed by $TYPE. See mchar_define_property () for types of
616 If $KEY is a valid character property key, this function returns a
617 char-table. Otherwise NULL is retuned. */
620 @brief ʸ»ú¥×¥í¥Ñ¥Æ¥£¤Îʸ»ú¥Æ¡¼¥Ö¥ë¤òÆÀ¤ë.
622 ´Ø¿ô mchar_get_prop_table () ¤Ï¡¢¥¡¼¤¬ $KEY ¤Ç¤¢¤ëʸ»ú¥×¥í¥Ñ¥Æ¥£
623 ¤ò´Þ¤àʸ»ú¥Æ¡¼¥Ö¥ë¤òÊÖ¤¹¡£¤â¤· $TYPE ¤¬ NULL ¤Ç¤Ê¤±¤ì¤Ð¡¢ $TYPE ¤Ç
624 »Ø¤µ¤ì¤ë¾ì½ê¤Ë¤½¤Îʸ»ú¤Î¥×¥í¥Ñ¥Æ¥£¤ò³ÊǼ¤¹¤ë¡£Ê¸»ú¥×¥í¥Ñ¥Æ¥£¤Î¼ïÎà
625 ¤Ë´Ø¤·¤Æ¤Ï mchar_define_property () ¤ò¸«¤è¡£
628 ¤â¤· $KEY ¤¬ÀµÅö¤Êʸ»ú¥×¥í¥Ñ¥Æ¥£¤Î¥¡¼¤Ç¤¢¤ì¤Ð¡¢Ê¸»ú¥Æ¡¼¥Ö¥ë¤¬ÊÖ¤µ
629 ¤ì¤ë¡£¤½¤¦¤Ç¤Ê¤¤¾ì¹ç¤Ï NULL ¤¬ÊÖ¤µ¤ì¤ë¡£ */
632 mchar_get_prop_table (MSymbol key, MSymbol *type)
634 MCharPropRecord *record;
636 if (! char_prop_list)
638 record = mplist_get (char_prop_list, key);
643 record->table = mdatabase_load (record->mdb);
645 MERROR (MERROR_DB, NULL);
649 *type = record->type;
650 return record->table;