summaryrefslogtreecommitdiff
path: root/src/c_client.py
AgeCommit message (Collapse)AuthorFilesLines
2014-07-28c_client.py: remove more trailing space from generated filesRan Benita1-5/+5
Signed-off-by: Ran Benita <ran234@gmail.com> Reviewed-by: Josh Triplett <josh@joshtriplett.org> Reviewed-by: Daniel Martin <consume.noise@gmail.com>
2014-07-28c_client.py: remove trailing whitespace from generated filesRan Benita1-4/+4
Signed-off-by: Ran Benita <ran234@gmail.com> Reviewed-by: Daniel Martin <consume.noise@gmail.com>
2014-07-28c_client.py: remove useless generated commentsRan Benita1-124/+0
They are bloated, don't add anything over the signature, in some cases duplicate the doxygen comments, and are not integrated with the <doc> tags in any way. Remove them and cut the generated LOC by half. Signed-off-by: Ran Benita <ran234@gmail.com> Reviewed-by: Daniel Martin <consume.noise@gmail.com>
2014-07-28c_client.py: make the man page output deterministicRan Benita1-3/+3
Some parts of the man pages (SEE ALSO and ERRORS) are generated by iterating a Python dict. But the iteration order in a dict is random, so each build the output is ordered differently. Avoid that by iterating in sorted order. Signed-off-by: Ran Benita <ran234@gmail.com> Reviewed-by: Daniel Martin <consume.noise@gmail.com>
2014-07-28c_client.py: prefix all monkey-patched fields with c_Ran Benita1-50/+50
The script adds many fields to the objects coming from xcbgen. To distinguish them, a c_ prefix is used, but for some it was missing. Signed-off-by: Ran Benita <ran234@gmail.com> Reviewed-by: Daniel Martin <consume.noise@gmail.com>
2014-07-28c_client.py: remove trailing whitespaceRan Benita1-169/+169
These are extra annoying in python code. Signed-off-by: Ran Benita <ran234@gmail.com> Reviewed-by: Daniel Martin <consume.noise@gmail.com>
2014-07-28c_client.py: remove useless 'today' variableRan Benita1-2/+0
Signed-off-by: Ran Benita <ran234@gmail.com> Reviewed-by: Daniel Martin <consume.noise@gmail.com>
2014-06-10Handle <pad align="n" /> between listsDaniel Martin1-6/+32
Without this patch we end up with invalid C code if we've a <pad align="n" /> between two variadic lists. Check for such a condition and take the alignment pad into account. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=79808 Signed-off-by: Daniel Martin <consume.noise@gmail.com> Signed-off-by: Peter Harris <pharris@opentext.com>
2014-03-22Only #include directly referenced module header filesKeith Packard1-1/+1
This avoids having the nested header files also included at the top level, which is more efficient. Signed-off-by: Keith Packard <keithp@keithp.com> Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-01-30generated man pages: use xorg footer and no hard coded extensionGaetan Nadon1-23/+29
The section number is no longer hard-coded The left footer is now "X Version 11". The center footer is the package name with the version, "libxcb 1.9" The three values above are provided through xorg-macros. They are passed-in to the python c_client code. Example of footer (last line, above dotted line) [...] AUTHOR Generated from xproto.xml. Contact xcb@lists.freedesktop.org for cor‐ rections and improvements. X Version 11 libxcb 1.9 xcb_send_event(3) ------------------------------------------------------------------------------ Reviewed-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Gaetan Nadon <memsize@videotron.ca>
2014-01-21Support <pad align="n" />Peter Harris1-10/+18
Reviewed-By: Ran Benita <ran234@gmail.com> Signed-off-by: Peter Harris <pharris@opentext.com>
2014-01-03Force XCB event structures with 64-bit extended fields to be packed.Kenneth Graunke1-3/+9
With the advent of the Present extension, some events (such as PresentCompleteNotify) now use native 64-bit types on the wire. For XGE events, we insert an extra "uint32_t full_sequence" field immediately after the first 32 bytes of data. Normally, this causes the subsequent fields to be shifted over by 4 bytes, and the structure to grow in size by 4 bytes. Everything works fine. However, if event contains 64-bit extended fields, this may result in the compiler adding an extra 4 bytes of padding so that those fields remain aligned on 64-bit boundaries. This causes the structure to grow by 8 bytes, not 4. Unfortunately, XCB doesn't realize this, and always believes that the length only increased by 4. read_packet() then fails to malloc enough memory to hold the event, and the event processing code uses the wrong offsets. To fix this, mark any event structures containing 64-bit extended fields with __attribute__((__packed__)). v2: Use any(...) instead of True in (...), as suggested by Daniel Martin. v3 (Alan Coopersmith): Fix build with Solaris Studio 12.3 by moving the attribute to after the structure definition. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Keith Packard <keithp@keithp.com> [v1] Reviewed-by: Josh Triplett <josh@joshtriplett.org> [v1] Reviewed-by: Daniel Martin <consume.noise@gmail.com> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2013-12-12c_client.py: Fix _sizeof() functionsDaniel Martin1-2/+2
Currently, it is not possible to correctly iterate over the replies of some requests. For example, the list of XIDeviceInfo returned by the XIQueryDevice request from xinput2 is read as garbage starting from the second entry. The culprits are the _sizeof() used by the iterators. In the above case: int xcb_input_xi_device_info_sizeof (const void *_buffer /**< */) { char *xcb_tmp = (char *)_buffer; [...] unsigned int xcb_block_len = 0; [...] xcb_block_len += sizeof(xcb_input_xi_device_info_t); xcb_tmp += xcb_block_len; /* name */ xcb_block_len += (((_aux->name_len + 3) / 4) * 4) * sizeof(char); xcb_tmp += xcb_block_len; [...] } The problem here is that `xcb_block_len` is not zero'd right above the `/* name */` comment, causing `xcb_tmp` to be incremented by `sizeof(xcb_input_xi_device_info_t)` twice. The returned size is too large. https://bugs.freedesktop.org/show_bug.cgi?id=68387 Tested-by: Ran Benita <ran234@gmail.com> Reviewed-by: Ran Benita <ran234@gmail.com> Reviewed-by: Daniel Martin <consume.noise@gmail.com> Signed-off-by: Ran Benita <ran234@gmail.com> Signed-off-by: Julien Cristau <jcristau@debian.org>
2013-11-07Add support for receiving fds in repliesKeith Packard1-5/+60
Requests signal which replies will have fds, and the replies report how many fds they expect in byte 1. Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-By: Uli Schlachter <psychon@znc.in>
2013-11-07Add xcb_send_fd APIKeith Packard1-0/+4
This uses sendmsg to transmit file descriptors from the application to the X server Signed-off-by: Keith Packard <keithp@keithp.com> Reviewed-By: Uli Schlachter <psychon@znc.in>
2013-08-15c_client.py: Do not create pointers in unionsDaniel Martin1-2/+2
Do not create pointers in unions for fields of variadic length. Signed-off-by: Daniel Martin <consume.noise@gmail.com> Reviewed-by: Ran Benita <ran234@gmail.com>
2013-08-15c_client.py: Always initialize xcb_align_toDaniel Martin1-4/+4
to get rid of: warning: 'xcb_align_to' may be used uninitialized in this function Signed-off-by: Daniel Martin <consume.noise@gmail.com> Reviewed-by: Peter Harris <pharris@opentext.com>
2013-07-12c_client.py: Inject full_sequence into GE eventsDaniel Martin1-0/+17
The generic event structure xcb_ge_event_t has the full_sequence field at the 32byte boundary. That's why we've to inject this field into GE events while generating the structure for them. Otherwise we would read garbage (the internal full_sequence) when accessing normal event fields there. Signed-off-by: Daniel Martin <consume.noise@gmail.com> Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Peter Harris <pharris@opentext.com>
2013-05-23c_client.py: Handle multiple expr. in a bitcaseDaniel Martin1-4/+14
Adopt a change from xcbgen. With that modification the expression in a bitcase became a list of expressions to support multiple <enumref> in a <bitcase>. Signed-off-by: Daniel Martin <consume.noise@gmail.com> Signed-off-by: Peter Harris <pharris@opentext.com>
2012-11-10c_client.py: Fix python-3 invalid except statementChí-Thanh Christopher Nguyễn1-1/+1
Replace except statement with a PEP-3110 compliant one. This fixes a regression introduced by c3deeaf714630531d693a6a902b8dabf791858b1 https://bugs.freedesktop.org/show_bug.cgi?id=55690 Reviewed-by: Peter Harris <pharris@opentext.com> Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-11-10c-client.py: Fix python-3 AttributeError: 'dict' object has no attribute ↵Chí-Thanh Christopher Nguyễn1-3/+3
'iteritems' This fixes a regression introduced by ea71d7d7e3f5d8189b80747678e9ca9a417b1d37 https://bugs.freedesktop.org/show_bug.cgi?id=55690 Reviewed-by: Peter Harris <pharris@opentext.com> Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-08-25Always include "config.h" at the start of all C source files.Alan Coopersmith1-0/+3
Allows configure to set defines such as _POSIX_SOURCE in config.h that affect functions exposed by system headers and get consistent results across all the source files. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2012-08-14c_client: Fix parallel-make issue creating 'man' directoryColin Walters1-1/+5
With make -j, it was possible to hit a race condition in the code to make the 'man' directory. Signed-off-by: Julien Danjou <julien@danjou.info>
2012-03-26Allow undocumented code to be builtJulien Danjou1-20/+20
Signed-off-by: Julien Danjou <julien@danjou.info>
2012-03-26c_client.py: generate manpagesMichael Stapelberg1-4/+596
Signed-off-by: Julien Danjou <julien@danjou.info>
2011-08-24Keep ALIGNOF definition out of the public namespace.Jamey Sharp1-3/+3
Uli's patch is an excellent solution; I just want to keep the new ALIGNOF macro hidden from XCB's users, as they don't need it to call XCB. Signed-off-by: Jamey Sharp <jamey@minilop.net>
2011-08-24Compute alignment correctlyUli Schlachter1-1/+11
The code previously assumed that everything has to be aligned to a 4 byte boundary. This assumption is wrong as e.g. the STR struct from xproto shows. Instead, each type has to be aligned to its natural alignment. So a char doesn't need any alignment, a INT16 gets aligned to a 2-byte-boundary and a INT32 gets the old 4 byte alignment. I'm not 100% sure that this commit is correct, but some quick tests with awesome and cairo-xcb went well. This commit causes lots of dead assignments to xcb_align_to since only the last field's alignment is actually used, but this simplified this patch a lot. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=34037 Signed-off-by: Uli Schlachter <psychon@znc.in> Signed-off-by: Peter Harris <pharris@opentext.com>
2011-05-11Insert, not append explicit xcbgen dir python pathJames Jones1-1/+1
If a the path to the xcb python generate libs is explicitly specified to c_client.py, insert it in the python path list just after the local dir entry, rather than appending it to the existing paths. This keeps a global/distro install of xcb from overriding a local build of the xcb proto files. Signed-off-by: James Jones <jajones@nvidia.com> Signed-off-by: Jamey Sharp <jamey@minilop.net>
2011-05-04Add support for building with Python 3David Coles1-19/+20
Python 3 introduces some language changes that cause issues when running c_client.py. This also breaks compatibility with Python 2.5 since it does not support the "as" statement in try/except blocks and does not have reduce() in the functools package. The main changes are: * try/except blocks require `except ... as ...:` to resolve syntactical ambiguity * map() and filter() return iterators rather than lists in Python 3 * reduce() is now in functools package (and not built-in in Python 3) * Dictionaries don't have a has_key() method in Python 3 * None and int types can't be directly compared in Python 3 * print() is a statement in Python 3 See http://diveintopython3.org/porting-code-to-python-3-with-2to3.html and PEP-3110 for details. Verified on Python 2.6.5 and 3.1.3. Signed-off-by: David Coles <dcoles@gaikai.com> Signed-off-by: Julien Danjou <julien@danjou.info>
2011-01-27Don't try to sizeof(void)Peter Harris1-4/+9
sizeof(void) is a gcc extension, and not portable. Xorg Bugzilla 31959 http://bugs.freedesktop.org/show_bug.cgi?id=31959 http://lists.freedesktop.org/archives/xcb/2010-May/006039.html Signed-off-by: Peter Harris <pharris@opentext.com> Tested-by: Cyril Brulebois <kibi@debian.org>
2010-09-22Fix _unserialize of reply headersPeter Harris1-2/+3
This cleans up a number of warnings, and passes the sequence number through correctly. Signed-off-by: Peter Harris <pharris@opentext.com>
2010-09-22Clean up a couple of warnings in xprintPeter Harris1-1/+1
Signed-off-by: Peter Harris <pharris@opentext.com>
2010-09-22Make *_unserialize safe to use on buffers in-placePeter Harris1-4/+5
By calling memmove instead of memcpy, and walking the buffer backward from the end, *_unserialize is safe to use in-place. Signed-off-by: Peter Harris <pharris@opentext.com>
2010-09-22Fix memory leak in _sizeof implemented with _unserializePeter Harris1-2/+7
Signed-off-by: Peter Harris <pharris@opentext.com>
2010-09-22Don't emit out-of-module sizeof definitionsPeter Harris1-2/+3
Signed-off-by: Peter Harris <pharris@opentext.com>
2010-08-16small fix to get rid of some compiler warningsChristoph Reimann1-2/+4
also added very basic documentation for xkb
2010-08-16added accessors for special casesChristoph Reimann1-545/+653
major bugfixes include: rewrite of prefix related functions, merge of serialize/unserialize/... generators, extended field name resolution
2010-08-08special case 'intermixed variable and fixed size fields': fixed reply side, ↵Christoph Reimann1-84/+166
needs testing
2010-08-05renamed most _unserialize() functions to _sizeof() and fixed _unserialize() ↵Christoph Reimann1-80/+240
for the special case of intermixed variable and fixed size fields
2010-08-02attempt to fix special case: variable fields followed by fixed size fieldsChristoph Reimann1-100/+141
2010-08-01bug fixes for all kinds of 'special cases'Christoph Reimann1-154/+299
2010-07-22partial rewrite of serialize helper functions completed;Christoph Reimann1-317/+211
_serialize() & _unserialize() have been tested for switch derived from valueparam
2010-07-20preliminary handling of further special cases in unserializeChristoph Reimann1-162/+284
first attempts to unify serialize and unserialize
2010-07-15added generating code for _serialize() in case of variable sized structs ↵Christoph Reimann1-103/+166
(largely untested)
2010-07-13new and still preliminary functions for switch; feautures includeChristoph Reimann1-26/+668
- API compatibility with valueparam - request _aux() auxiliary functions - _serialize() and _unserialize() auxiliary functions - new data type that allows mixing of fixed and variable size members
2010-05-14Add ~ operator support in code generatorMarcin Kościelnicki1-1/+3
Reviewed-by: Julien Cristau <jcristau@debian.org> Signed-off-by: Julien Danjou <julien@danjou.info>
2009-03-14Avoid name collisions between xidtype and enum.Peter Harris1-2/+18
These changes are necessary to build with latest xcb/proto. Signed-off-by: Peter Harris <pharris@opentext.com>
2009-03-13Revert "Don't use enums in generated C code"Peter Harris1-6/+8
This commit broke xcb/util. This reverts commit 9984b72888108a038d6b3f7dee374d17e26ef9e2. Signed-off-by: Peter Harris <pharris@opentext.com>
2009-02-25Don't use enums in generated C code - use integer constants instead.Peter Harris1-8/+6
Signed-off-by: Peter Harris <pharris@opentext.com>
2008-11-19Treat XIDs the same as other cardinal values.Peter Harris1-15/+3
This fixes a bug where c_client.py wasn't generating *_end functions, but expected them to exist in order to find the subsequent list's start. Signed-off-by: Peter Harris <peter.harris@hummingbird.com>