diff --git a/scheme/ikarus.io.ss b/scheme/ikarus.io.ss index 378a9e2..94daa57 100644 --- a/scheme/ikarus.io.ss +++ b/scheme/ikarus.io.ss @@ -140,7 +140,8 @@ fxior fxand fxsra fxsll integer->char char->integer string-ref string-set! string-length - bytevector-u8-ref bytevector-u8-set!) + bytevector-u8-ref bytevector-u8-set! + bytevector-u16-ref) (import (rename (ikarus system $strings) ($string-length string-length) @@ -163,7 +164,16 @@ ($fx> fx>) ($fx>= fx>=) ($fx<= fx<=) - ($fx= fx=)))) + ($fx= fx=))) + (define (bytevector-u16-ref x i endianness) + (case endianness + [(little) + (fxlogor (bytevector-u8-ref x i) + (fxsll (bytevector-u8-ref x (fx+ i 1)) 8))] + [else + (fxlogor (bytevector-u8-ref x (fx+ i 1)) + (fxsll (bytevector-u8-ref x i) 8))]))) + (define (port? x) (import (only (ikarus) port?)) diff --git a/scheme/ikarus.unicode-conversion.ss b/scheme/ikarus.unicode-conversion.ss index ec04674..35ca3cc 100644 --- a/scheme/ikarus.unicode-conversion.ss +++ b/scheme/ikarus.unicode-conversion.ss @@ -410,7 +410,7 @@ [(str) (unless (string? str) (die 'string->utf16 "not a string" str)) - ($string->utf16 str (native-endianness))] + ($string->utf16 str 'big)] [(str endianness) (unless (string? str) (die 'string->utf16 "not a string" str)) @@ -431,20 +431,20 @@ (cond [(or (fx< w1 #xD800) (fx> w1 #xDFFF)) (count-size bv endianness (+ i 2) len (+ n 1))] - [(not (fx<= #xD800 w1 #xDBFF)) ;;; die sequence + [(not (fx<= #xD800 w1 #xDBFF)) ;;; error sequence (count-size bv endianness (+ i 2) len (+ n 1))] [(<= (+ i 4) (bytevector-length bv)) (let ([w2 (bytevector-u16-ref bv (+ i 2) endianness)]) (cond [(not (<= #xDC00 w2 #xDFFF)) ;;; do we skip w2 also? - ;;; I won't. Just w1 is an die + ;;; I won't. Just w1 is an error (count-size bv endianness (+ i 2) len (+ n 1))] [else ;;; 4-byte sequence is ok (count-size bv endianness (+ i 4) len (+ n 1))]))] [else - ;;; die again + ;;; error again (count-size bv endianness (+ i 2) len (+ n 1))]))])) (define (fill bv endianness str i len n) (cond @@ -531,7 +531,7 @@ [(str) (unless (string? str) (die who "not a string" str)) - ($string->utf32 str (native-endianness))] + ($string->utf32 str 'big)] [(str endianness) (unless (string? str) (die who "not a string" str)) diff --git a/scheme/last-revision b/scheme/last-revision index 755d892..d65a7d9 100644 --- a/scheme/last-revision +++ b/scheme/last-revision @@ -1 +1 @@ -1637 +1638