MTS 8: LISP and SLIP in MTS
June 1976
Initialization. SLIP requires that the program first call the
subroutine INITAS which sets up 10 public lists with the symbolic
aliases W(1), W(2), ..., W(10). The subroutine has two arguments,
INITAS (SPACE,NDIM), that refer to the name and the dimension of the
one-dimensional array of free space. If we intend to use these public
lists then we must first declare¹
COMMON/PUBLIC/W(10)
The variables SPACE and W must be declared DOUBLE PRECISION.
The argument SPACE is the name of a DOUBLE PRECISION linear array of
dimension NDIM. In our system the user need not make of this space
assignment if he sets NDIM to a negative integer; the magnitude of this
integer will be used as an estimate of the number of pages of memory
initially assigned. The integer is rounded up, modulo 4096. In any
event space is acquired as needed. Under these conditions SPACE does
not have to be dimensioned but must be declared DOUBLE PRECISION.
Alternately, if SPACE is dimensioned NDIM, and NDIM is positive, then
this will be the assigned space for the available space list of NDIM/2
SLIP cells. Should all the available space be exhausted SLIP will
abruptly terminate execution with announcements when additional space is
sought.
Another point to be noted here, but which has no effect on the user,
is that in our SLIP system the available space list is a linked list of
one-directional pointers whose starting and ending names are stored in
FAVSLC and LAVSLC respectively.
Processes Affecting the Available Space _______________________________________
A basic operation, creating a list, is done by the function
LIST(LST)
Both its returned value and the value of its argument are the aliases of
the newly created empty list. We can, for example, write
DM2 = LIST(STACK)
and refer to the same list by the names DM2 and STACK. We are, of
course, also permitted to put
--------------------
¹Normally AVSL and W were maintained in unlabeled COMMON; we have
elected to use FAVSLC and LAVSLC for AVSL and labeled common PUBLIC, a
deviation from the early SLIP implementation. Also only 10 public
lists are created in this version of SLIP; early SLIP implementations
use 100.
120 SLIP

MTS 8: LISP and SLIP in MTS
June 1976
DN4 = LIST(DN4)
Further, if the argument is the numeral 9, a "local" sublist is created
with a reference counter 0 rather than the usual 1. If the name of this
list is put on another list, the sublist is automatically erased at the
time the superlist is returned to the available space list. (Sometimes
this kind of list is called temporary, as opposed to permanent lists
that are created with non-9 aliases.)
Another function
J = IRALST(LST)
returns the list with alias LST to the available space list. This
return takes place only if the list’s reference counter is 1; otherwise
the counter is decremented by 1. J is always the value of the reference
counter after the operation. If it is 0, the list has been erased. The
functions
DELETE(CADR)
or
DELETE(MADR)
should be employed to erase a list cell. They erase any list cell
except the Header and should be employed to return a cell no longer
needed to the available space list. These functions insure that the
link fields are properly rewritten. The value of the functions is the
datum of the cell returned. When accidentally a Header cell is named by
CADR or MADR, the value is 0, a warning message is given, and no action
is taken.
Another function of direct help to the programmer is
MTLIST(LST)
The function returns to the available space list all cells of the list
LST except its Header and its Description List, if any. Its returned
value is the alias of the just-emptied list.
It is noteworthy that, because of the postponed clean-up operation in
the returned cells, the time required by MTLIST is completely independ-
ent of the length of the list in question. The operation affects the
same number of link fields, i.e., those in the boundary cells, each
time.
The function
LPURGE(LST)
deletes all recursive references to lists from a list structure with the
alias LST. Its returned value is the number of times names were
SLIP 121
Previous Page Next Page