The atom or string File must be instantiated to a legitimate specification for an existing file except for the suffix. The predicate first checks whether the File exists and if so, File is taken as the literal file name. If File does not exist, the predicate tries to add to it the Prolog suffixes from the list specified in the Prolog flag prolog_suffix. The suffix .sd is not considered, because loading and dumping the same file does nothing useful. As soon as a file is found which exists, it is taken as the input file name. The default Prolog suffixes are .sd and .pl.
The name of the dump file is the same as that of the input file, but its suffix is replaced by (or added) .sd (ECLiPSe dump). The whole contents of the input file, including predicate definitions and queries, is stored into the dump file. The queries in the input file are processed in a special way, some of them are executed to allow correct reading of the input file, others are only transformed to the internal form and written into the dump file. The queries being executed are ','/2, ';'/2, op/3, local_op/3, set_flag/2, get_flag/2, define_global_macro/3, define_local_macro/3, ./2, compile/1, set_chtab/2, call/1, cprolog/1, bsi/1, sicstus/1 and quintus/1.
If compile/1 or ./2 (e.g. [File]) are encountered as queries in the input file, the query is replaced by dump/1 and the corresponding files are recursively dumped into their dump files. Unlike in the compile/1 predicate, relative pathnames are interpreted as starting in the current working directory, and not in the directory of the file being dumped (this prevents accidental creation of dump files in other directories).
If File is a list of file names, all files in the list are dumped into their corresponding dump files. It is not possible to dump several input files into one dump file, however it is possible to concatenate any number of dump files into one dump file, which has the same effect as concatenating all input files into one input file and dumping it.
Success: [eclipse]: dump(country). country.pl dumped yes. % the .sd file is found first and loaded faster [eclipse]: [country, 'country.pl']. /home/eclipse/country.sd loaded 31152 bytes in 0.27 seconds /home/eclipse/country.pl compiled 31152 bytes in 0.53 seconds Error: dump(F). (Error 4). dump(file1/1). (Error 5). dump(nofile). (Error 171).