comp.lang.ada
 help / color / mirror / Atom feed
From: vladimir@speedy.intrepid.com (Vladimir Vukicevic)
Subject: Re: Type t is MOD c???
Date: 07 Feb 1995 07:16:28 GMT
Date: 1995-02-07T07:16:28+00:00	[thread overview]
Message-ID: <VLADIMIR.95Feb6231628@speedy.intrepid.com> (raw)
In-Reply-To: Magnus Hakansson's message of 6 Feb 1995 14:24:18 GMT

In article <3h5bei$npp@nyheter.chalmers.se> Magnus Hakansson
<z94magh@mtek.chalmers.se> writes:
> This probably a very simple question when you know the answer, but
> it is causing me some troubble. In "system.ads" there is a
> declaraton:
>
> type Address is mod Memory_Size;
>
> and I want to know how to assign a specific address to a pointer.
> How do I do? What is the syntax for an "address"? Is there any
> hidden packages avilable for accessing certain bytes of the memory
> of my PC, or is there any other tricks I don't know?
>
> Can anyone help me on this subject?

You would do something like:

with System.Storage_Elements;
package Q is
	X : Integer;
	for X'Address use System.Storage_Elements.To_Address (16#ffff#);
end Q;

to access the Integer at address 16#ffff#.

The type Address is left as implementation-defined in the standard; in
GNAT, it's private. The 'Address attribute rep clause takes a
System.Address, so you have to use the functions in System.Storage_Elements
to convert an integer to an Address. (See RM9X5.0 13.3(10), 13.7, 13.7.1)

	- Vladimir



  reply	other threads:[~1995-02-07  7:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1995-02-06 14:24 Type t is MOD c??? Magnus Hakansson
1995-02-07  7:16 ` Vladimir Vukicevic [this message]
1995-02-07 11:56 ` Robert Dewar
replies disabled

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