void init_mtd(Ctx *ctx, struct func_data *d)
{
    while(d->cname != NULL) {
        //printk("func '%s.%s', func=%p\n", d->cname, d->fname, d->func);
        knh_class_t cid = knh_findcid(ctx, B(d->cname));
        if(cid != CLASS_unknown) {
            //fprintf(stderr, "find cid=%d\n",cid);
            knh_bytes_t fname = B(d->fname);
            knh_methodn_t mn = knh_getmn(ctx, fname, METHODN_NONAME);
            knh_Method_t *mtd = knh_lookupMethod(ctx, cid, mn);
            if(IS_Method(mtd) && d->func != NULL) {
                //printk("sync func '%s(cid=%d).%s(mtd=%p)'\n", d->cname, cid, d->fname, mtd);
                knh_Method_syncFunc(mtd, d->func);
            }
        }
        d++;
    }
}
Exemple #2
0
KNHAPI(void) knh_addAffineMapper(Ctx *ctx, knh_class_t scid, char *text, knh_float_t scale, knh_float_t shift)
{
	//KNH_ASSERT_cid(scid);
	knh_class_t tcid = knh_findcid(ctx, B(text));
	if(tcid != CLASS_unknown && ctx->share->ClassTable[tcid].bcid != tcid) {
		KNH_TAFFINE(ctx, scid, tcid, scale, shift);
#ifndef KONOHA_ON_LKM
		if(scale != 0.0) {
			KNH_TAFFINE(ctx, tcid, scid, 1.0 / scale, -(shift/scale));
		}
#else
		if(scale != 0) {
			KNH_TAFFINE(ctx, tcid, scid, 1 / scale, -(shift/scale));
		}
#endif


	}
}