mie: implement value type initialiser functions
This commit is contained in:
@@ -1,20 +1,27 @@
|
||||
#ifndef MIE_BUILDER_H_
|
||||
#define MIE_BUILDER_H_
|
||||
|
||||
#include <blue/core/btree.h>
|
||||
#include <mie/misc.h>
|
||||
#include <mie/switch.h>
|
||||
#include <mie/value.h>
|
||||
|
||||
struct b_dict;
|
||||
|
||||
struct mie_block;
|
||||
struct mie_module;
|
||||
struct mie_data;
|
||||
struct mie_type;
|
||||
struct mie_phi;
|
||||
|
||||
struct mie_ctx {
|
||||
struct mie_int *ctx_true, *ctx_false;
|
||||
b_btree ctx_ints;
|
||||
};
|
||||
|
||||
struct mie_builder {
|
||||
struct mie_ctx *b_ctx;
|
||||
struct mie_module *b_module;
|
||||
struct mie_instr *b_prev_instr;
|
||||
struct mie_block *b_current_block;
|
||||
};
|
||||
@@ -22,14 +29,15 @@ struct mie_builder {
|
||||
extern struct mie_ctx *mie_ctx_create(void);
|
||||
extern void mie_ctx_destroy(struct mie_ctx *ctx);
|
||||
|
||||
extern struct mie_value mie_ctx_get_bool(struct mie_ctx, bool val);
|
||||
extern struct mie_value mie_ctx_get_int(struct mie_ctx, long long val);
|
||||
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);
|
||||
|
||||
extern struct mie_builder *mie_builder_create(void);
|
||||
extern struct mie_builder *mie_builder_create(
|
||||
struct mie_ctx *ctx, struct mie_module *mod);
|
||||
extern void mie_builder_destroy(struct mie_builder *builder);
|
||||
|
||||
extern void mie_builder_put_record(
|
||||
struct mie_builder *builder, const char *name, struct mie_value *val);
|
||||
struct mie_builder *builder, struct mie_const *val, const char *name);
|
||||
extern void mie_builder_put_data(struct mie_builder *builder, struct mie_data *data);
|
||||
extern void mie_builder_put_type(struct mie_builder *builder, struct mie_type *type);
|
||||
extern void mie_builder_set_insert_point(
|
||||
|
||||
@@ -8,7 +8,7 @@ enum mie_const_type {
|
||||
MIE_CONST_INT,
|
||||
MIE_CONST_FLOAT,
|
||||
MIE_CONST_STRING,
|
||||
MIE_CONST_SYMBOL,
|
||||
MIE_CONST_ATOM,
|
||||
MIE_CONST_LABEL,
|
||||
MIE_CONST_ARRAY,
|
||||
};
|
||||
@@ -34,7 +34,7 @@ struct mie_str {
|
||||
char *s_value;
|
||||
};
|
||||
|
||||
struct mie_sym {
|
||||
struct mie_atom {
|
||||
struct mie_const s_base;
|
||||
char *s_value;
|
||||
};
|
||||
@@ -50,4 +50,7 @@ struct mie_array {
|
||||
struct mie_value **a_values;
|
||||
};
|
||||
|
||||
extern void mie_int_init(struct mie_int *out, long long val, unsigned int nr_bits);
|
||||
extern struct mie_int *mie_int_create(long long val, unsigned int nr_bits);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <mie/value.h>
|
||||
|
||||
struct mie_type;
|
||||
struct mie_arg;
|
||||
struct b_dict;
|
||||
|
||||
enum mie_func_type {
|
||||
@@ -25,4 +26,10 @@ struct mie_func {
|
||||
b_queue f_blocks;
|
||||
};
|
||||
|
||||
extern struct mie_func *mie_func_create(
|
||||
const char *name, enum mie_func_type type, struct mie_type *ret_type,
|
||||
struct mie_arg **args, unsigned int nr_args);
|
||||
extern char *mie_func_generate_value_name(
|
||||
struct mie_func *func, const char *name_hint);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -31,4 +31,11 @@ struct mie_instr {
|
||||
enum mie_instr_type i_type;
|
||||
};
|
||||
|
||||
struct mie_ret {
|
||||
struct mie_instr r_base;
|
||||
struct mie_value *r_val;
|
||||
};
|
||||
|
||||
extern void mie_instr_init(struct mie_instr *instr, enum mie_instr_type type);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,7 +6,9 @@
|
||||
|
||||
struct mie_record {
|
||||
struct mie_value r_base;
|
||||
struct mie_const *r_value;
|
||||
const struct mie_const *r_value;
|
||||
};
|
||||
|
||||
extern struct mie_record *mie_record_create(const struct mie_const *val);
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user