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 X-Google-Attributes: gid103376,public From: "Paul Hussein" Subject: Re: Calling XtAppAddTimeOut, help Date: 1999/05/30 Message-ID: <7ir1ug$9nf$1@lure.pipex.net>#1/1 X-Deja-AN: 483700399 References: X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 X-Complaints-To: abuse@uk.uu.net X-Trace: lure.pipex.net 928058128 9967 194.69.105.11 (30 May 1999 09:55:28 GMT) Organization: UUNET WorldCom server (post doesn't reflect views of UUNET WorldCom X-MSMail-Priority: Normal NNTP-Posting-Date: 30 May 1999 09:55:28 GMT Newsgroups: comp.lang.ada Date: 1999-05-30T09:55:28+00:00 List-Id: Where is you app context coming from. Should it not be the app context for the main app window ? I am working on SGI with gnat Ada and C, and have just implemented a timeout o.k. However, I write the Motif code in C and interface to it. Best approach would be to write it in C and get it working first, then gradually move to Ada, one part at a time. John B. Matthews, M.D. wrote in message news:matthewsj-ya023680003005990012190001@news.saic.com... > 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 -----