comp.lang.ada
 help / color / mirror / Atom feed
* Rep Spec Report with ASIS
@ 2002-02-02 14:33 John Cupak
  2002-02-02 17:35 ` tmoran
  2002-02-02 22:51 ` Robert Dewar
  0 siblings, 2 replies; 7+ messages in thread
From: John Cupak @ 2002-02-02 14:33 UTC (permalink / raw)


I was approached by a co-worker who is porting an Ada application from one
platform/compiler to another (doesn't matter which), and she asked me if the
compiler could generate a "Representation Specification Report" listing all
the
components of a record, their relative byte positions, and bit start/end
values.

After a bit of digging around, we found that the compiler being ported TO
provides the ability to CREATE a rep spec for a selected record - that is,
it writes the "for use", and "at" clauses IN THE CODE. Unfortunately, this
is NOT what she wants. She wants a separate report. I know that GNAT
can generate a report using the -gnatR switch, but she is not using GNAT.

So, I thought that there might be an ASIS program someone out there in
"Ada Land" has written that might provide the information requested. I would
think it wouldn't be terribly hard to walk throught the declarations, find
record
type definitions, and generate a Representation Specification Report for
each
one - would it?

Please contact me at John_J_Cupak@raytheon.com if you have seen or
written such a report, or can provide something I could start with to create
it. Of course, I'll gladly provide the source to this newsgroup and Ada
groups for their use if I have to create it.

Thanks -
John





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

* Re: Rep Spec Report with ASIS
  2002-02-02 14:33 Rep Spec Report with ASIS John Cupak
@ 2002-02-02 17:35 ` tmoran
  2002-02-02 21:29   ` Larry Kilgallen
  2002-02-02 22:51 ` Robert Dewar
  1 sibling, 1 reply; 7+ messages in thread
From: tmoran @ 2002-02-02 17:35 UTC (permalink / raw)


>think it wouldn't be terribly hard to walk throught the declarations,
>find record type definitions, and generate a Representation
>Specification Report for each one - would it?
  Do you mean scan
    type R is record
      A : Boolean;
      B : Integer;
    end record;
and produce something like
    for R use record
      B at 0 range 0 .. 15;
      A at 2 range 0 .. 7;
    end record;
Only the compiler can do that because only the compiler knows how
big its Integer, Boolean, etc are and how it optimally arranges
them in a non-rep-speced record.

>After a bit of digging around, we found that the compiler being ported TO
>provides the ability to CREATE a rep spec for a selected record - that is,
>it writes the "for use", and "at" clauses IN THE CODE. Unfortunately, this
>is NOT what she wants. She wants a separate report.
  Can't she write a q&d program to scan and print out just the parts
she wants?

  Another possibility, useful for the FROM compiler that doesn't
produce such a nice output, would be to scan and generate a program
that creates an instance X of each record type, then uses the
Storage Place Attributes to print.  eg.
    type R is record
      A : Boolean;
      B : Integer;
    end record;
    X_R : R;
begin
  Ada.Text_IO.Put_Line("A" & " at" & Integer'image(X_R.A'Position)
    & " range" & Integer'image(X_R.A'First_Bit)
    & " .." & Integer'image(X_R.A'Last_Bit)
    & ";");
  Ada.Text_IO.Put_Line("B" & " at" & Integer'image(X_R.B'Position)
    & " range" & Integer'image(X_R.B'First_Bit)
    & " .." & Integer'image(X_R.B'Last_Bit)
    & ";");



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

* Re: Rep Spec Report with ASIS
  2002-02-02 17:35 ` tmoran
@ 2002-02-02 21:29   ` Larry Kilgallen
  0 siblings, 0 replies; 7+ messages in thread
From: Larry Kilgallen @ 2002-02-02 21:29 UTC (permalink / raw)


In article <xrV68.6402$P87.3738368124@newssvr14.news.prodigy.com>, tmoran@acm.org writes:
>>think it wouldn't be terribly hard to walk throught the declarations,
>>find record type definitions, and generate a Representation
>>Specification Report for each one - would it?
>   Do you mean scan
>     type R is record
>       A : Boolean;
>       B : Integer;
>     end record;
> and produce something like
>     for R use record
>       B at 0 range 0 .. 15;
>       A at 2 range 0 .. 7;
>     end record;
> Only the compiler can do that because only the compiler knows how
> big its Integer, Boolean, etc are and how it optimally arranges
> them in a non-rep-speced record.

The compiler also may change its mind regarding the meaning of
"optimally" based on user-supplied controls.



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

* Re: Rep Spec Report with ASIS
  2002-02-02 14:33 Rep Spec Report with ASIS John Cupak
  2002-02-02 17:35 ` tmoran
@ 2002-02-02 22:51 ` Robert Dewar
  2002-02-03  0:34   ` Jeffrey Creem
  1 sibling, 1 reply; 7+ messages in thread
From: Robert Dewar @ 2002-02-02 22:51 UTC (permalink / raw)


"John Cupak" <Jcupak744@mediaone.net> wrote in message news:<PMS68.69384$Ln2.15233029@typhoon.ne.mediaone.net>...
> 
> So, I thought that there might be an ASIS program someone out there in
> "Ada Land" has written that might provide the information requested. I would
> think it wouldn't be terribly hard to walk throught the declarations, find
> record
> type definitions, and generate a Representation Specification Report for
> each
> one - would it?

It would be virtually impossible unless the ASIS port you
are using supports the data representation section of the
ASIS standard, and this support is of course keyed to a 
particular compiler. However, as far as I know, ASIS-for-GNAT is the
only implementation of ASIS that
supports this optional capability.

The reason that this is virtually impossible is 

a) you would have to duplicate the entire data layout algorithms of
the compiler you are using, these algorithms
are often extremely extensive and complex.

