generator: sumof of lists with varsized members ListInputDevices-V2
authorChristian Linhart <chris@demorecorder.com>
Wed, 3 Sep 2014 11:22:41 +0000 (13:22 +0200)
committerChristian Linhart <chris@demorecorder.com>
Sat, 6 Sep 2014 18:26:36 +0000 (20:26 +0200)
commit2592873f1979fe372138f73b4ae43371d887f0e3
treef053e85bbe27b967fd00b4eb8c134cded065e2bc
parent761a208c4ad626f0e84ee10e44fe2e4af3ee10d4
generator: sumof of lists with varsized members

Support sumof of lists with varsized members.
For these lists, iteration has to be done with iterators.

example:
<struct name="SumofTest_Element_Varsized">
   <field type="CARD16" name="foo" />
   <field type="CARD16" name="bar" />
   <list type="CARD16" name="list1">
<fieldref>foo</fieldref>
   </list>
</struct>

<struct name="SumofTest_FieldAccess_VarSized">
   <field type="CARD32" name="len" />
   <list type="SumofTest_Element_Varsized" name="mylist1">
   <fieldref>len</fieldref>
   </list>
   <list type="CARD16" name="mylist2">
<sumof ref="mylist1">
<fieldref>bar</fieldref>
</sumof>
   </list>
</struct>

generated tempvar:
    int xcb_pre_tmp_1; /* sumof length */
    int xcb_pre_tmp_2; /* sumof loop counter */
    int64_t xcb_pre_tmp_3; /* sumof sum */
    xcb_input_sumof_test_element_varsized_iterator_t xcb_pre_tmp_4; /* sumof list iterator */

generated code:
    /* mylist2 */
    /* sumof start */
    xcb_pre_tmp_1 = _aux->len;
    xcb_pre_tmp_3 = 0;
    xcb_pre_tmp_4 = xcb_input_sumof_test_field_access_var_sized_mylist_1_iterator(_aux);
    for ( xcb_pre_tmp_2 = 0; xcb_pre_tmp_2 < xcb_pre_tmp_1; xcb_pre_tmp_2++) {
        xcb_pre_tmp_3 += xcb_pre_tmp_4.data->bar;
        xcb_input_sumof_test_element_varsized_next(&xcb_pre_tmp_4);
    }
    /* sumof end. Result is in xcb_pre_tmp_3 */
    xcb_block_len += xcb_pre_tmp_3 * sizeof(uint16_t);

Message-ID: <1409743361-466-6-git-send-email-chris@demorecorder.com>
Patch-Thread-Subject: [Xcb] xinput: make ListInputDevices work, sumof with nested expr, ...
Patch-Set: ListInputDevices
Patch-Number: libxcb 6/6
Patch-Version: V1
Signed-off-by: Christian Linhart <chris@DemoRecorder.com>
src/c_client.py