<div dir="ltr">Hi Oliver,<br><br><span class="im"><div style="font-size:13px">I guess if we explicitly 
define pad align as a variable part before list, we need to handle it in
 the end function, which is not handled currently I guess.<br></div></span><div style="font-size:13px">(It is handled for functions accessing lists)<br><br>diff --git a/src/c_client.py b/src/c_client.py
<br>index 9a7c67c..45ad2bf 100644
<br>--- a/src/c_client.py
<br>+++ b/src/c_client.py
<br>@@ -1931,18 +1931,24 @@ def _c_accessors_list(self, field):
<br>         if switch_obj is not None:
<br>             _c('    i.data = %s + %s;', fields[field.c_field_name][0],
<br>                _c_accessor_get_expr(field.type.expr, fields))
<br>         elif field.prev_varsized_field == None:
<br>             _c('    i.data = ((%s *) (R + 1)) + (%s);', field.type.c_wiretype,
<br>                _c_accessor_get_expr(field.type.expr, fields))
<br>         else:
<br>+            (prev_varsized_field, align_pad) = get_align_pad(field)
<br>             _c('    xcb_generic_iterator_t child = %s;',
<br>-               _c_iterator_get_end(field.prev_varsized_field, 'R'))
<br>-            _c('    i.data = ((%s *) child.data) + (%s);', field.type.c_wiretype,
<br>-               _c_accessor_get_expr(field.type.expr, fields))
<br>+                _c_iterator_get_end(prev_varsized_field, 'R'))
<br>+            if align_pad is not None:
<br>+                _c('    i.data = ((%s *) child.data + (%s) + ((-child.index) & (4 - 1)) + %d);', field.type.c_wiretype,
<br>+                   _c_accessor_get_expr(field.type.expr, fields),field.prev_varsized_offset)
<br>+            else:
<br>+               _c('    i.data = ((%s *) child.data) + (%s);', field.type.c_wiretype,
<br>+                   _c_accessor_get_expr(field.type.expr, fields))
<br>+
<br> 
<br>         _c('    i.rem = 0;')
<br>         _c('    i.index = (char *) i.data - (char *) %s;', param)
<br>         _c('    return i;')
<br>         _c('}')
<br> 
<br>     else:<br><br><div style="font-size:13px">With this, I could avoid the error.</div><div style="font-size:13px">But I am not sure of the solution though, maybe someone can come up with a better handling for align pad list end accessors.</div><div><br></div><div>Also, just the implicit length lists needs to be the last member, so list "options" can be kept as a length less list, </div><div>But
 then, as for request, we have accessor functions for every fields , options_len (implicit length of options list) also has 
an accessor function named xcb_x_print_print_put_document_data_options_len !</div><div>So,
 instead of having an accessor for every field, we can have accessor for
 just the wire fields but only ones that need accessor (i,e the variable
 part of request)<br><br>diff --git a/src/c_client.py b/src/c_client.py
<br>index 45ad2bf..3db313e 100644
<br>--- a/src/c_client.py
<br>+++ b/src/c_client.py
<br>@@ -3097,15 +3097,22 @@ def c_request(self, name):
<br>     else:
<br>         # Request prototypes
<br>         _c_request_helper(self, name, void=True, regular=False)
<br>         _c_request_helper(self, name, void=True, regular=True)
<br>         if self.c_need_aux:
<br>             _c_request_helper(self, name, void=True, regular=False, aux=True)
<br>             _c_request_helper(self, name, void=True, regular=True, aux=True)
<br>-        _c_accessors(self, name, name)
<br>+        for field in self.fields:
<br>+            if not field.type.is_pad and field.wire:
<br>+                print("My fields are : "+str(field.field_name))
<br>+                if _c_field_needs_list_accessor(field):
<br>+                    _c_accessors_list(self, field)
<br>+                elif _c_field_needs_field_accessor(field):
<br>+                    _c_accessors_field(self, field)
<br>+
<br> 
<br>     # We generate the manpage afterwards because _c_type_setup has been called.
<br>     # TODO: what about aux helpers?
<br>     _man_request(self, name, void=not self.reply, aux=False)
<br> 
<br> def c_event(self, name):
<br>     '''<br><br><div>This was working fine previously, because there was no padding 
between lists of implicit length and a list having length. So this will 
solve the issue of un necessary accessor functions.</div><div><br></div><div>Also, I am a little confused with the Implicit padding here.<br></div><div>For the lists with implicit length, it has an implicit padding added because of the implicit length of list treated a variable sized field before the list.<br><br></div><div>While, lists with a length field have their lengths as the fixed fields and hence have no such padding issues.<br><br></div><div>Is this behavior expected?<br></div><div><br></div><div>Can you please correct me in my understanding if I am getting something wrong here.<br><br></div><div>Thank you<br></div><br></div>Regards,<br></div><div style="font-size:13px">Jaya<br></div><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, May 19, 2015 at 9:18 PM, Olivier Fourdan <span dir="ltr"><<a href="mailto:ofourdan@redhat.com" target="_blank">ofourdan@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Peter,<br>
<span class=""><br>
> Since you're fixing the protocol definition of this request, you could<br>
> also change the <!-- padding --> comment to <pad align="4" />. ("pad<br>
> align" is relatively recent, and I'm guessing whoever originally wrote<br>
> xprint.xml was too lazy to put in the annoyingly large <op> block<br>
> required to do an alignment pad without "pad align").<br>
<br>
</span>If I add the <pad align="4" /> statement, the generated code won't build anymore :(<br>
<br>
It fails with:<br>
<br>
xprint.c: In function 'xcb_x_print_print_put_document_data_doc_format_end':<br>
xprint.c:1338:36: error: 'None' undeclared (first use in this function)<br>
     xcb_generic_iterator_t child = None;<br>
                                    ^<br>
xprint.c:1338:36: note: each undeclared identifier is reported only once for each function it appears in<br>
xprint.c: In function 'xcb_x_print_print_put_document_data_options_end':<br>
xprint.c:1362:36: error: 'None' undeclared (first use in this function)<br>
     xcb_generic_iterator_t child = None;<br>
                                    ^<br>
Not sure why padding does that...<br>
<span class=""><br>
> That said, this looks good. With or without the <pad align="4" /> changes,<br>
> Reviewed-by: Peter Harris <<a href="mailto:pharris@opentext.com">pharris@opentext.com</a>><br>
<br>
</span>Cheers!<br>
<span class="HOEnZb"><font color="#888888">Olivier<br>
</font></span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
Xcb mailing list<br>
<a href="mailto:Xcb@lists.freedesktop.org">Xcb@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/xcb" target="_blank">http://lists.freedesktop.org/mailman/listinfo/xcb</a></div></div></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature"><div dir="ltr"><div>Regards,<br></div>Jaya<br></div></div>
</div>