The following functions are provided by
(use-modules (ice-9 buffered-input))
A buffered input port allows a reader function to return chunks of characters which are to be handed out on reading the port. A notion of further input for an application level logical expression is maintained too, and passed through to the reader.
Create an input port which returns characters obtained from the given reader function. reader is called (reader cont), and should return a string or an EOF object.
The new port gives precisely the characters returned by reader, nothing is added, so if any newline characters or other separators are desired they must come from the reader function.
The cont parameter to reader is
#ffor initial input, or
#twhen continuing an expression. This is an application level notion, set with
set-buffered-input-continuation?!below. If the user has entered a partial expression then it allows reader for instance to give a different prompt to show more is required.
reader is called (reader cont), and should return a string or an EOF object as above. Each string is a line of input without a newline character, the port code inserts a newline after each string.
Set the input continuation flag for a given buffered input port.
An application uses this by calling with a cont flag of
#fwhen beginning to read a new logical expression. For example with the Scheme
readfunction (see Scheme Read),(define my-port (make-buffered-input-port my-reader)) (set-buffered-input-continuation?! my-port #f) (let ((obj (read my-port))) ...