YAP 7.1.0
Configuration of the Prolog file search path

Prolog systems search follow a complex search on order to track down files. More...

Detailed Description

Prolog systems search follow a complex search on order to track down files.


Class Documentation

◆ library_directory/1

class library_directory/1

library_directory(?Directory:atom)

properties: nondeterministic

properties: dynamic

Dynamic, multi-file predicate that succeeds when Directory is a current library directory name Asserted in the user module

Library directories are the places where files specified in the form library( _File_ ) are searched by the predicates consult/1 , reconsult/1 , use_module/1 , ensure_loaded/1 , and load_files/2

This directory is initialized by a rule that calls the system predicate system_library/1

◆ commons_directory/1

class commons_directory/1

commons_directory(? Directory:atom)

properties: nondeterministic

properties: dynamic

State the location of the Commons Prolog Initiative

This directory is initialized as a rule that calls the system predicate library_directories/2

◆ foreign_directory/1

class foreign_directory/1

foreign_directory(? Directory:atom)

properties: nondeterministic

properties: dynamic

State the location of the Foreign Prolog Initiative

This directory is initialized as a rule that calls the system predicate library_directories/2

◆ prolog_file_type/2

class prolog_file_type/2

prolog_file_type(?Suffix:atom, ?Handler:atom)

properties: nondeterministic

properties: dynamic

This multifile/dynamic predicate relates a file extension Suffix to a language or file type Handler By default, it supports the extensions yap, pl, and prolog for prolog files and uses one of dll, so, or dylib for shared objects Initial definition is:

prolog_file_type(yap, prolog).
prolog_file_type(pl, prolog).
prolog_file_type(prolog, prolog).
prolog_file_type(qly, prolog).
prolog_file_type(qly, qly).
prolog_file_type(A, prolog) :-
current_prolog_flag(associate, A),
A \== current_prolog_flag,
A \==current_prolog_flag,
A \== current_prolog_flag.
prolog_file_type(A, executable) :-
current_prolog_flag(shared_object_extension, A).
prolog_file_type(pyd, executable).
current_prolog_flag(? Flag,- Value)
prolog_file_type(?Suffix:atom, ?Handler:atom)

◆ file_search_path/2

class file_search_path/2

file_search_path(+Name:atom, -Directory:atom)

properties: nondeterministic

Allows writing file names as compound terms The Name and DIRECTORY must be atoms The predicate may generate multiple solutions The predicate is originally defined as follows:

file_search_path(library, Dir) :-
file_search_path(commons, Dir) :-
file_search_path(swi, Home) :-
current_prolog_flag(home, Home).
file_search_path(yap, Home) :-
current_prolog_flag(home, Home).
file_search_path(system, Dir) :-
prolog_flag(host_type, Dir).
file_search_path(foreign, Dir) :-
file_search_path(executable, Dir) :-
file_search_path(path, C) :-
( getenv('PATH', A),
( current_prolog_flag(windows, true)
-> atomic_list_concat(B, ;, A)
; atomic_list_concat(B, :, A)
),
lists:member(C, B)
).
atomic_list_concat(+ As,? A)
atomic_list_concat(? As,+ Separator,? A)
member(?Element, ?Set) is true when Set is a list, and Element occurs in it
commons_directory(? Directory:atom)
file_search_path(+Name:atom, -Directory:atom)
foreign_directory(? Directory:atom)
library_directory(?Directory:atom)

Thus, compile(library(A)) will search for a file using library_directory/1 to obtain the prefix, whereas 'compile(system(A))would look at thehost_type` flag