comp.lang.ada
 help / color / mirror / Atom feed
* Easy Question - Printing Out An Address
@ 2005-03-09 18:03 Bryan.Berns
  2005-03-09 18:23 ` Pascal Obry
  2005-03-09 18:34 ` Dmitry A. Kazakov
  0 siblings, 2 replies; 5+ messages in thread
From: Bryan.Berns @ 2005-03-09 18:03 UTC (permalink / raw)


How can I print out (for debugging purposes) a Machine.Address to the
screen?

- Console.Write(????)

Any ideas?

Thanks,

- Bryan




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Easy Question - Printing Out An Address
  2005-03-09 18:03 Easy Question - Printing Out An Address Bryan.Berns
@ 2005-03-09 18:23 ` Pascal Obry
  2005-03-09 18:34 ` Dmitry A. Kazakov
  1 sibling, 0 replies; 5+ messages in thread
From: Pascal Obry @ 2005-03-09 18:23 UTC (permalink / raw)



Bryan.Berns@gmail.com writes:

> How can I print out (for debugging purposes) a Machine.Address to the
> screen?
> 
> - Console.Write(????)
> 
> Any ideas?

If you are using GNAT, check the System.Address_Image package designed just
for this purpose.

Pascal.

-- 

--|------------------------------------------------------
--| Pascal Obry                           Team-Ada Member
--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE
--|------------------------------------------------------
--|              http://www.obry.org
--| "The best way to travel is by means of imagination"
--|
--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Easy Question - Printing Out An Address
  2005-03-09 18:03 Easy Question - Printing Out An Address Bryan.Berns
  2005-03-09 18:23 ` Pascal Obry
@ 2005-03-09 18:34 ` Dmitry A. Kazakov
  2005-03-09 21:09   ` Bryan.Berns
  1 sibling, 1 reply; 5+ messages in thread
From: Dmitry A. Kazakov @ 2005-03-09 18:34 UTC (permalink / raw)


On 9 Mar 2005 10:03:34 -0800, Bryan.Berns@gmail.com wrote:

> How can I print out (for debugging purposes) a Machine.Address to the
> screen?
> 
> - Console.Write(????)
> 
> Any ideas?

See System.Storage_Elements ARM 13.7.1

It defines To_Integer that converts address to an integer type
Integer_Address (that can be either modular or signed depending on the
compiler). Anyway, you can then do Integer_Address'Image (X'Address).

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Easy Question - Printing Out An Address
  2005-03-09 18:34 ` Dmitry A. Kazakov
@ 2005-03-09 21:09   ` Bryan.Berns
  2005-03-09 21:22     ` Mark Lorenzen
  0 siblings, 1 reply; 5+ messages in thread
From: Bryan.Berns @ 2005-03-09 21:09 UTC (permalink / raw)


Thanks.  The Address_Image method worked perfectly.  Now I'm working
with trying to do the same with a type of Address_Int.   Any input
appreciated.




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Easy Question - Printing Out An Address
  2005-03-09 21:09   ` Bryan.Berns
@ 2005-03-09 21:22     ` Mark Lorenzen
  0 siblings, 0 replies; 5+ messages in thread
From: Mark Lorenzen @ 2005-03-09 21:22 UTC (permalink / raw)


Bryan.Berns@gmail.com writes:

> Thanks.  The Address_Image method worked perfectly.  Now I'm working
> with trying to do the same with a type of Address_Int.   Any input
> appreciated.

What about:

with Ada.Text_IO;
with System.Storage_Elements;

procedure Print_Int_Address is
   package SE renames System.Storage_Elements;
     
   My_Var      : Positive; -- Or some other type.
   Sys_Address : System.Address;
   Int_Address : SE.Integer_Address;
begin
   Sys_Address := My_Var'Address;
   Int_Address := SE.To_Integer (Sys_Address);
   Ada.Text_IO.Put_Line ("Address is:" &
			 SE.Integer_Address'Image (Int_Address));
end Print_Int_Address;

Regards,
- Mark Lorenzen



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-03-09 21:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-09 18:03 Easy Question - Printing Out An Address Bryan.Berns
2005-03-09 18:23 ` Pascal Obry
2005-03-09 18:34 ` Dmitry A. Kazakov
2005-03-09 21:09   ` Bryan.Berns
2005-03-09 21:22     ` Mark Lorenzen

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