From 058d954e80f83c26deb209008f11d87a5b59418e Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Thu, 30 Dec 2021 16:02:10 +0100 Subject: Unify value types --- api/ref.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 api/ref.c (limited to 'api/ref.c') 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, +}; -- cgit v1.2.3