| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
With commit 65169c1af7893882c21d1e2a544903212b8d6fb0, I am seeing build
failures in libxcb, using sys.version_info fixes those.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This makes the code added in the previous commit consistent with the
rest of the code base. From Björn's suggestion:
This should import xml.etree.{,c}ElementTree conditionally on the
version of the Python interpreter used to import this module.
xml.etree.ElementTree is preferred for Python >= 3.3, as it uses the
fastest possible implementation automatically. Earlier versions of
Python need xml.etree.cElementTree as they may not have an
implementation that can be used in a platform generic way.
Suggested-by: Björn Esser <besser82@fedoraproject.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
All X11 errors have the same fields. There are no differences.
In a perfect world, the XML could thus just say "define an error" and
xcbgen would do all the rest. However, the world is imperfect and we
already have a mixture of fields defined in the XML. Some of the XML
even defines trailing padding, while most does not.
This commit makes xcbgen add all fields to X11 errors, but those that
are already defined in the XML are skipped and left as-is. Due to the
structure of the code, this requires pretending that a different XML was
read, i.e. the code now modifies the in-memory structure of ElementTree
to add the missing fields to the in-memory representation of the XML.
This is the simplest way that I found to append elements. The existing
mechanisms can only prepend fields.
The approach taken by this commit was suggested by Peter Harris. Thanks
a lot for this idea, it's a lot simpler than my previous approach.
Fixes: https://gitlab.freedesktop.org/xorg/proto/xcbproto/-/issues/16
Signed-off-by: Uli Schlachter <psychon@znc.in>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently the layout of a struct is used to compute its size. This works
fine in case of structs of fixed size. However this introduces
forwards-compatibility problems in cases when the struct has multiple
variants and the exact variant is specified by the value of some field
(e.g. in the case of <switch> elements). Future revisions of protocols
may introduce new layout variants, in which case the old code does not
know the size of the struct variant and can't parse the incoming byte
stream.
Instead of relying on knowledge about the layout of data structures we
should instead use the length field for length information. This way
when old client libxcb communicates with newer server it can at least
ignore unknown struct variants.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In commit 7d58eed95f796fc764741d7549ee2214bbbcc64c 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: https://github.com/python/cpython/commit/a72a98f24a19928e31dcc4cab2cd2ad0f1846e11
Signed-off-by: Björn Esser <besser82@fedoraproject.org>
|
|
|
|
|
|
| |
It can be replaced with xml.etree.ElementTree safely.
Signed-off-by: Björn Esser <besser82@fedoraproject.org>
|
|
|
|
|
|
|
|
| |
fractions.gcd() has been deprecated since Python 3.5, and
was finally dropped in Python 3.9. It is recommended to
use math.gcd() instead.
Signed-off-by: Björn Esser <besser82@fedoraproject.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In xv.xml, there is something like this:
<struct name="ImageFormatInfo">
[...]
<field type="CARD8" name="byte_order" enum="ImageOrder" />
<pad bytes="2" />
<list type="CARD8" name="guid">
<value>16</value>
</list>
[...]
</struct>
When parsing this, the Field instance for "guid" ended up with .enum ==
"ImageOrder". This is because the loop that parses complex type did not
unset a variable across iterations, meaning that the last "enum"
property "stuck" and was also used for all following fields.
Fix this by simply moving the initialisation of the "enum" variable
inside of the loop.
Signed-off-by: Uli Schlachter <psychon@znc.in>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
XFixes contains a CreateRegion request:
<request name="CreateRegion" opcode="5">
<field type="REGION" name="region" />
<list type="RECTANGLE" name="rectangles" />
</request>
This request contains a list of type RECTANGLE. This struct comes from
xproto and is thus not contained in xfixes itself.
Normal "Struct"s have their resolve() method called early, because they
appear in the module itself. However, in the CreateRegion case, this
struct is imported and thus does not get resolved. Instead, ListType's
resolve() method calls self.member.resolve(module). Thus, only at this
point is the struct resolved.
Why is this important? Struct.resolve() is the same as
ComplexType.resolve() and this function does self.calc_size() at the
end. Thus, only after the struct was resolved is its size known. Before
that, the size is just set to 0 (this happens in ComplexType.__init__).
However, ListType.__init__ already computes its size member based on its
member. At this point, this is still 0 so the list ends up believing its
size to be zero.
Fix this by recomputing self.size in ListType.resolve().
Signed-off-by: Uli Schlachter <psychon@znc.in>
|
|
|
|
|
|
|
| |
According to git grep '\.fds', this does not appear anywhere else in
xcb-proto or libxcb.
Signed-off-by: Uli Schlachter <psychon@znc.in>
|
|
|
|
|
|
|
|
|
|
| |
Add a special case in ListType to support lists of file descriptors,
which also requires explicit support within clients.
File descriptors are not supported as children of other complex types,
e.g. switch.
Signed-off-by: Daniel Stone <daniels@collabora.com>
|
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
| |
Set the lenfield of a sumof expression object, so that
libxcb or other generators won't need to look it up.
This object is trivially available in the parser but
needs a complex lookup in generators.
Signed-off-by: Christian Linhart <chris@demorecorder.com>
|
|
|
|
|
|
|
| |
Fixes build with python-3.x.
Signed-off-by: Thomas Klausner <wiz@NetBSD.org>
Signed-off-by: Uli Schlachter <psychon@znc.in>
|
|
|
|
|
|
|
| |
At least python-3.5.x complains about this forcefully.
Signed-off-by: Thomas Klausner <wiz@NetBSD.org>
Signed-off-by: Uli Schlachter <psychon@znc.in>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
From now on, due to a patch in libxcb, pads will not be serialized
anymore. This is to maintain ABI-compatibility when adding
explicit align pads.
However, some align pads were already be serialized in prior
official versions of libxcb. Therefore we need a method to
enforce serialization, so we can maintainn ABI compatibility
with that legacy.
Signed-off-by: Christian Linhart <chris@demorecorder.com>
|
|
|
|
|
|
|
| |
Some rework done by Christian Linhart
Signed-off-by: Jaya Tiwari <tiwari.jaya18@gmail.com>
Signed-off-by: Christian Linhart <chris@demorecorder.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The verification algorithm basically traverses the protocol-description
of a protocol entity by recursively processing all fields and their
types.
A start-align consists of two numbers:
* the alignment: This is a power of 2, and guarantees that the
address (or protocol position) minus the offset can be divided
by this number.
* the offset: how many bytes the current position is after a
position that can be divided by the alignment.
The algorithm starts with the start-alignment and computes the alignment
of each field from the start-align of the previous field as follows:
* if the previous field is a primitive type then the offset is increased
by the size of the primitive type module the alignment.
If the alignment or offset are incompatible with the primitive type,
then an error is reported.
* if the previous field is a complex type, then it is processed recursively.
* if the previous field is an alignment-pad, then the alignment is
adjusted accordingly, as to be expected by the alignment-pad.
Start-aligns can also be set manually with the xml-element
"required_start_align" which has two attributes: "align" and "offset"
If "offset" is omitted, it is assumed to 0.
All toplevel protocol entities default to 4-byte start-alignment with offset 0.
All non-toplevel complex entities, such as structs, switch, case, ...
do not have a default alignment.
If no alignment is explicitly specified for them, their alignment
is computed by their usage in other entities.
In that case, if they are used with aligments that violate the
alignment requirements of some of their fields, an error is issued.
If they are used with an alignment with non-zero offset,
a warning is issued, which recommends to specify the required_start_align
explicitly. (Reason: I don't want non-zero offsets to be silently
computed automatically. These non-zero offsets have to be reviewed
by a human and specified explicitely to record that this was reviewed
by a human)
If the required_start_align is explicitly specified for an entity
then an error will be issued if it is used with an aligment that's
incompatible with the explicitly specified alignment.
If an entity is used in different contexts with different start-aligns
then those start-aligns are combined to an align which is compatible
with all aligns.
E.g. (align 4, offset 0) and (align 4, offset 2) are combined
to (align 2, offset 0).
Error reports include the relevant context for a misalignment.
For non-toplevel entities this includes the entity-usage stack.
There is some complexity in the algorithm for reducing the size
of the error-reports to include only the relevant info.
This alignment verifier is also a prerequisite for getting
rid of implicit alignment altogether.
(This will then simplify the generated code and make it faster.)
Signed-off-by: Christian Linhart <chris@demorecorder.com>
|
|
|
|
|
|
|
|
|
| |
Removed all the valueparam occurences from parsers and xml schema as
well along with all the protocol
definitions as valueparam has been replaced by switch bit-case
Signed-off-by: Jaya Tiwari <tiwari.jaya18@gmail.com>
Reviewed-by: Christian Linhart <chris@demorecorder.com>
|
|
|
|
|
|
|
|
|
|
|
| |
paramref is similar to fieldref, but has a type attribute.
Message-ID: <1410136150-30254-1-git-send-email-chris@demorecorder.com>
Patch-Thread-Subject: [Xcb] parametrized structs implemented
Patch-Set: ParametrizedStruct
Patch-Number: proto 1/5
Patch-Version: V1
Signed-off-by: Christian Linhart <chris@DemoRecorder.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add parser-support for the new expression-type "listelement-ref"
which represents the current list-element when used inside
a list-iteration expression such as <sumof>.
This patch includes computation of the flag "contains_listelement_ref"
which is set to True when an expression or any of its
subexpressions is a listelement-ref.
(This is needed by the generator)
Message-ID: <1409845742-38797-2-git-send-email-chris@demorecorder.com>
Patch-Thread-Subject: [Xcb] support popcount of a list and associated xml changes
Patch-Set: PopcountList
Patch-Number: proto 2/8
Patch-Version: V1
Signed-off-by: Christian Linhart <chris@DemoRecorder.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add parser support for sumof with a nested expression.
For example:
<sumof ref="mylist1">
<fieldref>bar</fieldref>
</sumof>
The nested expression is added as the "rhs"-field of the
expression.object.
Signed-off-by: Christian Linhart <chris@demorecorder.com>
Reviewed-by: Ran Benita <ran234@gmail.com>
Message-ID: <545627E1.8070302@DemoRecorder.com>
Patch-Thread-Subject: [Xcb] [PATCHSET] ListInputDevices revision 2
Patch-Set: ListInputDevices
Patch-Number: proto 4/8
Patch-Version: V1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Objects of type Field get a reference to their parent.
This is needed in the generator to differentiate
field handling dependend on properties of their parent.
Signed-off-by: Christian Linhart <chris@demorecorder.com>
Reviewed-by: Ran Benita <ran234@gmail.com>
Message-ID: <545627CB.1000606@DemoRecorder.com>
Patch-Thread-Subject: [Xcb] [PATCHSET] ListInputDevices revision 2
Patch-Set: ListInputDevices
Patch-Number: proto 1/8
Patch-Version: V1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
"case" is implemented as a variation of "bitcase" as follows:
The old class "BitCaseType" became the abstract class
"CaseOrBitcaseType" with two derived classes
"CaseType" and "BitcaseType".
(Therefore BitcaseType keeps the old semantic which may
be important for some generators)
There are two additional flags in class Type:
* is_case
* is_case_or_bitcase
The latter is for convenience because case and bitcase
have to be treated the same way in many cases.
The list of cases and bitcases in a SwitchType object
is still called "bitcases".
Reasons:
* Renaming that list would break generators based on the parser.
* Creating an extra list for cases would make other code more
complicated because you usually want to iterate over all
case and bitcase members of a switch.
Reviewed-by: Ran Benita <ran234@gmail.com>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
| |
Reviewed-By: Ran Benita <ran234@gmail.com>
Signed-off-by: Peter Harris <pharris@opentext.com>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=71418
|
|
|
|
|
|
|
| |
These are present in the API, but not present on the wire.
Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
|
|
|
|
|
|
|
| |
With these patches, we are able to mark an XGE event as such and
generate the correct header for it.
XGE events can be found in the X Input Extension v2++.
Signed-off-by: Daniel Martin <consume.noise@gmail.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Peter Harris <pharris@opentext.com>
|
|
|
|
|
|
|
|
|
|
| |
Adopt the XML schema change from commit
ee71d96 Allow multiple <enumref> in a <bitcase>
and its usage with commit
b3b5e02 XKB: Fix GetKbdByName.
Signed-off-by: Daniel Martin <consume.noise@gmail.com>
Signed-off-by: Peter Harris <pharris@opentext.com>
|
| |
|
|
|
|
| |
Signed-off-by: Julien Danjou <julien@danjou.info>
|
|
|
|
|
|
|
|
| |
This is fallout from commit 76ca2c0b1527541be59c344118c538ba055ad9d8,
which renamed the *parent parameter of ExprType.__init__, but failed
to rename the instance attribute to which it was assigned.
Signed-off-by: Julien Danjou <julien@danjou.info>
|
|
|
|
|
|
|
|
|
| |
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>
|
|
|
|
| |
xml: small fixes according to Xlib or the spec
|
| |
|
| |
|
|
|
|
| |
appear inside another switch)
|
|
|
|
| |
- added SwitchType and BitcaseType
|
| |
|
| |
|
| |
|
|
|
|
|
| |
Reviewed-by: Julien Cristau <jcristau@debian.org>
Signed-off-by: Julien Danjou <julien@danjou.info>
|
|
|
|
|
|
|
|
|
|
|
| |
As a side-effect it also adds octal and binary literals. Exact syntax is
described at http://docs.python.org/reference/lexical_analysis.html#numbers
It is unwise to use full syntax, as there might be other binding generators,
octal, binary and hex literals seem to be safe though.
Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Signed-off-by: Julien Danjou <julien@danjou.info>
|
|
|
|
|
|
|
|
|
| |
structures"
This change fixes a ConfigureWindow request padding issue,
but has a bug that affects xpyb (#24507).
This reverts commit 57934caa3fb207320c33312646d8e98290950f51.
|
|
|
|
|
|
|
| |
The Enum-class now exports the bit numbers in the 'bits'-list
if they have been specified in the protocol description.
Signed-off-by: Bart Massey <bart@cs.pdx.edu>
|
|
|
|
|
|
|
| |
Now more language independent as some languages don't have
C-like shift-operators.
Signed-off-by: Bart Massey <bart@cs.pdx.edu>
|