comp.lang.ada
 help / color / mirror / Atom feed
From: "David C. Hoos, Sr." <david.c.hoos.sr@ada95.com>
Subject: Re: Program identification
Date: 1996/09/03
Date: 1996-09-03T00:00:00+00:00	[thread overview]
Message-ID: <01bb9986$a6da1c80$438371a5@dhoossr.iquest.com> (raw)
In-Reply-To: INFO-ADA%96082914161709@LISTSERV.NODAK.EDU


Chris Sparks <sparks@AISF.COM> wrote in article
<INFO-ADA%96082914161709@LISTSERV.NODAK.EDU>...
> Does anyone know of a way to determine the program name within a program
> without explictly making a constant for it.  If there isn't a way then
> maybe a new attribute should be made for the next version of Ada, namely:
> 
> P'Identity which returns a string, P is a program unit
> 
> I am using this information as part of an exception reporter system.
> 
> BTW these would be helpful too:
> 
> P'Location which returns a string, P is a program unit and the string
would
> contain the current line number in the source code, or maybe even the
previous
> line number (for exception processing).
> 
> Any thoughts?
> 
The gnat compiler has an assert mechanism which will identify source file
name and line numbers.  It is used in the compiler code itself to do just
what you describe.
It seems to me that you don't need to know the program unit name if you
know the source code location -- but I haven't seen how, or thought through
whether there is any way to identify the location of the instantiation, if
the assertion fails in a generic unit's code.
Incidentally, you need to turn on a compiler switch to activate the
assertion mechanism.
-- 
David C. Hoos, Sr.,
http://www.dbhwww.com
http://www.ada95.com






  parent reply	other threads:[~1996-09-03  0:00 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-08-29  0:00 Program identification Chris Sparks
1996-08-31  0:00 ` Dale Stanbrough
1996-08-31  0:00 ` Ray Blaak
1996-08-31  0:00 ` Robert A Duff
1996-08-31  0:00   ` Ray Blaak
1996-08-31  0:00     ` Robert A Duff
1996-09-02  0:00 ` Stephen & Tammy House
1996-09-03  0:00 ` David C. Hoos, Sr. [this message]
1996-09-13  0:00 ` James A. Krzyzanowski
1996-09-14  0:00   ` Ken Garlington
1996-09-15  0:00     ` Larry Kilgallen
  -- strict thread matches above, loose matches on Subject: below --
1996-08-31  0:00 tmoran
1996-08-31  0:00 ` Robert A Duff
1996-09-02  0:00 tmoran
1996-09-03  0:00 ` Joel VanLaven
replies disabled

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