commander-s/scheme/tty-debug.scm

25 lines
495 B
Scheme
Raw Normal View History

(define debug-mode #t)
(define *tty-port* #f)
(define (init-tty-debug-output!)
(and debug-mode
(call-with-values
open-pty
(lambda (input-port name)
(set! *tty-port* (dup->outport input-port))
(close input-port)
(set-port-buffering *tty-port* bufpol/block 8192)
name))))
(define debug-message
(lambda args
(if debug-mode
(with-current-output-port*
*tty-port*
(lambda ()
(for-each display args)
(newline)
(flush-tty/output *tty-port*))))))
2005-05-18 14:56:30 -04:00