The standard predicate consult/[1,2] is the most convenient method for entering static source code rules into XSB's database 3.7. consult/1 has the form:
consult/2 has the form.
Consulting a file (module) conceptually consists of the following five steps which are described in detail in the following paragraphs.
There are two steps to name resolution: determining the proper directory prefix and determining the proper file extension. When FileName is absolute (i.e. it contains a path from the file to the root of the file system) determining the proper directory prefix is straightforward. If FileName is relative, i.e. it contains a '/' in Unix or '/' in Windows, FileName is expanded to a directory prefix in an OS-dependent way, resolving symbols like '.', '..' and '~' when applicable. However, the user may also enter a name without any directory prefix. In this case, the directory prefix is a directory in the dynamic loader path (see Section 3.6) where the source file exists. Once the directory prefix is determined, the file name is checked for an extension. If there is no extension the loader first checks for a file in the directory with the .P extension, (or .c for foreign modules) before searching for a file without the extension, and finally for a file with a .pl extension. Note that since directories in the dynamic loader path are searched in a predetermined order (see Section 3.6), if the same file name appears in more than one of these directories, the compiler will consult the first one it encounters.
Compilation is performed if the update date of a source file (*.P/.pl or *.H) is later than that of the the object file (*.xwam). Currently (Version 3.0), a foreign language module is compiled when at least one of files *.c or *.H has been changed from the time the corresponding object files have been created.
Once the file is compiled into byte-code, the byte-code for the file is loaded into XSB's database. After loading the file all exported predicates of that module are imported into the current environment (the current working module usermod) if the file is a module. For non-modules, all predicates are imported into the current working module. As the last part of loading, any queries -- that is, any terms with principal functor '?-'/1, or with the principal functor ':-'/1 and that are not directives like the ones described in Section 3.10 are executed in the order that they are encountered.
Error conditions for consult(+File) are as follows: