[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-users] endian-port
From: |
Shawn Rutledge |
Subject: |
[Chicken-users] endian-port |
Date: |
Mon, 22 Feb 2010 19:34:16 -0700 |
I'm having trouble reading back a float from a file that I just wrote:
(use endian-port)
(let ([outp (port->endian-port (open-output-file "eptest"))])
(endian-port-write-ieee-float32 outp 5.25)
(close-endian-port outp))
(let ([inp (port->endian-port (open-input-file "eptest"))])
(print (endian-port-read-ieee-float32 inp))
(close-endian-port inp))
it returns #f.
This was with chicken 3, but I managed to compile that egg for chicken
4 as well, and it acts the same:
/usr/bin/csc -feature compiling-extension -setup-mode -O2 -d0 -s -o
endian-port.so endian-port.scm endian_lowio_wrap.c endian_lowio_lib.c
floatformat.c endian_lowio.scm -lchicken -ldl -lm
#;1> (load "endian-port.so")
; loading endian-port.so ...
; loading /usr/lib64/chicken/4/iset.so ...
so apparently porting that egg is going to be fairly trivial. Maybe
I'll give it a shot if someone will create the directory under
release/4?
Functions like endian_lowio_read_int8 return by value, but
endian_lowio_read_ieee_float32 set a value into a passed pointer, so
wonder why that is... anyway seems to be where the problem is. Maybe
it's done that way because of NaN? But usually NaN is a valid value,
and can be tested for with isnan().
- [Chicken-users] endian-port,
Shawn Rutledge <=