comp.lang.ada
 help / color / mirror / Atom feed
From: "Corey Ashford" <yeroca7@rocketmail.com>
Subject: Re: In Exception ?
Date: 1998/04/05
Date: 1998-04-05T00:00:00+00:00	[thread overview]
Message-ID: <6g7fpc$l08$1@usenet.rational.com> (raw)
In-Reply-To: 35214b7a.0@news.profinet.at



Gerhard Auinger wrote in message <35214b7a.0@news.profinet.at>...
>Hello,
>
>I'm a pretty unexperienced ada programmer (Ada83), therefore I hope not to
>ask to stupid things.
>
>My problem: I want to establish a  routine that is called out of normal
>flow, or out of an exception handler. How can I get the knowledge whether I
>am 'in' an exception (means in its processing) or not.  Is there a sort of
>function than can be coded like
>
>         if  in_exception_handler  then
>           ...
>        else
>           ...
>        end if;

Ada95 doesn't provide such a feature, I'm afraid.  So you'll need a more
complicated
solution.

If you aren't using more than one task, then a simple global variable
counter
which is incremented inside the handler and decremented after the handler
should suffice.  If the counter is equal to zero, you are not on the
"thread" of an
exception handler.  You'll have to treat non-standard exits from exception
handlers
carefully (goto's, exit statements, return statements, etc.).

If you are using more than one task, you need this information on a per-task
basis.
If your compiler supports Annex C, then you could use the task attribute
feature to
implement the per-task counter.

Another possible implementation is to pass the a boolean down through the
call
chain which says whether or not you're in a handler.  This could get ugly,
of course.

Good luck

- Corey






  parent reply	other threads:[~1998-04-05  0:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <35214b7a.0@news.profinet.at>
1998-04-04  0:00 ` In Exception ? Paul Van Bellinghen
1998-04-07  0:00   ` John Herro
1998-04-05  0:00 ` Corey Ashford [this message]
1998-04-07  0:00   ` nabbasi
1998-04-07  0:00     ` Corey Minyard
     [not found]     ` <Er1n22.24v@world.std.com>
1998-04-07  0:00       ` Robert Dewar
1998-04-09  0:00     ` Mats Weber
1998-04-09  0:00       ` nabbasi
1998-04-10  0:00         ` Larry Kilgallen
1998-04-09  0:00     ` Mats Weber
1998-04-09  0:00       ` nabbasi
replies disabled

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