aboutsummaryrefslogtreecommitdiff
path: root/api/int.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/int.c
parent058d954e80f83c26deb209008f11d87a5b59418e (diff)
downloaduwu-lang-4c52777ca9e52edd0bff76168d886de9757ea457.tar.xz
Add :ref module and refactor type handling
Diffstat (limited to 'api/int.c')
-rw-r--r--api/int.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/api/int.c b/api/int.c
index 0b9329d..8446d1d 100644
--- a/api/int.c
+++ b/api/int.c
@@ -13,7 +13,12 @@ UwUVMValue uwuint_create(int value)
return vm_value;
}
-void *uwuint_copy(void *data)
+int uwuint_get(UwUVMValue vm_value)
+{
+ return *(int *) vm_value.data;
+}
+
+void *uwuint_clone(void *data)
{
int *copy = malloc(sizeof(*copy));
*copy = *(int *) data;
@@ -26,7 +31,7 @@ char *uwuint_print(void *data)
}
UwUVMType uwuint_type = {
- .copy = &uwuint_copy,
- .delete = &free,
+ .clone = &uwuint_clone,
+ .delet = &free,
.print = &uwuint_print,
};