void KTexture::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) { //fprintf(stderr, "KTexture::mouseReleaseEvent\n"); isDrag = false; if (ctx != NULL && sfp != NULL && mouse_release_func != NULL) { const knh_ClassTBL_t *ct1 = ClassTBL(cid); const knh_ClassTBL_t *ct2 = ClassTBL(mouse_event_cid); if (ct1 == NULL || ct2 == NULL) return; knh_RawPtr_t *p1 = (knh_RawPtr_t*)new_hObject_(ctx, ct1); p1->rawptr = this; KNH_SETv(ctx, sfp[5].o, UPCAST(p1)); knh_RawPtr_t *p2 = (knh_RawPtr_t*)new_hObject_(ctx, ct2); p2->rawptr = event; KNH_SETv(ctx, sfp[6].o, UPCAST(p2)); if (mouse_release_func->baseNULL != NULL) { KNH_SETv(ctx, sfp[K_CALLDELTA].o, mouse_release_func->baseNULL); } KNH_SCALL(ctx, sfp, 0, mouse_release_func->mtd, 3); } }
KNHAPI2(knh_Int_t*) new_Int(CTX ctx, knh_class_t cid, knh_int_t value) { knh_Int_t *b = (knh_Int_t*)new_hObject_(ctx, ClassTBL(cid)); b->n.ivalue = value; return b; }
KNHAPI2(knh_Float_t*) new_Float(CTX ctx, knh_class_t cid, knh_float_t value) { knh_Float_t *b = (knh_Float_t*)new_hObject_(ctx, ClassTBL(cid)); b->n.fvalue = value; return b; }
static kcontext_t* new_RootContext(void) { kcontext_t *ctx = (kcontext_t*)new_hcontext(NULL); const knh_LoaderAPI_t *kapi = knh_getLoaderAPI(); kshare_t *share = (kshare_t*)malloc(sizeof(kshare_t) + sizeof(kstatinfo_t) + sizeof(knh_ServiceSPI_t)); ctx->share = share; knh_bzero(share, sizeof(kshare_t) + sizeof(kstatinfo_t) + sizeof(knh_ServiceSPI_t)); share->syslock = knh_mutex_malloc(_ctx); ctx->stat = (kstatinfo_t*)((share+1)); ctx->spi = (const knh_ServiceSPI_t*)(_ctx->stat + 1); initServiceSPI((knh_ServiceSPI_t*)ctx->spi); kmemshare_init(_ctx); share->ClassTBL = (kclass_t**)KMALLOC((CTX)ctx, sizeof(struct _kclass*)*(K_CLASSTABLE_INIT)); knh_bzero(share->ClassTBL, sizeof(struct _kclass*)*(K_CLASSTABLE_INIT)); share->sizeClassTBL = 0; share->capacityClassTBL = K_CLASSTABLE_INIT; share->EventTBL = (knh_EventTBL_t*)KCALLOC(SIZEOF_TEXPT(K_EVENTTBL_INIT)); knh_bzero((void*)share->EventTBL, SIZEOF_TEXPT(K_EVENTTBL_INIT)); share->sizeEventTBL = 0; share->capacityEventTBL = K_EVENTTBL_INIT; kshare_loadStructData(_ctx, kapi); KINITv(share->funcDictSet, new_DictSet0(_ctx, 0, 0, "funcDictSet")); KINITv(share->constPtrMap, new_PtrMap(_ctx, 0)); KINITv(share->inferPtrMap, new_PtrMap(_ctx, 0)); KINITv(share->xdataPtrMap, new_PtrMap(_ctx, 0)); KINITv(share->constPools, new_Array0(_ctx, 0)); knh_loadSystemTypeMapRule(_ctx); knh_ClassTBL_setConstPool(_ctx, ClassTBL(CLASS_Int)); knh_ClassTBL_setConstPool(_ctx, ClassTBL(CLASS_Float)); #ifdef K_USING_STRINGPOOL knh_ClassTBL_setConstPool(_ctx, ClassTBL(CLASS_String)); #endif { kObject *p = (kObject*)new_hObject_(_ctx, ClassTBL(CLASS_Object)); Object_setNullObject(p, 1); KINITv(share->constNull, p); } { kBoolean *o = new_H(Boolean); o->n.bvalue = 1; KINITv(share->constTrue, o); o = new_H(Boolean); o->n.bvalue = 0; KINITv(share->constFalse, o); } { static const kdim_t dimINIT = {}; kArray *a = new_H(Array); (a)->size = 0; (a)->dim = &dimINIT; KINITv(share->emptyArray, a); } share->tString = (kString**)KCALLOC(SIZEOF_TSTRING); knh_bzero(share->tString, SIZEOF_TSTRING); knh_loadScriptSystemString(_ctx); KINITv(share->cwdPath, new_CurrentPath(_ctx)); /* These are not shared, but needed to initialize System*/ knh_stack_initexpand(_ctx, NULL, K_STACKSIZE); KINITv(share->packageDictMap, new_DictMap0(_ctx, 0, 1/*isCaseMap*/, "packageDictMap")); KINITv(share->secfileidtyDictMap, new_DictMap0(_ctx, 0, 1/*isCaseMap*/, "secfileidtyDictMap")); // added by Wakamori KINITv(share->classNameDictSet, new_DictSet0(_ctx, 128, 1/*isCaseMap*/, "classNameDictSet")); KINITv(share->eventDictSet, new_DictSet0(_ctx, 32, 1/*isCaseMap*/, "eventDictSet")); KINITv(share->streamDpiDictSet, new_DictSet0(_ctx, 0, 1/*isCaseMap*/, "streamDpiDictSet")); KINITv(share->mapDpiDictSet, new_DictSet0(_ctx, 0, 1/*isCaseMap*/, "mapDpiDictSet")); KINITv(share->convDpiDictSet, new_DictSet0(_ctx, 0, 1/*isCaseMap*/, "convDpiDictSet")); KINITv(share->rconvDpiDictSet, new_DictSet0(_ctx, 0, 1/*isCaseMap*/, "convDpiDictSet")); KINITv(share->enc, new_T(knh_getSystemEncoding())); KINITv(share->in, new_InputStreamStdIn(_ctx, share->enc)); KINITv(share->out, new_OutputStreamStdOut(_ctx, share->enc)); KINITv(share->err, new_OutputStreamStdErr(_ctx, share->enc)); KINITv(share->props, new_DictMap0(_ctx, 20, 1/*isCaseMap*/, "System.props")); KINITv(share->symbolDictCaseSet, new_DictSet0(_ctx, K_TFIELD_SIZE + 10, 1/*isCaseMap*/, "System.symbolDictSet")); KINITv(share->symbolList, new_Array0(_ctx, K_TFIELD_SIZE + 10)); KINITv(share->urnDictSet, new_DictSet0(_ctx, 0, 0/*isCaseMap*/, "System.urnDictSet")); KINITv(share->urns, new_Array0(_ctx, 1)); KINITv(share->corelang, new_(Lang)); knh_initSugarData(_ctx); KINITv(share->tokenDictSet, new_DictSet0(_ctx, (TT_MAX - STT_MAX), 0/*isCaseMap*/, "System.tokenDictSet")); // KINITv(share->URNAliasDictMap, new_DictMap0(_ctx, 0, 0/*isCaseMap*/, "System.URNAliasDictMap")); KINITv(share->rootks, new_(KonohaSpace)); knh_loadScriptSystemData(_ctx, share->rootks, kapi); knh_System_initPath(_ctx); // require rootks KINITv(_ctx->script, new_(Script)); // require rootks KINITv(_ctx->gma, new_(GammaBuilder)); // require script knh_loadScriptSystemKonohaCode(_ctx); // require gamma loadPolicy(_ctx); // added by Wakamori knh_loadScriptSystemMethod(_ctx, kapi); CommonContext_init(_ctx, ctx); knh_loadScriptTermData(_ctx); knh_loadScriptAliasTermData(_ctx); share->ctx0 = ctx; knh_GammaBuilder_init(_ctx); // initalize gamma->gf, reported by uh knh_initBuiltInPackage(_ctx, knh_getLoaderAPI()); /* CompilerAPI */ KINITv(share->konoha_compiler, K_NULL); share->compilerAPI = NULL; share->contextCounter = 1; share->threadCounter = 1; share->stopCounter = 0; share->gcStopCounter = 0; KINITv(share->contextListNULL, new_Array0(_ctx, 4)); kArray_add(ctx->share->contextListNULL, knh_toContext(_ctx)); #if defined(K_USING_THREAD) share->stop_cond = kthread_cond_init(_ctx); share->start_cond = kthread_cond_init(_ctx); share->close_cond = kthread_cond_init(_ctx); #endif return ctx; }
KNHAPI(knh_Float_t*) new_Float(Ctx *ctx, knh_class_t cid, knh_float_t value) { knh_Float_t *b = (knh_Float_t*)new_hObject_(ctx, FLAG_Float, CLASS_Float, cid); b->n.fvalue = value; return b; }
KNHAPI(knh_Int_t*) new_Int(Ctx *ctx, knh_class_t cid, knh_int_t value) { knh_Int_t *b = (knh_Int_t*)new_hObject_(ctx, FLAG_Int, CLASS_Int, cid); b->n.ivalue = value; return b; }