Implement accessors for binary-port source/sink.
authorChris Hanson <org/chris-hanson/cph>
Wed, 26 Apr 2017 05:44:46 +0000 (22:44 -0700)
committerChris Hanson <org/chris-hanson/cph>
Wed, 26 Apr 2017 05:44:46 +0000 (22:44 -0700)
src/runtime/binary-port.scm
src/runtime/runtime.pkg

index 2a7efac42ded6ddcabdd0199f7b9ae4798d98dbf..8728dd6712c657d8d9d72d9acbffa0e05f7dd7fa 100644 (file)
@@ -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)
index cf1ace9d2a7fd7a6c61c088ce237d2b82ef8dbba..8d37bbcecf6c0b38b77e134f67f4027967a25ee2 100644 (file)
@@ -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