Developer Tools

Paulo Moura edited this page Jan 17, 2017 · 37 revisions

Text editing and code publishing support

Logtalk includes support for several text editors (providing text editing services such as syntax highlight, code completion, code folding, code navigation, templates, and snippets) and syntax highlighters (used for publishing source code on e.g Trac, Wikis, and web pages):

Logtalk make features

Logtalk provides built-in logtalk_make/0-1 predicates that can be used to reload all Logtalk source files that have been modified since last loaded, to delete all intermediate files generated by the compilation of Logtalk source files, to list missing entities and predicates, and to list circular dependencies between pairs or trios of objects:

Logtalk assertions tool

This tool provides two meta-predicates, assertion/1-2, which allows using of assertions on your source code. Several usage scenarios are described in the tool documentation:

Logtalk dead code scanner

This tool detects likely dead code in Logtalk entities and in Prolog modules compiled as objects:

Logtalk debugger

Logtalk includes a source-level debugger tool, which implements an enhanced version of procedure box model found on most Prolog compilers:

This debugger supports not only traditional predicate spy points but also line number spy points and context spy points:

Logtalk port profiler

Logtalk includes a predicate execution box model port profiler tool, ports, which counts and reports the number of times each port is traversed during the execution of queries:

This tool can be used for performance analysis, helping to detect e.g. unwanted non-determinism and predicate calls that always fail.

Logtalk documenting tool

Logtalk includes a source documenting tool, lgtdoc, which uses reflection to extract and output to XML files documenting information about compiled source files:

The tool includes ready to use scripts and stylesheets to convert the generated XML documenting files to e.g. Markdown, (X)HTML, and PDF.

Logtalk diagram tools

Logtalk includes diagram tools that can generate .dot files, which can easily be converted into several formats such as SVG and PDF:

The file diagrams helps tracking file loading and file entity dependencies. The entity diagrams can document all entities on a source file or all entities on a library of source files, showing entity relations such as inheritance and usage information. The predicate call diagrams show call graphs with detailed predicate cross-referencing information. For large applications, there is also support for library loading and library entity dependency diagrams. See the diagrams tool in the current Logtalk distribution for details.

This tool can also be used, with some limitations, to generate diagrams for Prolog module applications.

Logtalk doclet tool

A simple tool for automating (re)generating documentation for a project. It allows the specification of the sequence of goals and shell commands required to produce documentation in its final format:

Logtalk unit testing tool

Logtalk includes a unit test tool, lgtunit, which supports several dialects for writing unit tests with optional full code coverage analysis:

Other highlights include support for testing automation, test set timeout options, determinism tests, testing of input/output predicates, and QuickCheck. Support is also provided for writing test results in TAP (Test Anything Protocol) and xUnit XML formats for use with continuous integration servers.

Logtalk code metrics tool

Logtalk includes an user-extensible code metrics tool, code_metrics:

Logtalk on-line help

Basic help is available from the Logtalk interpreter command-line. See the help tool in the current Logtalk distribution for details:

Logtalk porting tool

A preliminary porting tool for plain Prolog code is available. See the wrapper tool notes for details at:

Integration with SWI-Prolog native tools

Logtalk supports SWI-Prolog edit/1, make/0, consult/1, and load_files/2 (to load Logtalk source files) predicates, the graphical profiler, and the graphical tracer. Recent versions of both Logtalk and SWI-Prolog are required. See the settings-sample.lgt file for the necessary settings to use the graphical tracer.

Integration with YAP native profilers

Logtalk supports the YAP tick and count profilers. See the profiler tool in the current Logtalk distribution for details.

Integration with SICStus Prolog native profilers

Logtalk supports the SICStus Prolog 4 profiler. See the profiler tool in the current Logtalk distribution for details.

Integration with PDT

PDT is a free Prolog IDE provided as a plug-in for the Eclipse IDE. PDT is being extended with Logtalk support.

PDT currently requires a recent version of SWI-Prolog. It's possible to start up Logtalk automatically by configuring PDT runtime preferences. The configuration depends on the operating-system. After installing Logtalk and setting the LOGTALKHOME and LOGTALKUSER environment variables, open Eclipse preferences, select PDT runtime preferences, and enter the following configuration data for the SWI-Prolog executable and for the extra environment variables (change the paths to match your SWI-Prolog and Logtalk installations and your home directory):

  • Mac OS X:

      /Users/pmoura/bin/swipl -s /opt/local/share/logtalk/integration/
      DISPLAY=:0.0, HOME=/Users/pmoura, LOGTALKHOME=/opt/local/share/logtalk, LOGTALKUSER=/Users/pmoura/logtalk

Notes: full paths should be used; no quotes should be used.

  • Windows:

      cmd.exe /c start "cmdwindow" /min "C:\Program Files\pl\bin\swipl-win.exe" -f "%LOGTALKHOME%\integration\"

Notes: if you're using a recent SWI-Prolog development version you may use the -s option instead of -f.

  • Linux:

      /usr/bin/swipl -L4m -G4m -T4m -s /usr/share/logtalk/integration/
      LOGTALKHOME=/usr/share/logtalk, LOGTALKUSER=/home/pmoura/logtalk

Notes: full paths should be used; no quotes should be used.

Compiling Logtalk source files with the source_data flag turned on is necessary for using PDT. Currently supported PDT features include consulting Logtalk source files, the source file outline (which requires the source code to be consulted first), and selecting a goal and searching for all declarations and definitions (you must select the whole goal and control-click on the selection).