[Emacs-ada-mode] gnatgpr

Stephen Leake stephen_leake at stephe-leake.org
Sat Oct 14 13:05:44 PDT 2006


I thought of a better way to use the Ada code that parses gpr files.
This was inspired by 'pkg-config' and similar functions, that parse
files on the disk and return various sets of command options.

We should create a new executable 'gnatgpr', which can be invoked as
follows:

    gnatgpr -P<file> --source_dirs

        returns (on standard output) the complete 'Source_Dirs'
        settings for the project file (including 'with'ed files).

    gnatgpr -P<file> --object_dirs

        returns the list of object dirs for the project (including
        'with'ed files). 

In general, we can read the output of this executable in lisp, by
directing the output to a buffer and parsing the buffer, storing the
result in the appropriate ada-mode lisp variables.

Other tools could also use gnatgpr to parse gpr files.

Then, add a setting in ada-mode project files:

    compiler_project=file

ada-mode would invoke "gnatgpr -P<file> --source_dirs" to get the
source directory list for compilation-search-path, and "gnatgpr
-P<file> --object_dirs" to get the list of directories for finding
.ali files for C-c C-d.

Alternately, there could be a search algorithm for .gpr files, to
avoid the need for .adp files.

gnatgpr completely eliminates the need for gpr2adp. So I have not
posted an executable for gpr2adp, although the source is still there.

I have not started writing gnatgpr yet; I'm waiting for some feedback.
It should be a simple adaptation of the gpr2adp code.

If gnatgpr catches on, maybe AdaCore would maintain it.

If other compilers have tools similar to gnatgpr, ada-mode could use
them ('gnatgpr' would be a customizable command).

-- 
-- Stephe



More information about the Emacs-ada-mode mailing list