aboutsummaryrefslogtreecommitdiff
path: root/api/str.c
blob: 84d2b107047ea1cad107200fdcca40ee253824f9 (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
#include <string.h>
#include <stdlib.h>
#include "str.h"

UwUVMValue uwustr_create(const char *value)
{
	return (UwUVMValue) {
		.type = &uwustr_type,
		.data = strdup(value),
	};
}

char *uwustr_get(UwUVMValue vm_value)
{
	vm_value.type->print(vm_value.data);
}

static void *uwustr_copy(void *data)
{
	return strdup(data);
}

static char *uwustr_print(void *data)
{
	return strdup(data);
}

UwUVMType uwustr_type = {
	.copy = &uwustr_copy,
	.delete = &free,
	.print = &uwustr_print,
};