Table Of Contents

Previous topic

12. Version Control System

Next topic

14. Working in a Cross Environment

This Page

13. Tools

13.1. The Tools Menu

The Tools menu gives access to additional tools. Some items are currently disabled, meaning that these are planned tools not yet available.

The list of active items includes:

Views

Bookmarks

Bookmarks.

Call Trees

Open a tree view of function callers and callees. See also

Call Graph.

Clipboard
The Clipboard View.
Coverage Report
Coverage Report.
Entities

Open the Entity View in the bottom area

The Entity View.

Files

Open a file system explorer on the left area.

The File View.

File Switches
File Switches.
Outline

Open a view of the current source editor.

The Outline View.

Messages

Open the Messages winbdow

The Messages Window.

Project
The Project View.
Remote
Setup a remote project.
Scenario
Scenarios and Configuration Variables.
Tasks
The Task Manager.
VCS Activities
The VCS Activities.
VCS Explorer
The VCS Explorer.
Windows

Open a view containing all currently opened files.

The Window View.

Browsers

Call Graph
Call Graph.
Dependency
Dependency Browser.
Elaboration Cycles
Elaboration Cycles Browser.
Entity
Entity Browser.
Coding Standard

Coding Standard.

Compare

Visual Comparison.

Consoles

GPS Shell

Open a shell console at the bottom area of GPS. Note that this not an OS shell console, but a GPS shell console, where you can type GPS specific commands such as help.

The Shell and Python Windows.

Python

Open a python console to access the python interpreter. The Shell and Python Windows.

OS Shell

Open an OS (Windows or Unix) console, using the environment variables SHELL and COMSPEC to determine which shell to use. The Shell and Python Windows.

On Unix, this terminal behaves a lot like a standard Unix terminal. In particular, you need to make sure that your shell will output all the information. In some cases, the configuration of your shell (.bashrc if you are running bash for instance) will deactivate the echo of what you type to the terminal. Since GPS is not outputing anything on its own, just showing what the shell is outputing, you need to somehow ensure that your shell always echos what you type. This is done by running the command:

stty echo

in such cases. In general, this can be safely done in your .bashrc

Auxiliary Builds
Open the console containing auxiliary builds output. For now, only cross-reference automated generation output is redirected to this console. Working with two compilers.
Coverage

Code Coverage.

Documentation

Documentation Generation.

GNATtest

Working With Unit Tests.

Stack Analysis

Stack Analysis.

Macro

Recording and replaying macros.

Metrics

Metrics.

Plug-ins

The Plug-ins Editor.

Interrupt

Interrupt the last task launched (e.g. compilation, vcs query, ...).

13.2. Coding Standard

The Coding Standard menu allows you to edit your coding standard file, as can be understood by gnatcheck, as well as run it against your code, to verifiy its compliance with this coding standard.

Note that you can also use the contextual menu to check the conformance of a particular project or source file against a Coding Standard.

The Coding standard editor is triggered by the menu Tools->Coding Standard->Edit Rules File. The editor allows you to select an existing coding standard file, or create a new one. The editor adapts itself to the version of gnatcheck you are using on your local machine.

The currently used rules are summarized in the bottom of the editor. Once all rules are defined, you can check the box ‘Open rules file after exit’ to manually verify the created file.

Once the Coding Standard file is created, you can define it as the default coding standard file for a project by going to the project editor, selecting the ‘Switches’ tab, and using this file in the ‘Gnatcheck’ section.

13.3. Visual Comparison

The visual comparison, available either from the VCS menus or from the Tools menu, provide a way to display graphically differences between two or three files, or two different versions of the same file.

