save_module(+atom_name)

This predicate writes all the clauses of a module to a file. The argument is the name of the module that must be saved. It is required that the filename of the module is known and that the open-mode of the module is readwrite. The predicate translates the compiled code of the module back to text and writes the text to a file, comments placed in the original code of the module are not saved! .

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/3 module_name/2 modules open_module/0 open_module/1 open_module/3 open_module_search/3 open_standard_module/2 save_module/2 save_module/3 set_active_module/0 set_active_module/1 this_module/3

Example
save_module(m23). the clauses of the module 'm23' are written to the same file that was last used for loading or saving the same module

 

Exceptions
the argument is a variable  a instantiation_error exception is thrown
the argument is not an atom a type_error(atom, A) exception is thrown
the open-mode is not readwrite a permission_error(save, module, A) exception is thrown
no module with the specified name a existence_error(module, A) exception is thrown
error while writing to file  a permission_error(write, file, A) exception is thrown

 

 

info@trinc-prolog.com