diff --git a/src/ikarus.boot b/src/ikarus.boot index 03d54ba..0efd8b7 100644 Binary files a/src/ikarus.boot and b/src/ikarus.boot differ diff --git a/src/ikarus.fasl.ss b/src/ikarus.fasl.ss index 1a45772..2cc7867 100644 --- a/src/ikarus.fasl.ss +++ b/src/ikarus.fasl.ss @@ -28,6 +28,9 @@ ;;; "<" + 4-bytes(i) : dereference the object marked with index i ;;; "x" : denotes code ;;; "T" : Thunk; followed by code. +;;; "r" + numerator + denominator : ratnum +;;; "f" + 8-byte : IEEE flonum +;;; "b" + 4-byte(n) + n-bytes denotes a bignum (sign is sign of n). diff --git a/src/ikarus.fasl.write.ss b/src/ikarus.fasl.write.ss index 84467fe..b89c942 100644 --- a/src/ikarus.fasl.write.ss +++ b/src/ikarus.fasl.write.ss @@ -10,6 +10,8 @@ (ikarus system $fx) (ikarus system $chars) (ikarus system $strings) + (ikarus system $flonums) + (ikarus system $bignums) (ikarus code-objects) (except (ikarus) fasl-write)) @@ -166,6 +168,30 @@ (write-int n p) (write-bytevector x 0 n p)) m] + [(flonum? x) + (write-char #\f p) + (write-byte ($flonum-u8-ref x 0) p) + (write-byte ($flonum-u8-ref x 1) p) + (write-byte ($flonum-u8-ref x 2) p) + (write-byte ($flonum-u8-ref x 3) p) + (write-byte ($flonum-u8-ref x 4) p) + (write-byte ($flonum-u8-ref x 5) p) + (write-byte ($flonum-u8-ref x 6) p) + (write-byte ($flonum-u8-ref x 7) p) + m] + [(ratnum? x) + (write-char #\r p) + (fasl-write-object (numerator x) p h + (fasl-write-object (denominator x) p h m))] + [(bignum? x) + (write-char #\b p) + (let ([sz ($bignum-size x)]) + (write-int (if ($bignum-positive? x) sz (- sz)) p) + (let f ([i 0]) + (unless (fx= i sz) + (write-byte ($bignum-byte-ref x i) p) + (f (fxadd1 i))))) + m] [else (error 'fasl-write "~s is not fasl-writable" x)]))) (define (write-bytevector x i j p) (unless ($fx= i j) @@ -242,6 +268,11 @@ (code-freevars code))) (make-graph code h))] [(bytevector? x) (void)] + [(flonum? x) (void)] + [(bignum? x) (void)] + [(ratnum? x) + (make-graph (numerator x) h) + (make-graph (denominator x) h)] [else (error 'fasl-write "~s is not fasl-writable" x)])])))) (define fasl-write-to-port (lambda (x port)