"Exception + extensions"

exception
These words implement an exception system in the
widely known THROW amp; CATCH concept.

see the PFE-SIG wordset for catching OS traps.
Tektronix CTE %version: 5.8 % GNU LGPL
[ANS]
* CATCH ( xt -- 0|n )

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.

exception ordinary primitive

* THROW ( n -- )

raise an exception - it will adjust the depth
of all stacks and start interpreting at the point
of the latest CATCH

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

exception ordinary primitive

* ABORT ( -- ) no-return

throw - cleanup some things and go back to the QUIT routine
 : ABORT -1 THROW ;

exception ordinary primitive

* ABORT" ( [string<">] -- ) no-return

throw like ABORT but print an additional error-message
to stdout telling what has happened.

exception compiling primitive

ENVIRONMENT ENVIRONMENT EXCEPTION-EXT

no special info, see general notes

exception ordinary constant

EXTENSIONS EXTENSIONS NEXT-EXCEPTION

no special info, see general notes

exception threadstate variable

EXTENSIONS no or not matching binary image

no special info, see general notes

exception exception declared

EXTENSIONS binary image too big

no special info, see general notes

exception exception declared

EXTENSIONS out of memory

no special info, see general notes

exception exception declared

EXTENSIONS index out of range

no special info, see general notes

exception exception declared

EXTENSIONS compile failed (call from bad point)

no special info, see general notes

exception exception declared