[Spice-devel] [PATCH 27/33] Implement ws_inline attribute
Frediano Ziglio
fziglio at redhat.com
Wed Jul 1 10:10:19 PDT 2015
This attribute allow structure to be aligned instead of be contained
in a separate function.
This is helpful as variable are declared in the function so allows
other member to reference to a nested structure.
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
python_modules/dissector.py | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/python_modules/dissector.py b/python_modules/dissector.py
index f18b5b4..3e7af08 100644
--- a/python_modules/dissector.py
+++ b/python_modules/dissector.py
@@ -301,9 +301,14 @@ def write_struct_func(writer, t, func_name, index):
def write_struct(writer, member, t, index, dest, scope):
assert(t.is_struct())
- func_name = 'dissect_spice_struct_' + t.name
- write_struct_func(writer, t, func_name, index)
- writer.assign('offset', '%s(glb, tree%d, offset, %s)' % (func_name, dest.level, index))
+ if member.has_attr('ws_inline'):
+ dest = dest.child_sub(member.name, scope)
+ with writer.block() as scope:
+ write_container_parser(writer, t, dest)
+ else:
+ func_name = 'dissect_spice_struct_' + t.name
+ write_struct_func(writer, t, func_name, index)
+ writer.assign('offset', '%s(glb, tree%d, offset, %s)' % (func_name, dest.level, index))
def write_member_primitive(writer, container, member, t, dest, scope):
assert(t.is_primitive())
--
2.1.0
More information about the Spice-devel
mailing list