Opened 3 years ago
Last modified 3 years 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 3 years ago by
comment:2 Changed 3 years ago by
Estimated difficulty: | medium → trivial |
---|
comment:3 Changed 3 years ago by
Perhaps C5 changed some port internals?
It did, the direction slot changed from a boolean to a bitmap.
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.
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.