[Xcb] bind from XML

Jeremy Kolb jkolb at brandeis.edu
Sat May 13 11:18:02 PDT 2006

Florent Monnier wrote:
> Hi Jamey,
> Sorry I'm not so good in English so I'm not sure to understand everything.
> I really don't care if the key-words are something or something else.
> The ML style name was the first which came in my mind since I'm an every day 
> OCaml user :)
> I have seen that everything in the XML files is made for the C language since 
> every key words are C ones (enum, union, ...) and I really don't care of it.
> My question was only: could it be possible to make little enhancements to 
> bring it compatible with other languages than C ? since it seems (I'm not 
> sure yet) that it won't be descriptive enough for OCaml.

You should be able to generate bindings for any language really,
enum/union... while those names may be in C you can deal with them
however you want in your own bindings.  They simply exist in the XML, it
doesn't matter how you transform them for your own bindings.

> What I've found interesting in your project was the goal to make it safer and 
> closer to the X protocol.
> What I have understood was that the X protocol should be universal/portable, 
> so perhaps there could be several parts in the code generation, a description 
> of the X protocol which is language independent, and then another XML file 
> which builds structures (for a specific language) from this first description
> and then the templates...
> Well I guess this is an Utopia, and that I'm too much a dreamer :) since your 
> project is XCB where « C » stands for the C language. Moreover I am a 
> beginner so I need to practice, read all the docs on X, and enhance my skills 
> to say in a concrete way where there are problems if there are some.

Currently we use XSLT to do the language specific code generation, you
can use perl/python/whatever to do that, you don't need another xml
file.  I believe eventually we will have the documentation in the xml.

>>> I think this is a very fine idea!
>> I'm hesitant to get too excited about it, since it's not actually
>> necessary for any language binding, as far as I know. It may not even be
>> usable for its intended purpose unless we're very careful. As a general
>> principle it'd be nice for the descriptions to be as complete as
>> possible, though, especially for generating documentation and such.
> If the first level X protocol description in XML files would be shared between 
> several projects, the efforts would be more completed on the shared elements,
> don't you think?

We do that already, the XML is (fairly) language-neutral even if it
doesn't quite capture everything that it could at this point in time.


More information about the Xcb mailing list