From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b0df326d95ae0b9e,start X-Google-Attributes: gid103376,public From: dbrown@vigra.com (David Brown) Subject: Generic address to access conversion. Date: 1996/12/26 Message-ID: #1/1 X-Deja-AN: 206101805 sender: dbrown@ted.vigra.com organization: VisiCom Laboratories, Inc. newsgroups: comp.lang.ada Date: 1996-12-26T00:00:00+00:00 List-Id: 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