33 lines
1.1 KiB
C
33 lines
1.1 KiB
C
#ifndef MIE_CTX_H_
|
|
#define MIE_CTX_H_
|
|
|
|
#include <blue/core/btree.h>
|
|
#include <blue/ds/hashmap.h>
|
|
#include <mie/type.h>
|
|
|
|
struct mie_ctx {
|
|
struct mie_const *ctx_true, *ctx_false;
|
|
struct mie_value *ctx_null;
|
|
struct mie_type *ctx_types[__MIE_TYPE_COUNT];
|
|
b_btree ctx_int_cache;
|
|
b_hashmap *ctx_sel_cache;
|
|
b_hashmap *ctx_string_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_null(struct mie_ctx *ctx);
|
|
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_string(struct mie_ctx *ctx, const char *s);
|
|
extern struct mie_value *mie_ctx_get_selector(struct mie_ctx *ctx, const char *sel);
|
|
extern struct mie_value *mie_ctx_create_array(struct mie_ctx *ctx);
|
|
|
|
#endif
|