Next: , Previous: Read macros, Up: Input and output


3.2 Input and Output Functions

The input and output functions of ECL almost follow the definitions in Chapter 22 of [see Steele:84]. Most of the differences come from the fact that, in ECL, input from the terminal is always in line mode and binary I/O is not supported.

In ECL, *terminal-io* is a two-way stream from the standard input and to the standard output. The echoing to the terminal is performed by the underlying operating system. In particular, when a disk file is assigned to the standard output, nothing will be echoed at the terminal.

Those functions that deviate from the definitions in [see Steele:84] are listed below.

— Function: load pathname &key :print :verbose :if-does-not-exist

If pathname does not specify the filetype of the input file, then load uses the association list si::*load-search-list* to find out a suitable filetype and the function to load it. Typically, this search list is made of the elements .fas, .lsp and .lisp, in this order. If everything fails, a file without filetype will be loaded.

— Function: open

Streams can only have element type base-char, (signed-byte 8) and (unsigned-byte 8). The :external-format is always :default.

— Function: close

The keyword variable :abort is always ignored.

— Function: listen

This routine requires some low level functions which are not available on all platforms (For instance on Windows). When ECL is not able to determine whether a stream is interactive, listen returns true unless an end of file has been previously detected.

— Function: clear-input

The functions clear-input and clear-output do nothing.

— Function: read-char-no-hang

read-char-no-hang is equivalent to read-char.

The functions princ, write-char and write-byte do not always flush the stream. The stream is flushed when

  1. a newline character is written, or
  2. the input from the terminal is requested in the case that these functions operate on *terminal-io*