1 \ @(#) case.fth 98/01/26 1.2
4 \ This definition is based upon Wil Baden's assertion that
5 \ >MARK >RESOLVE ?BRANCH etc. are not needed if one has IF ELSE THEN etc.
8 \ Copyright 1994 3DO, Phil Burk, Larry Polansky, Devid Rosenboom
10 \ The pForth software code is dedicated to the public domain,
11 \ and any third party may reproduce, distribute and modify
12 \ the pForth software code or any derivative works thereof
13 \ without any compensation or license. The pForth software
14 \ code is provided on an "as is" basis without any warranty
15 \ of any kind, including, without limitation, the implied
16 \ warranties of merchantability and fitness for a particular
17 \ purpose and their equivalents under the laws of any jurisdiction.
19 \ MOD: PLB 6/24/91 Check for missing ENDOF
20 \ MOD: PLB 8/7/91 Add ?OF and RANGEOF
27 : CASE ( n -- , start case statement ) ( -c- case-depth )
28 ?comp case-depth @ case-depth off ( allow nesting )
32 : ?OF ( n flag -- | n , doit if true ) ( -c- addr )
39 : OF ( n t -- | n , doit if match ) ( -c- addr )
41 compile over compile =
45 : (RANGEOF?) ( n lo hi -- | n flag )
54 : RANGEOF ( n lo hi -- | n , doit if within ) ( -c- addr )
59 : ENDOF ( -- ) ( addr -c- addr' )
64 : ENDCASE ( n -- ) ( old-case-depth addr' addr' ??? -- )
66 IF >newline ." Missing ENDOF in CASE!" cr abort