b) you would have to know what these algorithms are. I don't think any
compiler has sufficiently complete documentation to reliably duplicate
the data layout for
this purpose.

We find that the -gnatR report that GNAT Pro can provide is
extremely useful, and a number of our customers very much
rely on this tool. The advantage here is that the compiler
is generating this information directly from the internal
data structures after laying out the data, so the output
from -gnatR is by definition exactly correct.

So basically you are out of luck here if you are not using
GNAT. Why not talk to your vendor and see if they can do
something for you -- perhaps they have some equivalent
internal tools that they can be persuaded to cough up.

(I say that because we find -gnatR enormously useful for
our support activities, and it is hard for me to imagine
how one would deal with things if you could not easily
tell how the compiler was laying things out).

Robert Dewar
Ada Core Technologies



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

* Re: Rep Spec Report with ASIS
  2002-02-02 22:51 ` Robert Dewar
@ 2002-02-03  0:34   ` Jeffrey Creem
  2002-02-03 10:29     ` Steven Hovater
  0 siblings, 1 reply; 7+ messages in thread
From: Jeffrey Creem @ 2002-02-03  0:34 UTC (permalink / raw)


Another approach for an ASIS implementation that does not support this
capability (data representation section)
would be to create an ASIS program who's output is a program that creates
the output you want....
I have not done so there may be a few snags but in principal it seems like
could be done.
Of course it is more work than I've ever wanted (or been paid :) to
undertake.


"Robert Dewar" <dewar@gnat.com> wrote in message
news:5ee5b646.0202021451.226fab4@posting.google.com...
> "John Cupak" <Jcupak744@mediaone.net> wrote in message
news:<PMS68.69384$Ln2.15233029@typhoon.ne.mediaone.net>...
> >
> > So, I thought that there might be an ASIS program someone out there in
> > "Ada Land" has written that might provide the information requested. I
would
> > think it wouldn't be terribly hard to walk throught the declarations,
find
> > record
> > type definitions, and generate a Representation Specification Report for
> > each
> > one - would it?
>
> It would be virtually impossible unless the ASIS port you
> are using supports the data representation section of the
> ASIS standard, and this support is of course keyed to a
> particular compiler. However, as far as I know, ASIS-for-GNAT is the
> only implementation of ASIS that
> supports this optional capability.
>
> The reason that this is virtually impossible is
>
> a) you would have to duplicate the entire data layout algorithms of
> the compiler you are using, these algorithms
> are often extremely extensive and complex.
>
> b) you would have to know what these algorithms are. I don't think any
> compiler has sufficiently complete documentation to reliably duplicate
> the data layout for
> this purpose.
>
> We find that the -gnatR report that GNAT Pro can provide is
> extremely useful, and a number of our customers very much
> rely on this tool. The advantage here is that the compiler
> is generating this information directly from the internal
> data structures after laying out the data, so the output
> from -gnatR is by definition exactly correct.
>
> So basically you are out of luck here if you are not using
> GNAT. Why not talk to your vendor and see if they can do
> something for you -- perhaps they have some equivalent
> internal tools that they can be persuaded to cough up.
>
> (I say that because we find -gnatR enormously useful for
> our support activities, and it is hard for me to imagine
> how one would deal with things if you could not easily
> tell how the compiler was laying things out).
>
> Robert Dewar
> Ada Core Technologies





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

* Re: Rep Spec Report with ASIS
  2002-02-03  0:34   ` Jeffrey Creem
