From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=0.5 required=3.0 tests=BAYES_05,FROM_ADDR_WS autolearn=no autolearn_force=no version=3.4.5-pre1 Date: 26 Apr 93 16:26:13 GMT From: pa.dec.com!nntpd2.cxo.dec.com!etre!wallace@decwrl.dec.com (Richard Walla ce) Subject: Re: VMS ADA - status return Message-ID: <1993Apr26.162613.8551@nntpd2.cxo.dec.com> List-Id: Ian Williams (iwilliam@au.oracle.com) wrote: : Hi All, : : I am a beginner ADA'er and am trying to have my program return non : successful error statuses in my exception handlers.. : I have managed to raise the SAME exception in my handler, but this causes : a half page dialog of stack dump information which is really not what I wante d. : : I simply want to be able to say something like this from DCL : : $ myprog :== $mydir:myprog.exe : $ myprog param1 param2 : $ if $status = errorval then etc. : : How can I do this easilly? : How can I find values to pass to LIB$STOP and not cause access violations??? : : -- : ---------------------+-------------+----------------------------------------- : Ian Williams | _--_|\ | Internet: iwilliam@au.oracle.com : Oracle Systems | / \ | Phone : +61 8 239 3900 : Adelaide, Australia | \_.--*_/ | : | v | Ian, Here's how it's done. Aloha, Richard Richard Wallace Senior Software Engineer Digital Equipment Corporation 301 Rockrimmon Blvd. South CXO2-1/7A Colorado Springs, CO 80919-2398 (719)548-2792 "The opinions expressed are my own, B.P. may not *quite* agree..." ----------------------------------- -- Ada program ----------------------------------- with STARLET; use STARLET; with CONDITION_HANDLING; use CONDITION_HANDLING; -- ++ -- What we're going to do here is raise an exception -- and reraise it so that the program exits and DCL -- gets the status return. We'll check the status -- return at the DCL level. procedure EXCEPTION_GENERATION is REAL_BAD_EXCEPTION : exception; OTHER_EXCEPTION : exception; SWITCH_VALUE : INTEGER; EXIT_STATUS : COND_VALUE_TYPE; CODE : COND_VALUE_TYPE; begin SWITCH_VALUE := 1; CODE := 33; if SWITCH_VALUE = 3 then raise OTHER_EXCEPTION; elsif SWITCH_VALUE = 1 then raise REAL_BAD_EXCEPTION; end if; exception when REAL_BAD_EXCEPTION => EXI ( EXIT_STATUS, CODE ); -- The EXIT_STATUS isn't checked as this -- VMS call transfers control directly -- from this code stream. end EXCEPTION_GENERATION; $!--------------------------------- $! DCL command procedure $!-------------------------------- $! Test command procedure $! Run the program and do something with the $STATUS $! DCL runtime symbol. $r/nodebug exception_generation $if($STATUS .EQ. 33) $then $ write sys$output "something very bad has happened" $endif $exit 1 $eod