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))
26#define GBL_CLOSURE_CLASS(klass) (GBL_CLASS_CAST
(GblClosure, klass))
27#define GBL_CLOSURE_GET_CLASS(self) (GBL_CLASSOF
(GblClosure, self))
30#define GBL_SELF_TYPE GblClosure
35
36
37
38
39
40
41
42
43
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
91
92
93
111
112
113
114
128
129
130
133 GblVariant* pRetValue,
140#define GblClosure_create(...)
142#define GblClosure_createDefault_(...)
144#define GblClosure_createDefault__(type, size, ud, dtor, ...)
#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.
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.