about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-07-29 15:11:33 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-07-29 15:11:33 -0700
commitb318b7fb127a2bdf3e394b315a45d339dc738447 (patch)
tree527cd9a5212d3b6d6c353c3ecb53708069fff327
parent502d2ea540bbb66f2bb5e649c7c7743973859092 (diff)
downloadmu-b318b7fb127a2bdf3e394b315a45d339dc738447.tar.gz
1884
-rw-r--r--chessboard.mu27
-rw-r--r--edit.mu31
2 files changed, 3 insertions, 55 deletions
diff --git a/chessboard.mu b/chessboard.mu
index d70c0544..9b65b116 100644
--- a/chessboard.mu
+++ b/chessboard.mu
@@ -35,8 +35,6 @@ scenario print-board-and-read-move [
   ]
   run [
     screen:address, console:address <- chessboard screen:address, console:address
-#?     $browse-trace #? 1
-#?     $close-trace #? 1
     # icon for the cursor
     screen <- print-character screen, 9251/␣
   ]
@@ -69,12 +67,9 @@ scenario print-board-and-read-move [
 ## Here's how 'chessboard' is implemented.
 
 recipe chessboard [
-#?   $start-tracing [schedule] #? 2
-#?   $start-tracing #? 1
   local-scope
   screen:address <- next-ingredient
   console:address <- next-ingredient
-#?   $print [screen: ], screen, [, console: ], console, 10/newline
   board:address:array:address:array:character <- initial-position
   # hook up stdin
   stdin:address:channel <- new-channel 10/capacity
@@ -265,11 +260,9 @@ recipe read-move [
   local-scope
   stdin:address:channel <- next-ingredient
   screen:address <- next-ingredient
-#?   $print screen:address #? 1
   from-file:number, quit?:boolean, error?:boolean <- read-file stdin, screen
   reply-if quit?, 0/dummy, quit?, error?
   reply-if error?, 0/dummy, quit?, error?
-#?   close-console #? 1
   # construct the move object
   result:address:move <- new move:type
   x:address:number <- get-address *result, from-file:offset
@@ -288,7 +281,6 @@ recipe read-move [
   *x, quit?, error? <- read-rank stdin, screen
   reply-if quit?, 0/dummy, quit?, error?
   reply-if error?, 0/dummy, quit?, error?
-#?   $exit #? 1
   error? <- expect-from-channel stdin, 10/newline, screen
   reply-if error?, 0/dummy, 0/quit, error?
   reply result, quit?, error?
@@ -324,7 +316,6 @@ recipe read-file [
     reply 0/dummy, 0/quit, 1/error
   }
   file:number <- subtract c, 97/a
-#?   $print file, 10/newline
   # 'a' <= file <= 'h'
   {
     above-min:boolean <- greater-or-equal file, 0
@@ -371,7 +362,6 @@ recipe read-rank [
     reply 0/dummy, 0/quit, 1/error
   }
   rank:number <- subtract c, 49/'1'
-#?   $print rank, 10/newline
   # assert'1' <= rank <= '8'
   {
     above-min:boolean <- greater-or-equal rank, 0
@@ -413,27 +403,20 @@ recipe expect-from-channel [
 scenario read-move-blocking [
   assume-screen 20/width, 2/height
   run [
-#?     $start-tracing #? 1
     1:address:channel <- new-channel 2
-#?     $print [aaa channel address: ], 1:address:channel, 10/newline
     2:number/routine <- start-running read-move:recipe, 1:address:channel, screen:address
     # 'read-move' is waiting for input
     wait-for-routine 2:number
-#?     $print [bbb channel address: ], 1:address:channel, 10/newline
     3:number <- routine-state 2:number/id
-#?     $print [I: routine ], 2:number, [ state ], 3:number 10/newline
     4:boolean/waiting? <- equal 3:number/routine-state, 2/waiting
     assert 4:boolean/waiting?, [
 F read-move-blocking: routine failed to pause after coming up (before any keys were pressed)]
     # press 'a'
-#?     $print [ccc channel address: ], 1:address:channel, 10/newline
-#?     $exit #? 1
     1:address:channel <- write 1:address:channel, 97/a
     restart 2:number/routine
     # 'read-move' still waiting for input
     wait-for-routine 2:number
     3:number <- routine-state 2:number/id
-#?     $print [II: routine ], 2:number, [ state ], 3:number 10/newline
     4:boolean/waiting? <- equal 3:number/routine-state, 2/waiting
     assert 4:boolean/waiting?, [
 F read-move-blocking: routine failed to pause after rank 'a']
@@ -443,7 +426,6 @@ F read-move-blocking: routine failed to pause after rank 'a']
     # 'read-move' still waiting for input
     wait-for-routine 2:number
     3:number <- routine-state 2:number/id
-#?     $print [III: routine ], 2:number, [ state ], 3:number 10/newline
     4:boolean/waiting? <- equal 3:number/routine-state, 2/waiting
     assert 4:boolean/waiting?, [
 F read-move-blocking: routine failed to pause after file 'a2']
@@ -453,7 +435,6 @@ F read-move-blocking: routine failed to pause after file 'a2']
     # 'read-move' still waiting for input
     wait-for-routine 2:number
     3:number <- routine-state 2:number
-#?     $print [IV: routine ], 2:number, [ state ], 3:number 10/newline
     4:boolean/waiting? <- equal 3:number/routine-state, 2/waiting
     assert 4:boolean/waiting?/routine-state, [
 F read-move-blocking: routine failed to pause after hyphen 'a2-']
@@ -463,7 +444,6 @@ F read-move-blocking: routine failed to pause after hyphen 'a2-']
     # 'read-move' still waiting for input
     wait-for-routine 2:number
     3:number <- routine-state 2:number
-#?     $print [V: routine ], 2:number, [ state ], 3:number 10/newline
     4:boolean/waiting? <- equal 3:number/routine-state, 2/waiting
     assert 4:boolean/waiting?/routine-state, [
 F read-move-blocking: routine failed to pause after rank 'a2-a']
@@ -473,7 +453,6 @@ F read-move-blocking: routine failed to pause after rank 'a2-a']
     # 'read-move' still waiting for input
     wait-for-routine 2:number
     3:number <- routine-state 2:number
-#?     $print [VI: routine ], 2:number, [ state ], 3:number 10/newline
     4:boolean/waiting? <- equal 3:number/routine-state, 2/waiting
     assert 4:boolean/waiting?, [
 F read-move-blocking: routine failed to pause after file 'a2-a4']
@@ -483,7 +462,6 @@ F read-move-blocking: routine failed to pause after file 'a2-a4']
     # 'read-move' now completes
     wait-for-routine 2:number
     3:number <- routine-state 2:number
-#?     $print [VII: routine ], 2:number, [ state ], 3:number 10/newline
     4:boolean/completed? <- equal 3:number/routine-state, 1/completed
     assert 4:boolean/completed?, [
 F read-move-blocking: routine failed to terminate on newline]
@@ -591,18 +569,13 @@ recipe make-move [
   b:address:array:address:array:character <- next-ingredient
   m:address:move <- next-ingredient
   from-file:number <- get *m, from-file:offset
-#?   $print from-file, 10/newline
   from-rank:number <- get *m, from-rank:offset
-#?   $print from-rank, 10/newline
   to-file:number <- get *m, to-file:offset
-#?   $print to-file, 10/newline
   to-rank:number <- get *m, to-rank:offset
-#?   $print to-rank, 10/newline
   f:address:array:character <- index *b, from-file
   src:address:character/square <- index-address *f, from-rank
   f <- index *b, to-file
   dest:address:character/square <- index-address *f, to-rank
-#?   $print *src, 10/newline
   *dest <- copy *src
   *src <- copy 32/space
   reply b/same-as-ingredient:0
diff --git a/edit.mu b/edit.mu
index e26872e8..b0690d83 100644
--- a/edit.mu
+++ b/edit.mu
@@ -203,7 +203,7 @@ recipe render [
       break-unless newline?
       # adjust cursor if necessary
       {
-        at-cursor-row? <- equal row, *cursor-row
+        at-cursor-row?:boolean <- equal row, *cursor-row
         break-unless at-cursor-row?
         left-of-cursor?:boolean <- lesser-than column, *cursor-column
         break-unless left-of-cursor?
@@ -241,7 +241,7 @@ recipe render [
   }
   # is cursor to the right of the last line? move to end
   {
-    at-cursor-row? <- equal row, *cursor-row
+    at-cursor-row?:boolean <- equal row, *cursor-row
     cursor-outside-line?:boolean <- lesser-or-equal column, *cursor-column
     before-cursor-on-same-line?:boolean <- and at-cursor-row?, cursor-outside-line?
     above-cursor-row?:boolean <- lesser-than row, *cursor-row
@@ -309,7 +309,7 @@ recipe render-string [
       break-unless newline?
       # clear rest of line in this window
       {
-        done? <- greater-than column, right
+        done?:boolean <- greater-than column, right
         break-if done?
         print-character screen, 32/space
         column <- add column, 1
@@ -1080,21 +1080,16 @@ recipe line-indent [
   start:address:duplex-list <- next-ingredient
   result:number <- copy 0
   reply-unless curr, result
-#?   $print [a0], 10/newline #? 1
   at-start?:boolean <- equal curr, start
   reply-if at-start?, result
-#?   $print [a1], 10/newline #? 1
   {
     curr <- prev-duplex curr
     break-unless curr
-#?   $print [a2], 10/newline #? 1
     at-start?:boolean <- equal curr, start
     break-if at-start?
-#?   $print [a3], 10/newline #? 1
     c:character <- get *curr, value:offset
     at-newline?:boolean <- equal c, 10/newline
     break-if at-newline?
-#?   $print [a4], 10/newline #? 1
     # if c is a space, increment result
     is-space?:boolean <- equal c, 32/space
     {
@@ -2926,7 +2921,6 @@ recipe render-sandboxes [
   screen-height:number <- screen-height screen
   at-bottom?:boolean <- greater-or-equal row, screen-height
   reply-if at-bottom?:boolean, row/same-as-ingredient:4, screen/same-as-ingredient:0
-#?   $print [rendering sandbox ], sandbox, 10/newline
   # render sandbox menu
   row <- add row, 1
   move-cursor screen, row, left
@@ -2977,7 +2971,6 @@ recipe restore-sandboxes [
   {
     contents:address:array:character <- restore filename
     break-unless contents  # stop at first error; assuming file didn't exist
-#?     $print contents, 10/newline
     # create new sandbox for file
     *curr <- new sandbox-data:type
     data:address:address:array:character <- get-address **curr, data:offset
@@ -2998,36 +2991,23 @@ recipe delete-sandbox [
   click-column:number <- get t, column:offset
   current-sandbox:address:editor-data <- get *env, current-sandbox:offset
   right:number <- get *current-sandbox, right:offset
-#?   $print [comparing column ], click-column, [ vs ], right, 10/newline
   at-right?:boolean <- equal click-column, right
   reply-unless at-right?, 0/false
-#?   $print [trying to delete
-#? ] #? 1
   click-row:number <- get t, row:offset
   prev:address:address:sandbox-data <- get-address *env, sandbox:offset
-#?   $print [prev: ], prev, [ -> ], *prev, 10/newline
   curr:address:sandbox-data <- get *env, sandbox:offset
   {
-#?     $print [next sandbox
-#? ] #? 1
     break-unless curr
     # more sandboxes to check
     {
-#?       $print [checking
-#? ] #? 1
       target-row:number <- get *curr, starting-row-on-screen:offset
-#?       $print [comparing row ], target-row, [ vs ], click-row, 10/newline
       delete-curr?:boolean <- equal target-row, click-row
       break-unless delete-curr?
-#?       $print [found!
-#? ] #? 1
       # delete this sandbox, rerender and stop
       *prev <- get *curr, next-sandbox:offset
-#?       $print [setting prev: ], prev, [ -> ], *prev, 10/newline
       reply 1/true
     }
     prev <- get-address *curr, next-sandbox:offset
-#?     $print [prev: ], prev, [ -> ], *prev, 10/newline
     curr <- get *curr, next-sandbox:offset
     loop
   }
@@ -3596,9 +3576,6 @@ recipe print-string-with-gradient-background [
   len:number <- length *s
   color-range:number <- subtract bg-color2, bg-color1
   color-quantum:number <- divide color-range, len
-#?   close-console #? 2
-#?   $print len, [, ], color-range, [, ], color-quantum, 10/newline
-#? #?   $exit #? 3
   bg-color:number <- copy bg-color1
   i:number <- copy 0
   {
@@ -3608,9 +3585,7 @@ recipe print-string-with-gradient-background [
     print-character screen, c, color, bg-color
     i <- add i, 1
     bg-color <- add bg-color, color-quantum
-#?     $print [=> ], bg-color, 10/newline
     loop
   }
-#?   $exit #? 1
   reply screen/same-as-ingredient:0
 ]