comp.lang.ada
 help / color / mirror / Atom feed
From: burnsedbw@aol.com (BurnsedBW)
Subject: What's with GNAT?
Date: 1996/12/26
Date: 1996-12-26T00:00:00+00:00	[thread overview]
Message-ID: <19961226012000.UAA10491@ladder01.news.aol.com> (raw)


The following is a trimmed-down excerpt of a set of functions and
procedures
we have implemented and used successfully for some time on Tartan C30 &
C40
compilers, as well as Rational (formerly Verdix) for the Sun, and DEC for
the
DEC Workstation. Another group has been trying to use this same code with
the
GNAT compiler for the SUN (sorry, I don't know the version--I'm not sure
they
do either!). But the problem seems to come from the conversion of an "out"
parameter. The GNAT compiler says the statement wil raise CONTRAINT_ERROR,
and
if a program is executed it does indeed raise it. Since I am not familiar
enough with GNAT, I offered to post this question for them. As background,
let
me say that this is for a missile system that deals heavily in vectors and
matrices (there are many more than the two types illustrated), and the
system
design often depends on quickly converting real valued vectors from one
type
to another. Sometimes the only difference is in rotating the coordinate
frame.
Hence, we chose the single enumerated type for all indices, with named
subtype
ranges that should allow a simple type-name conversion syntax. And it
works,
and has been tested on the compilers mentioned above. What are missing
about
GNAT?
--------------------------------------------------------------------------
------
   package Global is

      type Real is digits 9;

      type Index_type is
      ( X, Y, Z,
        North, East, Down
      );

      subtype Cartesian_Axes   is Index_type range X     .. Z    ;
      subtype NED_Axes         is Index_type range North .. Down ;

      type General_Vector is array ( Index_type range <> ) of Real ;

      type Cartesian_Vector   is General_Vector( Cartesian_Axes   );
      type NED_Vector         is General_Vector( NED_Axes         );

   end Global;
--------------------------------------------------------------------------
------
   with Global;   
   package Matrix is

      procedure Multiply ( Left, Right : in     Global.Cartesian_Vector;
                           Result      :    out Global.Cartesian_Vector 
);

      procedure Multiply ( Left, Right : in     Global.NED_Vector;
                           Result      :    out Global.NED_Vector  );

   end Matrix;
--------------------------------------------------------------------------
------
   package body Matrix is

      procedure Multiply ( Left, Right : in     Global.Cartesian_Vector;
                           Result      :    out Global.Cartesian_Vector  )
is
      begin  -- Multiply
         ... code to perform matrix mulitplication ...
      end Multiply;


      procedure Multiply ( Left, Right : in     Global.NED_Vector;
                           Result      :    out Global.NED_Vector  );
      begin  -- Multiply
         Multiply ( Global.Cartesian(Left), Global.Cartesian(Right),
                    Global.NED_Vector(Result)                         );
 -------------------^^^^^^^^^^^^^^^^^^^^^^^^^
-------------------- claims it will raise CONSTRAINT_ERROR--and does!
      end Multiply;

   end Matrix;
--------------------------------------------------------------------------
------

Thanks,
-----
 BwB




             reply	other threads:[~1996-12-26  0:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-12-26  0:00 BurnsedBW [this message]
  -- strict thread matches above, loose matches on Subject: below --
1996-12-27  0:00 What's with GNAT? Sazonov Cyril
1996-12-28  0:00 ` burnsedbw
1996-12-30  0:00 Sazonov Cyril
replies disabled

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