-- The Optional Exception Word Set
Copyright (C) Tektronix, Inc. 1998 - 2001. All rights reserved.
description: These words implement an exception system in the widely known THROW & CATCH concept.
see the PFE-SIG wordset for catching OS traps.
FORTH
CATCH
( xt -- 0|n )(
)
;
p4:"catch";
execute the given execution-token and catch any exception that can be caught therein. software can arbitrarily raise an exception using THROW - the value 0 means there was no exception, other denote implementation dependent exception-codes.
dpANS 9.6.1.0875 - standard forth word
FORTH
THROW
( n -- )(
)
;
p4:"throw";
raise an exception - it will adjust the depth of all stacks and start interpreting at the point of the latest CATCH <br> if n is null nothing happens, the -1 (ie. FALSE ) is the raise-code of ABORT - the other codes are implementation dependent and will result in something quite like ABORT
dpANS 9.6.1.2275 - standard forth word
FORTH
ABORT
( -- )no-return(
)
;
p4:"abort";
throw - cleanup some things and go back to the QUIT routine
: ABORT -1 THROW ;
dpANS 9.6.2.0670 - standard forth word
FORTH
ABORT"
( [string<">] -- )no-return( | ) ; |
; |
throw like ABORT but print an additional error-message to stdout telling what has happened.
dpANS 9.6.2.0680 - standard forth word
ENVIRONMENT
EXCEPTION-EXT
( .. )( | ) ; |
; |
( 1994 ) constant EXCEPTION-EXT
an ordinary constant (no special usage info)
EXTENSIONS
NEXT-EXCEPTION
( .. )( | ) ; |
; |
threadstate variable NEXT-EXCEPTION
next_exception (no special usage info)