当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript emscripten-library-decorator.dep函数代码示例

本文整理汇总了TypeScript中emscripten-library-decorator.dep函数的典型用法代码示例。如果您正苦于以下问题:TypeScript dep函数的具体用法?TypeScript dep怎么用?TypeScript dep使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了dep函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: _nbind_register_function

	@dep('_nbind', '_removeAccessorPrefix')
	static _nbind_register_function(
		boundID: number,
		policyListPtr: number,
		typeListPtr: number,
		typeCount: number,
		ptr: number,
		direct: number,
		signatureType: SignatureType,
		namePtr: number,
		num: number,
		flags: TypeFlags
	) {
		const bindClass = _nbind.getType(boundID) as _class.BindClass;
		const policyTbl = _nbind.readPolicyList(policyListPtr);
		const typeList = _nbind.readTypeIdList(typeListPtr, typeCount);

		let specList: _class.MethodSpec[];

		if(signatureType == SignatureType.construct) {
			specList = [{
				direct: ptr,
				name: '__nbindConstructor',
				ptr: 0,
				title: bindClass.name + ' constructor',
				typeList: ['uint32_t'].concat(typeList.slice(1))
			}, {
				direct: direct,
				name: '__nbindValueConstructor',
				ptr: 0,
				title: bindClass.name + ' value constructor',
				typeList: ['void', 'uint32_t'].concat(typeList.slice(1))
			}];
		} else {
			let name = _nbind.readAsciiString(namePtr);
			const title = (bindClass.name && bindClass.name + '.') + name;

			if(signatureType == SignatureType.getter || signatureType == SignatureType.setter) {
				name = _removeAccessorPrefix(name);
			}

			specList = [{
				boundID: boundID,
				direct: direct,
				name: name,
				ptr: ptr,
				title: title,
				typeList: typeList
			}];
		}

		for(let spec of specList) {
			spec.signatureType = signatureType;
			spec.policyTbl = policyTbl;
			spec.num = num;
			spec.flags = flags;

			bindClass.addMethod(spec);
		}
	}
开发者ID:charto,项目名称:nbind,代码行数:60,代码来源:em-api.ts

示例2: _nbind_register_primitive

	@dep('_nbind')
	static _nbind_register_primitive(id: number, size: number, flag: number) {
		const isSignless = flag & 16;
		const isConst    = flag & 8;
		const isPointer  = flag & 4;
		const isFloat    = flag & 2;
		const isUnsigned = flag & 1;

		let name = isConst ? 'const ' : '';

		if(isSignless) {
			name += 'char';
		} else if(isPointer) {
			if(isUnsigned) name += 'un';
			name += 'signed char';
		} else {
			name += (
				(isUnsigned ? 'u' : '') +
				(isFloat ? 'float' : 'int') +
				(size * 8 + '_t')
			);
		}

		if(isPointer) {
			// tslint:disable-next-line:no-unused-expression
			new _nbind.CStringType(id, name + ' *');
		} else if(size == 8 && !isFloat) {
			// tslint:disable-next-line:no-unused-expression
			new _nbind.Int64Type(id, name);
		} else {
			// tslint:disable-next-line:no-unused-expression
			new _nbind.PrimitiveType(id, name, size, !!isUnsigned, !!isFloat);
		}
	}
开发者ID:wonism,项目名称:nbind,代码行数:34,代码来源:em-api.ts

示例3: _nbind_register_function

	@dep('_nbind')
	static _nbind_register_function(
		typeID: number,
		policyListPtr: number,
		typeListPtr: number,
		typeCount: number,
		ptr: number,
		namePtr: number,
		num: number,
		direct: number
	) {
		const name = _nbind.readAsciiString(namePtr);
		const policyTbl = _nbind.readPolicyList(policyListPtr);
		const typeList = _nbind.readTypeIdList(typeListPtr, typeCount);
		let target: any;

		if(typeID) {
			target = (_nbind.typeList[typeID] as _class.BindClass).proto;
		} else {
			target = Module;
		}

		_nbind.addMethod(
			target,
			name,
			_nbind.makeCaller(ptr, num, direct, typeList, policyTbl),
			typeCount - 1
		);
	}
开发者ID:wonism,项目名称:nbind,代码行数:29,代码来源:em-api.ts

示例4: _nbind_register_constructor

	@dep('_nbind')
	static _nbind_register_constructor(
		typeID: number,
		typeListPtr: number,
		typeCount: number,
		ptr: number,
		ptrValue: number
	) {
		const typeList = _nbind.readTypeIdList(typeListPtr, typeCount);
		const proto = (_nbind.typeList[typeID] as _class.BindClass).proto.prototype;

		// The constructor returns a pointer to the new object.
		// It fits in uint32_t.

		typeList[0] = 'uint32_t';

		_nbind.addMethod(
			proto,
			'__nbindConstructor',
			_nbind.makeCaller(null, 0, ptr, typeList),
			typeCount - 1
		);

		// First argument is a pointer to the C++ object to construct in place.
		// It fits in uint32_t.

		typeList.splice(0, 1, 'void', 'uint32_t');

		_nbind.addMethod(
			proto,
			'__nbindValueConstructor',
			_nbind.makeCaller(null, 0, ptrValue, typeList),
			typeCount
		);
	}
