comp.lang.ada
 help / color / mirror / Atom feed
From: "Beard, Frank" <beardf@spawar.navy.mil>
To: "'comp.lang.ada@ada.eu.org'" <comp.lang.ada@ada.eu.org>
Subject: RE: Package name
Date: Wed, 16 May 2001 12:17:10 -0400
Date: 2001-05-16T12:17:10-04:00	[thread overview]
Message-ID: <mailman.990029894.5812.comp.lang.ada@ada.eu.org> (raw)


-----Original Message-----
From: Marin David Condic [mailto:marin.condic.auntie.spam@pacemicro.com]

> I think the idea is to have something like a pragma or attribute that lets
> you get the name of the module you are in as a string. I have frequently
> wished I could write a more general exception handler (or error handler or
> simple messages at runtime...) by having something like "Context'Image" or
> some other function that would provide the fully qualified name of the
> subprogram, package, whatever that I am currently in. Example:
>
> package body Some_Package is
>    procedure Some_Procedure is
>        ....
>        Put_Line ("Running in: " & Current_Context'Image) ;
>
> having that print:
>
> Running in: Standard.Some_Package.Some_Procedure

The Aonix ObjectAda compiler on Windows NT, returns the Package,
Procedure, and line number when Exception_Information is called.
That is, assuming you produced the executable with at least
CodeView debugging included.  If you build the executable without
any debugging, then all you get is useless addresses.

For general debugging, we had to defined our own constants.  The
PACKAGE_NAME/CLASS_NAME was defined globally in the package body,
while each procedure or function had a local constant (METHOD_NAME).
It would have been really nice to have something like Context'image,
as Marin suggests.

Frank




             reply	other threads:[~2001-05-16 16:17 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-16 16:17 Beard, Frank [this message]
2001-05-16 18:11 ` Package name tmoran
  -- strict thread matches above, loose matches on Subject: below --
2001-05-16 12:56 Atle R�stad
2001-05-16 13:28 ` Preben Randhol
2001-05-16 13:46   ` Atle R�stad
2001-05-16 14:00   ` Marin David Condic
2001-05-16 16:45     ` Claude SIMON
2001-05-17 13:59       ` Marin David Condic
2001-05-17 15:06         ` Samuel T. Harris
2001-05-16 18:24     ` Randy Brukardt
2001-05-16 16:10 ` Jeffrey Carter
2001-05-16 17:08 ` David C. Hoos, Sr.
replies disabled

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