16.1 Useful Commands
who-calls x &optional package
who-uses x &optional package
x must be a symbol. who-calls tries to find all of the compiled functions in the Lisp world which call x as a function, use x as a variable, or use x as a constant. (It won't find things that use constants which contain x , such as a list one of whose elements is x ; it will only find it if x itself is used as a constant.) It tries to find all of the compiled code objects by searching all of the function cells of all of the symbols on package and package 's decendants. package defaults to the global package, and so normally all packages are checked. If who-calls encounters an interpreted function definition, it simply tells you if x appears anywhere in the interpreted code. who-uses is currently the same thing as who-calls . The symbol unbound-function is treated specially by who-calls . (who-calls 'unbound-function) will search the compiled code objects for any calls through a symbol which is not currently defined as a function. This is useful for finding errors.
apropos string &optional package
(apropos string) tries to find all symbols whose print-names contain string as a substring. Whenever it finds a symbol, it prints out the symbol's name; if the symbol is defined as a function and/or bound, it tells you so, and prints the function (if any). It finds the symbols on package and package 's decendants. package defaults to the global package, so normally all packages are searched.
where-is pname &optional package
Prints the names of all packages which contain a symbol with the print-name pname . pname gets upper-cased. The package package and all its sub-packages are searched; package defaults to the global package, which causes all packages to be searched.
describe x
describe tries to tell you all of the interesting information about any object x (except for array contents). describe knows about arrays, symbols, flonums, packages, stacks, closures, and FEFs, and prints out the attributes of each in human-readable form. Sometimes it will describe something which it finds inside something else; such recursive descriptions are indented appropriately. For instance, describe of a symbol will tell you about the symbol's value, its definition, and each of its properties. describe of a flonum (regular or small) will show you its internal representation in a way which is useful for tracking down roundoff errors and the like. If x is a named-structure, describe handles it specially. To understand this, you should read the section on named structures (see this link). First it gets the named-structure symbol, and sees whether its function knows about the :describe operation. If the operation is known, it applies the function to two arguments: the symbol :describe , and the named-structure itself. Otherwise, it looks on the named-structure symbol for information which might have been left by defstruct ; this information would tell it what the symbolic names for the entries in the structure are, and describe knows how to use the names to print out what each field's name and contents is.
describe-file filename
This prints what the system knows about the file filename . It tells you what package it is in and what version of it is loaded.
describe-package package-name
(describe-package package-name) is equivalent to (describe (pkg-find-package package-name)) ; that is, it describes the package whose name is package-name .
describe-area area
area may be the name or the number of an area. Various attributes of the area are printed.
room &optional arg
room tells you how much room is left in some areas. For each area it tells you about, it prints out the name of the area, the number of words used in the area, the size of the area, and the percentage of words which are used in the area. If arg is not given, the value of room should be a list of area numbers and/or area names; room describes those areas. If arg is a fixnum, room describes that area. If arg is t , room describes all areas.
room Variable
The value of room is a list of area names and/or area numbers, denoting the areas which the function room will describe if given no arguments. Its initial value is:
(working-storage-area macro-compiled-program)
set-memory-size n-words
set-memory-size tells the virtual memory system to only use n-words words of main memory for paging. Of course, n-words may not exceed the amount of main memory on the machine.
recompile-world &rest keywords
recompile-world is a rather ad-hoc tool for recompiling all of the Lisp Machine system packages. It works by calling the pkg-load facility (see LINK:(pkg-load-fun)). It will find all files that need recompiling from any of the packages:
system-internals format compiler
chaos supdup peek eine
keywords is a list of keywords; usually it is empty. The useful keywords are:
loadAfter compiling, load in any files which are not loaded.
noconfirmDon't ask for confirmation for each package.
selectiveAsk for confirmation for each file.
Any of the other keywords accepted by pkg-load will also work.
qld &optional restart-p
qld is used to generate a new Lisp Machine system after the cold-load is loaded in. If you don't know how to use this, you don't need it. If restart-p is non-nil , then it ignores that it has done anything, and starts from scratch.
disassemble function
function should be a FEF, or a symbol which is defined as a FEF. This prints out a human-readable version of the macro-instructions in function . The macro-code instruction set is explained on LINK:(macro-code).
set-current-band band
Sets which "band" (saved virtual memory image) is to be loaded when the machine is started. Use with caution!
set-current-microload band
Sets which microload (MCR1 or MCR2) is to be loaded when the machine is started. Use with caution!
16.2 Querying the User
y-or-n-p &optional stream message
This is used for asking the user a question whose answer is either "Yes" or "No". It types out message (if any) and reads in one character from the keyboard. If the character is Y, T, or space, it returns t . If the character is N or rubout, it returns nil . Otherwise it prints out message (if any), followed by "(Y or N)", to stream and tries again. stream defaults to standard-output . y-or-n-p should only be used for questions which the user knows are coming. If the user is not going to be anticipating the question (e.g., if the question is "Do you really want to delete all of your files?" out of the blue) then y-or-n-p should not be used, because the user might type ahead a T, Y, N, space, or rubout, and therefore accidentally answer the question. In such cases, use yes-or-no-p .
yes-or-no-p &optional stream message
This is used for asking the user a question whose answer is either "Yes" or "No". It types out message (if any) and reads in a line from the keyboard. If the line is the string "Yes", it returns t . If the line is "No", it returns nil . (Case is ignored, as are leading and trailing spaces and tabs.) Otherwise it prints out message (if any), followed by `Please type either "Yes" or "No"' to stream and tries again. stream defaults to standard-output . To allow the user to answer a yes-or-no question with a single character, use y-or-n-p . yes-or-no-p should be used for unanticipated or momentous questions.
setup-keyboard-dispatch-table array lists
Several programs on the Lisp Machine accept characters from the keyboard and take a different action on each key. This function helps the programmer initialize a dispatch table for the keyboard. array should be a two-dimensional array with dimensions (4 220) . The first subscript to the array represents the Control and Meta keys; the Control key is the low order bit and the Meta key is the high order bit. The second subscript is the character typed, with the Control and Meta bits stripped off. In other words, the first subscript is the %%kbd-control-meta part of the character and the second is the %%kbd-char part. lists should be a list of four lists. Each of these lists describes a row of the table. The elements of one of these lists are called items , and may be any of a number of things. If the item is not a list, it is simply stored into the next location of the row. If the item is a list, then its first element is inspected. If the first element is the symbol :repeat , then the second element should be a fixnum n , and the third element is stored into the next n locations of the row. If the first element is :repeat-eval , it is treated as is :repeat except that the third element of the item is a form which is evaluated before being put into the array. The form may take advantage of the symbol si:rpcnt , which is set to 0 the first time the form is evaluated, and is increased by one every subsequent time. If the first element of an item is :eval , then the second element is evaluated, and the result is stored into the next location of the row. Otherwise, the item itself is stored in the next location of the row. Altogether exactly all 220 locations of the row must be filled in, or else an error will be signalled.
16.3 Stuff That Doesn't Fit Anywhere Else
time array lists
(time) returns a number which increases by 1 every 1/60 of a second, and wraps around at some point (currently after 18 bits' worth). Use the time-lessp and time-difference functions to avoid getting in trouble due to the wrap-around. The most important thing about time is that it is completely incompatible with Maclisp; this will get changed.
time-lessp time1 time2
t if time1 is earlier than time2 , compensating for wrap-around, otherwise nil .
time-difference time1 time2
Assuming time1 is later than time2 , returns the number of 60ths of a second difference between them, compensating for wrap-around.
defun-compatibility x
This function is used by defun and the compiler to convert Maclisp-style defun s to Lisp Machine definitions. x should be the cdr of a (defun ...) form. defun-compatibility will return a corresponding (defun ...) or (macro ...) form, in the usual Lisp Machine format.
set-error-mode &optional (car-sym-mode 1 ) (cdr-sym-mode 1 )
.defunc (car-num-mode 0 ) (cdr-num-mode 0 ) set-error-mode sets the four "error mode" variables. See the documentation of car and cdr (LINK:(car-fun)) which explains what these mean.
*rset flag
Sets the variable *rset to flag . Nothing looks at this variable; it is a vestigial crock left over from Maclisp.
disk-restore &optional partition
partition may be the name or the number of a disk partition containing a virtual-memory load, or nil or omitted, meaning to use the default load, which is the one the machine loads automatically when it is booted. The specified partition is copied into the paging area of the disk and then started. Lisp-machine disks currently contain seven partitions on which copies of virtual-memory may be saved for later execution in this way. disk-restore asks the user for confirmation before doing it.
disk-save partition
partition may be the name or the number of a disk partition containing a virtual-memory load, or nil , meaning to use the default load, which is the one the machine loads automatically when it is booted. The current contents of virtual memory are copied from main memory and the paging area of the disk into the specified partition, and then restarted as if it had just been reloaded. disk-save asks the user for confirmation before doing it.
16.4 Stuff That Doesn't Fit Anywhere Else
The status and sstatus special forms exist for compatibility with Maclisp. Programs that wish to run in both Maclisp and Lisp Machine Lisp can use status to determine which of these they are running in. Also, (sstatus feature ...) can be used as it is in Maclisp.
status Special Form
(status features) returns a list of symbols indicating features of the Lisp environment. The complete list of all symbols which may appear on this list, and their meanings, is given in the Maclisp manual. The default list for the Lisp Machine is:
(sort fasload string newio roman trace grindef grind lispm)
The value of this list will be kept up to date as features are added or removed from the Lisp Machine system. Most important is the symbol lispm , which is the last element of the list; this indicates that the program is executing on the Lisp Machine. (status feature symbol) returns t if symbol is on the (status features) list, otherwise nil . (status nofeature symbol) returns t if symbol is not on the (status features) list, otherwise nil . (status status) returns a list of all status operations. (status sstatus) returns a list of all sstatus operations.
sstatus Special Form
(sstatus feature symbol) adds symbol to the list of features. (sstatus nofeature symbol) removes symbol from the list of features.