Textual Port Types (MIT/GNU Scheme 10.1.4)

Next: Constructors and Accessors for Textual Ports, Previous: Textual Port Primitives, Up: Textual Port Primitives [Contents][Index]

#### 14.12.1 Textual Port Types

The procedures in this section provide means for constructing port types with standard and custom operations, and accessing their operations.

procedure: make-textual-port-type operations port-type

  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 `#f` or 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, `read-char` and `peek-char`; for output ports, either `write-char` or `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.

  If `read-char` is defined in operations, then any standard input operations defined in port-type are ignored. Likewise, if `write-char` or `write-substring` is 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.

procedure: textual-port-type? object
procedure: textual-input-port-type? object
procedure: textual-output-port-type? object
procedure: textual-i/o-port-type? object

  These predicates return `#t` if object is a port type, input-port type, output-port type, or I/O-port type, respectively. Otherwise, they return `#f`.

obsolete procedure: make-port-type operations port-type
obsolete procedure: port-type? object
obsolete procedure: input-port-type? object
obsolete procedure: output-port-type? object
obsolete procedure: i/o-port-type? object

  These procedures are deprecated; use the procedures defined above.

obsolete procedure: port-type/operations port-type
obsolete procedure: port-type/operation-names port-type
obsolete procedure: port-type/operation port-type symbol

  These procedures are deprecated and will be removed in the near future. There are no replacements planned.

Next: Constructors and Accessors for Textual Ports, Previous: Textual Port Primitives, Up: Textual Port Primitives [Contents][Index]