From 413b43c421e0aabef510b6dbfd204f63a64050f1 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Tue, 8 May 2018 21:54:21 -0700 Subject: [PATCH] Provide access to the channels in a binary port. --- src/runtime/binary-port.scm | 10 ++++++++++ src/runtime/runtime.pkg | 2 ++ 2 files changed, 12 insertions(+) diff --git a/src/runtime/binary-port.scm b/src/runtime/binary-port.scm index 40113adca..0c709420b 100644 --- a/src/runtime/binary-port.scm +++ b/src/runtime/binary-port.scm @@ -59,6 +59,16 @@ USA. (and buffer (buffer-source/sink buffer)))) +(define (binary-port-input-channel port) + (let ((buffer (port-input-buffer port))) + (and buffer + (buffer-channel buffer)))) + +(define (binary-port-output-channel port) + (let ((buffer (port-output-buffer port))) + (and buffer + (buffer-channel buffer)))) + (define (binary-input-port? object) (and (binary-port? object) (port-input-buffer object) diff --git a/src/runtime/runtime.pkg b/src/runtime/runtime.pkg index 787bcdbad..b94da19af 100644 --- a/src/runtime/runtime.pkg +++ b/src/runtime/runtime.pkg @@ -2567,6 +2567,8 @@ USA. write-bytevector write-u8) (export (runtime) + binary-port-input-channel + binary-port-output-channel binary-port-sink binary-port-source input-source-channel -- 2.25.1