From: handa Date: Thu, 29 Mar 2007 11:25:32 +0000 (+0000) Subject: (struct MPlist): Make the member val a union. X-Git-Tag: FLT-base~107 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=37033eec4345f2c3d60f939d5b273b4572f8e054;p=m17n%2Fm17n-lib.git (struct MPlist): Make the member val a union. (MPLIST_VAL): Adjusted for the above change. (MPLIST_FUNC): New macro. (MPLIST_VAL_FUNC_P, MPLIST_SET_VAL_FUNC_P): New macros. --- diff --git a/src/plist.h b/src/plist.h index 1d89c16..931762f 100644 --- a/src/plist.h +++ b/src/plist.h @@ -35,7 +35,10 @@ struct MPlist MSymbol key; /**en Value of the first element of the plist. */ - void *val; + union { + void *pointer; + M17NFunc func; + } val; /**en Plist for the next element. */ MPlist *next; @@ -44,7 +47,8 @@ struct MPlist /** Macros to access each member of PLIST. */ #define MPLIST_KEY(plist) ((plist)->key) -#define MPLIST_VAL(plist) ((plist)->val) +#define MPLIST_VAL(plist) ((plist)->val.pointer) +#define MPLIST_FUNC(plist) ((plist)->val.func) #define MPLIST_NEXT(plist) ((plist)->next) #define MPLIST_TAIL_P(plist) ((plist)->key == Mnil) @@ -59,6 +63,11 @@ struct MPlist #define MPLIST_SET_NESTED_P(plist) \ ((plist)->control.flag |= 1) +#define MPLIST_VAL_FUNC_P(plist) \ + ((plist)->control.flag & 2) +#define MPLIST_SET_VAL_FUNC_P(plist) \ + ((plist)->control.flag |= 2) + #define MPLIST_SYMBOL(plist) ((MSymbol) MPLIST_VAL (plist)) #define MPLIST_STRING(plist) ((char *) MPLIST_VAL (plist)) #define MPLIST_MTEXT(plist) ((MText *) MPLIST_VAL (plist))