Previous Contents Next
7.23 Program state

7.23.1 consult/1, '.'/2 - program consult
[default]consult/1@consult/1|textbf7.23.1htoc [default]'.'/2@'.'/2|textbf7.23.1htoc
Templates

consult(+atom_or_atom_list)
'.'(+atom, +atom_list)
Description

consult(Files) compiles and loads into memory each file of the list Files. Each file is compiled for byte-code using the GNU Prolog compiler (section 3.4) then loaded using load/1 (section 7.23.2). It is possible to specify user[default]user@user7.23.1htoc as a file name to directly enter the program from the terminal. Files can be also a single file name (i.e. an atom). Refer to the section concerning the consult of a Prolog program for more information (section 3.2.3).

The final file name of a file is computed using the predicates prolog_file_name/2[default]prolog_file_name/2@prolog_file_name/27.23.1htoc (section 7.26.3) and absolute_file_name/2[default]absolute_file_name/2@absolute_file_name/27.23.1htoc (section 7.26.1).

[ File | Files ], i.e. '.'(File, Files) is equivalent to consult([ File | Files ]).

Errors

Files is a partial list or a list with an element E which is a variable    instantiation_error
Files is neither a partial list nor a list nor an atom    type_error(list, Files)
an element E of the Files list is neither a variable nor an atom    type_error(atom, E)
an element E of the Files list is an atom but not a valid pathname    domain_error(os_path, E)
an element E of the Files list is a valid pathname but does not correspond to an existing source    existence_error(source_sink, E)
an error occurs executing a directive    see call/1 errors (section 6.2.3)

Portability

GNU Prolog predicates.

7.23.2 load/1
[default]load/1@load/1|textbf7.23.2htoc
Templates

load(+atom_or_atom_list)
Description

load(Files) loads into memory each file of the list Files. Each file must have been previously compiled for byte-code using the GNU Prolog compiler (section 3.4). Files can be also a single file name (i.e. an atom).

The final file name of a file is computed using the predicates absolute_file_name/2[default]absolute_file_name/2@absolute_file_name/27.23.2htoc (section 7.26.1). If no suffix is given '.wbc' is appended to the file name.

Errors

Files is a partial list or a list with an element E which is a variable    instantiation_error
Files is neither a partial list nor a list nor an atom    type_error(list, Files)
an element E of the Files list is neither a variable nor an atom    type_error(atom, E)
an element E of the Files list is an atom but not a valid pathname    domain_error(os_path, E)
an element E of the Files list is a valid pathname but does not correspond to an existing source    existence_error(source_sink, E)
an error occurs executing a directive    see call/1 errors (section 6.2.3)

Portability

GNU Prolog predicate.

7.23.3 listing/1, listing/0
[default]listing/1@listing/1|textbf7.23.3htoc [default]listing/0@listing/0|textbf7.23.3htoc
Templates

listing(+predicate_indicator)
listing(+atom)
listing
Description

listing(Pred) lists the clauses of the consulted predicate whose predicate indicator is Pred. Pred can also be a single atom in which case all predicates whose name is Pred are listed (of any arity). This predicate uses portray_clause/2[default]portray_clause/2@portray_clause/27.23.3htoc (section 7.14.8) to output the clauses.

listing lists all clauses of all consulted predicates.

Errors

Pred is a variable    instantiation_error
Pred is neither a variable nor predicate indicator or an atom    type_error(predicate_indicator, Pred)

Portability

GNU Prolog predicate.


Copyright (C) 1999-2001 Daniel Diaz

Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.

More about the copyright
Previous Contents Next