Example #1
0
	KTL_INLINE void NativeArchive::loadPtINFO(tjs_char const* data) {
		std::basic_istringstream<tjs_char> is(data ? data : SPRIG_KRKR_TJS_W(""));
		{
			boost::property_tree::basic_ptree<serialization_string_type, serialization_string_type> pt;
			boost::property_tree::read_info(
				is,
				pt
				);
			element_stack_.loadPtArchive(pt);
		}
	}
Example #2
0
				SPRIG_INLINE void PropSetByNum(
					iTJSDispatch2* that,
					tjs_uint32 flag,
					tjs_int num,
					tTJSVariant const* param,
					iTJSDispatch2* objthis
					)
				{
					if (TJS_FAILED(that->PropSetByNum(flag, num, param, objthis))) {
						::TVPThrowExceptionMessage(SPRIG_KRKR_TJS_W("error in iTJSDispatch2::PropSetByNum()"));
					}
				}
Example #3
0
				SPRIG_INLINE tjs_int* GetCount(
					iTJSDispatch2* that,
					tjs_int *result,
					tjs_char const* membername,
					tjs_uint32* hint,
					iTJSDispatch2* objthis
					)
				{
					if (TJS_FAILED(that->GetCount(result, membername, hint, objthis))) {
						::TVPThrowExceptionMessage(SPRIG_KRKR_TJS_W("error in iTJSDispatch2::GetCount()"));
					}
					return result;
				}
Example #4
0
				SPRIG_INLINE tTJSVariant* PropGetByNum(
					iTJSDispatch2* that,
					tjs_uint32 flag,
					tjs_int num,
					tTJSVariant* result,
					iTJSDispatch2* objthis
					)
				{
					if (TJS_FAILED(that->PropGetByNum(flag, num, result, objthis))) {
						::TVPThrowExceptionMessage(SPRIG_KRKR_TJS_W("error in iTJSDispatch2::PropGetByNum()"));
					}
					return result;
				}
Example #5
0
				SPRIG_INLINE void PropSet(
					iTJSDispatch2* that,
					tjs_uint32 flag,
					tjs_char const* membername,
					tjs_uint32* hint,
					tTJSVariant const* param,
					iTJSDispatch2* objthis
					)
				{
					if (TJS_FAILED(that->PropSet(flag, membername, hint, param, objthis))) {
						::TVPThrowExceptionMessage(SPRIG_KRKR_TJS_W("error in iTJSDispatch2::PropSet()"));
					}
				}
