mie: move mie_ctx to a separate header

This commit is contained in:
2025-04-17 22:02:10 +01:00
parent 7b8d77a264
commit abb7cfaf0e
6 changed files with 246 additions and 218 deletions

View File

@@ -14,13 +14,7 @@ struct mie_module;
struct mie_data;
struct mie_type;
struct mie_phi;
struct mie_ctx {
struct mie_const *ctx_true, *ctx_false;
struct mie_type *ctx_types[__MIE_TYPE_COUNT];
b_btree ctx_int_cache;
struct b_hashmap *ctx_sel_cache;
};
struct mie_ctx;
struct mie_builder {
struct mie_ctx *b_ctx;

26
mie/include/mie/ctx.h Normal file
View File

@@ -0,0 +1,26 @@
#ifndef MIE_CTX_H_
#define MIE_CTX_H_
#include <blue/core/btree.h>
#include <mie/type.h>
struct mie_ctx {
struct mie_const *ctx_true, *ctx_false;
struct mie_type *ctx_types[__MIE_TYPE_COUNT];
b_btree ctx_int_cache;
struct b_hashmap *ctx_sel_cache;
};
extern struct mie_ctx *mie_ctx_create(void);
extern void mie_ctx_destroy(struct mie_ctx *ctx);
extern struct mie_type *mie_ctx_get_type(
struct mie_ctx *ctx, enum mie_type_id type_id);
extern struct mie_type *mie_ctx_get_int_type(
struct mie_ctx *ctx, unsigned int nr_bits);
extern struct mie_value *mie_ctx_get_bool(struct mie_ctx *ctx, bool val);
extern struct mie_value *mie_ctx_get_int(
struct mie_ctx *ctx, long long val, unsigned int nr_bits);
extern struct mie_value *mie_ctx_get_selector(struct mie_ctx *ctx, const char *sel);
#endif