summaryrefslogtreecommitdiffstats
path: root/python_modules
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2011-06-18 00:08:35 +0200
committerMarc-André Lureau <marcandre.lureau@redhat.com>2011-06-21 13:17:17 +0200
commitaa57d2f70cac4bcbaf9324c5efb8c9254caaeb30 (patch)
treef815d20f8eb7c20578d96c3dd0f33a616e350985 /python_modules
parent8131249d6cabadfa94f2c251e5cfec204b190ae1 (diff)
downloadspice-aa57d2f70cac4bcbaf9324c5efb8c9254caaeb30.tar.gz
spice-aa57d2f70cac4bcbaf9324c5efb8c9254caaeb30.tar.xz
spice-aa57d2f70cac4bcbaf9324c5efb8c9254caaeb30.zip
codegen: typedef the protocol enums
Commit 9d5ef9beeca722b2ceff7d15aaa3aaaaf07ecfbf in spice-protocol introduced a typedef manually in the generated enums.h header. This patch adds them automatically to all enums during enums.h generation.
Diffstat (limited to 'python_modules')
-rw-r--r--python_modules/ptypes.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/python_modules/ptypes.py b/python_modules/ptypes.py
index 9c4b7def..9e444f56 100644
--- a/python_modules/ptypes.py
+++ b/python_modules/ptypes.py
@@ -280,7 +280,7 @@ class EnumType(EnumBaseType):
return "enum %s" % self.name
def c_define(self, writer):
- writer.write("enum ")
+ writer.write("typedef enum ")
writer.write(self.c_name())
writer.begin_block()
values = self.names.keys()
@@ -296,7 +296,11 @@ class EnumType(EnumBaseType):
writer.newline()
writer.write(codegen.prefix_underscore_upper(self.name.upper(), "ENUM_END"))
writer.newline()
- writer.end_block(semicolon=True)
+ writer.end_block(newline=False)
+ writer.write(" ")
+ writer.write(self.c_name())
+ writer.write(";")
+ writer.newline()
writer.newline()
class FlagsType(EnumBaseType):
@@ -330,7 +334,7 @@ class FlagsType(EnumBaseType):
return "flags %s" % self.name
def c_define(self, writer):
- writer.write("enum ")
+ writer.write("typedef enum ")
writer.write(self.c_name())
writer.begin_block()
values = self.names.keys()
@@ -347,7 +351,11 @@ class FlagsType(EnumBaseType):
writer.write(codegen.prefix_underscore_upper(self.name.upper(), "MASK"))
writer.write(" = 0x%x" % (mask))
writer.newline()
- writer.end_block(semicolon=True)
+ writer.end_block(newline=False)
+ writer.write(" ")
+ writer.write(self.c_name())
+ writer.write(";")
+ writer.newline()
writer.newline()
class ArrayType(Type):