コード例 #1
0
ファイル: ObjectDesc.py プロジェクト: jmingtan/tpclient-ogre
	def pack_callback(arg):
		output = ""
		for name, id, description, extra in arg:
			extra = dict(extra)
			output += pack('SIS', name, id, description)
			if ObjectParamsStructDesc.has_key(id):
				for substruct, name, description in ObjectParamsStructDesc[id]:
					output += pack(substruct, extra.pop(name))

			if len(extra) > 0:
				raise TypeError("There was left over extra stuff...")
		return output
コード例 #2
0
ファイル: ObjectDesc.py プロジェクト: jmingtan/tpclient-ogre
	def struct_callback(s):
		(name, id, description), s = unpack('SIS', s)

		if ObjectParamsStructDesc.has_key(id):
			output_extra = {}
			for substruct, ename, edescription in ObjectParamsStructDesc[id]:
				o, s = unpack(substruct, s)
				output_extra[ename] = o
			output = [name, id, description, output_extra]
		else:
			output = [name, id, description, {}]

		return output, s