~ chicken-core (chicken-5) 36ad662f8eb24fa9ef4686b353995ef7e2c4e1df
commit 36ad662f8eb24fa9ef4686b353995ef7e2c4e1df
Author: Evan Hanson <evhan@foldling.org>
AuthorDate: Tue Feb 16 14:35:20 2016 +1300
Commit: Evan Hanson <evhan@foldling.org>
CommitDate: Tue Feb 16 14:35:20 2016 +1300
Allow multiple debug modes to be used for `debugging`
Previously, `with-debugging-output` allowed using a list to specify
multiple debug modes, but `debugging` didn't. The scrutinizer uses
"(debugging '(o e) ...)" to print specialization info, however, meaning
that info was never printed. This change just makes both procedures
accept a list of modes.
diff --git a/support.scm b/support.scm
index f28d9949..561ffab1 100644
--- a/support.scm
+++ b/support.scm
@@ -54,6 +54,11 @@
(define +logged-debugging-modes+ '(o x S))
+(define (test-debugging-mode mode enabled)
+ (if (symbol? mode)
+ (memq mode enabled)
+ (pair? (lset-intersection eq? mode enabled))))
+
(define (debugging mode msg . args)
(define (text)
(with-output-to-string
@@ -67,15 +72,15 @@
(newline))))
(define (dump txt)
(fprintf collected-debugging-output "~a|~a" mode txt))
- (cond ((memq mode debugging-chicken)
+ (cond ((test-debugging-mode mode debugging-chicken)
(let ((txt (text)))
(display txt)
(flush-output)
- (when (memq mode +logged-debugging-modes+)
+ (when (test-debugging-mode mode +logged-debugging-modes+)
(dump txt))
#t))
(else
- (when (memq mode +logged-debugging-modes+)
+ (when (test-debugging-mode mode +logged-debugging-modes+)
(dump (text)))
#f)))
@@ -87,17 +92,13 @@
(if (pair? mode) (car mode) mode)
ln))
(string-split text "\n")))
- (define (test-mode mode set)
- (if (symbol? mode)
- (memq mode set)
- (pair? (lset-intersection eq? mode set))))
- (cond ((test-mode mode debugging-chicken)
+ (cond ((test-debugging-mode mode debugging-chicken)
(let ((txt (with-output-to-string thunk)))
(display txt)
(flush-output)
- (when (test-mode mode +logged-debugging-modes+)
+ (when (test-debugging-mode mode +logged-debugging-modes+)
(collect txt))))
- ((test-mode mode +logged-debugging-modes+)
+ ((test-debugging-mode mode +logged-debugging-modes+)
(collect (with-output-to-string thunk)))))
(define (quit msg . args)
Trap