[Mesa-dev] [PATCH 07/18] intel/genxml: Emit genxml enums as C enums

Kristian H. Kristensen hoegsberg at gmail.com
Tue Nov 29 20:48:07 UTC 2016


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 <hoegsberg at gmail.com>
---
 src/intel/genxml/gen_pack_header.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/intel/genxml/gen_pack_header.py b/src/intel/genxml/gen_pack_header.py
index f09667d..1024745 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")
-- 
2.9.3



More information about the mesa-dev mailing list