Esempio n. 1
0
	def iguana_get_info_for_bitfield_type(self, thetype):
		debug_iguana_generator("bitfield - %s" % thetype.name)
		# FIXME: Perhaps formalise this interface?
		real_type = thetype.basic_type_inst
		real_type_info = self.iguana_get_info_for_random_type(real_type)
		# FIXME: For some reason GCC ignores the original type 
		# of bitfields and just treats them all as ints (?):
		return ('i', real_type_info[1], real_type_info[2])
Esempio n. 2
0
 def iguana_get_info_for_bitfield_type(self, thetype):
     debug_iguana_generator("bitfield - %s" % thetype.name)
     # FIXME: Perhaps formalise this interface?
     real_type = thetype.basic_type_inst
     real_type_info = self.iguana_get_info_for_random_type(real_type)
     # FIXME: For some reason GCC ignores the original type
     # of bitfields and just treats them all as ints (?):
     return ("i", real_type_info[1], real_type_info[2])
Esempio n. 3
0
 def iguana_get_info_for_constructed_type(self, thetype):
     # FIXME: Seedy knowledge of other classes as per bitfield_type?
     debug_iguana_generator("constructed - %s" % thetype.name)
     format_string_list = []
     description_list = []
     access_list = []
     for member in thetype.members_inst:
         new_fmtstring_list, new_desc_list, new_ac_list = self.iguana_get_info_for_random_type(member)
         format_string_list.extend(new_fmtstring_list)
         # 			if isinstance (thetype, builtin.IDLTypeUnionBase):
         # 				description_list.extend(new_desc_list)
         # 				access_list.extend(new_ac_list)
         # 			else:
         # Not an union class; we need to pass through it...
         description_list.extend(["%s.%s" % (thetype.var_name, desc) for desc in new_desc_list])
         access_list.extend(["%s.%s" % (thetype.var_name, ac) for ac in new_ac_list])
     return (format_string_list, description_list, access_list)
Esempio n. 4
0
	def iguana_get_info_for_random_type(self, thetype):
		debug_iguana_generator("random - %s" % thetype.name)
		# We understand four fundamental types of types: simple, bitfield, alias, and constructed.
		if isinstance(thetype, builtin.IDLTypeBitfieldMemberBase):
			# No wuzzas.
			return self.iguana_get_info_for_bitfield_type(thetype)
		elif isinstance(thetype, idltype.IDLTypeSimple):
			# Still no wuzzas.
			return self.iguana_get_info_for_simple_type(thetype)
		elif isinstance(thetype, idltype.IDLTypeAlias):
			# No real wuzzas.
			return self.iguana_get_info_for_alias_type(thetype)
		elif isinstance(thetype, idltype.IDLTypeConstructed):
			# Okay, now we have wuzzas.
			return self.iguana_get_info_for_constructed_type(thetype)
		else:
			# Too many wuzzas.
			raise Exception("Unknown idl type-type %s" % (type(thetype)))
Esempio n. 5
0
	def iguana_get_info_for_constructed_type(self, thetype):
		# FIXME: Seedy knowledge of other classes as per bitfield_type?
		debug_iguana_generator("constructed - %s" % thetype.name)
		format_string_list = []
		description_list = []
		access_list = []
		for member in thetype.members_inst:
			new_fmtstring_list, new_desc_list, new_ac_list \
				= self.iguana_get_info_for_random_type(member)
			format_string_list.extend(new_fmtstring_list)
#			if isinstance (thetype, builtin.IDLTypeUnionBase):
#				description_list.extend(new_desc_list)
#				access_list.extend(new_ac_list)
#			else:
			# Not an union class; we need to pass through it...
			description_list.extend(['%s.%s' % (thetype.var_name, desc) for desc in new_desc_list])
			access_list.extend(['%s.%s' % (thetype.var_name, ac) for ac in new_ac_list])
		return (format_string_list, description_list, access_list)
