1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-25 09:47:17 +00:00

Fix wrap functions.

This commit is contained in:
Calvin Rose 2019-04-27 19:47:32 -04:00
parent 5b36199aea
commit 0bad523913

View File

@ -49,26 +49,26 @@ int (janet_unwrap_boolean)(Janet x) { return janet_unwrap_boolean(x); }
double (janet_unwrap_number)(Janet x) { return janet_unwrap_number(x); } double (janet_unwrap_number)(Janet x) { return janet_unwrap_number(x); }
int32_t (janet_unwrap_integer)(Janet x) { return janet_unwrap_integer(x); } int32_t (janet_unwrap_integer)(Janet x) { return janet_unwrap_integer(x); }
#ifdef JANET_NANBOX #if defined(JANET_NANBOX_32) || defined(JANET_NANBOX_64)
Janet (janet_wrap_nil)(void) { return janet_wrap_nil(); } Janet (janet_wrap_nil)(void) { return janet_wrap_nil(); }
Janet (janet_wrap_number)(double x) { return janet_wrap_number(); } Janet (janet_wrap_number)(double x) { return janet_wrap_number(x); }
Janet (janet_wrap_true)(void) { return janet_wrap_true(); } Janet (janet_wrap_true)(void) { return janet_wrap_true(); }
Janet (janet_wrap_false)(void) { return janet_wrap_false(); } Janet (janet_wrap_false)(void) { return janet_wrap_false(); }
Janet (janet_wrap_boolean)(int x) { return janet_wrap_boolean(); } Janet (janet_wrap_boolean)(int x) { return janet_wrap_boolean(x); }
Janet (janet_wrap_string)(const uint8_t *x) { return janet_wrap_string(); } Janet (janet_wrap_string)(const uint8_t *x) { return janet_wrap_string(x); }
Janet (janet_wrap_symbol)(const uint8_t *x) { return janet_wrap_symbol(); } Janet (janet_wrap_symbol)(const uint8_t *x) { return janet_wrap_symbol(x); }
Janet (janet_wrap_keyword)(const uint8_t *x) { return janet_wrap_keyword(); } Janet (janet_wrap_keyword)(const uint8_t *x) { return janet_wrap_keyword(x); }
Janet (janet_wrap_array)(JanetArray *x) { return janet_wrap_array(); } Janet (janet_wrap_array)(JanetArray *x) { return janet_wrap_array(x); }
Janet (janet_wrap_tuple)(const Janet *x) { return janet_wrap_tuple(); } Janet (janet_wrap_tuple)(const Janet *x) { return janet_wrap_tuple(x); }
Janet (janet_wrap_struct)(const JanetKV *x) { return janet_wrap_struct(); } Janet (janet_wrap_struct)(const JanetKV *x) { return janet_wrap_struct(x); }
Janet (janet_wrap_fiber)(JanetFiber *x) { return janet_wrap_fiber(); } Janet (janet_wrap_fiber)(JanetFiber *x) { return janet_wrap_fiber(x); }
Janet (janet_wrap_buffer)(JanetBuffer *x) { return janet_wrap_buffer(); } Janet (janet_wrap_buffer)(JanetBuffer *x) { return janet_wrap_buffer(x); }
Janet (janet_wrap_function)(JanetFunction *x) { return janet_wrap_function(); } Janet (janet_wrap_function)(JanetFunction *x) { return janet_wrap_function(x); }
Janet (janet_wrap_cfunction)(JanetCFunction x) { return janet_wrap_cfunction(); } Janet (janet_wrap_cfunction)(JanetCFunction x) { return janet_wrap_cfunction(x); }
Janet (janet_wrap_table)(JanetTable *x) { return janet_wrap_table(); } Janet (janet_wrap_table)(JanetTable *x) { return janet_wrap_table(x); }
Janet (janet_wrap_abstract)(void *x) { return janet_wrap_abstract(); } Janet (janet_wrap_abstract)(void *x) { return janet_wrap_abstract(x); }
Janet (janet_wrap_pointer)(void *x) { return janet_wrap_pointer(); } Janet (janet_wrap_pointer)(void *x) { return janet_wrap_pointer(x); }
Janet (janet_wrap_integer)(int32_t x) { return janet_wrap_integer(); } Janet (janet_wrap_integer)(int32_t x) { return janet_wrap_integer(x); }
#endif #endif
/*****/ /*****/
@ -159,13 +159,7 @@ double janet_unwrap_number(Janet x) {
#else #else
/* Wrapper functions wrap a data type that is used from C into a Janet janet_wrap_nil(void) {
* janet value, which can then be used in janet internal functions. Use
* these functions sparingly, as these function will let the programmer
* leak memory, where as the stack based API ensures that all values can
* be collected by the garbage collector. */
Janet janet_wrap_nil() {
Janet y; Janet y;
y.type = JANET_NIL; y.type = JANET_NIL;
y.as.u64 = 0; y.as.u64 = 0;