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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,34e28efa1a88ae84 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news3.google.com!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!oleane.net!oleane!hunter.axlog.fr!nobody From: Jean-Pierre Rosen Newsgroups: comp.lang.ada Subject: Re: Access procedure to pointer Date: Wed, 28 May 2008 17:26:01 +0200 Organization: Adalog Message-ID: References: <483C48B5.9060303@gmail.com> <483D209D.5010408@gmail.com> <483D72F0.9090308@gmail.com> NNTP-Posting-Host: mailhost.axlog.fr Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Trace: s1.news.oleane.net 1211987257 3179 195.25.228.57 (28 May 2008 15:07:37 GMT) X-Complaints-To: abuse@oleane.net NNTP-Posting-Date: Wed, 28 May 2008 15:07:37 +0000 (UTC) User-Agent: Thunderbird 2.0.0.14 (Windows/20080421) In-Reply-To: <483D72F0.9090308@gmail.com> Xref: g2news1.google.com comp.lang.ada:428 Date: 2008-05-28T17:26:01+02:00 List-Id: S�bastien a �crit : >> Why don't you simply use Ada.Interrupts? > > Two reasons: > 1) It didn't know it exists > 2) It's not documented, and not intuitive, no example nothing to start. > > As a matter of fact, the first problem is solved ;-), if you any help > about the second problem, I'll be happy to use standard package instead > of mine. > Well, it is documented in the reference manual, and a quick search for the word "interrupt" in the index would have put you right there... However, I think this is an interesting example. I guess the OP simply thought "oh, I must handle interrupts, therefore I must interface with the system - i.e. use C)", he didn't even imagine that it was provided out of the box... Short answer: to attach statically: pragma Attach_Handler (PO.P, Interrupt_Number); to attach dynamically: Ada.Interrupts.Attach_Handler (PO.P'Access, Interrupt_Number); Note that the handler must be a *protected* procedure (i.e. a procedure declared in a protected type), to model the non-reentrant nature of interrupt handlers. -- --------------------------------------------------------- J-P. Rosen (rosen@adalog.fr) Visit Adalog's web site at http://www.adalog.fr