Esempio n. 6
0
 def iguana_get_info_for_random_type(self, thetype):
     debug_iguana_generator("random - %s" % thetype.name)
     # We understand four fundamental types of types: simple, bitfield, alias, and constructed.
     if isinstance(thetype, builtin.IDLTypeBitfieldMemberBase):
         # No wuzzas.
         return self.iguana_get_info_for_bitfield_type(thetype)
     elif isinstance(thetype, idltype.IDLTypeSimple):
         # Still no wuzzas.
         return self.iguana_get_info_for_simple_type(thetype)
     elif isinstance(thetype, idltype.IDLTypeAlias):
         # No real wuzzas.
         return self.iguana_get_info_for_alias_type(thetype)
     elif isinstance(thetype, idltype.IDLTypeConstructed):
         # Okay, now we have wuzzas.
         return self.iguana_get_info_for_constructed_type(thetype)
     else:
         # Too many wuzzas.
         raise Exception("Unknown idl type-type %s" % (type(thetype)))
Esempio n. 7
0
	def iguana_generate_calling_parameter_string(self):
		# Make life easier by doing this here rather than in the template.
		# Basically we want to print each parameter out using printf. To
		# do this gets complicated if we have complicated structures.
		# We want three lists:
		format_string_list = [] # - List of format specifiers ['%d', '%f']
		description_list = [] # - List of param names ['struct.p1', 'struct.p2']
		access_list = [] # - List of dereferences to get to the data ['struct.p1', 'struct.p2']
		for param in self.output.context.function.call_params:
			if self.satisfactory_param(param):
				thetype = param['idltype']
				debug_iguana_generator('* Decoding new type')
				new_format_string_list, new_description_list, new_access_list \
					= self.iguana_get_info_for_random_type(thetype)
				debug_iguana_generator("  decoded to %s" % new_access_list)
				format_string_list.extend(new_format_string_list)
				description_list.extend(new_description_list)
				access_list.extend(new_access_list)
		return format_string_list, description_list, access_list
Esempio n. 8
0
 def iguana_generate_calling_parameter_string(self):
     # Make life easier by doing this here rather than in the template.
     # Basically we want to print each parameter out using printf. To
     # do this gets complicated if we have complicated structures.
     # We want three lists:
     format_string_list = []  # - List of format specifiers ['%d', '%f']
     description_list = []  # - List of param names ['struct.p1', 'struct.p2']
     access_list = []  # - List of dereferences to get to the data ['struct.p1', 'struct.p2']
     for param in self.output.context.function.call_params:
         if self.satisfactory_param(param):
             thetype = param["idltype"]
             debug_iguana_generator("* Decoding new type")
             new_format_string_list, new_description_list, new_access_list = self.iguana_get_info_for_random_type(
                 thetype
             )
             debug_iguana_generator("  decoded to %s" % new_access_list)
             format_string_list.extend(new_format_string_list)
             description_list.extend(new_description_list)
             access_list.extend(new_access_list)
     return format_string_list, description_list, access_list
Esempio n. 9
0
	def iguana_get_info_for_alias_type(self, thetype):
		debug_iguana_generator("alias - %s" % thetype.name)
		real_type = thetype.real_type_instance
		return self.iguana_get_info_for_random_type(real_type)
Esempio n. 10
0
	def iguana_get_info_for_simple_type(self, thetype):
		debug_iguana_generator("basic - %s" % thetype.name)
		format_string = basic_conversions[thetype.name]
		access = thetype.var_name
		description = thetype.var_name
		return ([format_string], [description], [access])
Esempio n. 11
0
 def iguana_get_info_for_alias_type(self, thetype):
     debug_iguana_generator("alias - %s" % thetype.name)
     real_type = thetype.real_type_instance
     return self.iguana_get_info_for_random_type(real_type)
Esempio n. 12
0
 def iguana_get_info_for_simple_type(self, thetype):
     debug_iguana_generator("basic - %s" % thetype.name)
     format_string = basic_conversions[thetype.name]
     access = thetype.var_name
     description = thetype.var_name
     return ([format_string], [description], [access])