@ 2002-02-03 10:29     ` Steven Hovater
  2002-02-03 13:40       ` Jeffrey Creem
  0 siblings, 1 reply; 7+ messages in thread
From: Steven Hovater @ 2002-02-03 10:29 UTC (permalink / raw)


Hi all

Following link describes such a tool that we wrote a few years ago when I
was
consulting at Raytheon.

http://info.acm.org/sigada/conf/sigada2000/private/SIGAda2000-CDROM/SIGAda20
00-Proceedings/Hovater-Presentation.pdf

http://www.acm.org/sigada/ada_letters/dec2000/hovater-paper.pdf

Cheers,
Steve

"Jeffrey Creem" <jeff@thecreems.com> wrote in message
news:bA%68.70669$Ln2.15685484@typhoon.ne.mediaone.net...
> Another approach for an ASIS implementation that does not support this
> capability (data representation section)
> would be to create an ASIS program who's output is a program that creates
> the output you want....
> I have not done so there may be a few snags but in principal it seems like
> could be done.
> Of course it is more work than I've ever wanted (or been paid :) to
> undertake.
>
>
> "Robert Dewar" <dewar@gnat.com> wrote in message
> news:5ee5b646.0202021451.226fab4@posting.google.com...
> > "John Cupak" <Jcupak744@mediaone.net> wrote in message
> news:<PMS68.69384$Ln2.15233029@typhoon.ne.mediaone.net>...
> > >
> > > So, I thought that there might be an ASIS program someone out there in
> > > "Ada Land" has written that might provide the information requested. I
> would
> > > think it wouldn't be terribly hard to walk throught the declarations,
> find
> > > record
> > > type definitions, and generate a Representation Specification Report
for
> > > each
> > > one - would it?
> >
> > It would be virtually impossible unless the ASIS port you
> > are using supports the data representation section of the
> > ASIS standard, and this support is of course keyed to a
> > particular compiler. However, as far as I know, ASIS-for-GNAT is the
> > only implementation of ASIS that
> > supports this optional capability.
> >
> > The reason that this is virtually impossible is
> >
> > a) you would have to duplicate the entire data layout algorithms of
> > the compiler you are using, these algorithms
> > are often extremely extensive and complex.
> >
> > b) you would have to know what these algorithms are. I don't think any
> > compiler has sufficiently complete documentation to reliably duplicate
> > the data layout for
> > this purpose.
> >
> > We find that the -gnatR report that GNAT Pro can provide is
> > extremely useful, and a number of our customers very much
> > rely on this tool. The advantage here is that the compiler
> > is generating this information directly from the internal
> > data structures after laying out the data, so the output
> > from -gnatR is by definition exactly correct.
> >
> > So basically you are out of luck here if you are not using
> > GNAT. Why not talk to your vendor and see if they can do
> > something for you -- perhaps they have some equivalent
> > internal tools that they can be persuaded to cough up.
> >
> > (I say that because we find -gnatR enormously useful for
> > our support activities, and it is hard for me to imagine
> > how one would deal with things if you could not easily
> > tell how the compiler was laying things out).
> >
> > Robert Dewar
> > Ada Core Technologies
>
>





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

