Next: , Previous: gnatxref Switches, Up: The Cross-Referencing Tools gnatxref and gnatfind


12.2 gnatfind Switches

The command line for gnatfind is:

     $ gnatfind [switches] pattern[:sourcefile[:line[:column]]]
           [file1 file2 ...]

where

pattern
An entity will be output only if it matches the regular expression found in `pattern', see See Regular Expressions in gnatfind and gnatxref.

Omitting the pattern is equivalent to specifying `*', which will match any entity. Note that if you do not provide a pattern, you have to provide both a sourcefile and a line.

Entity names are given in Latin-1, with uppercase/lowercase equivalence for matching purposes. At the current time there is no support for 8-bit codes other than Latin-1, or for wide characters in identifiers.

sourcefile
gnatfind will look for references, bodies or declarations of symbols referenced in sourcefile, at line `line' and column `column'. See see Examples of gnatfind Usage for syntax examples.
line
is a decimal integer identifying the line number containing the reference to the entity (or entities) to be located.
column
is a decimal integer identifying the exact location on the line of the first character of the identifier for the entity reference. Columns are numbered from 1.
file1 file2 ...
The search will be restricted to these files. If none are given, then the search will be done for every library file in the search path. These file must appear only after the pattern or sourcefile.

These file names are considered to be regular expressions, so for instance specifying 'source*.adb' is the same as giving every file in the current directory whose name starts with 'source' and whose extension is 'adb'.

Not that if you specify at least one file in this part, gnatfind may sometimes not be able to find the body of the subprograms...

At least one of 'sourcefile' or 'pattern' has to be present on the command line.

The following switches are available:

-a
If this switch is present, gnatfind and gnatxref will parse the read-only files found in the library search path. Otherwise, these files will be ignored. This option can be used to protect Gnat sources or your own libraries from being parsed, thus making gnatfind and gnatxref much faster, and their output much smaller.
-aIDIR
When looking for source files also look in directory DIR. The order in which source file search is undertaken is the same as for gnatmake.
-aODIR
When searching for library and object files, look in directory DIR. The order in which library files are searched is the same as for gnatmake.
-nostdinc
Do not look for sources in the system default directory.
-nostdlib
Do not look for library files in the system default directory.
--RTS=rts-path
Specifies the default location of the runtime library. Same meaning as the equivalent gnatmake flag (see Switches for gnatmake).
-d
If this switch is set, then gnatfind will output the parent type reference for each matching derived types.
-e
By default, gnatfind accept the simple regular expression set for `pattern'. If this switch is set, then the pattern will be considered as full Unix-style regular expression.
-f
If this switch is set, the output file names will be preceded by their directory (if the file was found in the search path). If this switch is not set, the directory will not be printed.
-g
If this switch is set, information is output only for library-level entities, ignoring local entities. The use of this switch may accelerate gnatfind and gnatxref.
-IDIR
Equivalent to `-aODIR -aIDIR'.
-pFILE
Specify a project file (see Project Files) to use. By default, gnatxref and gnatfind will try to locate a project file in the current directory.

If a project file is either specified or found by the tools, then the content of the source directory and object directory lines are added as if they had been specified respectively by `-aI' and `-aO'.

-r
By default, gnatfind will output only the information about the declaration, body or type completion of the entities. If this switch is set, the gnatfind will locate every reference to the entities in the files specified on the command line (or in every file in the search path if no file is given on the command line).
-s
If this switch is set, then gnatfind will output the content of the Ada source file lines were the entity was found.
-t
If this switch is set, then gnatfind will output the type hierarchy for the specified type. It act like -d option but recursively from parent type to parent type. When this switch is set it is not possible to specify more than one file.

All these switches may be in any order on the command line, and may even appear after the file names. They need not be separated by spaces, thus you can say `gnatxref -ag' instead of `gnatxref -a -g'.

As stated previously, gnatfind will search in every directory in the search path. You can force it to look only in the current directory if you specify * at the end of the command line.