comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen_leake@acm.org>
To: comp.lang.ada@ada-france.org
Subject: Re: Generic,procedure and visibility.
Date: 25 Nov 2004 14:15:08 -0500
Date: 2004-11-25T14:15:08-05:00	[thread overview]
Message-ID: <mailman.119.1101410151.10401.comp.lang.ada@ada-france.org> (raw)
In-Reply-To: <1101401637.028058.169190@z14g2000cwz.googlegroups.com>

"mferracini" <maurizio.ferracini@gmail.com> writes:

> now see this new case:
> 
> package Generico is
> generic
> with procedure Lavora;
> package Nascosto is
> procedure Inizia;
> end Nascosto;
> end Generico;

Please use standard indentation; it makes things much easier to read:

package Generico is
   generic
      with procedure Lavora;
   package Nascosto is
      procedure Inizia;
   end Nascosto;
end Generico;

package body Generico is

   package body Nascosto is

      task type Pippo is
         entry Fai;
      end Pippo;

      task body Pippo is
      begin
         accept Fai;
         Lavora;
      end Pippo;

      type P_Pippo is access Pippo;
      x:p_pippo;

      procedure Inizia is
      begin
         X:=new Pippo;
         X.Fai;
      end Inizia;
   end Nascosto;

begin
   null;
end Generico;

Note that you _don't_ need the "begin null;" at the end of the
package; that is optional, and should only be there if it does some
initialization.


> evry time that call i [thing that is a new generico.nascosto].inizia
> a new task born.

Yes; X := new Pippo; creates a new task.

> so i want to create a array of this task for manage them.
> how i can do?

type Task_Array is array (1 .. 10) of P_Pippo;

Have Inizia return the pointer it creates, so the user can store it in
the array.

-- 
-- Stephe




  reply	other threads:[~2004-11-25 19:15 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-25 16:36 Generic,procedure and visibility mferracini
2004-11-25 16:53 ` mferracini
2004-11-25 19:15   ` Stephen Leake [this message]
2004-11-25 20:27     ` Jeffrey Carter
2004-11-29 16:29     ` mferracini
2004-11-29 21:47       ` Stephen Leake
2004-11-25 18:20 ` Georg Bauhaus
replies disabled

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