1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
PACKET command dialogue DEFINES (* Autor: J.Liedtke *)
(* Stand: 25.11.83 *)
command dialogue ,
say ,
yes ,
no ,
param position ,
last param ,
std ,
QUIET ,
quiet :
LET up = ""3"" ,
right = ""2"" ,
cr lf = ""13""10"" ,
param pre = " (""" ,
param post = """)"13""10"" ;
TEXT VAR std param := "" ;
BOOL VAR dialogue flag := TRUE ;
INT VAR param x := 0 ;
TYPE QUIET = INT ;
QUIET PROC quiet :
QUIET:(0)
ENDPROC quiet ;
BOOL PROC command dialogue :
dialogue flag
ENDPROC command dialogue ;
PROC command dialogue (BOOL CONST status) :
dialogue flag := status
ENDPROC command dialogue ;
BOOL PROC yes (TEXT CONST question) :
IF dialogue flag
THEN ask question
ELSE TRUE
FI .
ask question :
out (question) ;
skip previous input chars ;
out (" (j/n) ? ") ;
get answer ;
IF correct answer
THEN out (answer) ;
out (cr lf) ;
positive answer
ELSE out (""7"") ;
LENGTH question + 9 TIMESOUT ""8"" ;
yes (question)
FI .
get answer :
TEXT VAR answer ;
inchar (answer) .
correct answer :
pos ("jnyJNY", answer) > 0 .
positive answer :
pos ("jyJY", answer) > 0 .
skip previous input chars :
REP UNTIL incharety = "" PER .
ENDPROC yes ;
BOOL PROC no (TEXT CONST question) :
NOT yes (question)
ENDPROC no ;
PROC say (TEXT CONST message) :
IF dialogue flag
THEN out (message)
FI
ENDPROC say ;
PROC param position (INT CONST x) :
param x := x
ENDPROC param position ;
TEXT PROC last param :
IF param x > 0 AND online
THEN out (up) ;
param x TIMESOUT right ;
out (param pre) ;
out (std param) ;
out (param post)
FI ;
std param .
ENDPROC last param ;
PROC last param (TEXT CONST new) :
std param := new
ENDPROC last param ;
TEXT PROC std :
std param
ENDPROC std ;
ENDPACKET command dialogue ;
|