Enums, bitfields and wl_arrays in the .xml file

Victor Berger victor.berger at polytechnique.org
Fri Sep 25 03:43:55 PDT 2015


On 2015-09-25 12:25, Nils Chr. Brause wrote :
> Hi,
> 
> On Fri, Sep 25, 2015 at 10:52 AM, Victor Berger
> <victor.berger at polytechnique.org> wrote:
>> 
>> What I meant here is that the format and contents of the XML files is
>> currently defined by the implementation of the C scanner, which is a 
>> less
>> than optimal situation to discuss evolutions of this format.
>> 
>> There will most likely be a need to write a proper document describing 
>> the
>> format of the XML files, as well as the semantic meanings of each 
>> field and
>> attribute it contains.
> 
> Isn't the DTD file the specification for the XML file format?

Not exactly, it only defines the valid structure of the file, but not 
how a scanner should interpret the values contained in the fields.

Mainly, a specification of how a scanner should behave given an XML 
input. In my opinion, it should be informative enough to write a new 
scanner
for any language _without_ needing to reverse-engineer the C scanner 
(which I had to do to write my Rust bindings).

Ideally, the protocol itself could be separated from the 
wayland-{client,server} libraries, but in practice it is not possible to 
re-implement the protocol down from the
wire format (which is a shame, but required for EGL support with mesa). 
So I think it makes sense to describe it altogether.

>> The questions about how breaking evolutions will be handled need to be
>> specified as well: how should an old scanner behave when it encounters 
>> a
>> more recent protocol file, containing fields or attributes it does not
>> recognize ? Ignore them ? Fail and declare being "not compatible with 
>> this
>> protocol format, please upgrade" ?
> 
> The last one makes the most sense to me. Someone who develops a
> language binding should always keep her/his scanner up to date with the
> most recent XML file format.

Agreed...

> [...]
> Also, from the discussion last year it emerged that the scanner should 
> also be
> modified to at least check for the validity of the new attribues.
> You can find the work that I had done so far here:
> https://github.com/NilsBrause/Wayland/commits/xml

... but from the discussion I had with pq on IRC, it does not seem like 
having the C-scanner start rejecting "old" protocol files is a welcomes 
outcome, from they point of view.

However, maybe checking the file, and emitting warnings if it is in an 
old format could be an option ?

The other bindings could explicitly refuse old formats, I don't think 
it's a deal breaker either.

----
Victor




More information about the wayland-devel mailing list