aboutsummaryrefslogtreecommitdiff
path: root/api/ref.c
diff options
context:
space:
mode:
authorElias Fleckenstein <eliasfleckenstein@web.de>2021-12-30 16:53:37 +0100
committerElias Fleckenstein <eliasfleckenstein@web.de>2021-12-30 16:53:37 +0100
commit4c52777ca9e52edd0bff76168d886de9757ea457 (patch)
tree385c548fbae43f4b4764a1c32d5babe60c84aa4d /api/ref.c
parent058d954e80f83c26deb209008f11d87a5b59418e (diff)
downloaduwu-lang-4c52777ca9e52edd0bff76168d886de9757ea457.tar.xz
Add :ref module and refactor type handling
Diffstat (limited to 'api/ref.c')
-rw-r--r--api/ref.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/api/ref.c b/api/ref.c
index f66ae19..43eb68e 100644
--- a/api/ref.c
+++ b/api/ref.c
@@ -1,20 +1,25 @@
#include "../src/util.h"
#include "ref.h"
-UwUVMValue uwuref_create(UwUVMFunction *function)
+UwUVMValue uwuref_create(UwUVMFunction *value)
{
return (UwUVMValue) {
.type = &uwuref_type,
- .data = function,
+ .data = value,
};
}
-static void *uwuref_copy(void *data)
+UwUVMFunction *uwuref_get(UwUVMValue value)
+{
+ return value.data;
+}
+
+static void *uwuref_clone(void *data)
{
return data;
}
-static void uwuref_delete(void *data)
+static void uwuref_delet(void *data)
{
(void) data;
}
@@ -25,7 +30,7 @@ static char *uwuref_print(void *data)
}
UwUVMType uwuref_type = {
- .copy = &uwuref_copy,
- .delete = &uwuref_delete,
+ .clone = &uwuref_clone,
+ .delet = &uwuref_delet,
.print = &uwuref_print,
};