Move exception encoding helpers from caml/callback.h to caml/mlvalues.h

master
Guillaume Munch-Maccagnoni 2019-10-15 00:33:09 +02:00
parent d0f70f757a
commit 7e8cf6e052
2 changed files with 7 additions and 4 deletions

View File

@ -39,10 +39,6 @@ CAMLextern value caml_callback3_exn (value closure,
value arg1, value arg2, value arg3);
CAMLextern value caml_callbackN_exn (value closure, int narg, value args[]);
#define Make_exception_result(v) ((v) | 2)
#define Is_exception_result(v) (((v) & 3) == 2)
#define Extract_exception(v) ((v) & ~3)
CAMLextern const value * caml_named_value (char const * name);
typedef void (*caml_named_action) (const value*, char *);
CAMLextern void caml_iterate_named_values(caml_named_action f);

View File

@ -81,6 +81,13 @@ typedef uintnat mark_t;
#define Unsigned_long_val(x) ((uintnat)(x) >> 1)
#define Unsigned_int_val(x) ((int) Unsigned_long_val(x))
/* Encoded exceptional return values, when functions are suffixed with
_exn. Encoded exceptions are invalid values and must not be seen
by the garbage collector. */
#define Make_exception_result(v) ((v) | 2)
#define Is_exception_result(v) (((v) & 3) == 2)
#define Extract_exception(v) ((v) & ~3)
/* Structure of the header:
For 16-bit and 32-bit architectures: