[Spice-devel,v3,10/51] codegen: Allows to specify C type for index variable

Submitted by Frediano Ziglio on July 21, 2015, 4:45 p.m.

Details

Message ID 1437497181-26929-11-git-send-email-fziglio@redhat.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Frediano Ziglio July 21, 2015, 4:45 p.m.
This to prepare to generate wireshark dissector which use
glib types instead of new C ones (for compatibility with some
compiler).

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
---
 python_modules/codegen.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Patch hide | download patch | download mbox

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):

Comments

Hey,

I've pushed these patches up to this point.

Christophe

On Tue, Jul 21, 2015 at 05:45:40PM +0100, Frediano Ziglio wrote:
> This to prepare to generate wireshark dissector which use
> glib types instead of new C ones (for compatibility with some
> compiler).
> 
> Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
> ---
>  python_modules/codegen.py | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> 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):
> -- 
> 2.1.0
> 
> _______________________________________________
> Spice-devel mailing list
> Spice-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel