Support sumof with a nested expression.
The nested expression is computed for every list-element
and the result of the computation is added to the sum.
This way, sumof can be applied to a list of structs,
and, e.g., compute the sum of a specific field of that struct.
example:
<struct name="SumofTest_Element">
<field type="CARD16" name="foo" />
<field type="CARD16" name="bar" />
</struct>
<struct name="SumofTest_FieldAccess">
<field type="CARD32" name="len" />
<list type="SumofTest_Element" name="mylist1">
<fieldref>len</fieldref>
</list>
<list type="CARD16" name="mylist2">
<sumof ref="mylist1">
<fieldref>bar</fieldref>
</sumof>
</list>
</struct>
generated tmpvar:
int xcb_pre_tmp_1; /* sumof length */
int xcb_pre_tmp_2; /* sumof loop counter */
int64_t xcb_pre_tmp_3; /* sumof sum */
const xcb_input_sumof_test_element_t* xcb_pre_tmp_4; /* sumof list ptr */
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_mylist_1(_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->bar;
xcb_pre_tmp_4++;
}
/* sumof end. Result is in xcb_pre_tmp_3 */
xcb_block_len += xcb_pre_tmp_3 * sizeof(uint16_t);
changes for V2 of this patch:
* explicitely set the member access operator in the prefix-tuple
passed to function _c_helper_field_mapping.
This enables us to simplify function "_c_helper_absolute_name"
(which will be renamed "_c_helper_fieldaccess_expr" soon)
V3: Changed style and formatting according to suggestions from Ran Benita
Signed-off-by: Christian Linhart <chris@DemoRecorder.com>
Reviewed-by: Ran Benita <ran234@gmail.com>
Message-ID: <54562798.8040500@DemoRecorder.com>
Patch-Thread-Subject: [Xcb] [PATCHSET] ListInputDevices revision 2
Patch-Set: ListInputDevices
Patch-Number: libxcb 5/9
Patch-Version: V3
|
||
|---|---|---|
| doc | ||
| m4 | ||
| man | ||
| src | ||
| tests | ||
| tools | ||
| .autom4te.cfg | ||
| .gitignore | ||
| COPYING | ||
| Makefile.am | ||
| NEWS | ||
| README | ||
| autogen.sh | ||
| check-pc-requires | ||
| configure.ac | ||
| xcb-composite.pc.in | ||
| xcb-damage.pc.in | ||
| xcb-dpms.pc.in | ||
| xcb-dri2.pc.in | ||
| xcb-dri3.pc.in | ||
| xcb-glx.pc.in | ||
| xcb-present.pc.in | ||
| xcb-randr.pc.in | ||
| xcb-record.pc.in | ||
| xcb-render.pc.in | ||
| xcb-res.pc.in | ||
| xcb-screensaver.pc.in | ||
| xcb-shape.pc.in | ||
| xcb-shm.pc.in | ||
| xcb-sync.pc.in | ||
| xcb-xevie.pc.in | ||
| xcb-xf86dri.pc.in | ||
| xcb-xfixes.pc.in | ||
| xcb-xinerama.pc.in | ||
| xcb-xinput.pc.in | ||
| xcb-xkb.pc.in | ||
| xcb-xprint.pc.in | ||
| xcb-xselinux.pc.in | ||
| xcb-xtest.pc.in | ||
| xcb-xv.pc.in | ||
| xcb-xvmc.pc.in | ||
| xcb.pc.in | ||
About libxcb
============
libxcb provides an interface to the X Window System protocol, which
replaces the current Xlib interface. It has several advantages over
Xlib, including:
- size: small, simple library, and lower memory footprint
- latency hiding: batch several requests and wait for the replies later
- direct protocol access: interface and protocol correspond exactly
- proven thread support: transparently access XCB from multiple threads
- easy extension implementation: interfaces auto-generated from XML-XCB
Xlib can also use XCB as a transport layer, allowing software to make
requests and receive responses with both, which eases porting to XCB.
However, client programs, libraries, and toolkits will gain the most
benefit from a native XCB port.
Please report any issues you find to the freedesktop.org bug tracker,
at:
<https://bugs.freedesktop.org/enter_bug.cgi?product=XCB>
Discussion about XCB occurs on the XCB mailing list:
<mailto:xcb at lists.freedesktop.org>
<http://lists.freedesktop.org/mailman/listinfo/xcb>
You can obtain the latest development versions of XCB using GIT.
For anonymous checkouts, use:
git clone git://anongit.freedesktop.org/git/xcb/libxcb
For developers, use:
git clone git+ssh://git.freedesktop.org/git/xcb/libxcb