home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
forth
/
compiler
/
fpc
/
tutor
/
l3p140
< prev
next >
Wrap
Text File
|
1990-07-15
|
2KB
|
56 lines
╔════════════════════════════════════════════════════╗
║ Lesson 3 Part 140 F-PC 3.5 Tutorial by Jack Brown ║
╚════════════════════════════════════════════════════╝
\ Here is another way that the word SPEED_CHECK could be formated.
\ Message Speed range kmph
\ ----------- ------------------
\ " issue ticket, impeding traffic flow." 0 - 15
\ " issue warning, impeding traffic flow." 16 - 30
\ " no action, safe speed." 31 - 55
\ " issue warning, exceeding speed limit." 56 - 65
\ " issue ticket, exceeding speed limit." 66 - 99
\ " arrest motorist, dangerous driving." 100 -
\ Leave true flag is speed is very slow 0 - 15 kmph
: VERY_SLOW? ( speed -- flag)
0 15 [IN] ;
\ Leave true flag if speed is slow 16 - 30 kmph
: SLOW? ( speed -- flag )
16 30 [IN] ;
\ Leave true flag if speed is normal 31 - 55 kmph
: NORMAL? ( speed -- flag )
31 55 [IN] ;
\ Leave true flag if speed is fast 56 - 65 kmph
: FAST? ( speed -- flag )
56 65 [IN] ;
\ Leave true flag if spped is very fast 66- 99 kmph
: VERY_FAST? ( speed -- flag )
66 99 [IN] ;
\ Leave true flag if speed is dangerous 100 kmph and over.
: DANGEROUS? ( speed -- flag )
99 > ;
\ Check speed and print appropriate message.
: SPEED_CHECK ( speed -- )
DUP VERY_SLOW?
IF ." Issue ticket, impeding traffic flow." DROP ELSE
DUP SLOW?
IF ." Issue warning, impeding traffic flow." DROP ELSE
DUP NORMAL?
IF ." No action, safe speed." DROP ELSE
DUP FAST?
IF ." Issue warning, exceeding speed limit." DROP ELSE
DUP VERY_FAST?
IF ." Issue ticket, exceeding speed limit." DROP ELSE
DANGEROUS?
IF ." Arrest motorist, dangerous driving."
THEN THEN THEN THEN THEN THEN ;