From: handa Date: Fri, 14 Oct 2005 02:26:38 +0000 (+0000) Subject: (MPLIST_VAL_MANAGED_P): Delete this macro. X-Git-Tag: REL-1-3-0~130 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bfa1cb88f0190dbb4bedd98509eb3593863ffc59;p=m17n%2Fm17n-lib.git (MPLIST_VAL_MANAGED_P): Delete this macro. (MPLIST_NESTED_P, MPLIST_SET_NESTED_P): New macros. (MPLIST_ADD_PLIST, MPLIST_PUSH_PLIST, MPLIST_PUT_PLIST): New macros. --- diff --git a/src/plist.h b/src/plist.h index 37fbfa8..a0ce3dd 100644 --- a/src/plist.h +++ b/src/plist.h @@ -45,7 +45,6 @@ struct MPlist #define MPLIST_KEY(plist) ((plist)->key) #define MPLIST_VAL(plist) ((plist)->val) -#define MPLIST_VAL_MANAGED_P(plist) ((plist)->control.flag) #define MPLIST_NEXT(plist) ((plist)->next) #define MPLIST_TAIL_P(plist) ((plist)->key == Mnil) @@ -55,6 +54,11 @@ struct MPlist #define MPLIST_INTEGER_P(plist) (MPLIST_KEY (plist) == Minteger) #define MPLIST_PLIST_P(plist) (MPLIST_KEY (plist) == Mplist) +#define MPLIST_NESTED_P(plist) \ + (MPLIST_PLIST_P (plist) || (plist)->control.flag & 1) +#define MPLIST_SET_NESTED_P(plist) \ + ((plist)->control.flag |= 1) + #define MPLIST_SYMBOL(plist) ((MSymbol) MPLIST_VAL (plist)) #define MPLIST_STRING(plist) ((char *) MPLIST_VAL (plist)) #define MPLIST_MTEXT(plist) ((MText *) MPLIST_VAL (plist)) @@ -77,6 +81,13 @@ struct MPlist : MPLIST_TAIL_P ((plist)->next->next) ? 2 \ : mplist_length (plist)) +#define MPLIST_ADD_PLIST(PLIST, KEY, VAL) \ + MPLIST_SET_NESTED_P (mplist_add ((PLIST), (KEY), (VAL))) +#define MPLIST_PUSH_PLIST(PLIST, KEY, VAL) \ + MPLIST_SET_NESTED_P (mplist_push ((PLIST), (KEY), (VAL))) +#define MPLIST_PUT_PLIST(PLIST, KEY, VAL) \ + MPLIST_SET_NESTED_P (mplist_put ((PLIST), (KEY), (VAL))) + extern unsigned char hex_mnemonic[256]; extern unsigned char escape_mnemonic[256];