Commit graph

10 commits

Author SHA1 Message Date
Björn Esser
029d5b5d70 xcbgen: Use xml.etree.ElementTree for Python >= 3.3.
In commit 7d58eed95f we started
to use xml.etree.ElementTree for Python >= 3.9.  In fact the
xml.etree.cElementTree module has already been deprecated
since Python 3.3.

Given this fact, we should start to use the xml.etree.ElementTree
module beginning with Python 3.3.

See: a72a98f24a

Signed-off-by: Björn Esser <besser82@fedoraproject.org>
2020-06-04 21:08:08 +02:00
Björn Esser
7d58eed95f xcbgen: xml.etree.cElementTree has been dropped in Python 3.9.
It can be replaced with xml.etree.ElementTree safely.

Signed-off-by: Björn Esser <besser82@fedoraproject.org>
2020-06-01 12:40:34 +02:00
Uli Schlachter
e79f6b01e0 Allow access to the original type in the XML
xcbgen 'helpfully' transforms things to C types already so that libxcb
does not have to do so. Thus, even though the XML says that a field has
type CARD8, xcbgen will claim uint8_t. This might be a bit weird, but is
so far totally fine.

However, the type mapping that xcbgen uses is not injective. All of
CARD8, BYTE and BOOL get turned into uint8_t and the original type is
lost.

This is totally fine for libxcb, but programming languages other than C
do have built in boolean types. My personal problem is with Rust, where
providing a boolean for an integer argument causes a compiler error.
This results in (relatively) ugly "0 / 1" instead of "false / true".

This commit adds a new xml_type member to SimpleType. This type contains
the original string that appeared in the XML file.

Since libxcb creates instances of SimpleType itself and to avoid
breaking the API, the new argument to SimpleType.__init__ defaults to
None.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-12-28 08:32:05 +00:00
Christian Linhart
4aa40fbd5e add support for eventstruct
eventstruct is a new xml element that allows to use events
as part of requests.

This is, e.g., needed by the SendExtensionEvent request
of the XINPUT extension.

Signed-off-by: Christian Linhart <chris@demorecorder.com>
2017-03-11 10:49:27 +01:00
Keith Packard
4270141a7c Also track directly imported modules in a separate list
This allows the generated header files to only include the
directly referenced header files, with the indirectly referenced header
files included by the directly referenced ones.

Signed-off-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-02-19 21:35:16 +01:00
Peter Harris
a05a510635 Track pad count at the module level
If the pad count is reset for each bitcase, the names will collide
in the encompasing switch struct.

Reviewed-By: Ran Benita <ran234@gmail.com>
Signed-off-by: Peter Harris <pharris@opentext.com>
2014-01-21 15:22:43 -05:00
Keith Packard
4d8241c67c Add CARD64/INT64 protocol types
No reason to make people use two 32-bit values when every modern
compiler has native 64-bit objects.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2013-11-06 16:50:55 -08:00
David Coles
f877a6f34c Use absolute imports in xcbgen for Python 3 compatibility
Python 3 has stricter syntax for relative imports. Use absolute imports to
ensure compatibility with all versions of Python. Also break cyclical module
import between state.py and matcher.py by deferring import.

Signed-off-by: David Coles <dcoles@gaikai.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
2011-05-03 10:21:55 +02:00
Eamon Walsh
bf652a63fe Work around a Python bug involving the file name 'types.py'. 2008-07-09 13:41:10 -04:00
Eamon Walsh
7820273c4b Add Python parser language-independent parts. 2008-04-19 04:30:21 -04:00