comp.lang.ada
 help / color / mirror / Atom feed
From: jim hopper <hopperj@macconnect.com>
Subject: X11 binding with FSF version of gnat
Date: Thu, 06 Feb 2003 23:49:19 -0500
Date: 2003-02-06T23:49:19-05:00	[thread overview]
Message-ID: <060220032349197450%hopperj@macconnect.com> (raw)

From: james hopper <hopperj@macconnect.com>

I am having a bit of a problem with x11 bindings when compiled for osx
(the intermetrics bindings updated for linux). I was hoping someone
might have worked with the bindings on os x or have some idea whats
going on.  This is using the os x version of gnat, so i don't know if
its a problem with our version of gnat or something that is specif to
gnat 5x. 

problem is this:

there is a type in x-xlib.ads that looks like this:

    type XEvent (Event_Type: X.signed_int := X.LASTEvent + 1) is record                      
-- Xlib.h:934
        serial       : X.unsigned_long;                     --
Xlib.h:902
        send_event   : Bool;                                --
Xlib.h:903
        display      : XDisplay_access;                     --
Xlib.h:904
   case Event_Type is
       when X.KeyPress | X.KeyRelease =>
      xkey     : XKeyEvent;                       -- Xlib.h:937
       when X.ButtonPress | X.ButtonRelease =>
      xbutton  : XButtonEvent;                    -- Xlib.h:938
...

its used in test sample called basicwin.adb where the type is
instantiated as

    Report             :          aliased X.Xlib.XEvent;

(note its using the default for the descriminant

ok now its used like this:

    loop
        X.Xlib.XNextEvent(Display, Report'access);
   ada.text_io.put_line("Here" & X.signed_int'image(Report.Event_Type) &
      Integer'image(Report'size/8));
        case  (Report.Event_Type) is
            when X.Expose =>
      ada.text_io.put_line("Expose");
      ...
            when X.ConfigureNotify =>
       ada.text_io.put_line("ConfigureNotify");
      ada.text_io.put_line("width = " &
integer'image(integer(Report.Xconfigure.Width)));
      ada.text_io.put_line("height = " &
X.signed_int'image(Report.Xconfigure.Height));
      ...
   when ...

i thought at first the problem was it wasnt being allocated because
when you use the debugger and stop right after the xnextevent  and do
"print report"  it shows report as a null record, however if i do

x/20 report'address

i can see that the data is all there and looks correct.

when i try to access the height and width field in x.configurenotify
version of the variant record, the print statements above it gets a
constraint error.  if i change x-xlib.ads to use x.xconfignotify as the
default descriminant then the height and width are fine, but then
expose variant gets a constraint error when it tries to access internal
fields of the expose variant. 

This looks like either a compiler problem, or something thats changed
from 3.13 (which i used the bindings for before) that doesnt like the
variant being changed behind the compilers back.  oh yes and i have to
use -gnatp or it always blows up when i try to access it with
constraint error in the descriminant.

Any information on this would help.

thanks jim



             reply	other threads:[~2003-02-07  4:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-07  4:49 jim hopper [this message]
2003-02-07 11:15 ` X11 binding with FSF version of gnat Jeffrey Creem
2003-02-07 16:50 ` Jean-Claude Mahieux
2003-02-07 17:02   ` David Botton
2003-02-07 17:06   ` Larry Kilgallen
2003-02-07 18:19     ` Jean-Claude Mahieux
2003-02-08  0:21   ` jim hopper
2003-02-10 10:06     ` Jean-Claude Mahieux
2003-02-11  0:12       ` jim hopper
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox