home *** CD-ROM | disk | FTP | other *** search
- \
- \ test/exception.4th --- tests the exception word set
- \ (duz 10Aug93)
- \
-
- CR .( exception words) CR .( )
-
- : FCL FDEPTH 0 > IF FDEPTH 0 DO FDROP LOOP THEN ;
- D SPACE \ stack must be empty on entry!
-
- : STK DROP ?STACK ; \ a stack underflow exception
- : FPE 1E0 0E0 F/ ; \ a floating point exception
-
- : EX1 ['] STK CATCH ; EX1 -4 = Y D SPACE
- : EX2 ['] FPE CATCH ; EX2 -55 = Y D SPACE
-
- : FPEE S" FPE" EVALUATE ; ' FPEE CATCH -55 = Y D FCL SPACE
-
- : FPEEE S" ' FPEE CATCH" ; FPEEE EVALUATE -55 = Y D FCL SPACE
-
- : UNDEF S" :-) 0 Y " ; UNDEF ' EVALUATE CATCH -13 = Y
- 2DROP D
-
- \
- \ Test handling signals with Forth words.
- \
-
- CR
- : SIG-TERM-HDL ." SIGTERM handled ok. " ;
- ' SIG-TERM-HDL SIGTERM SIGNAL .
- SIGTERM RAISE
- 0 SIGTERM SIGNAL ' SIG-TERM-HDL = Y
-