source_file(*Pred, *AbsFile)

source_file(*Pred, *ClauseNumber, *AbsFile)

AbsFile is the absolute name of a loaded file, and ClauseNumber is the number of a clause for Pred in that file.


Pred callable [MOD]
selected predicate specification.
ClauseNumber integer
integer representing clause number
AbsFile atom
absolute filename


Loaded files include compiled, QOF loaded and pre-linked files.

If AbsFile is not the name of a loaded file, then source_file(AbsFile) simply fails. If AbsFile is bound to an illegal filename, source_file/1 fails.

If Pred is not a loaded predicate, then source_file/2 simply fails. If bound to an illegal predicate specification, it fails. Pred is assumed to refer to the source module. Thus, to find any predicates defined in a given file, use the form:

     source_file(M:P, File)

source_file/3 is true if clause number ClauseNumber of predicate Pred comes from file AbsFile. source_file/3 is useful for handling multifile predicates, but it works for predicates defined completely in one file, as well.

Any combination of bound and unbound arguments is possible, and source_file/3 will generate the others.


If AbsFile is unbound, it is successively unified with the absolute names of all currently loaded files. Files loaded through the foreign function interface are not reported by source_file/1.

If Pred is instantiated to the skeletal specification of a loaded predicate, then AbsFile will be successively unified with the absolute names of the files in which the Pred was defined.

If AbsFile is instantiated to the absolute name of a loaded file, then Pred will be successively unified with the skeletal specifications of all predicates defined in AbsFile.

See Also

absolute_file_name/[2,3], multifile/1