aboutsummaryrefslogtreecommitdiff
path: root/api/ref.c
blob: 43eb68e4cb0b95d3bb35f7e75211a35e22ea5b5c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "../src/util.h"
#include "ref.h"

UwUVMValue uwuref_create(UwUVMFunction *value)
{
	return (UwUVMValue) {
		.type = &uwuref_type,
		.data = value,
	};
}

UwUVMFunction *uwuref_get(UwUVMValue value)
{
	return value.data;
}

static void *uwuref_clone(void *data)
{
	return data;
}

static void uwuref_delet(void *data)
{
	(void) data;
}

static char *uwuref_print(void *data)
{
	return asprintf_wrapper("[Function reference: %p]", data);
}

UwUVMType uwuref_type = {
	.clone = &uwuref_clone,
	.delet = &uwuref_delet,
	.print = &uwuref_print,
};