From 378ffc9f2f5e4ecd585d16c085ced5ea307f224a Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Tue, 10 Feb 2015 21:44:06 -0800 Subject: 738 --- trace.mu | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/trace.mu b/trace.mu index ca827564..51cf58ad 100644 --- a/trace.mu +++ b/trace.mu @@ -266,6 +266,24 @@ (cursor-to-next-line screen:terminal-address) ]) +;; initial screen state +(function print-traces-collapsed [ + (default-space:space-address <- new space:literal 30:literal/capacity) + (0:space-address/names:screen-state <- 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) + { begin + (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) + (i:integer <- add i:integer 1:literal) + (loop) + } +]) + +;; modify screen state in response to a single key (function process-key [ (default-space:space-address <- new space:literal 30:literal/capacity) (0:space-address/names:screen-state <- next-input) @@ -333,22 +351,11 @@ mem: ((3 integer)): 3 <= 4 schedule: done with routine") (s:stream-address <- init-stream x:string-address) (traces:instruction-trace-address-array-address <- parse-traces s:stream-address) - (len:integer <- length traces:instruction-trace-address-array-address/deref) ;? ($print (("#traces: " literal))) ;? 1 ;? ($print len:integer) ;? 1 ;? ($print (("\n" literal))) ;? 1 (cursor-mode) - ; 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 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) - (i:integer <- add i:integer 1:literal) - (loop) - } - ; handle key presses + (print-traces-collapsed 0:space-address/screen-state 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) -- cgit 1.4.1-2-gfad0