comp.lang.ada
 help / color / mirror / Atom feed
From: keld.nielsen@agip.it (Keld Lund Nielsen)
Subject: Re: Visibility problems in Parent.Child configuration
Date: 31 Jul 2002 03:01:34 -0700
Date: 2002-07-31T10:01:34+00:00	[thread overview]
Message-ID: <383f908a.0207310201.207dc9ef@posting.google.com> (raw)
In-Reply-To: wccfzy1ghpn.fsf@shell01.TheWorld.com

You are right. Here is an edited example, which compile except for the
last
file "unit_test.math.G_scalar.adb".

The structure is:

Math.ads (compiles)
\
 Math.G_Scalar.ads  (compiles)

and

Unit_Test.ads  (compiles)
\
 Unit_Test.Math.ads & Unit_Test.Math.adb  (compiles)
 \
  Unit_Test.Math.G_Scalar.ads (compiles) & Unit_Test.Math.G_Scalar
(comp.error)

--Example:

------------------------------
-- Math.ads
------------------------------
 with Ada.Numerics.Generic_Elementary_Functions;
 
package Math is

  package Float_32 is
     type Instance is digits 6;
       for Instance'Size use 32;
         package Operations is 
           new Ada.Numerics.Generic_Elementary_Functions( Instance );
  end Float_32;
  
  package Float_64 is
     type Instance is digits 15;
       for Instance'Size use 64;
         package Operations is 
           new Ada.Numerics.Generic_Elementary_Functions( Instance );
  end Float_64;
           
end Math;


------------------------------
-- Math.G_Scalar.ads
------------------------------
 generic
 
  type Scalar_Type is private;
  
package Math.G_Scalar is

  subtype Instance is Scalar_Type;
  
end Math.G_Scalar;


---
--  unit test 
---

package Unit_Test is
 
  
  procedure Write_Test( Result          : in Boolean; 
                        Routine_Name    : in String;
                        Name_Of_Package : in String);
  
  
  
end Unit_Test;


------------------------------
-- Unit_Test.Math.ads
------------------------------

package Unit_Test.Math is


  procedure Check;


end Unit_Test.Math;


------------------------------
-- Unit_Test.Math.adb
------------------------------

 with Math;
 use Math;


package body Unit_Test.Math is


  procedure Check is

   Name_Of_Package: constant String := "Math";

    Xs : Float_32.Instance;
    Xd : Float_64.Instance;

  begin -- Check

    Write_Test( (Xs'Size = 32), "Float_32 size", Name_Of_Package);
    
    Write_Test( (Xd'Size = 64), "Float_64 size", Name_Of_Package);

  end Check;


end Unit_Test.Math;


------------------------------
-- Unit_Test.Math.G_Scalar.ads
------------------------------

package Unit_Test.Math.G_Scalar is


  procedure Check;


end Unit_Test.Math.G_Scalar;


------------------------------
-- Unit_Test.Math.G_Scalar.adb
------------------------------
 with Math.G_Scalar;

package body Unit_Test.Math.G_Scalar is


  procedure Check is

   Name_Of_Package: constant String := "Math.G_Scalar";

    subtype F64 is Math.Float_64.Instance; ------> ERROR HERE
    
    package Scalar is
      new Math.G_Scalar( Math.Float_64.Instance ); ------> ERROR HERE

  begin -- Check

    Write_Test( false, "Insert routine name here", Name_Of_Package);

  end Check;


end Unit_Test.Math.G_Scalar;


Error message is simply that Float_64 is not in Math according to the
compiler(Gnat).

Do you have any suggestions?
Cheers
Keld


Robert A Duff <bobduff@shell01.TheWorld.com> wrote in message news:<wccfzy1ghpn.fsf@shell01.TheWorld.com>...
> I think you have to show us the exact code that gets the error.
> I can't see what the problem is from the description below.



  reply	other threads:[~2002-07-31 10:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-30 11:41 Visibility problems in Parent.Child configuration Keld Lund Nielsen
2002-07-30 19:04 ` Robert A Duff
2002-07-31 10:01   ` Keld Lund Nielsen [this message]
2002-08-01 19:09     ` Stephen Leake
2002-07-31 10:57 ` Thomas Wolf
2002-08-01  7:51   ` Keld Lund Nielsen
replies disabled

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