languages/gen_h.py
def __write_structure_bitfields(self, decls, bitFieldWidth):
		""" 
		Create structure declaration with bitfields.
		Arguments:
			decls			List of declarations describing the structure 
							elements
			bitFieldWidth 	Width of the bitfield to create
		"""
		# Copy the list of declarations and insert the reserved values
		# check if we reached the full width in the end
		# Add one dummy element at the end of the list so that we dont have
		# to solve the special case of the interval between last element and
		# end of the bitfield
		tmp = copy.copy(decls)
		index = 0
		tmp.append(copy.copy(tmp[-1]))
		tmp[-1].bitIndex = bitFieldWidth
		for item in tmp:
			if (item.bitIndex > index):
				index = self.__insert_rsvd_bitfield(tmp, item, index)
			else:
				index = index + item.bitWidth
		tmp.remove(tmp[-1])
		
		# Write bitfield values
		if (len(tmp) > 1):
			self.__wr_line("#ifdef __LITTLE_ENDIAN_BITFIELD\n")
		for decl in sorted(tmp , key=lambda a: a.bitIndex):
			self.write_decl(decl)
		if (len(tmp) > 1):
			self.__wr_line("#else\n")
			for decl in sorted(tmp , key=lambda a: a.bitIndex, reverse=True):
				backUp = decl.comment
				decl.comment = None
				self.write_decl(decl)
				decl.comment = backUp
			self.__wr_line("#endif\n")
 
		Create structure declaration with bitfields.
		Arguments:
			decls			List of declarations describing the structure 
							elements
			bitFieldWidth 	Width of the bitfield to create
		
Create structure declaration with bitfields.
Arguments:
decls                   List of declarations describing the structure
elements
bitFieldWidth   Width of the bitfield to create
Create structure declaration with bitfields . Arguments : decls List of declarations describing the structure elements bitFieldWidth Width of the bitfield to create
def __write_structure_bitfields(self, decls, bitFieldWidth):
		tmp = copy.copy(decls)
		index = 0
		tmp.append(copy.copy(tmp[-1]))
		tmp[-1].bitIndex = bitFieldWidth
		for item in tmp:
			if (item.bitIndex > index):
				index = self.__insert_rsvd_bitfield(tmp, item, index)
			else:
				index = index + item.bitWidth
		tmp.remove(tmp[-1])
		if (len(tmp) > 1):
			self.__wr_line("#ifdef __LITTLE_ENDIAN_BITFIELD\n")
		for decl in sorted(tmp , key=lambda a: a.bitIndex):
			self.write_decl(decl)
		if (len(tmp) > 1):
			self.__wr_line("#else\n")
			for decl in sorted(tmp , key=lambda a: a.bitIndex, reverse=True):
				backUp = decl.comment
				decl.comment = None
				self.write_decl(decl)
				decl.comment = backUp
			self.__wr_line("#endif\n")
def __write_structure_bitfields ( self , decls , bitFieldWidth ) : tmp = copy . copy ( decls ) index = 0 tmp . append ( copy . copy ( tmp [ - 1 ] ) ) tmp [ - 1 ] . bitIndex = bitFieldWidth for item in tmp : if ( item . bitIndex > index ) : index = self . __insert_rsvd_bitfield ( tmp , item , index ) else : index = index + item . bitWidth tmp . remove ( tmp [ - 1 ] ) if ( len ( tmp ) > 1 ) : self . __wr_line ( "#ifdef __LITTLE_ENDIAN_BITFIELD\n" ) for decl in sorted ( tmp , key = lambda a : a . bitIndex ) : self . write_decl ( decl ) if ( len ( tmp ) > 1 ) : self . __wr_line ( "#else\n" ) for decl in sorted ( tmp , key = lambda a : a . bitIndex , reverse = True ) : backUp = decl . comment decl . comment = None self . write_decl ( decl ) decl . comment = backUp self . __wr_line ( "#endif\n" )
Create structure declaration with bitfields.
Create structure declaration with bitfields .
""" 
		Create structure declaration with bitfields.
		Arguments:
			decls			List of declarations describing the structure 
							elements
			bitFieldWidth 	Width of the bitfield to create
		""" # Copy the list of declarations and insert the reserved values # check if we reached the full width in the end # Add one dummy element at the end of the list so that we dont have # to solve the special case of the interval between last element and # end of the bitfield # Write bitfield values
self
decls
bitFieldWidth