This attribute allows the structure parsing code to be inlined instead of being contained in a separate function. This is helpful as variable are declared in the function so allows other members to access to a nested structure. For instance in this example MouseState structure text (ws_txt) access pt member fields and needs the ws_inline attribute: struct Point { int32 x; int32 y; }; struct MouseState { Point pt @ws_inline; int32 buttons; } @ws_txt("Mouse at (%u,%u) buttons %u", pt.x, pt.y, buttons); Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx> --- 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 4213484..f7db4b8 100644 --- a/python_modules/dissector.py +++ b/python_modules/dissector.py @@ -381,9 +381,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, %s, offset, %s)' % (func_name, dest.level.tree, 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, %s, offset, %s)' % (func_name, dest.level.tree, index)) def write_member_primitive(writer, container, member, t, dest, scope): assert(t.is_primitive()) -- 2.4.3 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx http://lists.freedesktop.org/mailman/listinfo/spice-devel