comp.lang.ada
 help / color / mirror / Atom feed
* Generic address to access conversion.
@ 1996-12-26  0:00 David Brown
  0 siblings, 0 replies; only message in thread
From: David Brown @ 1996-12-26  0:00 UTC (permalink / raw)



I am implementing a specialized memory manager that manages a small
region of non-virtual wired memory.  This manager would almost use
ordinary pool semantics except that the memory manager needs to be
able to move regions of memory around.  To use this, I expect
something like:

   Fixed_Memory.Lock (...);
   Accessor := ....Accessor (Handle);
   ...
   Fixed_Memory.Unlock (...);

where Accessor is an access variable that will be valid until the
memory is unlocked.

I have implemented the manager but am having difficulty coming up with
a way of implementing (or even specifying) the Accessor.  The memory
manager currently keeps track of an offset into

   type Byte is mod 2 ** System.Storage_Unit;
   for Byte'Size use System.Storage_Unit;
   type Byte_Array is array (Offset range <>) of Byte;
   pragma Pack (Byte_Array);

for the current location of the region.  The problem I am having is
converting this to a given user's access type.  I can make the code
work by using an Unchecked_Conversion as well as
System.Address_To_Access_Conversions, however it only works for
discriminated types, and this I only suspect is because my compiler
(GNAT 3.07) uses simple pointers for access variables.

Thanks,
David Brown
dbrown@vigra.com




^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1996-12-26  0:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-12-26  0:00 Generic address to access conversion David Brown

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