(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:terminal-address/raw) (cursor-down 2:terminal-address/raw) (3:space-address/raw <- browser-state 1:instruction-trace-address-array-address/raw 30:literal/screen-height) ; draw trace (print-tra
c{0: 0 (((1 integer)) <- ((copy)) ((1 literal))) -- nil
c{0: 1 (((2 integer)) <- ((copy)) ((3 literal))) -- nil
c{0: 2 (((3 integer)) <- ((test1)) ((1 integer)) ((2 integer))) -- nil
c{1: 0 ✓ (((1 integer)) <- ((copy)) ((1 literal)))
c{1: 1 ✓ (((2 integer)) <- ((copy)) ((3 literal)))
c{1: 2 ✓ (((3 integer)) <- ((test1)) ((1 integer)) ((2 integer)))
c{0: 0 (((4 integer)) <- ((next-input))) -- nil
c{0: 1 (((5 integer)) <- ((next-input))) -- nil
c{0: 2 (((6 integer)) <- ((add)) ((4 integer)) ((5 integer))) -- nil
c{0: 3 (((reply)) ((6 integer))) -- nil
c{0: 4 (((4 integer)) <- ((copy)) ((34 literal))) -- nil
c{1: 0 ✓ (((4 integer)) <- ((next-input)))
c{1: 1 ✓ (((5 integer)) <- ((next-input)))
c{1: 2 ✓ (((6 integer)) <- ((add)) ((4 integer)) ((5 integer)))
c{1: 3 ✓ (((reply)) ((6 integer)))
c{1: 4 ✓ (((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: (((3 integer)) <- ((test1)) ((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: convert-names in test1
cn0: (((4 integer)) <- ((next-input))) nil nil
cn0: checking oarg ((4 integer))
maybe-add: ((4 integer))
cn0: (((5 integer)) <- ((next-input))) nil nil
cn0: checking oarg ((5 integer))
maybe-add: ((5 integer))
cn0: (((6 integer)) <- ((add)) ((4 integer)) ((5 integer))) nil nil
cn0: checking arg ((4 integer))
maybe-add: ((4 integer))
cn0: checking arg ((5 integer))
maybe-add: ((5 integer))
cn0: checking oarg ((6 integer))
maybe-add: ((6 integer))
cn0: (((reply)) ((6 integer))) nil nil
cn0: checking arg ((6 integer))
maybe-add: ((6 integer))
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: (((3 integer)) <- ((test1)) ((1 integer)) ((2 integer)))
cn1: (((4 integer)) <- ((next-input)))
cn1: (((5 integer)) <- ((next-input)))
cn1: (((6 integer)) <- ((add)) ((4 integer)) ((5 integer)))
cn1: (((reply)) ((6 integer)))
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: (((3 integer)) <- ((test1)) ((1 integer)) ((2 integer)))
mem: ((1 integer)) => 1
mem: ((2 integer)) => 3
run: test1/main 0: (((4 integer)) <- ((next-input)))
arg: nil 0 (1 3)
run: test1/main 0: 1 => ((4 integer))
mem: ((4 integer)): 4 <= 1
run: test1/main 1: (((5 integer)) <- ((next-input)))
arg: nil 1 (1 3)
run: test1/main 1: 3 => ((5 integer))
mem: ((5 integer)): 5 <= 3
run: test1/main 2: (((6 integer)) <- ((add)) ((4 integer)) ((5 integer)))
mem: ((4 integer)) => 1
mem: ((5 integer)) => 3
run: test1/main 2: 4 => ((6 integer))
mem: ((6 integer)): 6 <= 4
run: test1/main 3: (((reply)) ((6 integer)))
mem: ((6 integer)) => 4
run: main 2: 4 => ((3 integer))
mem: ((3 integer)): 3 <= 4
schedule: done with routine nil