--- gforth/kernel/basics.fs 2006/02/25 18:28:12 1.51 +++ gforth/kernel/basics.fs 2006/03/25 18:37:16 1.52 @@ -219,6 +219,13 @@ has? glocals [IF] laddr# [ 0 , ] ; [THEN] +has? ec [IF] + : catch ( ... xt -- ... 0 ) + handler @ >r sp@ >r + rp@ handler ! execute 0 r> drop r> handler ! ; + : throw ( error -- error ) dup 0= IF drop EXIT THEN + handler @ rp! r> swap >r sp! r> r> handler ! ; +[ELSE] defer catch ( x1 .. xn xt -- y1 .. ym 0 / z1 .. zn error ) \ exception \G @code{Executes} @i{xt}. If execution returns normally, \G @code{catch} pushes 0 on the stack. If execution returns through @@ -243,6 +250,7 @@ defer throw ( y1 .. ym nerror -- y1 .. y [ [ELSE] ] quit [ [THEN] ] then ; is throw +[THEN] \ (abort")