6.2.0873
CASE
CORE EXT
Interpretation:
Interpretation semantics for this word are undefined.
Compilation:
( C: --
case-sys
)
Mark the start of the
CASE
...
OF
...
ENDOF
...
ENDCASE
structure. Append the run-time semantics given below to the current definition.
Run-time:
( -- )
Continue execution.
See:
6.2.1342 ENDCASE
,
6.2.1343 ENDOF
,
6.2.1950 OF
,
A.6.2.0873 CASE
.
Rationale:
Typical use:
:
X
...
CASE
test1
OF
...
ENDOF
testn
OF
...
ENDOF
...
(
default )
ENDCASE
...
;
Testing:
:
cs1
CASE
1
OF
111
ENDOF
2
OF
222
ENDOF
3
OF
333
ENDOF
>R
999
R>
ENDCASE
;
T{ 1 cs1 -> 111 }T
T{ 2 cs1 -> 222 }T
T{ 3 cs1 -> 333 }T
T{ 4 cs1 -> 999 }T
:
cs2
>R
CASE
-1
OF
CASE
R@
1
OF
100
ENDOF
2
OF
200
ENDOF
>R
-300
R>
ENDCASE
ENDOF
-2
OF
CASE
R@
1
OF
-99
ENDOF
>R
-199
R>
ENDCASE
ENDOF
>R
299
R>
ENDCASE
R>
DROP
;
T{ -1 1 cs2 -> 100 }T
T{ -1 2 cs2 -> 200 }T
T{ -1 3 cs2 -> -300 }T
T{ -2 1 cs2 -> -99 }T
T{ -2 2 cs2 -> -199 }T
T{ 0 2 cs2 -> 299 }T
Forth 2012
Forth 2012
Glossary
Foreword
Proposals Process
200
x
Membership
Introduction
Terms, notation, and references
Usage requirements
Documentation requirements
Compliance and labeling
Glossary
Block word set
Double-Number word set
Exception word set
Facility word set
File-Access word set
Floating-Point word set
Locals word set
Memory-Allocation word set
Programming-Tools word set
Search-Order word set
String word set
Extended-Character word set
Rationale
Bibliography
Compatibility analysis
Portability guide
Reference Implementations
Test Suite
Alphabetic list of words
CASE
!
#
#>
#S
'
(
*
*/
*/MOD
+
+!
+LOOP
,
-
.
."
/
/MOD
0<
0=
1+
1-
2!
2*
2/
2@
2DROP
2DUP
2OVER
2SWAP
:
;
<
<#
=
>
>BODY
>IN
>NUMBER
>R
?DUP
@
ABORT
ABORT"
ABS
ACCEPT
ALIGN
ALIGNED
ALLOT
AND
BASE
BEGIN
BL
C!
C,
C@
CELL+
CELLS
CHAR
CHAR+
CHARS
CONSTANT
COUNT
CR
CREATE
DECIMAL
DEPTH
DO
DOES>
DROP
DUP
ELSE
EMIT
ENVIRONMENT?
EVALUATE
EXECUTE
EXIT
FILL
FIND
FM/MOD
HERE
HOLD
I
IF
IMMEDIATE
INVERT
J
KEY
LEAVE
LITERAL
LOOP
LSHIFT
M*
MAX
MIN
MOD
MOVE
NEGATE
OR
OVER
POSTPONE
QUIT
R>
R@
RECURSE
REPEAT
ROT
RSHIFT
S"
S>D
SIGN
SM/REM
SOURCE
SPACE
SPACES
STATE
SWAP
THEN
TYPE
U.
U<
UM*
UM/MOD
UNLOOP
UNTIL
VARIABLE
WHILE
WORD
XOR
[
[']
[CHAR]
]
.(
.R
0<>
0>
2>R
2R>
2R@
:NONAME
<>
?DO
ACTION-OF
AGAIN
BUFFER:
C"
CASE
COMPILE,
DEFER
DEFER!
DEFER@
ENDCASE
ENDOF
ERASE
FALSE
HEX
HOLDS
IS
MARKER
NIP
OF
PAD
PARSE
PARSE-NAME
PICK
REFILL
RESTORE-INPUT
ROLL
S\"
SAVE-INPUT
SOURCE-ID
TO
TRUE
TUCK
U.R
U>
UNUSED
VALUE
WITHIN
[COMPILE]
\