Diff for /gforth/except.fs between versions 1.20 and 1.22

version 1.20, 2007/12/31 17:34:58 version 1.22, 2010/08/31 20:10:59
Line 6 Line 6
   
 \ Gforth is free software; you can redistribute it and/or  \ Gforth is free software; you can redistribute it and/or
 \ modify it under the terms of the GNU General Public License  \ modify it under the terms of the GNU General Public License
 \ as published by the Free Software Foundation; either version 2  \ as published by the Free Software Foundation, either version 3
 \ of the License, or (at your option) any later version.  \ of the License, or (at your option) any later version.
   
 \ This program is distributed in the hope that it will be useful,  \ This program is distributed in the hope that it will be useful,
Line 15 Line 15
 \ GNU General Public License for more details.  \ GNU General Public License for more details.
   
 \ You should have received a copy of the GNU General Public License  \ You should have received a copy of the GNU General Public License
 \ along with this program; if not, write to the Free Software  \ along with this program. If not, see http://www.gnu.org/licenses/.
 \ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.  
   
 \ !! use a separate exception stack?           anton  \ !! use a separate exception stack?           anton
   
Line 76  Variable first-throw Line 75  Variable first-throw
     \G backtrace.      \G backtrace.
     first-throw on ;      first-throw on ;
   
   : (try0) ( -- aoldhandler )
       first-throw on
       handler @ ;
   
   [undefined] (try1) [if]
   : (try1) ( aoldhandler arecovery -- anewhandler )
       r>
       swap >r \ recovery address
       sp@ cell+ >r
       fp@ >r
       lp@ >r
       swap >r \ old handler
       rp@ swap \ new handler
       >r ;
   [endif]
   
   : (try2)
       handler ! ;
   
 : (try) ( ahandler -- )  : (try) ( ahandler -- )
     first-throw on      first-throw on
     r>      r>
Line 87  Variable first-throw Line 105  Variable first-throw
     rp@ handler !      rp@ handler !
     >r ;      >r ;
   
   \ : try ( compilation  -- orig ; run-time  -- R:sys1 ) \ gforth
   \     \G Start an exception-catching region.
   \     POSTPONE ahead here >r >mark 1 cs-roll POSTPONE then
   \     r> POSTPONE literal POSTPONE (try) ; immediate compile-only
   
 : try ( compilation  -- orig ; run-time  -- R:sys1 ) \ gforth  : try ( compilation  -- orig ; run-time  -- R:sys1 ) \ gforth
     \G Start an exception-catching region.      \G Start an exception-catching region.
     POSTPONE ahead here >r >mark 1 cs-roll POSTPONE then      POSTPONE ahead here >r >mark 1 cs-roll POSTPONE then
     r> POSTPONE literal POSTPONE (try) ; immediate compile-only      POSTPONE (try0) r> POSTPONE literal POSTPONE (try1) POSTPONE (try2)
   ; immediate compile-only
   
   
 : (endtry) ( -- )  : (endtry) ( -- )
     \ normal end of try block: restore handler, forget rest      \ normal end of try block: restore handler, forget rest

Removed from v.1.20  
changed lines
  Added in v.1.22


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>