Dump forms to a file in a binary format, which can then be loaded using load-data-file.
A pathname designator.
Lisp code that calls
The value of fasl-stream-var.
A list of forms.
with-output-to-fasl-file and the functions
dump-forms-to-file allow you to dump forms to a file in a binary format, which can then be loaded using load-data-file.
dump-forms-to-filesimply dumps the forms in forms into the file specified by pathname.
with-output-to-fasl-filebinds fasl-stream-var to an opaque structure associated with pathname. Inside the body,
dump-formis used to dump individual forms to the file.
overwrite specifies what to do if pathname already exists. If overwrite is non-nil,
with-output-to-fasl-file overwrite the existing file, otherwise they signal an error. The default value of overwrite is
delete-on-error specifies what to in case of a non-local exit from the body of
with-output-to-fasl-file or from
dump-forms-to-file (typically abort after an error). By default, the file is deleted, but if delete-on-error is
nil then the file is left as it is. The default value of delete-on-error is
dump-standard-objects specifies what to do when trying to dump a standard object (that is, an instance of a subclass of
standard-object) which does not have a user-defined
make-load-form. If dump-standard-objects is
nil, an error is signaled. If dump-standard-objects is non-nil, the instance is dumped using
make-load-form-saving-slots. The default value of dump-standard-objects is
When the generated file is loaded by load-data-file, the forms are loaded and by default evaluated, though load-data-file can also load without evaluating. If callback is passed to load-data-file, it gets each of the results. Otherwise the results are discarded (except being printed when passing
:print t). Hence to be useful, either load-data-file must be called with callback, or evaluation of the forms should have some side effect, for example setting the value of some special symbol or adding entries to some global table.
For a form which is not a list or an object with
make-load-form, or is a quoted list,
eval does nothing. Dumping such forms and then using using the callback in load-data-file to do some work with them is the natural way of using
with-output-to-fasl-file and load-data-file to transfer large amounts of data.
Files generated by
with-output-to-fasl-file can be loaded (by load-data-file) on any LispWorks platform with the same byte order. All x86/x64 architectures have the same byte order (little-endian), so load-data-file on any x86/x64 architecture can be used load a data file that was generated on any x86/x64 architecture. The ARM architecture has the same byte order as x86/x64. The reverse byte order (big-endian) is used by AIX and SPARC (old Solaris).
t, structures (unless they have a
make-load-form), and, when dump-standard-objects is non-nil, standard objects without
make-load-formare dumped recursively.
with-output-to-fasl-filecope with cyclic structures.
make-load-formmethod for the objects at the nodes where the recursion should stop.
with-output-to-fasl-filemust be loaded only by load-data-file, and not by
LispWorks User Guide and Reference Manual - 13 Feb 2015