comp.lang.ada
 help / color / mirror / Atom feed
From: Dale Stanbrough <dale@cs.rmit.edu.au>
Subject: Re: A copy question....
Date: Mon, 15 Oct 2001 11:21:07 GMT
Date: 2001-10-15T11:21:07+00:00	[thread overview]
Message-ID: <dale-238AFE.21195615102001@mec2.bigpond.net.au> (raw)
In-Reply-To: 9qedad$i1p$1@newstoo.ericsson.se

In article <9qedad$i1p$1@newstoo.ericsson.se>,
 "Zebylon" <sebastian.madunic@esavionics.se> wrote:

> If you have an system.address variable, an data length variable and an array
> of Unsigned_32. How can you move the data ranging between the address and
> the address+data_length into the array?
> 
> I.G.
> 
> Address               : System.address      := 0x0200_0000;
> Data_Length       : Natural                       := 200; --bytes
> Array                   : array range (integer 0..375) of Unsigned_32;
> 
> Is there some smart way of placing the data in the array...?


Convert the address to an access type using an instantiation of the 
generic

   System.Address_To_Access_Conversions.To_Pointer

and then dereference the pointer generated by the function...

   function Address_To_Int_Pointer is new
      To_Pointer (Int_Pointer);

...
   for i in Array'range loop
      Array (i) := Address_To_Int_Pointer (Address).all;
      Address := Address + Unsigned_32'Size/8;
      -- i think there is a constant somewhere i should use instead of 8
   end loop;

note that the "+" operator is from System.Storage_Elements

Alternatively you could dive into either the OS API, which could well 
have a block move instruction (realloc?), or call any relavent assembler 
instruction.

Dale



  reply	other threads:[~2001-10-15 11:21 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-15 10:40 A copy question Zebylon
2001-10-15 11:21 ` Dale Stanbrough [this message]
2001-10-15 11:30   ` Dale Stanbrough
2001-10-15 11:59     ` Petter Fryklund
2001-10-15 21:04       ` Dale Stanbrough
2001-10-16  2:34         ` Jeffrey Carter
2001-10-16 11:15           ` Dale Stanbrough
2001-10-15 13:38   ` Ted Dennison
2001-10-15 13:30 ` Mark Doherty
2001-10-15 17:00 ` tmoran
2001-10-16 10:09   ` Mark Doherty
2001-10-17  0:18     ` tmoran
2001-10-17  1:14       ` David Botton
2001-10-16 23:00 ` David Botton
replies disabled

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