[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This chapter discusses some other utility programs available in the Ada environment.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The object files generated by GNAT are in standard system format and in particular the debugging information uses this format. This means programs generated by GNAT can be used with existing utilities that depend on these formats.
In general, any utility program that works with C will also often work with Ada programs generated by GNAT. This includes software utilities such as gprof (a profiling program), gnatgdb (the FSF debugger), and utilities such as Purify.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
gnatpsys
Utility Program Many of the definitions in package System are implementation-dependent. Furthermore, although the source of the package System is available for inspection, it uses special attributes for parameterizing many of the critical values, so the source is not informative for the casual user.
The gnatpsys
utility is designed to deal with this situation.
It is an Ada program that dynamically determines the
values of all the relevant parameters in System, and prints them
out in the form of an Ada source listing for System, displaying all
the values of interest. This output is generated to
`stdout'.
To determine the value of any parameter in package System, simply
run gnatpsys
with no qualifiers or arguments, and examine
the output. This is preferable to consulting documentation, because
you know that the values you are getting are the actual ones provided
by the executing system.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
gnatpsta
Utility Program Many of the definitions in package Standard are implementation-dependent. However, the source of this package does not exist as an Ada source file, so these values cannot be determined by inspecting the source. They can be determined by examining in detail the coding of `cstand.adb' which creates the image of Standard in the compiler, but this is awkward and requires a great deal of internal knowledge about the system.
The gnatpsta
utility is designed to deal with this situation.
It is an Ada program that dynamically determines the
values of all the relevant parameters in Standard, and prints them
out in the form of an Ada source listing for Standard, displaying all
the values of interest. This output is generated to
`stdout'.
To determine the value of any parameter in package Standard, simply
run gnatpsta
with no qualifiers or arguments, and examine
the output. This is preferable to consulting documentation, because
you know that the values you are getting are the actual ones provided
by the executing system.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
In order to interpret the output from GNAT, when using tools that are originally intended for use with other languages, it is useful to understand the conventions used to generate link names from the Ada entity names.
All link names are in all lowercase letters. With the exception of library procedure names, the mechanism used is simply to use the full expanded Ada name with dots replaced by double underscores. For example, suppose we have the following package spec:
package QRS is MN : Integer; end QRS; |
The variable MN
has a full expanded Ada name of QRS.MN
, so
the corresponding link name is qrs__mn
.
Of course if a pragma Export
is used this may be overridden:
package Exports is Var1 : Integer; pragma Export (Var1, C, External_Name => "var1_name"); Var2 : Integer; pragma Export (Var2, C, Link_Name => "var2_link_name"); end Exports; |
In this case, the link name for Var1 is var1_name, and the link name for Var2 is var2_link_name.
One exception occurs for library level procedures. A potential ambiguity
arises between the required name _main
for the C main program,
and the name we would otherwise assign to an Ada library level procedure
called Main
(which might well not be the main program).
To avoid this ambiguity, we attach the prefix _ada_
to such
names. So if we have a library level procedure such as
procedure Hello (S : String); |
the external name of this procedure will be _ada_hello.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
emacs
The Emacs mode for programming in Ada (both, Ada83 and Ada95) helps the user in understanding existing code and facilitates writing new code. It furthermore provides some utility functions for easier integration of standard Emacs features when programming in Ada.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
For more information, please see See section 19.5 Ada Mode for emacs
.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This Perl
script allows Ada source files to be browsed using
standard Web browsers. For installation procedure, see the section
See section 19.10 Installing gnathtml.
Ada reserved keywords are highlighted in a bold font and Ada comments in
a blue font. Unless your program was compiled with the gnatgcc -gnatx
switch to suppress the generation of cross-referencing information, user
defined variables and types will appear in a different color; you will
be able to click on any identifier and go to its declaration.
The command line is as follow:
$ perl gnathtml.pl [switches] ada-files |
You can pass it as many Ada files as you want. gnathtml
will generate
an html file for every ada file, and a global file called `index.htm'.
This file is an index of every identifier defined in the files.
The available switches are the following ones :
-83
-cc color
-d
with
command, the latter will also be converted to html.
Only the files in the user project will be converted to html, not the files
in the runtime library itself.
-D
gnathtml
will also look
for files in the runtime library, and generate html files for them.
-f
-f
on the command line, then links will be generated for local
entities too.
-l number
gnathtml
will number the html files every number line.
-I dir
-o dir
-p file
Using this switch, you can tell gnathtml to use these files. This allows you to get an html version of your application, even if it is spread over multiple directories.
-sc color
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Perl
needs to be installed on your machine to run this script.
Perl
is freely available for almost every architecture and
Operating System via the Internet.
On Unix systems, you may want to modify the first line of the script
gnathtml
, to explicitly tell the Operating system where Perl
is. The syntax of this line is :
#!full_path_name_to_perl |
Alternatively, you may run the script using the following command line:
$ perl gnathtml.pl [switches] files |
[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |