The Prolog Search finds code loaded into the Prolog process that is currently selected in the Prolog Console. It will not find predicates in files that are not consulted! If you want a textual search, use the textual search dialog that is standard in Eclipse.
There are three ways to run a search:
The following options are supported:
- Exact matches only: If selected only modules and predicates whose name is equal to the search string will be found. If not selected modules and predicates whose name contains the search string will be found.
- Search for
- Module/Entity: Enter the module name as search string. If
modis the searched module name the search will find
- all explicit references (of the form
- all implicit references (of the form
predif pred is imported from
mod, typically via a use_module directive)
- Predicates: Enter the search string as PredicateSymbol/Arity. If no arity is specified, all matching predicate symbols will be found, regardless of arity.
- Limit to
- Declarations & Definitions: Search for all declarations and definitions of entities or predicates whose name (and arity in case of predicates) matches the search string.
Three different problem searches are possible:
- Undefined Call: Search for undefined calls.
- Dead Predicate: Search for dead predicates, i.e. search for predicates which are not called (directly or indirectly) from entry points. There has to be at least one entry point to be able run this search. Entry points are:
- all exported predicates of Entry Point Files,
- all exported predicates of modules specified by the multifile predicate
- all predicates specified by the multifile predicate
pdt_call_analysis:entry_point/1(the expected format is
- Undeclared Meta Predicate: Search for undeclared or wrongly declared meta predicates.
For each search it is possible to use the Create Warnings option. If enabled a persistent Eclipse marker will be created for each search result.
The results of the Prolog Search are presented in the Search View. The following elements are shown in this view:
This is how search results for different search options look like. The searches were performed on the PDT Tutorial Project.
You can start the search for predicates directly from the editor.
The search for predicate declarations and definitions from the editor will find the same results like the global search via the search dialog but the results will contain information regarding the context (current file) of the search:
- super: predicate is defined in a module that is imported by the module of the current file
- local: predicate is defined in the current file
- sub: predicate is defined in a module that imports the module of the current file
- invisible: predicate is defined in a module that has no import relation to the current file
The “invisible” category is intended to make programmers aware of unrelated but homonymous predicates that could lead to confusion.
If results on multiple categories are found the categories are ordered as shown above (supermodules, local module, submodules and invisible predicates).
The reference search in the editor will find exactly the same results as the global reference search.
Sometimes you might want to search for a predicate mentioned in a console message. For example, after a message about a call to an undefined predicate you might want to find all other references to it.
For this, select the predicate name (or full predicate indicator name/arity) in the console and choose “Open Search Dialog” from the context menu. The Prolog Search dialog will be opened with the current text selection in the Prolog Console as input.
|The highlighted text…||…is the input for the search dialog.|