void tTVPAsyncImageLoader::HandleLoadedImage() { bool loading; do { loading = false; tTVPImageLoadCommand* cmd = NULL; { tTJSCriticalSectionHolder cs(ImageQueueCS); if( LoadedQueue.size() > 0 ) { cmd = LoadedQueue.front(); LoadedQueue.pop(); loading = true; } } if( cmd != NULL ) { cmd->bmp_->SetLoading( false ); if( cmd->result_.length() > 0 ) { // error tTJSVariant param[4]; param[0] = tTJSVariant((iTJSDispatch2*)NULL,(iTJSDispatch2*)NULL); param[1] = 1; // true async param[2] = 1; // true error param[3] = cmd->result_; // error_mes static ttstr eventname(TJS_W("onLoaded")); if( cmd->owner_->IsValid(0,NULL,NULL,cmd->owner_) == TJS_S_TRUE ) { TVPPostEvent(cmd->owner_, cmd->owner_, eventname, 0, TVP_EPT_IMMEDIATE, 4, param); } if( cmd->dest_->MetaInfo ) { delete cmd->dest_->MetaInfo; cmd->dest_->MetaInfo = NULL; } } else { iTJSDispatch2* metainfo = TVPMetaInfoPairsToDictionary(cmd->dest_->MetaInfo); cmd->bmp_->SetSizeAndImageBuffer( cmd->dest_->w, cmd->dest_->h, cmd->dest_->buf ); cmd->dest_->buf = NULL; // 読込み完了時にもキャッシュチェック(非同期なので完了前に読み込まれている可能性あり) if( TVPHasImageCache( cmd->path_, glmNormal, 0, 0, TVP_clNone ) == false ) { TVPPushGraphicCache( cmd->path_, cmd->bmp_->GetBitmap(), cmd->dest_->MetaInfo ); cmd->dest_->MetaInfo = NULL; } else { delete cmd->dest_->MetaInfo; cmd->dest_->MetaInfo = NULL; } tTJSVariant param[4]; param[0] = tTJSVariant(metainfo,metainfo); if( metainfo ) metainfo->Release(); param[1] = 1; // true async param[2] = 0; // false error param[3] = TJS_W(""); // error_mes static ttstr eventname(TJS_W("onLoaded")); if( cmd->owner_->IsValid(0,NULL,NULL,cmd->owner_) == TJS_S_TRUE ) { TVPPostEvent(cmd->owner_, cmd->owner_, eventname, 0, TVP_EPT_IMMEDIATE, 4, param); } } delete cmd; } } while(loading); }
KTL_INLINE tTJSVariant NativeStorageStream::readNarrowString(size_type size) { binary_type buffer; if (!readBuffer(buffer, size)) { return tTJSVariant(); } buffer.insert(buffer.end(), sizeof(tjs_nchar) * 2 - 1, 0); return tTJSVariant(reinterpret_cast<tjs_nchar const*>(&buffer[0])); }
KTL_INLINE tTJSVariant NativeNetwork::hostName() { boost::system::error_code error; std::string result = boost::asio::ip::host_name(error); if (error) { return tTJSVariant(); } return tTJSVariant(result.c_str()); }
/** * XMLのノードから tTJSVariantを取得する * @param var 結果格納先 * @param node ノード */ static void getVariantFromNode(tTJSVariant &var, xml_node *node) { if (node && node->type() == rapidxml::node_element) { if (_wcsicmp(node->name(), L"undefined") == 0) { var.Clear(); } else if (_wcsicmp(node->name(), L"null") == 0) { var = tTJSVariant((iTJSDispatch2*)NULL); } else if (_wcsicmp(node->name(), L"array") == 0) { iTJSDispatch2 *array = TJSCreateArrayObject(); for (xml_node *propNode = node->first_node(); propNode; propNode = propNode->next_sibling()) { if (_wcsicmp(propNode->name(), L"property") == 0) { xml_attribute *attr_id = propNode->first_attribute(L"id"); if (attr_id) { tjs_int id = wcstol(attr_id->value(), NULL, 10); xml_node *valueNode = propNode->first_node(); if (valueNode) { tTJSVariant value; getVariantFromNode(value, valueNode); array->PropSetByNum(0, id, &value, array); } } } } var = tTJSVariant(array, array); array->Release(); } else if (_wcsicmp(node->name(), L"object") == 0) { iTJSDispatch2 *dict = TJSCreateDictionaryObject(); for (xml_node *propNode = node->first_node(); propNode; propNode = propNode->next_sibling()) { if (_wcsicmp(propNode->name(), L"property") == 0) { xml_attribute *attr_id = propNode->first_attribute(L"id"); if (attr_id) { ttstr id = attr_id->value(); if (id.length() > 0) { xml_node *valueNode = propNode->first_node(); if (valueNode) { tTJSVariant value; getVariantFromNode(value, valueNode); dict->PropSet(0, id.c_str(), 0, &value, dict); } } } } } var = tTJSVariant(dict, dict); dict->Release(); } else if (_wcsicmp(node->name(), L"string") == 0) { var = node->value(); } else if (_wcsicmp(node->name(), L"number") == 0) { var = wcstod(node->value(), NULL); } } else { var.Clear(); } }
KTL_INLINE tTJSVariant NativeStorageStream::readOctet(size_type size) { binary_type buffer; if (!readBuffer(buffer, size)) { return tTJSVariant(); } return tTJSVariant( buffer.size() ? &buffer[0] : 0 , buffer.size() ); }
// メソッド呼び出し共通処理 tjs_error TJSInstance::callMethod(Isolate *isolate, Local<Object> &obj, const tjs_char *membername, tTJSVariant *result, tjs_int numparams, tTJSVariant **param, iTJSDispatch2 *objthis) { HandleScope handle_scope(isolate); Context::Scope context_scope(getContext()); TryCatch try_catch; Local<Object> context = membername ? obj : objthis ? toJSValue(isolate, tTJSVariant(objthis))->ToObject() : getContext()->Global(); Local<Object> method = membername ? obj->Get(String::NewFromTwoByte(isolate, membername))->ToObject() : obj; if (!method->IsFunction()) { return TJS_E_NOTIMPL; } // 関数抽出 Local<Function> func = Local<Function>::Cast(method); // 引数 Handle<Value> *argv = new Handle<Value>[numparams]; for (int i=0;i<numparams;i++) { argv[i] = toJSValue(isolate, *param[i]); } Local<Value> ret = func->Call(context, numparams, argv); delete argv; if (ret.IsEmpty()) { JSEXCEPTION(isolate, &try_catch); } else { if (result) { *result = toVariant(isolate, ret); } } return TJS_S_OK; }
// onLoaded( dic, is_async, is_error, error_mes ); エラーは // sync ( main thead ) void tTVPAsyncImageLoader::LoadRequest( iTJSDispatch2 *owner, tTJSNI_Bitmap* bmp, const ttstr &name ) { //tTVPBaseBitmap* dest = new tTVPBaseBitmap( 32, 32, 32 ); tTVPBaseBitmap dest( TVPGetInitialBitmap() ); iTJSDispatch2* metainfo = NULL; ttstr nname = TVPNormalizeStorageName(name); if( TVPCheckImageCache(nname,&dest,glmNormal,0,0,TVP_clNone,&metainfo) ) { // キャッシュ内に発見、即座に読込みを完了する bmp->CopyFrom( &dest ); bmp->SetLoading( false ); tTJSVariant param[4]; param[0] = tTJSVariant(metainfo,metainfo); if( metainfo ) metainfo->Release(); param[1] = 0; // false param[2] = 0; // false param[3] = TJS_W(""); // error_mes static ttstr eventname(TJS_W("onLoaded")); TVPPostEvent(owner, owner, eventname, 0, TVP_EPT_IMMEDIATE, 4, param); return; } if( TVPIsExistentStorage(name) == false ) { TVPThrowExceptionMessage(TVPCannotFindStorage, name); } ttstr ext = TVPExtractStorageExt(name); if(ext == TJS_W("")) { TVPThrowExceptionMessage(TJS_W("Filename extension not found/%1"), name); } PushLoadQueue( owner, bmp, nname ); }
//--------------------------------------------------------------------------- // TJSGetExceptionObject : retrieves TJS 'Exception' object //--------------------------------------------------------------------------- void TJSGetExceptionObject(tTJS *tjs, tTJSVariant *res, tTJSVariant &msg, tTJSVariant *trace/* trace is optional */) { if(!res) return; // not prcess // retrieve class "Exception" from global iTJSDispatch2 *global = tjs->GetGlobalNoAddRef(); tTJSVariant val; static tTJSString Exception_name(TJS_W("Exception")); tjs_error hr = global->PropGet(0, Exception_name.c_str(), Exception_name.GetHint(), &val, global); if(TJS_FAILED(hr)) TJS_eTJSError(TJSExceptionNotFound); // create an Exception object iTJSDispatch2 *excpobj; tTJSVariantClosure clo = val.AsObjectClosureNoAddRef(); tTJSVariant *pmsg = &msg; hr = clo.CreateNew(0, NULL, NULL, &excpobj, 1, &pmsg, clo.ObjThis); if(TJS_FAILED(hr)) TJS_eTJSError(TJSExceptionNotFound); if(trace) { static tTJSString trace_name(TJS_W("trace")); excpobj->PropSet(TJS_MEMBERENSURE, trace_name.c_str(), trace_name.GetHint(), trace, excpobj); } *res = tTJSVariant(excpobj, excpobj); excpobj->Release(); }
tjs_error TJS_INTF_METHOD NativeOdeint::ConstVector::PropGet( tjs_uint32 flag, tjs_char const* membername, tjs_uint32* hint, tTJSVariant* result, iTJSDispatch2* objthis ) { if (!membername) { return TJS_E_NOTIMPL; } if (sprig::str_compare(membername, SPRIG_KRKR_TJS_W("asArray")) == 0) { if (result) { sprig::krkr::tjs::object_type obj = sprig::krkr::tjs::CreateNewObject( sprig::krkr::tjs::GetTJSClassNoAddRef(SPRIG_KRKR_TJS_W("Array")), 0, 0, 0 ); { tjs_int num = 0; for (state_type::const_iterator it = s_->begin(), last = s_->end(); it != last; ++it) { sprig::krkr::tjs::AddMember(obj, num, tTJSVariant(*it)); ++num; } } *result = sprig::krkr::tjs::as_object_closure_variant(obj); } } else if (sprig::str_compare(membername, SPRIG_KRKR_TJS_W("count")) == 0) { if (result) { *result = static_cast<tjs_int>(s_->size()); } } else { return TJS_E_MEMBERNOTFOUND; } return TJS_S_OK; }
//---------------------------------------------------------------------- // 構造体比較関数 bool ScriptsAdd::equalStruct(tTJSVariant v1, tTJSVariant v2) { // タイプがオブジェクトなら特殊判定 if (v1.Type() == tvtObject && v2.Type() == tvtObject) { if (v1.AsObjectNoAddRef() == v2.AsObjectNoAddRef()) return true; tTJSVariantClosure &o1 = v1.AsObjectClosureNoAddRef(); tTJSVariantClosure &o2 = v2.AsObjectClosureNoAddRef(); // 関数どうしなら特別扱いで関数比較 if (o1.IsInstanceOf(0, NULL, NULL, L"Function", NULL)== TJS_S_TRUE && o2.IsInstanceOf(0, NULL, NULL, L"Function", NULL)== TJS_S_TRUE) return v1.DiscernCompare(v2); // Arrayどうしなら全項目を比較 if (o1.IsInstanceOf(0, NULL, NULL, L"Array", NULL)== TJS_S_TRUE && o2.IsInstanceOf(0, NULL, NULL, L"Array", NULL)== TJS_S_TRUE) { // 長さが一致していなければ比較失敗 tTJSVariant o1Count, o2Count; (void)o1.PropGet(0, L"count", &countHint, &o1Count, NULL); (void)o2.PropGet(0, L"count", &countHint, &o2Count, NULL); if (! o1Count.DiscernCompare(o2Count)) return false; // 全項目を順番に比較 tjs_int count = o1Count; tTJSVariant o1Val, o2Val; for (tjs_int i = 0; i < count; i++) { (void)o1.PropGetByNum(TJS_IGNOREPROP, i, &o1Val, NULL); (void)o2.PropGetByNum(TJS_IGNOREPROP, i, &o2Val, NULL); if (! equalStruct(o1Val, o2Val)) return false; } return true; } // Dictionaryどうしなら全項目を比較 if (o1.IsInstanceOf(0, NULL, NULL, L"Dictionary", NULL)== TJS_S_TRUE && o2.IsInstanceOf(0, NULL, NULL, L"Dictionary", NULL)== TJS_S_TRUE) { // 項目数が一致していなければ比較失敗 tjs_int o1Count, o2Count; (void)o1.GetCount(&o1Count, NULL, NULL, NULL); (void)o2.GetCount(&o2Count, NULL, NULL, NULL); if (o1Count != o2Count) return false; // 全項目を順番に比較 DictMemberCompareCaller *caller = new DictMemberCompareCaller(o2); tTJSVariantClosure closure(caller); tTJSVariant(o1.EnumMembers(TJS_IGNOREPROP, &closure, NULL)); bool result = caller->match; caller->Release(); return result; } } return v1.DiscernCompare(v2); }
// // SUMMARY: クロック系メソッド // KTL_INLINE tTJSVariant NativeNetwork::getClockTime() { boost::system::error_code error; time_point_type time_point = clock_type::now(error); if (error) { return tTJSVariant(); } return tTVInteger(boost::chrono::duration_cast<milliseconds_type>(time_point.time_since_epoch()).count()); }
SPRIG_INLINE void optional_result_set(tTJSVariant* result, boost::optional<T> const& value) { if (result) { if (value) { *result = *value; } else { *result = tTJSVariant(); } } }
void _TryCreate() { tjs_error error; iTJSDispatch2 *newinstance; if (TJS_SUCCEEDED(error = classObj.AsObjectClosureNoAddRef().CreateNew(0, NULL, NULL, &newinstance, argc, argv, NULL))) { new TJSInstance(args.GetIsolate(), args.This(), tTJSVariant(newinstance, newinstance)); newinstance->Release(); ret = args.This(); } else { ret = ERROR_KRKR(args.GetIsolate(), error); } }
void _TryCreate() { tjs_error error; iTJSDispatch2 *newinstance; if (TJS_SUCCEEDED(error = instance.AsObjectClosureNoAddRef().CreateNew(0, NULL, NULL, &newinstance, argc, args, NULL))) { r = tTJSVariant(newinstance, newinstance); newinstance->Release(); result = SQ_OK; } else { result = ERROR_KRKR(v, error); } }
extern "C" HRESULT _stdcall _export V2Link(iTVPFunctionExporter *exporter) { // スタブの初期化(必ず記述する) TVPInitImportStub(exporter); // TestFunction の作成と登録 tTJSVariant val; // TJS のグローバルオブジェクトを取得する iTJSDispatch2 * global = TVPGetScriptDispatch(); // 1 まずオブジェクトを作成 DrawFFTGraphFunction = new tDrawFFTGraphFunction(); // 2 DrawFFTGraphFunction を tTJSVariant 型に変換 val = tTJSVariant(DrawFFTGraphFunction); // 3 すでに val が DrawFFTGraphFunction を保持しているので、 // DrawFFTGraphFunction は Release する DrawFFTGraphFunction->Release(); // 4 global の PropSet メソッドを用い、オブジェクトを登録する global->PropSet( TJS_MEMBERENSURE, // メンバがなかった場合には作成するようにするフラグ TJS_W("drawFFTGraph"), // メンバ名 ( かならず TJS_W( ) で囲む ) NULL, // ヒント ( 本来はメンバ名のハッシュ値だが、NULL でもよい ) &val, // 登録する値 global // コンテキスト ( global でよい ) ); // - global を Release する global->Release(); // val をクリアする。 // これは必ず行う。そうしないと val が保持しているオブジェクト // が Release されず、次に使う TVPPluginGlobalRefCount が正確にならない。 val.Clear(); // この時点での TVPPluginGlobalRefCount の値を GlobalRefCountAtInit = TVPPluginGlobalRefCount; TVPAddLog(TVPPluginGlobalRefCount); // として控えておく。TVPPluginGlobalRefCount はこのプラグイン内で // 管理されている tTJSDispatch 派生オブジェクトの参照カウンタの総計で、 // 解放時にはこれと同じか、これよりも少なくなってないとならない。 // そうなってなければ、どこか別のところで関数などが参照されていて、 // プラグインは解放できないと言うことになる。 return S_OK; }
void callback() { set_processing(true); set_result(tTJSVariant()); { tTJSVariant result; tTJSVariant param[] = { tTJSVariant(control_.get(), control_.get()) }; tTJSVariant* p_param[] = { param + 0 }; sprig::krkr::tjs::FuncObjectCall( get_obj().get(), &result, 1, p_param, get_obj_this().get() ); set_result(result); } set_processing(false); }
// メソッドの呼び出し void TJSObject::caller(const FunctionCallbackInfo<Value>& args) { Isolate *isolate = args.GetIsolate(); HandleScope handle_scope(isolate); tTJSVariant self; if (getVariant(isolate, self, args.This())) { Local<Value> ret; // 引数変換 tjs_int argc = args.Length(); tTJSVariant **argv = new tTJSVariant*[argc]; for (tjs_int i=0;i<argc;i++) { argv[i] = new tTJSVariant(); *argv[i] = toVariant(isolate, args[i]); } if (self.AsObjectClosureNoAddRef().IsInstanceOf(0, NULL, NULL, L"Class", NULL) == TJS_S_TRUE) { // クラスオブジェクトならコンストラクタ呼び出し iTJSDispatch2 *instance = NULL; tjs_error error; if (TJS_SUCCEEDED(error = self.AsObjectClosureNoAddRef().CreateNew(0, NULL, NULL, &instance, argc, argv, NULL))) { ret = toJSValue(isolate, tTJSVariant(instance, instance)); instance->Release(); } else { ret = ERROR_KRKR(isolate, error); } } else { // メソッド呼び出し tTJSVariant result; tjs_error error; if (TJS_SUCCEEDED(error = self.AsObjectClosureNoAddRef().FuncCall(0, NULL, NULL, &result, argc, argv, NULL))) { ret = toJSValue(isolate, result); } else { ret = ERROR_KRKR(isolate, error); } } // 引数解放 if (argv) { for (int i=0;i<argc;i++) { delete argv[i]; } delete[] argv; } args.GetReturnValue().Set(ret); return; } args.GetReturnValue().Set(ERROR_BADINSTANCE(isolate)); }
// メソッドの呼び出し Handle<Value> TJSObject::caller(const Arguments& args) { tTJSVariant self; if (getVariant(self, args.This())) { Handle<Value> ret; // 引数変換 tjs_int argc = args.Length(); tTJSVariant **argv = new tTJSVariant*[argc]; for (tjs_int i=0;i<argc;i++) { argv[i] = new tTJSVariant(); *argv[i] = toVariant(args[i]); } if (self.AsObjectClosureNoAddRef().IsInstanceOf(0, NULL, NULL, L"Class", NULL) == TJS_S_TRUE) { // クラスオブジェクトならコンストラクタ呼び出し iTJSDispatch2 *instance = NULL; tjs_error error; if (TJS_SUCCEEDED(error = self.AsObjectClosureNoAddRef().CreateNew(0, NULL, NULL, &instance, argc, argv, NULL))) { ret = toJSValue(tTJSVariant(instance, instance)); instance->Release(); } else { ret = ERROR_KRKR(error); } } else { // メソッド呼び出し tTJSVariant result; tjs_error error; if (TJS_SUCCEEDED(error = self.AsObjectClosureNoAddRef().FuncCall(0, NULL, NULL, &result, argc, argv, NULL))) { ret = toJSValue(result); } else { ret = ERROR_KRKR(error); } } // 引数解放 if (argv) { for (int i=0;i<argc;i++) { delete argv[i]; } delete[] argv; } return ret; } return ERROR_BADINSTANCE(); }
KTL_INLINE tTJSVariant Archive::savePtINFO( boost::optional<tTVInteger> indent_char, boost::optional<tTVInteger> indent_count ) const { return tTJSVariant( instance_->savePtINFO( indent_char ? boost::optional<tjs_char>(boost::numeric_cast<tjs_char>(*indent_char)) : boost::none , indent_count ? boost::optional<NativeArchive::size_type>(boost::numeric_cast<NativeArchive::size_type>(*indent_count)) : boost::none )->c_str() ); }
/** * 吉里吉里に対して例外通知 */ void JSEXCEPTION(Isolate* isolate, TryCatch *try_catch) { HandleScope handle_scope(isolate); //HandleScope handle_scope; String::Value exception(try_catch->Exception()); Local<Message> message = try_catch->Message(); if (!message.IsEmpty()) { // 例外表示 String::Value filename(message->GetScriptResourceName()); ttstr msg; msg += *filename; msg += ":"; msg += tTJSVariant(message->GetLineNumber()); msg += ":"; msg += *exception; TVPAddLog(msg); // Print (filename):(line number): (message). String::Value sourceline(message->GetSourceLine()); TVPAddLog(ttstr(*sourceline)); // エラー行表示 ttstr wavy; int start = message->GetStartColumn(); for (int i = 0; i < start; i++) { wavy += " "; } int end = message->GetEndColumn(); for (int i = start; i < end; i++) { wavy +="^"; } TVPAddLog(wavy); // スタックトレース表示 String::Value stack_trace(try_catch->StackTrace()); if (stack_trace.length() > 0) { TVPAddLog(ttstr(*stack_trace)); } } TVPThrowExceptionMessage(*exception); }
/** * メンバ名一覧の取得 */ tjs_error TJS_INTF_METHOD ScriptsAdd::getKeys(tTJSVariant *result, tjs_int numparams, tTJSVariant **param, iTJSDispatch2 *objthis) { if (numparams < 1) return TJS_E_BADPARAMCOUNT; if (result) { iTJSDispatch2 *array = TJSCreateArrayObject(); DictMemberGetCaller *caller = new DictMemberGetCaller(array); tTJSVariantClosure closure(caller); param[0]->AsObjectClosureNoAddRef().EnumMembers(TJS_IGNOREPROP, &closure, NULL); caller->Release(); *result = tTJSVariant(array, array); array->Release(); } return TJS_S_OK; }
// // SUMMARY: 積分系メソッド // KTL_INLINE std::size_t NativeOdeint::integrate( tTJSVariantClosure const& system, tTJSVariantClosure const& start_state, time_type start_time, time_type end_time, time_type dt ) { System sys(system); state_type state; tjs_int const count = sprig::krkr::tjs::GetPropValue<tjs_int>(start_state, SPRIG_KRKR_TJS_W("count")); for (tjs_int i = 0; i != count; ++i) { state.push_back( sprig::krkr::tjs::GetPropValue<value_type>(start_state, i) ); } std::size_t ret = boost::numeric::odeint::integrate(sys, state, start_time, end_time, dt); for (tjs_int i = 0; i != count; ++i) { sprig::krkr::tjs::AddMember(start_state.Object, i, tTJSVariant(state[i])); } return ret; }
// // SUMMARY: Ptシリアライズ系メソッド // KTL_INLINE tTJSVariant Archive::savePtXML( boost::optional<tTVInteger> indent_char, boost::optional<tTVInteger> indent_count, tTJSVariantString const* encoding ) const { return tTJSVariant( instance_->savePtXML( indent_char ? boost::optional<tjs_char>(boost::numeric_cast<tjs_char>(*indent_char)) : boost::none , indent_count ? boost::optional<NativeArchive::size_type>(boost::numeric_cast<NativeArchive::size_type>(*indent_count)) : boost::none , encoding ? sprig::krkr::tjs::as_c_str(encoding) : 0 )->c_str() ); }
tTJSVariant stat() { if (!buffer) TVPThrowExceptionMessage(TJS_W("LongExposure.stat: not initialized")); MinMaxRGBA m; if (!_stat(m)) TVPThrowExceptionMessage(TJS_W("LongExposure.stat: invalid layer image")); ncbDictionaryAccessor rdic; tTJSVariant r; if (rdic.IsValid()) { rdic.SetValue(TJS_W("min_r"), (tTVInteger)m._min.r); rdic.SetValue(TJS_W("min_g"), (tTVInteger)m._min.g); rdic.SetValue(TJS_W("min_b"), (tTVInteger)m._min.b); rdic.SetValue(TJS_W("min_a"), (tTVInteger)m._min.a); rdic.SetValue(TJS_W("max_r"), (tTVInteger)m._max.r); rdic.SetValue(TJS_W("max_g"), (tTVInteger)m._max.g); rdic.SetValue(TJS_W("max_b"), (tTVInteger)m._max.b); rdic.SetValue(TJS_W("max_a"), (tTVInteger)m._max.a); r = tTJSVariant(rdic, rdic); } return r; }
KTL_INLINE tTJSVariant SpriteCoord::saveCoordTransByBinary() const { NativeSpriteCoord::binary_instance_type data(instance_->saveCoordTransByBinary()); return tTJSVariant(reinterpret_cast<tjs_uint8 const*>(&(*data)[0]), data->size()); }
KTL_INLINE tTJSVariant VariateRandom::distribution() const { sprig::krkr::tjs::object_type result = instance_->distribution(); return tTJSVariant(result.get(), result.get()); }
/** * 生成時の自己オブジェクトを取得 */ tTJSVariant PSD::getSelf() { return tTJSVariant(objthis, objthis); }
KTL_INLINE tTJSVariant SpriteCoord::saveCoordTransByXML() const { return tTJSVariant(instance_->saveCoordTransByXML()->c_str()); }
KTL_INLINE tTJSVariant NativeBigInt::asOctet() const { std::vector<tjs_uint8> bytes; sprig::get_bytes(value_, std::back_inserter(bytes)); return tTJSVariant(bytes.empty() ? 0 : &bytes[0], bytes.size()); }
/** * コンテキストの取得 */ tTJSVariant ScriptsAdd::getObjectContext(tTJSVariant obj) { iTJSDispatch2 *objthis = obj.AsObjectClosureNoAddRef().ObjThis; return tTJSVariant(objthis, objthis); }