From 73d7e610bfd29e74ff1ed9b7e1d60ca999abb1e3 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Tue, 25 Apr 2017 22:44:46 -0700 Subject: [PATCH] Implement accessors for binary-port source/sink. --- 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 2a7efac42..8728dd671 100644 --- a/src/runtime/binary-port.scm +++ b/src/runtime/binary-port.scm @@ -49,6 +49,16 @@ USA. (output-buffer port-output-buffer) (metadata binary-port-metadata)) +(define (binary-port-source port) + (let ((buffer (port-input-buffer port))) + (and buffer + (buffer-source/sink buffer)))) + +(define (binary-port-sink port) + (let ((buffer (port-output-buffer port))) + (and buffer + (buffer-source/sink 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 cf1ace9d2..8d37bbcec 100644 --- a/src/runtime/runtime.pkg +++ b/src/runtime/runtime.pkg @@ -2507,6 +2507,8 @@ USA. make-non-channel-input-source make-non-channel-output-sink) (export (runtime) + binary-port-sink + binary-port-source input-source-channel input-source-custom-length input-source-custom-ref -- 2.25.1