comp.lang.ada
 help / color / mirror / Atom feed
* Calling XtAppAddTimeOut, help
@ 1999-05-30  0:00 John B. Matthews, M.D.
  1999-05-30  0:00 ` Paul Hussein
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: John B. Matthews, M.D. @ 1999-05-30  0:00 UTC (permalink / raw)


Under IRIX 6.5, I'm trying to set up a callback using the X-windows
function Xt.Intrinsic.XtAppAddTimeOut. For some reason, the code raises
Program_Error when the call to XtAppAddTimeOut occurs. Example code
follows. I've tried making my own binding and allocating more space to
Xt.Intrinsic.XtAppStruct. The SGI binding appears to match the declaration
in Intrinsic.h. A call to the obsolete function XtAddTimeOut succeeds, but
the callback never excecutes. Any insights much appreciated; post or email
(sans deleteme) is fine.

Thanks in advance,

John

----- gnatchop here ----
-- gnatmake -g -n32 -mips3 timeout.adb -largs -lXm -lXt -lMrm -lX11
with Ada.Unchecked_Conversion;
with System;
with Text_IO;
with Timer_CB;
with Xt.Intrinsic;

procedure TimeOut is

--- Convert a System.Address to an XtPointer
function To_XtPointer is new Ada.Unchecked_Conversion (
    System.Address, Xt.Intrinsic.XtPointer);

--- Timer static data
App_Context : Xt.Intrinsic.XtAppContext := new Xt.Intrinsic.XtAppStruct;
Timer_Id    : Xt.Intrinsic.XtIntervalId := 0;

begin
    --- Add a timer callback
    Timer_Id := Xt.Intrinsic.XtAppAddTimeOut ( -- dies here!
        App_Context => App_Context,
        Interval    => 200, -- 200 msec
        Proc        => Timer_CB.Timer_Callback'Access,
        Closure     => To_XtPointer (Timer_Id'Address));
    Delay 10.0;
    Text_IO.Put_Line("Main ends.");

end;

package body Timer_CB is

procedure Timer_Callback (
    Closure : Xt.Intrinsic.XtPointer;
    Id      : access Xt.Intrinsic.XtIntervalId) is
begin
    Text_IO.Put_Line("In callback.");
end Timer_Callback;

end;

with Text_IO;
with Xt.Intrinsic;

package Timer_CB is

procedure Timer_Callback (
    Closure : Xt.Intrinsic.XtPointer;
    Id      : access Xt.Intrinsic.XtIntervalId);
pragma Convention (C, Timer_Callback);

end;
----- code ends -----




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1999-06-07  0:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-05-30  0:00 Calling XtAppAddTimeOut, help John B. Matthews, M.D.
1999-05-30  0:00 ` Paul Hussein
1999-06-01  0:00 ` dennison
1999-06-07  0:00 ` John

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