* Re: Rep Spec Report with ASIS
  2002-02-03 10:29     ` Steven Hovater
@ 2002-02-03 13:40       ` Jeffrey Creem
  0 siblings, 0 replies; 7+ messages in thread
From: Jeffrey Creem @ 2002-02-03 13:40 UTC (permalink / raw)


Yup...Except for a few minor details, that looks exactly like the kind of
thing I've
always wanted....Too bad it was work  you did at Ratheeon instead of
Rational. That
would be a cool feature to include in Ada Analyzer..



"Steven Hovater" <nh-ho@mediaone.net> wrote in message
news:Mh878.4701$KA4.1865704@typhoon.ne.mediaone.net...
> Hi all
>
> Following link describes such a tool that we wrote a few years ago when I
> was
> consulting at Raytheon.
>
>
http://info.acm.org/sigada/conf/sigada2000/private/SIGAda2000-CDROM/SIGAda20
> 00-Proceedings/Hovater-Presentation.pdf
>
> http://www.acm.org/sigada/ada_letters/dec2000/hovater-paper.pdf
>
> Cheers,
> Steve
>
> "Jeffrey Creem" <jeff@thecreems.com> wrote in message
> news:bA%68.70669$Ln2.15685484@typhoon.ne.mediaone.net...
> > Another approach for an ASIS implementation that does not support this
> > capability (data representation section)
> > would be to create an ASIS program who's output is a program that
creates
> > the output you want....
> > I have not done so there may be a few snags but in principal it seems
like
> > could be done.
> > Of course it is more work than I've ever wanted (or been paid :) to
> > undertake.
> >
> >
> > "Robert Dewar" <dewar@gnat.com> wrote in message
> > news:5ee5b646.0202021451.226fab4@posting.google.com...
> > > "John Cupak" <Jcupak744@mediaone.net> wrote in message
> > news:<PMS68.69384$Ln2.15233029@typhoon.ne.mediaone.net>...
> > > >
> > > > So, I thought that there might be an ASIS program someone out there
in
> > > > "Ada Land" has written that might provide the information requested.
I
> > would
> > > > think it wouldn't be terribly hard to walk throught the
declarations,
> > find
> > > > record
> > > > type definitions, and generate a Representation Specification Report
> for
> > > > each
> > > > one - would it?
> > >
> > > It would be virtually impossible unless the ASIS port you
> > > are using supports the data representation section of the
> > > ASIS standard, and this support is of course keyed to a
> > > particular compiler. However, as far as I know, ASIS-for-GNAT is the
> > > only implementation of ASIS that
> > > supports this optional capability.
> > >
> > > The reason that this is virtually impossible is
> > >
> > > a) you would have to duplicate the entire data layout algorithms of
> > > the compiler you are using, these algorithms
> > > are often extremely extensive and complex.
> > >
> > > b) you would have to know what these algorithms are. I don't think any
> > > compiler has sufficiently complete documentation to reliably duplicate
> > > the data layout for
> > > this purpose.
> > >
> > > We find that the -gnatR report that GNAT Pro can provide is
> > > extremely useful, and a number of our customers very much
> > > rely on this tool. The advantage here is that the compiler
> > > is generating this information directly from the internal
> > > data structures after laying out the data, so the output
> > > from -gnatR is by definition exactly correct.
> > >
> > > So basically you are out of luck here if you are not using
> > > GNAT. Why not talk to your vendor and see if they can do
> > > something for you -- perhaps they have some equivalent
> > > internal tools that they can be persuaded to cough up.
> > >
> > > (I say that because we find -gnatR enormously useful for
> > > our support activities, and it is hard for me to imagine
> > > how one would deal with things if you could not easily
> > > tell how the compiler was laying things out).
> > >
> > > Robert Dewar
> > > Ada Core Technologies
> >
> >
>
>





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

end of thread, other threads:[~2002-02-03 13:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-02 14:33 Rep Spec Report with ASIS John Cupak
2002-02-02 17:35 ` tmoran
2002-02-02 21:29   ` Larry Kilgallen
2002-02-02 22:51 ` Robert Dewar
2002-02-03  0:34   ` Jeffrey Creem
2002-02-03 10:29     ` Steven Hovater
2002-02-03 13:40       ` Jeffrey Creem

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