From 9e751bb8c0cdf771d34c839cb6591d892b8e62de Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Tue, 7 Mar 2017 01:41:48 -0800 Subject: 3761 --- html/edit/010-sandbox-trace.mu.html | 247 ++++++++++++++++++------------------ 1 file changed, 124 insertions(+), 123 deletions(-) (limited to 'html/edit/010-sandbox-trace.mu.html') diff --git a/html/edit/010-sandbox-trace.mu.html b/html/edit/010-sandbox-trace.mu.html index caafdea5..99709a40 100644 --- a/html/edit/010-sandbox-trace.mu.html +++ b/html/edit/010-sandbox-trace.mu.html @@ -15,16 +15,17 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color a { text-decoration: none; } a:hover { text-decoration: underline; } * { font-size: 12pt; font-size: 1em; } -.muData { color: #ffff00; } -.muControl { color: #c0a020; } +.Conceal { color: #4e4e4e; } +.muScenario { color: #00af00; } .Special { color: #c00000; } .Delimiter { color: #800080; } .SalientComment { color: #00ffff; } .Constant { color: #00a0a0; } .LineNr { color: #444444; } -.Comment { color: #9090ff; } .muRecipe { color: #ff8700; } -.muScenario { color: #00af00; } +.Comment { color: #9090ff; } +.muControl { color: #c0a020; } +.muData { color: #ffff00; } --> @@ -67,70 +68,70 @@ if ('onhashchange' in window) { 6 assume-screen 100/width, 10/height 7 # basic recipe 8 assume-resources [ - 9 [lesson/recipes.mu] <- [ - 10 |recipe foo [| - 11 | stash [abc]| - 12 |]| - 13 ] + 9 ¦ [lesson/recipes.mu] <- [ + 10 ¦ ¦ |recipe foo [| + 11 ¦ ¦ | stash [abc]| + 12 ¦ ¦ |]| + 13 ¦ ] 14 ] 15 env:&:environment <- new-programming-environment resources, screen, [foo] 16 # run it 17 assume-console [ - 18 press F4 + 18 ¦ press F4 19 ] 20 event-loop screen, console, env, resources 21 screen-should-contain [ - 22 . run (F4) . - 23 .recipe foo [ ╎ . - 24 . stash [abc] ╎─────────────────────────────────────────────────. - 25 .] ╎0 edit copy delete . - 26 . ╎foo . - 27 .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────. - 28 . ╎ . + 22 ¦ . run (F4) . + 23 ¦ .recipe foo [ ╎ . + 24 ¦ . stash [abc] ╎─────────────────────────────────────────────────. + 25 ¦ .] ╎0 edit copy delete . + 26 ¦ . ╎foo . + 27 ¦ .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────. + 28 ¦ . ╎ . 29 ] 30 # click on the code in the sandbox 31 assume-console [ - 32 left-click 4, 51 + 32 ¦ left-click 4, 51 33 ] 34 run [ - 35 event-loop screen, console, env, resources - 36 cursor:char <- copy 9251/␣ - 37 print screen, cursor + 35 ¦ event-loop screen, console, env, resources + 36 ¦ cursor:char <- copy 9251/␣ + 37 ¦ print screen, cursor 38 ] 39 # trace now printed and cursor shouldn't have budged 40 screen-should-contain [ - 41 . run (F4) . - 42 .␣ecipe foo [ ╎ . - 43 . stash [abc] ╎─────────────────────────────────────────────────. - 44 .] ╎0 edit copy delete . - 45 . ╎foo . - 46 .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎abc . + 41 ¦ . run (F4) . + 42 ¦ .␣ecipe foo [ ╎ . + 43 ¦ . stash [abc] ╎─────────────────────────────────────────────────. + 44 ¦ .] ╎0 edit copy delete . + 45 ¦ . ╎foo . + 46 ¦ .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎abc . 47 ] 48 screen-should-contain-in-color 245/grey, [ - 49 . . - 50 . ╎ . - 51 . ╎─────────────────────────────────────────────────. - 52 . ╎ . - 53 . ╎ . - 54 .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎abc . + 49 ¦ . . + 50 ¦ . ╎ . + 51 ¦ . ╎─────────────────────────────────────────────────. + 52 ¦ . ╎ . + 53 ¦ . ╎ . + 54 ¦ .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎abc . 55 ] 56 # click again on the same region 57 assume-console [ - 58 left-click 4, 55 + 58 ¦ left-click 4, 55 59 ] 60 run [ - 61 event-loop screen, console, env, resources - 62 print screen, cursor + 61 ¦ event-loop screen, console, env, resources + 62 ¦ print screen, cursor 63 ] 64 # trace hidden again 65 screen-should-contain [ - 66 . run (F4) . - 67 .␣ecipe foo [ ╎ . - 68 . stash [abc] ╎─────────────────────────────────────────────────. - 69 .] ╎0 edit copy delete . - 70 . ╎foo . - 71 .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────. - 72 . ╎ . + 66 ¦ . run (F4) . + 67 ¦ .␣ecipe foo [ ╎ . + 68 ¦ . stash [abc] ╎─────────────────────────────────────────────────. + 69 ¦ .] ╎0 edit copy delete . + 70 ¦ . ╎foo . + 71 ¦ .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────. + 72 ¦ . ╎ . 73 ] 74 ] 75 @@ -140,48 +141,48 @@ if ('onhashchange' in window) { 79 assume-screen 100/width, 10/height 80 # basic recipe 81 assume-resources [ - 82 [lesson/recipes.mu] <- [ - 83 |recipe foo [| - 84 | stash [abc]| - 85 | reply 4| - 86 |]| - 87 ] + 82 ¦ [lesson/recipes.mu] <- [ + 83 ¦ ¦ |recipe foo [| + 84 ¦ ¦ | stash [abc]| + 85 ¦ ¦ | reply 4| + 86 ¦ ¦ |]| + 87 ¦ ] 88 ] 89 env:&:environment <- new-programming-environment resources, screen, [foo] 90 # run it 91 assume-console [ - 92 press F4 + 92 ¦ press F4 93 ] 94 event-loop screen, console, env, resources 95 screen-should-contain [ - 96 . run (F4) . - 97 .recipe foo [ ╎ . - 98 . stash [abc] ╎─────────────────────────────────────────────────. - 99 . reply 4 ╎0 edit copy delete . -100 .] ╎foo . -101 . ╎4 . -102 .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────. -103 . ╎ . + 96 ¦ . run (F4) . + 97 ¦ .recipe foo [ ╎ . + 98 ¦ . stash [abc] ╎─────────────────────────────────────────────────. + 99 ¦ . reply 4 ╎0 edit copy delete . +100 ¦ .] ╎foo . +101 ¦ . ╎4 . +102 ¦ .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────. +103 ¦ . ╎ . 104 ] 105 # click on the code in the sandbox 106 assume-console [ -107 left-click 4, 51 +107 ¦ left-click 4, 51 108 ] 109 run [ -110 event-loop screen, console, env, resources +110 ¦ event-loop screen, console, env, resources 111 ] 112 # trace now printed above result 113 screen-should-contain [ -114 . run (F4) . -115 .recipe foo [ ╎ . -116 . stash [abc] ╎─────────────────────────────────────────────────. -117 . reply 4 ╎0 edit copy delete . -118 .] ╎foo . -119 . ╎abc . -120 .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎8 instructions run . -121 . ╎4 . -122 . ╎─────────────────────────────────────────────────. -123 . ╎ . +114 ¦ . run (F4) . +115 ¦ .recipe foo [ ╎ . +116 ¦ . stash [abc] ╎─────────────────────────────────────────────────. +117 ¦ . reply 4 ╎0 edit copy delete . +118 ¦ .] ╎foo . +119 ¦ . ╎abc . +120 ¦ .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎8 instructions run . +121 ¦ . ╎4 . +122 ¦ . ╎─────────────────────────────────────────────────. +123 ¦ . ╎ . 124 ] 125 ] 126 @@ -194,33 +195,33 @@ if ('onhashchange' in window) { 133 env:&:environment <- new-programming-environment resources, screen, [stash 123456789] 134 # create and expand the trace 135 assume-console [ -136 press F4 -137 left-click 4, 51 +136 ¦ press F4 +137 ¦ left-click 4, 51 138 ] 139 event-loop screen, console, env, resources 140 screen-should-contain [ -141 . run (F4) . -142 . ╎ . -143 .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────. -144 . ╎0 edit copy delete . -145 . ╎stash 123456789 . -146 . ╎123456789 . +141 ¦ . run (F4) . +142 ¦ . ╎ . +143 ¦ .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────. +144 ¦ . ╎0 edit copy delete . +145 ¦ . ╎stash 123456789 . +146 ¦ . ╎123456789 . 147 ] 148 # click on the stash under the edit-button region (or any of the other buttons, really) 149 assume-console [ -150 left-click 5, 57 +150 ¦ left-click 5, 57 151 ] 152 run [ -153 event-loop screen, console, env, resources +153 ¦ event-loop screen, console, env, resources 154 ] 155 # no change; doesn't die 156 screen-should-contain [ -157 . run (F4) . -158 . ╎ . -159 .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────. -160 . ╎0 edit copy delete . -161 . ╎stash 123456789 . -162 . ╎123456789 . +157 ¦ . run (F4) . +158 ¦ . ╎ . +159 ¦ .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────. +160 ¦ . ╎0 edit copy delete . +161 ¦ . ╎stash 123456789 . +162 ¦ . ╎123456789 . 163 ] 164 ] 165 @@ -244,29 +245,29 @@ if ('onhashchange' in window) { 183 after <global-touch> [ 184 # check if it's inside the code of any sandbox 185 { -186 sandbox-left-margin:num <- get *current-sandbox, left:offset -187 click-column:num <- get t, column:offset -188 on-sandbox-side?:bool <- greater-or-equal click-column, sandbox-left-margin -189 break-unless on-sandbox-side? -190 first-sandbox:&:sandbox <- get *env, sandbox:offset -191 break-unless first-sandbox -192 first-sandbox-begins:num <- get *first-sandbox, starting-row-on-screen:offset -193 click-row:num <- get t, row:offset -194 below-sandbox-editor?:bool <- greater-or-equal click-row, first-sandbox-begins -195 break-unless below-sandbox-editor? -196 # identify the sandbox whose code is being clicked on -197 sandbox:&:sandbox <- find-click-in-sandbox-code env, click-row -198 break-unless sandbox -199 # toggle its display-trace? property -200 x:bool <- get *sandbox, display-trace?:offset -201 x <- not x -202 *sandbox <- put *sandbox, display-trace?:offset, x -203 hide-screen screen -204 screen <- render-sandbox-side screen, env, render -205 screen <- update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env -206 # no change in cursor -207 show-screen screen -208 loop +next-event +186 ¦ sandbox-left-margin:num <- get *current-sandbox, left:offset +187 ¦ click-column:num <- get t, column:offset +188 ¦ on-sandbox-side?:bool <- greater-or-equal click-column, sandbox-left-margin +189 ¦ break-unless on-sandbox-side? +190 ¦ first-sandbox:&:sandbox <- get *env, sandbox:offset +191 ¦ break-unless first-sandbox +192 ¦ first-sandbox-begins:num <- get *first-sandbox, starting-row-on-screen:offset +193 ¦ click-row:num <- get t, row:offset +194 ¦ below-sandbox-editor?:bool <- greater-or-equal click-row, first-sandbox-begins +195 ¦ break-unless below-sandbox-editor? +196 ¦ # identify the sandbox whose code is being clicked on +197 ¦ sandbox:&:sandbox <- find-click-in-sandbox-code env, click-row +198 ¦ break-unless sandbox +199 ¦ # toggle its display-trace? property +200 ¦ x:bool <- get *sandbox, display-trace?:offset +201 ¦ x <- not x +202 ¦ *sandbox <- put *sandbox, display-trace?:offset, x +203 ¦ hide-screen screen +204 ¦ screen <- render-sandbox-side screen, env, render +205 ¦ screen <- update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env +206 ¦ # no change in cursor +207 ¦ show-screen screen +208 ¦ loop +next-event 209 } 210 ] 211 @@ -280,13 +281,13 @@ if ('onhashchange' in window) { 219 assert clicked-on-sandboxes?, [extract-sandbox called on click to sandbox editor] 220 # while click-row < sandbox.next-sandbox.starting-row-on-screen 221 { -222 next-sandbox:&:sandbox <- get *sandbox, next-sandbox:offset -223 break-unless next-sandbox -224 next-start:num <- get *next-sandbox, starting-row-on-screen:offset -225 found?:bool <- lesser-than click-row, next-start -226 break-if found? -227 sandbox <- copy next-sandbox -228 loop +222 ¦ next-sandbox:&:sandbox <- get *sandbox, next-sandbox:offset +223 ¦ break-unless next-sandbox +224 ¦ next-start:num <- get *next-sandbox, starting-row-on-screen:offset +225 ¦ found?:bool <- lesser-than click-row, next-start +226 ¦ break-if found? +227 ¦ sandbox <- copy next-sandbox +228 ¦ loop 229 } 230 # return sandbox if click is in its code region 231 code-ending-row:num <- get *sandbox, code-ending-row-on-screen:offset @@ -295,8 +296,8 @@ if ('onhashchange' in window) { 234 click-below-menu?:bool <- greater-than click-row, start 235 click-on-sandbox-code?:bool <- and click-above-response?, click-below-menu? 236 { -237 break-if click-on-sandbox-code? -238 return 0/no-click-in-sandbox-output +237 ¦ break-if click-on-sandbox-code? +238 ¦ return 0/no-click-in-sandbox-output 239 } 240 return sandbox 241 ] @@ -304,11 +305,11 @@ if ('onhashchange' in window) { 243 # when rendering a sandbox, dump its trace before response/warning if display-trace? property is set 244 after <render-sandbox-results> [ 245 { -246 display-trace?:bool <- get *sandbox, display-trace?:offset -247 break-unless display-trace? -248 sandbox-trace:text <- get *sandbox, trace:offset -249 break-unless sandbox-trace # nothing to print; move on -250 row, screen <- render-text screen, sandbox-trace, left, right, 245/grey, row +246 ¦ display-trace?:bool <- get *sandbox, display-trace?:offset +247 ¦ break-unless display-trace? +248 ¦ sandbox-trace:text <- get *sandbox, trace:offset +249 ¦ break-unless sandbox-trace # nothing to print; move on +250 ¦ row, screen <- render-text screen, sandbox-trace, left, right, 245/grey, row 251 } 252 <render-sandbox-trace-done> 253 ] -- cgit 1.4.1-2-gfad0