Add unparser method to binary ports.
authorChris Hanson <org/chris-hanson/cph>
Wed, 11 Jan 2017 06:44:04 +0000 (22:44 -0800)
committerChris Hanson <org/chris-hanson/cph>
Wed, 11 Jan 2017 06:44:04 +0000 (22:44 -0800)
src/runtime/binary-port.scm

index d7d619ce9febb866483f38a2f87fdfae8949ef05..e7e59769eec62abf259626f77a36e7e1566bfb8b 100644 (file)
@@ -81,6 +81,15 @@ USA.
                        '<= binary-port?)
    (register-predicate! binary-i/o-port? 'binary-i/o-port
                        '<= (list binary-input-port? binary-output-port?))))
+
+(set-record-type-unparser-method! <binary-port>
+  (standard-unparser-method
+   (lambda (port)
+     (cond ((binary-i/o-port? port) 'BINARY-I/O-PORT)
+          ((binary-input-port? port) 'BINARY-INPUT-PORT)
+          ((binary-output-port? port) 'BINARY-OUTPUT-PORT)
+          (else 'BINARY-PORT)))
+   #f))
 \f
 ;;;; Bytevector input ports