comp.lang.ada
 help / color / mirror / Atom feed
* Ada pointers to functions
@ 1999-11-23  0:00 Eric poirier
  1999-11-23  0:00 ` Matthew Heaney
  0 siblings, 1 reply; 2+ messages in thread
From: Eric poirier @ 1999-11-23  0:00 UTC (permalink / raw)


Hi !!!

I know that there is some kind of pointers to function (see html
reference language) But can I have an arrayr of pointers to functions
something like :

type Message_Procedure is access procedure (M : in String := "Error!");
       procedure Default_Message_Procedure(M : in String);
       Give_Message : Message_Procedure :=
Default_Message_Procedure'Access;
       ...
       procedure Other_Procedure(M : in String);
       ...
       Give_Message := Other_Procedure'Access;
       ...
       Give_Message("File not found.");  -- call with parameter (.all is
optional)
       Give_Message.all;                            -- call with no
parameters


-->    T_Ptr_Func is array (1..10) of Message_Procedure;   <--

Is this legal ???

And how should I call one of these function-pointed in an array ???








^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Ada pointers to functions
  1999-11-23  0:00 Ada pointers to functions Eric poirier
@ 1999-11-23  0:00 ` Matthew Heaney
  0 siblings, 0 replies; 2+ messages in thread
From: Matthew Heaney @ 1999-11-23  0:00 UTC (permalink / raw)


In article <3839DC14.74BE166C@algopharm.com> , Eric poirier 
<computer@algopharm.com>  wrote:

> -->  type T_Ptr_Func is array (1..10) of Message_Procedure;   <--
>
> Is this legal ???

Yes.

> And how should I call one of these function-pointed in an array ???

declare
  Messages : T_Ptr_Func;
begin
  <populate Messages array>
  for I in Messages'Range loop
    Messages (I).all;
    Messages (I)("this is a message");
  end loop;
end;


--
The new standards [for science curricula in Kansas] do not forbid the
teaching of evolution, but the subject will no longer be included in
statewide tests for evaluating students--a virtual guarantee, given the
realities of education, that this central concept of biology will be
diluted or eliminated, thus reducing courses to something like chemistry
without the periodic table, or American history without Lincoln.

Stephen Jay Gould, Time, 23 Aug 1999




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1999-11-23  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-11-23  0:00 Ada pointers to functions Eric poirier
1999-11-23  0:00 ` Matthew Heaney

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