106typedef struct closure_ref {
124_Ret_valid_ closure _closureCreate(_In_
closureFunc func,
int n,
stvar cvars[]);
135#define closureCreate(func, ...) \
136 _closureCreate(func, count_macro_args(__VA_ARGS__), (stvar[]) { __VA_ARGS__ })
138bool _closureCall(_In_ closure cls,
int n,
stvar args[]);
147#define closureCall(cls, ...) \
148 _closureCall(cls, count_macro_args(__VA_ARGS__), (stvar[]) { __VA_ARGS__ })
150_Ret_valid_ closure _closureCreateAs(_In_
void (*func)(
void), _In_z_
const char* sig,
int n,
168#define closureCreateAs(sigtype, func, ...) \
169 _closureCreateAs((void (*)(void))(1 ? (func) : (sigtype)0), \
171 count_macro_args(__VA_ARGS__), \
172 (stvar[]) { __VA_ARGS__ })
176void (*_closureFuncAs(_In_ closure cls, _In_z_
const char* sig))(void);
177_Ret_valid_
stvlist* _closureCvars(_In_ closure cls, _Out_
stvlist* storage);
195#define closureCallAs(sigtype, cls, ...) \
196 ((sigtype)_closureFuncAs((cls), #sigtype))(_closureCvars((cls), &(stvlist) { 0 }), __VA_ARGS__)
Macro argument counting utilities.
void closureSetDestroy(closure cls, closureDestroyFunc destroy)
void(* closureDestroyFunc)(stvlist *cvars)
void closureDestroy(closure *cls)
struct closure_ref * closure
Opaque handle to a closure.
bool(* closureFunc)(stvlist *cvars, stvlist *args)
closure closureClone(closure cls)
#define stvar(typen, val)
Variant type containers and type-safe variadic argument support.