[fpc-devel]x11 fix (and a "feature" in h2pas)

Nikolay Nikolov nickysn1983 at netscape.net
Wed Jul 30 15:08:35 CEST 2003

I already sent this message to the fpc-devel list (3 days ago), but I 
still haven't seen it being delievered, so I'm sending it again...

Basically the X11 package doesn't work. The reason is h2pas. It converts
   typedef char* XPointer;
   type TXPointer = char;

That (of course) leads to some very nasty effects, such as different
sizes of structs (since sizeof(pchar) is 4 and sizeof(char) is 1) and
all the bad things resulting from that. e.g. even ScreenOfDisplay
doesn't work - it is actually a macro that accesses
PXPrivDisplay(dpy)^.screens[scr] and of course TXPrivDisplay is
incorrect... :)

I can't fix h2pas, but I'm attaching diffs for the X11 units - x, xlib
and xutil. I also included a translation of the X11 keysymdefs and
implemented the macros properly in xlib and xutil, so that programming
for raw X with fpc, isn't more terrible than programming for raw X with gcc.

The new keysym unit has to be added to the makefiles or it has to be 
converted to an include file, and included in the xlib unit. BTW isn't 
it better to merge the X, Xlib and Xutil units into only one unit - Xlib?

I changed a few types to what I think is more correct. (e.g. from char 
to byte, etc.) Hope that doesn't break the units from the other packages 
that use xlib. (but it shouldn't, as the changes are few)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: x11.tar.bz2
Type: application/x-bzip2
Size: 15983 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20030730/0ee85518/attachment.bin>

More information about the fpc-devel mailing list