Example #6
0
static void unregist_ktl_checksum() {
	SPRIG_KRKR_SECTION(SPRIG_KRKR_TJS_W("KTL:Checksum:unregist"), SPRIG_KRKR_LOG_LEVEL_NOTIFICATION);
	sprig::krkr::tjs::object_type global(::TVPGetScriptDispatch(), false);
	if (global) {
		sprig::krkr::tjs::DeleteMember(global, SPRIG_KRKR_TJS_W("SHA1"));
		sprig::krkr::tjs::DeleteMember(global, SPRIG_KRKR_TJS_W("MD5"));
		sprig::krkr::tjs::DeleteMember(global, SPRIG_KRKR_TJS_W("CRC_32"));
		sprig::krkr::tjs::DeleteMember(global, SPRIG_KRKR_TJS_W("CRC_XMODEM"));
		sprig::krkr::tjs::DeleteMember(global, SPRIG_KRKR_TJS_W("CRC_CCITT"));
		sprig::krkr::tjs::DeleteMember(global, SPRIG_KRKR_TJS_W("CRC_16"));
	}
}
Example #7
0
//
// regist_ktl_checksum
// unregist_ktl_checksum
//
static void regist_ktl_checksum() {
	SPRIG_KRKR_SECTION(SPRIG_KRKR_TJS_W("KTL:Checksum:regist"), SPRIG_KRKR_LOG_LEVEL_NOTIFICATION);
	sprig::krkr::tjs::object_type global(::TVPGetScriptDispatch(), false);
	if (global) {
		sprig::krkr::tjs::AddNewMember(global, SPRIG_KRKR_TJS_W("CRC_16"), ktl::CreateNativeClassCRC_16());
		sprig::krkr::tjs::AddNewMember(global, SPRIG_KRKR_TJS_W("CRC_CCITT"), ktl::CreateNativeClassCRC_CCITT());
		sprig::krkr::tjs::AddNewMember(global, SPRIG_KRKR_TJS_W("CRC_XMODEM"), ktl::CreateNativeClassCRC_XMODEM());
		sprig::krkr::tjs::AddNewMember(global, SPRIG_KRKR_TJS_W("CRC_32"), ktl::CreateNativeClassCRC_32());
		sprig::krkr::tjs::AddNewMember(global, SPRIG_KRKR_TJS_W("MD5"), ktl::CreateNativeClassMD5());
		sprig::krkr::tjs::AddNewMember(global, SPRIG_KRKR_TJS_W("SHA1"), ktl::CreateNativeClassSHA1());
	}
}
Example #8
0
				SPRIG_INLINE tTJSVariant* PropGet(
					iTJSDispatch2* that,
					tjs_uint32 flag,
					tjs_char const* membername,
					tjs_uint32* hint,
					tTJSVariant* result,
					iTJSDispatch2* objthis
					)
				{
					if (TJS_FAILED(that->PropGet(flag, membername, hint, result, objthis))) {
						::TVPThrowExceptionMessage(SPRIG_KRKR_TJS_W("error in iTJSDispatch2::PropGet()"));
					}
					return result;
				}
Example #9
0
	//
	//	SUMMARY: Ptシリアライズ系メソッド
	//
	KTL_INLINE NativeArchive::string_instance_type NativeArchive::savePtXML(
		boost::optional<tjs_char> indent_char,
		boost::optional<size_type> indent_count,
		tjs_char const* encoding
		) const
	{
		std::basic_ostringstream<tjs_char> os;
		{
			boost::property_tree::basic_ptree<serialization_string_type, serialization_string_type> pt;
			element_stack_.savePtArchive(pt);
			boost::property_tree::write_xml(
				os,
				pt,
				boost::property_tree::xml_writer_settings<std::basic_string<tjs_char> >(
					indent_char ? *indent_char : SPRIG_KRKR_TJS_W(' '),
					indent_count ? *indent_count : 4,
					encoding ? encoding : SPRIG_KRKR_TJS_W("UTF-16")
					)
				);
		}
		string_instance_type result(new serialization_string_type(os.str()));
		return result;
	}
Example #10
0
				SPRIG_INLINE void FuncCall(
					iTJSDispatch2* that,
					tjs_uint32 flag,
					tjs_char const* membername,
					tjs_uint32* hint,
					tTJSVariant* result,
					tjs_int numparams,
					tTJSVariant** param,
					iTJSDispatch2* objthis
					)
				{
					if (TJS_FAILED(that->FuncCall(flag, membername, hint, result, numparams, param, objthis))) {
						::TVPThrowExceptionMessage(SPRIG_KRKR_TJS_W("error in iTJSDispatch2::FuncCall()"));
					}
				}
Example #11
0
	tjs_error TJS_INTF_METHOD BigInt::Construct(
		tjs_int numparams,
		tTJSVariant** param,
		iTJSDispatch2* tjs_obj
		)
	{
		SPRIG_KRKR_SECTION(SPRIG_KRKR_TJS_W("BigInt::Construct"), SPRIG_KRKR_LOG_LEVEL_NORMAL);
		if (numparams >= 2) {
			instance_ = boost::make_shared<NativeBigInt>(*param[0], *param[1]);
		} else if (numparams >= 1) {
			instance_ = boost::make_shared<NativeBigInt>(*param[0]);
		} else {
			instance_ = boost::make_shared<NativeBigInt>();
		}
		return TJS_S_OK;
	}
