fix: Mirror now supports TC_CAST
i hate this
This commit is contained in:
parent
8c5aa78195
commit
368332b2b3
|
@ -5,7 +5,7 @@
|
||||||
#include "stdint.h"
|
#include "stdint.h"
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
#include "strutil.h"
|
#include "strutil.h" // included because the impl macros require strhash
|
||||||
|
|
||||||
typedef uintptr_t typeid;
|
typedef uintptr_t typeid;
|
||||||
|
|
||||||
|
@ -17,7 +17,11 @@ typedef struct {
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
void* data;
|
void* data;
|
||||||
IMirror const* tc;
|
union {
|
||||||
|
IMirror const* tc;
|
||||||
|
// this is cursed, but it allows the TC_CAST macro to work
|
||||||
|
IMirror const* mirror;
|
||||||
|
};
|
||||||
} Mirror;
|
} Mirror;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -40,7 +44,7 @@ static inline int mirror_eq(const Mirror* lhs, const Mirror* rhs) {
|
||||||
extern const void* mirror_get_typeclass(void* data, IMirror const* tc, const char* typeclass);
|
extern const void* mirror_get_typeclass(void* data, IMirror const* tc, const char* typeclass);
|
||||||
// get the wrapper function for a given typeclass name
|
// get the wrapper function for a given typeclass name
|
||||||
// example:
|
// example:
|
||||||
//
|
// mirror_get_function(physics_entity.data, physics_entity.mirror, "BehaviourEntity")
|
||||||
extern void* mirror_get_function(void* data, IMirror const* tc, const char* typeclass_name);
|
extern void* mirror_get_function(void* data, IMirror const* tc, const char* typeclass_name);
|
||||||
|
|
||||||
// macro reexport of mirror_get_function which will cast the function so it can be called immediately
|
// macro reexport of mirror_get_function which will cast the function so it can be called immediately
|
||||||
|
|
Loading…
Reference in a new issue