module(+atom, ?quoted_atom, ?atom)
module(?atom, ?quoted_atom, ?atom)

The module/3 predicate gives information about compiled modules that have been loaded into memory by Trinc-Prolog. It is possible with this built-in predicate to get information about a single module or about all modules loaded.

The first parameter is the name of the loaded module, the second parameter is the filename of the module and the last parameter is the open-mode of the module (read or readwrite). If the first parameter is a variable then the predicate can be redone after a solution and information about all modules can thus be retrieved. Information about a module is unified with each parameter.

When specifying a filename put two backslash characters for each normal backslash in the filename, otherwise the character sequence could be mistaken for a symbolic control character like for instance: \t, which is replaced by a single tab character.

see also: active_module/1 check_singleton/1 close_all_modules/0 close_module/1 consult/0 consult/1 consult/3 create_module/1 create_module/2 ensure_loaded/1 include/1 module_name/2 modules open_module/0 open_module/1 open_module_search/3 open_standard_module/2 save_module/1 save_module/2 save_module/3 set_active_module/0 set_active_module/1 this_module/3

Examples
open_module(m23, 'c:\\temp\\f23.txt', read),
module(Name, File, Mode).
per call information about a module is retrieved, if the open_module/3 goal was successful then two modules are loaded (the system module is always open), the two solutions are:

Name = system, File = 'c:\\Program Files\\Trinc-Prolog\\program\\system.txt'
Name = m23, File = 'c:\\temp\\f23.txt'

open_module(m23, File, Mode). If there is no module with the name 'm32' then an existence_error exception is thrown
open_module(Name, File, read). retrieve the module name and file name for each module opened with the 'read' mode, the number of solutions is equal to the number of modules opened with the 'read' mode

 

Exceptions
an argument Arg is not an atom nor a variable a type_error(atom, Arg) exception is thrown
there is no module with the same name a existence_error(module, A) exception is thrown

 

 

info@trinc-prolog.com