Did you know ... Search Documentation:
qsave.pl -- Save current program as a state or executable
PublicShow source

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 ...
Source qsave_program(+File) is det
Source qsave_program(+File, :Options) is det
Make a saved state in file `File'.
Source make_header(+Out:stream, +SaveClass, +Options) is det[private]
Source 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.

Source save_option_value(+SaveClass, +OptionName, +OptionValue, -FinalValue)[private]
Source 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.
Source mkrcname(+Module, +NameSpec, -Name)[private]
Turn a resource name term into a resource name atom.
Source save_resource(+Zipper, +Name, +FileSpec, +Options) is det[private]
Add the content represented by FileSpec to Zipper under Name.
Source create_mapping(+Options) is det[private]
Call hook to obfuscate symbols.
Source 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?
Source save_program(+Zipper, +SaveClass, +Options) is det[private]
Save the program itself as virtual machine code to Zipper.
Source 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.
Source prepare_state(+Options) is det[private]
Prepare the executable by running the prepare_state registered initialization hooks.
Source 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.
Source save_module(+Module, +SaveClass)[private]
Saves a module
Source 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.
Source 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.
Source 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).
Source save_operators(+Options) is det[private]
Save operators for all modules. Operators for system are not saved because these are read-only anyway.
Source save_foreign_libraries(+Archive, +Options) is det[private]
Save current foreign libraries into the archive.
Source 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
Source strip_file(+File, -Stripped) is det[private]
Try to strip File. Unify Stripped with File if stripping fails for some reason.
Source 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.

Source zipper_append_file(+Zipper, +Name, +File, +Options) is det[private]
Append the content of File under Name to the open Zipper.
Source 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).
Source 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.
Source 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.
Source 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.

Source qsave_program(+File) is det
Source qsave_program(+File, :Options) is det
Make a saved state in file `File'.