[Xcb] bind from XML (was: Objective-C binding)

Florent Monnier fmonnier at linux-nantes.fr.eu.org
Fri May 12 14:48:13 PDT 2006


Hi,
I'm continuing to bind the xlib for OCaml even if I'll stop to switch on 
another way to make OCaml X clients. For beginning it's the easiest way to 
get used to X programming since the xlib is installed yet and there are a lot 
of tutorials, demos to see and documentations everywhere on the web.

(I still haven't understood where to get the modular proto.pc, if you could 
give me a pointer on it, I would appreciate.)

> > > I would probably need to use something other than xslt, such as
> > > perl, for processing the files, since xslt doesn't look very
> > > conductive to outputting Objective-C, and a quick google search
> > > hasn't turned up any equivalents.
> >
> > Well, XSLT doesn't seem any less conducive to outputting Objective-C
> > than C. :)
>
> If you don't like XSLT for this -- for which I can't blame you -- my
> favorite would probably be HaXML or CDuce. (I have yet to actually try
> either, but they look awesome.) But do whatever works for you.

CDuce is written in OCaml and in my humble opinion is quite hard.
There is XMLite in OCaml too that is very easy to use, and its source code is 
very small, so you can modify it easily for your needs.
XMLite uses ocamlyacc and ocamllex (which are close to yacc and lex).

In a previous email you have suggested that I could take the XML files of XCB 
to produce an X clients for my favorite language.
I guess it is the better idea, and the best thing to do in my case.

So I've found:
./xcb-proto-0.9/doc/xml-xcb.txt
./xcb-proto-0.9/src/xcb_types.xml
./xcb-proto-0.9/src/xproto.xml
./xcb-proto-0.9/src/extensions/*.xml

I haven't found "c-client.xsl"

And I would like to know where is the X protocol specs I should use?
Is it this one:  http://www.ietf.org/rfc/rfc1013.txt  ?

For exemple OCaml is very strict with types, so I have noticed in RFC
in  SECTION 12.  EVENTS  for KeyPress there is:
           root, event: WINDOW
           child: WINDOW or None
while in  ./xcb-proto-0.9/src/xproto.xml  there is:
  <event name="KeyPress" number="2">
      <field type="WINDOW" name="root" />
      <field type="WINDOW" name="event" />
      <field type="WINDOW" name="child" />
      <!--  [...]  -->
  </event>

I am not sure at all of this but perhaps it should be a little bit more strict 
for OCaml users, for exemple switching to:
      <field type="WINDOW option" name="child" />

Well I'm not sure at all of everthing since I'm a newbee, but if there would 
be a need for little changes on the XML files to make these compatible with 
other X bindings, would it be possible or not ?

-- flo


More information about the Xcb mailing list