mie: ctx: add function to create ops

This commit is contained in:
2026-01-21 14:17:43 +00:00
parent 72de4ce845
commit 0c4ebe7f39
2 changed files with 23 additions and 0 deletions

View File

@@ -70,6 +70,27 @@ struct mie_ctx *mie_ctx_create(void)
return out;
}
struct mie_op *mie_ctx_create_op(
const struct mie_ctx *ctx, const char *dialect, const char *op)
{
const struct mie_op_definition *def
= mie_ctx_get_op_definition(ctx, dialect, op);
if (!def) {
return NULL;
}
struct mie_op *out = mie_op_create();
if (!out) {
return NULL;
}
out->op_flags |= MIE_OP_F_OP_RESOLVED;
out->op_info = def;
out->op_dialect = def->op_parent;
return out;
}
bool mie_ctx_resolve_op(const struct mie_ctx *ctx, struct mie_op *op)
{
if (op->op_flags & MIE_OP_F_OP_RESOLVED) {

View File

@@ -36,6 +36,8 @@ struct mie_ctx {
MIE_API struct mie_ctx *mie_ctx_create(void);
MIE_API void mie_ctx_destroy(struct mie_ctx *ctx);
MIE_API struct mie_op *mie_ctx_create_op(
const struct mie_ctx *ctx, const char *dialect, const char *op);
MIE_API bool mie_ctx_resolve_op(const struct mie_ctx *ctx, struct mie_op *op);
MIE_API struct mie_dialect *mie_ctx_get_dialect(