\ exception 10/04/97 gwj \ an implementation of the ANS Forth \ exception wordset create exception create handler 0 , 0 , : catch ( xt -- exception# | 0 ) sp@ >r >r handler 2@ >r >r rp@ handler 2! execute r> r> handler 2! r> r> 2drop 0 ; : throw ( ??? xcptn# -- ??? xcptn# ) ?dup if handler 2@ or 0= if dup -1 <> and dup -2 <> and dup if ." Unhandled exception#" . then abort else handler 2@ rp! r> r> handler 2! r> r> rot >r sp! drop r> then then ; : abort ( -- ) -1 throw ; : abortq ( addr cnt -- ) cr type -2 throw ; : abort" ( "ccc<">" -- ) postpone s" postpone abortq ; immediate