From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,FREEMAIL_FROM, INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e6dde7d957da14ec,start X-Google-Attributes: gid103376,public From: burnsedbw@aol.com (BurnsedBW) Subject: What's with GNAT? Date: 1996/12/26 Message-ID: <19961226012000.UAA10491@ladder01.news.aol.com>#1/1 X-Deja-AN: 205952977 organization: AOL http://www.aol.com newsgroups: comp.lang.ada x-admin: news@aol.com Date: 1996-12-26T00:00:00+00:00 List-Id: 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