Example #12
0
	//
	//	SUMMARY: シーク系メソッド
	//
	KTL_INLINE NativeStorageStream::int_type NativeStorageStream::seek(int_type offset, flag_type flag) {
		if (!stream_) {
			return -1;
		}
		LARGE_INTEGER move;
		move.QuadPart = offset;
		ULARGE_INTEGER new_pos;
		if (FAILED(stream_->Seek(move, flag, &new_pos))) {
			KTL_ERROR(
				KTL_ERROR_SECTION,
				SPRIG_KRKR_TJS_W("ファイルシークに失敗しました"),
				sprig::krkr::internal_error
				);
			return -1;
		}
		return static_cast<int_type>(new_pos.QuadPart);
	}
Example #13
0
	KTL_INLINE NativeStorageStream::int_type NativeStorageStream::writeBytes(byte_type const* data, size_type size) {
		if (!stream_) {
			return -1;
		}
		if (!size) {
			return size;
		}
		ULONG io_size = 0;
		if (FAILED(stream_->Write(data, size, &io_size))) {
			KTL_ERROR(
				KTL_ERROR_SECTION,
				SPRIG_KRKR_TJS_W("ファイル書込に失敗しました"),
				sprig::krkr::internal_error
				);
			return io_size;
		}
		return io_size;
	}
Example #14
0
	//
	//	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;
	}
Example #15
0
	bool NativeStorageStream::readBuffer(binary_type& buffer, size_type size) {
		if (!stream_) {
			return false;
		}
		if (!size) {
			buffer.clear();
			return true;
		}
		buffer.resize(size);
		ULONG io_size = 0;
		if (FAILED(stream_->Read(&buffer[0], size, &io_size))) {
			KTL_ERROR(
				KTL_ERROR_SECTION,
				SPRIG_KRKR_TJS_W("ファイル読込に失敗しました"),
				sprig::krkr::internal_error
				);
			return false;
		}
		return true;
	}
Example #16
0
	KTL_INLINE NativeArchive::string_instance_type NativeArchive::savePtINFO(
		boost::optional<tjs_char> indent_char,
		boost::optional<size_type> indent_count
		) const
	{
		std::basic_ostringstream<tjs_char> os;
		{
			boost::property_tree::basic_ptree<serialization_string_type, serialization_string_type> pt;
			element_stack_.savePtArchive(pt);
			boost::property_tree::write_info(
				os,
				pt,
				boost::property_tree::info_writer_settings<tjs_char>(
					indent_char ? *indent_char : SPRIG_KRKR_TJS_W(' '),
					indent_count ? *indent_count : 4
					)
				);
		}
		string_instance_type result(new serialization_string_type(os.str()));
		return result;
	}
Example #17
0
	tjs_error TJS_INTF_METHOD VariateRandom::Construct(
		tjs_int numparams,
		tTJSVariant** param,
		iTJSDispatch2* tjs_obj
		)
	{
		SPRIG_KRKR_SECTION(SPRIG_KRKR_TJS_W("VariateRandom::Construct"), SPRIG_KRKR_LOG_LEVEL_NORMAL);
		if (numparams >= 2) {
			SPRIG_KRKR_TYPE_CHECK(0, tvtObject);
			SPRIG_KRKR_TYPE_CHECK(1, tvtObject);
			instance_ = boost::make_shared<NativeVariateRandom>(
				param[0]->AsObjectNoAddRef(),
				param[1]->AsObjectNoAddRef()
				);
		} else if (numparams >= 1) {
			SPRIG_KRKR_TYPE_CHECK(0, tvtObject);
			instance_ = boost::make_shared<NativeVariateRandom>(
				param[0]->AsObjectNoAddRef()
				);
		} else {
			instance_ = boost::make_shared<NativeVariateRandom>();
		}
		return TJS_S_OK;
	}
	void TJS_INTF_METHOD LayeredSplashWindow::Invalidate() {
		SPRIG_KRKR_SECTION(SPRIG_KRKR_TJS_W("LayeredSplashWindow::Invalidate"), SPRIG_KRKR_LOG_LEVEL_NORMAL);
		instance_.reset();
	}
