- Documentation
- Reference manual
- Built-in Predicates
- Loading Prolog source files
- load_files/1
- load_files/2
- consult/1
- ensure_loaded/1
- include/1
- require/1
- encoding/1
- make/0
- library_directory/1
- file_search_path/2
- expand_file_search_path/2
- prolog_file_type/2
- source_file/1
- source_file/2
- source_file_property/2
- unload_file/1
- prolog_load_context/2
- source_location/2
- at_halt/1
- cancel_halt/1
- initialization/1
- initialization/2
- initialization/0
- compiling/0
- Conditional compilation and program transformation
- Reloading files, active code and threads
- Quick load files
- Loading Prolog source files
- Built-in Predicates
- Packages
- Reference manual
Availability:built-in
Key | Description |
directory | Directory in which source
lives |
dialect | Compatibility mode. See expects_dialect/1. |
file | Similar to source ,
but returns the file being included when called while an include file is
being processed |
module | Module into which file is loaded |
reload | true if
the file is being
reloaded. Not present on first load |
script | Boolean that indicates whether the file is loaded as a script file (see -s) |
source | File being loaded. If
the system is processing an included file, the value is the main
file. Returns the original Prolog file when loading a
.qlf file. |
stream | Stream identifier (see current_input/1) |
term_position | Start position
of last term read. See also
stream_property/2
(position property and
stream_position_data/3.49Up
to version 7.1.22, the position term carried fake data except for the line_count
and had five arguments, where the position property of a stream
only has four. |
term | Term being expanded by expand_term/2. |
variable_names | A list of `Name = Var' of the last term read. See read_term/2 for details. |
The directory
is commonly used to add rules to file_search_path/2,
setting up a search path for finding files with absolute_file_name/3.
For example:
:- dynamic user:file_search_path/2. :- multifile user:file_search_path/2. :- prolog_load_context(directory, Dir), asserta(user:file_search_path(my_program_home, Dir)). ... absolute_file_name(my_program_home('README.TXT'), ReadMe, [ access(read) ]), ...