Opened 7 months ago

Last modified 7 months ago

#1801 new defect

parley constructs an internally inconsistent input port

Reported by: Vasilij Schneidermann Owned by:
Priority: minor Milestone: someday
Component: extensions Version: 5.3.0
Keywords: parley port Cc: Christian Kellermann
Estimated difficulty: trivial

Description

The parley egg still hasn't been ported successfully to C5. Most of the steps are done already (egg file, imports, tests), but interactive usage fails:

#;2> (define p (let ((old (current-input-port))) (make-parley-port old)))
#;3> p
#<port "(parley)">
#;4> (input-port? (current-input-port))
#t
#;5> (input-port? p)
#t
#;6> (current-input-port p)

Error: (current-input-port) bad argument type - not a port of the correct type: #<port "(parley)">

        Call history:

        <syntax>          (current-input-port p)
        <eval>    (current-input-port p)        <--

Looking at the code performing checks, it seems that the I/O direction slot is checked whether it's an input one. Both input-port? and current-input-port seem to look at the same slot, but arrive to different conclusions. Perhaps C5 changed some port internals?

One way of side-stepping this would be to avoid low-level port construction, but this might break C4 compatibility completely.

Change History (3)

comment:1 Changed 7 months ago by Vasilij Schneidermann

<mario-goulart> wasamasa: last time I checked, http://parenteses.org/mario/misc/parley-patches/0001-CHICKEN-5-support.patch and http://parenteses.org/mario/misc/parley-patches/0002-Adapt-Kooda-s-change-on-top-of-mine.patch were enough to make parley work.

I've confirmed the above two patches do the trick on an unmodified copy of parley-0.9.4. Therefore they can be used as is by the egg author to port it to C5. Feel free to close once it's been released.

comment:2 Changed 7 months ago by Vasilij Schneidermann

Estimated difficulty: mediumtrivial

comment:3 Changed 7 months ago by evhan

Perhaps C5 changed some port internals?

It did, the direction slot changed from a boolean to a bitmask.

For code that is rummaging around inside a port's internals, if you want to know whether a port is open for input, you can check the first slot of the port for 0x1 (or 0x2 for output).

Not sure if that helps, just for the record.

Last edited 7 months ago by evhan (previous) (diff)
Note: See TracTickets for help on using tickets.