The old pbm/pgm/ppm/pnm file format follows a few lines of ASCII header information at the top of a file with the bytes/octets of the image data. So you have to switch from ASCII to binary at a very particular point in the file.
In gambit you have "read", which does the usual thing, and read-u8, which appears to do a similar thing as get-u8 in (rnrs io ports (6)). So I have two questions. If you turn off buffering in gambit, you can switch between using "read" and using "read-u8" without problems. Is there any way to do that in (rnrs io ports (6))? It appears on my first reading that the answer is no. In gambit, after I stop reading the header information (which must use unbuffered reads, because I don't want any lookahead), I can change the port buffering to #t (allowing buffering again), which speeds up the reading of the rest of the file, even an octet at a time in in a loop that makes several function calls for each byte, by more than an order of magnitude. So my second question is: Is there any way to change the buffering of a port after it's been opened in (rnrs io ports (6))? And a meta-question is: Leaving aside how these things are done in Gambit, how can I achieve what I want to do (mixed ASCII and binary data, buffered reads of the binary data) in (rnrs io ports (6))? Brad _______________________________________________ r6rs-discuss mailing list [email protected] http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss
