From 724ee38197015387ec9e44e82bb3743b703e173b Mon Sep 17 00:00:00 2001 From: handa Date: Thu, 29 Mar 2007 11:27:41 +0000 Subject: [PATCH] (M17NFunc): New function type. (M17N_FUNC): New macro. (msymbol_put_func, msymbol_get_func): Extern them. (mplist_put_func, mplist_get_func): Extern them. --- src/m17n-core.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/m17n-core.h b/src/m17n-core.h index 157a341..fdd465a 100644 --- a/src/m17n-core.h +++ b/src/m17n-core.h @@ -122,6 +122,30 @@ extern int m17n_object_ref (void *object); /* Decrement the reference count of managed object OBJECT. */ extern int m17n_object_unref (void *object); +/*** @ingroup m17nCore */ +/***en + @brief Generic function type. + + #M17NFunc is a generic function type for setting a function + pointer as a value of #MSymbol property or #MPlist. */ + +/*** + @seealso + msymbol_put_func (), msymbol_get_func (), + mplist_put_func (), mplist_get_func (). */ + +typedef void (*M17NFunc) (void); + +/*=*/ + +/*** @ingroup m17nCore */ +/***en + @brief Wrapper for a generic function type. + + The macro M17N_FUNC () is to cast a function to type #M17NFunc. */ + +#define M17N_FUNC(func) ((M17NFunc) (func)) + /*=*/ /* (C2) Symbol handling */ @@ -177,6 +201,10 @@ extern int msymbol_put (MSymbol symbol, MSymbol key, void *val); /*** Return KEY property value of SYMBOL. */ extern void *msymbol_get (MSymbol symbol, MSymbol key); +extern int msymbol_put_func (MSymbol symbol, MSymbol key, M17NFunc func); + +extern M17NFunc msymbol_get_func (MSymbol symbol, MSymbol key); + /* * (2-1) Property List */ @@ -220,6 +248,10 @@ extern MPlist *mplist_put (MPlist *plist, MSymbol key, void *val); extern void *mplist_get (MPlist *plist, MSymbol key); +extern MPlist *mplist_put_func (MPlist *plist, MSymbol key, M17NFunc func); + +extern M17NFunc mplist_get_func (MPlist *plist, MSymbol key); + extern MPlist *mplist_find_by_key (MPlist *plist, MSymbol key); extern MPlist *mplist_find_by_value (MPlist *plist, void *val); -- 1.7.10.4