forked from KolibriOS/kolibrios
09488af869
git-svn-id: svn://kolibrios.org@4867 a494cfbc-eb01-0410-851d-a64ba20cac60
43 lines
867 B
Forth
43 lines
867 B
Forth
\ Ęîíńňđóęöč˙ âűáîđŕ CASE
|
|
\ ń ó÷ĺňîě âîçěîćíîé âëîćĺííîńňč îďĺđŕňîđîâ CASE
|
|
|
|
|
|
DECIMAL
|
|
VARIABLE CSP \ Óęŕçŕňĺëü ńňĺęŕ ęîíňđîë˙
|
|
6 CONSTANT L-CAS# \ Äîďóńňčěűé óđîâĺíü âëîćĺííîńňč
|
|
CREATE S-CSP L-CAS# CELLS ALLOT \ Ńňĺę ęîíňđîë˙
|
|
S-CSP CSP !
|
|
|
|
: +CSP ( -> P) \ Äîáŕâčňü óđîâĺíü
|
|
CSP @ DUP CELL+ CSP !
|
|
;
|
|
: -CSP ( -> ) \ Óáđŕňü óđîâĺíü
|
|
CSP @ 1 CELLS - CSP !
|
|
;
|
|
|
|
: !CSP ( -> ) \ Číčöčŕëčçčđîâŕňü óđîâĺíü
|
|
SP@ +CSP !
|
|
;
|
|
|
|
: CSP@ ( -> A)
|
|
CSP @ 1 CELLS - @
|
|
;
|
|
: ?CSP ( -> ) \ Ďđîâĺđčňü âűäĺđćŕííîńňü ńňĺęŕ
|
|
\ SP@ CSP@ <> 37 ?ERROR ( ABORT" Ńáîé ńňĺęŕ ďî CSP !")
|
|
-CSP
|
|
;
|
|
: CASE ( -> )
|
|
!CSP
|
|
; IMMEDIATE
|
|
: OF
|
|
POSTPONE OVER POSTPONE =
|
|
[COMPILE] IF POSTPONE DROP
|
|
; IMMEDIATE
|
|
: ENDOF
|
|
[COMPILE] ELSE
|
|
; IMMEDIATE
|
|
: ENDCASE
|
|
POSTPONE DROP BEGIN SP@ CSP@ =
|
|
0= WHILE [COMPILE] THEN REPEAT -CSP
|
|
; IMMEDIATE
|