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,989d8fbfea6cca1b X-Google-Attributes: gid103376,public From: matthew_heaney@acm.org (Matthew Heaney) Subject: Re: Passing a function "pointer" Date: 1998/05/24 Message-ID: #1/1 X-Deja-AN: 356112695 Content-Transfer-Encoding: 8bit References: <3567CBEB.3098@mpce.mq.edu.au> Content-Type: text/plain; charset=ISO-8859-1 Organization: Network Intensive Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 1998-05-24T00:00:00+00:00 List-Id: In article <3567CBEB.3098@mpce.mq.edu.au>, Brendan Reville wrote: >I need to pass a "pointer" (access type?) to a procedure, to another >procedure. The second procedure will then call the first using this >pointer. How exactly can I do this? Do I need to create an access type >to a procedure?? (I'm mainly not sure about the syntax...) Ada is described in terms in BNF in the RM; you may have learned how to learn BNF in your compiler class or something. Follow the syntax as it appears in the RM. The description of access types is in section 3.10. Here are a couple of examples: type Procedure_Access is access procedure (I : in Integer); type Function_Access is access function (I : Integer) return Float; >Actually, I also need to do this, not for a normal procedure, but for a >task's entry point. Can I pass a "pointer" to a task's entry point? >Again, exactly how? I'm not sure you can do that. You may have to call a wrapper procedure, that in turn calls the task entry. >Thanks heaps. I'm doing Ada for an honours course, and just wasn't sure >how to do these things. You need to read the RM. Copies are available on-line if you don't have a hard-copy.