From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,FREEMAIL_FROM, INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1096a7986b560ad6 X-Google-Attributes: gid103376,public From: "Corey Ashford" Subject: Re: In Exception ? Date: 1998/04/05 Message-ID: <6g7fpc$l08$1@usenet.rational.com>#1/1 X-Deja-AN: 341026378 References: <35214b7a.0@news.profinet.at> X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4 Organization: Rational Software Newsgroups: comp.lang.ada Date: 1998-04-05T00:00:00+00:00 List-Id: 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