The Quintus Prolog input/output system is designed to handle various file formats, device-dependent I/O, and in particular, it enables you to create customized Prolog streams in C. File-related input/output operations of a Prolog program can be coded to be portable among different operating systems and the underlying formats of files.
A Prolog stream is an object storing the information about how to complete input/output operations to a file, device or other form of I/O channel. All Prolog input/output operations are performed through Prolog streams.
The embedding ("bottom") layer of the Quintus Prolog system provides a set of default functions for handling normal Prolog streams. However, user defined streams can be defined at runtime in such a way that Prolog built-in I/O operations work on other types of Prolog stream. Examples of user-defined streams include:
There are three streams opened by the embedding layer I/O initialization functions when a Prolog process starts:
Prolog also keeps track of two current streams,
A Prolog input/output built-in predicate or function that takes no stream argument is performed on the current input or current output stream.
In this section, we outline the Quintus Prolog input/output model and describe the Prolog stream structure, defining the different formats and options that can be associated with a stream. Then we discuss the method of creating a user-defined stream.
We also list a number of functions that enable Prolog streams to be manipulated in foreign code. Finally we discuss some compatability issues with the I/O system in previous versions of Quintus Prolog.
Please note: The terms record and line have the same meaning in this section. A line terminated with <LFD> is just a type of record. However, a record (line) is not always terminated by <LFD>.