Example #19
0
	void TJS_INTF_METHOD StorageStream::Invalidate() {
		SPRIG_KRKR_SECTION(SPRIG_KRKR_TJS_W("StorageStream::Invalidate"), SPRIG_KRKR_LOG_LEVEL_NORMAL);
		instance_.reset();
	}
Example #20
0
	void TJS_INTF_METHOD BigInt::Invalidate() {
		SPRIG_KRKR_SECTION(SPRIG_KRKR_TJS_W("BigInt::Invalidate"), SPRIG_KRKR_LOG_LEVEL_NORMAL);
		instance_.reset();
	}
Example #21
0
	SPRIG_KRKR_SECTION(SPRIG_KRKR_TJS_W("KTL:Checksum:regist"), SPRIG_KRKR_LOG_LEVEL_NOTIFICATION);
	sprig::krkr::tjs::object_type global(::TVPGetScriptDispatch(), false);
	if (global) {
		sprig::krkr::tjs::AddNewMember(global, SPRIG_KRKR_TJS_W("CRC_16"), ktl::CreateNativeClassCRC_16());
		sprig::krkr::tjs::AddNewMember(global, SPRIG_KRKR_TJS_W("CRC_CCITT"), ktl::CreateNativeClassCRC_CCITT());
		sprig::krkr::tjs::AddNewMember(global, SPRIG_KRKR_TJS_W("CRC_XMODEM"), ktl::CreateNativeClassCRC_XMODEM());
		sprig::krkr::tjs::AddNewMember(global, SPRIG_KRKR_TJS_W("CRC_32"), ktl::CreateNativeClassCRC_32());
		sprig::krkr::tjs::AddNewMember(global, SPRIG_KRKR_TJS_W("MD5"), ktl::CreateNativeClassMD5());
		sprig::krkr::tjs::AddNewMember(global, SPRIG_KRKR_TJS_W("SHA1"), ktl::CreateNativeClassSHA1());
	}
}
static void unregist_ktl_checksum() {
	SPRIG_KRKR_SECTION(SPRIG_KRKR_TJS_W("KTL:Checksum:unregist"), SPRIG_KRKR_LOG_LEVEL_NOTIFICATION);
	sprig::krkr::tjs::object_type global(::TVPGetScriptDispatch(), false);
	if (global) {
		sprig::krkr::tjs::DeleteMember(global, SPRIG_KRKR_TJS_W("SHA1"));
		sprig::krkr::tjs::DeleteMember(global, SPRIG_KRKR_TJS_W("MD5"));
		sprig::krkr::tjs::DeleteMember(global, SPRIG_KRKR_TJS_W("CRC_32"));
		sprig::krkr::tjs::DeleteMember(global, SPRIG_KRKR_TJS_W("CRC_XMODEM"));
		sprig::krkr::tjs::DeleteMember(global, SPRIG_KRKR_TJS_W("CRC_CCITT"));
		sprig::krkr::tjs::DeleteMember(global, SPRIG_KRKR_TJS_W("CRC_16"));
	}
}
NCB_POST_REGIST_CALLBACK(regist_ktl_checksum);
NCB_PRE_UNREGIST_CALLBACK(unregist_ktl_checksum);

//
// information
//
KTL_INFORMATION(SPRIG_KRKR_TJS_W("KTL:Checksum:information"));
Example #22
0
	void TJS_INTF_METHOD VariateRandom::Invalidate() {
		SPRIG_KRKR_SECTION(SPRIG_KRKR_TJS_W("VariateRandom::Invalidate"), SPRIG_KRKR_LOG_LEVEL_NORMAL);
		instance_.reset();
	}
Example #23
0
	SPRIG_KRKR_END_CREATE_NATIVE_CLASS();
#undef TJS_NATIVE_CLASSID_NAME
}	// namespace ktl

