From: Chris Hanson Date: Thu, 5 Jan 2017 20:06:15 +0000 (-0800) Subject: Implement byte?. X-Git-Tag: mit-scheme-pucked-9.2.12~227^2~228 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=6842876c9946cc96f4b879e95a5555f091a92b9a;p=mit-scheme.git Implement byte?. --- diff --git a/src/runtime/bytevector.scm b/src/runtime/bytevector.scm index e39d1409f..80e104096 100644 --- a/src/runtime/bytevector.scm +++ b/src/runtime/bytevector.scm @@ -28,6 +28,12 @@ USA. (declare (usual-integrations)) +(define (byte? object) + (and (index-fixnum? object) + (fix:< object #x100))) + +(define-guarantee byte "byte") + (define-primitives (allocate-bytevector 1) (bytevector-fill! 4) diff --git a/src/runtime/runtime.pkg b/src/runtime/runtime.pkg index 987e4fcfc..50c1a900d 100644 --- a/src/runtime/runtime.pkg +++ b/src/runtime/runtime.pkg @@ -1122,6 +1122,7 @@ USA. (files "bytevector") (parent (runtime)) (export () + byte? bytevector bytevector-append bytevector-copy @@ -1130,6 +1131,7 @@ USA. bytevector-u8-ref bytevector-u8-set! bytevector? + guarantee-byte guarantee-bytevector make-bytevector string->utf8