comp.lang.ada
 help / color / mirror / Atom feed
From: dbrown@vigra.com (David Brown)
Subject: Generic address to access conversion.
Date: 1996/12/26
Date: 1996-12-26T00:00:00+00:00	[thread overview]
Message-ID: <oszpz09aor.fsf@ted.vigra.com> (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




                 reply	other threads:[~1996-12-26  0:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
replies disabled

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