comp.lang.ada
 help / color / mirror / Atom feed
From: Viqar Abbasi <viqar@cae.ca>
Subject: Re: Fortran's Equivalence
Date: 1997/04/07
Date: 1997-04-07T00:00:00+00:00	[thread overview]
Message-ID: <3349165C.3B93@cae.ca> (raw)
In-Reply-To: dewar.860159911@merv


Hi, from the original poster... :)

I've appreciated this dicussion on the "best" way to implement overlays. 
One thing that I forgot to mention was that I am confined to the Ada 83 
environment, regardless of platform.  So, I am attempting a conscious 
effort to enforce "old-style Ada 83 thinking".

My original reason for this post was because when I received the code, 
it used address clause overlays.  However, on my GNAT 3.07 for SGI, the 
overlaying didn't work (or at least, that particular code have the 
wrong results).  So, I added a routine for bit swapping, (localizing the 
effect of changing machines to that one small routine), and then 
proceeded with Unchecked_Conversion.  Later, when I downloaded GNAT 
3.09, I found that it offered a whole new spectrum of address clause 
flexibility.  A quick test showed me that the old address clause overlay 
would work.  So, I thought I'd ask about the "preferred method" to do 
something which I knew is dangerous.  (And actually, I've never used 
EQUIVALENCE in a Fortran program... But I knew about it. :)

<< there's the Prologue :) >>

<< Questions (this should be a standardized form) >>

Can someone please explain to me the effect of representation clauses 
when doing these overlays?  For example,

record My_Record is
    A:  some_type;
    B:  some_other_type;
    C:  still_another_type;
end record;
for My_Record_Type'Size use 32;
for My_Record_Type use
  record
    A at 0 range 0 .. 14;
    B at 0 range 15 .. 24;
    C at 0 range 25 .. 31;
  end record;

Does "range 0 .. 14" mean the Most Signicant Bits?  Or does it mean 
"Left most bits"?  This will clearly have an impact on my overlays.  If 
I'm going to move bits arouund, then I don't want to have to change the 
record representation clauses...  Will I be able to avoid it, by 
only changing my bit-manipulation routine, depending on my machine?

Thanks for being here... :)
V.




  parent reply	other threads:[~1997-04-07  0:00 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-03-25  0:00 Fortran's Equivalence Viqar Abbasi
1997-03-26  0:00 ` Robert Dewar
1997-03-26  0:00   ` Robert A Duff
1997-03-29  0:00   ` Matthew Heaney
1997-03-29  0:00     ` Robert Dewar
1997-04-02  0:00       ` JP Thornley
1997-03-26  0:00 ` FORTRAN's Equivalence Nick Roberts
1997-03-26  0:00 ` Fortran's Equivalence Michael F Brenner
1997-03-26  0:00   ` Larry Kilgallen
1997-03-28  0:00   ` Oliver Kellogg
1997-03-29  0:00   ` Matthew Heaney
1997-03-29  0:00     ` Robert Dewar
1997-04-01  0:00       ` Keith Thompson
1997-04-01  0:00         ` Robert Dewar
1997-04-01  0:00           ` Robert A Duff
1997-04-01  0:00             ` Robert Dewar
1997-04-04  0:00           ` Keith Thompson
1997-04-04  0:00             ` Robert Dewar
1997-04-07  0:00               ` Keith Thompson
1997-04-07  0:00               ` Charles H. Sampson
1997-04-07  0:00               ` Viqar Abbasi [this message]
1997-04-08  0:00                 ` Charles H. Sampson
1997-04-08  0:00                   ` Matthew Heaney
1997-04-09  0:00                     ` Stephen Leake
1997-04-09  0:00                       ` Robert Dewar
1997-04-10  0:00                         ` Simon Wright
1997-04-10  0:00                           ` Robert Dewar
1997-04-08  0:00                   ` Robert Dewar
     [not found]                     ` <1997Apr15.163103.27481@nosc.mil>
1997-04-16  0:00                       ` Robert Dewar
1997-04-04  0:00             ` Keith Thompson
1997-04-04  0:00               ` Robert Dewar
1997-04-08  0:00                 ` Keith Thompson
1997-04-07  0:00             ` Charles H. Sampson
1997-03-29  0:00     ` Robert Dewar
1997-03-26  0:00 ` Tom Moran
1997-03-28  0:00 ` Charles H. Sampson
1997-03-29  0:00   ` Matthew Heaney
1997-04-01  0:00     ` Charles H. Sampson
1997-03-29  0:00 ` Matthew Heaney
1997-03-29  0:00   ` Robert Dewar
replies disabled

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