mie: refactor ir api into a separate sub-directory

This commit is contained in:
2025-06-02 11:31:19 +01:00
parent a3d553019d
commit d01a3b4663
42 changed files with 85 additions and 85 deletions

29
mie/ir/record.c Normal file
View File

@@ -0,0 +1,29 @@
#include <mie/ir/record.h>
#include <stdlib.h>
#include <string.h>
struct mie_record *mie_record_create(const struct mie_const *val)
{
struct mie_record *out = malloc(sizeof *out);
if (!out) {
return NULL;
}
memset(out, 0x0, sizeof *out);
mie_value_init(&out->r_base, MIE_VALUE_RECORD);
out->r_value = val;
return out;
}
static struct mie_type *get_type(struct mie_value *v, struct mie_ctx *ctx)
{
struct mie_record *r = MIE_RECORD(v);
return r->r_value->c_type;
}
const struct mie_value_type record_value_type = {
.t_id = MIE_VALUE_RECORD,
.t_get_type = get_type,
};