diff --git a/scheme/debug-packages.scm b/scheme/debug-packages.scm new file mode 100644 index 0000000..11e5a92 --- /dev/null +++ b/scheme/debug-packages.scm @@ -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)) + \ No newline at end of file diff --git a/scheme/tty-debug.scm b/scheme/tty-debug.scm new file mode 100644 index 0000000..fac3e2b --- /dev/null +++ b/scheme/tty-debug.scm @@ -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))))) \ No newline at end of file