$find_library(+Module, +Name, +Arity, -LoadModule, -Library) is semidet- Locate a predicate in the library. Name and arity are the name
and arity of the predicate searched for. `Module' is the
preferred target module. The return values are the full path
name (excluding extension) of the library and module declared in
that file.
$in_library(+Name, +Arity, -Path) is semidet
- $in_library(-Name, -Arity, -Path) is nondet
- Is true if Name/Arity is in the autoload libraries.
$define_predicate(:Head)- Make sure PredInd can be called. First test if the predicate is
defined. If not, invoke the autoloader.
$update_library_index(+Options)- Called from make/0 to update the index of the library for each
library directory that has a writable index. Note that in the
Windows version access_file/2 is mostly bogus. We assert
silent/0 to suppress error messages. Options:
- system(+Boolean)
- Do (not) include system libraries. Default
false
.
- user(+Boolean)
- Do (not) include user libraries. Default
true
.
writable_indexed_directory(-Dir, +Options) is nondet[private]- True when Dir is an indexed library directory with a writable
index, i.e., an index that can be updated.
reload_library_index- Reload the index on the next call
load_library_index(?Name, ?Arity) is det[private]
load_library_index(?Name, ?Arity, :IndexSpec) is det[private]- Try to find Name/Arity in the library. If the predicate is
there, we are happy. If not, we check whether the set of loaded
libraries has changed and if so we reload the index.
index_file_name(-IndexFile, +Spec, +Options) is nondet[private]- True if IndexFile is an autoload index file. Options is passed
to absolute_file_name/3. This predicate searches the path
autoload
.
- See also
- - file_search_path/2.
make_library_index(+Dir) is det- Create an index for autoloading from the directory Dir. The
index file is called
INDEX.pl
. In Dir contains a file
MKINDEX.pl
, this file is loaded and we assume that the index is
created by directives that appearin this file. Otherwise, all
source files are scanned for their module-header and all
exported predicates are added to the autoload index.
- See also
- - make_library_index/2
make_library_index(+Dir, +Patterns:list(atom)) is det- Create an autoload index
INDEX.pl
for Dir by scanning all files
that match any of the file-patterns in Patterns. Typically, this
appears as a directive in MKINDEX.pl
. For example:
:- prolog_load_context(directory, Dir),
make_library_index(Dir, ['*.pl']).
- See also
- - make_library_index/1.
index_files(+Files, +Directory, +Out:stream) is det[private]- Write index for Files in Directory to the stream Out.
exports(+File, -Module, -Exports) is det
- exports(+File, -Module, -Exports, -Meta) is det
- Get the exports from a library as a list of PIs. Exports are all
exports of the module header (including op/3 terms) and encountered
export/1 directives. Meta are all heads in meta_predicate/1
declarations.
autoload_path(+Path) is det- Add Path to the libraries that are used by the autoloader. This
extends the search path
autoload
and reloads the library
index. For example:
:- autoload_path(library(http)).
If this call appears as a directive, it is term-expanded into a
clause for file_search_path/2 and a directive calling
reload_library_index/0. This keeps source information and allows
for removing this directive.
autoload_from(+PI, -LoadModule, -PlFile) is semidet[private]- True when PI can be defined by loading File which is defined the
module LoadModule.
autoload_in(+AutoloadFlag, +AutoloadMode, +TargetModule) is semidet[private]
do_autoload(Library, :PI, +LoadModule) is det[private]- Load File, importing PI into the qualified module. File is known to
define LoadModule. There are three cases:
- The target is the autoload module itself. Uncommon.
- We already loaded this module. Note that
'$get_predicate_attribute'/3 alone is not enough as it will
consider auto-import from
user
. '$c_current_predicate'/2
verifies the predicate really exists, but doesn't validate
that it is defined.
- We must load the module and import the target predicate.
- Arguments:
-
Library | - is an absolute file name, either without extension or
with the source (.pl) extension. |
autoloadable(:Head, -File) is nondet- True when Head can be autoloaded from File. This implements the
predicate_property/2 property
autoload(File)
. The module must be
instantiated.
library_info(+Spec, +AutoloadContext, -FullFile, -Module, -Exports)[private]- Find information about a library. Spec is the file specification as
it appears in the autoload/1,2 call. AutoloadContext is a term
File:Line, providing the location of the directive.
- Arguments:
-
FullFile | - is the source (.pl) file in canonical (absolute)
notation. |
Module | - is the module defined in FullFile |
Exports | - is a list of predicate indicators. |
set_autoload(+Value) is det- Hook called from set_prolog_flag/2 when autoloading is switched. If
the desired value is
false
we should materialize all registered
requests for autoloading. We must do so before disabling autoloading
as loading the files may require autoloading.
assert_autoload(+Module, +File, +Context, +Imports) is det[private]- Assert that Module can autoload predicates defines in Imports by
loading File. Context provides the file owner of the declaration.
- Arguments:
-
Imports | - is either all or imports(List) . That latter comes
from an autoload/2 directive. |
register_autoloads(+ListOfPI, +Module, +File, +Context)[private]- Put an
autoload
flag on all predicates declared using autoload/2
to prevent duplicates or the user defining the same predicate.
- Arguments:
-
warn_autoload(+TargetModule, :PI) is det[private]-
- Arguments:
-
PI | - is of the shape LoadModule:Name/Arity. |
nowarn_autoload(+TargetModule, +LoadModulePI) is semidet[private]- True when LoadModule:'$nowarn_autoload'(PI,TargetModule) is defined
and true.
- To be done
- - As is, these facts must be defined by the library being
autoloaded. Possibly we want a specific autoload declaration. As all
this only affects the Prolog libraries, we can always change this.
One option might be this, where How is one of
true
, false
or
warning
.
:- autoloadable(PI, How)
require(:ListOfPredIndicators) is det- Register the predicates in ListOfPredIndicators for autoloading
using autoload/2 if they are not system predicates.
Undocumented predicates
The following predicates are exported, but not or incorrectly documented.
autoload(Arg1)
$autoload(Arg1)
autoload(Arg1, Arg2)