[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
LISP NIL
- To: info-macl@cambridge.apple.com
- Subject: LISP NIL
- From: cdj@pwtc.tc.pw.com (Cris Johnson)
- Date: Mon, 11 Mar 91 10:54:45 PST
If one was curious perhaps others are also?
A lot of
specifications of toolbox interface in Inside Mac refer to NIL. I know
that isn't the same NIL in LISP, it's something at the system level, but
what exactly is it? Is it a pointer to memory location zero, or is it a
word of exactly zero, or is it a pointer to a STRING255 containing the
characters N I L and <AsciiNul> (I doubt that's what it is, but you
never know), or what? I notice you say you can generate it by
(%null-ptr) inside MACL, except you have to use NIL instead in earlier
versions than 2.0. Do you mean lisp-NIL automatically gets mapped to
whatever system-NIL is but that feature was removed in 2.0 in favor of a
prettier way, or do you mean lisp-NIL has the zero bits in all the right
places to be used as-is without crashing the machine but is not exactly
per specs so there's now in MACL 2.0 a more per spec way of doing it?
NIL in the macintosh toolbox sense is a pointer to memory address zero,
an address that in all cpu's I've know of has been used for interrupt and
startup vectors and is clearly unique for an application to indicate
something other than a normal memory reference is intended.
The toolbox NIL is definitely not the same thing as a
lisp NIL, but it did happen that the representation picked in MACL for
lisp NIL was all zero bits so that it could be used for toolbox nil
arguments. %null-ptr in MACL2 is a macro expanding to (%int-to-ptr 0).
It has not been a 32 bit clean world in the past but since 8 megs/24 bits
was the biggest possible address, doing sneaky things with the most
significant byte of a pointer was usually ok. In particular pre 2.0 MACL
represented some data types as 32 bit numbers with special semantics for
the most significant byte.
MacOS 7 presumably will handle address spaces larger than 24 bits/8 meg
and having a few of the bits "wrong" in your addresses won't work anymore.
To that end MACL 2.0 has a new lisp data type just for macintosh memory
addresses/pointers and it has become manditory all pointers including
toolbox nil be of this data type.
Cris Johnson
Price Waterhouse Technology Centre
68 Willow Road, Menlo Park, CA 94025
(415) 322-0606