* need code improvment
@ 1998-05-18 0:00 grave
1998-05-18 0:00 ` Steve Doiel
1998-05-19 0:00 ` Matthew Heaney
0 siblings, 2 replies; 3+ messages in thread
From: grave @ 1998-05-18 0:00 UTC (permalink / raw)
Hi all,
I'm working on a powerpc vme board and one of the solution I've found to
work with a vme address is the following :
with Ada.Unchecked_Conversion;
with System;
package try_vme is
type Vecteur1 is array(1..10) of Integer;
function Adresse_Tableau is new Ada.Unchecked_Conversion
(Integer,System.Address);
Tableau1 : Vecteur1;
for Tableau1'Address use Adresse_Tableau(16#12_2a8_000#);
-- some procedures
end try_vme;
Did someone can advice me for a better code ?
(i.e avoiding unchecked conversion)
Thanks in advance,
Xavier Grave
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: need code improvment
1998-05-18 0:00 need code improvment grave
@ 1998-05-18 0:00 ` Steve Doiel
1998-05-19 0:00 ` Matthew Heaney
1 sibling, 0 replies; 3+ messages in thread
From: Steve Doiel @ 1998-05-18 0:00 UTC (permalink / raw)
While I haven't used it myself, in Barnes' "Programming in Ada" he gives an
example:
S : Status;
for Status use at 8#100#;
More to the point an example in the reference manual gives:
Device_Register : Medium;
for Device_Register'Size use Medium'Size;
for Device_Register'Address use
System.Storage_Elements.To_Address(16#FFFF_0020#);
Which is more like your example.
I hope this helps,
SteveD
grave wrote in message <35607DFE.59B@ipnsun5.in2p3.fr>...
>Hi all,
>
>I'm working on a powerpc vme board and one of the solution I've found to
>work with a vme address is the following :
>
>with Ada.Unchecked_Conversion;
>with System;
>package try_vme is
>type Vecteur1 is array(1..10) of Integer;
>
>function Adresse_Tableau is new Ada.Unchecked_Conversion
>(Integer,System.Address);
>
>Tableau1 : Vecteur1;
>for Tableau1'Address use Adresse_Tableau(16#12_2a8_000#);
>
>-- some procedures
>
>end try_vme;
>
>Did someone can advice me for a better code ?
>(i.e avoiding unchecked conversion)
>
>Thanks in advance,
>
>Xavier Grave
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: need code improvment
1998-05-18 0:00 need code improvment grave
1998-05-18 0:00 ` Steve Doiel
@ 1998-05-19 0:00 ` Matthew Heaney
1 sibling, 0 replies; 3+ messages in thread
From: Matthew Heaney @ 1998-05-19 0:00 UTC (permalink / raw)
In article <35607DFE.59B@ipnsun5.in2p3.fr>, grave <grave@ipnsun5.in2p3.fr>
wrote:
(start of quote)
function Adresse_Tableau is new Ada.Unchecked_Conversion
(Integer,System.Address);
Tableau1 : Vecteur1;
for Tableau1'Address use Adresse_Tableau(16#12_2a8_000#);
Did someone can advice me for a better code ?
(i.e avoiding unchecked conversion)
(end of quote)
Ada comes with a predefined operation to convert between type Integer and
Address:
System.Storage_Elements.To_Address.
No use of Unchecked_Conversion is required.
(start of quote)
Thanks in advance,
Xavier Grave
(end of quote)
De rien.
Matt
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1998-05-19 0:00 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-05-18 0:00 need code improvment grave
1998-05-18 0:00 ` Steve Doiel
1998-05-19 0:00 ` Matthew Heaney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox