blob: d52183a285da7e2b12dd2f9e4ba850df650c77cd (
plain) (
blame)
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
|
(selective-load "mu.arc" section-level)
(reset)
(new-trace "read-move-legal")
(add-code:readfile "chessboard-cursor.mu")
(add-code
'((function! main [
(default-space:space-address <- new space:literal 30:literal/capacity)
(1:channel-address/raw <- init-channel 3:literal)
(r:integer/routine <- fork read-move:fn nil:literal/globals 200:literal/limit)
(c:character <- copy ((#\a literal)))
(x:tagged-value <- save-type c:character)
(1:channel-address/raw/deref <- write 1:channel-address/raw x:tagged-value)
(c:character <- copy ((#\2 literal)))
(x:tagged-value <- save-type c:character)
(1:channel-address/raw/deref <- write 1:channel-address/raw x:tagged-value)
(c:character <- copy ((#\- literal)))
(x:tagged-value <- save-type c:character)
(1:channel-address/raw/deref <- write 1:channel-address/raw x:tagged-value)
(c:character <- copy ((#\a literal)))
(x:tagged-value <- save-type c:character)
(1:channel-address/raw/deref <- write 1:channel-address/raw x:tagged-value)
(c:character <- copy ((#\4 literal)))
(x:tagged-value <- save-type c:character)
(1:channel-address/raw/deref <- write 1:channel-address/raw x:tagged-value)
(sleep until-routine-done:literal r:integer/routine)
])))
;? (set dump-trace*)
;? (= dump-trace* (obj whitelist '("schedule")))
(run 'main)
(each routine completed-routines*
;? (prn " " routine)
(awhen rep.routine!error
(prn "error - " it)))
(if (~ran-to-completion 'read-move)
(prn "F - chessboard accepts legal moves (<rank><file>-<rank><file>)"))
;? (quit)
(reset)
(new-trace "read-move-incomplete")
(add-code:readfile "chessboard-cursor.mu")
(add-code
'((function! main [
(default-space:space-address <- new space:literal 30:literal/capacity)
(1:channel-address/raw <- init-channel 3:literal)
(r:integer/routine <- fork-helper read-move:fn nil:literal/globals 200:literal/limit)
(c:character <- copy ((#\a literal)))
(x:tagged-value <- save-type c:character)
(1:channel-address/raw/deref <- write 1:channel-address/raw x:tagged-value)
(c:character <- copy ((#\2 literal)))
(x:tagged-value <- save-type c:character)
(1:channel-address/raw/deref <- write 1:channel-address/raw x:tagged-value)
(c:character <- copy ((#\- literal)))
(x:tagged-value <- save-type c:character)
(1:channel-address/raw/deref <- write 1:channel-address/raw x:tagged-value)
(c:character <- copy ((#\a literal)))
(x:tagged-value <- save-type c:character)
(1:channel-address/raw/deref <- write 1:channel-address/raw x:tagged-value)
(sleep until-routine-done:literal r:integer/routine)
])))
(run 'main)
(if (ran-to-completion 'read-move)
(prn "F - chessboard hangs until 5 characters are entered"))
(reset)
(new-trace "read-move-quit")
(add-code:readfile "chessboard-cursor.mu")
(add-code
'((function! main [
(default-space:space-address <- new space:literal 30:literal/capacity)
(1:channel-address/raw <- init-channel 3:literal)
(r:integer/routine <- fork-helper read-move:fn nil:literal/globals nil:literal/limit)
(c:character <- copy ((#\q literal)))
(x:tagged-value <- save-type c:character)
(1:channel-address/raw/deref <- write 1:channel-address/raw x:tagged-value)
(sleep until-routine-done:literal r:integer/routine)
])))
(run 'main)
(if (~ran-to-completion 'read-move)
(prn "F - chessboard quits on move starting with 'q'"))
(reset)
(new-trace "read-illegal-file")
(add-code:readfile "chessboard-cursor.mu")
(add-code
'((function! main [
(default-space:space-address <- new space:literal 30:literal/capacity)
(1:channel-address/raw <- init-channel 3:literal)
(r:integer/routine <- fork-helper read-file:fn nil:literal/globals nil:literal/limit)
(c:character <- copy ((#\i literal)))
(x:tagged-value <- save-type c:character)
(1:channel-address/raw/deref <- write 1:channel-address/raw x:tagged-value)
(sleep until-routine-done:literal r:integer/routine)
])))
;? (= dump-trace* (obj whitelist '("schedule")))
(run 'main)
;? (each routine completed-routines*
;? (prn " " routine))
(if (ran-to-completion 'read-file)
(prn "F - 'read-file' checks that file lies between 'a' and 'h'"))
(reset)
(new-trace "read-illegal-rank")
(add-code:readfile "chessboard-cursor.mu")
(add-code
'((function! main [
(default-space:space-address <- new space:literal 30:literal/capacity)
(1:channel-address/raw <- init-channel 3:literal)
(r:integer/routine <- fork-helper read-rank:fn nil:literal/globals nil:literal/limit)
(c:character <- copy ((#\9 literal)))
(x:tagged-value <- save-type c:character)
(1:channel-address/raw/deref <- write 1:channel-address/raw x:tagged-value)
(sleep until-routine-done:literal r:integer/routine)
])))
(run 'main)
(if (ran-to-completion 'read-rank)
(prn "F - 'read-rank' checks that rank lies between '1' and '8'"))
(reset)
|