Ensure and document that SEEK works on unbuffered ports only.
This commit is contained in:
parent
903fdad089
commit
9b29fff8e1
2
RELEASE
2
RELEASE
|
@ -191,6 +191,8 @@ We manage the project using SourceForge:
|
||||||
This release adds support for SRFI 42.
|
This release adds support for SRFI 42.
|
||||||
|
|
||||||
** Bug fixes
|
** Bug fixes
|
||||||
|
- SEEK currently works on unbuffered ports only. Check this in the
|
||||||
|
implementation and oopsify it in the manual.
|
||||||
- Adjust documentation of some low-level regexp procedures
|
- Adjust documentation of some low-level regexp procedures
|
||||||
- Removed message argument form errno-error
|
- Removed message argument form errno-error
|
||||||
- After fork/pipe, make the ports returned by the pipe the
|
- After fork/pipe, make the ports returned by the pipe the
|
||||||
|
|
|
@ -572,6 +572,7 @@ this is dependent on the OS implementation.
|
||||||
The return value is the resulting position of the I/O cursor in the I/O stream.
|
The return value is the resulting position of the I/O cursor in the I/O stream.
|
||||||
\oops{The current implementation doesn't handle \var{offset} arguments
|
\oops{The current implementation doesn't handle \var{offset} arguments
|
||||||
that are not immediate integers (\ie, representable in 30 bits).}
|
that are not immediate integers (\ie, representable in 30 bits).}
|
||||||
|
\oops{The current implementation doesn't handle buffered ports.}
|
||||||
\end{desc}
|
\end{desc}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -375,6 +375,12 @@
|
||||||
(define seek/end 2)
|
(define seek/end 2)
|
||||||
|
|
||||||
(define (seek fd/port offset . maybe-whence)
|
(define (seek fd/port offset . maybe-whence)
|
||||||
|
(if (and (open-input-port? fd/port)
|
||||||
|
(> (byte-vector-length (port-buffer fd/port)) 1))
|
||||||
|
(error "Seek does currently not work on buffered ports" fd/port))
|
||||||
|
(if (and (open-output-port? fd/port)
|
||||||
|
(> (byte-vector-length (port-buffer fd/port)) 0))
|
||||||
|
(error "Seek does currently not work on buffered ports" fd/port))
|
||||||
(let ((whence (:optional maybe-whence seek/set))
|
(let ((whence (:optional maybe-whence seek/set))
|
||||||
(fd (if (integer? fd/port) fd/port (port->fdes fd/port))))
|
(fd (if (integer? fd/port) fd/port (port->fdes fd/port))))
|
||||||
(%fd-seek fd offset whence)))
|
(%fd-seek fd offset whence)))
|
||||||
|
|
Loading…
Reference in New Issue