languages/gen_h.py
def create_enum(self, name, decls):
		""" 
		Create a C enum. Align to the maximum declaration name within the
		elements declaration list.
		Arguments:
			name		Enum name
			decls		List of enum elements as declarations
		"""
		self.__wr_line("enum {} {}\n".format(name, "{"))
		
		# Check the maximum string length in the enum
		maxLen = 0
		for item in decls:
			if (len(item.name) > maxLen):
				maxLen = len(item.name)
		
		# Write the enum
		for item in decls:
			pref = "	{}".format(item.name)
			if (item.value != None):
				post = " = {},\n".format(hex(item.value))
				post = '{:>{}}'.format(post, maxLen + 15 - len(pref))
			else:
				post = ",\n"
			self.__wr_line(pref + post)
			
		self.__wr_line("};\n")
 
		Create a C enum. Align to the maximum declaration name within the
		elements declaration list.
		Arguments:
			name		Enum name
			decls		List of enum elements as declarations
		
Create a C enum. Align to the maximum declaration name within the
elements declaration list.
Arguments:
name            Enum name
decls           List of enum elements as declarations
Create a C enum . Align to the maximum declaration name within the elements declaration list . Arguments : name Enum name decls List of enum elements as declarations
def create_enum(self, name, decls):
		self.__wr_line("enum {} {}\n".format(name, "{"))
		maxLen = 0
		for item in decls:
			if (len(item.name) > maxLen):
				maxLen = len(item.name)
		for item in decls:
			pref = "	{}".format(item.name)
			if (item.value != None):
				post = " = {},\n".format(hex(item.value))
				post = '{:>{}}'.format(post, maxLen + 15 - len(pref))
			else:
				post = ",\n"
			self.__wr_line(pref + post)
		self.__wr_line("};\n")
def create_enum ( self , name , decls ) : self . __wr_line ( "enum {} {}\n" . format ( name , "{" ) ) maxLen = 0 for item in decls : if ( len ( item . name ) > maxLen ) : maxLen = len ( item . name ) for item in decls : pref = "	{}" . format ( item . name ) if ( item . value != None ) : post = " = {},\n" . format ( hex ( item . value ) ) post = '{:>{}}' . format ( post , maxLen + 15 - len ( pref ) ) else : post = ",\n" self . __wr_line ( pref + post ) self . __wr_line ( "};\n" )
Create a C enum.
Create a C enum .
""" 
		Create a C enum. Align to the maximum declaration name within the
		elements declaration list.
		Arguments:
			name		Enum name
			decls		List of enum elements as declarations
		""" # Check the maximum string length in the enum # Write the enum
self
name
decls