The Lambda Lab
/
projects
/
scheme.forth.jl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Updated README.
[scheme.forth.jl.git]
/
catch-throw.4th
diff --git
a/catch-throw.4th
b/catch-throw.4th
index
5c66df3
..
9192082
100644
(file)
--- a/
catch-throw.4th
+++ b/
catch-throw.4th
@@
-1,6
+1,7
@@
\ Exception handling
variable handler
\ Exception handling
variable handler
+0 handler !
: catch ( cfa -- exception# | 0 )
psp@ >R
: catch ( cfa -- exception# | 0 )
psp@ >R
@@
-15,7
+16,12
@@
variable handler
: throw ( ... exception# -- ... exception# )
?dup 0= if exit then
: throw ( ... exception# -- ... exception# )
?dup 0= if exit then
- handler @ rsp!
+ handler @ ?dup 0= if
+ ." Aborting: Uncaught exception " . ." ." cr
+ abort
+ then
+
+ rsp!
R> handler !
R> swap >R
R> handler !
R> swap >R