summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuo Jinghua <sunmoon1997@gmail.com>2009-10-31 13:37:45 +0800
committerLuo Jinghua <sunmoon1997@gmail.com>2009-10-31 13:37:45 +0800
commit8378dfcba3a31527838cff712ad4d1ace0cef525 (patch)
tree097ea12c0fd61104185845b6f20ca056c063ac82
parentb5ed56af6ed484b338376a67e2bef17e1893a853 (diff)
milkway: add a macro for invoking super finalizer
-rw-r--r--milkway/mw-object.h13
1 files changed, 8 insertions, 5 deletions
diff --git a/milkway/mw-object.h b/milkway/mw-object.h
index f453398..22bef62 100644
--- a/milkway/mw-object.h
+++ b/milkway/mw-object.h
@@ -48,11 +48,14 @@ struct mw_object {
mw_object_type_t *type;
};
-#define MW_OBJECT_TYPE (mw_object_get_type())
-#define MW_TYPE(self) (((mw_object_t*)(self))->type)
-#define MW_SUPER_TYPE(self) (((mw_object_t*)(self))->type->parent)
-#define MW_SUPER_TYPE_CAST(self, type) ((type*)MW_SUPER_TYPE(self))
-#define MW_SUPER_TYPE_BASE(self, base) ((mw_object_type_t*)mw_object_get_super_type(self, base))
+#define MW_OBJECT_TYPE (mw_object_get_type())
+#define MW_TYPE(self) (((mw_object_t*)(self))->type)
+#define MW_SUPER_TYPE(self) (((mw_object_t*)(self))->type->parent)
+#define MW_SUPER_TYPE_CAST(self, type) ((type*)MW_SUPER_TYPE(self))
+#define MW_SUPER_TYPE_BASE(self, base) ((mw_object_type_t*)mw_object_get_super_type(self, base))
+#define MW_SUPER_TYPE_MTH(self, base, type, mth) ((type*)MW_SUPER_TYPE_BASE(self, base))->mth
+#define MW_SUPER_FINALIZE(self, base) MW_SUPER_TYPE_MTH(self, base, mw_object_type_t, finalize)
+
#define MW_TYPE_SUPER(type) ((mw_object_type_t*)(((mw_object_type_t*)(type))->parent))
#define MW_PRIV_ALIGN(size) ((size + 15) & ~15)
#define MW_GET_PRIV(self, type) ((char*)self + NW_TYPE(self)->size + \