The 2-file comparison tool is based on the standard text command diff, available on all Unix systems. Under Windows, a default implementation is provided with GPS, called gnudiff.exe. You may want to provide an alternate implementation by e.g. installing a set of Unix tools such as cygwin (http://www.cygwin.com).

The 3-file comparison tool is based on the text command diff3, available on all Unix systems. Under Windows, this tool is not shipped with GPS. It is available as part of cygwin, for example.

When querying a visual comparison in GPS, in Side_By_Side mode, the user area will show, side by side, editors for the files involved in the comparison. The reference file is placed by default on the left side. When in Unified mode, GPS will not open a new editor, but will show all the changes directly in the original editor. Note that Unified mode is relevant only when comparing two files: when comparing three files, the Side_By_Side mode is used.

Color highlighting will be added to the file editors:

gray
This color is used for all the chunks on the reference (left) file. Only the modified (right) file is displayed with different colors.
yellow
This color is used to display lines that have been modified compared to the reference file. When there are fine differences within one line, they are shown in a brighter yellow.
green
Used to display lines added compared to the reference file; in other words, lines that are not present in the reference file.
red
Used to display lines removed from the reference file; in other words, lines that are present only in the reference file.

These colors can be configured, The Preferences Dialog.

As with all highlighted lines in GPS, the visual differences highlights are visible in the Speed Column at the left of the editors.

Blank lines are also added in the editors, in places that correspond to existing lines in the other editors. The vertical and horizontal scrolling are synchronized between all editors involved in a visual comparison.

When a visual comparison is created, the Locations View is populated with the entries for each chunk of differences, and can be used to navigate between those.

Closing one of the editors involved in a visual comparison removes the highlighting, blank lines, and scrolling in the other editors.

Editors involved in a visual comparison have a contextual menu Visual diff that contains the following entries:

Recompute
Regenerates the visual comparison. This is useful, for example, when one of the editors has been modified by hand while it was involved in a visual comparison
Hide
Removes the highlighting corresponding to the visual comparison from all editors involved
Close editors
Closes all editors involved in this visual comparison
Use this editor as reference
Change the reference to this editor. (This is only visible when displaying a visual comparison involving 3 files).
_images/visual-diff.jpg

13.4. Code Fixing

GPS provides an interactive way to fix or improve your source code, based on messages (errors and warnings) generated by the GNAT compiler.

This capability is integrated with the Locations View (see The Locations View): when GPS can take advantage of a compiler message, an icon is added on the left side of the line.

For a simple fix, a wrench icon is displayed. If you click with the left button on this icon, the code will be fixed automatically, and you will see the change in the corresponding source editor. An example of a simple fix, is the addition of a missing semicolon.

You can also check what action will be performed by clicking on the right button which will display a contextual menu with a text explaining the action that will be performed. Similarly, if you display the contextual menu anywhere else on the message line, a sub menu called Auto Fix gives you access to the same information. In the previous example of a missing semicolon, the menu will contain an entry labelled Add expected string ”;”. Two nested menu items let you choose to Apply to this occurrence or Apply to all similar errors. Latter choice will apply the same simple fix for all errors which are detected by the system as being the same kind. This is based on message parsing.

Once the code change has been performed, the tool icon is no longer displayed.

For more complex fixes, where more than one change is possible, a wrench icon with a blue plus sign is displayed. In this case, clicking on the icon will display the contextual menu directly, giving you access to the possible choices. For example, this will be the case when an ambiguity is reported by the compiler for resolving an entity.

Right clicking on a message with a fix will open a contextual menu with an entry “Auto Fix”. Fixes that can be applied by clicking on the wrench are available through that menu as well. In addiditon, if one of the fixes is considered to be safe by GPS, additional entries will be provided to apply fixes on multiple messages:

Fix all simple style errors and warnings
This entry is offered only when the selected message is a warning and a style error. Will fix all other warnings and style errors for which a unique simple fix is available.
Fix all simple errors
Will fix all errors messages for which a unique simple fix is available

13.5. Documentation Generation

GPS provides a documentation generator which processes source files and generates annotated HTML files.

It is based on the source cross-reference information (e.g. generated by GNAT for Ada files). This means that you