Am Mon, 03 Jun 2013 01:02:12 +0200
schrieb "Adam D. Ruppe" <[email protected]>:

> On Sunday, 2 June 2013 at 21:53:56 UTC, Marco Leise wrote:
> > Also eventually we should generate X bindings for all
> > platforms (including Windows) from the XML definitions like
> > XCB does.
> 
> hmm I don't see an xml file for Xlib.h on my system, do you know 
> if there is supposed to be one? Though I'm pretty sure I have 
> most of it correct now, so I guess it isn't really necessary.

XCB is generated from these XML files. They have nothing to do
with Xlib. You can find the XML files here:
http://cgit.freedesktop.org/xcb/proto/tree/src
A generator tool for the target language (C in this case)
parses them and creates include files from them that define
all the remote procedure calls to the X Server. Internally
those calls rely on a small generic set of functions that
serializes the requests for transmission.

What is needed are those generic functions written in D to
establish the connection to the server and handling
serialization, probably relying on std.socket.
And then an XML parser that would write out .d files for the
different modules of the X Server, like xrandr, xkb and so on,
which are all available as separate XML files.

This is what a RPC from glx.xml looks like:

        <request name="GenTextures" opcode="145">
                <field type="CONTEXT_TAG" name="context_tag" />
                <field type="INT32" name="n" />
                <reply>
                        <pad bytes="1" />
                        <pad bytes="24" />
                        <list type="CARD32" name="data">
                                <fieldref>length</fieldref>
                        </list>
                </reply>
        </request>

In general they also include documentation tags which can be
made available through DDoc automatically and displayed in
IDEs like Mono-D already does.

> I know everybody says Xlib is dying but I still use it. It is 
> simple enough and gets the job done without having to learn a 
> whole thing library...

The big deal about it is asynchronous RCP especially over
internet connections to X Servers, since with Xlib you have to
way for each response before the next request.

-- 
Marco

Reply via email to