From: Christian Linhart Date: Wed, 3 Sep 2014 11:22:36 +0000 (+0200) Subject: generator: fix absname for fields with only accessor function X-Git-Url: http://git.demorecorder.com/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=19c4056f747452718146cb3ae84cbcd4ecb279fb;p=free-sw%2Fxcb%2Flibxcb generator: fix absname for fields with only accessor function Fix _c_helper_absolute_name for fields which cannot be accessed as a struct/union member but which can be accessed by an accessor function. The fix calls the accessor function in these cases. Example: len The sumof-expression ( ) refers to mylist1 which is only acessible by an accessor function. Previously, sumof was only used inside bitcases, where such lists are accessible by members of the deserialized parent struct. (there is a difference between deserialization of switches and structs.) Message-ID: <1409743361-466-1-git-send-email-chris@demorecorder.com> Patch-Thread-Subject: [Xcb] xinput: make ListInputDevices work, sumof with nested expr, ... Patch-Set: ListInputDevices Patch-Number: libxcb 1/6 Patch-Version: V1 Signed-off-by: Christian Linhart --- diff --git a/src/c_client.py b/src/c_client.py index 56a1766..20c4b5e 100644 --- a/src/c_client.py +++ b/src/c_client.py @@ -434,16 +434,42 @@ def _c_helper_absolute_name(prefix, field=None): if field is not None, append the field name as well """ prefix_str = '' + last_sep ='' for name, sep, obj in prefix: + if '' != last_sep: + prefix_str += last_sep prefix_str += name if '' == sep: sep = '->' if ((obj.is_case_or_bitcase and obj.has_name) or # named bitcase (obj.is_switch and len(obj.parents)>1)): sep = '.' - prefix_str += sep + last_sep = sep + + prefix_str_without_lastsep = prefix_str + prefix_str += last_sep + if field is not None: prefix_str += _cpp(field.field_name) + + + if ( + field != None + and hasattr(field, 'c_accessor_name') + and field.parent != None + and field.parent.is_container + and not field.parent.is_switch + and not field.parent.is_case_or_bitcase + and (# the following conditions are taken from _c_accessors() + (field.type.is_list and not field.type.fixed_size()) + or + (field.prev_varsized_field is not None + or not field.type.fixed_size() + ) + ) + ): + prefix_str = field.c_accessor_name + "(" + prefix_str_without_lastsep + ")"; + return prefix_str # _c_absolute_name