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
21 \ MOD: PLB 11/2/99 Fixed nesting of CASE. Needed to save of-depth on stack as well as case-depth.
28 : CASE ( n -- , start case statement ) ( -c- case-depth )
30 of-depth @ 0 of-depth ! \ 11/2/99
31 case-depth @ 0 case-depth ! ( allow nesting )
34 : ?OF ( n flag -- | n , doit if true ) ( -c- addr )
41 : OF ( n t -- | n , doit if match ) ( -c- addr )
43 compile over compile =
47 : (RANGEOF?) ( n lo hi -- | n flag )
56 : RANGEOF ( n lo hi -- | n , doit if within ) ( -c- addr )
61 : ENDOF ( -- ) ( addr -c- addr' )
66 : ENDCASE ( n -- ) ( old-case-depth addr' addr' ??? -- )
68 IF >newline ." Missing ENDOF in CASE!" cr abort