From 805d58c6aeeeba3e4989c0eed6781b3861e8fae0 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Thu, 25 Jan 2018 22:39:31 -0800 Subject: 4199 --- html/edit/008-sandbox-edit.mu.html | 323 ++++++++++++++++++------------------- 1 file changed, 161 insertions(+), 162 deletions(-) (limited to 'html/edit/008-sandbox-edit.mu.html') diff --git a/html/edit/008-sandbox-edit.mu.html b/html/edit/008-sandbox-edit.mu.html index 23a66210..7c7cfa4f 100644 --- a/html/edit/008-sandbox-edit.mu.html +++ b/html/edit/008-sandbox-edit.mu.html @@ -15,17 +15,16 @@ body { font-size: 12pt; font-family: monospace; color: #aaaaaa; background-color a { color:#eeeeee; text-decoration: none; } a:hover { text-decoration: underline; } * { font-size: 12pt; font-size: 1em; } +.muControl { color: #c0a020; } +.muRecipe { color: #ff8700; } .muScenario { color: #00af00; } -.Conceal { color: #4e4e4e; } .LineNr { color: #444444; } .Delimiter { color: #800080; } .Constant { color: #00a0a0; } +.Special { color: #c00000; } .Comment { color: #9090ff; } .Comment a { color:#0000ee; text-decoration:underline; } .SalientComment { color: #00ffff; } -.Special { color: #c00000; } -.muControl { color: #c0a020; } -.muRecipe { color: #ff8700; } --> @@ -69,49 +68,49 @@ if ('onhashchange' in window) { 7 # empty recipes 8 assume-resources [ 9 ] - 10 env:&:environment <- new-programming-environment resources, screen, [add 2, 2] - 11 render-all screen, env, render + 10 env:&:environment <- new-programming-environment resources, screen, [add 2, 2] + 11 render-all screen, env, render 12 # run it 13 assume-console [ - 14 ¦ press F4 + 14 press F4 15 ] - 16 event-loop screen, console, env, resources + 16 event-loop screen, console, env, resources 17 screen-should-contain [ - 18 ¦ . run (F4) . - 19 ¦ . ╎ . - 20 ¦ .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────. - 21 ¦ . ╎0 edit copy to recipe delete . - 22 ¦ . ╎add 2, 2 . - 23 ¦ . ╎4 . - 24 ¦ . ╎─────────────────────────────────────────────────. - 25 ¦ . ╎ . + 18 . run (F4) . + 19 . ╎ . + 20 .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────. + 21 . ╎0 edit copy to recipe delete . + 22 . ╎add 2, 2 . + 23 . ╎4 . + 24 . ╎─────────────────────────────────────────────────. + 25 . ╎ . 26 ] 27 # click at left edge of 'edit' button 28 assume-console [ - 29 ¦ left-click 3, 55 + 29 left-click 3, 55 30 ] 31 run [ - 32 ¦ event-loop screen, console, env, resources + 32 event-loop screen, console, env, resources 33 ] 34 # it pops back into editor 35 screen-should-contain [ - 36 ¦ . run (F4) . - 37 ¦ . ╎add 2, 2 . - 38 ¦ .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────. - 39 ¦ . ╎ . + 36 . run (F4) . + 37 . ╎add 2, 2 . + 38 .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────. + 39 . ╎ . 40 ] 41 # cursor should be in the right place 42 assume-console [ - 43 ¦ type [0] + 43 type [0] 44 ] 45 run [ - 46 ¦ event-loop screen, console, env, resources + 46 event-loop screen, console, env, resources 47 ] 48 screen-should-contain [ - 49 ¦ . run (F4) . - 50 ¦ . ╎0add 2, 2 . - 51 ¦ .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────. - 52 ¦ . ╎ . + 49 . run (F4) . + 50 . ╎0add 2, 2 . + 51 .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────. + 52 . ╎ . 53 ] 54 ] 55 @@ -122,97 +121,97 @@ if ('onhashchange' in window) { 60 # empty recipes 61 assume-resources [ 62 ] - 63 env:&:environment <- new-programming-environment resources, screen, [add 2, 2] - 64 render-all screen, env, render + 63 env:&:environment <- new-programming-environment resources, screen, [add 2, 2] + 64 render-all screen, env, render 65 # run it 66 assume-console [ - 67 ¦ press F4 + 67 press F4 68 ] - 69 event-loop screen, console, env, resources + 69 event-loop screen, console, env, resources 70 screen-should-contain [ - 71 ¦ . run (F4) . - 72 ¦ . ╎ . - 73 ¦ .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────. - 74 ¦ . ╎0 edit copy to recipe delete . - 75 ¦ . ╎add 2, 2 . - 76 ¦ . ╎4 . - 77 ¦ . ╎─────────────────────────────────────────────────. - 78 ¦ . ╎ . + 71 . run (F4) . + 72 . ╎ . + 73 .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────. + 74 . ╎0 edit copy to recipe delete . + 75 . ╎add 2, 2 . + 76 . ╎4 . + 77 . ╎─────────────────────────────────────────────────. + 78 . ╎ . 79 ] 80 # click at right edge of 'edit' button (just before 'copy') 81 assume-console [ - 82 ¦ left-click 3, 65 + 82 left-click 3, 65 83 ] 84 run [ - 85 ¦ event-loop screen, console, env, resources + 85 event-loop screen, console, env, resources 86 ] 87 # it pops back into editor 88 screen-should-contain [ - 89 ¦ . run (F4) . - 90 ¦ . ╎add 2, 2 . - 91 ¦ .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────. - 92 ¦ . ╎ . + 89 . run (F4) . + 90 . ╎add 2, 2 . + 91 .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────. + 92 . ╎ . 93 ] 94 # cursor should be in the right place 95 assume-console [ - 96 ¦ type [0] + 96 type [0] 97 ] 98 run [ - 99 ¦ event-loop screen, console, env, resources + 99 event-loop screen, console, env, resources 100 ] 101 screen-should-contain [ -102 ¦ . run (F4) . -103 ¦ . ╎0add 2, 2 . -104 ¦ .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────. -105 ¦ . ╎ . +102 . run (F4) . +103 . ╎0add 2, 2 . +104 .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────. +105 . ╎ . 106 ] 107 ] 108 -109 after <global-touch> [ +109 after <global-touch> [ 110 # support 'edit' button 111 { -112 ¦ edit?:bool <- should-attempt-edit? click-row, click-column, env -113 ¦ break-unless edit? -114 ¦ edit?, env <- try-edit-sandbox click-row, env -115 ¦ break-unless edit? -116 ¦ screen <- render-sandbox-side screen, env, render -117 ¦ screen <- update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env -118 ¦ loop +next-event +112 edit?:bool <- should-attempt-edit? click-row, click-column, env +113 break-unless edit? +114 edit?, env <- try-edit-sandbox click-row, env +115 break-unless edit? +116 screen <- render-sandbox-side screen, env, render +117 screen <- update-cursor screen, recipes, current-sandbox, sandbox-in-focus?, env +118 loop +next-event 119 } 120 ] 121 122 # some preconditions for attempting to edit a sandbox -123 def should-attempt-edit? click-row:num, click-column:num, env:&:environment -> result:bool [ +123 def should-attempt-edit? click-row:num, click-column:num, env:&:environment -> result:bool [ 124 local-scope 125 load-inputs 126 # are we below the sandbox editor? -127 click-sandbox-area?:bool <- click-on-sandbox-area? click-row, click-column, env +127 click-sandbox-area?:bool <- click-on-sandbox-area? click-row, click-column, env 128 return-unless click-sandbox-area?, 0/false 129 # narrower, is the click in the columns spanning the 'edit' button? 130 first-sandbox:&:editor <- get *env, current-sandbox:offset 131 assert first-sandbox, [!!] 132 sandbox-left-margin:num <- get *first-sandbox, left:offset 133 sandbox-right-margin:num <- get *first-sandbox, right:offset -134 edit-button-left:num, edit-button-right:num, _ <- sandbox-menu-columns sandbox-left-margin, sandbox-right-margin -135 edit-button-vertical-area?:bool <- within-range? click-column, edit-button-left, edit-button-right +134 edit-button-left:num, edit-button-right:num, _ <- sandbox-menu-columns sandbox-left-margin, sandbox-right-margin +135 edit-button-vertical-area?:bool <- within-range? click-column, edit-button-left, edit-button-right 136 return-unless edit-button-vertical-area?, 0/false 137 # finally, is sandbox editor empty? 138 current-sandbox:&:editor <- get *env, current-sandbox:offset -139 result <- empty-editor? current-sandbox +139 result <- empty-editor? current-sandbox 140 ] 141 -142 def try-edit-sandbox click-row:num, env:&:environment -> clicked-on-edit-button?:bool, env:&:environment [ +142 def try-edit-sandbox click-row:num, env:&:environment -> clicked-on-edit-button?:bool, env:&:environment [ 143 local-scope 144 load-inputs 145 # identify the sandbox to edit, if the click was actually on the 'edit' button -146 sandbox:&:sandbox <- find-sandbox env, click-row +146 sandbox:&:sandbox <- find-sandbox env, click-row 147 return-unless sandbox, 0/false 148 clicked-on-edit-button? <- copy 1/true 149 # 'edit' button = 'copy' button + 'delete' button 150 text:text <- get *sandbox, data:offset 151 current-sandbox:&:editor <- get *env, current-sandbox:offset -152 current-sandbox <- insert-text current-sandbox, text -153 env <- delete-sandbox env, sandbox +152 current-sandbox <- insert-text current-sandbox, text +153 env <- delete-sandbox env, sandbox 154 # reset scroll 155 *env <- put *env, render-from:offset, -1 156 # position cursor in sandbox editor @@ -227,41 +226,41 @@ if ('onhashchange' in window) { 165 assume-resources [ 166 ] 167 # right editor contains a print instruction -168 env:&:environment <- new-programming-environment resources, screen, [print screen, 4] -169 render-all screen, env, render +168 env:&:environment <- new-programming-environment resources, screen, [print screen, 4] +169 render-all screen, env, render 170 # run the sandbox 171 assume-console [ -172 ¦ press F4 +172 press F4 173 ] -174 event-loop screen, console, env, resources +174 event-loop screen, console, env, resources 175 screen-should-contain [ -176 ¦ . run (F4) . -177 ¦ . ╎ . -178 ¦ .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────. -179 ¦ . ╎0 edit copy to recipe delete . -180 ¦ . ╎print screen, 4 . -181 ¦ . ╎screen: . -182 ¦ . ╎ .4 . . -183 ¦ . ╎ . . . -184 ¦ . ╎ . . . -185 ¦ . ╎ . . . -186 ¦ . ╎ . . . -187 ¦ . ╎─────────────────────────────────────────────────. -188 ¦ . ╎ . +176 . run (F4) . +177 . ╎ . +178 .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────. +179 . ╎0 edit copy to recipe delete . +180 . ╎print screen, 4 . +181 . ╎screen: . +182 . ╎ .4 . . +183 . ╎ . . . +184 . ╎ . . . +185 . ╎ . . . +186 . ╎ . . . +187 . ╎─────────────────────────────────────────────────. +188 . ╎ . 189 ] 190 # edit the sandbox 191 assume-console [ -192 ¦ left-click 3, 65 +192 left-click 3, 65 193 ] 194 run [ -195 ¦ event-loop screen, console, env, resources +195 event-loop screen, console, env, resources 196 ] 197 screen-should-contain [ -198 ¦ . run (F4) . -199 ¦ . ╎print screen, 4 . -200 ¦ .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────. -201 ¦ . ╎ . -202 ¦ . ╎ . +198 . run (F4) . +199 . ╎print screen, 4 . +200 .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────. +201 . ╎ . +202 . ╎ . 203 ] 204 ] 205 @@ -272,45 +271,45 @@ if ('onhashchange' in window) { 210 # initialize environment 211 assume-resources [ 212 ] -213 env:&:environment <- new-programming-environment resources, screen, [] -214 render-all screen, env, render +213 env:&:environment <- new-programming-environment resources, screen, [] +214 render-all screen, env, render 215 # create 2 sandboxes and scroll to second 216 assume-console [ -217 ¦ press ctrl-n -218 ¦ type [add 2, 2] -219 ¦ press F4 -220 ¦ type [add 1, 1] -221 ¦ press F4 -222 ¦ press page-down -223 ¦ press page-down +217 press ctrl-n +218 type [add 2, 2] +219 press F4 +220 type [add 1, 1] +221 press F4 +222 press page-down +223 press page-down 224 ] -225 event-loop screen, console, env, resources +225 event-loop screen, console, env, resources 226 screen-should-contain [ -227 ¦ . run (F4) . -228 ¦ . ╎─────────────────────────────────────────────────. -229 ¦ .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎1 edit copy to recipe delete . -230 ¦ . ╎add 2, 2 . -231 ¦ . ╎4 . -232 ¦ . ╎─────────────────────────────────────────────────. -233 ¦ . ╎ . +227 . run (F4) . +228 . ╎─────────────────────────────────────────────────. +229 .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎1 edit copy to recipe delete . +230 . ╎add 2, 2 . +231 . ╎4 . +232 . ╎─────────────────────────────────────────────────. +233 . ╎ . 234 ] 235 # edit the second sandbox 236 assume-console [ -237 ¦ left-click 2, 55 +237 left-click 2, 55 238 ] 239 run [ -240 ¦ event-loop screen, console, env, resources +240 event-loop screen, console, env, resources 241 ] 242 # second sandbox shows in editor; scroll resets to display first sandbox 243 screen-should-contain [ -244 ¦ . run (F4) . -245 ¦ . ╎add 2, 2 . -246 ¦ .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────. -247 ¦ . ╎0 edit copy to recipe delete . -248 ¦ . ╎add 1, 1 . -249 ¦ . ╎2 . -250 ¦ . ╎─────────────────────────────────────────────────. -251 ¦ . ╎ . +244 . run (F4) . +245 . ╎add 2, 2 . +246 .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────. +247 . ╎0 edit copy to recipe delete . +248 . ╎add 1, 1 . +249 . ╎2 . +250 . ╎─────────────────────────────────────────────────. +251 . ╎ . 252 ] 253 ] 254 @@ -321,68 +320,68 @@ if ('onhashchange' in window) { 259 # initialize environment 260 assume-resources [ 261 ] -262 env:&:environment <- new-programming-environment resources, screen, [] -263 render-all screen, env, render +262 env:&:environment <- new-programming-environment resources, screen, [] +263 render-all screen, env, render 264 # create 2 sandboxes 265 assume-console [ -266 ¦ press ctrl-n -267 ¦ type [add 2, 2] -268 ¦ press F4 -269 ¦ type [add 1, 1] -270 ¦ press F4 +266 press ctrl-n +267 type [add 2, 2] +268 press F4 +269 type [add 1, 1] +270 press F4 271 ] -272 event-loop screen, console, env, resources +272 event-loop screen, console, env, resources 273 screen-should-contain [ -274 ¦ . run (F4) . -275 ¦ . ╎ . -276 ¦ .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────. -277 ¦ . ╎0 edit copy to recipe delete . -278 ¦ . ╎add 1, 1 . -279 ¦ . ╎2 . -280 ¦ . ╎─────────────────────────────────────────────────. -281 ¦ . ╎1 edit copy to recipe delete . -282 ¦ . ╎add 2, 2 . -283 ¦ . ╎4 . +274 . run (F4) . +275 . ╎ . +276 .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────. +277 . ╎0 edit copy to recipe delete . +278 . ╎add 1, 1 . +279 . ╎2 . +280 . ╎─────────────────────────────────────────────────. +281 . ╎1 edit copy to recipe delete . +282 . ╎add 2, 2 . +283 . ╎4 . 284 ] 285 # edit the second sandbox, then resave 286 assume-console [ -287 ¦ left-click 3, 60 -288 ¦ press F4 +287 left-click 3, 60 +288 press F4 289 ] 290 run [ -291 ¦ event-loop screen, console, env, resources +291 event-loop screen, console, env, resources 292 ] 293 # no change in contents 294 screen-should-contain [ -295 ¦ . run (F4) . -296 ¦ . ╎ . -297 ¦ .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────. -298 ¦ . ╎0 edit copy to recipe delete . -299 ¦ . ╎add 1, 1 . -300 ¦ . ╎2 . -301 ¦ . ╎─────────────────────────────────────────────────. -302 ¦ . ╎1 edit copy to recipe delete . -303 ¦ . ╎add 2, 2 . -304 ¦ . ╎4 . +295 . run (F4) . +296 . ╎ . +297 .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎─────────────────────────────────────────────────. +298 . ╎0 edit copy to recipe delete . +299 . ╎add 1, 1 . +300 . ╎2 . +301 . ╎─────────────────────────────────────────────────. +302 . ╎1 edit copy to recipe delete . +303 . ╎add 2, 2 . +304 . ╎4 . 305 ] 306 # now try to scroll past end 307 assume-console [ -308 ¦ press page-down -309 ¦ press page-down -310 ¦ press page-down +308 press page-down +309 press page-down +310 press page-down 311 ] 312 run [ -313 ¦ event-loop screen, console, env, resources +313 event-loop screen, console, env, resources 314 ] 315 # screen should show just final sandbox with the right index (1) 316 screen-should-contain [ -317 ¦ . run (F4) . -318 ¦ . ╎─────────────────────────────────────────────────. -319 ¦ .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎1 edit copy to recipe delete . -320 ¦ . ╎add 2, 2 . -321 ¦ . ╎4 . -322 ¦ . ╎─────────────────────────────────────────────────. -323 ¦ . ╎ . +317 . run (F4) . +318 . ╎─────────────────────────────────────────────────. +319 .╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╎1 edit copy to recipe delete . +320 . ╎add 2, 2 . +321 . ╎4 . +322 . ╎─────────────────────────────────────────────────. +323 . ╎ . 324 ] 325 ] -- cgit 1.4.1-2-gfad0