Revert "Don't use enums in generated C code"
This commit broke xcb/util.
This reverts commit 9984b72888
.
Signed-off-by: Peter Harris <pharris@opentext.com>
This commit is contained in:
parent
9984b72888
commit
e986d1ee5a
|
@ -222,15 +222,17 @@ def c_enum(self, name):
|
|||
'''
|
||||
_h_setlevel(0)
|
||||
_h('')
|
||||
_h('typedef enum %s {', _t(name))
|
||||
|
||||
next = -1
|
||||
count = len(self.values)
|
||||
|
||||
for (enam, eval) in self.values:
|
||||
if eval == '':
|
||||
next += 1
|
||||
else:
|
||||
next = int(eval)
|
||||
_h('static const uint32_t %s = %d;', _n(name + (enam,)).upper(), next)
|
||||
count = count - 1
|
||||
equals = ' = ' if eval != '' else ''
|
||||
comma = ',' if count > 0 else ''
|
||||
_h(' %s%s%s%s', _n(name + (enam,)).upper(), equals, eval, comma)
|
||||
|
||||
_h('} %s;', _t(name))
|
||||
|
||||
def _c_type_setup(self, name, postfix):
|
||||
'''
|
||||
|
|
Loading…
Reference in New Issue