about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-03-11 21:02:33 -0700
committerKartik K. Agaram <vc@akkartik.com>2015-03-11 21:03:06 -0700
commitaf4654c82a5b4c499e8832cfc43875b5f09b88ee (patch)
tree630b2dc4f9cd5a59b5cee621d514b23758ae8f1d
parent6904136acd6cb32f26fc920399882eb615d19110 (diff)
downloadmu-af4654c82a5b4c499e8832cfc43875b5f09b88ee.tar.gz
886
Another test, but now the tests run 50% slower (8 vs 12 minutes)
-rw-r--r--mu.arc3
-rw-r--r--trace.arc.t42
-rw-r--r--trace.mu47
3 files changed, 71 insertions, 21 deletions
diff --git a/mu.arc b/mu.arc
index dc2444a2..9aa6c736 100644
--- a/mu.arc
+++ b/mu.arc
@@ -862,6 +862,9 @@
                              ;else
                                (pr x)))
                           ))
+                $write
+                  (do1 nil
+                    (write (m arg.0)))
                 $eval
                   (new-string:repr:eval:read:to-arc-string (m arg.0))
 ;?                   (let x (to-arc-string (m arg.0)) ;? 1
diff --git a/trace.arc.t b/trace.arc.t
index 3016fd7e..8ba0e9b8 100644
--- a/trace.arc.t
+++ b/trace.arc.t
@@ -1540,5 +1540,47 @@ run: main 5: l")
             "                 "))
   (prn "F - process-key expands trace index on a page that starts with a partial expanded trace - 2"))
 
