From 92ccc5626ddb7d6b374262ffcbfef9a772e1be9e Mon Sep 17 00:00:00 2001 From: Max Wash Date: Thu, 17 Jul 2025 17:55:34 +0100 Subject: [PATCH] object: add macro to test object type --- object/include/blue/object/object.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/object/include/blue/object/object.h b/object/include/blue/object/object.h index 5632be9..185d6ff 100644 --- a/object/include/blue/object/object.h +++ b/object/include/blue/object/object.h @@ -3,13 +3,15 @@ #include -#define B_OBJECT(p) ((b_object *)(p)) +#define B_OBJECT(p) ((b_object *)(p)) -#define B_TYPEOF(object) ((struct b_object *)(object)->ob_type) -#define B_TYPEID(object) (b_typeid(B_OBJECT(object))) +#define B_TYPEOF(object) ((struct b_object *)(object)->ob_type) +#define B_TYPEID(object) (b_typeid(B_OBJECT(object))) -#define B_RV(p) (b_make_rvalue(B_OBJECT(p))) -#define B_RVT(t, p) ((t *)(b_make_rvalue(B_OBJECT(p)))) +#define B_RV(p) (b_make_rvalue(B_OBJECT(p))) +#define B_RVT(t, p) ((t *)(b_make_rvalue(B_OBJECT(p)))) + +#define B_OBJECT_IS(object, type) (B_TYPEID(object) == B_OBJECT_TYPE_##type) struct b_string; struct b_stream;