added current-trace-results
This commit is contained in:
parent
96018f258c
commit
a63bbf82ab
|
@ -4,7 +4,9 @@
|
||||||
(for-syntax scheme/base))
|
(for-syntax scheme/base))
|
||||||
|
|
||||||
(provide trace untrace
|
(provide trace untrace
|
||||||
current-trace-print-args trace-call
|
current-trace-print-results
|
||||||
|
current-trace-print-args
|
||||||
|
trace-call
|
||||||
current-trace-notify
|
current-trace-notify
|
||||||
current-prefix-out current-prefix-in)
|
current-prefix-out current-prefix-in)
|
||||||
|
|
||||||
|
@ -108,9 +110,10 @@
|
||||||
(lambda (name results level)
|
(lambda (name results level)
|
||||||
(as-trace-notify
|
(as-trace-notify
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(trace-print-results name results level)))))
|
((current-trace-print-results) name results level)))))
|
||||||
|
|
||||||
(define trace-print-results
|
(define current-trace-print-results
|
||||||
|
(make-parameter
|
||||||
(lambda (name results level)
|
(lambda (name results level)
|
||||||
(let-values (((first rest)
|
(let-values (((first rest)
|
||||||
(build-prefixes level (current-prefix-out))))
|
(build-prefixes level (current-prefix-out))))
|
||||||
|
@ -143,7 +146,7 @@
|
||||||
(if n
|
(if n
|
||||||
(string-length rest)
|
(string-length rest)
|
||||||
0))))
|
0))))
|
||||||
(for-each pretty-print (cdr results)))))))))
|
(for-each pretty-print (cdr results))))))))))
|
||||||
|
|
||||||
|
|
||||||
;; A traced-proc struct instance acts like a procedure,
|
;; A traced-proc struct instance acts like a procedure,
|
||||||
|
|
|
@ -92,3 +92,15 @@ ordinary arguments, its keywords, the values of the keywords, and a
|
||||||
number indicating the depth of the call.
|
number indicating the depth of the call.
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@defparam[current-trace-results trace-print-results
|
||||||
|
(-> symbol?
|
||||||
|
list?
|
||||||
|
number?
|
||||||
|
any)]{
|
||||||
|
|
||||||
|
The value of this parameter is invoked to print out the results of a
|
||||||
|
traced call. It receives the name of the function, the function's
|
||||||
|
results, and a number indicating the depth of the call.
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user