--- gforth/kernel/cond.fs 2004/12/31 13:24:04 1.19 +++ gforth/kernel/cond.fs 2012/12/31 15:25:19 1.30 @@ -1,12 +1,12 @@ \ Structural Conditionals 12dec92py -\ Copyright (C) 1995,1996,1997,2000,2003,2004 Free Software Foundation, Inc. +\ Copyright (C) 1995,1996,1997,2000,2003,2004,2007,2010,2011,2012 Free Software Foundation, Inc. \ This file is part of Gforth. \ Gforth is free software; you can redistribute it and/or \ 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. \ This program is distributed in the hope that it will be useful, @@ -15,8 +15,7 @@ \ GNU General Public License for more details. \ You should have received a copy of the GNU General Public License -\ along with this program; if not, write to the Free Software -\ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. +\ along with this program. If not, see http://www.gnu.org/licenses/. here 0 , \ just a dummy, the real value of locals-list is patched into it in glocals.fs AConstant locals-list \ acts like a variable that contains @@ -92,6 +91,9 @@ variable backedge-locals rdrop dup cs-item? ; +: CS-DROP ( dest -- ) \ gforth + dest? 2drop ; + : cs-push-part ( -- list addr ) locals-list @ here ; @@ -151,7 +153,7 @@ immediate restrict \ people who have not been brought up with Forth (or who have been \ brought up with fig-Forth). -: ELSE ( compilation orig1 -- orig2 ; run-time f -- ) \ core +: ELSE ( compilation orig1 -- orig2 ; run-time -- ) \ core POSTPONE ahead 1 cs-roll POSTPONE then ; immediate restrict @@ -185,6 +187,16 @@ IS until-like POSTPONE again POSTPONE then ; immediate restrict +\ not clear if this should really go into Gforth's kernel... + +: CONTINUE ( dest-sys j*sys -- dest-sys j*sys ) \ gforth + \g jump to the next outer BEGIN + depth 0 ?DO I pick dest = IF + I cs-item-size / cs-pick postpone AGAIN + UNLOOP EXIT THEN + cs-item-size +LOOP + true abort" no BEGIN found" ; immediate restrict + \ counted loops \ leave poses a little problem here @@ -225,7 +237,7 @@ Avariable leave-sp leave-stack 3 cells leave-sp ! ; : DONE ( compilation orig -- ; run-time -- ) \ gforth - \ !! the original done had ( addr -- ) + \g resolves all LEAVEs up to the compilaton orig (from a BEGIN) drop >r drop begin leave>