--- gforth/prims2x.fs 2005/12/31 15:46:10 1.160 +++ gforth/prims2x.fs 2007/02/18 18:30:51 1.164 @@ -1,6 +1,6 @@ \ converts primitives to, e.g., C code -\ Copyright (C) 1995,1996,1997,1998,2000,2003,2004,2005 Free Software Foundation, Inc. +\ Copyright (C) 1995,1996,1997,1998,2000,2003,2004,2005,2006 Free Software Foundation, Inc. \ This file is part of Gforth. @@ -140,13 +140,10 @@ $12340000 immarg ! : ?print-error { f addr u -- } f ?not? if - outfile-id >r try - stderr to outfile-id - filename 2@ type ." :" line @ 0 .r ." : " addr u type cr - print-error-line - 0 - recover endtry - r> to outfile-id throw + stderr >outfile + filename 2@ type ." :" line @ 0 .r ." : " addr u type cr + print-error-line + outfile< 1 (bye) \ abort endif ; @@ -205,6 +202,7 @@ struct% end-struct ss% \ stack-state struct% + cell% field state-enabled cell% field state-number cell% max-stacks * field state-sss end-struct state% @@ -504,8 +502,8 @@ defer inst-stream-f ( -- stack ) ." vm_two" r@ item-stack-type-name type ." 2" r@ item-type @ print-type-prefix ." (" - r@ item-in-index r@ item-stack @ 2dup ." (Cell)" stack-read - ." , " -1 under+ ." (Cell)" stack-read + r@ item-in-index r@ item-stack @ 2dup stack-read + ." , " -1 under+ stack-read ." , " r@ item-name 2@ type ." )" cr rdrop ; @@ -755,11 +753,18 @@ stack inst-stream IP Cell : state ( "name" -- ) \ create a state initialized with default-sss create state% %allot { s } + s state-enabled on next-state-number @ s state-number ! 1 next-state-number +! max-stacks 0 ?do default-ss s state-sss i th ! loop ; +: state-disable ( state -- ) + state-enabled off ; + +: state-enabled? ( state -- f ) + state-enabled @ ; + : .state ( state -- ) 0 >body - >name .name ; @@ -1462,6 +1467,7 @@ variable reprocessed-num 0 reprocessed-n : state-prim1 { in-state out-state prim -- } in-state out-state state-default dup d= ?EXIT + in-state state-enabled? out-state state-enabled? and 0= ?EXIT in-state to state-in out-state to state-out prim reprocess-simple ;