![[LISPWORKS]](/image.pl?url=http%3a%2f%2fwww.lispworks.com%2fdocumentation%2fHyperSpec%2fBody%2f..%2fGraphics%2fLWSmall.gif&f=jpg&w=240)
![[Common Lisp HyperSpec (TM)]](/image.pl?url=http%3a%2f%2fwww.lispworks.com%2fdocumentation%2fHyperSpec%2fBody%2f..%2fGraphics%2fCLHS_Sm.gif&f=jpg&w=240)
Syntax:
compile-fileinput-file&key output-file verbose print external-format
=>output-truename, warnings-p, failure-p
Arguments and Values:
input-file---apathname designator. (Default fillers for unspecified components are taken from*default-pathname-defaults*.)
output-file---apathname designator. The default isimplementation-defined.
verbose---ageneralized boolean. The default is thevalue of*compile-verbose*.
print---ageneralized boolean. The default is thevalue of*compile-print*.
external-format---anexternal file format designator. The default is:default.
output-truename---apathname (thetruename of the outputfile), ornil.
warnings-p---ageneralized boolean.
failure-p---ageneralized boolean.
Description:
compile-file transforms the contents of the file specified byinput-file intoimplementation-dependent binary data which are placed in the file specified byoutput-file.
Thefile to whichinput-file refers should be asource file.output-file can be used to specify an outputpathname; the actualpathname of thecompiled file to whichcompiled code will be output is computed as if by callingcompile-file-pathname.
Ifinput-file oroutput-file is alogical pathname, it is translated into aphysical pathname as if by callingtranslate-logical-pathname.
Ifverbose istrue,compile-file prints a message in the form of a comment (i.e., with a leadingsemicolon) tostandard output indicating whatfile is beingcompiled and other useful information. Ifverbose isfalse,compile-file does not print this information.
Ifprint istrue, information abouttop level forms in the file being compiled is printed tostandard output. Exactly what is printed isimplementation-dependent, but nevertheless some information is printed. Ifprint isnil, no information is printed.
Theexternal-format specifies theexternal file format to be used when opening thefile; see thefunctionopen.compile-file andload must cooperate in such a way that the resultingcompiled file can beloaded without specifying anexternal file format anew; see thefunctionload.
compile-file binds*readtable* and*package* to the values they held before processing the file.
*compile-file-truename* is bound bycompile-file to hold thetruename of thepathname of the file being compiled.
*compile-file-pathname* is bound bycompile-file to hold apathname denoted by the first argument tocompile-file, merged against the defaults; that is,(pathname (merge-pathnamesinput-file)).
The compiledfunctions contained in thecompiled file become available for use when thecompiled file isloaded into Lisp. Any function definition that is processed by the compiler, including#'(lambda ...) forms and local function definitions made byflet,labels anddefun forms, result in anobject oftypecompiled-function.
Theprimary value returned bycompile-file,output-truename, is thetruename of the output file, ornil if the file could not be created.
Thesecondary value,warnings-p, isfalse if noconditions oftypeerror orwarning were detected by the compiler, andtrue otherwise.
Thetertiary value,failure-p, isfalse if noconditions oftypeerror orwarning (other thanstyle-warning) were detected by the compiler, andtrue otherwise.
For general information about howfiles are processed by thefile compiler, seeSection 3.2.3 (File Compilation).
Programs to be compiled by thefile compiler must only containexternalizable objects; for details on suchobjects, seeSection 3.2.4 (Literal Objects in Compiled Files). For information on how to extend the set ofexternalizable objects, see thefunctionmake-load-form andSection 3.2.4.4 (Additional Constraints on Externalizable Objects).
Examples: None.
Affected By:
*error-output*,*standard-output*,*compile-verbose*,*compile-print*
The computer's file system.
Exceptional Situations:
For information about errors detected during the compilation process, seeSection 3.2.5 (Exceptional Situations in the Compiler).
An error oftypefile-error might be signaled if(wild-pathname-pinput-file) returns true.
If either the attempt to open thesource file for input or the attempt to open thecompiled file for output fails, an error oftypefile-error is signaled.
See Also:
compile,declare,eval-when,pathname,logical-pathname,Section 20.1 (File System Concepts),Section 19.1.2 (Pathnames as Filenames)
Notes: None.