about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2015-02-10 21:52:28 -0800
committerKartik K. Agaram <vc@akkartik.com>2015-02-10 21:52:28 -0800
commit285e0963a711da019f0ea27c234b19d3c76b5ee5 (patch)
tree2f8fbf55f8fdc9094f5e96b50698f602fa6d9c5b
parent378ffc9f2f5e4ecd585d16c085ced5ea307f224a (diff)
downloadmu-285e0963a711da019f0ea27c234b19d3c76b5ee5.tar.gz
739
-rw-r--r--trace.arc.t17
-rw-r--r--trace.mu5
2 files changed, 7 insertions, 15 deletions
diff --git a/trace.arc.t b/trace.arc.t
index a2971b31..2e7faa93 100644
--- a/trace.arc.t
+++ b/trace.arc.t
@@ -22,21 +22,12 @@ run: main 2: 4 => ((3 integer))
 mem: ((3 integer)): 3 <= 4
 schedule:  done with routine")
       (s:stream-address <- init-stream x:string-address)
-      (arr:instruction-trace-address-array-address <- parse-traces s:stream-address)
-      (len:integer <- length arr:instruction-trace-address-array-address/deref)
+      (traces:instruction-trace-address-array-address <- parse-traces s:stream-address)
+      (len:integer <- length traces:instruction-trace-address-array-address/deref)
       ; fake screen
       (screen:terminal-address <- init-fake-terminal 70:literal 15:literal)
       (screen-state:space-address <- screen-state)
-      ; print trace collapsed
-      (i:integer <- copy 0:literal)
-      { begin
-        (done?:boolean <- greater-or-equal i:integer len:integer)
-        (break-if done?:boolean)
-        (tr:instruction-trace-address <- index arr:instruction-trace-address-array-address/deref i:integer)
-        (print-instruction-trace-collapsed screen:terminal-address tr:instruction-trace-address screen-state:space-address)
-        (i:integer <- add i:integer 1:literal)
-        (loop)
-      }
+      (print-traces-collapsed screen-state:space-address screen:terminal-address traces:instruction-trace-address-array-address)
       (1:string-address/raw <- get screen:terminal-address/deref data:offset)
     ])))
 ;? (set dump-trace*)
@@ -53,6 +44,6 @@ schedule:  done with routine")
             "+ main/ 1 : 3 => ((2 integer))                                        "
             "+ main/ 2 : (((3 integer)) <- ((add)) ((1 integer)) ((2 integer)))    "
             "+ main/ 2 : 4 => ((3 integer))                                        "))
-  (prn "F - print-instruction-trace-collapsed works"))
+  (prn "F - print-traces-collapsed works"))
 
 (reset)
diff --git a/trace.mu b/trace.mu
index 51cf58ad..7bce1e8d 100644
--- a/trace.mu
+++ b/trace.mu
@@ -270,6 +270,7 @@
 (function print-traces-collapsed [
   (default-space:space-address <- new space:literal 30:literal/capacity)
   (0:space-address/names:screen-state <- next-input)
+  (screen:terminal-address <- next-input)
   (traces:instruction-trace-address-array-address <- next-input)
   (len:integer <- length traces:instruction-trace-address-array-address/deref)
   (i:integer <- copy 0:literal)
@@ -277,7 +278,7 @@
     (done?:boolean <- greater-or-equal i:integer len:integer)
     (break-if done?:boolean)
     (tr:instruction-trace-address <- index traces:instruction-trace-address-array-address/deref i:integer)
-    (print-instruction-trace-collapsed nil:literal/terminal tr:instruction-trace-address 0:space-address/screen-state)
+    (print-instruction-trace-collapsed screen:terminal-address tr:instruction-trace-address 0:space-address/screen-state)
     (i:integer <- add i:integer 1:literal)
     (loop)
   }
@@ -355,7 +356,7 @@ schedule:  done with routine")
 ;?   ($print len:integer) ;? 1
 ;?   ($print (("\n" literal))) ;? 1
   (cursor-mode)
-  (print-traces-collapsed 0:space-address/screen-state traces:instruction-trace-address-array-address)
+  (print-traces-collapsed 0:space-address/screen-state nil:literal/terminal traces:instruction-trace-address-array-address)
   { begin
     (quit?:boolean <- process-key 0:space-address/screen-state nil:literal/keyboard nil:literal/terminal traces:instruction-trace-address-array-address)
     (break-if quit?:boolean)