* Type t is MOD c???
@ 1995-02-06 14:24 Magnus Hakansson
1995-02-07 7:16 ` Vladimir Vukicevic
1995-02-07 11:56 ` Robert Dewar
0 siblings, 2 replies; 3+ messages in thread
From: Magnus Hakansson @ 1995-02-06 14:24 UTC (permalink / raw)
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?
****
--- ******
mvh mh __o __ ***
_____/\ _`\<,_ / \ I __---___
__________------- \________(o)/_(*)____---/ \---___-+-/ \
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Type t is MOD c???
1995-02-06 14:24 Type t is MOD c??? Magnus Hakansson
@ 1995-02-07 7:16 ` Vladimir Vukicevic
1995-02-07 11:56 ` Robert Dewar
1 sibling, 0 replies; 3+ messages in thread
From: Vladimir Vukicevic @ 1995-02-07 7:16 UTC (permalink / raw)
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Type t is MOD c???
1995-02-06 14:24 Type t is MOD c??? Magnus Hakansson
1995-02-07 7:16 ` Vladimir Vukicevic
@ 1995-02-07 11:56 ` Robert Dewar
1 sibling, 0 replies; 3+ messages in thread
From: Robert Dewar @ 1995-02-07 11:56 UTC (permalink / raw)
Magnus Hakansson asks:
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?
Magnus, clearly you are using Ada 95 (probably GNAT, though you did not say).
Assigning an address to a pointer can be done, but is usually not the best way
of doing things instead use:
for x'address use expr;
where x is a variable, and expr is an address. For how to construct an
address, see the type Integer_Address and associated routines in the
package System.Storage_Elements.
If you really need to convert an address to a pointer, see package
System.Address_To_Access_Conversions.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~1995-02-07 11:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1995-02-06 14:24 Type t is MOD c??? Magnus Hakansson
1995-02-07 7:16 ` Vladimir Vukicevic
1995-02-07 11:56 ` Robert Dewar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox