Provide access to the channels in a binary port.
authorChris Hanson <org/chris-hanson/cph>
Wed, 9 May 2018 04:54:21 +0000 (21:54 -0700)
committerChris Hanson <org/chris-hanson/cph>
Wed, 9 May 2018 04:54:21 +0000 (21:54 -0700)
src/runtime/binary-port.scm
src/runtime/runtime.pkg

index 40113adca4d20937410526f5c76ba52070bd6193..0c709420bbcaa2e97a4db2f3067fa27754866804 100644 (file)
@@ -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)
index 787bcdbad72557babefd3fdfde5c7259379c93bf..b94da19afd43cd6551cec43aa137686bdb93a9ae 100644 (file)
@@ -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