diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2015-02-24 00:35:56 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2015-02-24 00:35:56 -0800 |
commit | dc3803320013059ad400853e3f6a2851f7f82c04 (patch) | |
tree | de49597d5ae9375a51ea9b0e8dda4a6aea97c675 /mu.arc | |
parent | 6333b7614e6c78e2dd4e61f65e73109238ece6ac (diff) | |
download | mu-dc3803320013059ad400853e3f6a2851f7f82c04.tar.gz |
831 - wire up trace browser to interactive repl
Diffstat (limited to 'mu.arc')
-rw-r--r-- | mu.arc | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/mu.arc b/mu.arc index a50573ca..9676112a 100644 --- a/mu.arc +++ b/mu.arc @@ -867,6 +867,18 @@ ;? (prn x) ;? 1 ;? (new-string:repr:eval x)) ;? 1 + $clear-trace + (do1 nil (wipe interactive-traces*)) + $save-trace +;? (let x (string:map [string:intersperse ": " _] +;? (as cons (interactive-traces* (m arg.0)))) + (let x (string:map [string:intersperse ": " _] + (apply join + (map [as cons _] rev.interactive-traces*))) +;? (write x)(write #\newline) ;? 1 +;? (prn x) ;? 1 + (new-string x)) + ; first-class continuations current-continuation (w/uniq continuation-name @@ -3067,11 +3079,30 @@ (add-next-space-generator function*!interactive 'interactive) (= location*!interactive (assign-names-to-location function*!interactive 'interactive location*!interactive)) (replace-names-with-location function*!interactive 'interactive) + (= traces* (queue)) ; skip preprocessing (run-more 'interactive)) + (when (no cdr.argv) + (add-code:readfile "trace.mu") + (freeze function*) + (load-system-functions) + (wipe interactive-commands*) + (wipe interactive-traces*) + (= interactive-cmdidx* 0) + (= traces* (queue)) +;? (set dump-trace*) ;? 2 ; interactive mode - (whilet expr (do (pr "mu> ") (read)) - (run-interactive expr))) - + (point break + (while t + (pr interactive-cmdidx*)(pr "> ") + (let expr (read) + (unless expr (break)) + (push expr interactive-commands*) + (run-interactive expr)) + (push traces* interactive-traces*) + (++ interactive-cmdidx*) + ))) + +(if ($.current-charterm) ($.close-charterm)) (reset) ;? (print-times) |