7 UwUVMValue uwubool_create(bool value)
9 UwUVMValue vm_value = {
10 .type = &uwubool_type,
11 .data = malloc(sizeof(bool)),
14 *(bool *) vm_value.data = value;
18 bool uwubool_get(UwUVMValue vm_value)
20 if (vm_value.type == &uwunil_type)
22 else if (vm_value.type == &uwubool_type)
23 return *(bool *) vm_value.data;
28 static void *uwubool_copy(void *data)
30 bool *copy = malloc(sizeof(*copy));
31 *copy = *(bool *) data;
35 static char *uwubool_print(void *data)
37 return strdup(((bool *) data) ? "true" : "false");
40 UwUVMType uwubool_type = {
41 .copy = &uwubool_copy,
43 .print = &uwubool_print,