summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrediano Ziglio <fziglio@redhat.com>2015-07-21 17:45:40 +0100
committerChristophe Fergeau <cfergeau@redhat.com>2015-07-23 11:22:11 +0200
commitde1286ad80ce7c559fccde5f6e466a89fc1ce60d (patch)
tree433d580a8d8908f2a5b044dc6f4517a00f632058
parent08384ac7fbdc8303fdf85cc2689602e429607126 (diff)
codegen: Allow to specify C type for index variable
This is to prepare to generate the wireshark dissector which uses glib types instead of the newer C ones (for compatibility with some compilers). Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
-rw-r--r--python_modules/codegen.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/python_modules/codegen.py b/python_modules/codegen.py
index c470988..f7a2048 100644
--- a/python_modules/codegen.py
+++ b/python_modules/codegen.py
@@ -81,6 +81,7 @@ class CodeWriter:
self.has_error_check = False
self.options = {}
self.function_helper_writer = None
+ self.index_type = 'uint32_t'
def set_option(self, opt, value = True):
self.options[opt] = value
@@ -113,6 +114,7 @@ class CodeWriter:
self.contents.append(self.out)
writer.indentation = self.indentation
writer.at_line_start = self.at_line_start
+ writer.index_type = self.index_type
writer.generated = self.generated
writer.options = self.options
writer.public_prefix = self.public_prefix
@@ -353,7 +355,7 @@ class CodeWriter:
def pop_index(self):
index = self.indexes[self.current_index]
self.current_index = self.current_index + 1
- self.add_function_variable("uint32_t", index)
+ self.add_function_variable(self.index_type, index)
return index
def push_index(self):