/***en
@brief Get the value of a property in a property list.
- The mplist_get () function searches property list $PLIST
- from the beginning for a property whose key is $KEY. If such a
- property is found, a pointer to its value is returned as the type
- of <tt>(void *)</tt>. If not found, @c NULL is returned.
+ The mplist_get () function searches property list $PLIST from the
+ beginning for a property whose key is $KEY. If such a property is
+ found, its value is returned as the type of <tt>(void *)</tt>. If
+ not found, @c NULL is returned.
When @c NULL is returned, there are two possibilities: one is the
case where no property is found (see above); the other is the case
/***ja
@brief ¥×¥í¥Ñ¥Æ¥£¥ê¥¹¥ÈÃæ¤Î¥×¥í¥Ñ¥Æ¥£¤ÎÃͤòÆÀ¤ë.
- ´Ø¿ô mplist_get () ¤Ï¡¢¥×¥í¥Ñ¥Æ¥£¥ê¥¹¥È $PLIST ¤ò»Ï¤á¤«¤éõ¤·¤Æ¡¢¥¡¼¤¬
- $KEY ¤Ç¤¢¤ë¥×¥í¥Ñ¥Æ¥£¤ò¸«¤Ä¤±¤ë¡£¸«¤Ä¤«¤ì¤Ð¡¢¤½¤ÎÃͤؤΥݥ¤¥ó¥¿¤ò
+ ´Ø¿ô mplist_get () ¤Ï¡¢¥×¥í¥Ñ¥Æ¥£¥ê¥¹¥È $PLIST ¤ò»Ï¤á¤«¤éõ¤·¤Æ¡¢¥¡¼
+ ¤¬ $KEY ¤Ç¤¢¤ë¥×¥í¥Ñ¥Æ¥£¤ò¸«¤Ä¤±¤ë¡£¸«¤Ä¤«¤ì¤Ð¡¢¤½¤ÎÃͤò
<tt>(void *)</tt> ·¿¤ÇÊÖ¤¹¡£¸«¤Ä¤«¤é¤Ê¤±¤ì¤Ð @c NULL ¤òÊÖ¤¹¡£
@c NULL ¤¬Ê֤俺ݤˤÏÆó¤Ä¤Î²ÄǽÀ¤¬¤¢¤ë:
/*=*/
/***en
+ @brief Set the value (function pointer) of a property in a property list.
+
+ The mplist_put_func () function is like mplist_put () but for
+ settting function pointer $FUNC in property list $PLIST for key
+ $KEY. */
+
+/***
+ @seealso
+ mplist_put (), M17N_FUNC () */
+
+MPlist *
+mplist_put_func (MPlist *plist, MSymbol key, M17NFunc func)
+{
+ if (key == Mnil)
+ MERROR (MERROR_PLIST, NULL);
+ do {
+ MPLIST_FIND (plist, key);
+ } while (! MPLIST_TAIL_P (plist) && ! MPLIST_VAL_FUNC_P (plist));
+
+ MPLIST_KEY (plist) = (key);
+ MPLIST_FUNC (plist) = func;
+ if (! plist->next)
+ MPLIST_NEW ((plist)->next);
+ return plist;
+}
+
+/*=*/
+
+/***en
+ @brief Get the value (function pointer) of a property in a property list.
+
+ The mplist_get_func () funciont is like mplist_get () but for
+ getting a function pointer from property list $PLIST by key $KEY. */
+
+/***
+ @seealso
+ mplist_get () */
+M17NFunc
+mplist_get_func (MPlist *plist, MSymbol key)
+{
+ do {
+ MPLIST_FIND (plist, key);
+ } while (! MPLIST_TAIL_P (plist) && ! MPLIST_VAL_FUNC_P (plist));
+ return (MPLIST_TAIL_P (plist) ? NULL : MPLIST_FUNC (plist));
+}
+
+/*=*/
+
+/***en
@brief Add a property at the end of a property list.
The mplist_add () function appends at the end of property list