Re: Re: [Sisc-users] (non-)Binary ports and warnings

Matthias Radestock <[email protected]> Tue, 14 Mar 2006 05:22:45 +0000
Newsgroups gmane.comp.java.sisc.devel
Message-ID <[email protected]>
"Alessandro Colomba" <[email protected]> writes:

> Here we go. This is a first pass at the signatures for a Scheme-Java
> I/O conversion library. I discuss one issue below.
>
> --8<----8<----8<----8<----8<----8<----8<----8<----8<--
> ;; *** Java Stream to non-character ports
> ;; ** INPUT
> ;; 1. InputStream -> <native-input-port>
> (define-method (->binary-input-port (<java.io.input-stream> is))
>     => <native-input-port>
>
> ;; ** OUTPUT
> ;; 2. OutputStream -> <native-output-port>
> (define-method (->binary-output-port (<java.io.output-stream> os)
>     => <native-output-port>

We probably also want methods to create serial ports (c.f. the
serial-io module) from Java streams.

> ;; *** Java Stream and Read/Writer to character ports
> ;; ** INPUT
> ;; 3. InputStream -> <native-character-input-port>
> (define-method (->character-input-port (<java.io.input-stream> is)
>                                        [(<string> encoding)]) ;; optional
>     => <native-character-input-port>

> ;; ** OUTPUT
> ;; 5. OutputStream -> <native-character-output-port>
> (define-method (->character-output-port (<java.io.output-stream> os)
>                                         [(<string> encoding)] ;; optional
>                                         (<boolean> aflush?))
>     => <native-character-output-port>

These should not take an encoding - that's what the character-set
dynamic parameter is for.

> One could opt to leave 3 and 5 out, and have users adopt the
> open-character-*-port methods from the generic-io module (since they
> "upgrade" a port to a chracter port).

I think I'd prefer that.

> I'll be glad to hear about this issue and any other I have not
> considered.

Scott's the expert on the generic I/O system. We are going to rewrite
the i/o code completely at some point, but probably not before the R6RS
folks have finalised their i/o system design.


Matthias



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642