[Larceny-users] Specification implementation bug In transcoded-port procedure?

Ray Racine ray.racine at comcast.net
Sun Jan 13 16:09:13 EST 2008


According to R6RS library spec.

(transcoded-port binary-port transcoder)    procedure 

The transcoded-port procedure returns a new textual port with the
specified transcoder. Otherwise the new textual port’s state is largely
the same as that of binary-port. If binary-port is an input port, the
new textual port will be an input port and will transcode the bytes that
have not yet been read from binary-port ...

Process scheme finished
Larceny v0.961 "Fluoridation" (Jan 13 2008 08:39:06,
precise:Linux:unified)
larceny.heap, built on Sat Dec 29 17:39:47 EST 2007
ERR5RS mode (no libraries have been imported)

> (import (rnrs))
Autoloading (rnrs)
Autoloading (rnrs enums)
Autoloading (rnrs lists)
Autoloading (rnrs syntax-case)
Autoloading (rnrs hashtables)
Autoloading (rnrs arithmetic bitwise)
Autoloading (rnrs programs)
Autoloading (rnrs files)
Autoloading (rnrs io ports)
Autoloading (larceny deprecated)
Autoloading (rnrs conditions)
Autoloading (rnrs exceptions)
Autoloading (rnrs records syntactic)
Autoloading (err5rs records procedural)
Autoloading (rnrs records procedural)
Autoloading (rnrs control)
Autoloading (rnrs sorting)
Autoloading (rnrs bytevectors)
Autoloading (rnrs unicode)

> (let ((bip (open-bytevector-input-port (string->utf8 "This is how the
world ends, not with a bang, but with a whimper."))))
  (display (get-u8 bip))
  (let ((tip (transcoded-port bip (native-transcoder))))
    (display (read-char tip))))

84

Error: assertion failure:  (fx= mainptr 0)
Entering debugger; type "?" for help.
debug> 

One should be able to switch the binary port to a textual port and read
the next char, correct???

Use Case:: Read an HTTP response from a socket.
 - open a custom binary input port on the socket
 - read the http headers from the port
 - see that "payload" is mime type text/html with some encoding
 - switch port to a textual port with the appropriate transcoder
 - read html payload





More information about the Larceny-users mailing list