3.8 Accessing the IDE from your program

Over the years a collection of IDE components have been developed, each with its own interface. In addition, some of these components require each other, and loading IDE components must be on demand to avoid the IDE being part of a saved state (see qsave_program/2). For this reason, access to the IDE is concentrated on a single interface called prolog_ide/1:

prolog_ide(+Action)
This predicate ensures the IDE-enabling XPCE component is loaded, creates the XPCE class prolog_ide and sends Action to its one and only instance @prolog_ide. Action is one of the following:
open_navigator
open_navigator(+Directory)
Open the Prolog Navigator (see section 3.6), rooted at Directory or, without argument, at the common directory of the loaded source files.
open_debug_status
Open a window to edit spy and trace points.
open_query_window
Open a little window to run Prolog queries from a GUI component.
thread_monitor
Open a graphical window indicating existing threads and their status. The diagram of a thread shows its stacks, private tables and CPU usage and, while it has incomplete tables, their number and the number of strongly connected components (SCCs) per incomplete table in percent. A few percent hints at badly structured rules, more than 30% that keeps growing at recursion over growing terms. The popup of a thread shows its incomplete tables (see sdg_viewer).
memory_viewer
Open a window that shows how Prolog uses its memory: per module and predicate, per thread (stacks, thread-local data and private tables), the tables, the objects of xpce per class and an overview of the process. The memory is shown as rings or as a treemap, in which a part can be zoomed into.
idg_viewer
Open a window that shows the incremental dependency graph (IDG) of a thread: which incremental dynamic predicates and incremental tables affect which tables. As the profiler, it has a browser of the predicates involved with a filter and shows the graph around the current predicate: what affects it on the left and what it affects on the right. Clicking a node makes it the current predicate; clicking the current predicate shows its call patterns, e.g., p(+,-), as a box holding them; the popup of any predicate does so as well. A node ... N more stands for relatives that are not shown; its popup shows them all. The popup of a predicate or call pattern can show its variants with their number of answers in a pane of their own, ten at a time, filtered on their text and on having answers. Selecting a variant shows its answers, where undefined answers are marked as such; they have a filter of their own. This pane is reused for the next predicate unless it is pinned. The Overview tab shows the graph by module and, for the non-modular code in user, by file; clicking a group shows it as a box holding its parts. Predicates and nodes that hold invalid tables are shown in red. The browser shows the incremental dynamic predicates in italics. Requires Graphviz.
sdg_viewer
sdg_viewer(+Thread)
Open a window that shows the incomplete tables of a thread (default main): the subgoal dependency graph (SDG) that tells why a tabled computation does not complete. At the level of variants the tables are shown in boxes for their strongly connected components (SCCs), nested as the SCCs are; at the level of predicates, used by default for more than 60 tables, clicking a predicate shows its tables. An edge from a table to another says that the first waits for answers of the second; edges of tnot/1 are red and dashed. Tables grow with their number of answers, the leader of an SCC has a double outline, a table with work left a thick one and one with conditional answers is yellow. The thread is interrupted using call_in_thread/3 to read its tables. The viewer is in the Tabling submenu of the Debug menu and in the popup of the thread monitor. It also opens if a break starts while the thread has incomplete tables, such as a break of a tripwire (see section 7.11) with action suspend, unless the setting prolog_ide.tables_on_break is false. Requires Graphviz.
debug_monitor
Open a graphical front-end for the library(debug) library that provides an overview of the topics and catches messages.
xref
Open a graphical front-end for the cross-referencer that provides an overview of predicates and their callers.