/usr/share/scheme48-1.9/srfi/srfi-66.scm is in scheme48 1.9-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | ; Part of Scheme 48 1.9. See file COPYING for notices and license.
; Authors: Mike Sperber, Robert Ransom
; SRFI 66: Octet vectors
(define (make-u8vector k fill)
(make-byte-vector k fill))
(define u8vector? byte-vector?)
(define (list->u8vector octets)
(let* ((size (length octets))
(v (make-byte-vector size 0)))
(do ((i 0 (+ 1 i))
(l octets (cdr l)))
((>= i size))
(byte-vector-set! v i (car l)))
v))
(define (u8vector->list octets)
(let loop ((n (byte-vector-length octets)) (r '()))
(if (zero? n)
r
(loop (- n 1) (cons (byte-vector-ref octets (- n 1)) r)))))
(define u8vector byte-vector)
(define u8vector-length byte-vector-length)
(define u8vector-ref byte-vector-ref)
(define u8vector-set! byte-vector-set!)
(define (u8vector-copy! source source-start target target-start count)
(copy-bytes! source source-start target target-start count))
(define (u8vector-copy u8vector)
(let* ((size (byte-vector-length u8vector))
(copy (make-byte-vector size 0)))
(u8vector-copy! u8vector 0 copy 0 size)
copy))
(define u8vector=? byte-vector=?)
(define (u8vector-compare u8vector-1 u8vector-2)
(let ((length-1 (u8vector-length u8vector-1))
(length-2 (u8vector-length u8vector-2)))
(cond
((< length-1 length-2) -1)
((> length-1 length-2) 1)
(else
(let loop ((i 0))
(if (= i length-1)
0
(let ((elt-1 (u8vector-ref u8vector-1 i))
(elt-2 (u8vector-ref u8vector-2 i)))
(cond ((< elt-1 elt-2) -1)
((> elt-1 elt-2) 1)
(else (loop (+ i 1)))))))))))
|