Update HL headers for 1.10 (resolve #1339)

This commit is contained in:
Joshua Granick
2019-08-20 08:06:58 -07:00
parent d215e9c344
commit b30f4bf39c
2 changed files with 60 additions and 8 deletions

View File

@@ -27,7 +27,7 @@
https://github.com/HaxeFoundation/hashlink/wiki/
**/
#define HL_VERSION 0x190
#define HL_VERSION 0x010A00
#if defined(_WIN32)
# define HL_WIN
@@ -129,6 +129,10 @@
# define HL_DEBUG
#endif
#ifndef HL_CONSOLE
# define HL_TRACK_ENABLE
#endif
#ifndef HL_NO_THREADS
# define HL_THREADS
# ifdef HL_VCC
@@ -329,8 +333,9 @@ typedef enum {
HENUM = 18,
HNULL = 19,
HMETHOD = 20,
HSTRUCT = 21,
// ---------
HLAST = 21,
HLAST = 22,
_H_FORCE_INT = 0x7FFFFFFF
} hl_type_kind;
@@ -438,6 +443,7 @@ HL_API int hl_pad_struct( int size, hl_type *t );
HL_API hl_runtime_obj *hl_get_obj_rt( hl_type *ot );
HL_API hl_runtime_obj *hl_get_obj_proto( hl_type *ot );
HL_API void hl_flush_proto( hl_type *ot );
HL_API void hl_init_enum( hl_type *et, hl_module_context *m );
/* -------------------- VALUES ------------------------------ */
@@ -587,7 +593,7 @@ HL_API hl_obj_field *hl_obj_field_fetch( hl_type *t, int fid );
HL_API int hl_hash( vbyte *name );
HL_API int hl_hash_utf8( const char *str ); // no cache
HL_API int hl_hash_gen( const uchar *name, bool cache_name );
HL_API const uchar *hl_field_name( int hash );
HL_API vbyte *hl_field_name( int hash );
#define hl_error(msg, ...) hl_throw(hl_alloc_strbytes(USTR(msg), ## __VA_ARGS__))
@@ -619,7 +625,7 @@ HL_API double hl_dyn_castd( void *data, hl_type *t );
#define hl_invalid_comparison 0xAABBCCDD
HL_API int hl_dyn_compare( vdynamic *a, vdynamic *b );
HL_API vdynamic *hl_make_dyn( void *data, hl_type *t );
HL_API void hl_write_dyn( void *data, hl_type *t, vdynamic *v );
HL_API void hl_write_dyn( void *data, hl_type *t, vdynamic *v, bool is_tmp );
HL_API void hl_dyn_seti( vdynamic *d, int hfield, hl_type *t, int value );
HL_API void hl_dyn_setp( vdynamic *d, int hfield, hl_type *t, void *ptr );
@@ -650,6 +656,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;
@@ -817,6 +838,7 @@ HL_API void *hl_fatal_error( const char *msg, const char *file, int line );
HL_API void hl_fatal_fmt( const char *file, int line, const char *fmt, ...);
HL_API void hl_sys_init(void **args, int nargs, void *hlfile);
HL_API void hl_setup_callbacks(void *sc, void *gw);
HL_API void hl_setup_reload_check( void *freload, void *param );
#include <setjmp.h>
typedef struct _hl_trap_ctx hl_trap_ctx;
@@ -832,8 +854,14 @@ struct _hl_trap_ctx {
#define HL_EXC_RETHROW 1
#define HL_EXC_CATCH_ALL 2
#define HL_EXC_IS_THROW 4
#define HL_TRACK_DISABLE 8
#define HL_THREAD_INVISIBLE 16
#define HL_TREAD_TRACK_SHIFT 5
#define HL_TRACK_ALLOC 1
#define HL_TRACK_CAST 2
#define HL_TRACK_DYNFIELD 4
#define HL_TRACK_DYNCALL 8
#define HL_TRACK_MASK (HL_TRACK_ALLOC | HL_TRACK_CAST | HL_TRACK_DYNFIELD | HL_TRACK_DYNCALL)
typedef struct {
int thread_id;
@@ -846,7 +874,7 @@ typedef struct {
hl_trap_ctx *trap_uncaught;
vclosure *exc_handler;
vdynamic *exc_value;
int exc_flags;
int flags;
int exc_stack_count;
// extra
jmp_buf gc_regs;
@@ -855,6 +883,28 @@ typedef struct {
HL_API hl_thread_info *hl_get_thread();
#ifdef HL_TRACK_ENABLE
typedef struct {
int flags;
void (*on_alloc)(hl_type *,int,int,void*);
void (*on_cast)(hl_type *, hl_type*);
void (*on_dynfield)( vdynamic *, int );
void (*on_dyncall)( vdynamic *, int );
} hl_track_info;
#define hl_is_tracking(flag) ((hl_track.flags&(flag)) && (hl_get_thread()->flags & (flag<<HL_TREAD_TRACK_SHIFT)))
#define hl_track_call(flag,call) if( hl_is_tracking(flag) ) hl_track.call
HL_API hl_track_info hl_track;
#else
#define hl_is_tracking(_) false
#define hl_track_call(a,b)
#endif
C_FUNCTION_END
#endif