Code for printing debug messages on a pty

This commit is contained in:
eknauel 2005-05-18 15:24:49 +00:00
parent 63ed7f8aa9
commit 867852bf16
2 changed files with 25 additions and 0 deletions

View File

@ -0,0 +1,8 @@
(define-interface tty-debug-interface
(export init-tty-debug-output!
debug-message))
(define-structure tty-debug tty-debug-interface
(open scheme-with-scsh)
(files tty-debug))

17
scheme/tty-debug.scm Normal file
View File

@ -0,0 +1,17 @@
(define *tty-port* #f)
(define (init-tty-debug-output!)
(call-with-values
open-pty
(lambda (input-port name)
(set! *tty-port* (dup->outport input-port))
(set-port-buffering *tty-port* bufpol/none)
name)))
(define debug-message
(lambda args
(with-current-output-port*
*tty-port*
(lambda ()
(for-each display args)
(newline)))))