* added flonum?, string->flonum, and flonum->string.

This commit is contained in:
Abdulaziz Ghuloum 2007-01-20 17:49:25 -05:00
parent c6bc77bc9d
commit de910a3544
6 changed files with 31 additions and 2 deletions

View File

@ -7,12 +7,12 @@ all: ikarus
ikarus: ikarus-collect.o ikarus-runtime.o ikarus-main.o ikarus-fasl.o \
ikarus-exec.o ikarus-print.o ikarus-enter.o ikarus-symbol-table.o \
ikarus-weak-pairs.o ikarus-numerics.o
ikarus-weak-pairs.o ikarus-numerics.o ikarus-flonums.o
$(CC) $(LDFLAGS) -o ikarus \
ikarus-main.o ikarus-runtime.o \
ikarus-fasl.o ikarus-exec.o ikarus-print.o ikarus-enter.o \
ikarus-symbol-table.o ikarus-collect.o ikarus-weak-pairs.o \
ikarus-numerics.o
ikarus-numerics.o ikarus-flonums.o
ikarus-main.o: ikarus-main.c ikarus.h
$(CC) $(CFLAGS) -c ikarus-main.c
@ -45,6 +45,9 @@ ikarus-symbol-table.o: ikarus-symbol-table.c ikarus.h
ikarus-numerics.o: ikarus-numerics.c ikarus.h
$(CC) $(CFLAGS) -c ikarus-numerics.c
ikarus-flonums.o: ikarus-flonums.c ikarus.h
$(CC) $(CFLAGS) -c ikarus-flonums.c
ikarus.h: ikarus-data.h
touch ikarus.h

Binary file not shown.

View File

@ -196,4 +196,9 @@
#define disp_bignum_data wordsize
#define off_bignum_data (disp_bignum_data - vector_tag)
#define flonum_tag ((ikp)0xFF)
#define flonum_size 16
#define disp_flonum_data 8
#define off_flonum_data (disp_flonum_data - vector_tag)
#endif

Binary file not shown.

View File

@ -1,4 +1,23 @@
(let ()
(define (flonum? x)
(foreign-call "ikrt_is_flonum" x))
(define (flonum->string x)
(or (foreign-call "ikrt_flonum_to_string" x)
(error 'flonum->string "~s is not a flonum" x)))
(define (string->flonum x)
(cond
[(string? x) (foreign-call "ikrt_string_to_flonum" x)]
[else
(error 'string->flonum "~s is not a string" x)]))
(primitive-set! 'flonum? flonum?)
(primitive-set! 'flonum->string flonum->string)
(primitive-set! 'string->flonum string->flonum)
)
(let ()
(define bignum?

View File

@ -92,6 +92,8 @@
char-downcase max min complex? real? rational?
exact? inexact? integer?
string->number
flonum? flonum->string string->flonum
))
(define system-primitives