blob: 0b9329d91a1a5ba06b88dfaf2213517262779801 (
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 <stdlib.h>
#include "../src/util.h"
#include "int.h"
UwUVMValue uwuint_create(int value)
{
UwUVMValue vm_value = {
.type = &uwuint_type,
.data = malloc(sizeof(int))
};
*(int *) vm_value.data = value;
return vm_value;
}
void *uwuint_copy(void *data)
{
int *copy = malloc(sizeof(*copy));
*copy = *(int *) data;
return copy;
}
char *uwuint_print(void *data)
{
return asprintf_wrapper("%d", *(int *) data);
}
UwUVMType uwuint_type = {
.copy = &uwuint_copy,
.delete = &free,
.print = &uwuint_print,
};
|