comp.lang.ada
 help / color / mirror / Atom feed
From: matthew_heaney@acm.org (Matthew Heaney)
Subject: Re: Passing a function "pointer"
Date: 1998/05/24
Date: 1998-05-24T00:00:00+00:00	[thread overview]
Message-ID: <matthew_heaney-ya023680002405981106270001@news.ni.net> (raw)
In-Reply-To: 3567CBEB.3098@mpce.mq.edu.au


In article <3567CBEB.3098@mpce.mq.edu.au>, Brendan Reville
<breville@mpce.mq.edu.au> 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.

<http://www.adahome.com/>




  reply	other threads:[~1998-05-24  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-05-24  0:00 Passing a function "pointer" Brendan Reville
1998-05-24  0:00 ` Matthew Heaney [this message]
1998-05-26  0:00   ` Fabrizio Castrotorres
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox