* Added flonum fasl reader.

This commit is contained in:
Abdulaziz Ghuloum 2007-06-14 19:48:57 +03:00
parent f147e391eb
commit b6779a0f87
5 changed files with 17 additions and 10 deletions

Binary file not shown.

View File

@ -514,8 +514,15 @@ static ikp do_read(ikpcb* pcb, fasl_port* p){
ref(pt, off_cdr) = do_read(pcb, p);
return pair;
}
else if(c == 'f'){
ikp x = ik_alloc(pcb, flonum_size) + vector_tag;
ref(x, -vector_tag) = flonum_tag;
fasl_read_buf(p, x+disp_flonum_data-vector_tag, 8);
if(put_mark_index){
p->marks[put_mark_index] = x;
}
return x;
}
else {
fprintf(stderr, "invalid type '%c' (0x%02x) found in fasl file\n", c, c);
exit(-1);

Binary file not shown.

View File

@ -170,14 +170,14 @@
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)
(write-byte ($flonum-u8-ref x 6) p)
(write-byte ($flonum-u8-ref x 5) p)
(write-byte ($flonum-u8-ref x 4) p)
(write-byte ($flonum-u8-ref x 3) p)
(write-byte ($flonum-u8-ref x 2) p)
(write-byte ($flonum-u8-ref x 1) p)
(write-byte ($flonum-u8-ref x 0) p)
m]
[(ratnum? x)
(write-char #\r p)

View File

@ -880,7 +880,7 @@
(if ($bignum-positive? x) x (- x))]
[(flonum? x)
(if ($flnegative? x)
($fl* x (exact->inexact -1))
($fl* x -1.0)
x)]
[(ratnum? x)
(let ([n ($ratnum-n x)])