|
|
The following page contains reserved words. These are not part of the ANS Forth Standard. They are just proposed by various people and published here at FORTH.SF.NET for public review. |
:NON:
|
TOC |
R.9.6.1.2275 EXCEPTION
( c-addr u -- n )
Each call to this word shall return a different number. A system may use the string denoted by c-addr u when reporting an exception (if it is not caught). Many systems start with -256 and return consecutive decreasing numbers down to -4095.
\ default implementation:
VARIABLE NEXT-EXCEPTION -1024 NEXT-EXCEPTION !
: EXCEPTION ( c-addr u -- n )
2DROP NEXT-EXCEPTION @ DUP 1+ NEXT-EXCEPTION ! ;
\ using a system link-list
: EXCEPTION ( c-addr u -- n )
EXCEPTION-LINK LINK, NEXT-EXCEPTION @ , STRING, ALIGN
NEXT-EXCEPTION @ DUP 1+ NEXT-EXCEPTION ! ;
\ example use
s" Package Error" EXCEPTION VALUE PACKAGE-ERROR
: ?THROW SWAP IF THROW THEN ;
: when-run check-state PACKAGE-ERROR ?THROW ;
See:
9.6.1.2275 THROW,
9.6.1.0006 STRING,,
Table of Contents
Next Section