The procedures in this section provide means for constructing port types with standard and custom operations, and accessing their operations.
Creates and returns a new port type. Operations must be a list; each element is a list of two elements, the name of the operation (a symbol) and the procedure that implements it. Port-type is either
#for a port type; if it is a port type, any operations implemented by port-type but not specified in operations will be implemented by the resulting port type.
Operations need not contain definitions for all of the standard operations; the procedure will provide defaults for any standard operations that are not defined. At a minimum, the following operations must be defined: for input ports,
peek-char; for output ports, either
write-substring. I/O ports must supply the minimum operations for both input and output.
If an operation in operations is defined to be
#f, then the corresponding operation in port-type is not inherited.
read-charis defined in operations, then any standard input operations defined in port-type are ignored. Likewise, if
write-substringis defined in operations, then any standard output operations defined in port-type are ignored. This feature allows overriding the standard operations without having to enumerate them.
These predicates return
#tif object is a port type, input-port type, output-port type, or I/O-port type, respectively. Otherwise, they return
Returns a newly allocated list containing all of the operations implemented by port-type. Each element of the list is a list of two elements — the name and its associated operation.
Returns a newly allocated list whose elements are the names of the operations implemented by port-type.