mie: implement an interface system for ops
this system allows dialects to register named interfaces, which are collections of function pointers. an op can then implement this interface, providing callbacks for the interface's virtual function pointers. C code can request a pointer to an op's implementation of a given interface and call virtual functions with no knowledge required about the op itself. this functonality will also be extended to types, attributes, and dialects themselves.
This commit is contained in:
@@ -18,6 +18,7 @@ struct mie_op_definition *mie_op_definition_create(
|
||||
|
||||
out->op_parent = parent;
|
||||
mie_trait_table_init(&out->op_traits);
|
||||
mie_interface_map_init(&out->op_iface);
|
||||
|
||||
b_rope name_rope = B_ROPE_CSTR(name);
|
||||
mie_id_map_put(&parent->d_ops, &out->op_id, &name_rope);
|
||||
@@ -30,3 +31,9 @@ enum mie_status mie_op_definition_add_trait(
|
||||
{
|
||||
return mie_trait_table_put(&op->op_traits, trait);
|
||||
}
|
||||
|
||||
enum mie_status mie_op_definition_add_interface(
|
||||
struct mie_op_definition *op, struct mie_interface *interface)
|
||||
{
|
||||
return mie_interface_map_put(&op->op_iface, interface);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user