comp.lang.ada
 help / color / mirror / Atom feed
* Ada Type Information
@ 1999-03-05  0:00 Sam Carnicelli
  1999-03-05  0:00 ` Tom Moran
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Sam Carnicelli @ 1999-03-05  0:00 UTC (permalink / raw)


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
------------------------------------------------------------------







^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~1999-03-09  0:00 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-03-05  0:00 Ada Type Information Sam Carnicelli
1999-03-05  0:00 ` Tom Moran
1999-03-05  0:00   ` Sam Carnicelli
1999-03-05  0:00 ` dewar
1999-03-06  0:00   ` Tom Moran
1999-03-08  0:00     ` Sam Carnicelli
1999-03-08  0:00   ` Sam Carnicelli
1999-03-09  0:00     ` robert_dewar
1999-03-09  0:00   ` korisko
1999-03-05  0:00 ` dennison
1999-03-08  0:00   ` Sam Carnicelli
1999-03-08  0:00     ` dennison
1999-03-08  0:00       ` Sam Carnicelli
1999-03-09  0:00       ` robert_dewar

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