From: Kristian H. Kristensen Date: Tue, 29 Nov 2016 00:34:08 +0000 (-0800) Subject: intel/genxml: Emit genxml enums as C enums X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=fc2225b1afb5c963e986ec3b94b1760355f3ec7d;p=mesa.git intel/genxml: Emit genxml enums as C enums The previous commits got rid of any clashes between #defines and enum values and we can now emit the genxml enums as debugger friendly C enums. Signed-off-by: Kristian H. Kristensen Reviewed-by: Jason Ekstrand --- diff --git a/src/intel/genxml/gen_pack_header.py b/src/intel/genxml/gen_pack_header.py index f09667d3d8e..1024745bfb1 100644 --- a/src/intel/genxml/gen_pack_header.py +++ b/src/intel/genxml/gen_pack_header.py @@ -268,7 +268,7 @@ class Field(object): elif self.type in self.parser.structs: type = 'struct ' + self.parser.gen_prefix(safe_name(self.type)) elif self.type in self.parser.enums: - type = 'uint32_t' + type = 'enum ' + self.parser.gen_prefix(safe_name(self.type)) elif self.type == 'mbo': return else: @@ -633,14 +633,14 @@ class Parser(object): self.emit_pack_function(self.struct, self.group) def emit_enum(self): - print('/* enum %s */' % self.gen_prefix(self.enum)) + print('enum %s {' % self.gen_prefix(self.enum)) for value in self.values: if self.prefix: name = self.prefix + "_" + value.name else: name = value.name - print('#define %-36s %6d' % (name.upper(), value.value)) - print('') + print(' %-36s = %6d,' % (name.upper(), value.value)) + print('};\n') def parse(self, filename): file = open(filename, "rb")