MTS 8: LISP and SLIP in MTS
June 1976
Specifically, an IOARG (the VALUE of an I/O destination atom) is a
dotted pair (BUFFER . FILE), which may be used to direct input/
output operations, and may also be used as a buffer pointer for
performing operations on buffers, e.g., EXPLODE, etc. If either
component of an IOARG is NIL, then the appropriate system buffer or
file is used. The VALUE of the I/O destination atom LISPIN is the
dotted pair of the default system input buffer and system input
file. The VALUE of the I/O destination atom LISPOUT is the dotted
pair of the default system output buffer and system output file.
If the user changes the system default buffers or files using the
STATUS function (the equivalent of a read- or write-select opera-
tion), he may still have access to the original system IOARGs
through LISPIN and LISPOUT.
Buffers
A buffer is an atomic structure with a variable PNAME, which is
accessed through one or more IOARGs. New buffers may be created
and linked to I/O destination atoms by calling the OPEN routine.
Buffers are used for input/output, and may also be viewed as
character strings.
The maximum size of a buffer is 255 characters.
Any PRINT operation into a buffer will cause a representation of
the argument to be placed in the buffer. Any READ operation from a
buffer will create and return the LISP structure represented by the
next S-expression in the buffer.
Instead of the buffer itself, the IOARG whose CAR is the buffer is
always passed as an argument to a function. For example, functions
such as EXPLODE, which forms a list of one-character atoms from the
characters in a buffer, or GENSYM, which creates an atom whose
PNAME begins with the current contents of the buffer, expect an
IOARG to be passed rather than the buffer itself. The FILE portion
of the IOARG is ignored. Thus, the IOARG also serves as a buffer
pointer throughout the system. However, when functions such as
READLINE, TAB, and SKIP return buffer pointers, it is the actual
buffer structure and not the IOARG which is returned.
The atomic structure of a buffer extends only to its PNAME.
Buffers may not be given VALUEs and PLISTs by the user. However, a
buffer may be part (or all) of the list-structure argument to a
PRINT or PRIN1. For printing purposes, a buffer is treated like
any other literal atom, and its PNAME is inserted into the output
buffer.
For example, if (PRIN1 (CAR LISPIN) BUF1) appears as an input line
under normal conditions of operation, the character string " (PRIN1
(CAR LISPIN) BUF1)" is placed in the buffer associated with I/O
destination atom BUF1.
48 LISP

MTS 8: LISP and SLIP in MTS
June 1976 Page Revised January 1983
Files
The FILE is an atomic structure which has no significance to the
user except that it serves to direct input and output calls to MTS
files and devices. A FILE may reference any MTS file or device
name, logical I/O unit name, or logical I/O unit number.
Several files can be attached to a single buffer by creating
several IOARGs with the same buffer component. If these IOARGs are
used for output, data printed will all go to the same buffer.
However, if the buffer overflows, the file for that I/O operation
is used as the output file. Similarly, several buffers can be
attached to the same file by creating several IOARGs with the same
file component. In that case, output from all the attached buffers
is interleaved in the file.
Buffer and File Prefix Characters _________________________________
Any LISP buffer may have a prefix of up to 255 characters, which may
be set or reset by calling the STATUS function. The purpose of the
buffer prefix is to allow prefix strings to precede output lines. All
PRINT operations, including TAB and SKIP, treat a buffer with an active
prefix as though it begins after the prefix. Prefix characters use up
character positions at the beginning of the buffer, and are included in
the buffer size limit of 255 characters. Since READ operations do not
recognize buffer prefixes, a physical read operation into a buffer with
a prefix destroys or replaces the prefix.
A file prefix character may be attached to any LISP file by calling
the STATUS function. This has the effect of calling the MTS subroutine
SETPFX which causes any input from or output to the terminal to be
prefixed by the prefix character. For example, the following is a
sample run in which a buffer is created, given a prefix, the prefix is
used, and is then disabled. Lines which are not indented are entered by
the user. Lines which are indented are responses from LISP.
(OPEN (ABUF 132)) A buffer is created with length 132.
ABUF is the I/O destination atom.
The file portion of the IOARG created
will be NIL.
NIL
(READ ABUF) Causes a line to be read from the
system input device into ABUF, and
the first S-expression found to be
returned as the value of READ.
THIS IS A TEST Here is the input line.
LISP 49
Previous Page Next Page