CX Framework
Cross-platform C utility framework
Loading...
Searching...
No Matches
closure.h
Go to the documentation of this file.
1
31
32#pragma once
33
34#include <cx/cx.h>
35#include <cx/stype/stvar.h>
37
38// Opaque closure reference type (internal)
39typedef struct closure_ref
40{
41 void* _is_closure;
42} closure_ref;
43
45typedef struct closure_ref *closure;
46
58typedef bool (*closureFunc)(stvlist *cvars, stvlist *args);
59
60_Ret_valid_ closure _closureCreate(_In_ closureFunc func, int n, stvar cvars[]);
61
72#define closureCreate(func, ...) _closureCreate(func, count_macro_args(__VA_ARGS__), (stvar[]) { __VA_ARGS__ })
73
74bool _closureCall(_In_ closure cls, int n, stvar args[]);
75
86#define closureCall(cls, ...) _closureCall(cls, count_macro_args(__VA_ARGS__), (stvar[]) { __VA_ARGS__ })
87
95_Ret_valid_ closure closureClone(_In_ closure cls);
96
102void closureDestroy(_Inout_ptr_uninit_ closure *cls);
103
105// end of closure_basic group
Macro argument counting utilities.
void closureDestroy(closure *cls)
struct closure_ref * closure
Opaque handle to a closure.
Definition closure.h:45
bool(* closureFunc)(stvlist *cvars, stvlist *args)
Definition closure.h:58
closure closureClone(closure cls)
#define stvar(typen, val)
Definition stvar.h:153
Variant type containers and type-safe variadic argument support.