This library provides qsave_program/1 and qsave_program/2, which are
also used by the commandline sequence below.
swipl -o exe -c file.pl ...
- qsave_program(+File) is det
- qsave_program(+File, :Options) is det
- Make a saved state in file `File'.
- make_header(+Out:stream, +SaveClass, +Options) is det[private]
- save_options(+ArchiveHandle, +SaveClass, +Options)[private]
- Save the options in the '$options' resource. The home directory is
saved for development states to make it keep refering to the
development home.
The script files (-s script) are not saved at all. I think this is
fine to avoid a save-script loading itself.
- save_option_value(+SaveClass, +OptionName, +OptionValue, -FinalValue)[private]
- save_init_goals(+Stream, +Options)[private]
- Save initialization goals. If there is a
goal(Goal)
option, use
that, else save the goals from '$cmd_option_val'/2.
- mkrcname(+Module, +NameSpec, -Name)[private]
- Turn a resource name term into a resource name atom.
- save_resource(+Zipper, +Name, +FileSpec, +Options) is det[private]
- Add the content represented by FileSpec to Zipper under Name.
- create_mapping(+Options) is det[private]
- Call hook to obfuscate symbols.
- lock_files(+SaveClass) is det[private]
- When saving as
runtime
, lock all files such that when running the
program the system stops checking existence and modification time on
the filesystem.
- To be done
- -
system
is a poor name. Maybe use resource
?
- save_program(+Zipper, +SaveClass, +Options) is det[private]
- Save the program itself as virtual machine code to Zipper.
- prepare_entry_points(+Options)[private]
- Prepare the --goal=Goal and --toplevel=Goal options. Preparing
implies autoloading the definition and declaring it public such at
it doesn't get obfuscated.
- prepare_state(+Options) is det[private]
- Prepare the executable by running the
prepare_state
registered
initialization hooks.
- save_autoload(+Options) is det[private]
- Resolve all autoload dependencies.
- Errors
- -
existence_error(procedures, List)
if undefined(true)
is
in Options and there are undefined predicates.
- save_module(+Module, +SaveClass)[private]
- Saves a module
- save_imports[private]
- Save import relations. An import relation is saved if a
predicate is imported from a module that is not a default module
for the destination module. If the predicate is dynamic, we
always define the explicit import relation to make clear that an
assert must assert on the imported predicate.
- restore_import(+TargetModule, +SourceModule, +PI) is det[private]
- Restore import relation. This notably deals with imports from
the module
user
, avoiding a message that the predicate is not
exported.
- restore_prolog_flag(+Name, +Value, +Type)[private]
- Deal with possibly protected flags (debug_on_error and
report_error are protected flags for the runtime kernel).
- save_operators(+Options) is det[private]
- Save operators for all modules. Operators for
system
are
not saved because these are read-only anyway.
- save_foreign_libraries(+Archive, +ExeFile, +Options) is det[private]
- Save current foreign libraries into the archive.
- copy_foreign_libraries(+Exe, +Options) is det[private]
- Copy all required foreign libraries to an installation directory.
This is currently only implemented for Windows, copying all .dll
files to the directory where the executable is created.
- find_foreign_library(+Architecture, +FileSpec, -EntryName, -File, -Time) is det[private]
- Find the shared object specified by FileSpec for the named
Architecture. EntryName will be the name of the file within the
saved state archive. If posible, the shared object is stripped to
reduce its size. This is achieved by calling
strip -o <tmp>
<shared-object>
. Note that (if stripped) the file is a Prolog tmp
file and will be deleted on halt.
- bug
- - Should perform OS search on failure
- strip_file(+File, -Stripped) is det[private]
- Try to strip File. Unify Stripped with File if stripping fails for
some reason.
- qsave:arch_shlib(+Architecture, +FileSpec, -File) is det[multifile]
- This is a user defined hook called by qsave_program/2. It is used to
find a shared library for the specified Architecture, named by
FileSpec. FileSpec is of the form
foreign(Name)
, a specification
usable by absolute_file_name/2. The predicate should unify File with
the absolute path for the shared library that corresponds to the
specified Architecture.
If this predicate fails to find a file for the specified
architecture an existence_error
is thrown.
- zipper_append_file(+Zipper, +Name, +File, +Options) is det[private]
- Append the content of File under Name to the open Zipper.
- zipper_add_directory(+Zipper, +Name, +Dir, +Options) is det[private]
- Add a directory entry. Dir is only used if there is no option
time(Stamp)
.
- zipper_append_directory(+Zipper, +Name, +Dir, +Options) is det[private]
- Append the content of Dir below Name in the resource archive.
Options:
- include(+Patterns)
- Only add entries that match an element from Patterns using
wildcard_match/2.
- exclude(+Patterns)
- Ignore entries that match an element from Patterns using
wildcard_match/2.
- To be done
- - Process .gitignore. There also seem to exists other
standards for this.
- ignored(+File, +Options) is semidet[private]
- Ignore File if there is an
include(Patterns)
option that does not
match File or an exclude(Patterns)
that does match File.
- qsave_toplevel
- Called to handle `-c file` compilaton.
- qsave_option(+Name, +ValueStrings, -Value) is semidet[private]
Re-exported predicates
The following predicates are exported from this file while their implementation is defined in imported modules or non-module files loaded by this module.
- qsave_program(+File) is det
- qsave_program(+File, :Options) is det
- Make a saved state in file `File'.