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>