mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-19 05:39:18 +02:00
Adding bytevector support to srfi-38.
This commit is contained in:
parent
83a2de519c
commit
90856b8de2
1 changed files with 15 additions and 0 deletions
|
@ -288,6 +288,21 @@
|
|||
((#\b) (read-char in) (read-number 2))
|
||||
((#\i) (read-char in) (exact->inexact (read-one)))
|
||||
((#\e) (read-char in) (inexact->exact (read-one)))
|
||||
((#\u #\v)
|
||||
(if (eqv? #\v (peek-char in))
|
||||
(read-char in))
|
||||
(read-char in)
|
||||
(if (not (eqv? #\8 (peek-char in)))
|
||||
(error "invalid syntax #u" (peek-char in)))
|
||||
(read-char in)
|
||||
(let ((ls (read-one)))
|
||||
(if (not (list? ls))
|
||||
(error "invalid bytevector syntax" ls))
|
||||
(let* ((len (length ls))
|
||||
(bv (make-bytevector len)))
|
||||
(do ((i 0 (+ i 1)) (ls ls (cdr ls)))
|
||||
((null? ls) bv)
|
||||
(bytevector-u8-set! bv i (car ls))))))
|
||||
((#\\)
|
||||
(read-char in)
|
||||
(let* ((c1 (read-char in))
|
||||
|
|
Loading…
Add table
Reference in a new issue