From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,6c9b3d9d1ba1b2e1,start X-Google-Attributes: gid103376,public From: matthewsj@deleteme.saic.com (John B. Matthews, M.D.) Subject: Calling XtAppAddTimeOut, help Date: 1999/05/30 Message-ID: #1/1 X-Deja-AN: 483641514 Content-transfer-encoding: 8bit Organization: SAIC Content-Type: text/plain; charset=ISO-8859-1 Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 1999-05-30T00:00:00+00:00 List-Id: 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 -----