[Xcb] [PUSHED] [PATCH proto 1/1] calculate lengthless list

Christian Linhart chris at DemoRecorder.com
Tue Jan 5 17:42:53 PST 2016


I have pushed this patch.

Besides adding useful functionality, it helps to avoid a future ABI/API issue in the present extension.

Cheers,

Chris

On 2015-11-11 01:01, Christian Linhart wrote:
> From: Jaya Tiwari <tiwari.jaya18 at gmail.com>
>
> Some rework done by Christian Linhart
>
> Signed-off-by: Jaya Tiwari <tiwari.jaya18 at gmail.com>
> Signed-off-by: Christian Linhart <chris at demorecorder.com>
> ---
>  xcbgen/xtypes.py | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/xcbgen/xtypes.py b/xcbgen/xtypes.py
> index 4d6bbc0..6d0930b 100644
> --- a/xcbgen/xtypes.py
> +++ b/xcbgen/xtypes.py
> @@ -177,18 +177,25 @@ class ListType(Type):
>      expr is an Expression object containing the length information, for variable-sized lists.
>      '''
>      def __init__(self, elt, member, *parent):
>          Type.__init__(self, member.name)
>          self.is_list = True
>          self.member = member
>          self.parents = list(parent)
> +        lenfield_name = False
>  
>          if elt.tag == 'list':
>              elts = list(elt)
>              self.expr = Expression(elts[0] if len(elts) else elt, self)
> +            is_list_in_parent = self.parents[0].elt.tag in ('request', 'event', 'reply', 'error')
> +            if not len(elts) and is_list_in_parent:
> +                self.expr = Expression(elt,self)
> +                self.expr.op = 'calculate_len'
> +            else:
> +                self.expr = Expression(elts[0] if len(elts) else elt, self)
>  
>          self.size = member.size if member.fixed_size() else None
>          self.nmemb = self.expr.nmemb if self.expr.fixed_size() else None
>  
>      def make_member_of(self, module, complex_type, field_type, field_name, visible, wire, auto, enum=None):
>          if not self.fixed_size():
>              # We need a length field.



More information about the Xcb mailing list