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, MSGID_RANDY 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: John B. Matthews, M.D. Subject: Re: Calling XtAppAddTimeOut, help Date: 1999/06/07 Message-ID: <7jh6s9$vua$1@nnrp1.deja.com>#1/1 X-Deja-AN: 486751306 References: X-Http-Proxy: 1.0 x27.deja.com:80 (Squid/1.1.22) for client 198.151.12.16 Organization: Deja.com - Share what you know. Learn what you don't. X-Article-Creation-Date: Mon Jun 07 19:34:33 1999 GMT Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.51 [en] (WinNT; U) via NetCache version NetApp Release 3.2.1: Thu May 21 16:33:01 PDT 1998 Date: 1999-06-07T00:00:00+00:00 List-Id: Thanks to everyone who offered insight into this problem. Many pointed out that XtAppContext wasn't being initialized; others observed that there was no X event loop. The correct solution was a combination of both. Specifically, the XtAppContext passed to XtAppAddTimeOut must be precisely the same one created at initialization time and later used in the event loop. John In article , matthewsj@deleteme.saic.com (John B. Matthews, M.D.) wrote: > 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 ----- > Sent via Deja.com http://www.deja.com/ Share what you know. Learn what you don't.