commander-s/scheme/tty-debug.scm

25 lines
510 B
Scheme
Raw Normal View History

2006-04-18 11:01:38 -04:00
(define debug-mode #f)
(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 (and debug-mode *tty-port*)
(with-current-output-port*
*tty-port*
(lambda ()
(for-each write args)
(newline)
(flush-tty/output *tty-port*))))))
2005-05-18 14:56:30 -04:00