23. Files

This chapter explains how the Lisp Machine system interacts with files and the file system. It explains how to keep your programs in files and how to get them into the Lisp environment, how they relate to packages, how they are divided into sections, and how they are seen by EINE (the editor). Eventually, Lisp Machines will be able to support their own file sytems, or use a special purpose "File Computer" over the Chaosnet. At the moment, the prototype Lisp Machine uses the A.I. PDP-10 file system. To allow it to access the PDP-10 (which is not yet attached to the Chaosnet), a special program must be run on the PDP-10, which is invoked by typing :lmio;file to DDT. A pathname or filename is a string of characters which identifies a file in the file system. On the existing file system, a pathname looks like "device : directory ; fn1 fn2 " It is assumed that the reader of this document is familiar with the meanings of these pathnames, and the use of ">" as the fn2 in a pathname. Unlike Maclisp, Lisp Machine functions usually take filenames as a character string, rather then as a list. Most functions understand pathnames in which some components are not specified. For example, in the string "lispm;qmod" , the device and fn2 are not specified.

23.1 Functions for Loading Programs
23.1.1 Functions for Loading Single Files
load pathname &optional pkg
This function loads the file pathname into the Lisp environment. If the file is a QFASL file, it calls fasload ; otherwise it calls readfile . pkg should be a package or the name of a package, and if it is given it is used as the current package when the file is read in. Usually it is not given; when it is not supplied explicitly, load tries to figure out what package to use by calling pkg-find-file-package . If the FN2 is not specified in pathname , load first tries appending the fn2 "qfasl" , and then tries the fn2 ">" if the "qfasl" file is not found.
readfile pathname
readfile sequentially reads and evaluates forms from the file pathname , in the current package.
fasload pathname
fasload reads in and processes a QFASL file, in the current package. That is, it defines functions and performs other actions as directed by the specifications inserted in the file by the compiler.
23.1.2 Loading and Compiling Whole Packages
Because each package has a file-alist, it is possible to request that the files of a package be compiled or loaded, as needed. This is done with the pkg-load function, which takes as arguments a package and a list of keywords (or one keyword) specifying the precise nature of the operation. For example, (pkg-load "eine" ':compile) would recompile and reload the files of the eine package, such as require it.
pkg-load package &optional keywords
This function loads and/or compiles the files of a package. package may be a package or a package name; keywords should be one of the keyword symbols below or a list of keywords. The keywords control what pkg-load does. The keywords defined include:
:confirmAsk for confirmation before doing it (this is the default);
:noconfirmDon't ask for confirmation
:compileCompile files before loading;
:nocompileDo not compile (this is the default);
:loadLoad files (the default);
:noloadDon't load (but compile, if that was specified);
:selectiveAsk about each file;
:completeDon't ask about each file (the default);
:reloadCompile or load even files which appear not to need it;
:noreloadOnly process files which have newer versions on disk (the default);
:recursiveAlso process packages this one refers to;
:defsProcess only DEFS files.
See also recompile-world (LINK:(recompile-world-fun)).