last call check
Arthur A. Gleckler
(05 May 2020 20:57 UTC)
|
Re: last call check
Shiro Kawai
(05 May 2020 21:26 UTC)
|
port positioning [was: last call check] Per Bothner (05 May 2020 22:22 UTC)
|
Re: port positioning [was: last call check]
Shiro Kawai
(05 May 2020 23:08 UTC)
|
Re: port positioning [was: last call check]
Per Bothner
(05 May 2020 23:15 UTC)
|
Re: port positioning [was: last call check]
Shiro Kawai
(05 May 2020 23:30 UTC)
|
Re: port positioning [was: last call check]
Marc Nieper-Wißkirchen
(06 May 2020 12:07 UTC)
|
Re: port positioning [was: last call check]
shiro.kawai@xxxxxx
(06 May 2020 12:12 UTC)
|
Re: port positioning [was: last call check]
Marc Nieper-Wißkirchen
(06 May 2020 12:19 UTC)
|
Re: port positioning [was: last call check]
John Cowan
(05 May 2020 23:53 UTC)
|
I haven't closely followed the discussion, but it seems to me: The peek-u8/peek-char procedures should work if get-position/set-position! aren't provided. By the same token, peek-char followed by read-char must not call read! twice and must not call set-position! (since it may be unavailable). As noted in previous messages, it followed that an input port must have a buffer with space for at least 1 byte/chars, along with a count indicating how may bytes/characters are available. It follows, for binary input ports: For peek-u8: If the buffer is empty, call read! to get at least one byte. If not eof or error return the first byte without making other changes. For read-u8: If the buffer is empty, call read! to get at least one byte. If not eof or error, get and remove the first byte in the buffer. For port-position: Call get-position. Return the result minus the number of bytes in the buffer. For textual input ports it is more complicated because the position may be an opaque object, which means port-position can't just do subtraction. The main difference is that peek-char must first (if the buffer is empty) call get-position and stash the position before calling read!. -- --Per Bothner xxxxxx@bothner.com http://per.bothner.com/