Fri, 8 Dec 2000 13:55:12 -0800
From: Bob Leif
To: Stephan Leake et al.
Could you circumvent this problem by using the GNAT 'Img attribute?
"The Img attribute differs from Image in that it may be applied to objects
as well as types, in which case it gives the Image for the subtype of the
object. This is convenient for debugging:
Put_Line ("X = " & X'Img);
has the same meaning as the more verbose:
Put_Line ("X = " & type'Image (X));"
From: Team Ada: Ada Advocacy Issues (83 & 95)
[mailto:[log in to unmask]]On Behalf Of Stephen Leake
Sent: Friday, December 08, 2000 11:46 AM
To: [log in to unmask]
Subject: finding type declaration using ASIS queries.
I'm writing an ASIS application that will generate a Text_IO child
package for a package containing types (record types, array types,
I'm trying to figure out what query to call in the following
situation. The type declarations are:
type Parameter_Type is record
h_1 : Math.Float_Type;
Sc_r_Tank : Math.DOF_3.Cart_Vector_Type;
type Index_Type is range 1 .. 10;
type Integer_Array_Parameter_Type is array (Index_Type) of
I'm traversing the ASIS tree, and I'm in the type definition for
Integer_Array_Parameter_Type, looking at Parameter_Type. What query
can I use to get the declaration of Parameter_Type, so I can ask
whether it is an integer, float, array, or record? I need to find out,
so I can instantiate an appropriate Generic Text_IO package.
Corresponding_Expression_Type would seem appropriate, but I'm not in
an expression, so it fails. Parameter_Type is A_Component_Declaration
More detail and sample code on request :).