|
@@ -648,6 +648,21 @@ HL_API void *hl_dyn_call_obj( vdynamic *obj, hl_type *ft, int hfield, void **arg
|
|
|
HL_API vdynamic *hl_dyn_call( vclosure *c, vdynamic **args, int nargs );
|
|
|
HL_API vdynamic *hl_dyn_call_safe( vclosure *c, vdynamic **args, int nargs, bool *isException );
|
|
|
|
|
|
+/*
|
|
|
+ These macros should be only used when the closure `cl` has been type checked beforehand
|
|
|
+ so you are sure it's of the used typed. Otherwise use hl_dyn_call
|
|
|
+*/
|
|
|
+#define hl_call0(ret,cl) \
|
|
|
+ (cl->hasValue ? ((ret(*)(vdynamic*))cl->fun)(cl->value) : ((ret(*)())cl->fun)())
|
|
|
+#define hl_call1(ret,cl,t,v) \
|
|
|
+ (cl->hasValue ? ((ret(*)(vdynamic*,t))cl->fun)(cl->value,v) : ((ret(*)(t))cl->fun)(v))
|
|
|
+#define hl_call2(ret,cl,t1,v1,t2,v2) \
|
|
|
+ (cl->hasValue ? ((ret(*)(vdynamic*,t1,t2))cl->fun)(cl->value,v1,v2) : ((ret(*)(t1,t2))cl->fun)(v1,v2))
|
|
|
+#define hl_call3(ret,cl,t1,v1,t2,v2,t3,v3) \
|
|
|
+ (cl->hasValue ? ((ret(*)(vdynamic*,t1,t2,t3))cl->fun)(cl->value,v1,v2,v3) : ((ret(*)(t1,t2,t3))cl->fun)(v1,v2,v3))
|
|
|
+#define hl_call4(ret,cl,t1,v1,t2,v2,t3,v3,t4,v4) \
|
|
|
+ (cl->hasValue ? ((ret(*)(vdynamic*,t1,t2,t3,t4))cl->fun)(cl->value,v1,v2,v3,v4) : ((ret(*)(t1,t2,t3,t4))cl->fun)(v1,v2,v3,v4))
|
|
|
+
|
|
|
// ----------------------- THREADS --------------------------------------------------
|
|
|
|
|
|
struct _hl_thread;
|