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=0.1 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00, INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,cdaa3abe008a8f57,start X-Google-Attributes: gid103376,public From: Sam Carnicelli Subject: Ada Type Information Date: 1999/03/05 Message-ID: <36E03843.3AD74457@lmco.com>#1/1 X-Deja-AN: 451674826 Content-Transfer-Encoding: 7bit Organization: Lockheed Martin OR&SS Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 1999-03-05T00:00:00+00:00 List-Id: I've been lurking around this newsgroup for a couple of weeks and I thought some of the people here might be able to offer some valuable advice. We have a need to convert Ada95 type information into a neutral format for use by a tool written in Java. We basically need, given a record type, the type starting bit position, and length in bits of all fields of a record. For instance, given this record definition: type ENUM_T is ( FIRST, SECOND, THIRD); type EXAMPLE_T is record Field1 : STRING(1..10); Field2 : INTEGER; Field3 : FLOAT; Field4 : ENUM_T end record; We would need the following data (all sizes are in bits and are my approximations): Type_Name: EXAMPLE_T Type_Size: 176 Field_Name: Field1 Field_Type : STRING Size: 80 Start_Bit: 0 Field_Name: Field2 Field_Type: INTEGER Size: 32 Start_Bit: 80 Field_Name: Field3 Field_Type: FLOAT Size: 32 Start_Bit: 112 Field_Name: Field4 Field_Type: ENUM Size: 32 Start_Bit: 144 Num_Enum_Codes: 3 Enum_Codes: FIRST, SECOND, THIRD This would have to get past the various layers of derived types, renames, etc to get to the underlying base types such as those above. Creating this data manually is very tedious, particularly when you have large, nested record structures. We are using GNAT 3.11b on Solaris. We have looked at a few options for getting this data, such as..... 1) Compiling with -g and -S to get assembly code. The assembly code contains "stabs" debug data which probably contains the needed information. However, we could not find a good set of documentation on the stabs format for Suns. Documentation that we did find mentioned that Suns did things a little differently than the standard. The thought was to build a table of type data and decompose the desired record based on the types it contained, etc. 2) Using the wavefront version of GNAT 3.12w. This has a -gnatR flag which produces rep spec information at compilation. This is good for sizing and layout of records, but didn't seem to have the necessary type information. 3) Using ASIS for GNAT. We've spent some time with this. We can get down to specific types of record components. If the types used are sized with representations clauses, we can get the size information. If records are rep spec'd, we can get the required layout information. What we haven't figured out is whether we can get record layout information in the absence of a rep spec. Is this possible with ASIS for GNAT? Has anyone done/seen anything using ASIS remotely similar to what we're trying to do? Any help/advice would be greatly appreciated. Thanks -- ------------------------------------------------------------------ Sam Carnicelli Lockheed Martin Phone : 315-456-2881 Syracuse, NY 13221-4840 Fax : 315-456-0107 e-mail: samuel.charles.carnicelli@lmco.com ------------------------------------------------------------------