开发者ID:Esauromano,项目名称:nbind,代码行数:35,代码来源:em-api.ts

示例5: _nbind_register_destructor

	@dep('_nbind')
	static _nbind_register_destructor(typeID: number, ptr: number) {
		_nbind.addMethod(
			(_nbind.typeList[typeID] as _class.BindClass).proto.prototype,
			'free',
			_nbind.makeMethodCaller(ptr, 0, typeID, ['void'], null),
			0
		);
	}
开发者ID:wonism,项目名称:nbind,代码行数:9,代码来源:em-api.ts

示例6: _nbind_register_primitive

	@dep('_nbind')
	static _nbind_register_primitive(id: number, size: number, flags: number) {
		const spec = {
			flags: TypeFlags.isArithmetic | flags,
			id: id,
			ptrSize: size
		};

		_nbind.makeType(_nbind.constructType, spec);
	}
开发者ID:charto,项目名称:nbind,代码行数:10,代码来源:em-api.ts

示例7: _nbind_register_method_getter_setter_id

	@dep('_nbind')
	static _nbind_register_method_getter_setter_id(
		methodID: number,
		getterID: number,
		setterID: number
	) {
		_nbind.MethodType.method = methodID;
		_nbind.MethodType.getter = getterID;
		_nbind.MethodType.setter = setterID;
	}
开发者ID:Esauromano,项目名称:nbind,代码行数:10,代码来源:em-api.ts

示例8: _nbind_register_pool

	@dep('_nbind')
	static _nbind_register_pool(
		pageSize: number,
		usedPtr: number,
		rootPtr: number,
		pagePtr: number
	) {
		_nbind.Pool.pageSize = pageSize;
		_nbind.Pool.usedPtr = usedPtr / 4;
		_nbind.Pool.rootPtr = rootPtr;
		_nbind.Pool.pagePtr = pagePtr / 4;

		HEAP32[usedPtr / 4] = 0x01020304;
		if(HEAP8[usedPtr] == 1) _nbind.bigEndian = true;
		HEAP32[usedPtr / 4] = 0;

		_nbind.makeTypeKindTbl = {
			[TypeFlags.isArithmetic]: _nbind.PrimitiveType,
			[TypeFlags.isBig]: _nbind.Int64Type,
			[TypeFlags.isClass]: _nbind.BindClass,
			[TypeFlags.isClassPtr]: _nbind.BindClassPtr,
			[TypeFlags.isSharedClassPtr]: _nbind.SharedClassPtr,
			[TypeFlags.isVector]: _nbind.ArrayType,
			[TypeFlags.isArray]: _nbind.ArrayType,
			[TypeFlags.isCString]: _nbind.CStringType,
			[TypeFlags.isCallback]: _nbind.CallbackType,
			[TypeFlags.isOther]: _nbind.BindType
		};

		_nbind.makeTypeNameTbl = {
			'Buffer': _nbind.BufferType,
			'External': _nbind.ExternalType,
			'Int64': _nbind.Int64Type,
			'_nbind_new': _nbind.CreateValueType,
			'bool': _nbind.BooleanType,
			// 'cbFunction': _nbind.CallbackType,
			'cbFunction &': _nbind.CallbackType,
			'const cbFunction &': _nbind.CallbackType,
			'const std::string &': _nbind.StringType,
			'std::string': _nbind.StringType
		};

		Module['toggleLightGC'] = _nbind.toggleLightGC;
		_nbind.callUpcast = Module['dynCall_ii'];

		const globalScope = _nbind.makeType(_nbind.constructType, {
			flags: TypeFlags.isClass,
			id: 0,
			name: ''
		}) as _class.BindClass;

		globalScope.proto = Module as any;
		_nbind.BindClass.list.push(globalScope);
	}
开发者ID:charto,项目名称:nbind,代码行数:54,代码来源:em-api.ts

示例9: _nbind_register_type

	@dep('_nbind', '_typeModule')
	static _nbind_register_type(id: number, namePtr: number) {
		const name = _nbind.readAsciiString(namePtr);

		const spec = {
			flags: TypeFlags.isOther,
			id: id,
			name: name
		};

		_nbind.makeType(_nbind.constructType, spec);
	}
开发者ID:charto,项目名称:nbind,代码行数:12,代码来源:em-api.ts

示例10: _nbind_register_pool

	@dep('_nbind')
	static _nbind_register_pool(
		pageSize: number,
		usedPtr: number,
		rootPtr: number,
		pagePtr: number
	) {
		_nbind.Pool.pageSize = pageSize;
		_nbind.Pool.usedPtr = usedPtr / 4;
		_nbind.Pool.rootPtr = rootPtr;
		_nbind.Pool.pagePtr = pagePtr / 4;
	}
开发者ID:wonism,项目名称:nbind,代码行数:12,代码来源:em-api.ts


注:本文中的emscripten-library-decorator.dep函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。