2
3
4
5
6
7
8
9
10
11
12
13
14#ifndef GIMBAL_CLOSURE_H
15#define GIMBAL_CLOSURE_H
17#include "../instances/gimbal_box.h"
21
22
23
25#define GBL_CLOSURE(self) (GBL_CAST(GblClosure, self))
27#define GBL_CLOSURE_GET_CLASS(self) (GBL_CLASSOF(GblClosure, self))
32# define GBL_CALLBACK(fn) ((GblFnPtr)fn)
34# define GBL_CALLBACK(fn) ((GblFnPtr)+fn)
37#define GBL_SELF_TYPE GblClosure
42
43
44
45
46
47
48
49
50
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
98
99
100
118
119
120
121
135
136
137
140 GblVariant* pRetValue,
147#define GblClosure_create(...)
149#define GblClosure_createDefault_(...)
151#define GblClosure_createDefault__(type, size, ud, dtor, ...)
#define GBL_CLASS_CAST(cType, klass)
#define GblClosure_create(...)
#define GblClosure_createDefault__(type, size, ud, dtor,...)
GblType GblClosure_type(void)
Returns the GblType UUID for GblClosure.
GblClosure * GblClosure_current(void)
Returns a pointer to the inner-most currently executing GblClosure instance.
#define GblClosure_createDefault_(...)
void * GblClosure_currentUserdata(void)
Returns a pointer to the userdatea of the inner-most currently executing GblClosure instance.
GblClosure * GblClosure_ref(GblClosure *pSelf)
Returns a new reference to the given GblClosure instance, increasing its reference count.
GblClosure * GblClosure_create(GblType derivedType, size_t size, void *pUserdata, GblArrayMapDtorFn pFnDtor)
Creates a GblClosure-derived instance with the given attributes, returning a pointer to it.
GblRefCount GblClosure_unref(GblClosure *pSelf)
Removes a reference to the given GblClosure, destroying it upon reaching zero.
#define GBL_TYPEID(instanceStruct)
#define GBL_INSTANCE_DERIVE(derivedInstance, baseInstance)
#define GBL_PRIVATE_BEGIN
#define GBL_CLASS_DERIVE(...)
#define GBL_PRIVATE_END
Private data structure.
#define GBL_CLASSOF(cType, self)
#define GBL_CAST(cType, self)
uint8_t GblBool
Basic boolean type, standardized to sizeof(char)
uint16_t GblRefCount
Type able to hold a reference counter across the codebase.
GblMarshalFn pFnMetaMarshal
Primary entry point when invoking a closure.
Base instance for all closure types.
GBL_RESULT GblClosure_setMetaMarshal(GblClosure *pSelf, GblMarshalFn pFnMeta)
Sets the closure's class's meta marshal to the function pointed to by pFnMeta, swizzling its class.
void GblClosure_setMarshal(GblClosure *pSelf, GblMarshalFn pFnMarshal)
Sets the closure's marshal to the function pointed to by pFnMarshal.
GblMarshalFn pFnMarshal
Per-instance marshal function, private.
GblBool GblClosure_hasMarshal(const GblClosure *pSelf)
Returns whether the GblClosure has an instance marshal or not.
GblBool GblClosure_hasMetaMarshal(const GblClosure *pSelf)
Returns whether the GblClosure's class has a meta marshal or not.
GBL_RESULT GblClosure_invoke(GblClosure *pSelf, GblVariant *pRetValue, size_t argCount, GblVariant *pArgValues)
Invokes the given GblClosure, marshalling args in and a value out as variants.