home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C!T ROM 5
/
ctrom5b.zip
/
ctrom5b
/
PROGRAM
/
DIVERSEN
/
TIPI2A
/
HELPCONT.TPI
< prev
next >
Wrap
Text File
|
1994-09-13
|
5KB
|
303 lines
define menu
# ( -- choice)
# ( valid$ -- )
# Returns the chosen key or 0 if the user escapes from this menu
0 cursor
ucase$
27 chr$ swap$ +$
begin
inkey$ ucase$ # valid$ key$
len instr *
dup
if dup drop$ endif drop$
until
1 -
1 cursor
enddef
define wait
begin key until cls
enddef
begin cls
|
| ╔══════════════════════════════════════════╗
| ║ C O N T R O L I N S T R U C T I O N S ║
| ╠══════════════╦══════════════╦════════════╣
| ║ ║ ║ ║
| ║ [A] BEGIN ║ [H] ENDCASE ║ [O] LEAVE ║
| ║ ║ ║ ║
| ║ [B] CASE ║ [I] ENDCASE$ ║ [P] LOOP ║
| ║ ║ ║ ║
| ║ [C] CASE$ ║ [J] ENDIF ║ [Q] OF ║
| ║ ║ ║ ║
| ║ [D] DEFAULT ║ [K] ENDOF ║ [R] OF$ ║
| ║ ║ ║ ║
| ║ [E] DEFAULT$ ║ [L] ENDOF$ ║ [S] UNTIL ║
| ║ ║ ║ ║
| ║ [F] DO ║ [M] IF ║ [T] WEND ║
| ║ ║ ║ ║
| ║ [G] ELSE ║ [N] INDEX ║ [U] WHILE ║
| ╚══════════════╩══════════════╩════════════╝
"abcdefghijklmnopqrstu" menu dup
cls
case 0 of endof
1 of
|
| BEGIN
|
| Data Stack: --
| String Stack: --
|
| Starts a BEGIN UNTIL loop. When TIPI encounters
| an UNTIL, it will branch back to the BEGIN if
| the value on the data stack is FALSE.
|
wait
endof
2 of
|
| CASE
|
| Data Stack: --
| String Stack: --
|
| Begins a CASE structure.
|
wait
endof
3 of
|
| CASE$
|
| Data Stack: --
| String Stack: --
|
| Begins a CASE$ structure.
|
wait
endof
4 of
|
| DEFAULT
|
| Data Stack: n --
| String Stack: --
|
| Used within a CASE structure to cover any cases
| not dealt with by previous OF clauses.
|
wait
endof
5 of
|
| DEFAULT$
|
| Data Stack: --
| String Stack: a$ --
|
| Used within a CASE$ structure to cover any
| cases not dealt with by previous OF$ clauses.
|
wait
endof
6 of
|
| DO
|
| Data Stack: N --
| String Stack: --
|
| Begins a DO loop. Processing continues until a
| LOOP instruction is encountered. The loop will
| be executed N times.
|
wait
endof
7 of
|
| ELSE
|
| Data Stack: --
| String Stack: --
|
| Used within IF ELSE ENDIF constructs.
|
wait
endof
8 of
|
| ENDCASE
|
| Data Stack: --
| String Stack: --
|
| Ends a CASE structure.
|
wait
endof
9 of
|
| ENDCASE$
|
| Data Stack: --
| String Stack: --
|
| Ends a CASE$ structure.
|
wait
endof
10 of
|
| ENDIF
|
| Data Stack: --
| String Stack: --
|
| Ends an IF ELSE ENDIF construct.
|
wait
endof
11 of
|
| ENDOF
|
| Data Stack: --
| String Stack: --
|
| Ends an OF clause in a CASE structure.
|
wait
endof
12 of
|
| ENDOF$
|
| Data Stack: --
| String Stack: --
|
| Ends an OF$ clause in a CASE$ structure.
|
wait
endof
13 of
|
| IF
|
| Data Stack: n --
| String Stack: --
|
| If n is non-zero, instructions up to the next ELSE
| or ENDIF will be executed. If n is zero,
| instructions up to the next ELSE or ENDIF will
| be skipped.
|
wait
endof
14 of
|
| INDEX
|
| Data Stack: -- index
| String Stack: --
|
| Copies the current DO LOOP index value to the
| data stack.
|
wait
endof
15 of
|
| LEAVE
|
| Data Stack: --
| String Stack: --
|
| Sets the current INDEX value to one, thus
| ensuring the current DO LOOP will be ended on
| this itteration.
|
wait
endof
16 of
|
| LOOP
|
| Data Stack: --
| String Stack: --
|
| Closes a DO LOOP construct. Decrements INDEX and
| loops back to the DO if INDEX > 0, otherwise
| exits the loop.
|
wait
endof
17 of
|
| OF
|
| Data Stack: m n --
| String Stack: --
|
| Must be used within a CASE structure. If m is
| equal to n, the instructions following the OF
| will be executed until an ENDOF is encountered.
|
wait
endof
18 of
|
| OF$
|
| Data Stack: --
| String Stack: a$ b$ --
|
| Must be used within a CASE$ structure. If a$ is
| equal to b$, the instructions following the OF$
| will be executed until an ENDOF$ is encountered.
|
wait
endof
19 of
|
| UNTIL
|
| Data Stack: N --
| String Stack: --
|
| Branches back to BEGIN if N is FALSE, otherwise
| continues.
|
wait
endof
20 of
|
| WEND
|
| Data Stack: --
| String Stack: --
|
| WEND branches back to a previous WHILE.
|
wait
endof
21 of
|
| WHILE
|
| Data Stack: n --
| String Stack: --
|
| If n is not equal to zero, instructions between
| the WHILE and the WEND will be executed. WEND
| will branch back to the WHILE. If n is equal to
| zero, execution branches to then next instruction
| following the next WEND.
|
wait
endof
endcase
not
until