Annotation of gforth/compat/exception.fs, revision 1.1
1.1 ! anton 1: \ exception
! 2:
! 3: \ This file is in the public domain. NO WARRANTY.
! 4:
! 5: \ this implementation tries to be as close to the following proposal
! 6: \ as possible (we cannot guarantee unusedness nor are we allowed to
! 7: \ use values in the range -4095..-256).
! 8:
! 9: \ EXCEPTION ( c-addr u -- n ) exception
! 10:
! 11: \ n is a previously unused THROW value in the range
! 12: \ {-4095...-256}. Consecutive calls to EXCEPTION return consecutive
! 13: \ decreasing numbers.
! 14:
! 15: \ The system may use the string denoted by c-addr u when reporting
! 16: \ that exception (if it is not caught).
! 17:
! 18: \ Typical Use
! 19:
! 20: \ s" Out of GC-managed memory" EXCEPTION CONSTANT gc-out-of-memory
! 21: \ ...
! 22: \ ... gc-out-of-memory THROW ...
! 23:
! 24: \ The program uses the following words
! 25: \ from CORE :
! 26: \ Variable ! : 2drop @ +! ;
! 27: \ from BLOCK-EXT :
! 28: \ \
! 29: \ from FILE :
! 30: \ (
! 31:
! 32: variable next-exception -10753 next-exception !
! 33:
! 34: : exception ( c-addr u -- n )
! 35: 2drop
! 36: next-exception @
! 37: -1 next-exception +! ;
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>