2024-01-26 21:58:02 +00:00
|
|
|
#ifndef CUTES_TYPECLASS_HELPERS_H
|
|
|
|
#define CUTES_TYPECLASS_HELPERS_H
|
2024-01-25 13:08:23 +00:00
|
|
|
|
|
|
|
#define TC_FN_TYPECHECK(__Return, __Name, ...)\
|
|
|
|
__Return (*const __Name##_)(__VA_ARGS__) = __Name; (void)__Name##_
|
|
|
|
|
|
|
|
#define decl_typeclass_impl(__Typeclass, __Type)\
|
|
|
|
extern __Typeclass __Type##_as_##__Typeclass(__Type*);
|
|
|
|
|
2024-09-12 12:02:18 +00:00
|
|
|
#define new(T) (malloc(sizeof(T)))
|
|
|
|
#define new_as(T, TC) (T##_as_##TC(new(T)))
|
|
|
|
#define tc_is_null(SELF) (SELF.data == NULL && SELF.tc == NULL)
|
2024-09-12 19:32:14 +00:00
|
|
|
#define tc_null(TC) ((TC){.data=NULL, .tc=NULL})
|
2024-09-10 07:47:14 +00:00
|
|
|
|
2024-01-26 21:58:02 +00:00
|
|
|
#endif // !CUTES_TYPECLASS_HELPERS_H
|