aboutsummaryrefslogtreecommitdiff
path: root/api/ref.c
diff options
context:
space:
mode:
authorElias Fleckenstein <eliasfleckenstein@web.de>2021-12-30 16:02:10 +0100
committerElias Fleckenstein <eliasfleckenstein@web.de>2021-12-30 16:02:10 +0100
commit058d954e80f83c26deb209008f11d87a5b59418e (patch)
treeef7b5a95cfd1dbdba71041e1f0608d551adfa360 /api/ref.c
parent3ba311b0afdf9cc62d630687d171bee0b6435e4a (diff)
downloaduwu-lang-058d954e80f83c26deb209008f11d87a5b59418e.tar.xz
Unify value types
Diffstat (limited to 'api/ref.c')
-rw-r--r--api/ref.c31
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,
+};