(selective-load "mu.arc" section-level) (test-only-settings) (add-code:readfile "trace.mu") (ero "running tests in trace.arc.t (takes ~10 mins)") (freeze function*) (load-system-functions) (reset2) (new-trace "print-trace") (run-code main (default-space:space-address <- new space:literal 30:literal/capacity) (x:string-address <- new "schedule: main run: main 0: (((1 integer)) <- ((copy)) ((1 literal))) run: main 0: 1 => ((1 integer)) mem: ((1 integer)): 1 <= 1 run: main 1: (((2 integer)) <- ((copy)) ((3 literal))) run: main 1: 3 => ((2 integer)) mem: ((2 integer)): 2 <= 3 run: main 2: (((3 integer)) <- ((add)) ((1 integer)) ((2 integer))) mem: ((1 integer)) => 1 mem: ((2 integer)) => 3 run: main 2: 4 => ((3 integer)) 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) (screen:terminal-address <- init-fake-terminal 70:literal 15:literal) (browser-state:space-address <- browser-state traces:instruction-trace-address-array-address 30:literal/screen-height) (print-traces-collapsed browser-state:space-address screen:terminal-address) (1:string-address/raw <- get screen:terminal-address/deref data:offset) ) (each routine completed-routines* (awhen rep.routine!error (prn "error - " it))) ;? (prn memory*.1) (when (~screen-contains memory*.1 70 (+ "+ main/ 0 : (((1 integer)) <- ((copy)) ((1 literal))) " "+ main/ 0 : 1 => ((1 integer)) " "+ main/ 1 : (((2 integer)) <- ((copy)) ((3 literal))) " "+ main/ 1 : 3 => ((2 integer)) " "+ main/ 2 : (((3 integer)) <- ((add)) ((1 integer)) ((2 integer))) " "+ main/ 2 : 4 => ((3 integer)) ")) (prn "F - print-traces-collapsed works")) ;? (quit) ;? 1 (reset2) (new-trace "print-trace-from-middle-of-screen") (run-code main (default-space:space-address <- new space:literal 30:literal/capacity) (x:string-address <- new "schedule: main run: main 0: (((1 integer)) <- ((copy)) ((1 literal))) run: main 0: 1 => ((1 integer)) mem: ((1 integer)): 1 <= 1 run: main 1: (((2 integer)) <- ((copy)) ((3 literal))) run: main 1: 3 => ((2 integer)) mem: ((2 integer)): 2 <= 3 run: main 2: (((3 integer)) <- ((add)) ((1 integer)) ((2 integer))) mem: ((1 integer)) => 1 mem: ((2 integer)) => 3 run: main 2: 4 => ((3 integer)) 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) (1:terminal-address/raw <- init-fake-terminal 70:literal 15:literal) ; position the cursor away from top of screen (cursor-down 1:terminal-address/raw) (cursor-down 1:terminal-address/raw) (browser-state:space-address <- browser-state traces:instruction-trace-address-array-address 30:literal/screen-height) (print-traces-collapsed browser-state:space-address 1:terminal-address/raw traces:instruction-trace-address-array-address) (2:string-address/raw <- get 1:terminal-address/raw/deref data:offset) ) (each routine completed-routines* (awhen rep.routine!error (prn "error - " it))) (when (~screen-contains memory*.2 70 (+ " " " " "+ main/ 0 : (((1 integer)) <- ((copy)) ((1 literal))) " "+ main/ 0 : 1 => ((1 integer)) " "+ main/ 1 : (((2 integer)) <- ((copy)) ((3 literal))) " "+ main/ 1 : 3 => ((2 integer)) " "+ main/ 2 : (((3 integer)) <- ((add)) ((1 integer)) ((2 integer))) " "+ main/ 2 : 4 => ((3 integer)) ")) (prn "F - print-traces-collapsed works anywhere on the screen")) (run-code main2 (print-character 1:terminal-address/raw ((#\* literal)))) (when (~screen-contains memory*.2 70 (+ " " " " "+ main/ 0 : (((1 integer)) <- ((copy)) ((1 literal))) " "+ main/ 0 : 1 => ((1 integer)) " "+ main/ 1 : (((2 integer)) <- ((copy)) ((3 literal))) " "+ main/ 1 : 3 => ((2 integer)) " "+ main/ 2 : (((3 integer)) <- ((add)) ((1 integer)) ((2 integer))) " "+ main/ 2 : 4 => ((3 integer)) " "* ")) (prn "F - print-traces-collapsed leaves cursor at next line")) (reset2) (new-trace "process-key-move-up-down") (run-code main (default-space:space-address <- new space:literal 30:literal/capacity) (x:string-address <- new "schedule: main run: main 0: (((1 integer)) <- ((copy)) ((1 literal))) run: main 0: 1 => ((1 integer)) mem: ((1 integer)): 1 <= 1 run: main 1: (((2 integer)) <- ((copy)) ((3 literal))) run: main 1: 3 => ((2 integer)) mem: ((2 integer)): 2 <= 3 run: main 2: (((3 integer)) <- ((add)) ((1 integer)) ((2 integer))) mem: ((1 integer)) => 1 mem: ((2 integer)) => 3 run: main 2: 4 => ((3 integer)) mem: ((3 integer)): 3 <= 4 schedule: done with routine") (s:stream-address <- init-stream x:string-address) (1:instruction-trace-address-array-address/raw <- parse-traces s:stream-address) (2:terminal-address/raw <- init-fake-terminal 70:literal 15:literal) ; position the cursor away from top of screen (cursor-down 2:term
c{0: 0 (((1 integer)) <- ((copy)) ((1 literal))) -- nil
c{0: 1 (((2 integer)) <- ((copy)) ((3 literal))) -- nil
c{0: 2 (((test1))) -- nil
c{1: 0 ✓ (((1 integer)) <- ((copy)) ((1 literal)))
c{1: 1 ✓ (((2 integer)) <- ((copy)) ((3 literal)))
c{1: 2 ✓ (((test1)))
c{0: 0 (((3 integer)) <- ((add)) ((1 integer)) ((2 integer))) -- nil
c{0: 1 (((reply))) -- nil
c{0: 2 (((4 integer)) <- ((copy)) ((34 literal))) -- nil
c{1: 0 ✓ (((3 integer)) <- ((add)) ((1 integer)) ((2 integer)))
c{1: 1 ✓ (((reply)))
c{1: 2 ✓ (((4 integer)) <- ((copy)) ((34 literal)))
cn0: convert-names in main
cn0: (((1 integer)) <- ((copy)) ((1 literal))) nil nil
cn0: checking arg ((1 literal))
cn0: checking oarg ((1 integer))
maybe-add: ((1 integer))
cn0: (((2 integer)) <- ((copy)) ((3 literal))) nil nil
cn0: checking arg ((3 literal))
cn0: checking oarg ((2 integer))
maybe-add: ((2 integer))
cn0: (((test1))) nil nil
cn0: convert-names in test1
cn0: (((3 integer)) <- ((add)) ((1 integer)) ((2 integer))) nil nil
cn0: checking arg ((1 integer))
maybe-add: ((1 integer))
cn0: checking arg ((2 integer))
maybe-add: ((2 integer))
cn0: checking oarg ((3 integer))
maybe-add: ((3 integer))
cn0: (((reply))) nil nil
cn0: (((4 integer)) <- ((copy)) ((34 literal))) nil nil
cn0: checking arg ((34 literal))
cn0: checking oarg ((4 integer))
maybe-add: ((4 integer))
cn1: (((1 integer)) <- ((copy)) ((1 literal)))
cn1: (((2 integer)) <- ((copy)) ((3 literal)))
cn1: (((test1)))
cn1: (((3 integer)) <- ((add)) ((1 integer)) ((2 integer)))
cn1: (((reply)))
cn1: (((4 integer)) <- ((copy)) ((34 literal)))
schedule: main
run: main 0: (((1 integer)) <- ((copy)) ((1 literal)))
run: main 0: 1 => ((1 integer))
mem: ((1 integer)): 1 <= 1
run: main 1: (((2 integer)) <- ((copy)) ((3 literal)))
run: main 1: 3 => ((2 integer))
mem: ((2 integer)): 2 <= 3
run: main 2: (((test1)))
run: test1/main 0: (((3 integer)) <- ((add)) ((1 integer)) ((2 integer)))
mem: ((1 integer)) => 1
mem: ((2 integer)) => 3
run: test1/main 0: 4 => ((3 integer))
mem: ((3 integer)): 3 <= 4
run: test1/main 1: (((reply)))
schedule: done with routine nil