* fasl writer can now write bytevectors using tag "v".
This commit is contained in:
parent
9a89717c2d
commit
5c24a02d73
BIN
src/ikarus.boot
BIN
src/ikarus.boot
Binary file not shown.
|
@ -16,8 +16,8 @@
|
|||
;;; "I" + 4-bytes : denoting a fixnum (in host byte order)
|
||||
;;; "C" + 1-byte : denoting a character
|
||||
;;; "P" + object1 + object2 : a pair
|
||||
;;; "V" + 4-bytes(n) + object ... : a vector of length n followed by n
|
||||
;;; objects
|
||||
;;; "V" + 4-bytes(n) + object ... : a vector of length n followed by n objects
|
||||
;;; "v" + 4-byte(n) + octet ... : a bytevector of length n followed by n octets
|
||||
;;; "S" + 4-bytes(n) + char ... : a string
|
||||
;;; "M" + symbol-name : a symbol
|
||||
;;; "G" + pretty-name + unique-name : a gensym
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
(import
|
||||
(ikarus system $codes)
|
||||
(ikarus system $records)
|
||||
(ikarus system $io)
|
||||
(ikarus system $bytevectors)
|
||||
(ikarus system $fx)
|
||||
(ikarus code-objects)
|
||||
(except (ikarus) fasl-write))
|
||||
|
||||
|
@ -111,7 +114,17 @@
|
|||
[(procedure? x)
|
||||
(write-char #\Q p)
|
||||
(fasl-write-object ($closure-code x) p h m)]
|
||||
[(bytevector? x)
|
||||
(write-char #\v p)
|
||||
(let ([n ($bytevector-length x)])
|
||||
(write-int n p)
|
||||
(write-bytevector x 0 n p))
|
||||
m]
|
||||
[else (error 'fasl-write "~s is not fasl-writable" x)])))
|
||||
(define (write-bytevector x i j p)
|
||||
(unless ($fx= i j)
|
||||
($write-byte ($bytevector-u8-ref x i) p)
|
||||
(write-bytevector x ($fxadd1 i) j p)))
|
||||
(define fasl-write-object
|
||||
(lambda (x p h m)
|
||||
(cond
|
||||
|
@ -182,6 +195,7 @@
|
|||
"Cannot write a non-thunk procedure; the one given has ~s free vars"
|
||||
(code-freevars code)))
|
||||
(make-graph code h))]
|
||||
[(bytevector? x) (void)]
|
||||
[else (error 'fasl-write "~s is not fasl-writable" x)])]))))
|
||||
(define fasl-write-to-port
|
||||
(lambda (x port)
|
||||
|
|
Loading…
Reference in New Issue