TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy

TEAM-ADA@LISTSERV.ACM.ORG

Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
"Robert C. Leif, Ph.D." <[log in to unmask]>
Reply To:
Robert C. Leif, Ph.D.
Date:
Fri, 8 Dec 2000 13:55:12 -0800
Content-Type:
text/plain
Parts/Attachments:
text/plain (53 lines)
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));"




-----Original Message-----
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,
etc).

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;
   end record;

   type Index_Type is range 1 .. 10;
   type Integer_Array_Parameter_Type is array (Index_Type) of
Parameter_Type;

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
(or An_Identifier).

More detail and sample code on request :).

--
-- Stephe

ATOM RSS1 RSS2