MTS 8: LISP and SLIP in MTS
Page Revised February 1979 June 1976
LISP interpreter, and requires familiarity with the internal
structures of LISP.
N=1 signifies FORTRAN function calling conventions, with a
floating-point value. Any number of arguments may be given,
and they must be numeric atoms. If an argument is a
floating-point numeric atom, it will be passed to the function
as a double-precision floating-point number. (This allows the
user to call both single- and double-precision external
functions, although LISP numbers have only single-precision
significance.) If the argument is an integer numeric atom, it
will be passed to the function as a fullword integer. (Note
that the number represented by the atom is passed, and not the
atomic structure.)
Upon return from the function, floating-point register 0 will
be treated as a single-precision value of the function, and a
| numeric atom with that value will be returned. No changes to
| any arguments will occur.
N=2 signifies FORTRAN function calling conventions, with an inte-
ger value. Any number of arguments may be given, and their
interpretation will be the same as for N=1.
Upon return from the function, general register 0 will be
treated as an integer return value from the function, and a
| numeric atom with that value will be returned. No changes to
| any arguments will occur.
N=3 signifies FORTRAN subroutine calling conventions. Any number
of numeric arguments may be given, and their interpretation
will be the same as for N=1 or N=2.
For this type of external function, the arguments may be
modified by the function, just as if they were the values of
FORTRAN variables.
Upon return from the subroutine, general register 15 is
checked first. If the return code is nonzero, then the value
returned from the LISP function will be NIL. If the return
code is zero, then a list of the argument values (which may
have possibly been modified) will be returned as the value of
the LISP function. Note that a FORTRAN program which modifies
the values of its arguments does not alter the value of any
LISP structure. The only effect of the modification is that
some new numeric atoms are returned as part of the value of
the LISP function.
An argument which was originally passed as an integer will be
interpreted upon return as an integer. An argument which was
originally passed as a floating-point number will be inter-
preted upon return as a single-precision floating-point
number.
44 LISP

MTS 8: LISP and SLIP in MTS
June 1976 Page Revised February 1979
N=4 signifies the same calling conventions as N=0; however, if the
system is CHECKPOINTed, the external code will also be
CHECKPOINTed. (Normally, an external routine is reloaded
after each RESTORE.)
Calls to the MTS functions STOP and ERROR while executing an external
routine are trapped by LISP. STOP causes a return from the external
function with a value of NIL. ERROR generates a call to the LISP
function ERR.
A Note on Recursion in Function Specification _____________________________________________
The CAR of a form being EVALed has a unique status in LISP. It has
been previously stated that the CAR is interpreted as a function
specification, and we have given some examples of typical function
specifications. If the CAR is a LAMBDA-expression, the LAMBDA-function
will be applied to the rest of the form being EVALed. Some of the other
possibilities will now be described in more detail.
If the CAR of the form being evaluated is an atom, then EVAL looks
for one of the special system indicators on the property-list of the
atom. If one is found, it will either be one of the built-in system
function indicators, in which case LISP goes off to execute that
function, or it will be one of the user-defined function indicators. If
it is one of the latter, then the property-value associated with the
indicator is merely substituted for the atom, and the evaluation process
continues.
(DEFINE (NEWCAR EXPR CAR))
(NEWCAR ’(A B C)) = A
Assume, for a moment, that the CAR of the form being EVALed is an
atom which has no system indicator on its property-list. In this case,
EVAL searches for a system indicator, fails to find one, and substitutes
the VALUE of that atom for the atom itself, and the process continues.
In this manner, an atom NAME can have a function definition temporarily
associated with it during execution of a LABEL-function. However, the
VALUE need not be a LAMBDA-expression, but may be another atom, or any
other "function specification."
Finally, if the CAR of the form being EVALed is not an atom and not a
LAMBDA-expression, it is then interpreted as an "indirect" function
specification. It is itself EVALed, its value is substituted for
itself, and the process continues.
(SETQ A ’(CONS))
(SETQ B ’CAR)
((B A) ’X ’Y) = (X . Y)
LISP 45
Previous Page Next Page