From: Chris Hanson Date: Wed, 26 Apr 2017 05:44:46 +0000 (-0700) Subject: Implement accessors for binary-port source/sink. X-Git-Tag: mit-scheme-pucked-9.2.12~14^2~137 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=73d7e610bfd29e74ff1ed9b7e1d60ca999abb1e3;p=mit-scheme.git Implement accessors for binary-port source/sink. --- 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