A.32 library(prolog_xref): Cross-reference data collection library
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
      • The SWI-Prolog library
        • library(prolog_xref): Cross-reference data collection library
          • xref_source/1
          • xref_current_source/1
          • xref_clean/1
          • xref_defined/3
          • xref_called/3
          • xref_exported/2
          • xref_module/2
          • xref_built_in/1
          • Extending the library
            • called_by/2
    • Packages

A.32.1 Extending the library

The library provides hooks for extending the rules it uses for finding predicates called by some programming construct.

prolog:called_by(+Goal, -Called)
Goal is a non-var subgoal appearing in the called object (typically a clause body). If it succeeds it must return a list of goals called by Goal. As a special construct, if a term Callable+N is returned, N variable arguments are added to Callable before further processing. For simple meta-calls a single fact suffices. Complex rules as used in the library(html_write) library provided by the HTTP package examine the arguments and create a list of called objects.

The current system cannot deal with the same name/arity in different modules that behave differently with respect to called arguments.