11.3.214 source_file/[1,2]

Synopsis

source_file(?AbsFile)

source_file(?Pred, ?AbsFile)

AbsFile is the absolute name of a loaded file, and Pred is a predicate with clauses in that file.

Arguments

:Pred
callable

Selected predicate specification.

AbsFile
atom

Absolute filename.

Description

Loaded files include compiled, consulted, restored, PO loaded and pre-linked files.

If AbsFile is bound and not the name of a loaded file, or if Pred is bound and not the name of a a loaded predicate, then source_file(AbsFile) simply fails.

To find any predicates defined in a given file, use the form:

     source_file(M:P, File)

Examples

Suppose that the startup file ~/.sicstusrc defines a predicate user:cd/1. Then upon startup:

     | ?- source_file(F).
     F = '/src/sicstus/matsc/sicstus4/Utils/x86-linux-glibc2.3/bin/sp-4.1.0/sicstus-4.1.0/library/SU_messages.pl' ? <;>
     F = '/home/matsc/.sicstusrc' ? <;>
     no
     
     | ?- source_file(P,F).
     F = '/home/matsc/.sicstusrc',
     P = cd(_A) ? <;>
     no
     
     | ?- source_file('SU_messages':P,F).
     F = '/src/sicstus/matsc/sicstus4/Utils/x86-linux-glibc2.3/bin/sp-4.1.0/sicstus-4.1.0/library/SU_messages.pl',
     P = query_class(_A,_B,_C,_D,_E) ? <RET>
     yes

See Also

ref-lps-apf.


Send feedback on this subject.