Re: [PATCH v4 04/41] dissector: Decorate writer class to make easier ifdef/endif handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jul 23, 2015 at 04:54:21PM +0100, Frediano Ziglio wrote:
> I'm generating code for dissector from demarshaller.
> Make simple to hangle ifdef/endif not having to check manually attribute.

'to handle'
This really should be more descriptive, my understanding is that this
dynamically generates methods to handle ifdef/ifdef_else/endif and avoid
code duplication? And existing code could be patched with:

diff --git a/python_modules/marshal.py b/python_modules/marshal.py
index 1d38d3d..c2ed854 100644
--- a/python_modules/marshal.py
+++ b/python_modules/marshal.py
@@ -334,8 +334,7 @@ def write_container_marshaller(writer, container, src):
             write_member_marshaller(writer, container, m, src, scope)

 def write_message_marshaller(writer, message, is_server, private):
-    if message.has_attr("ifdef"):
-        writer.ifdef(message.attributes["ifdef"][0])
+    writer.ifdef(message)
     writer.out_prefix = ""
     function_name = "spice_marshall_" + message.c_name()
     if writer.is_generated("marshaller", function_name):
@@ -367,8 +366,7 @@ def write_message_marshaller(writer, message, is_server, private):
         write_container_marshaller(writer, message, src)

     writer.end_block()
-    if message.has_attr("ifdef"):
-        writer.endif(message.attributes["ifdef"][0])
+    writer.endif(message)
     writer.newline()
     return function_name

Attachment: pgpeHzBTUp69o.pgp
Description: PGP signature

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]