Has anyone created an IDL file for Xlib? Alternatively, has anyone created one for
H/Direct?
I know that someone is working on GTK, but I'm interested in Xlib specifically. Also,
I'm aware of Sigbjorn's Xlib interface in Haggis, but that one's reportedly still for
GHC 0.29. :(
BTW, it's not urgent---I don't have any experience with either Xlib or H/Direct yet; I
just want to play around with them. Having unsuccessfully checked the net for a
suitable IDL description, I'm taking a shot at writing one myself, and I have a couple
questions. (If I ever get this into a usable form, I'll notify you all.)
First, judging from the DCE grammar it looks like you can't specify attributes for
constants. In a constant definition like
const char *XNCursor = "cursor";
will H/Direct figure out the right interpretation for char *?
Do I need to specify an attribute (ref, ptr, unique, ..) for every occurrence of a *
type in a struct field, or is there a default? The user manual seems to imply that
translation of char * types default to [string], but I didn't see any mention of this
in my perusal of the DCE spec. The technical report on H/Direct mentions a "pointer
default" in connection with the internal translation into core IDL; the DCE spec
mentions that you can set a pointer default by setting it on an interface. What about
at top level? Is the default just [ptr] for non-char * cases?
There is a function which takes an argument that is a pointer to an allocated struct,
and deallocates it. What is the correct annotation for this behavior?
xlib.h has a macro:
#define Bool int
Is it safe to translate this as
typedef boolean Bool;
? Apparently the "recommended" C-translation for boolean is char...
Finally, any ideas on how to handle callbacks...? Any other special provisos or advice
on dealing with Xlib?
--FC