//
// regist_ktl_system_info
// unregist_ktl_system_info
//
static void regist_ktl_system_info() {
	SPRIG_KRKR_SECTION(SPRIG_KRKR_TJS_W("KTL:SystemInfo:regist"), SPRIG_KRKR_LOG_LEVEL_NOTIFICATION);
	sprig::krkr::tjs::object_type global(::TVPGetScriptDispatch(), false);
	if (global) {
		sprig::krkr::tjs::AddNewMember(global, SPRIG_KRKR_TJS_W("SystemInfo"), ktl::CreateNativeClassSystemInfo());
	}
}
static void unregist_ktl_system_info() {
	SPRIG_KRKR_SECTION(SPRIG_KRKR_TJS_W("KTL:SystemInfo:unregist"), SPRIG_KRKR_LOG_LEVEL_NOTIFICATION);
	sprig::krkr::tjs::object_type global(::TVPGetScriptDispatch(), false);
	if (global) {
		sprig::krkr::tjs::DeleteMember(global, SPRIG_KRKR_TJS_W("SystemInfo"));
	}
}
NCB_POST_REGIST_CALLBACK(regist_ktl_system_info);
NCB_PRE_UNREGIST_CALLBACK(unregist_ktl_system_info);

//
// information
//
KTL_INFORMATION(SPRIG_KRKR_TJS_W("KTL:SystemInfo:information"));
Example #24
0
	SPRIG_KRKR_END_NATIVE_METHOD_DECL(saveStruct);

	SPRIG_KRKR_END_CREATE_NATIVE_CLASS();
#undef TJS_NATIVE_CLASSID_NAME
}	// namespace ktl

//
// regist_ktl_utils, unregist_ktl_utils
//
static void regist_ktl_utils() {
	SPRIG_KRKR_SECTION(SPRIG_KRKR_TJS_W("KTL:Utils:regist"), SPRIG_KRKR_LOG_LEVEL_NOTIFICATION);
	sprig::krkr::tjs::object_type global(::TVPGetScriptDispatch(), false);
	if (global) {
		sprig::krkr::tjs::AddNewMember(global, SPRIG_KRKR_TJS_W("Utils"), ktl::CreateNativeClassUtils());
	}
}
static void unregist_ktl_utils() {
	SPRIG_KRKR_SECTION(SPRIG_KRKR_TJS_W("KTL:Utils:unregist"), SPRIG_KRKR_LOG_LEVEL_NOTIFICATION);
	sprig::krkr::tjs::object_type global(::TVPGetScriptDispatch(), false);
	if (global) {
		sprig::krkr::tjs::DeleteMember(global, SPRIG_KRKR_TJS_W("Utils"));
	}
}
NCB_POST_REGIST_CALLBACK(regist_ktl_utils);
NCB_PRE_UNREGIST_CALLBACK(unregist_ktl_utils);

//
// information
//
KTL_INFORMATION(SPRIG_KRKR_TJS_W("KTL:Utils:information"));
Example #25
0
	SPRIG_KRKR_END_CREATE_NATIVE_CLASS();
#undef TJS_NATIVE_CLASSID_NAME
}	// namespace ktl

//
// regist_ktl_inflate
// unregist_ktl_inflate
//
static void regist_ktl_inflate() {
	SPRIG_KRKR_SECTION(SPRIG_KRKR_TJS_W("KTL:Inflate:regist"), SPRIG_KRKR_LOG_LEVEL_NOTIFICATION);
	sprig::krkr::tjs::object_type global(::TVPGetScriptDispatch(), false);
	if (global) {
		sprig::krkr::tjs::AddNewMember(global, SPRIG_KRKR_TJS_W("Inflate"), ktl::CreateNativeClassInflate());
	}
}
static void unregist_ktl_inflate() {
	SPRIG_KRKR_SECTION(SPRIG_KRKR_TJS_W("KTL:Inflate:unregist"), SPRIG_KRKR_LOG_LEVEL_NOTIFICATION);
	sprig::krkr::tjs::object_type global(::TVPGetScriptDispatch(), false);
	if (global) {
		sprig::krkr::tjs::DeleteMember(global, SPRIG_KRKR_TJS_W("Inflate"));
	}
}
NCB_POST_REGIST_CALLBACK(regist_ktl_inflate);
NCB_PRE_UNREGIST_CALLBACK(unregist_ktl_inflate);