+; expand scenario
+; + run: main 0: a b c
+;   mem: 0 a
+; + run: main 1: d e f
+;   mem: 1 a              <- top of page
+;   mem: 1 b
+;   mem: 1 c              <- bottom of page
+; + run: main 2: g hi
+;   mem: 2 a
+; + run: main 3: j
+; + run: main 4: k
+; + run: main 5: l
+(run-code main30
+  (default-space:space-address <- new space:literal 30:literal/capacity)
+  (0:space-address/names:browser-state <- copy 3:space-address/raw/browser-state)
+  (first-index-on-page:integer/space:1 <- copy 1:literal)
+  (first-subindex-on-page:integer/space:1 <- copy 0:literal)
+  (last-index-on-page:integer/space:1 <- copy 1:literal)
+  (last-subindex-on-page:integer/space:1 <- copy 2:literal)
+  (expanded-index:integer/space:1 <- copy 1:literal)
+  (expanded-children:integer/space:1 <- copy 3:literal)
+  (to-top 0:space-address/browser-state 2:terminal-address/raw)
+  (print-page 0:space-address/browser-state 2:terminal-address/raw)
+  (s:string-address <- new "k\n")
+  (k:keyboard-address <- init-keyboard s:string-address)
+  (process-key 3:space-address/raw/browser-state k:keyboard-address 2:terminal-address/raw)
+  (process-key 3:space-address/raw/browser-state k:keyboard-address 2:terminal-address/raw)
+;?   (replace-character 2:terminal-address/raw ((#\* literal))) ;? 1
+  )
+(each routine completed-routines*
+  (awhen rep.routine!error
+    (prn "error - " it)))
+(when (~screen-contains memory*.4 17
+;?          (+ "   mem : 1 a     "  ; after print-page
+;?             "   mem : 1 b     "
+;?             "   mem : 1 c     "
+;?             "*                "))
+         (+ "+ main/ 1 : d e f"
+            "+ main/ 2 : g hi "
+            "+ main/ 3 : j    "))
+  (prn "F - process-key expands trace index on a page with only subindex lines"))
+
 (reset2)
 ;? (print-times) ;? 3
diff --git a/trace.mu b/trace.mu
index 610d44f8..9e173739 100644
--- a/trace.mu
+++ b/trace.mu
@@ -19,7 +19,7 @@
 
 (function parse-traces [  ; stream-address -> instruction-trace-address-array-address
   (default-space:space-address <- new space:literal 30:literal)
-;?   ($print (("parse-traces\n" literal))) ;? 1
+;?   ($print (("parse-traces\n" literal))) ;? 2
   (in:stream-address <- next-input)
   (result:buffer-address <- init-buffer 30:literal)
   (curr-tail:instruction-trace-address <- copy nil:literal)
@@ -433,6 +433,7 @@
   (default-space:space-address <- new space:literal 30:literal/capacity)
   (0:space-address/names:browser-state <- next-input)
   (screen:terminal-address <- next-input)
+;?   ($print (("print traces collapsed\n" literal))) ;? 1
   (print-traces-collapsed-from 0:space-address/browser-state screen:terminal-address 0:literal/from)
   (clear-rest-of-page 0:space-address/browser-state screen:terminal-address)
 ])
@@ -848,6 +849,9 @@
     (break-if c:character)
     (reply nil:literal)
   }
+;?   ($print (("key pressed: " literal))) ;? 1
+;?   ($write c:character) ;? 1
+;?   ($print (("\n" literal))) ;? 1
   { begin
     ; user quit
     (q-pressed?:boolean <- equal c:character ((#\q literal)))
@@ -922,13 +926,13 @@
     (toggle?:boolean <- equal c:character ((#\newline literal)))
     (break-unless toggle?:boolean)
     (original-cursor-row:integer <- copy cursor-row:integer/space:1)
-;?     ($print (("cursor starts at row " literal))) ;? 4
-;?     ($print original-cursor-row:integer) ;? 5
-;?     ($print (("\n" literal))) ;? 5
+;?     ($print (("cursor starts at row " literal))) ;? 5
+;?     ($print original-cursor-row:integer) ;? 6
+;?     ($print (("\n" literal))) ;? 6
     (original-trace-index:integer <- cursor-row-to-trace-index 0:space-address/browser-state original-cursor-row:integer)
-;?     ($print (("which maps to index " literal))) ;? 5
-;?     ($print original-trace-index:integer) ;? 7
-;?     ($print (("\n" literal))) ;? 7
+;?     ($print (("which maps to index " literal))) ;? 6
+;?     ($print original-trace-index:integer) ;? 8
+;?     ($print (("\n" literal))) ;? 8
     ; is expanded-index already set?
     { begin
       (expanded?:boolean <- greater-or-equal expanded-index:integer/space:1 0:literal)
@@ -938,13 +942,14 @@
       (too-late?:boolean <- greater-than expanded-index:integer/space:1 last-index-on-page:integer/space:1)
       (break-if too-late?:boolean)
       ; expanded-index is now on this page
-;?       ($print (("expanded index on this page\n" literal))) ;? 4
+;?       ($print (("expanded index on this page\n" literal))) ;? 5
       { begin
         ; are we at the expanded row?
         (at-expanded?:boolean <- equal original-trace-index:integer expanded-index:integer/space:1)
         (break-unless at-expanded?:boolean)
-;?         ($print (("at expanded index\n" literal))) ;? 3
+;?         ($print (("at expanded index\n" literal))) ;? 4
         ; print remaining lines collapsed and return
+        (back-to-index 0:space-address/browser-state screen:terminal-address expanded-index:integer/space:1)
         (expanded-index:integer/space:1 <- copy -1:literal)
         (expanded-children:integer/space:1 <- copy -1:literal)
         (print-traces-collapsed-from 0:space-address/browser-state screen:terminal-address original-trace-index:integer)
@@ -956,33 +961,33 @@
       { begin
         (below-expanded?:boolean <- greater-than original-trace-index:integer expanded-index:integer/space:1)
         (break-unless below-expanded?:boolean)
-;?         ($print (("below expanded index\n" literal))) ;? 4
+;?         ($print (("below expanded index\n" literal))) ;? 5
         (back-to-index 0:space-address/browser-state screen:terminal-address expanded-index:integer/space:1)
-;?         ($print (("scanning up to row " literal))) ;? 1
-;?         ($print cursor-row:integer/space:1) ;? 1
-;?         ($print (("\n" literal))) ;? 1
+;?         ($print (("scanning up to row " literal))) ;? 2
+;?         ($print cursor-row:integer/space:1) ;? 2
+;?         ($print (("\n" literal))) ;? 2
         ; print traces collapsed until just before original row
         (print-traces-collapsed-from 0:space-address/browser-state screen:terminal-address expanded-index:integer/space:1 original-trace-index:integer/until)
         ; fall through
       }
     }
     ; expand original row and print traces below it
-;?     ($print (("done collapsing previously expanded index\n" literal))) ;? 4
+;?     ($print (("done collapsing previously expanded index\n" literal))) ;? 5
     (expanded-index:integer/space:1 <- copy original-trace-index:integer)
     (last-index-on-page:integer/space:1 <- copy original-trace-index:integer)
     (tr:instruction-trace-address <- index traces:instruction-trace-address-array-address/space:1/deref original-trace-index:integer)
-;?     ($print (("expanded\n" literal))) ;? 4
+;?     ($print (("expanded\n" literal))) ;? 5
     (print-instruction-trace screen:terminal-address tr:instruction-trace-address 0:space-address/browser-state)
     (next-index:integer <- add original-trace-index:integer 1:literal)
-;?     ($print (("printing collapsed lines from " literal))) ;? 5
-;?     ($print next-index:integer) ;? 6
-;?     ($print (("\n" literal))) ;? 6
+;?     ($print (("printing collapsed lines from " literal))) ;? 6
+;?     ($print next-index:integer) ;? 7
+;?     ($print (("\n" literal))) ;? 7
     (print-traces-collapsed-from 0:space-address/browser-state screen:terminal-address next-index:integer)
-;?     ($print (("clearing rest of page\n" literal))) ;? 4
+;?     ($print (("clearing rest of page\n" literal))) ;? 5
     (clear-rest-of-page 0:space-address/browser-state screen:terminal-address)
-;?     ($print (("moving cursor back up\n" literal))) ;? 4
+;?     ($print (("moving cursor back up\n" literal))) ;? 5
     (back-to-index 0:space-address/browser-state screen:terminal-address original-trace-index:integer)
-;?     ($print (("returning\n" literal))) ;? 3
+;?     ($print (("returning\n" literal))) ;? 4
     (reply nil:literal)
   }
   (reply nil:literal)