diff options
author | Elias Fleckenstein <eliasfleckenstein@web.de> | 2021-12-30 16:02:10 +0100 |
---|---|---|
committer | Elias Fleckenstein <eliasfleckenstein@web.de> | 2021-12-30 16:02:10 +0100 |
commit | 058d954e80f83c26deb209008f11d87a5b59418e (patch) | |
tree | ef7b5a95cfd1dbdba71041e1f0608d551adfa360 /api/ref.c | |
parent | 3ba311b0afdf9cc62d630687d171bee0b6435e4a (diff) | |
download | uwu-lang-058d954e80f83c26deb209008f11d87a5b59418e.tar.xz |
Unify value types
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, +}; |