comp.lang.ada
 help / color / mirror / Atom feed
From: "Scott Travak" <s.travak@j-inet.com>
Subject: Re: elaboration circularity detected problem, How to fix?
Date: Tue, 21 Sep 2004 16:44:45 +1000
Date: 2004-09-21T16:44:45+10:00	[thread overview]
Message-ID: <414fcddf@dnews.tpgi.com.au> (raw)
In-Reply-To: 7e7vk0dv2qhpqbdd58c0bvpesitapijr8v@4ax.com

Hi Dennis, yes you are right, there are a few inconsistencies there. Sorry 
about that. My scaled-down workable code (which produces the same error) is 
as follows:

Essentially what the example code is trying to do is:

1) create a remote location (i.e. chicago) with a 'send' and 'receive' task
2) the 'send task' sends a signal to some Destination station
3) the Destination station sends an acknowledgement signal back to chicago's 
'receive task'

The code worked fine prior to changing the location package into a generic 
package.

All I want is to get rid of this "error: elaboration circularity detected" 
compilation error.

Thanks for any help!

Cheers, Scott

-----------------
main.adb
-----------------

with Definitions;
use  Definitions;

with Location;

procedure main is

   package Chicago_Ptr is new Location (Chicago);

begin

   Chicago_Ptr.Send_Ptr    := new Chicago_Ptr.Send_Type;
   Chicago_Ptr.Receive_Ptr := new Chicago_Ptr.Receive_Type;

end main;


-----------------
definitions.adb
-----------------

package Definitions is

   type Location_Type is
         (Chicago,
          Paris,
          London);

end Definitions;


-----------------
location.ads
-----------------

with Definitions;
use  Definitions;

generic
   Centre : Location_Type;

package Location is

   task type Send_Type is
   end  Send_Type;

   task type Receive_Type is
      entry Ack_Channel;
   end Receive_Type;

   type Send_Ptr_Type is access Send_Type;
   type Receive_Ptr_Type is access Receive_Type;

   Send_Ptr    : Send_Ptr_Type;
   Receive_Ptr : Receive_Ptr_Type;

end Location;


-----------------
location.adb
-----------------

with Text_Io;
use  Text_Io;

with Station;
use  Station;

package body Location is

   task body Send_Type is
      Calls : Integer := 2;
      Done  : Boolean := False;
   begin

      Put_Line(Location_Type'Image(Centre) & "_SEND alive");

      while Calls > 0 loop
         delay 0.1;
         Destination.Signal;
         Calls := Calls - 1;
      end loop;

      Put_Line(Location_Type'Image(Centre) & "_SEND dead");

   end Send_Type;

   ------------

   task body Receive_Type is
      Done : Boolean := False;
   begin

      Put_Line(Location_Type'Image(Centre) & "_RECEIVE alive");

      while not Done loop

         select
            accept Ack_Channel do
               Put_Line("Signal received by DESTINATION");
            end Ack_Channel;
         else
            delay 0.1;
         end select;

      end loop;

      Put_Line(Location_Type'Image(Centre) & "_RECEIVE dead");

   end Receive_Type;

end Location;


-----------------
station.ads
-----------------

package Station is

   task Destination is
      entry Signal;
   end Destination;

end Station;


-----------------
station.adb
-----------------

with Text_Io;
use  Text_Io;

with Definitions;
use  Definitions;

with Location;

package body Station is

   package Chicago_Ptr is new Location (Chicago);

   task body Destination is
      Done : Boolean := False;
   begin

      Put_Line("DESTINATION alive");

      while not Done loop

         select
            accept Signal do
               Put_Line("DESTINATION: Received signal");
               Chicago_Ptr.Receive_Ptr.Ack_Channel;
            end Signal;
         else
            delay 0.1;
         end select;

      end loop;

      Put_Line("DESTINATION dead");

   end Destination;

end Station; 





  parent reply	other threads:[~2004-09-21  6:44 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-20 14:51 elaboration circularity detected problem, How to fix? Scott Travak
2004-09-20 15:52 ` Martin Dowie
2004-09-20 17:11   ` Florian Weimer
2004-09-20 21:19     ` Randy Brukardt
2004-09-21 10:09       ` Martin Dowie
2004-09-21 17:53         ` Randy Brukardt
2004-09-21  6:32   ` Scott Travak
2004-09-21  7:30     ` gnat options (Re: " Peter Hermann
2004-09-21  8:00       ` Scott Travak
2004-09-21  8:09       ` Alex R. Mosteo
     [not found] ` <7e7vk0dv2qhpqbdd58c0bvpesitapijr8v@4ax.com>
2004-09-21  6:44   ` Scott Travak [this message]
2004-09-21 18:40     ` Ludovic Brenta
2004-09-21 20:15       ` Scott Travak
2004-09-22 21:08 ` Simon Wright
replies disabled

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