| \ along with this program; if not, write to the Free Software |
\ along with this program; if not, write to the Free Software |
| \ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
\ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| |
|
| |
\ !! use a separate exception stack? anton |
| |
|
| |
\ user-definable rollback actions |
| |
|
| Defer 'catch |
Defer 'catch |
| Defer 'throw |
Defer 'throw |
| |
|
| : (try) ( -- ) |
: (try) ( -- ) |
| \ inline argument: address of the handler |
\ inline argument: address of the handler |
| r> |
r> |
| 'catch |
|
| dup dup @ + >r \ recovery address |
dup dup @ + >r \ recovery address |
| |
rp@ 'catch >r |
| sp@ >r |
sp@ >r |
| fp@ >r |
fp@ >r |
| lp@ >r |
lp@ >r |
| rdrop \ lp |
rdrop \ lp |
| rdrop \ fp |
rdrop \ fp |
| rdrop \ sp |
rdrop \ sp |
| |
r> rp! |
| rdrop \ recovery address |
rdrop \ recovery address |
| >r ; |
>r ; |
| |
|
| r> lp! |
r> lp! |
| r> fp! |
r> fp! |
| r> swap >r sp! drop r> |
r> swap >r sp! drop r> |
| 'throw |
rdrop 'throw |
| THEN ; |
THEN ; |
| is throw |
is throw |
| |
|