manual: add documentation for new binary stream interfaces

This commit is contained in:
Daniel Kochmański 2025-07-22 17:06:46 +02:00
parent 7ee0977a50
commit 37c3955180
3 changed files with 29 additions and 1 deletions

View file

@ -113,7 +113,7 @@
;;; Extension
(defgeneric stream-peek-byte (stream)
(:documentation
"This is used to implement EXT:PEEK-BYTE; this corresponds to PEEK-TYPE of NIL.
"This is used to implement EXT:PEEK-BYTE.
It returns either a byte or :EOF. The default method calls STREAM-READ-BYTE
and STREAM-UNREAD-BYTE."))

View file

@ -59,3 +59,17 @@ modification. The default method calls @code{stream-write-char} or
@code{stream-element-type}. Element access to the sequence is done via
@code{elt}.
@end defun
@subsection Gray Stream Extensions
@defun {stream-unread-byte} stream byte
Un-do the last call to @code{stream-read-byte}, as in @code{ext:unread-byte}.
Return @code{nil}. Every subclass of @code{fundamental-binary-input-stream}
should define a method for this function. A default method signals an error.
@end defun
@defun {stream-peek-byte} stream
This is used to implement @code{ext:peek-byte}. It returns either a byte
or @code{:eof}. A default method calls @code{stream-read-byte} and
@code{stream-unread-byte}.
@end defun

View file

@ -150,6 +150,20 @@ happen.
Return the POSIX file descriptor of @var{file-stream} as an integer
@end defun
@subsubsection Binary Stream Extensions
@lspdef ext:unread-byte
@defun ext:unread-byte stream byte
Similar to @code{unread-char} but for unreading the last element to the
input binary stream. See also @code{gray:stream-unread-byte}.
@end defun
@lspdef ext:peek-byte
@defun ext:peek-byte stream eof-value
Similar to @code{peek-char} but for peeking the next element from the
output binary stream. See also @code{gray:stream-peek-byte}.
@end defun
@subsubsection External Format Extensions
@lspdef ext:*default-external-format*