//
// information
//
KTL_INFORMATION(SPRIG_KRKR_TJS_W("KTL:Inflate:information"));
Example #26
0
	SPRIG_KRKR_END_CREATE_NATIVE_CLASS();
#undef TJS_NATIVE_CLASSID_NAME
}	// namespace ktl

//
// regist_ktl_fps_counter
// unregist_ktl_fps_counter
//
static void regist_ktl_fps_counter() {
	SPRIG_KRKR_SECTION(SPRIG_KRKR_TJS_W("KTL:FPSCounter:regist"), SPRIG_KRKR_LOG_LEVEL_NOTIFICATION);
	sprig::krkr::tjs::object_type global(::TVPGetScriptDispatch(), false);
	if (global) {
		sprig::krkr::tjs::AddNewMember(global, SPRIG_KRKR_TJS_W("FPSCounter"), ktl::CreateNativeClassFPSCounter());
	}
}
static void unregist_ktl_fps_counter() {
	SPRIG_KRKR_SECTION(SPRIG_KRKR_TJS_W("KTL:FPSCounter:unregist"), SPRIG_KRKR_LOG_LEVEL_NOTIFICATION);
	sprig::krkr::tjs::object_type global(::TVPGetScriptDispatch(), false);
	if (global) {
		sprig::krkr::tjs::DeleteMember(global, SPRIG_KRKR_TJS_W("FPSCounter"));
	}
}
NCB_POST_REGIST_CALLBACK(regist_ktl_fps_counter);
NCB_PRE_UNREGIST_CALLBACK(unregist_ktl_fps_counter);

//
// information
//
KTL_INFORMATION(SPRIG_KRKR_TJS_W("KTL:FPSCounter:information"));
Example #27
0
	void TJS_INTF_METHOD SpriteCoord::Invalidate() {
		SPRIG_KRKR_SECTION(SPRIG_KRKR_TJS_W("SpriteCoord::Invalidate"), SPRIG_KRKR_LOG_LEVEL_NORMAL);
		instance_.reset();
	}
Example #28
0
	SPRIG_KRKR_END_CREATE_NATIVE_CLASS();
#undef TJS_NATIVE_CLASSID_NAME
}	// namespace ktl

//
// regist_ktl_inflate
// unregist_ktl_inflate
//
static void regist_ktl_inflate() {
	SPRIG_KRKR_SECTION(SPRIG_KRKR_TJS_W("KTL:Bzip2Decompressor:regist"), SPRIG_KRKR_LOG_LEVEL_NOTIFICATION);
	sprig::krkr::tjs::object_type global(::TVPGetScriptDispatch(), false);
	if (global) {
		sprig::krkr::tjs::AddNewMember(global, SPRIG_KRKR_TJS_W("Bzip2Decompressor"), ktl::CreateNativeClassBzip2Decompressor());
	}
}
static void unregist_ktl_inflate() {
	SPRIG_KRKR_SECTION(SPRIG_KRKR_TJS_W("KTL:Bzip2Decompressor:unregist"), SPRIG_KRKR_LOG_LEVEL_NOTIFICATION);
	sprig::krkr::tjs::object_type global(::TVPGetScriptDispatch(), false);
	if (global) {
		sprig::krkr::tjs::DeleteMember(global, SPRIG_KRKR_TJS_W("Bzip2Decompressor"));
	}
}
NCB_POST_REGIST_CALLBACK(regist_ktl_inflate);
NCB_PRE_UNREGIST_CALLBACK(unregist_ktl_inflate);

//
// information
//
KTL_INFORMATION(SPRIG_KRKR_TJS_W("KTL:Bzip2Decompressor:information"));
Example #29
0
		PTIndexTable()
			: prefix_(SPRIG_KRKR_TJS_W("_"))
		{}