[Xcb] bind from XML

Florent Monnier fmonnier at linux-nantes.fr.eu.org
Sat May 13 11:55:52 PDT 2006


Hi Jeremy,

> > 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.

Sorry my English is not quite good to say all I want to say,
I was willing to mean that I really don't care if the key-words are C ones.

What I was willing to point is that it seems there will be lacks in the XML 
files, which lacks are not important for C, but that could be important for 
OCaml.
For example if an argument is optional :

  <event name="KeyPress" number="2">
      <field type="WINDOW" name="root" />
      <field type="WINDOW" name="event" />
      <field type="WINDOW" name="child" />
      <!--  [...]  -->
  </event>

change the field child to say that it is optional, something like this:
      <field type="WINDOW_or_NULL" name="child" />
or like that:
      <field name="child">
          <type name="WINDOW" />
          <type name="NULL" />
      </field>
or something else...
  I don't care the syntax, my question is just:
Could it be possible to modify things when needed?
(in order to make the XML files portable for other languages than C)


> 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.
XML-Light (an OCaml XML parser à la DOM) written by Nicolas Cannasse is nice
http://tech.motion-twin.com/xmllight

>        I believe eventually we will have the documentation in the xml.

Is it possible to mix in the same file GPL code and FDL doc ?


> > 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.

/me trolling: from a C programmer point of view, yes it is :-)

I am currently downloading the 45M of Xorg src to get the specs of the X11R6.9 
protocol. As you say the XML doesn't capture everything yet, if you are 
willing to improve that point, I hope I will be able to help.

-- 
Cheers
flo


More information about the Xcb mailing list