ANN void op_cpy(const Env env, const struct Op_Import *opi);
ANN m_bool add_op(const Gwion gwion, const struct Op_Import *);
+ANN void* op_get(const Env env, struct Op_Import *opi);
ANN Type op_check(const Env, struct Op_Import *);
ANN m_bool op_emit(const Emitter, const struct Op_Import *);
ANN m_bool operator_set_func(const struct Op_Import *);
#define GWDEPEND_NAME gwdepend
#define GWMODINI(a) \
ANN2(1) \
- void *GWMODINI_NAME(const struct Gwion_ *gwion NUSED, const Vector args NUSED)
+ void *GWMODINI_NAME(struct Gwion_ *const gwion NUSED, const Vector args NUSED)
#define GWMODEND(a) \
- ANN void GWMODEND_NAME(const struct Gwion_ *gwion NUSED, void *self NUSED)
+ ANN void GWMODEND_NAME(struct Gwion_ *const gwion NUSED, void *self NUSED)
#define GWDRIVER(a) ANN void GWDRIVER_NAME(DriverData *d)
#define GWDEPEND ANN m_str const *GWDEPEND_NAME(void)
-Subproject commit b2c146f2a2d9789a45e00ce90d998ebec6f005ed
+Subproject commit ab56ae7687294f6fbaf1d4089412219c3ffcd8de
return NULL;
}
+ANN void* op_get(const Env env, struct Op_Import *opi) {
+ for (int i = 0; i < 2; ++i) {
+ Nspc nspc = env->curr;
+ do {
+ Type l = opi->lhs;
+ if (!nspc->info->op_map.ptr) continue;
+ const Map map = &nspc->info->op_map;
+ do {
+ Type r = opi->rhs;
+ do {
+ const m_int idx = map_index(map, (vtype)opi->op);
+ if(idx != -1) {
+ M_Operator *const mo = !i
+ ? operator_find2((Vector)&VVAL(map, idx), l, r)
+ : operator_find((Vector)&VVAL(map, idx), l, r);
+ if (mo)
+ return mo;
+ }
+ } while (r && (r = op_parent(env, r)));
+ } while (l && (l = op_parent(env, l)));
+ } while ((nspc = nspc->parent));
+ }
+ return NULL;
+}
+
ANN Type op_check(const Env env, struct Op_Import *opi) {
for (int i = 0; i < 2; ++i) {
Nspc nspc = env->curr;