Thanks for the report , I'm forwarding this to ExtLib mailling list because
it seems interesting enough to be shared by more people.
> just a few comments about the extlib IO-module. I'm developing some
> routines (reading bitmap images) with ocaml, and would like to use extlibs
> io routines. I really like the "read_byte" -family of functions, but still
> few comments:
> - It would be beneficial to document whether the read_ui16/read_i16/etc
> functions expect the data to be in LSB or MSB (would be cool to have
> implementations for both (as both are encountered in binary formats)!)
That's true. You are welcome to contribute theses :) since the current
default is Low Endian (because x86), providing function to read/write int16
and 32 in big endian mode could be useful for further compatibility.
> - How about functions that read to an int32 and int64 -types? A little
> slower perhaps, but those who use int32 do so mainly because it's more
> convenient. (and how about write?)
the current int32 is using caml int and is checking for overflow, you can
then "safely" use them. Providing real-int32 read/write primitives is easy
and should be added.
> - Is it possible to add read_float64 and write_float64? At least in the
> ocaml library there is Int64.bits_of_float. It would be more useful (for
> to support read_float32/write_float32 as well, but that seems to be a
> more work :).
read_float and write_float should be added . Caml floats are 64 bits floats
so we will specify that it's reading 64 bits , and since there is no support
for 32-bits float in caml, you should manipulate them as int32 :)
> - Lack of seek and peek (I suppose this has been already thoroughly
> discussed with the other library authors so I don't know how much I should
> specify :)
this is difficult for generic IO (think sockets)
> - The ability to add a buffer to input/output (like val buffered_input :
> ('a,string) input -> int -> (char,string) input). Large amounts of low
> (OS-level) io calls usually slow the system down too much (in other envs
theses also are useful.
In general I agree to include all theses changes, I might add them when I
have free time. Of course, you're welcome to contribute them so it might
speed up the process :)
> Btw, in the future I expect to use the same structure to generate network
> packets for a networked game, so the lowlevel routines are very useful.
> Otherwise a nice job!