diff options
Diffstat (limited to 'api/ref.c')
-rw-r--r-- | api/ref.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/api/ref.c b/api/ref.c new file mode 100644 index 0000000..f66ae19 --- /dev/null +++ b/api/ref.c @@ -0,0 +1,31 @@ +#include "../src/util.h" +#include "ref.h" + +UwUVMValue uwuref_create(UwUVMFunction *function) +{ + return (UwUVMValue) { + .type = &uwuref_type, + .data = function, + }; +} + +static void *uwuref_copy(void *data) +{ + return data; +} + +static void uwuref_delete(void *data) +{ + (void) data; +} + +static char *uwuref_print(void *data) +{ + return asprintf_wrapper("[Function reference: %p]", data); +} + +UwUVMType uwuref_type = { + .copy = &uwuref_copy, + .delete = &uwuref_delete, + .print = &uwuref_print, +}; |