diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2014-08-01 10:58:50 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2014-08-01 10:58:50 +0200 |
commit | d77cfab2813d0921344f74c219ec3e4a173aa3f1 (patch) | |
tree | 1142a04682934a8780528bde27cb0ae6f0707e7d /gcc/ada | |
parent | c84495c0e1f09b876c4db803a9436632eed74cb1 (diff) | |
download | gcc-d77cfab2813d0921344f74c219ec3e4a173aa3f1.zip gcc-d77cfab2813d0921344f74c219ec3e4a173aa3f1.tar.gz gcc-d77cfab2813d0921344f74c219ec3e4a173aa3f1.tar.bz2 |
[multiple changes]
2014-08-01 Gary Dismukes <dismukes@adacore.com>
* makeutl.ads, opt.ads: Minor grammar fixes.
* makeutl.adb: Minor code reorganization.
2014-08-01 Arnaud Charlet <charlet@adacore.com>
* gcc-interface/Makefile.in, gcc-interface/Make-lang.in,
gnatsym.adb: Remove gnatsym (VMS only tool).
2014-08-01 Ben Brosgol <brosgol@adacore.com>
* gnat_ugn.texi, projects.texi, xgnatugn.adb: Removed all VMS
conditionalization from gnat_ugn.texi and projects.texi, and updated
(considerably simplified) xgnatugn.adb, to be removed soon.
From-SVN: r213427
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/ChangeLog | 16 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/Make-lang.in | 6 | ||||
-rw-r--r-- | gcc/ada/gcc-interface/Makefile.in | 5 | ||||
-rw-r--r-- | gcc/ada/gnat_ugn.texi | 8401 | ||||
-rw-r--r-- | gcc/ada/gnatsym.adb | 359 | ||||
-rw-r--r-- | gcc/ada/makeutl.adb | 2 | ||||
-rw-r--r-- | gcc/ada/makeutl.ads | 4 | ||||
-rw-r--r-- | gcc/ada/opt.ads | 2 | ||||
-rw-r--r-- | gcc/ada/projects.texi | 684 | ||||
-rw-r--r-- | gcc/ada/xgnatugn.adb | 1071 |
10 files changed, 3061 insertions, 7489 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 502df3e..29fe77f 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,19 @@ +2014-08-01 Gary Dismukes <dismukes@adacore.com> + + * makeutl.ads, opt.ads: Minor grammar fixes. + * makeutl.adb: Minor code reorganization. + +2014-08-01 Arnaud Charlet <charlet@adacore.com> + + * gcc-interface/Makefile.in, gcc-interface/Make-lang.in, + gnatsym.adb: Remove gnatsym (VMS only tool). + +2014-08-01 Ben Brosgol <brosgol@adacore.com> + + * gnat_ugn.texi, projects.texi, xgnatugn.adb: Removed all VMS + conditionalization from gnat_ugn.texi and projects.texi, and updated + (considerably simplified) xgnatugn.adb, to be removed soon. + 2014-08-01 Vincent Celier <celier@adacore.com> * debug.adb: Remove doc for gnatmake/gprbuild switch -ds. diff --git a/gcc/ada/gcc-interface/Make-lang.in b/gcc/ada/gcc-interface/Make-lang.in index 11a97b4..4b87997 100644 --- a/gcc/ada/gcc-interface/Make-lang.in +++ b/gcc/ada/gcc-interface/Make-lang.in @@ -89,7 +89,7 @@ ADA_FLAGS_TO_PASS = \ # List of Ada tools to build and install ADA_TOOLS=gnatbind gnatchop gnat gnatkr gnatlink gnatls gnatmake \ - gnatname gnatprep gnatxref gnatfind gnatclean gnatsym + gnatname gnatprep gnatxref gnatfind gnatclean # Say how to compile Ada programs. .SUFFIXES: .ada .adb .ads @@ -763,8 +763,7 @@ doc/gnat-style.pdf: ada/gnat-style.texi $(gcc_docdir)/include/fdl.texi # or from the --target option if the former is not specified. # Do the same for the rest of the Ada tools (gnatchop, gnat, gnatkr, # gnatlink, gnatls, gnatmake, gnatname, gnatprep, gnatxref, gnatfind, -# gnatclean, gnatsym). -# gnatsym is only built on some platforms, including VMS. +# gnatclean). # gnatdll is only used on Windows. # vxaddr2line is only used for cross VxWorks ports (it calls the underlying # cross addr2line). @@ -840,7 +839,6 @@ ada.distclean: -$(RM) gnatfind$(exeext) -$(RM) gnatxref$(exeext) -$(RM) gnatclean$(exeext) - -$(RM) gnatsym$(exeext) -$(RM) ada/rts/* -$(RMDIR) ada/rts -$(RM) ada/tools/* diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in index fcb632b..892119b 100644 --- a/gcc/ada/gcc-interface/Makefile.in +++ b/gcc/ada/gcc-interface/Makefile.in @@ -2544,11 +2544,6 @@ common-tools: ../stamp-tools $(GNATLINK) -v gnatclean -o ../../gnatclean$(exeext) \ --GCC="$(GCC_LINK)" $(TOOLS_LIBS) -../../gnatsym$(exeext): ../stamp-tools - $(GNATMAKE) -c $(ADA_INCLUDES) gnatsym --GCC="$(CC) $(ALL_ADAFLAGS)" - $(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatsym - $(GNATLINK) -v gnatsym -o $@ --GCC="$(GCC_LINK)" $(TOOLS_LIBS) - ../../gnatdll$(exeext): ../stamp-tools $(GNATMAKE) -c $(ADA_INCLUDES) gnatdll --GCC="$(CC) $(ALL_ADAFLAGS)" $(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) gnatdll diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi index 8e7b4fb..83be002 100644 --- a/gcc/ada/gnat_ugn.texi +++ b/gcc/ada/gnat_ugn.texi @@ -75,10 +75,6 @@ Texts. A copy of the license is included in the section entitled @c This command inhibits page breaks, so long examples in a @cartouche can @c lead to large, ugly patches of empty space on a page. @c -@c NOTE: This file should be submitted to xgnatugn with either the vms flag -@c or the unw flag set. The unw flag covers topics for both Unix and -@c Windows. -@c @c oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo @set NOW January 2007 @@ -91,15 +87,7 @@ Texts. A copy of the license is included in the section entitled @set FSFEDITION @set EDITION GNAT -@ifset unw @set PLATFORM -@set TITLESUFFIX -@end ifset - -@ifset vms -@set PLATFORM OpenVMS -@set TITLESUFFIX for OpenVMS -@end ifset @c @ovar(ARG) @c ---------- @@ -116,7 +104,7 @@ Texts. A copy of the license is included in the section entitled @c of the @ovar macro have been expanded inline. -@settitle @value{EDITION} User's Guide @value{TITLESUFFIX} +@settitle @value{EDITION} User's Guide @dircategory GNU Ada tools @direntry * @value{EDITION} User's Guide: (gnat_ugn). @value{PLATFORM} @@ -130,12 +118,6 @@ Texts. A copy of the license is included in the section entitled @titlepage @title @value{EDITION} User's Guide -@ifset vms -@sp 1 -@flushright -@titlefont{@i{@value{PLATFORM}}} -@end flushright -@end ifset @sp 2 @@ -181,19 +163,15 @@ AdaCore@* * The Cross-Referencing Tools gnatxref and gnatfind:: @ifclear FSFEDITION * The GNAT Pretty-Printer gnatpp:: -@ifclear vms * The Ada-to-XML converter gnat2xml:: -@end ifclear * The GNAT Metrics Tool gnatmetric:: @end ifclear * File Name Krunching with gnatkr:: * Preprocessing with gnatprep:: * The GNAT Library Browser gnatls:: * Cleaning Up with gnatclean:: -@ifclear vms * GNAT and Libraries:: * Using the GNU make Utility:: -@end ifclear * Memory Management Issues:: * Stack Related Facilities:: @ifclear FSFEDITION @@ -204,13 +182,8 @@ AdaCore@* * Performing Dimensionality Analysis in GNAT:: * Generating Ada Bindings for C and C++ headers:: * Other Utility Programs:: -@ifclear vms * Code Coverage and Profiling:: -@end ifclear * Running and Debugging Ada Programs:: -@ifset vms -* Compatibility with HP Ada:: -@end ifset * Platform-Specific Information for the Run-Time Libraries:: * Example of Binder Output File:: * Elaboration Order Handling in GNAT:: @@ -229,17 +202,9 @@ AdaCore@* @unnumbered About This Guide @noindent -@ifset vms -This guide describes the use of @value{EDITION}, -a compiler and software development toolset for the full Ada -programming language, implemented on OpenVMS for HP's Alpha and -Integrity server (I64) platforms. -@end ifset -@ifclear vms This guide describes the use of @value{EDITION}, a compiler and software development toolset for the full Ada programming language. -@end ifclear It documents the features of the compiler and tools, and explains how to use them to build Ada applications. @@ -342,12 +307,10 @@ comment placement, and other elements of program presentation style. @end ifclear @ifclear FSFEDITION -@ifclear vms @item @ref{The Ada-to-XML converter gnat2xml}, shows how to convert Ada source code into XML. @end ifclear -@end ifclear @ifclear FSFEDITION @item @@ -376,7 +339,6 @@ on the corresponding sources files, and consistency of compilations. @ref{Cleaning Up with gnatclean}, describes @code{gnatclean}, a utility to delete files that are produced by the compiler, binder and linker. -@ifclear vms @item @ref{GNAT and Libraries}, describes the process of creating and using Libraries with GNAT. It also describes how to recompile the GNAT run-time @@ -385,18 +347,15 @@ library. @item @ref{Using the GNU make Utility}, describes some techniques for using the GNAT toolset in Makefiles. -@end ifclear @item @ref{Memory Management Issues}, describes some useful predefined storage pools and in particular the GNAT Debug Pool facility, which helps detect incorrect memory references. -@ifclear vms @ifclear FSFEDITION It also describes @command{gnatmem}, a utility that monitors dynamic allocation and deallocation and helps detect ``memory leaks''. @end ifclear -@end ifclear @item @ref{Stack Related Facilities}, describes some useful tools associated with @@ -432,27 +391,14 @@ generate automatically Ada bindings from C and C++ headers. @ref{Other Utility Programs}, discusses several other GNAT utilities, including @code{gnathtml}. -@ifclear vms @item @ref{Code Coverage and Profiling}, describes how to perform a structural coverage and profile the execution of Ada programs. -@end ifclear @item @ref{Running and Debugging Ada Programs}, describes how to run and debug Ada programs. -@ifset vms -@item -@ref{Compatibility with HP Ada}, details the compatibility of GNAT with -HP Ada 83 @footnote{``HP Ada'' refers to the legacy product originally -developed by Digital Equipment Corporation and currently supported by HP.} -for OpenVMS Alpha. This product was formerly known as DEC Ada, -@cindex DEC Ada -and for -historical compatibility reasons, the relevant libraries still use the -DEC prefix. -@end ifset @item @ref{Platform-Specific Information for the Run-Time Libraries}, @@ -485,7 +431,6 @@ in an Ada program. of GNAT with other Ada development environments (including Ada 83 systems), to assist in porting code from those environments. -@ifset unw @item @ref{Microsoft Windows Topics}, presents information relevant to the Microsoft Windows platform. @@ -493,7 +438,6 @@ Microsoft Windows platform. @item @ref{Mac OS Topics}, presents information relevant to Apple's OS X platform. -@end ifset @end itemize @c ************************************************* @@ -526,7 +470,6 @@ documents: Reference Manual}, which contains all reference material for the GNAT implementation of Ada. -@ifset unw @item @cite{Using the GNAT Programming Studio}, which describes the GPS Integrated Development Environment. @@ -534,7 +477,6 @@ Integrated Development Environment. @item @cite{GNAT Programming Studio Tutorial}, which introduces the main GPS features through examples. -@end ifset @item @cite{Ada 95 Reference Manual}, which contains reference @@ -546,17 +488,11 @@ material for the Ada 2005 programming language. @item @xref{Top,, Debugging with GDB, gdb, Debugging with GDB}, -@ifset vms -in the GNU:[DOCS] directory, -@end ifset for all details on the use of the GNU source-level debugger. @item @xref{Top,, The extensible self-documenting text editor, emacs, GNU Emacs Manual}, -@ifset vms -located in the GNU:[DOCS] directory if the EMACS kit is installed, -@end ifset for full information on the extensible editor and programming environment Emacs. @@ -608,12 +544,10 @@ you see them in the manual. If your system uses some other prompt, then the command will appear with the @code{$} replaced by whatever prompt character you are using. -@ifset unw Full file names are shown with the ``@code{/}'' character as the directory separator; e.g., @file{parent-dir/subdir/myfile.adb}. If you are using GNAT on a Windows platform, please note that the ``@code{\}'' character should be used instead. -@end ifset @c **************************** @node Getting Started with GNAT @@ -622,7 +556,6 @@ the ``@code{\}'' character should be used instead. @noindent This chapter describes some simple ways of using GNAT to build executable Ada programs. -@ifset unw @ref{Running GNAT}, through @ref{Using the gnatmake Utility}, show how to use the command line environment. @ref{Introduction to GPS}, provides a brief @@ -633,19 +566,13 @@ other programming languages, comprehensive browsing features, and many other capabilities. For information on GPS please refer to @cite{Using the GNAT Programming Studio}. -@end ifset @menu * Running GNAT:: * Running a Simple Ada Program:: * Running a Program with Multiple Units:: * Using the gnatmake Utility:: -@ifset vms -* Editing with Emacs:: -@end ifset -@ifclear vms * Introduction to GPS:: -@end ifclear @end menu @node Running GNAT @@ -683,11 +610,11 @@ standard format text file: @smallexample @c ada @cartouche -with Ada.Text_IO; use Ada.Text_IO; -procedure Hello is -begin +@b{with} Ada.Text_IO; @b{use} Ada.Text_IO; +@b{procedure} Hello @b{is} +@b{begin} Put_Line ("Hello WORLD!"); -end Hello; +@b{end} Hello; @end cartouche @end smallexample @@ -722,12 +649,10 @@ C. It assumes that you have given it an Ada program if the file extension is either @file{.ads} or @file{.adb}, and it will then call the GNAT compiler to compile the specified file. -@ifclear vms The @option{-c} switch is required. It tells @command{gcc} to only do a compilation. (For C programs, @command{gcc} can also do linking, but this capability is not used directly for Ada programs, so the @option{-c} switch must always be present.) -@end ifclear This compile command generates a file @file{hello.o}, which is the object @@ -767,7 +692,7 @@ The result is an executable program called @file{hello}, which can be run by entering: @smallexample -$ ^hello^RUN HELLO^ +$ hello @end smallexample @noindent @@ -795,32 +720,32 @@ main program, and the spec and body of a package: @smallexample @c ada @cartouche @group -package Greetings is - procedure Hello; - procedure Goodbye; -end Greetings; - -with Ada.Text_IO; use Ada.Text_IO; -package body Greetings is - procedure Hello is - begin +@b{package} Greetings @b{is} + @b{procedure} Hello; + @b{procedure} Goodbye; +@b{end} Greetings; + +@b{with} Ada.Text_IO; @b{use} Ada.Text_IO; +@b{package} @b{body} Greetings @b{is} + @b{procedure} Hello @b{is} + @b{begin} Put_Line ("Hello WORLD!"); - end Hello; + @b{end} Hello; - procedure Goodbye is - begin + @b{procedure} Goodbye @b{is} + @b{begin} Put_Line ("Goodbye WORLD!"); - end Goodbye; -end Greetings; + @b{end} Goodbye; +@b{end} Greetings; @end group @group -with Greetings; -procedure Gmain is -begin +@b{with} Greetings; +@b{procedure} Gmain @b{is} +@b{begin} Greetings.Hello; Greetings.Goodbye; -end Gmain; +@b{end} Gmain; @end group @end cartouche @end smallexample @@ -910,7 +835,7 @@ Invoke it using either one of the following forms: @smallexample $ gnatmake gmain.adb -$ gnatmake ^gmain^GMAIN^ +$ gnatmake gmain @end smallexample @noindent @@ -918,7 +843,7 @@ The argument is the name of the file containing the main program; you may omit the extension. @command{gnatmake} examines the environment, automatically recompiles any files that need recompiling, and binds and links the resulting set of object files, -generating the executable file, @file{^gmain^GMAIN.EXE^}. +generating the executable file, @file{gmain}. In a large program, it can be extremely helpful to use @command{gnatmake}, because working out by hand what needs to be recompiled can be difficult. @@ -933,36 +858,7 @@ found by the compiler on a previous compilation, which may possibly be wrong when sources change. @command{gnatmake} determines the exact set of dependencies from scratch each time it is run. -@ifset vms -@node Editing with Emacs -@section Editing with Emacs -@cindex Emacs - -@noindent -Emacs is an extensible self-documenting text editor that is available in a -separate VMSINSTAL kit. - -Invoke Emacs by typing @kbd{Emacs} at the command prompt. To get started, -click on the Emacs Help menu and run the Emacs Tutorial. -In a character cell terminal, Emacs help is invoked with @kbd{Ctrl-h} (also -written as @kbd{C-h}), and the tutorial by @kbd{C-h t}. - -Documentation on Emacs and other tools is available in Emacs under the -pull-down menu button: @code{Help - Info}. After selecting @code{Info}, -use the middle mouse button to select a topic (e.g.@: Emacs). -In a character cell terminal, do @kbd{C-h i} to invoke info, and then @kbd{m} -(stands for menu) followed by the menu item desired, as in @kbd{m Emacs}, to -get to the Emacs manual. -Help on Emacs is also available by typing @kbd{HELP EMACS} at the DCL command -prompt. - -The tutorial is highly recommended in order to learn the intricacies of Emacs, -which is sufficiently extensible to provide for a complete programming -environment and shell for the sophisticated user. -@end ifset - -@ifclear vms @node Introduction to GPS @section Introduction to GPS @cindex GPS (GNAT Programming Studio) @@ -1083,11 +979,11 @@ Type the following text @smallexample @c ada @group -with Ada.Text_IO; use Ada.Text_IO; -procedure Hello is -begin +@b{with} Ada.Text_IO; @b{use} Ada.Text_IO; +@b{procedure} Hello @b{is} +@b{begin} Put_Line("Hello from GPS!"); -end Hello; +@b{end} Hello; @end group @end smallexample @@ -1149,19 +1045,19 @@ Select @code{File}, then @code{New}, and type in the following program: @smallexample @c ada @group -with Ada.Text_IO; use Ada.Text_IO; -procedure Example is +@b{with} Ada.Text_IO; @b{use} Ada.Text_IO; +@b{procedure} Example @b{is} Line : String (1..80); N : Natural; -begin +@b{begin} Put_Line("Type a line of text at each prompt; an empty line to exit"); - loop + @b{loop} Put(": "); Get_Line (Line, N); Put_Line (Line (1..N) ); - exit when N=0; - end loop; -end Example; + @b{exit} @b{when} N=0; + @b{end} @b{loop}; +@b{end} Example; @end group @end smallexample @@ -1271,7 +1167,6 @@ The value of @code{N} will be 0, and the program will terminate. The console window will disappear. @end enumerate @end enumerate -@end ifclear @node The GNAT Compilation Model @chapter The GNAT Compilation Model @@ -1289,14 +1184,9 @@ The console window will disappear. * The Ada Library Information Files:: * Binding an Ada Program:: * Mixed Language Programming:: -@ifclear vms * Building Mixed Ada & C++ Programs:: * Comparison between GNAT and C/C++ Compilation Models:: -@end ifclear * Comparison between GNAT and Conventional Ada Library Models:: -@ifset vms -* Placement of temporary files:: -@end ifset @end menu @noindent @@ -1637,27 +1527,17 @@ ACATS (Ada Conformity Assessment Test Suite) test suite distributions. The default file name is determined by the name of the unit that the file contains. The name is formed by taking the full expanded name of the unit and replacing the separating dots with hyphens and using -^lowercase^uppercase^ for all letters. +lowercase for all letters. An exception arises if the file name generated by the above rules starts with one of the characters -@ifset vms -@samp{A}, @samp{G}, @samp{I}, or @samp{S}, -@end ifset -@ifclear vms @samp{a}, @samp{g}, @samp{i}, or @samp{s}, -@end ifclear and the second character is a -minus. In this case, the character ^tilde^dollar sign^ is used in place +minus. In this case, the character tilde is used in place of the minus. The reason for this special rule is to avoid clashes with the standard names for child units of the packages System, Ada, Interfaces, and GNAT, which use the prefixes -@ifset vms -@samp{S-}, @samp{A-}, @samp{I-}, and @samp{G-}, -@end ifset -@ifclear vms @samp{s-}, @samp{a-}, @samp{i-}, and @samp{g-}, -@end ifclear respectively. The file extension is @file{.ads} for a spec and @@ -1679,7 +1559,7 @@ Func.Spec (child package spec) Func.Spec (child package body) @item main-sub.adb Sub (subunit of Main) -@item ^a~bad.adb^A$BAD.ADB^ +@item a~bad.adb A.Bad (child package body) @end table @@ -1729,9 +1609,9 @@ The form of this pragma is as shown in the following examples: @smallexample @c ada @cartouche -pragma Source_File_Name (My_Utilities.Stacks, +@b{pragma} Source_File_Name (My_Utilities.Stacks, Spec_File_Name => "myutilst_a.ada"); -pragma Source_File_name (My_Utilities.Stacks, +@b{pragma} Source_File_name (My_Utilities.Stacks, Body_File_Name => "myutilst.ada"); @end cartouche @end smallexample @@ -1751,7 +1631,6 @@ For more details on how the @file{gnat.adc} file is created and used see @ref{Handling of Configuration Pragmas}. @cindex @file{gnat.adc} -@ifclear vms GNAT allows completely arbitrary file names to be specified using the source file name pragma. However, if the file name specified has an extension other than @file{.ads} or @file{.adb} it is necessary to use @@ -1762,7 +1641,6 @@ of the language, here @code{ada}, as in: @smallexample $ gcc -c -x ada peculiar_file_name.sim @end smallexample -@end ifclear @noindent @command{gnatmake} handles non-standard file names in the usual manner (the @@ -1789,17 +1667,17 @@ alternative scheme for naming is specified by the use of @cindex Source_File_Name pragma @smallexample @c ada -pragma Source_File_Name ( +@b{pragma} Source_File_Name ( Spec_File_Name => FILE_NAME_PATTERN @r{[},Casing => CASING_SPEC@r{]} @r{[},Dot_Replacement => STRING_LITERAL@r{]}); -pragma Source_File_Name ( +@b{pragma} Source_File_Name ( Body_File_Name => FILE_NAME_PATTERN @r{[},Casing => CASING_SPEC@r{]} @r{[},Dot_Replacement => STRING_LITERAL@r{]}); -pragma Source_File_Name ( +@b{pragma} Source_File_Name ( Subunit_File_Name => FILE_NAME_PATTERN @r{[},Casing => CASING_SPEC@r{]} @r{[},Dot_Replacement => STRING_LITERAL@r{]}); @@ -1816,7 +1694,7 @@ systematically for this asterisk. The optional parameter whether the unit name is to be all upper-case letters, all lower-case letters, or mixed-case. If no @code{Casing} parameter is used, then the default is all -^lower-case^upper-case^. +lower-case. The optional @code{Dot_Replacement} string is used to replace any periods that occur in subunit or child unit names. If no @code{Dot_Replacement} @@ -1869,9 +1747,9 @@ bodies end with @file{.2.ada}. GNAT will follow this scheme if the following two pragmas appear: @smallexample @c ada -pragma Source_File_Name +@b{pragma} Source_File_Name (Spec_File_Name => "*.1.ada"); -pragma Source_File_Name +@b{pragma} Source_File_Name (Body_File_Name => "*.2.ada"); @end smallexample @@ -1880,9 +1758,9 @@ The default GNAT scheme is actually implemented by providing the following default pragmas internally: @smallexample @c ada -pragma Source_File_Name +@b{pragma} Source_File_Name (Spec_File_Name => "*.ads", Dot_Replacement => "-"); -pragma Source_File_Name +@b{pragma} Source_File_Name (Body_File_Name => "*.adb", Dot_Replacement => "-"); @end smallexample @@ -1897,15 +1775,15 @@ Ada 83 compiler, but it seems reasonable to extend this scheme to use the same double underscore separator for child units. @smallexample @c ada -pragma Source_File_Name +@b{pragma} Source_File_Name (Spec_File_Name => "*_.ADA", Dot_Replacement => "__", Casing = Uppercase); -pragma Source_File_Name +@b{pragma} Source_File_Name (Body_File_Name => "*.ADA", Dot_Replacement => "__", Casing = Uppercase); -pragma Source_File_Name +@b{pragma} Source_File_Name (Subunit_File_Name => "*.SEP", Dot_Replacement => "__", Casing = Uppercase); @@ -2225,7 +2103,7 @@ procedure My_Main is -- Declare an Ada procedure spec for Print_Num, then use -- C function print_num for the implementation. procedure Print_Num (Num : Integer); - pragma Import (C, Print_Num, "print_num"); + pragma Import (C, Print_Num, "print_num"; begin Print_Num (Get_Num); @@ -2237,15 +2115,15 @@ end My_Main; To build this example, first compile the foreign language files to generate object files: @smallexample -^gcc -c file1.c^gcc -c FILE1.C^ -^gcc -c file2.c^gcc -c FILE2.C^ +gcc -c file1.c +gcc -c file2.c @end smallexample @item Then, compile the Ada units to produce a set of object files and ALI files: @smallexample -gnatmake ^-c^/ACTIONS=COMPILE^ my_main.adb +gnatmake -c my_main.adb @end smallexample @item @@ -2340,22 +2218,22 @@ The build procedure for this application is similar to the last example's. First, compile the foreign language files to generate object files: @smallexample -^gcc -c main.c^gcc -c main.c^ +gcc -c main.c @end smallexample @item Next, compile the Ada units to produce a set of object files and ALI files: @smallexample -gnatmake ^-c^/ACTIONS=COMPILE^ unit1.adb -gnatmake ^-c^/ACTIONS=COMPILE^ unit2.adb +gnatmake -c unit1.adb +gnatmake -c unit2.adb @end smallexample @item Run the Ada binder on every generated ALI file. Make sure to use the @option{-n} option to specify a foreign main program: @smallexample -gnatbind ^-n^/NOMAIN^ unit1.ali unit2.ali +gnatbind -n unit1.ali unit2.ali @end smallexample @item @@ -2372,7 +2250,7 @@ This procedure yields a binary executable called @file{exec_file}. Depending on the circumstances (for example when your non-Ada main object does not provide symbol @code{main}), you may also need to instruct the GNAT linker not to include the standard startup objects by passing the -@option{^-nostartfiles^/NOSTART_FILES^} switch to @command{gnatlink}. +@option{-nostartfiles} switch to @command{gnatlink}. @node Calling Conventions @subsection Calling Conventions @@ -2478,7 +2356,6 @@ Equivalent to C. @item External Equivalent to C. -@ifclear vms @findex C++ @cindex Interfacing to C++ @cindex Convention C++ @@ -2486,7 +2363,6 @@ Equivalent to C. This stands for C++. For most purposes this is identical to C. See the separate description of the specialized GNAT pragmas relating to C++ interfacing for further details. -@end ifclear @findex Fortran @cindex Interfacing to Fortran @@ -2521,12 +2397,12 @@ types). This simplifies the definition of operations that use type checking to perform dimensional checks: @smallexample @c ada -type Distance is new Long_Float; -type Time is new Long_Float; -type Velocity is new Long_Float; -function "/" (D : Distance; T : Time) - return Velocity; -pragma Import (Intrinsic, "/"); +@b{type} Distance @b{is} @b{new} Long_Float; +@b{type} Time @b{is} @b{new} Long_Float; +@b{type} Velocity @b{is} @b{new} Long_Float; +@b{function} "/" (D : Distance; T : Time) + @b{return} Velocity; +@b{pragma} Import (Intrinsic, "/"); @end smallexample @noindent @@ -2542,8 +2418,8 @@ available. A typical example is the set of ``__builtin'' functions exposed by the GCC back-end, as in the following example: @smallexample @c ada - function builtin_sqrt (F : Float) return Float; - pragma Import (Intrinsic, builtin_sqrt, "__builtin_sqrtf"); + @b{function} builtin_sqrt (F : Float) @b{return} Float; + @b{pragma} Import (Intrinsic, builtin_sqrt, "__builtin_sqrtf"); @end smallexample Most of the GCC builtins are accessible this way, and as for other @@ -2554,7 +2430,6 @@ expectations. @noindent -@ifset unw @findex Stdcall @cindex Convention Stdcall @item Stdcall @@ -2573,7 +2448,6 @@ This is equivalent to @code{Stdcall}. @cindex Convention Win32 @item Win32 This is equivalent to @code{Stdcall}. -@end ifset @findex Stubbed @cindex Convention Stubbed @@ -2590,7 +2464,7 @@ identifier Fortran77 was used for Fortran, you can use the configuration pragma: @smallexample @c ada -pragma Convention_Identifier (Fortran77, Fortran); +@b{pragma} Convention_Identifier (Fortran77, Fortran); @end smallexample @noindent @@ -2598,7 +2472,6 @@ And from now on the identifier Fortran77 may be used as a convention identifier (for example in an @code{Import} pragma) with the same meaning as Fortran. -@ifclear vms @node Building Mixed Ada & C++ Programs @section Building Mixed Ada and C++ Programs @@ -2848,34 +2721,34 @@ A::A(void) @end smallexample @smallexample @c ada --- Ada sources -package body Simple_Cpp_Interface is +--@i{ Ada sources} +@b{package} @b{body} Simple_Cpp_Interface @b{is} - procedure Ada_Method2 (This : in out A; V : Integer) is - begin + @b{procedure} Ada_Method2 (This : @b{in} @b{out} A; V : Integer) @b{is} + @b{begin} Method1 (This); This.A_Value := V; - end Ada_Method2; + @b{end} Ada_Method2; -end Simple_Cpp_Interface; +@b{end} Simple_Cpp_Interface; -with System; -package Simple_Cpp_Interface is - type A is limited - record +@b{with} System; +@b{package} Simple_Cpp_Interface @b{is} + @b{type} A @b{is} @b{limited} + @b{record} Vptr : System.Address; O_Value : Integer; A_Value : Integer; - end record; - pragma Convention (C, A); + @b{end} @b{record}; + @b{pragma} Convention (C, A); - procedure Method1 (This : in out A); - pragma Import (C, Method1); + @b{procedure} Method1 (This : @b{in} @b{out} A); + @b{pragma} Import (C, Method1); - procedure Ada_Method2 (This : in out A; V : Integer); - pragma Export (C, Ada_Method2); + @b{procedure} Ada_Method2 (This : @b{in} @b{out} A; V : Integer); + @b{pragma} Export (C, Ada_Method2); -end Simple_Cpp_Interface; +@b{end} Simple_Cpp_Interface; @end smallexample @node Interfacing with C++ constructors @@ -2909,26 +2782,26 @@ information on how to build this spec is available in @ref{Generating Ada Bindings for C and C++ headers}). @smallexample @c ada -with Interfaces.C; use Interfaces.C; -package Pkg_Root is - type Root is tagged limited record +@b{with} Interfaces.C; @b{use} Interfaces.C; +@b{package} Pkg_Root @b{is} + @b{type} Root @b{is} @b{tagged} @b{limited} @b{record} A_Value : int; B_Value : int; - end record; - pragma Import (CPP, Root); + @b{end} @b{record}; + @b{pragma} Import (CPP, Root); - function Get_Value (Obj : Root) return int; - pragma Import (CPP, Get_Value); + @b{function} Get_Value (Obj : Root) @b{return} int; + @b{pragma} Import (CPP, Get_Value); - function Constructor return Root; - pragma Cpp_Constructor (Constructor, "_ZN4RootC1Ev"); + @b{function} Constructor @b{return} Root; + @b{pragma} Cpp_Constructor (Constructor, "_ZN4RootC1Ev"); - function Constructor (v : Integer) return Root; - pragma Cpp_Constructor (Constructor, "_ZN4RootC1Ei"); + @b{function} Constructor (v : Integer) @b{return} Root; + @b{pragma} Cpp_Constructor (Constructor, "_ZN4RootC1Ei"); - function Constructor (v, w : Integer) return Root; - pragma Cpp_Constructor (Constructor, "_ZN4RootC1Eii"); -end Pkg_Root; + @b{function} Constructor (v, w : Integer) @b{return} Root; + @b{pragma} Cpp_Constructor (Constructor, "_ZN4RootC1Eii"); +@b{end} Pkg_Root; @end smallexample On the Ada side the constructor is represented by a function (whose @@ -2978,9 +2851,9 @@ non-default C++ constructor that takes two integers. Let us derive the imported C++ class in the Ada side. For example: @smallexample @c ada - type DT is new Root with record + @b{type} DT @b{is} @b{new} Root @b{with} @b{record} C_Value : Natural := 2009; - end record; + @b{end} @b{record}; @end smallexample In this case the components DT inherited from the C++ side must be @@ -2992,7 +2865,7 @@ an aggregate of type DT, or by means of an extension aggregate. @smallexample @c ada Obj5 : DT; Obj6 : DT := Function_Returning_DT (50); - Obj7 : DT := (Constructor (30,40) with C_Value => 50); + Obj7 : DT := (Constructor (30,40) @b{with} C_Value => 50); @end smallexample The declaration of @code{Obj5} invokes the default constructors: the @@ -3008,15 +2881,15 @@ Let us now consider a record that has components whose type is imported from C++. For example: @smallexample @c ada - type Rec1 is limited record + @b{type} Rec1 @b{is} @b{limited} @b{record} Data1 : Root := Constructor (10); Value : Natural := 1000; - end record; + @b{end} @b{record}; - type Rec2 (D : Integer := 20) is limited record + @b{type} Rec2 (D : Integer := 20) @b{is} @b{limited} @b{record} Rec : Rec1; Data2 : Root := Constructor (D, 30); - end record; + @b{end} @b{record}; @end smallexample The initialization of an object of type @code{Rec2} will call the @@ -3033,8 +2906,8 @@ declarations. For example: @smallexample @c ada Obj9 : Rec2 := (Rec => (Data1 => Constructor (15, 16), - others => <>), - others => <>); + @b{others} => <>), + @b{others} => <>); @end smallexample The above declaration uses an Ada 2005 limited aggregate to @@ -3052,16 +2925,16 @@ In Ada 2005 we can use the extended return statement to build the Ada equivalent to C++ non-default constructors. For example: @smallexample @c ada - function Constructor (V : Integer) return Rec2 is - begin - return Obj : Rec2 := (Rec => (Data1 => Constructor (V, 20), - others => <>), - others => <>) do - -- Further actions required for construction of - -- objects of type Rec2 + @b{function} Constructor (V : Integer) @b{return} Rec2 @b{is} + @b{begin} + @b{return} Obj : Rec2 := (Rec => (Data1 => Constructor (V, 20), + @b{others} => <>), + @b{others} => <>) @b{do} + --@i{ Further actions required for construction of} + --@i{ objects of type Rec2} ... - end record; - end Constructor; + @b{end} @b{record}; + @b{end} Constructor; @end smallexample In this example the extended return statement construct is used to @@ -3133,46 +3006,46 @@ located in a file named @code{animals.h}. The following package demonstrates how to import these C++ declarations from the Ada side: @smallexample @c ada -with Interfaces.C.Strings; use Interfaces.C.Strings; -package Animals is - type Carnivore is interface; - pragma Convention (C_Plus_Plus, Carnivore); - function Number_Of_Teeth (X : Carnivore) - return Natural is abstract; - - type Domestic is interface; - pragma Convention (C_Plus_Plus, Set_Owner); - procedure Set_Owner - (X : in out Domestic; - Name : Chars_Ptr) is abstract; - - type Animal is tagged record +@b{with} Interfaces.C.Strings; @b{use} Interfaces.C.Strings; +@b{package} Animals @b{is} + @b{type} Carnivore @b{is} interface; + @b{pragma} Convention (C_Plus_Plus, Carnivore); + @b{function} Number_Of_Teeth (X : Carnivore) + @b{return} Natural @b{is} @b{abstract}; + + @b{type} Domestic @b{is} interface; + @b{pragma} Convention (C_Plus_Plus, Set_Owner); + @b{procedure} Set_Owner + (X : @b{in} @b{out} Domestic; + Name : Chars_Ptr) @b{is} @b{abstract}; + + @b{type} Animal @b{is} @b{tagged} @b{record} Age : Natural := 0; - end record; - pragma Import (C_Plus_Plus, Animal); + @b{end} @b{record}; + @b{pragma} Import (C_Plus_Plus, Animal); - procedure Set_Age (X : in out Animal; Age : Integer); - pragma Import (C_Plus_Plus, Set_Age); + @b{procedure} Set_Age (X : @b{in} @b{out} Animal; Age : Integer); + @b{pragma} Import (C_Plus_Plus, Set_Age); - function Age (X : Animal) return Integer; - pragma Import (C_Plus_Plus, Age); + @b{function} Age (X : Animal) @b{return} Integer; + @b{pragma} Import (C_Plus_Plus, Age); - type Dog is new Animal and Carnivore and Domestic with record + @b{type} Dog @b{is} @b{new} Animal @b{and} Carnivore @b{and} Domestic @b{with} @b{record} Tooth_Count : Natural; Owner : String (1 .. 30); - end record; - pragma Import (C_Plus_Plus, Dog); + @b{end} @b{record}; + @b{pragma} Import (C_Plus_Plus, Dog); - function Number_Of_Teeth (A : Dog) return Integer; - pragma Import (C_Plus_Plus, Number_Of_Teeth); + @b{function} Number_Of_Teeth (A : Dog) @b{return} Integer; + @b{pragma} Import (C_Plus_Plus, Number_Of_Teeth); - procedure Set_Owner (A : in out Dog; Name : Chars_Ptr); - pragma Import (C_Plus_Plus, Set_Owner); + @b{procedure} Set_Owner (A : @b{in} @b{out} Dog; Name : Chars_Ptr); + @b{pragma} Import (C_Plus_Plus, Set_Owner); - function New_Dog return Dog; - pragma CPP_Constructor (New_Dog); - pragma Import (CPP, New_Dog, "_ZN3DogC2Ev"); -end Animals; + @b{function} New_Dog @b{return} Dog; + @b{pragma} CPP_Constructor (New_Dog); + @b{pragma} Import (CPP, New_Dog, "_ZN3DogC2Ev"); +@b{end} Animals; @end smallexample Thanks to the compatibility between GNAT run-time structures and the C++ ABI, @@ -3219,46 +3092,46 @@ Now let us define all the types and constructors on the Ada side and export them to C++, using the same hierarchy of our previous example: @smallexample @c ada -with Interfaces.C.Strings; -use Interfaces.C.Strings; -package Animals is - type Carnivore is interface; - pragma Convention (C_Plus_Plus, Carnivore); - function Number_Of_Teeth (X : Carnivore) - return Natural is abstract; - - type Domestic is interface; - pragma Convention (C_Plus_Plus, Set_Owner); - procedure Set_Owner - (X : in out Domestic; - Name : Chars_Ptr) is abstract; - - type Animal is tagged record +@b{with} Interfaces.C.Strings; +@b{use} Interfaces.C.Strings; +@b{package} Animals @b{is} + @b{type} Carnivore @b{is} interface; + @b{pragma} Convention (C_Plus_Plus, Carnivore); + @b{function} Number_Of_Teeth (X : Carnivore) + @b{return} Natural @b{is} @b{abstract}; + + @b{type} Domestic @b{is} interface; + @b{pragma} Convention (C_Plus_Plus, Set_Owner); + @b{procedure} Set_Owner + (X : @b{in} @b{out} Domestic; + Name : Chars_Ptr) @b{is} @b{abstract}; + + @b{type} Animal @b{is} @b{tagged} @b{record} Age : Natural := 0; - end record; - pragma Convention (C_Plus_Plus, Animal); + @b{end} @b{record}; + @b{pragma} Convention (C_Plus_Plus, Animal); - procedure Set_Age (X : in out Animal; Age : Integer); - pragma Export (C_Plus_Plus, Set_Age); + @b{procedure} Set_Age (X : @b{in} @b{out} Animal; Age : Integer); + @b{pragma} Export (C_Plus_Plus, Set_Age); - function Age (X : Animal) return Integer; - pragma Export (C_Plus_Plus, Age); + @b{function} Age (X : Animal) @b{return} Integer; + @b{pragma} Export (C_Plus_Plus, Age); - type Dog is new Animal and Carnivore and Domestic with record + @b{type} Dog @b{is} @b{new} Animal @b{and} Carnivore @b{and} Domestic @b{with} @b{record} Tooth_Count : Natural; Owner : String (1 .. 30); - end record; - pragma Convention (C_Plus_Plus, Dog); + @b{end} @b{record}; + @b{pragma} Convention (C_Plus_Plus, Dog); - function Number_Of_Teeth (A : Dog) return Integer; - pragma Export (C_Plus_Plus, Number_Of_Teeth); + @b{function} Number_Of_Teeth (A : Dog) @b{return} Integer; + @b{pragma} Export (C_Plus_Plus, Number_Of_Teeth); - procedure Set_Owner (A : in out Dog; Name : Chars_Ptr); - pragma Export (C_Plus_Plus, Set_Owner); + @b{procedure} Set_Owner (A : @b{in} @b{out} Dog; Name : Chars_Ptr); + @b{pragma} Export (C_Plus_Plus, Set_Owner); - function New_Dog return Dog'Class; - pragma Export (C_Plus_Plus, New_Dog); -end Animals; + @b{function} New_Dog @b{return} Dog'Class; + @b{pragma} Export (C_Plus_Plus, New_Dog); +@b{end} Animals; @end smallexample Compared with our previous example the only difference is the use of @@ -3335,7 +3208,6 @@ simpler to use, but the C++ programmer has no control over elaboration. Where @code{gnatbind} might complain there was no valid order of elaboration, a C++ compiler would simply construct a program that malfunctioned at run time. -@end ifclear @node Comparison between GNAT and Conventional Ada Library Models @section Comparison between GNAT and Conventional Ada Library Models @@ -3400,35 +3272,6 @@ GNAT, simple source dependencies; in other words, there is only a set of rules saying what source files must be present when a file is compiled. -@ifset vms -@node Placement of temporary files -@section Placement of temporary files -@cindex Temporary files (user control over placement) - -@noindent -GNAT creates temporary files in the directory designated by the environment -variable @env{TMPDIR}. -(See the HP @emph{C RTL Reference Manual} on the function @code{getenv()} -for detailed information on how environment variables are resolved. -For most users the easiest way to make use of this feature is to simply -define @env{TMPDIR} as a job level logical name). -For example, if you wish to use a Ramdisk (assuming DECRAM is installed) -for compiler temporary files, then you can include something like the -following command in your @file{LOGIN.COM} file: - -@smallexample -$ define/job TMPDIR "/disk$scratchram/000000/temp/" -@end smallexample - -@noindent -If @env{TMPDIR} is not defined, then GNAT uses the directory designated by -@env{TMP}; if @env{TMP} is not defined, then GNAT uses the directory -designated by @env{TEMP}. -If none of these environment variables are defined then GNAT uses the -directory designated by the logical name @code{SYS$SCRATCH:} -(by default the user's home directory). If all else fails -GNAT uses the current directory for temporary files. -@end ifset @c ************************* @node Compiling with gcc @@ -3523,10 +3366,8 @@ $ gcc -c @r{[}@var{switches}@r{]} @file{file name} where @var{file name} is the name of the Ada file (usually having an extension @file{.ads} for a spec or @file{.adb} for a body). -@ifclear vms You specify the @option{-c} switch to tell @command{gcc} to compile, but not link, the file. -@end ifclear The result of a successful compilation is an object file, which has the same name as the source file but an extension of @file{.o} and an Ada Library Information (ALI) file, which also has the same name as the @@ -3559,7 +3400,7 @@ calls @code{gnat1} (the Ada compiler) twice to compile @file{x.adb} and @file{y.adb}. The compiler generates two object files @file{x.o} and @file{y.o} and the two ALI files @file{x.ali} and @file{y.ali}. -Any switches apply to all the files ^listed,^listed.^ +Any switches apply to all the files listed, @node Switches for gcc @section Switches for @command{gcc} @@ -3595,14 +3436,10 @@ compilation units. * Units to Sources Mapping Files:: * Integrated Preprocessing:: * Code Generation Control:: -@ifset vms -* Return Codes:: -@end ifset @end menu @table @option @c !sort! -@ifclear vms @cindex @option{-b} (@command{gcc}) @item -b @var{target} Compile your program to run on @var{target}, which is the name of a @@ -3628,7 +3465,6 @@ use @command{gcc} without a @option{-c} switch to compile and link in one step. In the case of GNAT, you cannot use this approach, because the binder must be run and @command{gcc} cannot be used to run the GNAT binder. -@end ifclear @item -fcallgraph-info@r{[}=su,da@r{]} @cindex @option{-fcallgraph-info} (@command{gcc}) @@ -3722,12 +3558,12 @@ See @ref{Stack Overflow Checking} for details. Makes the compiler output stack usage information for the program, on a per-subprogram basis. See @ref{Static Stack Usage Analysis} for details. -@item ^-g^/DEBUG^ -@cindex @option{^-g^/DEBUG^} (@command{gcc}) +@item -g +@cindex @option{-g} (@command{gcc}) Generate debugging information. This information is stored in the object file and copied from there to the final executable file by the linker, where it can be read by the debugger. You must use the -@option{^-g^/DEBUG^} switch if you plan on using the debugger. +@option{-g} switch if you plan on using the debugger. @item -gnat83 @cindex @option{-gnat83} (@command{gcc}) @@ -3811,19 +3647,14 @@ debug options. Certain debug options are relevant to applications programmers, and these are documented at appropriate points in this users guide. -@ifclear vms @item -gnatD @cindex @option{-gnatD[nn]} (@command{gcc}) -@end ifclear -@ifset vms -@item /XDEBUG /LXDEBUG=nnn -@end ifset Create expanded source files for source level debugging. This switch also suppress generation of cross-reference information (see @option{-gnatx}). Note that this switch is not allowed if a previous -gnatR switch has been given, since these two switches are not compatible. -@item ^-gnateA^/ALIASING_CHECK^ +@item -gnateA @cindex @option{-gnateA} (@command{gcc}) Check that the actual parameters of a subprogram call are not aliases of one another. To qualify as aliasing, the actuals must denote objects of a composite @@ -3860,9 +3691,7 @@ not share the memory location of @code{Obj}. @item -gnatec=@var{path} @cindex @option{-gnatec} (@command{gcc}) Specify a configuration pragma file -@ifclear vms (the equal sign is optional) -@end ifclear (@pxref{The Configuration Pragmas Files}). @item -gnateC @@ -3871,11 +3700,11 @@ Generate CodePeer messages in a compiler-like format. This switch is only effective if @option{-gnatcC} is also specified and requires an installation of CodePeer. -@item ^-gnated^/DISABLE_ATOMIC_SYNCHRONIZATION^ +@item -gnated @cindex @option{-gnated} (@command{gcc}) Disable atomic synchronization -@item ^-gnateD^/DATA_PREPROCESSING=^symbol@r{[}=@var{value}@r{]} +@item -gnateDsymbol@r{[}=@var{value}@r{]} @cindex @option{-gnateD} (@command{gcc}) Defines a symbol, associated with @var{value}, for preprocessing. (@pxref{Integrated Preprocessing}). @@ -3933,17 +3762,13 @@ This switch turns off the info messages about implicit elaboration pragmas. @item -gnatem=@var{path} @cindex @option{-gnatem} (@command{gcc}) Specify a mapping file -@ifclear vms (the equal sign is optional) -@end ifclear (@pxref{Units to Sources Mapping Files}). @item -gnatep=@var{file} @cindex @option{-gnatep} (@command{gcc}) Specify a preprocessing data file -@ifclear vms (the equal sign is optional) -@end ifclear (@pxref{Integrated Preprocessing}). @item -gnateP @@ -4075,12 +3900,12 @@ compiling sources developed on a later version of the compiler with an earlier version. Of course the earlier version must support this switch. -@item ^-gnateV^/PARAMETER_VALIDITY_CHECK^ +@item -gnateV @cindex @option{-gnateV} (@command{gcc}) Check that all actual parameters of a subprogram call are valid according to the rules of validity checking (@pxref{Validity Checking}). -@item ^-gnateY^/IGNORE_SUPPRESS_SYLE_CHECK_PRAGMAS^ +@item -gnateY @cindex @option{-gnateY} (@command{gcc}) Ignore all STYLE_CHECKS pragmas. Full legality checks are still carried out, but the pragmas have no effect @@ -4100,41 +3925,34 @@ attempt to suppress cascaded errors. @cindex @option{-gnatF} (@command{gcc}) Externals names are folded to all uppercase. -@item ^-gnatg^/GNAT_INTERNAL^ -@cindex @option{^-gnatg^/GNAT_INTERNAL^} (@command{gcc}) +@item -gnatg +@cindex @option{-gnatg} (@command{gcc}) Internal GNAT implementation mode. This should not be used for applications programs, it is intended only for use by the compiler and its run-time library. For documentation, see the GNAT sources. -Note that @option{^-gnatg^/GNAT_INTERNAL^} implies -@option{^-gnatw.ge^/WARNINGS=GNAT,ERRORS^} and -@option{^-gnatyg^/STYLE_CHECKS=GNAT^} +Note that @option{-gnatg} implies +@option{-gnatw.ge} and +@option{-gnatyg} so that all standard warnings and all standard style options are turned on. All warnings and style messages are treated as errors. -@ifclear vms @item -gnatG=nn @cindex @option{-gnatG[nn]} (@command{gcc}) -@end ifclear -@ifset vms -@item /EXPAND_SOURCE, /LEXPAND_SOURCE=nnn -@end ifset List generated expanded code in source form. -@item ^-gnath^/HELP^ -@cindex @option{^-gnath^/HELP^} (@command{gcc}) +@item -gnath +@cindex @option{-gnath} (@command{gcc}) Output usage information. The output is written to @file{stdout}. -@item ^-gnati^/IDENTIFIER_CHARACTER_SET=^@var{c} -@cindex @option{^-gnati^/IDENTIFIER_CHARACTER_SET^} (@command{gcc}) +@item -gnati@var{c} +@cindex @option{-gnati} (@command{gcc}) Identifier character set -@ifclear vms (@var{c}=1/2/3/4/8/9/p/f/n/w). -@end ifclear For details of the possible selections for @var{c}, see @ref{Character Set Control}. -@item ^-gnatI^/IGNORE_REP_CLAUSES^ -@cindex @option{^-gnatI^IGNORE_REP_CLAUSES^} (@command{gcc}) +@item -gnatI +@cindex @option{-gnatI} (@command{gcc}) Ignore representation clauses. When this switch is used, representation clauses are treated as comments. This is useful when initially porting code where you want to ignore rep clause @@ -4157,7 +3975,7 @@ Reformat error messages to fit on nn character lines @item -gnatk=@var{n} @cindex @option{-gnatk} (@command{gcc}) -Limit file names to @var{n} (1-999) characters ^(@code{k} = krunch)^^. +Limit file names to @var{n} (1-999) characters (@code{k} = krunch). @item -gnatl @cindex @option{-gnatl} (@command{gcc}) @@ -4229,7 +4047,7 @@ cases; if two digits are given, then the first applies outside assertions, and the second within assertions. If no digits follow the @option{-gnato}, then it is equivalent to -@option{^-gnato11^/OVERFLOW_CHECKS=11^}, +@option{-gnato11}, causing all intermediate overflows to be handled in strict mode. This switch also causes arithmetic overflow checking to be performed @@ -4274,13 +4092,13 @@ errors, so even with @option{-gnatQ} no object file is generated. @cindex @option{-gnatr} (@command{gcc}) Treat pragma Restrictions as Restriction_Warnings. -@item ^-gnatR@r{[}0@r{/}1@r{/}2@r{/}3@r{[}s@r{]]}^/REPRESENTATION_INFO^ +@item -gnatR@r{[}0@r{/}1@r{/}2@r{/}3@r{[}s@r{]]} @cindex @option{-gnatR} (@command{gcc}) Output representation information for declared types and objects. Note that this switch is not allowed if a previous @code{-gnatD} switch has been given, since these two switches are not compatible. -@item ^-gnatRm[s]^/REPRESENTATION_INFO^ +@item -gnatRm[s] Output convention and parameter passing mechanisms for all subprograms. @item -gnats @@ -4295,8 +4113,8 @@ Print package Standard. @cindex @option{-gnatt} (@command{gcc}) Generate tree output file. -@item ^-gnatT^/TABLE_MULTIPLIER=^@var{nnn} -@cindex @option{^-gnatT^/TABLE_MULTIPLIER^} (@command{gcc}) +@item -gnatT@var{nnn} +@cindex @option{-gnatT} (@command{gcc}) All compiler tables start at @var{nnn} times usual starting size. @item -gnatu @@ -4315,22 +4133,17 @@ Verbose mode. Full error output with source lines to @file{stdout}. @cindex @option{-gnatV} (@command{gcc}) Control level of validity checking (@pxref{Validity Checking}). -@item ^-gnatw@var{xxx}^/WARNINGS=(@var{option}@r{[},@dots{}@r{]})^ -@cindex @option{^-gnatw^/WARNINGS^} (@command{gcc}) +@item -gnatw@var{xxx} +@cindex @option{-gnatw} (@command{gcc}) Warning mode where -^@var{xxx} is a string of option letters that^the list of options^ denotes +@var{xxx} is a string of option letters that denotes the exact warnings that are enabled or disabled (@pxref{Warning Message Control}). -@item ^-gnatW^/WIDE_CHARACTER_ENCODING=^@var{e} -@cindex @option{^-gnatW^/WIDE_CHARACTER_ENCODING^} (@command{gcc}) +@item -gnatW@var{e} +@cindex @option{-gnatW} (@command{gcc}) Wide character encoding method -@ifclear vms (@var{e}=n/h/u/s/e/8). -@end ifclear -@ifset vms -(@var{e}=@code{BRACKETS, NONE, HEX, UPPER, SHIFT_JIS, EUC, UTF8}) -@end ifset @item -gnatx @cindex @option{-gnatx} (@command{gcc}) @@ -4340,36 +4153,29 @@ Suppress generation of cross-reference information. @cindex @option{-gnatX} (@command{gcc}) Enable GNAT implementation extensions and latest Ada version. -@item ^-gnaty^/STYLE_CHECKS=(option,option@dots{})^ -@cindex @option{^-gnaty^/STYLE_CHECKS^} (@command{gcc}) +@item -gnaty +@cindex @option{-gnaty} (@command{gcc}) Enable built-in style checks (@pxref{Style Checking}). -@item ^-gnatz^/DISTRIBUTION_STUBS=^@var{m} -@cindex @option{^-gnatz^/DISTRIBUTION_STUBS^} (@command{gcc}) +@item -gnatz@var{m} +@cindex @option{-gnatz} (@command{gcc}) Distribution stub generation and compilation -@ifclear vms (@var{m}=r/c for receiver/caller stubs). -@end ifclear -@ifset vms -(@var{m}=@code{RECEIVER} or @code{CALLER} to specify the type of stubs -to be generated and compiled). -@end ifset -@item ^-I^/SEARCH=^@var{dir} -@cindex @option{^-I^/SEARCH^} (@command{gcc}) +@item -I@var{dir} +@cindex @option{-I} (@command{gcc}) @cindex RTL Direct GNAT to search the @var{dir} directory for source files needed by the current compilation (@pxref{Search Paths and the Run-Time Library (RTL)}). -@item ^-I-^/NOCURRENT_DIRECTORY^ -@cindex @option{^-I-^/NOCURRENT_DIRECTORY^} (@command{gcc}) +@item -I- +@cindex @option{-I-} (@command{gcc}) @cindex RTL Except for the source file named in the command line, do not look for source files in the directory containing the source file named in the command line (@pxref{Search Paths and the Run-Time Library (RTL)}). -@ifclear vms @item -mbig-switch @cindex @option{-mbig-switch} (@command{gcc}) @cindex @code{case} statement (effect of @option{-mbig-switch} option) @@ -4386,7 +4192,6 @@ This switch is used in @command{gcc} to redirect the generated object file and its associated ALI file. Beware of this switch with GNAT, because it may cause the object file and ALI file to have different names which in turn may confuse the binder and the linker. -@end ifclear @item -nostdinc @cindex @option{-nostdinc} (@command{gcc}) @@ -4398,7 +4203,6 @@ Library (RTL) source files. Inhibit the search of the default location for the GNAT Run Time Library (RTL) ALI files. -@ifclear vms @c @item -O@ovar{n} @c Expanding @ovar macro inline (explanation in macro def comments) @item -O@r{[}@var{n}@r{]} @@ -4428,92 +4232,44 @@ Optimize space usage @noindent See also @ref{Optimization Levels}. -@end ifclear - -@ifset vms -@item /NOOPTIMIZE -@cindex @option{/NOOPTIMIZE} (@code{GNAT COMPILE}) -Equivalent to @option{/OPTIMIZE=NONE}. -This is the default behavior in the absence of an @option{/OPTIMIZE} -qualifier. - -@item /OPTIMIZE@r{[}=(keyword@r{[},@dots{}@r{]})@r{]} -@cindex @option{/OPTIMIZE} (@code{GNAT COMPILE}) -Selects the level of optimization for your program. The supported -keywords are as follows: -@table @code -@item ALL -Perform most optimizations, including those that -are expensive. -This is the default if the @option{/OPTIMIZE} qualifier is supplied -without keyword options. - -@item NONE -Do not do any optimizations. Same as @code{/NOOPTIMIZE}. - -@item SOME -Perform some optimizations, but omit ones that are costly. -@item DEVELOPMENT -Same as @code{SOME}. -@item INLINING -Full optimization as in @option{/OPTIMIZE=ALL}, and also attempts -automatic inlining of small subprograms within a unit - -@item UNROLL_LOOPS -Try to unroll loops. This keyword may be specified together with -any keyword above other than @code{NONE}. Loop unrolling -usually, but not always, improves the performance of programs. - -@item SPACE -Optimize space usage -@end table - -@noindent -See also @ref{Optimization Levels}. -@end ifset - -@ifclear vms @item -pass-exit-codes @cindex @option{-pass-exit-codes} (@command{gcc}) Catch exit codes from the compiler and use the most meaningful as exit status. -@end ifclear @item --RTS=@var{rts-path} @cindex @option{--RTS} (@command{gcc}) Specifies the default location of the runtime library. Same meaning as the equivalent @command{gnatmake} flag (@pxref{Switches for gnatmake}). -@item ^-S^/ASM^ -@cindex @option{^-S^/ASM^} (@command{gcc}) -^Used in place of @option{-c} to^Used to^ +@item -S +@cindex @option{-S} (@command{gcc}) +Used in place of @option{-c} to cause the assembler source file to be -generated, using @file{^.s^.S^} as the extension, +generated, using @file{.s} as the extension, instead of the object file. This may be useful if you need to examine the generated assembly code. -@item ^-fverbose-asm^/VERBOSE_ASM^ -@cindex @option{^-fverbose-asm^/VERBOSE_ASM^} (@command{gcc}) -^Used in conjunction with @option{-S}^Used in place of @option{/ASM}^ +@item -fverbose-asm +@cindex @option{-fverbose-asm} (@command{gcc}) +Used in conjunction with @option{-S} to cause the generated assembly code file to be annotated with variable names, making it significantly easier to follow. -@item ^-v^/VERBOSE^ -@cindex @option{^-v^/VERBOSE^} (@command{gcc}) +@item -v +@cindex @option{-v} (@command{gcc}) Show commands generated by the @command{gcc} driver. Normally used only for debugging purposes or if you need to be sure what version of the compiler you are executing. -@ifclear vms @item -V @var{ver} @cindex @option{-V} (@command{gcc}) Execute @var{ver} version of the compiler. This is the @command{gcc} version, not the GNAT version. -@end ifclear -@item ^-w^/NO_BACK_END_WARNINGS^ +@item -w @cindex @option{-w} (@command{gcc}) Turn off warnings generated by the back end of the compiler. Use of this switch also causes the default for front end warnings to be set @@ -4522,7 +4278,6 @@ the options). @end table -@ifclear vms @c Combining qualifiers does not work on VMS You may combine a sequence of GNAT switches into a single switch. For example, the combined switch @@ -4538,7 +4293,6 @@ is equivalent to specifying the following sequence of switches: @smallexample -gnato -gnatf -gnati3 @end smallexample -@end ifclear @noindent The following restrictions apply to the combination of switches @@ -4555,14 +4309,13 @@ first in the string. @item The switches -^^@option{/DISTRIBUTION_STUBS=},^ + @option{-gnatzc} and @option{-gnatzr} may not be combined with any other switches, and only one of them may appear in the command line. @item The switch @option{-gnat-p} may not be combined with any other switch. -@ifclear vms @item Once a ``y'' appears in the string (that is a use of the @option{-gnaty} switch), then all further characters in the switch are interpreted @@ -4586,7 +4339,6 @@ as validity checking options (@pxref{Validity Checking}). @item Option ``em'', ``ec'', ``ep'', ``l='' and ``R'' must be the last options in a combined list of options. -@end ifclear @end itemize @node Output and Error Message Control @@ -4606,10 +4358,8 @@ e.adb:4:20: ";" should be "is" @noindent The first integer after the file name is the line number in the file, and the second integer is the column number within the line. -@ifclear vms @code{GPS} can parse the error messages and point to the referenced character. -@end ifclear The following switches provide control over the error message format: @@ -4618,9 +4368,7 @@ format: @item -gnatv @cindex @option{-gnatv} (@command{gcc}) @findex stdout -@ifclear vms The v stands for verbose. -@end ifclear The effect of this setting is to write long-format error messages to @file{stdout} (the standard output file. The same program compiled with the @@ -4644,9 +4392,7 @@ used the only source lines output are those with errors. @item -gnatl @cindex @option{-gnatl} (@command{gcc}) -@ifclear vms The @code{l} stands for list. -@end ifclear This switch causes a full listing of the file to be generated. In the case where a body is compiled, the corresponding spec is also listed, along @@ -4657,38 +4403,38 @@ body @file{p.adb} might look like: @cartouche Compiling: p.adb - 1. package body p is - 2. procedure a; - 3. procedure a is separate; - 4. begin - 5. null + 1. @b{package} @b{body} p @b{is} + 2. @b{procedure} a; + 3. @b{procedure} a @b{is} @b{separate}; + 4. @b{begin} + 5. @b{null} | >>> missing ";" - 6. end; + 6. @b{end}; Compiling: p.ads - 1. package p is - 2. pragma Elaborate_Body + 1. @b{package} p @b{is} + 2. @b{pragma} Elaborate_Body | >>> missing ";" - 3. end p; + 3. @b{end} p; Compiling: p-a.adb - 1. separate p + 1. @b{separate} p | >>> missing "(" - 2. procedure a is - 3. begin - 4. null + 2. @b{procedure} a @b{is} + 3. @b{begin} + 4. @b{null} | >>> missing ";" - 5. end; + 5. @b{end}; @end cartouche @end smallexample @@ -4699,15 +4445,15 @@ standard output is redirected, a brief summary is written to @file{stderr} (standard error) giving the number of error messages and warning messages generated. -@item ^-gnatl^/OUTPUT_FILE^=file -@cindex @option{^-gnatl^/OUTPUT_FILE^=fname} (@command{gcc}) +@item -gnatl=file +@cindex @option{-gnatl=fname} (@command{gcc}) This has the same effect as @option{-gnatl} except that the output is written to a file instead of to standard output. If the given name @file{fname} does not start with a period, then it is the full name of the file to be written. If @file{fname} is an extension, it is appended to the name of the file being compiled. For example, if -file @file{xyz.adb} is compiled with @option{^-gnatl^/OUTPUT_FILE^=.lst}, -then the output is written to file ^xyz.adb.lst^xyz.adb_lst^. +file @file{xyz.adb} is compiled with @option{-gnatl=.lst}, +then the output is written to file xyz.adb.lst. @item -gnatU @cindex @option{-gnatU} (@command{gcc}) @@ -4718,9 +4464,7 @@ of error messages. @item -gnatb @cindex @option{-gnatb} (@command{gcc}) -@ifclear vms The @code{b} stands for brief. -@end ifclear This switch causes GNAT to generate the brief format error messages to @file{stderr} (the standard error file) as well as the verbose @@ -4729,9 +4473,7 @@ format message or full listing (which as usual is written to @item -gnatm=@var{n} @cindex @option{-gnatm} (@command{gcc}) -@ifclear vms The @code{m} stands for maximum. -@end ifclear @var{n} is a decimal integer in the range of 1 to 999999 and limits the number of error or warning messages to be generated. For example, using @@ -4759,9 +4501,7 @@ Note that the equal sign is optional, so the switches @item -gnatf @cindex @option{-gnatf} (@command{gcc}) @cindex Error messages, suppressing -@ifclear vms The @code{f} stands for full. -@end ifclear Normally, the compiler suppresses error messages that are likely to be redundant. This switch causes all error messages to be generated. In particular, in the case of @@ -4813,9 +4553,7 @@ is longer than nn characters. @item -gnatq @cindex @option{-gnatq} (@command{gcc}) -@ifclear vms The @code{q} stands for quit (really ``don't quit''). -@end ifclear In normal operation mode, the compiler first parses the program and determines if there are any syntax errors. If there are, appropriate error messages are generated and compilation is immediately terminated. @@ -5342,7 +5080,7 @@ representation clauses that leave holes (haps) in the record layout. This switch activates warnings for a @code{with} of an internal GNAT implementation unit, defined as any unit from the @code{Ada}, @code{Interfaces}, @code{GNAT}, -^^@code{DEC},^ or @code{System} + or @code{System} hierarchies that is not documented in either the Ada Reference Manual or the GNAT Programmer's Reference Manual. Such units are intended only @@ -5785,7 +5523,7 @@ Table is an array of records whose components are only partially uninitialized, then the following code: @smallexample @c ada - Tab : Table := (others => <>); + Tab : Table := (@b{others} => <>); @end smallexample will suppress warnings on subsequent statements that access components @@ -5827,8 +5565,8 @@ assertion that the lower bound is 1, as shown in the following example. @smallexample @c ada - procedure K (S : String) is - pragma Assert (S'First = 1); + @b{procedure} K (S : String) @b{is} + @b{pragma} Assert (S'First = 1); @dots{} @end smallexample @@ -5963,17 +5701,17 @@ size that is greater than the specified size. The warning can also be suppressed by giving an explicit @code{Object_Size} value. -@item ^-Wunused^WARNINGS=UNUSED^ +@item -Wunused @cindex @option{-Wunused} The warnings controlled by the @option{-gnatw} switch are generated by the front end of the compiler. The @option{GCC} back end can provide additional warnings and they are controlled by the @option{-W} switch. -For example, @option{^-Wunused^WARNINGS=UNUSED^} activates back end +For example, @option{-Wunused} activates back end warnings for entities that are declared but not referenced. -@item ^-Wuninitialized^WARNINGS=UNINITIALIZED^ +@item -Wuninitialized @cindex @option{-Wuninitialized} -Similarly, @option{^-Wuninitialized^WARNINGS=UNINITIALIZED^} activates +Similarly, @option{-Wuninitialized} activates the back end warning for uninitialized variables. This switch must be used in conjunction with an optimization level greater than zero. @@ -5982,7 +5720,7 @@ used in conjunction with an optimization level greater than zero. Warn if the stack usage of a subprogram might be larger than @var{len} bytes. See @ref{Static Stack Usage Analysis} for details. -@item ^-Wall^/ALL_BACK_END_WARNINGS^ +@item -Wall @cindex @option{-Wall} This switch enables most warnings from the @option{GCC} back end. The code generator detects a number of warning situations that are missed @@ -5990,7 +5728,7 @@ by the @option{GNAT} front end, and this switch can be used to activate them. The use of this switch also sets the default front end warning mode to @option{-gnatwa}, that is, most front end warnings activated as well. -@item ^-w^/NO_BACK_END_WARNINGS^ +@item -w @cindex @option{-w} Conversely, this switch suppresses warnings from the @option{GCC} back end. The use of this switch also sets the default front end warning mode to @@ -6005,7 +5743,6 @@ counted as errors, and prevent the generation of an object file. @end table @noindent -@ifclear vms A string of warning parameters can be used in the same parameter. For example: @smallexample @@ -6015,9 +5752,8 @@ A string of warning parameters can be used in the same parameter. For example: @noindent will turn on all optional warnings except for unrecognized pragma warnings, and also specify that warnings should be treated as errors. -@end ifclear -When no switch @option{^-gnatw^/WARNINGS^} is used, this is equivalent to: +When no switch @option{-gnatw} is used, this is equivalent to: @table @option @c !sort! @@ -6100,27 +5836,6 @@ The @code{Debug} pragma causes @var{procedure} to be called. Note that @code{pragma Debug} may appear within a declaration sequence, allowing debugging procedures to be called between declarations. -@ifset vms -@item /DEBUG@r{[}=debug-level@r{]} -@itemx /NODEBUG -Specifies how much debugging information is to be included in -the resulting object file where 'debug-level' is one of the following: -@table @code -@item TRACEBACK -Include both debugger symbol records and traceback -the object file. -This is the default setting. -@item ALL -Include both debugger symbol records and traceback in -object file. -@item NONE -Excludes both debugger symbol records and traceback -the object file. Same as /NODEBUG. -@item SYMBOLS -Includes only debugger symbol records in the object -file. Note that this doesn't include traceback information. -@end table -@end ifset @end table @node Validity Checking @@ -6154,7 +5869,7 @@ combination with optimization, since this can confuse the optimizer. If performance is a consideration, leading to the need to optimize, then the validity checking options should not be used. -The other @option{-gnatV^@var{x}^^} switches below allow finer-grained +The other @option{-gnatV@var{x}} switches below allow finer-grained control; you can enable whichever validity checks you desire. However, for most debugging purposes, @option{-gnatVa} is sufficient, and the default @option{-gnatVd} (i.e. standard Ada behavior) is usually @@ -6167,18 +5882,11 @@ the compiler can generate more efficient code, since the range of values is better known at compile time. However, an uninitialized variable can cause wild jumps and memory corruption in this mode. -The @option{-gnatV^@var{x}^^} switch allows control over the validity +The @option{-gnatV@var{x}} switch allows control over the validity checking mode as described below. -@ifclear vms The @code{x} argument is a string of letters that indicate validity checks that are performed or not performed in addition to the default checks required by Ada as described above. -@end ifclear -@ifset vms -The options allowed for this qualifier -indicate validity checks that are performed or not performed in addition -to the default checks required by Ada as described above. -@end ifset @table @option @c !sort! @@ -6186,10 +5894,8 @@ to the default checks required by Ada as described above. @emph{All validity checks.} @cindex @option{-gnatVa} (@command{gcc}) All validity checks are turned on. -@ifclear vms That is, @option{-gnatVa} is equivalent to @option{gnatVcdfimorst}. -@end ifclear @item -gnatVc @emph{Validity checks for copies.} @@ -6236,8 +5942,8 @@ as well as out of range values for constrained types. Note that this means that standard IEEE infinity mode is not allowed. The exact contexts in which floating-point values are checked depends on the setting of other options. For example, -@option{^-gnatVif^VALIDITY_CHECKING=(IN_PARAMS,FLOATS)^} or -@option{^-gnatVfi^VALIDITY_CHECKING=(FLOATS,IN_PARAMS)^} +@option{-gnatVif} or +@option{-gnatVfi} (the order does not matter) specifies that floating-point parameters of mode @code{in} should be validity checked. @@ -6313,35 +6019,18 @@ statements are checked, as well as guard expressions in entry calls. @noindent The @option{-gnatV} switch may be followed by -^a string of letters^a list of options^ +a string of letters to turn on a series of validity checking options. For example, -@option{^-gnatVcr^/VALIDITY_CHECKING=(COPIES, RETURNS)^} +@option{-gnatVcr} specifies that in addition to the default validity checking, copies and function return expressions are to be validity checked. In order to make it easier to specify the desired combination of effects, -@ifclear vms the upper case letters @code{CDFIMORST} may be used to turn off the corresponding lower case option. -@end ifclear -@ifset vms -the prefix @code{NO} on an option turns off the corresponding validity -checking: -@itemize @bullet -@item @code{NOCOPIES} -@item @code{NODEFAULT} -@item @code{NOFLOATS} -@item @code{NOIN_PARAMS} -@item @code{NOMOD_PARAMS} -@item @code{NOOPERANDS} -@item @code{NORETURNS} -@item @code{NOSUBSCRIPTS} -@item @code{NOTESTS} -@end itemize -@end ifset Thus -@option{^-gnatVaM^/VALIDITY_CHECKING=(ALL, NOMOD_PARAMS)^} +@option{-gnatVaM} turns on all validity checking options except for checking of @code{@b{in out}} procedure arguments. @@ -6362,7 +6051,7 @@ temporary disabling of validity checks. @findex Style checking @noindent -The @option{-gnaty^x^(option,option,@dots{})^} switch +The @option{-gnatyx} switch @cindex @option{-gnaty} (@command{gcc}) causes the compiler to enforce specified style rules. A limited set of style rules has been used @@ -6386,12 +6075,7 @@ of an existing set of coding rules, you should look to the gnatcheck tool, which is designed for that purpose. @end ifclear -@ifset vms -@code{(option,option,@dots{})} is a sequence of keywords -@end ifset -@ifclear vms The string @var{x} is a sequence of letters or digits -@end ifclear indicating the particular style checks to be performed. The following checks are defined: @@ -6400,7 +6084,7 @@ checks to be performed. The following checks are defined: @item 0-9 @emph{Specify indentation level.} If a digit from 1-9 appears -^in the string after @option{-gnaty}^as an option for /STYLE_CHECKS^ +in the string after @option{-gnaty} then proper indentation is checked, with the digit indicating the indentation level required. A value of zero turns off this style check. The general style of required indentation is as specified by @@ -6411,33 +6095,33 @@ non-blank line (this is useful when full line comments appear in the middle of a statement, or they may be aligned with the source line on the previous non-blank line. -@item ^a^ATTRIBUTE^ +@item a @emph{Check attribute casing.} Attribute names, including the case of keywords such as @code{digits} used as attributes names, must be written in mixed case, that is, the initial letter and any letter following an underscore must be uppercase. All other letters must be lowercase. -@item ^A^ARRAY_INDEXES^ +@item A @emph{Use of array index numbers in array attributes.} When using the array attributes First, Last, Range, or Length, the index number must be omitted for one-dimensional arrays and is required for multi-dimensional arrays. -@item ^b^BLANKS^ +@item b @emph{Blanks not allowed at statement end.} Trailing blanks are not allowed at the end of statements. The purpose of this rule, together with h (no horizontal tabs), is to enforce a canonical format for the use of blanks to separate source tokens. -@item ^B^BOOLEAN_OPERATORS^ +@item B @emph{Check Boolean operators.} The use of AND/OR operators is not permitted except in the cases of modular operands, array operands, and simple stand-alone boolean variables or boolean constants. In all other cases @code{and then}/@code{or else} are required. -@item ^c^COMMENTS^ +@item c @emph{Check comments, double space.} Comments must meet the following set of rules: @@ -6489,28 +6173,28 @@ example: @end smallexample @end itemize -@item ^C^COMMENTS1^ +@item C @emph{Check comments, single space.} -This is identical to @code{^c^COMMENTS^} except that only one space +This is identical to @code{c} except that only one space is required following the @code{--} of a comment instead of two. -@item ^d^DOS_LINE_ENDINGS^ +@item d @emph{Check no DOS line terminators present.} All lines must be terminated by a single ASCII.LF character (in particular the DOS line terminator sequence CR/LF is not allowed). -@item ^e^END^ +@item e @emph{Check end/exit labels.} Optional labels on @code{end} statements ending subprograms and on @code{exit} statements exiting named loops, are required to be present. -@item ^f^VTABS^ +@item f @emph{No form feeds or vertical tabs.} Neither form feeds nor vertical tab characters are permitted in the source text. -@item ^g^GNAT^ +@item g @emph{GNAT style mode.} The set of style check switches is set to match that used by the GNAT sources. This may be useful when developing code that is eventually intended to be @@ -6518,32 +6202,32 @@ incorporated into GNAT. Currently this is equivalent to @option{-gnatwydISux}) but additional style switches may be added to this set in the future without advance notice. -@item ^h^HTABS^ +@item h @emph{No horizontal tabs.} Horizontal tab characters are not permitted in the source text. Together with the b (no blanks at end of line) check, this enforces a canonical form for the use of blanks to separate source tokens. -@item ^i^IF_THEN^ +@item i @emph{Check if-then layout.} The keyword @code{then} must appear either on the same line as corresponding @code{if}, or on a line on its own, lined up under the @code{if}. -@item ^I^IN_MODE^ +@item I @emph{check mode IN keywords.} Mode @code{in} (the default mode) is not allowed to be given explicitly. @code{in out} is fine, but not @code{in} on its own. -@item ^k^KEYWORD^ +@item k @emph{Check keyword casing.} All keywords must be in lower case (with the exception of keywords such as @code{digits} used as attribute names to which this check does not apply). -@item ^l^LAYOUT^ +@item l @emph{Check layout.} Layout of statement and declaration constructs must follow the recommendations in the Ada Reference Manual, as indicated by the @@ -6560,22 +6244,22 @@ For example, any of the following three layouts is acceptable: @smallexample @c ada @cartouche -type q is record +@b{type} q @b{is} @b{record} a : integer; b : integer; -end record; +@b{end} @b{record}; -type q is - record +@b{type} q @b{is} + @b{record} a : integer; b : integer; - end record; + @b{end} @b{record}; -type q is - record +@b{type} q @b{is} + @b{record} a : integer; b : integer; -end record; +@b{end} @b{record}; @end cartouche @end smallexample @@ -6588,18 +6272,18 @@ the block label. For example both the following are permitted: @smallexample @c ada @cartouche -Block : declare +Block : @b{declare} A : Integer := 3; -begin +@b{begin} Proc (A, A); -end Block; +@b{end} Block; Block : - declare + @b{declare} A : Integer := 3; - begin + @b{begin} Proc (A, A); - end Block; + @b{end} Block; @end cartouche @end smallexample @@ -6609,24 +6293,24 @@ the following are permitted: @smallexample @c ada @cartouche -Clear : while J < 10 loop +Clear : @b{while} J < 10 @b{loop} A (J) := 0; -end loop Clear; +@b{end} @b{loop} Clear; Clear : - while J < 10 loop + @b{while} J < 10 @b{loop} A (J) := 0; - end loop Clear; + @b{end} @b{loop} Clear; @end cartouche @end smallexample -@item ^Lnnn^MAX_NESTING=nnn^ +@item Lnnn @emph{Set maximum nesting level.} The maximum level of nesting of constructs (including subprograms, loops, blocks, packages, and conditionals) may not exceed the given value @option{nnn}. A value of zero disconnects this style check. -@item ^m^LINE_LENGTH^ +@item m @emph{Check maximum line length.} The length of source lines must not exceed 79 characters, including any trailing blanks. The value of 79 allows convenient display on an @@ -6636,7 +6320,7 @@ characters in the source text. This means that a tab character counts as one character in this count and a wide character sequence counts as a single character (however many bytes are needed in the encoding). -@item ^Mnnn^MAX_LENGTH=nnn^ +@item Mnnn @emph{Set maximum line length.} The length of lines must not exceed the given value @option{nnn}. The maximum value that can be specified is 32767. @@ -6644,17 +6328,17 @@ If neither style option for setting the line length is used, then the default is 255. This also controls the maximum length of lexical elements, where the only restriction is that they must fit on a single line. -@item ^n^STANDARD_CASING^ +@item n @emph{Check casing of entities in Standard.} Any identifier from Standard must be cased to match the presentation in the Ada Reference Manual (for example, @code{Integer} and @code{ASCII.NUL}). -@item ^N^NONE^ +@item N @emph{Turn off all style checks.} All style check options are turned off. -@item ^o^ORDERED_SUBPROGRAMS^ +@item o @emph{Check order of subprogram bodies.} All subprogram bodies in a given scope (e.g.@: a package body) must be in alphabetical order. The ordering @@ -6663,26 +6347,26 @@ of letters, except that if there is a trailing numeric suffix, then the value of this suffix is used in the ordering (e.g.@: Junk2 comes before Junk10). -@item ^O^OVERRIDING_INDICATORS^ +@item O @emph{Check that overriding subprograms are explicitly marked as such.} The declaration of a primitive operation of a type extension that overrides an inherited operation must carry an overriding indicator. -@item ^p^PRAGMA^ +@item p @emph{Check pragma casing.} Pragma names must be written in mixed case, that is, the initial letter and any letter following an underscore must be uppercase. All other letters must be lowercase. An exception is that SPARK_Mode is allowed as an alternative for Spark_Mode. -@item ^r^REFERENCES^ +@item r @emph{Check references.} All identifier references must be cased in the same way as the corresponding declaration. No specific casing style is imposed on identifiers. The only requirement is for consistency of references with declarations. -@item ^s^SPECS^ +@item s @emph{Check separate specs.} Separate declarations (``specs'') are required for subprograms (a body is not allowed to serve as its own declaration). The only @@ -6690,14 +6374,14 @@ exception is that parameterless library level procedures are not required to have a separate declaration. This exception covers the most frequent form of main program procedures. -@item ^S^STATEMENTS_AFTER_THEN_ELSE^ +@item S @emph{Check no statements after @code{then}/@code{else}.} No statements are allowed on the same line as a @code{then} or @code{else} keyword following the keyword in an @code{if} statement. @code{or else} and @code{and then} are not affected, and a special exception allows a pragma to appear after @code{else}. -@item ^t^TOKEN^ +@item t @emph{Check token spacing.} The following token spacing rules are enforced: @@ -6754,26 +6438,25 @@ A vertical bar must be surrounded by spaces. Exactly one blank (and no other white space) must appear between a @code{not} token and a following @code{in} token. -@item ^u^UNNECESSARY_BLANK_LINES^ +@item u @emph{Check unnecessary blank lines.} Unnecessary blank lines are not allowed. A blank line is considered unnecessary if it appears at the end of the file, or if more than one blank line occurs in sequence. -@item ^x^XTRA_PARENS^ +@item x @emph{Check extra parentheses.} Unnecessary extra level of parentheses (C-style) are not allowed around conditions in @code{if} statements, @code{while} statements and @code{exit} statements. -@item ^y^ALL_BUILTIN^ +@item y @emph{Set all standard style check options} This is equivalent to @code{gnaty3aAbcefhiklmnprst}, that is all checking options enabled with the exception of @option{-gnatyB}, @option{-gnatyd}, @option{-gnatyI}, @option{-gnatyLnnn}, @option{-gnatyo}, @option{-gnatyO}, @option{-gnatyS}, @option{-gnatyu}, and @option{-gnatyx}. -@ifclear vms @item - @emph{Remove style check options} This causes any subsequent options in the string to act as canceling the @@ -6786,17 +6469,9 @@ allowed after @option{-}. @item + This causes any subsequent options in the string to enable the corresponding -style check option. That is, it cancels the effect of a previous ^-^REMOVE^, +style check option. That is, it cancels the effect of a previous -, if any. -@end ifclear -@ifset vms -@item NOxxx -@emph{Removing style check options} -If the name of a style check is preceded by @option{NO} then the corresponding -style check is turned off. For example @option{NOCOMMENTS} turns off style -checking for comments. -@end ifset @end table @noindent @@ -6817,26 +6492,14 @@ file. The @option{-gnatwe} switch can be used to treat warning messages, including style messages, as fatal errors. The switch -@ifclear vms @option{-gnaty} on its own (that is not followed by any letters or digits) is equivalent to the use of @option{-gnatyy} as described above, that is all built-in standard style check options are enabled. -@end ifclear -@ifset vms -/STYLE_CHECKS=ALL_BUILTIN enables all checking options with -the exception of ORDERED_SUBPROGRAMS, UNNECESSARY_BLANK_LINES, -XTRA_PARENS, and DOS_LINE_ENDINGS. In addition -@end ifset The switch -@ifclear vms @option{-gnatyN} -@end ifclear -@ifset vms -/STYLE_CHECKS=NONE -@end ifset clears any previously set style checks. @node Run-Time Checks @@ -6975,7 +6638,7 @@ subscript), or a wild jump (from an out of range case value). Overflow checking is also quite expensive in time and space, since in general it requires the use of double length arithmetic. -Note again that the default is @option{^-gnato00^/OVERFLOW_CHECKS=00^}, +Note again that the default is @option{-gnato00}, so overflow checking is not performed in default mode. This means that out of the box, with the default settings, @value{EDITION} does not do all the checks expected from the language description in the Ada Reference Manual. @@ -7014,11 +6677,9 @@ the program source. @table @option @item -gnats @cindex @option{-gnats} (@command{gcc}) -@ifclear vms @noindent The @code{s} stands for ``syntax''. -@end ifclear Run GNAT in syntax checking only mode. For example, the command @@ -7030,11 +6691,9 @@ $ gcc -c -gnats x.adb @noindent compiles file @file{x.adb} in syntax-check-only mode. You can check a series of files in a single command -@ifclear vms , and can use wild cards to specify such a group of files. Note that you must specify the @option{-c} (compile only) flag in addition to the @option{-gnats} flag. -@end ifclear . You may use other switches in conjunction with @option{-gnats}. In particular, @option{-gnatl} and @option{-gnatv} are useful to control the @@ -7070,10 +6729,8 @@ together. This is primarily used by the @code{gnatchop} utility @item -gnatc @cindex @option{-gnatc} (@command{gcc}) -@ifclear vms @noindent The @code{c} stands for ``check''. -@end ifclear Causes the compiler to operate in semantic check mode, with full checking for all illegalities specified in the Ada Reference Manual, but without generation of any object code @@ -7212,15 +6869,15 @@ extensions, see the GNAT reference manual. @node Character Set Control @subsection Character Set Control @table @option -@item ^-gnati^/IDENTIFIER_CHARACTER_SET=^@var{c} -@cindex @option{^-gnati^/IDENTIFIER_CHARACTER_SET^} (@command{gcc}) +@item -gnati@var{c} +@cindex @option{-gnati} (@command{gcc}) @noindent Normally GNAT recognizes the Latin-1 character set in source program identifiers, as described in the Ada Reference Manual. This switch causes GNAT to recognize alternate character sets in identifiers. @var{c} is a -single character ^^or word^ indicating the character set, as follows: +single character indicating the character set, as follows: @table @code @item 1 @@ -7241,19 +6898,19 @@ ISO 8859-5 (Cyrillic) letters allowed in identifiers @item 9 ISO 8859-15 (Latin-9) letters allowed in identifiers -@item ^p^PC^ +@item p IBM PC letters (code page 437) allowed in identifiers -@item ^8^PC850^ +@item 8 IBM PC letters (code page 850) allowed in identifiers -@item ^f^FULL_UPPER^ +@item f Full upper-half codes allowed in identifiers -@item ^n^NO_UPPER^ +@item n No upper-half codes allowed in identifiers -@item ^w^WIDE^ +@item w Wide-character codes (that is, codes greater than 255) allowed in identifiers @end table @@ -7261,29 +6918,29 @@ allowed in identifiers @xref{Foreign Language Representation}, for full details on the implementation of these character sets. -@item ^-gnatW^/WIDE_CHARACTER_ENCODING=^@var{e} -@cindex @option{^-gnatW^/WIDE_CHARACTER_ENCODING^} (@command{gcc}) +@item -gnatW@var{e} +@cindex @option{-gnatW} (@command{gcc}) Specify the method of encoding for wide characters. @var{e} is one of the following: @table @code -@item ^h^HEX^ +@item h Hex encoding (brackets coding also recognized) -@item ^u^UPPER^ +@item u Upper half encoding (brackets encoding also recognized) -@item ^s^SHIFT_JIS^ +@item s Shift/JIS encoding (brackets encoding also recognized) -@item ^e^EUC^ +@item e EUC encoding (brackets encoding also recognized) -@item ^8^UTF8^ +@item 8 UTF-8 encoding (brackets encoding also recognized) -@item ^b^BRACKETS^ +@item b Brackets encoding only (default value) @end table For full details on these encoding @@ -7339,7 +6996,7 @@ This is a common mode for many programs with foreign language comments. @subsection File Naming Control @table @option -@item ^-gnatk^/FILE_NAME_MAX_LENGTH=^@var{n} +@item -gnatk@var{n} @cindex @option{-gnatk} (@command{gcc}) Activates file name ``krunching''. @var{n}, a decimal integer in the range 1-999, indicates the maximum allowable length of a file name (not @@ -7356,10 +7013,8 @@ For the source file naming rules, @xref{File Naming Rules}. @c !sort! @item -gnatn[12] @cindex @option{-gnatn} (@command{gcc}) -@ifclear vms The @code{n} here is intended to suggest the first syllable of the word ``inline''. -@end ifclear GNAT recognizes and processes @code{Inline} pragmas. However, for the inlining to actually occur, optimization must be enabled and, in order to enable inlining of subprograms specified by pragma @code{Inline}, @@ -7417,7 +7072,6 @@ Print a list of units required by this compilation on @file{stdout}. The listing includes all units on which the unit being compiled depends either directly or indirectly. -@ifclear vms @item -pass-exit-codes @cindex @option{-pass-exit-codes} (@command{gcc}) If this switch is not used, the exit code returned by @command{gcc} when @@ -7438,7 +7092,6 @@ The compiler died unexpectedly (internal error for example). @item 0 An object file has been generated for every source file. @end table -@end ifclear @end table @node Debugging Control @@ -7447,7 +7100,6 @@ An object file has been generated for every source file. @table @option @c !sort! @cindex Debugging options -@ifclear vms @item -gnatd@var{x} @cindex @option{-gnatd} (@command{gcc}) Activate internal debugging switches. @var{x} is a letter or digit, or @@ -7456,7 +7108,6 @@ outputs desired. Normally these are used only for internal development or system debugging purposes. You can find full documentation for these switches in the body of the @code{Debug} unit in the compiler source file @file{debug.adb}. -@end ifclear @item -gnatG[=nn] @cindex @option{-gnatG} (@command{gcc}) @@ -7500,14 +7151,14 @@ Shows the finalization (cleanup) procedure for a scope. @item (if @var{expr} then @var{expr} else @var{expr}) Conditional expression equivalent to the @code{x?y:z} construction in C. -@item @var{target}^^^(@var{source}) +@item @var{target}^(@var{source}) A conversion with floating-point truncation instead of rounding. @item @var{target}?(@var{source}) A conversion that bypasses normal Ada semantic checking. In particular enumeration types and fixed-point types are treated simply as integers. -@item @var{target}?^^^(@var{source}) +@item @var{target}?^(@var{source}) Combines the above two cases. @item @var{x} #/ @var{y} @@ -7568,18 +7219,18 @@ evaluation of the expression 1.0/27.0). When used in conjunction with @option{-gnatG}, this switch causes the expanded source, as described above for @option{-gnatG} to be written to files with names -@file{^xxx.dg^XXX_DG^}, where @file{xxx} is the normal file name, +@file{xxx.dg}, where @file{xxx} is the normal file name, instead of to the standard output file. For example, if the source file name is @file{hello.adb}, then a file -@file{^hello.adb.dg^HELLO.ADB_DG^} will be written. The debugging -information generated by the @command{gcc} @option{^-g^/DEBUG^} switch -will refer to the generated @file{^xxx.dg^XXX_DG^} file. This allows +@file{hello.adb.dg} will be written. The debugging +information generated by the @command{gcc} @option{-g} switch +will refer to the generated @file{xxx.dg} file. This allows you to do source level debugging using the generated code which is sometimes useful for complex code, for example to find out exactly which part of a complex construction raised an exception. This switch also suppress generation of cross-reference information (see @option{-gnatx}) since otherwise the cross-reference information -would refer to the @file{^.dg^.DG^} file, which would cause +would refer to the @file{.dg} file, which would cause confusion since this is not the original source file. Note that @option{-gnatD} actually implies @option{-gnatG} @@ -7606,7 +7257,6 @@ or investigated. The switch also causes pragma Profile to be treated as Profile_Warnings, and pragma Restricted_Run_Time and pragma Ravenscar set restriction warnings rather than restrictions. -@ifclear vms @item -gnatR@r{[}0@r{|}1@r{|}2@r{|}3@r{[}s@r{]]} @cindex @option{-gnatR} (@command{gcc}) This switch controls output from the compiler of a listing showing @@ -7628,43 +7278,13 @@ format with #n being used to represent the value of the n'th discriminant. See source files @file{repinfo.ads/adb} in the @code{GNAT} sources for full details on the format of @option{-gnatR3} output. If the switch is followed by an s (e.g.@: @option{-gnatR2s}), then -the output is to a file with the name @file{^file.rep^file_REP^} where +the output is to a file with the name @file{file.rep} where file is the name of the corresponding source file. @item -gnatRm[s] This form of the switch controls output of subprogram conventions and parameter passing mechanisms for all subprograms. A following @code{s} means output to a file as described above. -@end ifclear -@ifset vms -@item /REPRESENTATION_INFO -@cindex @option{/REPRESENTATION_INFO} (@command{gcc}) -This qualifier controls output from the compiler of a listing showing -representation information for declared types and objects. For -@option{/REPRESENTATION_INFO=NONE}, no information is output -(equivalent to omitting the @option{/REPRESENTATION_INFO} qualifier). -@option{/REPRESENTATION_INFO} without option is equivalent to -@option{/REPRESENTATION_INFO=ARRAYS}. -For @option{/REPRESENTATION_INFO=ARRAYS}, size and alignment -information is listed for declared array and record types. For -@option{/REPRESENTATION_INFO=OBJECTS}, size and alignment information -is listed for all expression information for values that are computed -at run time for variant records. These symbolic expressions have a mostly -obvious format with #n being used to represent the value of the n'th -discriminant. See source files @file{REPINFO.ADS/ADB} in the -@code{GNAT} sources for full details on the format of -@option{/REPRESENTATION_INFO=SYMBOLIC} output. -If _FILE is added at the end of an option -(e.g.@: @option{/REPRESENTATION_INFO=ARRAYS_FILE}), -then the output is to a file with the name @file{file_REP} where -file is the name of the corresponding source file. - -@item /REPRESENTATION_INFO=MECHANISMS -This qualifier form controls output of subprogram conventions -and parameter passing mechanisms for all subprograms. It is -possible to append _FILE as described above to cause information -to be written to a file. -@end ifset Note that it is possible for record components to have zero size. In this case, the component clause uses an obvious extension of permitted @@ -7830,13 +7450,13 @@ preprocessing in a file, then you should use @command{gnatprep} to perform the desired preprocessing in stand-alone mode. @noindent -It is recommended that @command{gnatmake} switch ^-s^/SWITCH_CHECK^ should be +It is recommended that @command{gnatmake} switch -s should be used when Integrated Preprocessing is used. The reason is that preprocessing with another Preprocessing Data file without changing the sources will not trigger recompilation without this switch. @noindent -Note that @command{gnatmake} switch ^-m^/MINIMAL_RECOMPILATION^ will almost +Note that @command{gnatmake} switch -m will almost always trigger recompilation for sources that are preprocessed, because @command{gnatmake} cannot compute the checksum of the source after preprocessing. @@ -7878,19 +7498,19 @@ indicating the file name of the definition file to be used for preprocessing compiler in one of the source directories. In some cases, when compiling a source in a directory other than the current directory, if the definition file is in the current directory, it may be necessary to add the current -directory as a source directory through switch ^-I.^/SEARCH=[]^, otherwise +directory as a source directory through switch -I., otherwise the compiler would not find the definition file. @noindent -Then, optionally, ^switches^switches^ similar to those of @code{gnatprep} may -be found. Those ^switches^switches^ are: +Then, optionally, switches similar to those of @code{gnatprep} may +be found. Those switches are: @table @code @item -b Causes both preprocessor lines and the lines deleted by preprocessing to be replaced by blank lines, preserving the line number. -This ^switch^switch^ is always implied; however, if specified after @option{-c} +This switch is always implied; however, if specified after @option{-c} it cancels the effect of @option{-c}. @item -c @@ -7903,7 +7523,7 @@ Define or redefine a symbol, associated with value. A symbol is an Ada identifier, or an Ada reserved word, with the exception of @code{if}, @code{else}, @code{elsif}, @code{end}, @code{and}, @code{or} and @code{then}. @code{value} is either a literal string, an Ada identifier or any Ada reserved -word. A symbol declared with this ^switch^switch^ replaces a symbol with the +word. A symbol declared with this switch replaces a symbol with the same name defined in a definition file. @item -s @@ -7935,7 +7555,7 @@ Examples of valid lines in a preprocessor data file: -- list all symbols with their values. @end smallexample -@item ^-gnateD^/DATA_PREPROCESSING=^symbol@r{[}=value@r{]} +@item -gnateDsymbol@r{[}=value@r{]} @cindex @option{-gnateD} (@command{gcc}) Define or redefine a preprocessing symbol, associated with value. If no value is given on the command line, then the value of the symbol is @code{True}. @@ -7946,7 +7566,6 @@ set (letters, digits, period, underline). Ada reserved words may be used as symbols, with the exceptions of @code{if}, @code{else}, @code{elsif}, @code{end}, @code{and}, @code{or} and @code{then}. -@ifclear vms @noindent Examples: @@ -7955,20 +7574,19 @@ Examples: -gnateDFoo -gnateDFoo=\"Foo-Bar\" @end smallexample -@end ifclear @noindent -A symbol declared with this ^switch^switch^ on the command line replaces a +A symbol declared with this switch on the command line replaces a symbol with the same name either in a definition file or specified with a -^switch^switch^ -D in the preprocessor data file. +switch -D in the preprocessor data file. @noindent -This switch is similar to switch @option{^-D^/ASSOCIATE^} of @code{gnatprep}. +This switch is similar to switch @option{-D} of @code{gnatprep}. @item -gnateG When integrated preprocessing is performed and the preprocessor modifies the source text, write the result of this preprocessing into a file -<source>^.prep^_prep^. +<source>.prep. @end table @@ -8001,30 +7619,6 @@ special needs lead to requirements in this area. In particular, there is no point in using @option{-m} switches to improve performance unless you actually see a performance improvement. -@ifset vms -@node Return Codes -@subsection Return Codes -@cindex Return Codes -@cindex @option{/RETURN_CODES=VMS} - -@noindent -On VMS, GNAT compiled programs return POSIX-style codes by default, -e.g.@: @option{/RETURN_CODES=POSIX}. - -To enable VMS style return codes, use GNAT BIND and LINK with the option -@option{/RETURN_CODES=VMS}. For example: - -@smallexample -GNAT BIND MYMAIN.ALI /RETURN_CODES=VMS -GNAT LINK MYMAIN.ALI /RETURN_CODES=VMS -@end smallexample - -@noindent -Programs built with /RETURN_CODES=VMS are suitable to be called in -VMS DCL scripts. Programs compiled with the default /RETURN_CODES=POSIX -are suitable for spawning with appropriate GNAT RTL routines. - -@end ifset @node Search Paths and the Run-Time Library (RTL) @section Search Paths and the Run-Time Library (RTL) @@ -8046,65 +7640,40 @@ The directory containing the source file of the main unit being compiled (the file name on the command line). @item -Each directory named by an @option{^-I^/SOURCE_SEARCH^} switch given on the +Each directory named by an @option{-I} switch given on the @command{gcc} command line, in the order given. @item @findex ADA_PRJ_INCLUDE_FILE Each of the directories listed in the text file whose name is given -by the @env{ADA_PRJ_INCLUDE_FILE} ^environment variable^logical name^. +by the @env{ADA_PRJ_INCLUDE_FILE} environment variable. @noindent -@env{ADA_PRJ_INCLUDE_FILE} is normally set by gnatmake or by the ^gnat^GNAT^ +@env{ADA_PRJ_INCLUDE_FILE} is normally set by gnatmake or by the gnat driver when project files are used. It should not normally be set by other means. @item @findex ADA_INCLUDE_PATH Each of the directories listed in the value of the -@env{ADA_INCLUDE_PATH} ^environment variable^logical name^. -@ifclear vms +@env{ADA_INCLUDE_PATH} environment variable. Construct this value exactly as the @env{PATH} environment variable: a list of directory names separated by colons (semicolons when working with the NT version). -@end ifclear -@ifset vms -Normally, define this value as a logical name containing a comma separated -list of directory names. - -This variable can also be defined by means of an environment string -(an argument to the HP C exec* set of functions). - -Logical Name: -@smallexample -DEFINE ANOTHER_PATH FOO:[BAG] -DEFINE ADA_INCLUDE_PATH ANOTHER_PATH,FOO:[BAM],FOO:[BAR] -@end smallexample - -By default, the path includes GNU:[LIB.OPENVMS7_x.2_8_x.DECLIB] -first, followed by the standard Ada -libraries in GNU:[LIB.OPENVMS7_x.2_8_x.ADAINCLUDE]. -If this is not redefined, the user will obtain the HP Ada 83 IO packages -(Text_IO, Sequential_IO, etc) -instead of the standard Ada packages. Thus, in order to get the standard Ada -packages by default, ADA_INCLUDE_PATH must be redefined. -@end ifset @item The content of the @file{ada_source_path} file which is part of the GNAT installation tree and is used to store standard libraries such as the GNAT Run Time Library (RTL) source files. -@ifclear vms @ref{Installing a library} -@end ifclear @end enumerate @noindent -Specifying the switch @option{^-I-^/NOCURRENT_DIRECTORY^} +Specifying the switch @option{-I-} inhibits the use of the directory containing the source file named in the command line. You can still have this directory on your search path, but in this case it must be -explicitly requested with a @option{^-I^/SOURCE_SEARCH^} switch. +explicitly requested with a @option{-I} switch. Specifying the switch @option{-nostdinc} inhibits the search of the default location for the GNAT Run Time @@ -8112,12 +7681,10 @@ Library (RTL) source files. The compiler outputs its object files and ALI files in the current working directory. -@ifclear vms Caution: The object file can be redirected with the @option{-o} switch; however, @command{gcc} and @code{gnat1} have not been coordinated on this so the @file{ALI} file will not go to the right place. Therefore, you should avoid using the @option{-o} switch. -@end ifclear @findex System.IO The packages @code{Ada}, @code{System}, and @code{Interfaces} and their @@ -8187,12 +7754,7 @@ The following are some typical Ada compilation command line examples: @item $ gcc -c xyz.adb Compile body in file @file{xyz.adb} with all default options. -@ifclear vms @item $ gcc -c -O2 -gnata xyz-def.adb -@end ifclear -@ifset vms -@item $ GNAT COMPILE /OPTIMIZE=ALL -gnata xyz-def.adb -@end ifset Compile the child unit package in file @file{xyz-def.adb} with extensive optimizations, and pragma @code{Assert}/@code{Debug} statements @@ -8334,7 +7896,7 @@ In most normal usage, the default mode of @command{gnatbind} which is to generate the main package in Ada, as described in the previous section. In particular, this means that any Ada programmer can read and understand the generated main program. It can also be debugged just like any other -Ada code provided the @option{^-g^/DEBUG^} switch is used for +Ada code provided the @option{-g} switch is used for @command{gnatbind} and @command{gnatlink}. @node Switches for gnatbind @@ -8373,28 +7935,28 @@ be treated as an initialisation routine by the linker (a constructor). This is intended to be used by the Project Manager to automatically initialize shared Stand-Alone Libraries. -@item ^-aO^/OBJECT_SEARCH^ -@cindex @option{^-aO^/OBJECT_SEARCH^} (@command{gnatbind}) +@item -aO +@cindex @option{-aO} (@command{gnatbind}) Specify directory to be searched for ALI files. -@item ^-aI^/SOURCE_SEARCH^ -@cindex @option{^-aI^/SOURCE_SEARCH^} (@command{gnatbind}) +@item -aI +@cindex @option{-aI} (@command{gnatbind}) Specify directory to be searched for source file. -@item ^-A^/ALI_LIST^@r{[=}@var{filename}@r{]} -@cindex @option{^-A^/ALI_LIST^} (@command{gnatbind}) +@item -A@r{[=}@var{filename}@r{]} +@cindex @option{-A} (@command{gnatbind}) Output ALI list (to standard output or to the named file). -@item ^-b^/REPORT_ERRORS=BRIEF^ -@cindex @option{^-b^/REPORT_ERRORS=BRIEF^} (@command{gnatbind}) +@item -b +@cindex @option{-b} (@command{gnatbind}) Generate brief messages to @file{stderr} even if verbose mode set. -@item ^-c^/NOOUTPUT^ -@cindex @option{^-c^/NOOUTPUT^} (@command{gnatbind}) +@item -c +@cindex @option{-c} (@command{gnatbind}) Check only, no generation of binder output file. -@item ^-d^/DEFAULT_STACK_SIZE=^@var{nn}@r{[}k@r{|}m@r{]} -@cindex @option{^-d^/DEFAULT_STACK_SIZE=^@var{nn}@r{[}k@r{|}m@r{]}} (@command{gnatbind}) +@item -d@var{nn}@r{[}k@r{|}m@r{]} +@cindex @option{-d@var{nn}@r{[}k@r{|}m@r{]}} (@command{gnatbind}) This switch can be used to change the default task stack size value to a specified size @var{nn}, which is expressed in bytes by default, or in kilobytes when suffixed with @var{k} or in megabytes when suffixed @@ -8402,12 +7964,12 @@ with @var{m}. In the absence of a @samp{@r{[}k@r{|}m@r{]}} suffix, this switch is equivalent, in effect, to completing all task specs with @smallexample @c ada - pragma Storage_Size (nn); + @b{pragma} Storage_Size (nn); @end smallexample When they do not already have such a pragma. -@item ^-D^/DEFAULT_SECONDARY_STACK_SIZE=^@var{nn}@r{[}k@r{|}m@r{]} -@cindex @option{^-D^/DEFAULT_SECONDARY_STACK_SIZE=nnnnn^} (@command{gnatbind}) +@item -D@var{nn}@r{[}k@r{|}m@r{]} +@cindex @option{-D} (@command{gnatbind}) This switch can be used to change the default secondary stack size value to a specified size @var{nn}, which is expressed in bytes by default, or in kilobytes when suffixed with @var{k} or in megabytes when suffixed @@ -8428,12 +7990,12 @@ the secondary stack is allocated by carving off a fixed ratio chunk of the primary task stack. The -D option is used to define the size of the environment task's secondary stack. -@item ^-e^/ELABORATION_DEPENDENCIES^ -@cindex @option{^-e^/ELABORATION_DEPENDENCIES^} (@command{gnatbind}) +@item -e +@cindex @option{-e} (@command{gnatbind}) Output complete list of elaboration-order dependencies. -@item ^-E^/STORE_TRACEBACKS^ -@cindex @option{^-E^/STORE_TRACEBACKS^} (@command{gnatbind}) +@item -E +@cindex @option{-E} (@command{gnatbind}) Store tracebacks in exception occurrences when the target supports it. @ignore @c The following may get moved to an appendix @@ -8442,13 +8004,11 @@ all x86 ports, Solaris, Windows, HP-UX, AIX, PowerPC VxWorks and Alpha VxWorks. @end ignore See also the packages @code{GNAT.Traceback} and @code{GNAT.Traceback.Symbolic} for more information. -@ifclear vms Note that on x86 ports, you must not use @option{-fomit-frame-pointer} @command{gcc} option. -@end ifclear -@item ^-F^/FORCE_ELABS_FLAGS^ -@cindex @option{^-F^/FORCE_ELABS_FLAGS^} (@command{gnatbind}) +@item -F +@cindex @option{-F} (@command{gnatbind}) Force the checks of elaboration flags. @command{gnatbind} does not normally generate checks of elaboration flags for the main executable, except when a Stand-Alone Library is used. However, there are cases when this cannot be @@ -8457,59 +8017,51 @@ Library through a pragma Import and only specifying through a linker switch this Stand-Alone Library. This switch is used to guarantee that elaboration flag checks are generated. -@item ^-h^/HELP^ -@cindex @option{^-h^/HELP^} (@command{gnatbind}) +@item -h +@cindex @option{-h} (@command{gnatbind}) Output usage (help) information -@item ^-H32^/32_MALLOC^ -@cindex @option{^-H32^/32_MALLOC^} (@command{gnatbind}) +@item -H32 +@cindex @option{-H32} (@command{gnatbind}) Use 32-bit allocations for @code{__gnat_malloc} (and thus for access types). For further details see @ref{Dynamic Allocation Control}. -@item ^-H64^/64_MALLOC^ -@cindex @option{^-H64^/64_MALLOC^} (@command{gnatbind}) +@item -H64 +@cindex @option{-H64} (@command{gnatbind}) Use 64-bit allocations for @code{__gnat_malloc} (and thus for access types). @cindex @code{__gnat_malloc} For further details see @ref{Dynamic Allocation Control}. -@item ^-I^/SEARCH^ -@cindex @option{^-I^/SEARCH^} (@command{gnatbind}) +@item -I +@cindex @option{-I} (@command{gnatbind}) Specify directory to be searched for source and ALI files. -@item ^-I-^/NOCURRENT_DIRECTORY^ -@cindex @option{^-I-^/NOCURRENT_DIRECTORY^} (@command{gnatbind}) +@item -I- +@cindex @option{-I-} (@command{gnatbind}) Do not look for sources in the current directory where @code{gnatbind} was invoked, and do not look for ALI files in the directory containing the ALI file named in the @code{gnatbind} command line. -@item ^-l^/ORDER_OF_ELABORATION^ -@cindex @option{^-l^/ORDER_OF_ELABORATION^} (@command{gnatbind}) +@item -l +@cindex @option{-l} (@command{gnatbind}) Output chosen elaboration order. -@item ^-L@var{xxx}^/BUILD_LIBRARY=@var{xxx}^ -@cindex @option{^-L^/BUILD_LIBRARY^} (@command{gnatbind}) +@item -L@var{xxx} +@cindex @option{-L} (@command{gnatbind}) Bind the units for library building. In this case the adainit and adafinal procedures (@pxref{Binding with Non-Ada Main Programs}) -are renamed to ^@var{xxx}init^@var{XXX}INIT^ and -^@var{xxx}final^@var{XXX}FINAL^. -Implies ^-n^/NOCOMPILE^. -@ifclear vms +are renamed to @var{xxx}init and +@var{xxx}final. +Implies -n. (@xref{GNAT and Libraries}, for more details.) -@end ifclear -@ifset vms -On OpenVMS, these init and final procedures are exported in uppercase -letters. For example if /BUILD_LIBRARY=toto is used, the exported name of -the init procedure will be "TOTOINIT" and the exported name of the final -procedure will be "TOTOFINAL". -@end ifset -@item ^-Mxyz^/RENAME_MAIN=xyz^ -@cindex @option{^-M^/RENAME_MAIN^} (@command{gnatbind}) +@item -Mxyz +@cindex @option{-M} (@command{gnatbind}) Rename generated main program from main to xyz. This option is supported on cross environments only. -@item ^-m^/ERROR_LIMIT=^@var{n} -@cindex @option{^-m^/ERROR_LIMIT^} (@command{gnatbind}) +@item -m@var{n} +@cindex @option{-m} (@command{gnatbind}) Limit number of detected errors or warnings to @var{n}, where @var{n} is in the range 1..999999. The default value if no switch is given is 9999. If the number of warnings reaches this limit, then a @@ -8519,8 +8071,8 @@ limit, then a message is output and the bind is abandoned. A value of zero means that no limit is enforced. The equal sign is optional. -@item ^-n^/NOMAIN^ -@cindex @option{^-n^/NOMAIN^} (@command{gnatbind}) +@item -n +@cindex @option{-n} (@command{gnatbind}) No main program. @item -nostdinc @@ -8536,45 +8088,45 @@ Do not look for library files in the system default directory. Specifies the default location of the runtime library. Same meaning as the equivalent @command{gnatmake} flag (@pxref{Switches for gnatmake}). -@item ^-o ^/OUTPUT=^@var{file} -@cindex @option{^-o ^/OUTPUT^} (@command{gnatbind}) +@item -o @var{file} +@cindex @option{-o } (@command{gnatbind}) Name the output file @var{file} (default is @file{b~@var{xxx}.adb}). Note that if this option is used, then linking must be done manually, gnatlink cannot be used. -@item ^-O^/OBJECT_LIST^@r{[=}@var{filename}@r{]} -@cindex @option{^-O^/OBJECT_LIST^} (@command{gnatbind}) +@item -O@r{[=}@var{filename}@r{]} +@cindex @option{-O} (@command{gnatbind}) Output object list (to standard output or to the named file). -@item ^-p^/PESSIMISTIC_ELABORATION^ -@cindex @option{^-p^/PESSIMISTIC_ELABORATION^} (@command{gnatbind}) +@item -p +@cindex @option{-p} (@command{gnatbind}) Pessimistic (worst-case) elaboration order -@item ^-P^-P^ -@cindex @option{^-P^/CODEPEER^} (@command{gnatbind}) +@item -P +@cindex @option{-P} (@command{gnatbind}) Generate binder file suitable for CodePeer. -@item ^-R^-R^ -@cindex @option{^-R^-R^} (@command{gnatbind}) +@item -R +@cindex @option{-R} (@command{gnatbind}) Output closure source list, which includes all non-time-units that are included in the bind. -@item ^-Ra^-Ra^ -@cindex @option{^-Ra^-Ra^} (@command{gnatbind}) +@item -Ra +@cindex @option{-Ra} (@command{gnatbind}) Like @option{-R} but the list includes run-time units. -@item ^-s^/READ_SOURCES=ALL^ -@cindex @option{^-s^/READ_SOURCES=ALL^} (@command{gnatbind}) +@item -s +@cindex @option{-s} (@command{gnatbind}) Require all source files to be present. -@item ^-S@var{xxx}^/INITIALIZE_SCALARS=@var{xxx}^ -@cindex @option{^-S^/INITIALIZE_SCALARS^} (@command{gnatbind}) +@item -S@var{xxx} +@cindex @option{-S} (@command{gnatbind}) Specifies the value to be used when detecting uninitialized scalar objects with pragma Initialize_Scalars. -The @var{xxx} ^string specified with the switch^option^ is one of: +The @var{xxx} string specified with the switch is one of: @itemize @bullet -@item ``@option{^in^INVALID^}'' for an invalid value +@item ``@option{in}'' for an invalid value If zero is invalid for the discrete type in question, then the scalar value is set to all zero bits. For signed discrete types, the largest possible negative value of @@ -8583,7 +8135,7 @@ For unsigned discrete types, the underlying scalar value is set to all one bits. For floating-point types, a NaN value is set (see body of package System.Scalar_Values for exact values). -@item ``@option{^lo^LOW^}'' for low value +@item ``@option{lo}'' for low value If zero is invalid for the discrete type in question, then the scalar value is set to all zero bits. For signed discrete types, the largest possible negative value of @@ -8592,7 +8144,7 @@ For unsigned discrete types, the underlying scalar value is set to all zero bits. For floating-point, a small value is set (see body of package System.Scalar_Values for exact values). -@item ``@option{^hi^HIGH^}'' for high value +@item ``@option{hi}'' for high value If zero is invalid for the discrete type in question, then the scalar value is set to all one bits. For signed discrete types, the largest possible positive value of @@ -8615,7 +8167,6 @@ of @option{in/lo/hi/@var{xx}} with the same meanings as above. If no environment variable is found, or if it does not have a valid value, then the default is @option{in} (invalid values). -@ifclear vms @item -static @cindex @option{-static} (@code{gnatbind}) Link against a static GNAT run time. @@ -8623,14 +8174,13 @@ Link against a static GNAT run time. @item -shared @cindex @option{-shared} (@code{gnatbind}) Link against a shared GNAT run time when available. -@end ifclear -@item ^-t^/NOTIME_STAMP_CHECK^ -@cindex @option{^-t^/NOTIME_STAMP_CHECK^} (@code{gnatbind}) +@item -t +@cindex @option{-t} (@code{gnatbind}) Tolerate time stamp and other consistency errors -@item ^-T@var{n}^/TIME_SLICE=@var{n}^ -@cindex @option{^-T^/TIME_SLICE^} (@code{gnatbind}) +@item -T@var{n} +@cindex @option{-T} (@code{gnatbind}) Set the time slice value to @var{n} milliseconds. If the system supports the specification of a specific time slice value, then the indicated value is used. If the system does not support specific time slice values, but @@ -8643,78 +8193,50 @@ semantics should match as closely as possible the Annex D requirements of the Ada RM, and in particular sets the default scheduling policy to @code{FIFO_Within_Priorities}. -@item ^-u@var{n}^/DYNAMIC_STACK_USAGE=@var{n}^ -@cindex @option{^-u^/DYNAMIC_STACK_USAGE^} (@code{gnatbind}) +@item -u@var{n} +@cindex @option{-u} (@code{gnatbind}) Enable dynamic stack usage, with @var{n} results stored and displayed at program termination. A result is generated when a task terminates. Results that can't be stored are displayed on the fly, at task termination. This option is currently not supported on Itanium platforms. (See @ref{Dynamic Stack Usage Analysis} for details.) -@item ^-v^/REPORT_ERRORS=VERBOSE^ -@cindex @option{^-v^/REPORT_ERRORS=VERBOSE^} (@code{gnatbind}) +@item -v +@cindex @option{-v} (@code{gnatbind}) Verbose mode. Write error messages, header, summary output to @file{stdout}. -@ifclear vms @item -w@var{x} @cindex @option{-w} (@code{gnatbind}) Warning mode (@var{x}=s/e for suppress/treat as error) -@end ifclear - -@ifset vms -@item /WARNINGS=NORMAL -@cindex @option{/WARNINGS} (@code{gnatbind}) -Normal warnings mode. Warnings are issued but ignored -@item /WARNINGS=SUPPRESS -@cindex @option{/WARNINGS} (@code{gnatbind}) -All warning messages are suppressed -@item /WARNINGS=ERROR -@cindex @option{/WARNINGS} (@code{gnatbind}) -Warning messages are treated as fatal errors -@end ifset - -@item ^-Wx^/WIDE_CHARACTER_ENCODING=^@var{e} -@cindex @option{^-Wx^/WIDE_CHARACTER_ENCODING^} (@code{gnatbind}) +@item -Wx@var{e} +@cindex @option{-Wx} (@code{gnatbind}) Override default wide character encoding for standard Text_IO files. -@item ^-x^/READ_SOURCES=NONE^ -@cindex @option{^-x^/READ_SOURCES^} (@code{gnatbind}) +@item -x +@cindex @option{-x} (@code{gnatbind}) Exclude source files (check object consistency only). -@ifset vms -@item /READ_SOURCES=AVAILABLE -@cindex @option{/READ_SOURCES} (@code{gnatbind}) -Default mode, in which sources are checked for consistency only if -they are available. -@end ifset -@item ^-X@var{nnn}^/RETURN_CODES=POSIX^ -@cindex @option{^-X@var{nnn}^/RETURN_CODES=POSIX^} (@code{gnatbind}) +@item -X@var{nnn} +@cindex @option{-X@var{nnn}} (@code{gnatbind}) Set default exit status value, normally 0 for POSIX compliance. -@ifset vms -@item /RETURN_CODES=VMS -@cindex @option{/RETURN_CODES=VMS} (@code{gnatbind}) -VMS default normal successful return value is 1. -@end ifset -@item ^-y^/ENABLE_LEAP_SECONDS^ -@cindex @option{^-y^/ENABLE_LEAP_SECONDS^} (@code{gnatbind}) +@item -y +@cindex @option{-y} (@code{gnatbind}) Enable leap seconds support in @code{Ada.Calendar} and its children. -@item ^-z^/ZERO_MAIN^ -@cindex @option{^-z^/ZERO_MAIN^} (@code{gnatbind}) +@item -z +@cindex @option{-z} (@code{gnatbind}) No main subprogram. @end table -@ifclear vms @noindent You may obtain this listing of switches by running @code{gnatbind} with no arguments. -@end ifclear @node Consistency-Checking Modes @subsection Consistency-Checking Modes @@ -8727,26 +8249,26 @@ access to sources. @table @option @c !sort! -@item ^-s^/READ_SOURCES=ALL^ -@cindex @option{^-s^/READ_SOURCES=ALL^} (@code{gnatbind}) +@item -s +@cindex @option{-s} (@code{gnatbind}) Require source files to be present. In this mode, the binder must be able to locate all source files that are referenced, in order to check their consistency. In normal mode, if a source file cannot be located it is simply ignored. If you specify this switch, a missing source file is an error. -@item ^-Wx^/WIDE_CHARACTER_ENCODING=^@var{e} -@cindex @option{^-Wx^/WIDE_CHARACTER_ENCODING^} (@code{gnatbind}) +@item -Wx@var{e} +@cindex @option{-Wx} (@code{gnatbind}) Override default wide character encoding for standard Text_IO files. Normally the default wide character encoding method used for standard [Wide_[Wide_]]Text_IO files is taken from the encoding specified for the main source input (see description of switch -@option{^-gnatWx^/WIDE_CHARACTER_ENCODING^} for the compiler). The +@option{-gnatWx} for the compiler). The use of this switch for the binder (which has the same set of possible arguments) overrides this default as specified. -@item ^-x^/READ_SOURCES=NONE^ -@cindex @option{^-x^/READ_SOURCES=NONE^} (@code{gnatbind}) +@item -x +@cindex @option{-x} (@code{gnatbind}) Exclude source files. In this mode, the binder only checks that ALI files are consistent with one another. Source files are not accessed. The binder runs faster in this mode, and there is still a guarantee that @@ -8758,12 +8280,6 @@ mode that is automatically used by @command{gnatmake} because in this case the checking against sources has already been performed by @command{gnatmake} in the course of compilation (i.e.@: before binding). -@ifset vms -@item /READ_SOURCES=AVAILABLE -@cindex @code{/READ_SOURCES=AVAILABLE} (@code{gnatbind}) -This is the default mode in which source files are checked if they are -available, and ignored if they are not available. -@end ifset @end table @node Binder Error Message Control @@ -8775,20 +8291,19 @@ messages from the binder: @table @option @c !sort! -@item ^-v^/REPORT_ERRORS=VERBOSE^ -@cindex @option{^-v^/REPORT_ERRORS=VERBOSE^} (@code{gnatbind}) +@item -v +@cindex @option{-v} (@code{gnatbind}) Verbose mode. In the normal mode, brief error messages are generated to @file{stderr}. If this switch is present, a header is written to @file{stdout} and any error messages are directed to @file{stdout}. All that is written to @file{stderr} is a brief summary message. -@item ^-b^/REPORT_ERRORS=BRIEF^ -@cindex @option{^-b^/REPORT_ERRORS=BRIEF^} (@code{gnatbind}) +@item -b +@cindex @option{-b} (@code{gnatbind}) Generate brief error messages to @file{stderr} even if verbose mode is specified. This is relevant only when used with the -@option{^-v^/REPORT_ERRORS=VERBOSE^} switch. +@option{-v} switch. -@ifclear vms @item -m@var{n} @cindex @option{-m} (@code{gnatbind}) Limits the number of error messages to @var{n}, a decimal integer in the @@ -8800,25 +8315,19 @@ Renames the generated main program from @code{main} to @code{xxx}. This is useful in the case of some cross-building environments, where the actual main program is separate from the one generated by @code{gnatbind}. -@end ifclear -@item ^-ws^/WARNINGS=SUPPRESS^ -@cindex @option{^-ws^/WARNINGS=SUPPRESS^} (@code{gnatbind}) +@item -ws +@cindex @option{-ws} (@code{gnatbind}) @cindex Warnings Suppress all warning messages. -@item ^-we^/WARNINGS=ERROR^ -@cindex @option{^-we^/WARNINGS=ERROR^} (@code{gnatbind}) +@item -we +@cindex @option{-we} (@code{gnatbind}) Treat any warning messages as fatal errors. -@ifset vms -@item /WARNINGS=NORMAL -Standard mode with warnings generated, but warnings do not get treated -as errors. -@end ifset -@item ^-t^/NOTIME_STAMP_CHECK^ -@cindex @option{^-t^/NOTIME_STAMP_CHECK^} (@code{gnatbind}) +@item -t +@cindex @option{-t} (@code{gnatbind}) @cindex Time stamp checks, in binder @cindex Binder consistency checks @cindex Consistency checks, in binder @@ -8841,13 +8350,13 @@ requirements of the Ada Reference Manual, causes error messages to be generated which abort the binder and prevent the output of a binder file and subsequent link to obtain an executable. -The @option{^-t^/NOTIME_STAMP_CHECK^} switch converts these error messages +The @option{-t} switch converts these error messages into warnings, so that binding and linking can continue to completion even in the presence of such errors. The result may be a failed link (due to missing symbols), or a non-functional executable which has undefined semantics. @emph{This means that -@option{^-t^/NOTIME_STAMP_CHECK^} should be used only in unusual situations, +@option{-t} should be used only in unusual situations, with extreme care.} @end table @@ -8859,8 +8368,8 @@ The following switches provide additional control over the elaboration order. For full details see @ref{Elaboration Order Handling in GNAT}. @table @option -@item ^-p^/PESSIMISTIC_ELABORATION^ -@cindex @option{^-p^/PESSIMISTIC_ELABORATION^} (@code{gnatbind}) +@item -p +@cindex @option{-p} (@code{gnatbind}) Normally the binder attempts to choose an elaboration order that is likely to minimize the likelihood of an elaboration order error resulting in raising a @code{Program_Error} exception. This switch reverses the @@ -8869,16 +8378,16 @@ that is likely to maximize the likelihood of an elaboration error. This is useful in ensuring portability and avoiding dependence on accidental fortuitous elaboration ordering. -Normally it only makes sense to use the @option{^-p^/PESSIMISTIC_ELABORATION^} +Normally it only makes sense to use the @option{-p} switch if dynamic elaboration checking is used (@option{-gnatE} switch used for compilation). This is because in the default static elaboration mode, all necessary @code{Elaborate} and @code{Elaborate_All} pragmas are implicitly inserted. These implicit pragmas are still respected by the binder in -@option{^-p^/PESSIMISTIC_ELABORATION^} mode, so a +@option{-p} mode, so a safe elaboration order is assured. -Note that @option{^-p^/PESSIMISTIC_ELABORATION^} is not intended for +Note that @option{-p} is not intended for production use; it is more for debugging/experimental use. @end table @@ -8892,34 +8401,34 @@ generated by the binder. @table @option @c !sort! -@item ^-c^/NOOUTPUT^ -@cindex @option{^-c^/NOOUTPUT^} (@code{gnatbind}) +@item -c +@cindex @option{-c} (@code{gnatbind}) Check only. Do not generate the binder output file. In this mode the binder performs all error checks but does not generate an output file. -@item ^-e^/ELABORATION_DEPENDENCIES^ -@cindex @option{^-e^/ELABORATION_DEPENDENCIES^} (@code{gnatbind}) +@item -e +@cindex @option{-e} (@code{gnatbind}) Output complete list of elaboration-order dependencies, showing the reason for each dependency. This output can be rather extensive but may be useful in diagnosing problems with elaboration order. The output is written to @file{stdout}. -@item ^-h^/HELP^ -@cindex @option{^-h^/HELP^} (@code{gnatbind}) +@item -h +@cindex @option{-h} (@code{gnatbind}) Output usage information. The output is written to @file{stdout}. -@item ^-K^/LINKER_OPTION_LIST^ -@cindex @option{^-K^/LINKER_OPTION_LIST^} (@code{gnatbind}) +@item -K +@cindex @option{-K} (@code{gnatbind}) Output linker options to @file{stdout}. Includes library search paths, contents of pragmas Ident and Linker_Options, and libraries added by @code{gnatbind}. -@item ^-l^/ORDER_OF_ELABORATION^ -@cindex @option{^-l^/ORDER_OF_ELABORATION^} (@code{gnatbind}) +@item -l +@cindex @option{-l} (@code{gnatbind}) Output chosen elaboration order. The output is written to @file{stdout}. -@item ^-O^/OBJECT_LIST^ -@cindex @option{^-O^/OBJECT_LIST^} (@code{gnatbind}) +@item -O +@cindex @option{-O} (@code{gnatbind}) Output full names of all the object files that must be linked to provide the Ada component of the program. The output is written to @file{stdout}. This list includes the files explicitly supplied and referenced by the user @@ -8927,8 +8436,8 @@ as well as implicitly referenced run-time unit files. The latter are omitted if the corresponding units reside in shared libraries. The directory names for the run-time units depend on the system configuration. -@item ^-o ^/OUTPUT=^@var{file} -@cindex @option{^-o^/OUTPUT^} (@code{gnatbind}) +@item -o @var{file} +@cindex @option{-o} (@code{gnatbind}) Set name of output file to @var{file} instead of the normal @file{b~@var{mainprog}.adb} default. Note that @var{file} denote the Ada binder generated body filename. @@ -8936,8 +8445,8 @@ Note that if this option is used, then linking must be done manually. It is not possible to use gnatlink in this case, since it cannot locate the binder file. -@item ^-r^/RESTRICTION_LIST^ -@cindex @option{^-r^/RESTRICTION_LIST^} (@code{gnatbind}) +@item -r +@cindex @option{-r} (@code{gnatbind}) Generate list of @code{pragma Restrictions} that could be applied to the current unit. This is useful for code audit purposes, and also may be used to improve code generation in some cases. @@ -8963,14 +8472,8 @@ Allocate memory on 64-bit heap. This is the default unless explicitly overridden by a @code{'Size} clause on the access type. @end table -@ifset vms -@noindent -See also @ref{Access types and 32/64-bit allocation}. -@end ifset -@ifclear vms @noindent These switches are only effective on VMS platforms. -@end ifclear @node Binding with Non-Ada Main Programs @@ -8986,8 +8489,8 @@ written in Ada and compiled using GNAT (@pxref{Mixed Language Programming}). The following switch is used in this situation: @table @option -@item ^-n^/NOMAIN^ -@cindex @option{^-n^/NOMAIN^} (@code{gnatbind}) +@item -n +@cindex @option{-n} (@code{gnatbind}) No main program. The main program is not in Ada. @end table @@ -9020,8 +8523,8 @@ terminates. @end table @noindent -If the @option{^-n^/NOMAIN^} switch -@cindex @option{^-n^/NOMAIN^} (@command{gnatbind}) +If the @option{-n} switch +@cindex @option{-n} (@command{gnatbind}) @cindex Binder, multiple input files is given, more than one ALI file may appear on the command line for @code{gnatbind}. The normal @dfn{closure} @@ -9032,8 +8535,8 @@ specify more than one ALI file is that a given program may invoke two or more quite separate groups of Ada units. The binder takes the name of its output file from the last specified ALI -file, unless overridden by the use of the @option{^-o file^/OUTPUT=file^}. -@cindex @option{^-o^/OUTPUT^} (@command{gnatbind}) +file, unless overridden by the use of the @option{-o file}. +@cindex @option{-o} (@command{gnatbind}) The output is an Ada unit in source form that can be compiled with GNAT. This compilation occurs automatically as part of the @command{gnatlink} processing. @@ -9056,8 +8559,8 @@ packages, then the finalization routines. The following switch is used to bind programs organized in this manner: @table @option -@item ^-z^/ZERO_MAIN^ -@cindex @option{^-z^/ZERO_MAIN^} (@code{gnatbind}) +@item -z +@cindex @option{-z} (@code{gnatbind}) Normally the binder checks that the unit name given on the command line corresponds to a suitable main subprogram. When this switch is used, a list of ALI files can be given, and the execution of the program @@ -9065,7 +8568,7 @@ consists of elaboration of these units in an appropriate order. Note that the default wide character encoding method for standard Text_IO files is always set to Brackets if this switch is set (you can use the binder switch -@option{^-Wx^WIDE_CHARACTER_ENCODING^} to override this default). +@option{-Wx} to override this default). @end table @node Command-Line Access @@ -9088,9 +8591,9 @@ char **gnat_argv; @findex gnat_argc are declared in one of the GNAT library routines. These variables must be set from the actual @code{argc} and @code{argv} values passed to the -main program. With no @option{^n^/NOMAIN^} present, @code{gnatbind} +main program. With no @option{n} present, @code{gnatbind} generates the C main program to automatically set these variables. -If the @option{^n^/NOMAIN^} switch is used, there is no automatic way to +If the @option{n} switch is used, there is no automatic way to set these variables. If they are not set, the procedures in @code{Ada.Command_Line} will not be available, and any attempt to use them will raise @code{Constraint_Error}. If command line access is @@ -9112,79 +8615,54 @@ directories searched are: @enumerate @item The directory containing the ALI file named in the command line, unless -the switch @option{^-I-^/NOCURRENT_DIRECTORY^} is specified. +the switch @option{-I-} is specified. @item -All directories specified by @option{^-I^/SEARCH^} +All directories specified by @option{-I} switches on the @code{gnatbind} command line, in the order given. @item @findex ADA_PRJ_OBJECTS_FILE Each of the directories listed in the text file whose name is given -by the @env{ADA_PRJ_OBJECTS_FILE} ^environment variable^logical name^. +by the @env{ADA_PRJ_OBJECTS_FILE} environment variable. @noindent -@env{ADA_PRJ_OBJECTS_FILE} is normally set by gnatmake or by the ^gnat^GNAT^ +@env{ADA_PRJ_OBJECTS_FILE} is normally set by gnatmake or by the gnat driver when project files are used. It should not normally be set by other means. @item @findex ADA_OBJECTS_PATH Each of the directories listed in the value of the -@env{ADA_OBJECTS_PATH} ^environment variable^logical name^. -@ifset unw +@env{ADA_OBJECTS_PATH} environment variable. Construct this value exactly as the @env{PATH} environment variable: a list of directory names separated by colons (semicolons when working with the NT version of GNAT). -@end ifset -@ifset vms -Normally, define this value as a logical name containing a comma separated -list of directory names. - -This variable can also be defined by means of an environment string -(an argument to the HP C exec* set of functions). - -Logical Name: -@smallexample -DEFINE ANOTHER_PATH FOO:[BAG] -DEFINE ADA_OBJECTS_PATH ANOTHER_PATH,FOO:[BAM],FOO:[BAR] -@end smallexample - -By default, the path includes GNU:[LIB.OPENVMS7_x.2_8_x.DECLIB] -first, followed by the standard Ada -libraries in GNU:[LIB.OPENVMS7_x.2_8_x.ADALIB]. -If this is not redefined, the user will obtain the HP Ada 83 IO packages -(Text_IO, Sequential_IO, etc) -instead of the standard Ada packages. Thus, in order to get the standard Ada -packages by default, ADA_OBJECTS_PATH must be redefined. -@end ifset @item The content of the @file{ada_object_path} file which is part of the GNAT installation tree and is used to store standard libraries such as the GNAT Run Time Library (RTL) unless the switch @option{-nostdlib} is specified. -@ifclear vms @ref{Installing a library} -@end ifclear @end enumerate @noindent -In the binder the switch @option{^-I^/SEARCH^} -@cindex @option{^-I^/SEARCH^} (@command{gnatbind}) +In the binder the switch @option{-I} +@cindex @option{-I} (@command{gnatbind}) is used to specify both source and -library file paths. Use @option{^-aI^/SOURCE_SEARCH^} -@cindex @option{^-aI^/SOURCE_SEARCH^} (@command{gnatbind}) +library file paths. Use @option{-aI} +@cindex @option{-aI} (@command{gnatbind}) instead if you want to specify -source paths only, and @option{^-aO^/LIBRARY_SEARCH^} -@cindex @option{^-aO^/LIBRARY_SEARCH^} (@command{gnatbind}) +source paths only, and @option{-aO} +@cindex @option{-aO} (@command{gnatbind}) if you want to specify library paths only. This means that for the binder -@option{^-I^/SEARCH=^}@var{dir} is equivalent to -@option{^-aI^/SOURCE_SEARCH=^}@var{dir} -@option{^-aO^/OBJECT_SEARCH=^}@var{dir}. +@option{-I}@var{dir} is equivalent to +@option{-aI}@var{dir} +@option{-aO}@var{dir}. The binder generates the bind file (a C language source file) in the current working directory. @@ -9221,12 +8699,7 @@ The main program @code{Hello} (source program in @file{hello.adb}) is bound using the standard switch settings. The generated main program is @file{b~hello.adb}. This is the normal, default use of the binder. -@ifclear vms @item gnatbind hello -o mainprog.adb -@end ifclear -@ifset vms -@item gnatbind HELLO.ALI /OUTPUT=Mainprog.ADB -@end ifset The main program @code{Hello} (source program in @file{hello.adb}) is bound using the standard switch settings. The generated main program is @file{mainprog.adb} with the associated spec in @@ -9244,7 +8717,7 @@ since gnatlink will not be able to find the generated file. @noindent This chapter discusses @command{gnatlink}, a tool that links an Ada program and builds an executable file. This utility -invokes the system linker ^(via the @command{gcc} command)^^ +invokes the system linker (via the @command{gcc} command) with a correct list of object files and library references. @command{gnatlink} automatically determines the list of files and references for the Ada part of a program. It uses the binder file @@ -9318,15 +8791,13 @@ details. Here is an example showing how to generate a linker map: @smallexample -$ ^gnatlink my_prog -Wl,-Map,MAPFILE^GNAT LINK my_prog.ali /MAP^ +$ gnatlink my_prog -Wl,-Map,MAPFILE @end smallexample Using @var{linker options} it is possible to set the program stack and heap size. -@ifset unw See @ref{Setting Stack Size from gnatlink} and @ref{Setting Heap Size from gnatlink}. -@end ifset @command{gnatlink} determines the list of objects required by the Ada program and prepends them to the list of objects passed to the linker. @@ -9334,12 +8805,6 @@ program and prepends them to the list of objects passed to the linker. @code{pragma Linker_Options} and adds them to the list of arguments presented to the linker. -@ifset vms -@command{gnatlink} accepts the following types of extra files on the command -line: objects (@file{.OBJ}), libraries (@file{.OLB}), sharable images -(@file{.EXE}), and options files (@file{.OPT}). These are recognized and -handled according to their extension. -@end ifset @node Switches for gnatlink @section Switches for @command{gnatlink} @@ -9359,55 +8824,54 @@ Display Copyright and version, then exit disregarding all other options. If @option{--version} was not used, display usage, then exit disregarding all other options. -@item ^-f^/FORCE_OBJECT_FILE_LIST^ +@item -f @cindex Command line length -@cindex @option{^-f^/FORCE_OBJECT_FILE_LIST^} (@command{gnatlink}) +@cindex @option{-f} (@command{gnatlink}) On some targets, the command line length is limited, and @command{gnatlink} will generate a separate file for the linker if the list of object files is too long. -The @option{^-f^/FORCE_OBJECT_FILE_LIST^} switch forces this file +The @option{-f} switch forces this file to be generated even if the limit is not exceeded. This is useful in some cases to deal with special situations where the command line length is exceeded. -@item ^-g^/DEBUG^ +@item -g @cindex Debugging information, including -@cindex @option{^-g^/DEBUG^} (@command{gnatlink}) +@cindex @option{-g} (@command{gnatlink}) The option to include debugging information causes the Ada bind file (in other words, @file{b~@var{mainprog}.adb}) to be compiled with -@option{^-g^/DEBUG^}. +@option{-g}. In addition, the binder does not delete the @file{b~@var{mainprog}.adb}, @file{b~@var{mainprog}.o} and @file{b~@var{mainprog}.ali} files. -Without @option{^-g^/DEBUG^}, the binder removes these files by +Without @option{-g}, the binder removes these files by default. The same procedure apply if a C bind file was generated using -@option{^-C^/BIND_FILE=C^} @code{gnatbind} option, in this case the filenames +@option{-C} @code{gnatbind} option, in this case the filenames are @file{b_@var{mainprog}.c} and @file{b_@var{mainprog}.o}. -@item ^-n^/NOCOMPILE^ -@cindex @option{^-n^/NOCOMPILE^} (@command{gnatlink}) +@item -n +@cindex @option{-n} (@command{gnatlink}) Do not compile the file generated by the binder. This may be used when a link is rerun with different options, but there is no need to recompile the binder file. -@item ^-v^/VERBOSE^ -@cindex @option{^-v^/VERBOSE^} (@command{gnatlink}) +@item -v +@cindex @option{-v} (@command{gnatlink}) Causes additional information to be output, including a full list of the included object files. This switch option is most useful when you want to see what set of object files are being used in the link step. -@item ^-v -v^/VERBOSE/VERBOSE^ -@cindex @option{^-v -v^/VERBOSE/VERBOSE^} (@command{gnatlink}) +@item -v -v +@cindex @option{-v -v} (@command{gnatlink}) Very verbose mode. Requests that the compiler operate in verbose mode when it compiles the binder file, and that the system linker run in verbose mode. -@item ^-o ^/EXECUTABLE=^@var{exec-name} -@cindex @option{^-o^/EXECUTABLE^} (@command{gnatlink}) +@item -o @var{exec-name} +@cindex @option{-o} (@command{gnatlink}) @var{exec-name} specifies an alternate name for the generated executable program. If this switch is omitted, the executable has the same name as the main unit. For example, @code{gnatlink try.ali} creates -an executable called @file{^try^TRY.EXE^}. +an executable called @file{try}. -@ifclear vms @item -b @var{target} @cindex @option{-b} (@command{gnatlink}) Compile your program to run on @var{target}, which is the name of a @@ -9465,32 +8929,7 @@ script that massages the parameters before invoking the real linker. It may be useful to control the exact invocation by using the verbose switch. -@end ifclear -@ifset vms -@item /DEBUG=TRACEBACK -@cindex @code{/DEBUG=TRACEBACK} (@command{gnatlink}) -This qualifier causes sufficient information to be included in the -executable file to allow a traceback, but does not include the full -symbol information needed by the debugger. - -@item /IDENTIFICATION="<string>" -@code{"<string>"} specifies the string to be stored in the image file -identification field in the image header. -It overrides any pragma @code{Ident} specified string. - -@item /NOINHIBIT-EXEC -Generate the executable file even if there are linker warnings. - -@item /NOSTART_FILES -Don't link in the object file containing the ``main'' transfer address. -Used when linking with a foreign language main program compiled with an -HP compiler. - -@item /STATIC -Prefer linking with object libraries over sharable images, even without -/DEBUG. -@end ifset @end table @@ -9581,9 +9020,9 @@ the source path of the compiler as described in @ref{Search Paths and the Run-Time Library (RTL)}. All @command{gnatmake} output (except when you specify -@option{^-M^/DEPENDENCIES_LIST^}) is to +@option{-M}) is to @file{stderr}. The output produced by the -@option{^-M^/DEPENDENCIES_LIST^} switch is send to +@option{-M} switch is send to @file{stdout}. @node Switches for gnatmake @@ -9604,7 +9043,6 @@ Display Copyright and version, then exit disregarding all other options. If @option{--version} was not used, display usage, then exit disregarding all other options. -@ifclear vms @item --GCC=@var{compiler_name} @cindex @option{--GCC=compiler_name} (@command{gnatmake}) Program used for compiling. The default is `@command{gcc}'. You need to use @@ -9643,22 +9081,21 @@ linker. Linker switches that are normally appended by @command{gnatmake} to A limitation of this syntax is that the name and path name of the executable itself must not include any embedded spaces. -@end ifclear -@item ^--subdirs^/SUBDIRS^=subdir +@item --subdirs=subdir Actual object directory of each project file is the subdirectory subdir of the object directory specified or defaulted in the project file. -@item ^--single-compile-per-obj-dir^/SINGLE_COMPILE_PER_OBJ_DIR^ +@item --single-compile-per-obj-dir Disallow simultaneous compilations in the same object directory when project files are used. -@item ^--unchecked-shared-lib-imports^/UNCHECKED_SHARED_LIB_IMPORTS^ +@item --unchecked-shared-lib-imports By default, shared library projects are not allowed to import static library projects. When this switch is used on the command line, this restriction is relaxed. -@item ^--source-info=<source info file>^/SRC_INFO=source-info-file^ +@item --source-info=<source info file> Specify a source info file. This switch is active only when project files are used. If the source info file is specified as a relative path, then it is relative to the object directory of the main project. If the source info file @@ -9675,7 +9112,6 @@ fail. @command{gnatmake} "trusts" the source info file. This means that if the source files have changed (addition, deletion, moving to a different source directory), then the source info file need to be deleted and recreated. -@ifclear vms @item --create-map-file When linking an executable, create a map file. The name of the map file has the same name as the executable with extension ".map". @@ -9684,10 +9120,9 @@ has the same name as the executable with extension ".map". When linking an executable, create a map file. The name of the map file is "mapfile". -@end ifclear -@item ^-a^/ALL_FILES^ -@cindex @option{^-a^/ALL_FILES^} (@command{gnatmake}) +@item -a +@cindex @option{-a} (@command{gnatmake}) Consider all files in the make process, even the GNAT internal system files (for example, the predefined Ada library files), as well as any locked files. Locked files are files whose ALI file is write-protected. @@ -9699,72 +9134,67 @@ installed. Note that if there is an installation problem, such that one of these files is not up to date, it will be properly caught by the binder. You may have to specify this switch if you are working on GNAT -itself. The switch @option{^-a^/ALL_FILES^} is also useful -in conjunction with @option{^-f^/FORCE_COMPILE^} +itself. The switch @option{-a} is also useful +in conjunction with @option{-f} if you need to recompile an entire application, including run-time files, using special configuration pragmas, such as a @code{Normalize_Scalars} pragma. By default -@code{gnatmake ^-a^/ALL_FILES^} compiles all GNAT +@code{gnatmake -a} compiles all GNAT internal files with -@ifclear vms @code{gcc -c -gnatpg} rather than @code{gcc -c}. -@end ifclear -@ifset vms -the @code{/CHECKS=SUPPRESS_ALL /STYLE_CHECKS=GNAT} switch. -@end ifset -@item ^-b^/ACTIONS=BIND^ -@cindex @option{^-b^/ACTIONS=BIND^} (@command{gnatmake}) -Bind only. Can be combined with @option{^-c^/ACTIONS=COMPILE^} to do +@item -b +@cindex @option{-b} (@command{gnatmake}) +Bind only. Can be combined with @option{-c} to do compilation and binding, but no link. -Can be combined with @option{^-l^/ACTIONS=LINK^} +Can be combined with @option{-l} to do binding and linking. When not combined with -@option{^-c^/ACTIONS=COMPILE^} +@option{-c} all the units in the closure of the main program must have been previously compiled and must be up to date. The root unit specified by @var{file_name} may be given without extension, with the source extension or, if no GNAT Project File is specified, with the ALI file extension. -@item ^-c^/ACTIONS=COMPILE^ -@cindex @option{^-c^/ACTIONS=COMPILE^} (@command{gnatmake}) -Compile only. Do not perform binding, except when @option{^-b^/ACTIONS=BIND^} +@item -c +@cindex @option{-c} (@command{gnatmake}) +Compile only. Do not perform binding, except when @option{-b} is also specified. Do not perform linking, except if both -@option{^-b^/ACTIONS=BIND^} and -@option{^-l^/ACTIONS=LINK^} are also specified. +@option{-b} and +@option{-l} are also specified. If the root unit specified by @var{file_name} is not a main unit, this is the default. Otherwise @command{gnatmake} will attempt binding and linking unless all objects are up to date and the executable is more recent than the objects. -@item ^-C^/MAPPING^ -@cindex @option{^-C^/MAPPING^} (@command{gnatmake}) +@item -C +@cindex @option{-C} (@command{gnatmake}) Use a temporary mapping file. A mapping file is a way to communicate to the compiler two mappings: from unit names to file names (without any directory information) and from file names to path names (with full directory information). A mapping file can make the compiler's file searches faster, especially if there are many source directories, or the sources are read over a slow network connection. If -@option{^-P^/PROJECT_FILE^} is used, a mapping file is always used, so -@option{^-C^/MAPPING^} is unnecessary; in this case the mapping file +@option{-P} is used, a mapping file is always used, so +@option{-C} is unnecessary; in this case the mapping file is initially populated based on the project file. If -@option{^-C^/MAPPING^} is used without -@option{^-P^/PROJECT_FILE^}, +@option{-C} is used without +@option{-P}, the mapping file is initially empty. Each invocation of the compiler will add any newly accessed sources to the mapping file. -@item ^-C=^/USE_MAPPING_FILE=^@var{file} -@cindex @option{^-C=^/USE_MAPPING^} (@command{gnatmake}) +@item -C=@var{file} +@cindex @option{-C=} (@command{gnatmake}) Use a specific mapping file. The file, specified as a path name (absolute or relative) by this switch, should already exist, otherwise the switch is ineffective. The specified mapping file will be communicated to the compiler. This switch is not compatible with a project file -(^-P^/PROJECT_FILE=^@var{file}) or with multiple compiling processes -(^-j^/PROCESSES=^nnn, when nnn is greater than 1). +(-P@var{file}) or with multiple compiling processes +(-jnnn, when nnn is greater than 1). -@item ^-d^/DISPLAY_PROGRESS^ -@cindex @option{^-d^/DISPLAY_PROGRESS^} (@command{gnatmake}) +@item -d +@cindex @option{-d} (@command{gnatmake}) Display progress for each source, up to date or not, as a single line @smallexample @@ -9774,10 +9204,10 @@ completed x out of y (zz%) If the file needs to be compiled this is displayed after the invocation of the compiler. These lines are displayed even in quiet output mode. -@item ^-D ^/DIRECTORY_OBJECTS=^@var{dir} -@cindex @option{^-D^/DIRECTORY_OBJECTS^} (@command{gnatmake}) +@item -D @var{dir} +@cindex @option{-D} (@command{gnatmake}) Put all object files and ALI file in directory @var{dir}. -If the @option{^-D^/DIRECTORY_OBJECTS^} switch is not used, all object files +If the @option{-D} switch is not used, all object files and ALI files go in the current working directory. This switch cannot be used when using a project file. @@ -9789,7 +9219,6 @@ in the source file is nnn. nnn needs to be a positive number and a valid index in the source. This switch cannot be used when @command{gnatmake} is invoked for several mains. -@ifclear vms @item -eL @cindex @option{-eL} (@command{gnatmake}) @cindex symbolic links @@ -9807,37 +9236,36 @@ save a lot of system calls (several per source file and object file), which can result in a significant speed up to load and manipulate a project file, especially when using source files from a remote system. -@end ifclear -@item ^-eS^/STANDARD_OUTPUT_FOR_COMMANDS^ -@cindex @option{^-eS^/STANDARD_OUTPUT_FOR_COMMANDS^} (@command{gnatmake}) +@item -eS +@cindex @option{-eS} (@command{gnatmake}) Output the commands for the compiler, the binder and the linker -on ^standard output^SYS$OUTPUT^, -instead of ^standard error^SYS$ERROR^. +on standard output, +instead of standard error. -@item ^-f^/FORCE_COMPILE^ -@cindex @option{^-f^/FORCE_COMPILE^} (@command{gnatmake}) +@item -f +@cindex @option{-f} (@command{gnatmake}) Force recompilations. Recompile all sources, even though some object files may be up to date, but don't recompile predefined or GNAT internal files or locked files (files with a write-protected ALI file), -unless the @option{^-a^/ALL_FILES^} switch is also specified. +unless the @option{-a} switch is also specified. -@item ^-F^/FULL_PATH_IN_BRIEF_MESSAGES^ -@cindex @option{^-F^/FULL_PATH_IN_BRIEF_MESSAGES^} (@command{gnatmake}) +@item -F +@cindex @option{-F} (@command{gnatmake}) When using project files, if some errors or warnings are detected during parsing and verbose mode is not in effect (no use of switch -^-v^/VERBOSE^), then error lines start with the full path name of the project +-v), then error lines start with the full path name of the project file, rather than its simple file name. -@item ^-g^/DEBUG^ -@cindex @option{^-g^/DEBUG^} (@command{gnatmake}) +@item -g +@cindex @option{-g} (@command{gnatmake}) Enable debugging. This switch is simply passed to the compiler and to the linker. -@item ^-i^/IN_PLACE^ -@cindex @option{^-i^/IN_PLACE^} (@command{gnatmake}) +@item -i +@cindex @option{-i} (@command{gnatmake}) In normal mode, @command{gnatmake} compiles all object files and ALI files -into the current directory. If the @option{^-i^/IN_PLACE^} switch is used, +into the current directory. If the @option{-i} switch is used, then instead object files and ALI files that already exist are overwritten in place. This means that once a large project is organized into separate directories in the desired manner, then @command{gnatmake} will automatically @@ -9851,8 +9279,8 @@ When detecting such a dummy file, @command{gnatmake} will be forced to recompile the corresponding source file, and it will be put the resulting object and ALI files in the directory where it found the dummy file. -@item ^-j^/PROCESSES=^@var{n} -@cindex @option{^-j^/PROCESSES^} (@command{gnatmake}) +@item -j@var{n} +@cindex @option{-j} (@command{gnatmake}) @cindex Parallel make Use @var{n} processes to carry out the (re)compilations. On a multiprocessor machine compilations will occur in parallel. If @var{n} is 0, then the @@ -9862,8 +9290,8 @@ compilations might get interspersed (but @command{gnatmake} will give you the full ordered list of failing compiles at the end). If this is problematic, rerun the make process with n set to 1 to get a clean list of messages. -@item ^-k^/CONTINUE_ON_ERROR^ -@cindex @option{^-k^/CONTINUE_ON_ERROR^} (@command{gnatmake}) +@item -k +@cindex @option{-k} (@command{gnatmake}) Keep going. Continue as much as possible after a compilation error. To ease the programmer's task in case of compilation errors, the list of sources for which the compile fails is given when @command{gnatmake} @@ -9873,21 +9301,21 @@ If @command{gnatmake} is invoked with several @file{file_names} and with this switch, if there are compilation errors when building an executable, @command{gnatmake} will not attempt to build the following executables. -@item ^-l^/ACTIONS=LINK^ -@cindex @option{^-l^/ACTIONS=LINK^} (@command{gnatmake}) -Link only. Can be combined with @option{^-b^/ACTIONS=BIND^} to binding +@item -l +@cindex @option{-l} (@command{gnatmake}) +Link only. Can be combined with @option{-b} to binding and linking. Linking will not be performed if combined with -@option{^-c^/ACTIONS=COMPILE^} -but not with @option{^-b^/ACTIONS=BIND^}. -When not combined with @option{^-b^/ACTIONS=BIND^} +@option{-c} +but not with @option{-b}. +When not combined with @option{-b} all the units in the closure of the main program must have been previously compiled and must be up to date, and the main program needs to have been bound. The root unit specified by @var{file_name} may be given without extension, with the source extension or, if no GNAT Project File is specified, with the ALI file extension. -@item ^-m^/MINIMAL_RECOMPILATION^ -@cindex @option{^-m^/MINIMAL_RECOMPILATION^} (@command{gnatmake}) +@item -m +@cindex @option{-m} (@command{gnatmake}) Specify that the minimum necessary amount of recompilations be performed. In this mode @command{gnatmake} ignores time stamp differences when the only @@ -9901,64 +9329,64 @@ out of date with respect to the sources if the @option{-m} switch causes a compilation to be switched, so the use of this switch represents a trade-off between compilation time and accurate debugging information. -@item ^-M^/DEPENDENCIES_LIST^ +@item -M @cindex Dependencies, producing list -@cindex @option{^-M^/DEPENDENCIES_LIST^} (@command{gnatmake}) +@cindex @option{-M} (@command{gnatmake}) Check if all objects are up to date. If they are, output the object dependences to @file{stdout} in a form that can be directly exploited in a @file{Makefile}. By default, each source file is prefixed with its (relative or absolute) directory name. This name is whatever you -specified in the various @option{^-aI^/SOURCE_SEARCH^} -and @option{^-I^/SEARCH^} switches. If you use -@code{gnatmake ^-M^/DEPENDENCIES_LIST^} -@option{^-q^/QUIET^} +specified in the various @option{-aI} +and @option{-I} switches. If you use +@code{gnatmake -M} +@option{-q} (see below), only the source file names, without relative paths, are output. If you just specify the -@option{^-M^/DEPENDENCIES_LIST^} +@option{-M} switch, dependencies of the GNAT internal system files are omitted. This is typically what you want. If you also specify -the @option{^-a^/ALL_FILES^} switch, +the @option{-a} switch, dependencies of the GNAT internal files are also listed. Note that dependencies of the objects in external Ada libraries (see switch -@option{^-aL^/SKIP_MISSING=^}@var{dir} in the following list) +@option{-aL}@var{dir} in the following list) are never reported. -@item ^-n^/DO_OBJECT_CHECK^ -@cindex @option{^-n^/DO_OBJECT_CHECK^} (@command{gnatmake}) +@item -n +@cindex @option{-n} (@command{gnatmake}) Don't compile, bind, or link. Checks if all objects are up to date. If they are not, the full name of the first file that needs to be recompiled is printed. Repeated use of this option, followed by compiling the indicated source file, will eventually result in recompiling all required units. -@item ^-o ^/EXECUTABLE=^@var{exec_name} -@cindex @option{^-o^/EXECUTABLE^} (@command{gnatmake}) +@item -o @var{exec_name} +@cindex @option{-o} (@command{gnatmake}) Output executable name. The name of the final executable program will be -@var{exec_name}. If the @option{^-o^/EXECUTABLE^} switch is omitted the default +@var{exec_name}. If the @option{-o} switch is omitted the default name for the executable will be the name of the input file in appropriate form for an executable file on the host system. This switch cannot be used when invoking @command{gnatmake} with several @file{file_names}. -@item ^-p or --create-missing-dirs^/CREATE_MISSING_DIRS^ -@cindex @option{^-p^/CREATE_MISSING_DIRS^} (@command{gnatmake}) -When using project files (^-P^/PROJECT_FILE=^@var{project}), create +@item -p or --create-missing-dirs +@cindex @option{-p} (@command{gnatmake}) +When using project files (-P@var{project}), create automatically missing object directories, library directories and exec directories. -@item ^-P^/PROJECT_FILE=^@var{project} -@cindex @option{^-P^/PROJECT_FILE^} (@command{gnatmake}) +@item -P@var{project} +@cindex @option{-P} (@command{gnatmake}) Use project file @var{project}. Only one such switch can be used. @xref{gnatmake and Project Files}. -@item ^-q^/QUIET^ -@cindex @option{^-q^/QUIET^} (@command{gnatmake}) +@item -q +@cindex @option{-q} (@command{gnatmake}) Quiet. When this flag is not set, the commands carried out by @command{gnatmake} are displayed. -@item ^-s^/SWITCH_CHECK/^ -@cindex @option{^-s^/SWITCH_CHECK^} (@command{gnatmake}) +@item -s +@cindex @option{-s} (@command{gnatmake}) Recompile if compiler switches have changed since last compilation. All compiler switches but -I and -o are taken into account in the following way: @@ -9969,60 +9397,60 @@ is equivalent to @option{-O -g}. This switch is recommended when Integrated Preprocessing is used. -@item ^-u^/UNIQUE^ -@cindex @option{^-u^/UNIQUE^} (@command{gnatmake}) +@item -u +@cindex @option{-u} (@command{gnatmake}) Unique. Recompile at most the main files. It implies -c. Combined with -f, it is equivalent to calling the compiler directly. Note that using -^-u^/UNIQUE^ with a project file and no main has a special meaning +-u with a project file and no main has a special meaning (@pxref{Project Files and Main Subprograms}). -@item ^-U^/ALL_PROJECTS^ -@cindex @option{^-U^/ALL_PROJECTS^} (@command{gnatmake}) +@item -U +@cindex @option{-U} (@command{gnatmake}) When used without a project file or with one or several mains on the command -line, is equivalent to ^-u^/UNIQUE^. When used with a project file and no main +line, is equivalent to -u. When used with a project file and no main on the command line, all sources of all project files are checked and compiled if not up to date, and libraries are rebuilt, if necessary. -@item ^-v^/REASONS^ -@cindex @option{^-v^/REASONS^} (@command{gnatmake}) +@item -v +@cindex @option{-v} (@command{gnatmake}) Verbose. Display the reason for all recompilations @command{gnatmake} decides are necessary, with the highest verbosity level. -@item ^-vl^/LOW_VERBOSITY^ -@cindex @option{^-vl^/LOW_VERBOSITY^} (@command{gnatmake}) +@item -vl +@cindex @option{-vl} (@command{gnatmake}) Verbosity level Low. Display fewer lines than in verbosity Medium. -@item ^-vm^/MEDIUM_VERBOSITY^ -@cindex @option{^-vm^/MEDIUM_VERBOSITY^} (@command{gnatmake}) +@item -vm +@cindex @option{-vm} (@command{gnatmake}) Verbosity level Medium. Potentially display fewer lines than in verbosity High. -@item ^-vh^/HIGH_VERBOSITY^ -@cindex @option{^-vm^/HIGH_VERBOSITY^} (@command{gnatmake}) -Verbosity level High. Equivalent to ^-v^/REASONS^. +@item -vh +@cindex @option{-vm} (@command{gnatmake}) +Verbosity level High. Equivalent to -v. -@item ^-vP^/MESSAGES_PROJECT_FILE=^@emph{x} +@item -vP@emph{x} Indicate the verbosity of the parsing of GNAT project files. @xref{Switches Related to Project Files}. -@item ^-x^/NON_PROJECT_UNIT_COMPILATION^ -@cindex @option{^-x^/NON_PROJECT_UNIT_COMPILATION^} (@command{gnatmake}) +@item -x +@cindex @option{-x} (@command{gnatmake}) Indicate that sources that are not part of any Project File may be compiled. Normally, when using Project Files, only sources that are part of a Project File may be compile. When this switch is used, a source outside of all Project Files may be compiled. The ALI file and the object file will be put in the object directory of the main Project. The compilation switches used will only be those specified on the command line. Even when -@option{^-x^/NON_PROJECT_UNIT_COMPILATION^} is used, mains specified on the +@option{-x} is used, mains specified on the command line need to be sources of a project file. -@item ^-X^/EXTERNAL_REFERENCE=^@var{name=value} +@item -X@var{name=value} Indicate that external variable @var{name} has the value @var{value}. The Project Manager will use this value for occurrences of @code{external(name)} when parsing the project file. @xref{Switches Related to Project Files}. -@item ^-z^/NOMAIN^ -@cindex @option{^-z^/NOMAIN^} (@command{gnatmake}) +@item -z +@cindex @option{-z} (@command{gnatmake}) No main subprogram. Bind and link the program even if the unit name given on the command line is a package name. The resulting executable will execute the elaboration routines of the package and its closure, @@ -10032,16 +9460,8 @@ then the finalization routines. @table @asis @item @command{gcc} @asis{switches} -@ifclear vms Any uppercase or multi-character switch that is not a @command{gnatmake} switch is passed to @command{gcc} (e.g.@: @option{-O}, @option{-gnato,} etc.) -@end ifclear -@ifset vms -Any qualifier that cannot be recognized as a qualifier for @code{GNAT MAKE} -but is recognizable as a valid qualifier for @code{GNAT COMPILE} is -automatically treated as a compiler switch, and passed on to all -compilations that are carried out. -@end ifset @end table @noindent @@ -10049,62 +9469,60 @@ Source and library search path switches: @table @option @c !sort! -@item ^-aI^/SOURCE_SEARCH=^@var{dir} -@cindex @option{^-aI^/SOURCE_SEARCH^} (@command{gnatmake}) +@item -aI@var{dir} +@cindex @option{-aI} (@command{gnatmake}) When looking for source files also look in directory @var{dir}. The order in which source files search is undertaken is described in @ref{Search Paths and the Run-Time Library (RTL)}. -@item ^-aL^/SKIP_MISSING=^@var{dir} -@cindex @option{^-aL^/SKIP_MISSING^} (@command{gnatmake}) +@item -aL@var{dir} +@cindex @option{-aL} (@command{gnatmake}) Consider @var{dir} as being an externally provided Ada library. Instructs @command{gnatmake} to skip compilation units whose @file{.ALI} files have been located in directory @var{dir}. This allows you to have missing bodies for the units in @var{dir} and to ignore out of date bodies for the same units. You still need to specify the location of the specs for these units by using the switches -@option{^-aI^/SOURCE_SEARCH=^@var{dir}} -or @option{^-I^/SEARCH=^@var{dir}}. +@option{-aI@var{dir}} +or @option{-I@var{dir}}. Note: this switch is provided for compatibility with previous versions of @command{gnatmake}. The easier method of causing standard libraries to be excluded from consideration is to write-protect the corresponding ALI files. -@item ^-aO^/OBJECT_SEARCH=^@var{dir} -@cindex @option{^-aO^/OBJECT_SEARCH^} (@command{gnatmake}) +@item -aO@var{dir} +@cindex @option{-aO} (@command{gnatmake}) When searching for library and object files, look in directory @var{dir}. The order in which library files are searched is described in @ref{Search Paths for gnatbind}. -@item ^-A^/CONDITIONAL_SOURCE_SEARCH=^@var{dir} +@item -A@var{dir} @cindex Search paths, for @command{gnatmake} -@cindex @option{^-A^/CONDITIONAL_SOURCE_SEARCH^} (@command{gnatmake}) -Equivalent to @option{^-aL^/SKIP_MISSING=^@var{dir} -^-aI^/SOURCE_SEARCH=^@var{dir}}. +@cindex @option{-A} (@command{gnatmake}) +Equivalent to @option{-aL@var{dir} +-aI@var{dir}}. -@item ^-I^/SEARCH=^@var{dir} -@cindex @option{^-I^/SEARCH^} (@command{gnatmake}) -Equivalent to @option{^-aO^/OBJECT_SEARCH=^@var{dir} -^-aI^/SOURCE_SEARCH=^@var{dir}}. +@item -I@var{dir} +@cindex @option{-I} (@command{gnatmake}) +Equivalent to @option{-aO@var{dir} +-aI@var{dir}}. -@item ^-I-^/NOCURRENT_DIRECTORY^ -@cindex @option{^-I-^/NOCURRENT_DIRECTORY^} (@command{gnatmake}) +@item -I- +@cindex @option{-I-} (@command{gnatmake}) @cindex Source files, suppressing search Do not look for source files in the directory containing the source file named in the command line. Do not look for ALI or object files in the directory where @command{gnatmake} was invoked. -@item ^-L^/LIBRARY_SEARCH=^@var{dir} -@cindex @option{^-L^/LIBRARY_SEARCH^} (@command{gnatmake}) +@item -L@var{dir} +@cindex @option{-L} (@command{gnatmake}) @cindex Linker libraries Add directory @var{dir} to the list of directories in which the linker will search for libraries. This is equivalent to -@option{-largs ^-L^/LIBRARY_SEARCH=^}@var{dir}. -@ifclear vms +@option{-largs -L}@var{dir}. Furthermore, under Windows, the sources pointed to by the libraries path set in the registry are not searched for. -@end ifclear @item -nostdinc @cindex @option{-nostdinc} (@command{gnatmake}) @@ -10196,11 +9614,11 @@ is a subunit or body of a generic unit, @command{gnatmake} recompiles warning. @item -In @command{gnatmake} the switch @option{^-I^/SEARCH^} +In @command{gnatmake} the switch @option{-I} is used to specify both source and -library file paths. Use @option{^-aI^/SOURCE_SEARCH^} +library file paths. Use @option{-aI} instead if you just want to specify -source paths only and @option{^-aO^/OBJECT_SEARCH^} +source paths only and @option{-aO} if you want to specify library paths only. @@ -10208,31 +9626,25 @@ only. @command{gnatmake} will ignore any files whose ALI file is write-protected. This may conveniently be used to exclude standard libraries from consideration and in particular it means that the use of the -@option{^-f^/FORCE_COMPILE^} switch will not recompile these files -unless @option{^-a^/ALL_FILES^} is also specified. +@option{-f} switch will not recompile these files +unless @option{-a} is also specified. @item @command{gnatmake} has been designed to make the use of Ada libraries particularly convenient. Assume you have an Ada library organized -as follows: @i{^obj-dir^[OBJ_DIR]^} contains the objects and ALI files for +as follows: @i{obj-dir} contains the objects and ALI files for of your Ada compilation units, -whereas @i{^include-dir^[INCLUDE_DIR]^} contains the +whereas @i{include-dir} contains the specs of these units, but no bodies. Then to compile a unit stored in @code{main.adb}, which uses this Ada library you would just type @smallexample -@ifclear vms $ gnatmake -aI@var{include-dir} -aL@var{obj-dir} main -@end ifclear -@ifset vms -$ gnatmake /SOURCE_SEARCH=@i{[INCLUDE_DIR]} - /SKIP_MISSING=@i{[OBJ_DIR]} main -@end ifset @end smallexample @item Using @command{gnatmake} along with the -@option{^-m (minimal recompilation)^/MINIMAL_RECOMPILATION^} +@option{-m (minimal recompilation)} switch provides a mechanism for avoiding unnecessary recompilations. Using this switch, you can update the comments/format of your @@ -10290,7 +9702,7 @@ Note: when using non-standard naming conventions file the version of a source and invoking @command{gnatmake} to recompile may have no effect, if the previous version of the source is still accessible by @command{gnatmake}. It may be necessary to use the switch -^-f^/FORCE_COMPILE^. +-f. @node Examples of gnatmake Usage @section Examples of @command{gnatmake} Usage @@ -10299,26 +9711,19 @@ by @command{gnatmake}. It may be necessary to use the switch @item gnatmake hello.adb Compile all files necessary to bind and link the main program @file{hello.adb} (containing unit @code{Hello}) and bind and link the -resulting object files to generate an executable file @file{^hello^HELLO.EXE^}. +resulting object files to generate an executable file @file{hello}. @item gnatmake main1 main2 main3 Compile all files necessary to bind and link the main programs @file{main1.adb} (containing unit @code{Main1}), @file{main2.adb} (containing unit @code{Main2}) and @file{main3.adb} (containing unit @code{Main3}) and bind and link the resulting object files -to generate three executable files @file{^main1^MAIN1.EXE^}, -@file{^main2^MAIN2.EXE^} -and @file{^main3^MAIN3.EXE^}. +to generate three executable files @file{main1}, +@file{main2} +and @file{main3}. -@ifclear vms @item gnatmake -q Main_Unit -cargs -O2 -bargs -l -@end ifclear -@ifset vms -@item gnatmake Main_Unit /QUIET -/COMPILER_QUALIFIERS /OPTIMIZE=ALL -/BINDER_QUALIFIERS /ORDER_OF_ELABORATION -@end ifset Compile all files necessary to bind and link the main program unit @code{Main_Unit} (from file @file{main_unit.adb}). All compilations will be done with optimization level 2 and the order of elaboration will be @@ -10409,9 +9814,6 @@ some guidelines on debugging optimized code. * Atomic Variables and Optimization:: * Passive Task Optimization:: -@ifset vms -* Coverage Analysis:: -@end ifset @end menu @node Controlling Run-Time Checks @@ -10484,8 +9886,8 @@ constructs and controlled types will show much improved performance. The relevant restrictions pragmas are @smallexample @c ada - pragma Restrictions (No_Abort_Statements); - pragma Restrictions (Max_Asynchronous_Select_Nesting => 0); + @b{pragma} Restrictions (No_Abort_Statements); + @b{pragma} Restrictions (Max_Asynchronous_Select_Nesting => 0); @end smallexample @noindent @@ -10495,10 +9897,10 @@ possibility of an immediate abort at any point. @node Optimization Levels @subsection Optimization Levels -@cindex @option{^-O^/OPTIMIZE^} (@command{gcc}) +@cindex @option{-O} (@command{gcc}) @noindent -Without any optimization ^option,^qualifier,^ +Without any optimization option, the compiler's goal is to reduce the cost of compilation and to make debugging produce the expected results. Statements are independent: if you stop the program with a breakpoint between @@ -10511,7 +9913,7 @@ performance and/or code size at the expense of compilation time and possibly the ability to debug the program. If you use multiple -^-O options, with or without level numbers,^/OPTIMIZE qualifiers,^ +-O options, with or without level numbers, the last such option is the one that is effective. @noindent @@ -10519,48 +9921,40 @@ The default is optimization off. This results in the fastest compile times, but GNAT makes absolutely no attempt to optimize, and the generated programs are considerably larger and slower than when optimization is enabled. You can use the -@ifclear vms @option{-O} switch (the permitted forms are @option{-O0}, @option{-O1} @option{-O2}, @option{-O3}, and @option{-Os}) -@end ifclear -@ifset vms -@code{OPTIMIZE} qualifier -@end ifset to @command{gcc} to control the optimization level: @table @option -@item ^-O0^/OPTIMIZE=NONE^ +@item -O0 No optimization (the default); generates unoptimized code but has the fastest compilation time. Note that many other compilers do fairly extensive optimization even if ``no optimization'' is specified. With gcc, it is -very unusual to use ^-O0^/OPTIMIZE=NONE^ for production if -execution time is of any concern, since ^-O0^/OPTIMIZE=NONE^ +very unusual to use -O0 for production if +execution time is of any concern, since -O0 really does mean no optimization at all. This difference between gcc and other compilers should be kept in mind when doing performance comparisons. -@item ^-O1^/OPTIMIZE=SOME^ +@item -O1 Moderate optimization; optimizes reasonably well but does not degrade compilation time significantly. -@item ^-O2^/OPTIMIZE=ALL^ -@ifset vms -@itemx /OPTIMIZE=DEVELOPMENT -@end ifset +@item -O2 Full optimization; generates highly optimized code and has the slowest compilation time. -@item ^-O3^/OPTIMIZE=INLINING^ +@item -O3 Full optimization as in @option{-O2}; also uses more aggressive automatic inlining of subprograms within a unit (@pxref{Inlining of Subprograms}) and attempts to vectorize loops. -@item ^-Os^/OPTIMIZE=SPACE^ +@item -Os Optimize space usage (code and data) of resulting program. @end table @@ -10577,10 +9971,10 @@ release to release (and sometime from target to target), it is best to think of the optimization settings in general terms. @xref{Optimize Options,, Options That Control Optimization, gcc, Using the GNU Compiler Collection (GCC)}, for details about -^the @option{-O} settings and a number of @option{-f} options that^how to^ +the @option{-O} settings and a number of @option{-f} options that individually enable or disable specific optimizations. -Unlike some other compilation systems, ^@command{gcc}^GNAT^ has +Unlike some other compilation systems, @command{gcc} has been tested extensively at all optimization levels. There are some bugs which appear only with optimization turned on, but there have also been bugs which show up only in @emph{unoptimized} code. Selecting a lower @@ -10600,24 +9994,18 @@ in @ref{Inlining of Subprograms}. @noindent Although it is possible to do a reasonable amount of debugging at -@ifclear vms nonzero optimization levels, the higher the level the more likely that -@end ifclear -@ifset vms -@option{/OPTIMIZE} settings other than @code{NONE}, -such settings will make it more likely that -@end ifset source-level constructs will have been eliminated by optimization. For example, if a loop is strength-reduced, the loop control variable may be completely eliminated and thus cannot be displayed in the debugger. This can only happen at @option{-O2} or @option{-O3}. Explicit temporary variables that you code might be eliminated at -^level^setting^ @option{-O1} or higher. +level @option{-O1} or higher. -The use of the @option{^-g^/DEBUG^} switch, -@cindex @option{^-g^/DEBUG^} (@command{gcc}) +The use of the @option{-g} switch, +@cindex @option{-g} (@command{gcc}) which is needed for source-level debugging, affects the size of the program executable on disk, and indeed the debugging information can be quite large. @@ -10665,7 +10053,7 @@ jumps to a statement that is not supposed to be executed, simply because it (and the code following) translates to the same thing as the code that @emph{was} supposed to be executed. This effect is typically seen in sequences that end in a jump, such as a @code{goto}, a @code{return}, or -a @code{break} in a C @code{^switch^switch^} statement. +a @code{break} in a C @code{switch} statement. @item @i{The ``roving variable'':} The symptom is an unexpected value in a variable. @@ -10713,13 +10101,11 @@ In light of such anomalies, a recommended technique is to use @option{-O0} early in the software development cycle, when extensive debugging capabilities are most needed, and then move to @option{-O1} and later @option{-O2} as the debugger becomes less critical. -Whether to use the @option{^-g^/DEBUG^} switch in the release version is +Whether to use the @option{-g} switch in the release version is a release management issue. -@ifclear vms Note that if you use @option{-g} you can then use the @command{strip} program on the resulting executable, which removes both debugging information and global symbols. -@end ifclear @node Inlining of Subprograms @subsection Inlining of Subprograms @@ -10741,7 +10127,7 @@ subprograms. @cindex pragma Inline @findex Inline Any one of the following applies: @code{pragma Inline} is applied to the -subprogram and the @option{^-gnatn^/INLINE^} switch is specified; the +subprogram and the @option{-gnatn} switch is specified; the subprogram is local to the unit and called once from within it; the subprogram is small and optimization level @option{-O2} is specified; optimization level @option{-O3} is specified. @@ -10768,7 +10154,7 @@ The call appears in a body (not in a package spec). There is a @code{pragma Inline} for the subprogram. @item -The @option{^-gnatn^/INLINE^} switch is used on the command line. +The @option{-gnatn} switch is used on the command line. @end itemize Even if all these conditions are met, it may not be possible for @@ -10781,20 +10167,20 @@ compilation dependencies. Consider the following: @smallexample @c ada @cartouche -package R is - procedure Q; - pragma Inline (Q); -end R; -package body R is +@b{package} R @b{is} + @b{procedure} Q; + @b{pragma} Inline (Q); +@b{end} R; +@b{package} @b{body} R @b{is} @dots{} -end R; +@b{end} R; -with R; -procedure Main is -begin +@b{with} R; +@b{procedure} Main @b{is} +@b{begin} @dots{} R.Q; -end Main; +@b{end} Main; @end cartouche @end smallexample @@ -10816,8 +10202,8 @@ occurs whether or not the call is in fact inlined by @command{gcc}. The use of front end inlining with @option{-gnatN} generates similar additional dependencies. -@cindex @option{^-fno-inline^/INLINE=SUPPRESS^} (@command{gcc}) -Note: The @option{^-fno-inline^/INLINE=SUPPRESS^} switch +@cindex @option{-fno-inline} (@command{gcc}) +Note: The @option{-fno-inline} switch can be used to prevent all inlining. This switch overrides all other conditions and ensures that no inlining occurs. The extra dependences resulting from @@ -10879,17 +10265,17 @@ contain a single nested loop, if it can be vectorized when considered alone: @smallexample @c ada @cartouche - A : array (1..4, 1..4) of Long_Float; - S : array (1..4) of Long_Float; + A : @b{array} (1..4, 1..4) @b{of} Long_Float; + S : @b{array} (1..4) @b{of} Long_Float; - procedure Sum is - begin - for I in A'Range(1) loop - for J in A'Range(2) loop + @b{procedure} Sum @b{is} + @b{begin} + @b{for} I @b{in} A'Range(1) @b{loop} + @b{for} J @b{in} A'Range(2) @b{loop} S (I) := S (I) + A (I, J); - end loop; - end loop; - end Sum; + @b{end} @b{loop}; + @b{end} @b{loop}; + @b{end} Sum; @end cartouche @end smallexample @@ -10918,25 +10304,25 @@ All kinds of array types are supported, i.e. constrained array types with static bounds: @smallexample @c ada - type Array_Type is array (1 .. 4) of Long_Float; + @b{type} Array_Type @b{is} @b{array} (1 .. 4) @b{of} Long_Float; @end smallexample @noindent constrained array types with dynamic bounds: @smallexample @c ada - type Array_Type is array (1 .. Q.N) of Long_Float; + @b{type} Array_Type @b{is} @b{array} (1 .. Q.N) @b{of} Long_Float; - type Array_Type is array (Q.K .. 4) of Long_Float; + @b{type} Array_Type @b{is} @b{array} (Q.K .. 4) @b{of} Long_Float; - type Array_Type is array (Q.K .. Q.N) of Long_Float; + @b{type} Array_Type @b{is} @b{array} (Q.K .. Q.N) @b{of} Long_Float; @end smallexample @noindent or unconstrained array types: @smallexample @c ada - type Array_Type is array (Positive range <>) of Long_Float; + @b{type} Array_Type @b{is} @b{array} (Positive @b{range} <>) @b{of} Long_Float; @end smallexample @noindent @@ -10950,7 +10336,7 @@ It is possible to specify that a given loop should be subject to vectorization preferably to other optimizations by means of pragma @code{Loop_Optimize}: @smallexample @c ada - pragma Loop_Optimize (Vector); + @b{pragma} Loop_Optimize (Vector); @end smallexample @noindent @@ -10962,14 +10348,14 @@ for a given loop by asserting that there are no loop-carried dependencies in the loop. Consider for example the procedure: @smallexample @c ada - type Arr is array (1 .. 4) of Long_Float; + @b{type} Arr @b{is} @b{array} (1 .. 4) @b{of} Long_Float; - procedure Add (X, Y : not null access Arr; R : not null access Arr) is - begin - for I in Arr'Range loop + @b{procedure} Add (X, Y : @b{not} @b{null} @b{access} Arr; R : @b{not} @b{null} @b{access} Arr) @b{is} + @b{begin} + @b{for} I @b{in} Arr'Range @b{loop} R(I) := X(I) + Y(I); - end loop; - end; + @b{end} @b{loop}; + @b{end}; @end smallexample @noindent @@ -10982,7 +10368,7 @@ as well as a test to select the appropriate version at run time. This can be overcome by another hint: @smallexample @c ada - pragma Loop_Optimize (Ivdep); + @b{pragma} Loop_Optimize (Ivdep); @end smallexample @noindent @@ -11017,24 +10403,24 @@ the following example: @smallexample @c ada @cartouche -procedure R is - type Int1 is new Integer; - type Int2 is new Integer; - type Int1A is access Int1; - type Int2A is access Int2; +@b{procedure} R @b{is} + @b{type} Int1 @b{is} @b{new} Integer; + @b{type} Int2 @b{is} @b{new} Integer; + @b{type} Int1A @b{is} @b{access} Int1; + @b{type} Int2A @b{is} @b{access} Int2; Int1V : Int1A; Int2V : Int2A; @dots{} -begin +@b{begin} @dots{} - for J in Data'Range loop - if Data (J) = Int1V.all then - Int2V.all := Int2V.all + 1; - end if; - end loop; + @b{for} J @b{in} Data'Range @b{loop} + @b{if} Data (J) = Int1V.@b{all} @b{then} + Int2V.@b{all} := Int2V.@b{all} + 1; + @b{end} @b{if}; + @b{end} @b{loop}; @dots{} -end R; +@b{end} R; @end cartouche @end smallexample @@ -11059,39 +10445,39 @@ the typing system. Consider the following complete program example: @smallexample @c ada @cartouche -package p1 is - type int1 is new integer; - type int2 is new integer; - type a1 is access int1; - type a2 is access int2; -end p1; - -with p1; use p1; -package p2 is - function to_a2 (Input : a1) return a2; -end p2; - -with Unchecked_Conversion; -package body p2 is - function to_a2 (Input : a1) return a2 is - function to_a2u is - new Unchecked_Conversion (a1, a2); - begin - return to_a2u (Input); - end to_a2; -end p2; - -with p2; use p2; -with p1; use p1; -with Text_IO; use Text_IO; -procedure m is - v1 : a1 := new int1; +@b{package} p1 @b{is} + @b{type} int1 @b{is} @b{new} integer; + @b{type} int2 @b{is} @b{new} integer; + @b{type} a1 @b{is} @b{access} int1; + @b{type} a2 @b{is} @b{access} int2; +@b{end} p1; + +@b{with} p1; @b{use} p1; +@b{package} p2 @b{is} + @b{function} to_a2 (Input : a1) @b{return} a2; +@b{end} p2; + +@b{with} Unchecked_Conversion; +@b{package} @b{body} p2 @b{is} + @b{function} to_a2 (Input : a1) @b{return} a2 @b{is} + @b{function} to_a2u @b{is} + @b{new} Unchecked_Conversion (a1, a2); + @b{begin} + @b{return} to_a2u (Input); + @b{end} to_a2; +@b{end} p2; + +@b{with} p2; @b{use} p2; +@b{with} p1; @b{use} p1; +@b{with} Text_IO; @b{use} Text_IO; +@b{procedure} m @b{is} + v1 : a1 := @b{new} int1; v2 : a2 := to_a2 (v1); -begin - v1.all := 1; - v2.all := 0; - put_line (int1'image (v1.all)); -end; +@b{begin} + v1.@b{all} := 1; + v2.@b{all} := 0; + put_line (int1'image (v1.@b{all})); +@b{end}; @end cartouche @end smallexample @@ -11169,10 +10555,10 @@ instantiation of @code{Unchecked_Conversion} to turn the warning off: @smallexample @c ada - pragma Warnings (Off); - function to_a2u is - new Unchecked_Conversion (a1, a2); - pragma Warnings (On); + @b{pragma} Warnings (Off); + @b{function} to_a2u @b{is} + @b{new} Unchecked_Conversion (a1, a2); + @b{pragma} Warnings (On); @end smallexample @noindent @@ -11197,8 +10583,8 @@ source type is not visible in that unit), you may use pragma same declarative sequence as the declaration of the access type: @smallexample @c ada - type a2 is access int2; - pragma No_Strict_Aliasing (a2); + @b{type} a2 @b{is} @b{access} int2; + @b{pragma} No_Strict_Aliasing (a2); @end smallexample @noindent @@ -11245,27 +10631,27 @@ variable's value, even though it is passed as an IN parameter. Consider the following example: @smallexample @c ada -procedure P is - Max_Length : constant Natural := 16; - type Char_Ptr is access all Character; +@b{procedure} P @b{is} + Max_Length : @b{constant} Natural := 16; + @b{type} Char_Ptr @b{is} @b{access} @b{all} Character; - procedure Get_String(Buffer: Char_Ptr; Size : Integer); - pragma Import (C, Get_String, "get_string"); + @b{procedure} Get_String(Buffer: Char_Ptr; Size : Integer); + @b{pragma} Import (C, Get_String, "get_string"); - Name : aliased String (1 .. Max_Length) := (others => ' '); + Name : @b{aliased} String (1 .. Max_Length) := (@b{others} => ' '); Temp : Char_Ptr; - function Addr (S : String) return Char_Ptr is - function To_Char_Ptr is - new Ada.Unchecked_Conversion (System.Address, Char_Ptr); - begin - return To_Char_Ptr (S (S'First)'Address); - end; + @b{function} Addr (S : String) @b{return} Char_Ptr @b{is} + @b{function} To_Char_Ptr @b{is} + @b{new} Ada.Unchecked_Conversion (System.Address, Char_Ptr); + @b{begin} + @b{return} To_Char_Ptr (S (S'First)'Address); + @b{end}; -begin +@b{begin} Temp := Addr (Name); Get_String (Temp, Max_Length); -end; +@b{end}; @end smallexample @noindent @@ -11304,14 +10690,14 @@ assume that the entire variable will always be accessed. Consider this example: @smallexample @c ada -type R is record +@b{type} R @b{is} @b{record} A,B,C,D : Character; -end record; -for R'Size use 32; -for R'Alignment use 4; +@b{end} @b{record}; +@b{for} R'Size @b{use} 32; +@b{for} R'Alignment @b{use} 4; RV : R; -pragma Atomic (RV); +@b{pragma} Atomic (RV); X : Character; ... X := RV.B; @@ -11333,11 +10719,11 @@ example be full 32-bit loads, you need to make a copy for the access as in: @smallexample @c ada -declare - RV_Copy : constant R := RV; -begin +@b{declare} + RV_Copy : @b{constant} R := RV; +@b{begin} X := RV_Copy.B; -end; +@b{end}; @end smallexample @@ -11401,15 +10787,6 @@ arise, and update those particular tasks to be protected types. Note that typically clients of the tasks who call entries, will not have to be modified, only the task definition itself. -@ifset vms -@node Coverage Analysis -@subsection Coverage Analysis - -@noindent -GNAT supports the HP Performance Coverage Analyzer (PCA), which allows -the user to determine the distribution of execution time across a program, -@pxref{Profiling} for details of usage. -@end ifset @node Text_IO Suggestions @@ -11491,7 +10868,7 @@ The following command will create the set of @file{ALI} files needed for @code{gnatelim}: @smallexample -$ gnatmake ^-c Main_Prog^/ACTIONS=COMPILE MAIN_PROG^ +$ gnatmake -c Main_Prog @end smallexample Note that @code{gnatelim} does not need object files. @@ -11503,7 +10880,7 @@ Note that @code{gnatelim} does not need object files. @code{gnatelim} has the following command-line interface: @smallexample -$ gnatelim [@var{switches}] ^-main^?MAIN^=@var{main_unit_name} @{@var{filename}@} @r{[}-cargs @var{gcc_switches}@r{]} +$ gnatelim [@var{switches}] -main=@var{main_unit_name} @{@var{filename}@} @r{[}-cargs @var{gcc_switches}@r{]} @end smallexample @noindent @@ -11517,7 +10894,7 @@ the file name may contain path information. @samp{@var{gcc_switches}} is a list of switches for @command{gcc}. They will be passed on to all compiler invocations made by @command{gnatelim} to generate the ASIS trees. Here you can provide -@option{^-I^/INCLUDE_DIRS=^} switches to form the source search path, +@option{-I} switches to form the source search path, use the @option{-gnatec} switch to set the configuration file, use the @option{-gnat05} switch if sources should be compiled in Ada 2005 mode etc. @@ -11545,66 +10922,66 @@ Indicates that external variable @var{name} in the argument project has the value @var{value}. Has no effect if no project is specified as tool argument. -@item ^-files^/FILES^=@var{filename} -@cindex @option{^-files^/FILES^} (@code{gnatelim}) +@item -files=@var{filename} +@cindex @option{-files} (@code{gnatelim}) Take the argument source files from the specified file. This file should be an ordinary text file containing file names separated by spaces or line breaks. You can use this switch more than once in the same call to @command{gnatelim}. You also can combine this switch with an explicit list of files. -@item ^-log^/LOG^ -@cindex @option{^-log^/LOG^} (@command{gnatelim}) +@item -log +@cindex @option{-log} (@command{gnatelim}) Duplicate all the output sent to @file{stderr} into a log file. The log file is named @file{gnatelim.log} and is located in the current directory. @ignore -@item ^-log^/LOGFILE^=@var{filename} -@cindex @option{^-log^/LOGFILE^} (@command{gnatelim}) +@item -log=@var{filename} +@cindex @option{-log} (@command{gnatelim}) Duplicate all the output sent to @file{stderr} into a specified log file. @end ignore -@cindex @option{^--no-elim-dispatch^/NO_DISPATCH^} (@command{gnatelim}) -@item ^--no-elim-dispatch^/NO_DISPATCH^ +@cindex @option{--no-elim-dispatch} (@command{gnatelim}) +@item --no-elim-dispatch Do not generate pragmas for dispatching operations. -@item ^--ignore^/IGNORE^=@var{filename} -@cindex @option{^--ignore^/IGNORE^} (@command{gnatelim}) +@item --ignore=@var{filename} +@cindex @option{--ignore} (@command{gnatelim}) Do not generate pragmas for subprograms declared in the sources listed in a specified file -@cindex @option{^-o^/OUTPUT^} (@command{gnatelim}) -@item ^-o^/OUTPUT^=@var{report_file} +@cindex @option{-o} (@command{gnatelim}) +@item -o=@var{report_file} Put @command{gnatelim} output into a specified file. If this file already exists, it is overridden. If this switch is not used, @command{gnatelim} outputs its results into @file{stderr} -@item ^-j^/PROCESSES=^@var{n} -@cindex @option{^-j^/PROCESSES^} (@command{gnatelim}) +@item -j@var{n} +@cindex @option{-j} (@command{gnatelim}) Use @var{n} processes to carry out the tree creations (internal representations of the argument sources). On a multiprocessor machine this speeds up processing of big sets of argument sources. If @var{n} is 0, then the maximum number of parallel tree creations is the number of core processors on the platform. -@item ^-q^/QUIET^ -@cindex @option{^-q^/QUIET^} (@command{gnatelim}) +@item -q +@cindex @option{-q} (@command{gnatelim}) Quiet mode: by default @code{gnatelim} outputs to the standard error stream the number of program units left to be processed. This option turns this trace off. -@cindex @option{^-t^/TIME^} (@command{gnatelim}) -@item ^-t^/TIME^ +@cindex @option{-t} (@command{gnatelim}) +@item -t Print out execution time. -@item ^-v^/VERBOSE^ -@cindex @option{^-v^/VERBOSE^} (@command{gnatelim}) +@item -v +@cindex @option{-v} (@command{gnatelim}) Verbose mode: @code{gnatelim} version information is printed as Ada comments to the standard output stream. Also, in addition to the number of program units left @code{gnatelim} will output the name of the current unit being processed. -@item ^-wq^/WARNINGS=QUIET^ -@cindex @option{^-wq^/WARNINGS=QUIET^} (@command{gnatelim}) +@item -wq +@cindex @option{-wq} (@command{gnatelim}) Quiet warning mode - some warnings are suppressed. In particular warnings that indicate that the analysed set of sources is incomplete to make up a partition and that some subprogram bodies are missing are not generated. @@ -11622,7 +10999,7 @@ If some program uses a precompiled Ada library, it can be processed by @code{gnatelim} in a usual way. @code{gnatelim} will newer generate an Eliminate pragma for a subprogram if the body of this subprogram has not been analysed, this is a typical case for subprograms from precompiled -libraries. Switch @option{^-wq^/WARNINGS=QUIET^} may be used to suppress +libraries. Switch @option{-wq} may be used to suppress warnings about missing source files and non-analyzed subprogram bodies that can be generated when processing precompiled Ada libraries. @@ -11654,11 +11031,11 @@ pragmas Eliminate generated by gnatelim. If these pragmas are placed in @file{gnat.adc} file located in your current directory, just do: @smallexample -$ gnatmake ^-f main_prog^/FORCE_COMPILE MAIN_PROG^ +$ gnatmake -f main_prog @end smallexample @noindent -(Use the @option{^-f^/FORCE_COMPILE^} option for @command{gnatmake} to +(Use the @option{-f} option for @command{gnatmake} to recompile everything with the set of pragmas @code{Eliminate} that you have obtained with @command{gnatelim}). @@ -11682,26 +11059,21 @@ Create a complete set of @file{ALI} files (if the program has not been built already) @smallexample -$ gnatmake ^-c main_prog^/ACTIONS=COMPILE MAIN_PROG^ +$ gnatmake -c main_prog @end smallexample @item Generate a list of @code{Eliminate} pragmas in default configuration file @file{gnat.adc} in the current directory @smallexample -@ifset vms -$ PIPE GNAT ELIM MAIN_PROG > GNAT.ADC -@end ifset -@ifclear vms $ gnatelim main_prog >@r{[}>@r{]} gnat.adc -@end ifclear @end smallexample @item Recompile the application @smallexample -$ gnatmake ^-f main_prog^/FORCE_COMPILE MAIN_PROG^ +$ gnatmake -f main_prog @end smallexample @end enumerate @@ -11778,32 +11150,32 @@ and data of the GNAT library from your executable. Here is a simple example: @smallexample @c ada -with Aux; +@b{with} Aux; -procedure Test is -begin +@b{procedure} Test @b{is} +@b{begin} Aux.Used (10); -end Test; +@b{end} Test; -package Aux is +@b{package} Aux @b{is} Used_Data : Integer; Unused_Data : Integer; - procedure Used (Data : Integer); - procedure Unused (Data : Integer); -end Aux; + @b{procedure} Used (Data : Integer); + @b{procedure} Unused (Data : Integer); +@b{end} Aux; -package body Aux is - procedure Used (Data : Integer) is - begin +@b{package} @b{body} Aux @b{is} + @b{procedure} Used (Data : Integer) @b{is} + @b{begin} Used_Data := Data; - end Used; + @b{end} Used; - procedure Unused (Data : Integer) is - begin + @b{procedure} Unused (Data : Integer) @b{is} + @b{begin} Unused_Data := Data; - end Unused; -end Aux; + @b{end} Unused; +@b{end} Aux; @end smallexample @noindent @@ -11973,13 +11345,13 @@ file called @file{hellofiles} containing @smallexample @c ada @group @cartouche -procedure hello; +@b{procedure} hello; -with Text_IO; use Text_IO; -procedure hello is -begin +@b{with} Text_IO; @b{use} Text_IO; +@b{procedure} hello @b{is} +@b{begin} Put_Line ("Hello"); -end hello; +@b{end} hello; @end cartouche @end group @end smallexample @@ -11988,7 +11360,7 @@ end hello; the command @smallexample -$ gnatchop ^hellofiles^HELLOFILES.^ +$ gnatchop hellofiles @end smallexample @noindent @@ -12009,7 +11381,7 @@ file called @file{toto.txt} containing @smallexample @c ada @group @cartouche --- Just a comment +--@i{ Just a comment} @end cartouche @end group @end smallexample @@ -12018,7 +11390,7 @@ file called @file{toto.txt} containing the command @smallexample -$ gnatchop ^toto.txt^TOT.TXT^ +$ gnatchop toto.txt @end smallexample @noindent @@ -12048,60 +11420,50 @@ Display Copyright and version, then exit disregarding all other options. If @option{--version} was not used, display usage, then exit disregarding all other options. -@item ^-c^/COMPILATION^ -@cindex @option{^-c^/COMPILATION^} (@code{gnatchop}) +@item -c +@cindex @option{-c} (@code{gnatchop}) Causes @code{gnatchop} to operate in compilation mode, in which configuration pragmas are handled according to strict RM rules. See previous section for a full description of this mode. -@ifclear vms @item -gnat@var{xxx} This passes the given @option{-gnat@var{xxx}} switch to @code{gnat} which is used to parse the given file. Not all @var{xxx} options make sense, but for example, the use of @option{-gnati2} allows @code{gnatchop} to process a source file that uses Latin-2 coding for identifiers. -@end ifclear -@item ^-h^/HELP^ +@item -h Causes @code{gnatchop} to generate a brief help summary to the standard output file showing usage information. -@item ^-k@var{mm}^/FILE_NAME_MAX_LENGTH=@var{mm}^ -@cindex @option{^-k^/FILE_NAME_MAX_LENGTH^} (@code{gnatchop}) +@item -k@var{mm} +@cindex @option{-k} (@code{gnatchop}) Limit generated file names to the specified number @code{mm} of characters. This is useful if the resulting set of files is required to be interoperable with systems which limit the length of file names. -@ifset vms -If no value is given, or -if no @code{/FILE_NAME_MAX_LENGTH} qualifier is given, -a default of 39, suitable for OpenVMS Alpha -Systems, is assumed -@end ifset -@ifclear vms No space is allowed between the @option{-k} and the numeric value. The numeric value may be omitted in which case a default of @option{-k8}, suitable for use with DOS-like file systems, is used. If no @option{-k} switch is present then there is no limit on the length of file names. -@end ifclear -@item ^-p^/PRESERVE^ -@cindex @option{^-p^/PRESERVE^} (@code{gnatchop}) -Causes the file ^modification^creation^ time stamp of the input file to be +@item -p +@cindex @option{-p} (@code{gnatchop}) +Causes the file modification time stamp of the input file to be preserved and used for the time stamp of the output file(s). This may be useful for preserving coherency of time stamps in an environment where @code{gnatchop} is used as part of a standard build process. -@item ^-q^/QUIET^ -@cindex @option{^-q^/QUIET^} (@code{gnatchop}) +@item -q +@cindex @option{-q} (@code{gnatchop}) Causes output of informational messages indicating the set of generated files to be suppressed. Warnings and error messages are unaffected. -@item ^-r^/REFERENCE^ -@cindex @option{^-r^/REFERENCE^} (@code{gnatchop}) +@item -r +@cindex @option{-r} (@code{gnatchop}) @findex Source_Reference Generate @code{Source_Reference} pragmas. Use this switch if the output files are regarded as temporary and development is to be done in terms @@ -12111,7 +11473,7 @@ generated files to refers back to the original file name and line number. The result is that all error messages refer back to the original unchopped file. In addition, the debugging information placed into the object file (when -the @option{^-g^/DEBUG^} switch of @command{gcc} or @command{gnatmake} is +the @option{-g} switch of @command{gcc} or @command{gnatmake} is specified) also refers back to this original file so that tools like profilers and debuggers will give information in terms of the original unchopped file. @@ -12125,14 +11487,14 @@ line numbers. This is particularly useful when @code{gnatchop} is used in conjunction with @code{gnatprep} to compile files that contain preprocessing statements and multiple units. -@item ^-v^/VERBOSE^ -@cindex @option{^-v^/VERBOSE^} (@code{gnatchop}) +@item -v +@cindex @option{-v} (@code{gnatchop}) Causes @code{gnatchop} to operate in verbose mode. The version number and copyright notice are output, as well as exact copies of the gnat1 commands spawned to obtain the chop control information. -@item ^-w^/OVERWRITE^ -@cindex @option{^-w^/OVERWRITE^} (@code{gnatchop}) +@item -w +@cindex @option{-w} (@code{gnatchop}) Overwrite existing file names. Normally @code{gnatchop} regards it as a fatal error if there is already a file with the same name as a file it would otherwise output, in other words if the files to be @@ -12140,37 +11502,30 @@ chopped contain duplicated units. This switch bypasses this check, and causes all but the last instance of such duplicated units to be skipped. -@ifclear vms @item --GCC=@var{xxxx} @cindex @option{--GCC=} (@code{gnatchop}) Specify the path of the GNAT parser to be used. When this switch is used, no attempt is made to add the prefix to the GNAT parser executable. -@end ifclear @end table @node Examples of gnatchop Usage @section Examples of @code{gnatchop} Usage @table @code -@ifset vms -@item gnatchop /OVERWRITE HELLO_S.ADA [PRERELEASE.FILES] -@end ifset -@ifclear vms @item gnatchop -w hello_s.ada prerelease/files -@end ifclear Chops the source file @file{hello_s.ada}. The output files will be -placed in the directory @file{^prerelease/files^[PRERELEASE.FILES]^}, +placed in the directory @file{prerelease/files}, overwriting any files with matching names in that directory (no files in the current directory are modified). -@item gnatchop ^archive^ARCHIVE.^ -Chops the source file @file{^archive^ARCHIVE.^} +@item gnatchop archive +Chops the source file @file{archive} into the current directory. One useful application of @code{gnatchop} is in sending sets of sources around, for example in email messages. The required sources are simply -concatenated (for example, using a ^Unix @code{cat}^VMS @code{APPEND/NEW}^ +concatenated (for example, using a Unix @code{cat} command), and then @command{gnatchop} is used at the other end to reconstitute the original file names. @@ -12180,7 +11535,7 @@ Chops all units in files @file{file1}, @file{file2}, @file{file3}, placing the resulting files in the directory @file{direc}. Note that if any units occur more than once anywhere within this set of files, an error message is generated, and no files are written. To override this check, use the -@option{^-w^/OVERWRITE^} switch, +@option{-w} switch, in which case the last occurrence in the last file will be the one that is output, and earlier duplicate occurrences for a given unit will be skipped. @@ -12358,21 +11713,6 @@ If you are using project file, a separate mechanism is provided using project attributes, see @ref{Specifying Configuration Pragmas} for more details. -@ifset vms -Of special interest to GNAT OpenVMS Alpha is the following -configuration pragma: - -@smallexample @c ada -@cartouche -pragma Extend_System (Aux_DEC); -@end cartouche -@end smallexample - -@noindent -In the presence of this pragma, GNAT adds to the definition of the -predefined package SYSTEM all the additional types and subprograms that are -defined in HP Ada. See @ref{Compatibility with HP Ada} for details. -@end ifset @node Handling Arbitrary File Naming Conventions with gnatname @chapter Handling Arbitrary File Naming Conventions with @code{gnatname} @@ -12501,106 +11841,104 @@ Do not create a backup copy of an existing project file. @item --and Start another section of directories/patterns. -@item ^-c^/CONFIG_FILE=^@file{file} -@cindex @option{^-c^/CONFIG_FILE^} (@code{gnatname}) +@item -c@file{file} +@cindex @option{-c} (@code{gnatname}) Create a configuration pragmas file @file{file} (instead of the default @file{gnat.adc}). -@ifclear vms There may be zero, one or more space between @option{-c} and @file{file}. -@end ifclear @file{file} may include directory information. @file{file} must be -writable. There may be only one switch @option{^-c^/CONFIG_FILE^}. -When a switch @option{^-c^/CONFIG_FILE^} is -specified, no switch @option{^-P^/PROJECT_FILE^} may be specified (see below). +writable. There may be only one switch @option{-c}. +When a switch @option{-c} is +specified, no switch @option{-P} may be specified (see below). -@item ^-d^/SOURCE_DIRS=^@file{dir} -@cindex @option{^-d^/SOURCE_DIRS^} (@code{gnatname}) +@item -d@file{dir} +@cindex @option{-d} (@code{gnatname}) Look for source files in directory @file{dir}. There may be zero, one or more -spaces between @option{^-d^/SOURCE_DIRS=^} and @file{dir}. +spaces between @option{-d} and @file{dir}. @file{dir} may end with @code{/**}, that is it may be of the form @code{root_dir/**}. In this case, the directory @code{root_dir} and all of its subdirectories, recursively, have to be searched for sources. -When a switch @option{^-d^/SOURCE_DIRS^} +When a switch @option{-d} is specified, the current working directory will not be searched for source -files, unless it is explicitly specified with a @option{^-d^/SOURCE_DIRS^} -or @option{^-D^/DIR_FILES^} switch. -Several switches @option{^-d^/SOURCE_DIRS^} may be specified. +files, unless it is explicitly specified with a @option{-d} +or @option{-D} switch. +Several switches @option{-d} may be specified. If @file{dir} is a relative path, it is relative to the directory of the configuration pragmas file specified with switch -@option{^-c^/CONFIG_FILE^}, +@option{-c}, or to the directory of the project file specified with switch -@option{^-P^/PROJECT_FILE^} or, -if neither switch @option{^-c^/CONFIG_FILE^} -nor switch @option{^-P^/PROJECT_FILE^} are specified, it is relative to the +@option{-P} or, +if neither switch @option{-c} +nor switch @option{-P} are specified, it is relative to the current working directory. The directory -specified with switch @option{^-d^/SOURCE_DIRS^} must exist and be readable. +specified with switch @option{-d} must exist and be readable. -@item ^-D^/DIRS_FILE=^@file{file} -@cindex @option{^-D^/DIRS_FILE^} (@code{gnatname}) +@item -D@file{file} +@cindex @option{-D} (@code{gnatname}) Look for source files in all directories listed in text file @file{file}. -There may be zero, one or more spaces between @option{^-D^/DIRS_FILE=^} +There may be zero, one or more spaces between @option{-D} and @file{file}. @file{file} must be an existing, readable text file. Each nonempty line in @file{file} must be a directory. -Specifying switch @option{^-D^/DIRS_FILE^} is equivalent to specifying as many -switches @option{^-d^/SOURCE_DIRS^} as there are nonempty lines in +Specifying switch @option{-D} is equivalent to specifying as many +switches @option{-d} as there are nonempty lines in @file{file}. @item -eL Follow symbolic links when processing project files. -@item ^-f^/FOREIGN_PATTERN=^@file{pattern} -@cindex @option{^-f^/FOREIGN_PATTERN^} (@code{gnatname}) +@item -f@file{pattern} +@cindex @option{-f} (@code{gnatname}) Foreign patterns. Using this switch, it is possible to add sources of languages other than Ada to the list of sources of a project file. -It is only useful if a ^-P^/PROJECT_FILE^ switch is used. +It is only useful if a -P switch is used. For example, @smallexample -gnatname ^-Pprj -f"*.c"^/PROJECT_FILE=PRJ /FOREIGN_PATTERN=*.C^ "*.ada" +gnatname -Pprj -f"*.c" "*.ada" @end smallexample @noindent will look for Ada units in all files with the @file{.ada} extension, and will add to the list of file for project @file{prj.gpr} the C files -with extension @file{.^c^C^}. +with extension @file{.c}. -@item ^-h^/HELP^ -@cindex @option{^-h^/HELP^} (@code{gnatname}) +@item -h +@cindex @option{-h} (@code{gnatname}) Output usage (help) information. The output is written to @file{stdout}. -@item ^-P^/PROJECT_FILE=^@file{proj} -@cindex @option{^-P^/PROJECT_FILE^} (@code{gnatname}) +@item -P@file{proj} +@cindex @option{-P} (@code{gnatname}) Create or update project file @file{proj}. There may be zero, one or more space between @option{-P} and @file{proj}. @file{proj} may include directory information. @file{proj} must be writable. -There may be only one switch @option{^-P^/PROJECT_FILE^}. -When a switch @option{^-P^/PROJECT_FILE^} is specified, -no switch @option{^-c^/CONFIG_FILE^} may be specified. +There may be only one switch @option{-P}. +When a switch @option{-P} is specified, +no switch @option{-c} may be specified. On all platforms, except on VMS, when @code{gnatname} is invoked for an existing project file <proj>.gpr, a backup copy of the project file is created in the project directory with file name <proj>.gpr.saved_x. 'x' is the first non negative number that makes this backup copy a new file. -@item ^-v^/VERBOSE^ -@cindex @option{^-v^/VERBOSE^} (@code{gnatname}) +@item -v +@cindex @option{-v} (@code{gnatname}) Verbose mode. Output detailed explanation of behavior to @file{stdout}. This includes name of the file written, the name of the directories to search and, for each file in those directories whose name matches at least one of the Naming Patterns, an indication of whether the file contains a unit, and if so the name of the unit. -@item ^-v -v^/VERBOSE /VERBOSE^ -@cindex @option{^-v -v^/VERBOSE /VERBOSE^} (@code{gnatname}) +@item -v -v +@cindex @option{-v -v} (@code{gnatname}) Very Verbose mode. In addition to the output produced in verbose mode, for each file in the searched directories whose name matches none of the Naming Patterns, an indication is given that there is no match. -@item ^-x^/EXCLUDED_PATTERN=^@file{pattern} -@cindex @option{^-x^/EXCLUDED_PATTERN^} (@code{gnatname}) +@item -x@file{pattern} +@cindex @option{-x} (@code{gnatname}) Excluded patterns. Using this switch, it is possible to exclude some files that would match the name patterns. For example, @smallexample -gnatname ^-x "*_nt.ada"^/EXCLUDED_PATTERN=*_nt.ada^ "*.ada" +gnatname -x "*_nt.ada" "*.ada" @end smallexample @noindent will look for Ada units in all files with the @file{.ada} extension, @@ -12611,44 +11949,27 @@ except those whose names end with @file{_nt.ada}. @node Examples of gnatname Usage @section Examples of @code{gnatname} Usage -@ifset vms -@smallexample -$ gnatname /CONFIG_FILE=[HOME.ME]NAMES.ADC /SOURCE_DIRS=SOURCES "[a-z]*.ada*" -@end smallexample -@end ifset -@ifclear vms @smallexample $ gnatname -c /home/me/names.adc -d sources "[a-z]*.ada*" @end smallexample -@end ifclear @noindent -In this example, the directory @file{^/home/me^[HOME.ME]^} must already exist +In this example, the directory @file{/home/me} must already exist and be writable. In addition, the directory -@file{^/home/me/sources^[HOME.ME.SOURCES]^} (specified by -@option{^-d sources^/SOURCE_DIRS=SOURCES^}) must exist and be readable. +@file{/home/me/sources} (specified by +@option{-d sources}) must exist and be readable. -@ifclear vms Note the optional spaces after @option{-c} and @option{-d}. -@end ifclear @smallexample -@ifclear vms $ gnatname -P/home/me/proj -x "*_nt_body.ada" -dsources -dsources/plus -Dcommon_dirs.txt "body_*" "spec_*" -@end ifclear -@ifset vms -$ gnatname /PROJECT_FILE=[HOME.ME]PROJ - /EXCLUDED_PATTERN=*_nt_body.ada - /SOURCE_DIRS=(SOURCES,[SOURCES.PLUS]) - /DIRS_FILE=COMMON_DIRS.TXT "body_*" "spec_*" -@end ifset @end smallexample -Note that several switches @option{^-d^/SOURCE_DIRS^} may be used, +Note that several switches @option{-d} may be used, even in conjunction with one or several switches -@option{^-D^/DIRS_FILE^}. Several Naming Patterns and one excluded pattern +@option{-D}. Several Naming Patterns and one excluded pattern are used in this example. @c ***************************************** @@ -12724,7 +12045,7 @@ are used in this example. @noindent This section covers several topics related to @command{gnatmake} and -project files: defining ^switches^switches^ for @command{gnatmake} +project files: defining switches for @command{gnatmake} and for the tools that it invokes; specifying configuration pragmas; the use of the @code{Main} attribute; building and rebuilding library project files. @@ -12747,79 +12068,67 @@ The following switches are used by GNAT tools that support project files: @table @option -@item ^-P^/PROJECT_FILE=^@var{project} -@cindex @option{^-P^/PROJECT_FILE^} (any project-aware tool) +@item -P@var{project} +@cindex @option{-P} (any project-aware tool) Indicates the name of a project file. This project file will be parsed with -the verbosity indicated by @option{^-vP^MESSAGE_PROJECT_FILES=^@emph{x}}, +the verbosity indicated by @option{-vP@emph{x}}, if any, and using the external references indicated -by @option{^-X^/EXTERNAL_REFERENCE^} switches, if any. -@ifclear vms +by @option{-X} switches, if any. There may zero, one or more spaces between @option{-P} and @var{project}. -@end ifclear -There must be only one @option{^-P^/PROJECT_FILE^} switch on the command line. +There must be only one @option{-P} switch on the command line. Since the Project Manager parses the project file only after all the switches on the command line are checked, the order of the switches -@option{^-P^/PROJECT_FILE^}, -@option{^-vP^/MESSAGES_PROJECT_FILE=^@emph{x}} -or @option{^-X^/EXTERNAL_REFERENCE^} is not significant. +@option{-P}, +@option{-vP@emph{x}} +or @option{-X} is not significant. -@item ^-X^/EXTERNAL_REFERENCE=^@var{name=value} -@cindex @option{^-X^/EXTERNAL_REFERENCE^} (any project-aware tool) +@item -X@var{name=value} +@cindex @option{-X} (any project-aware tool) Indicates that external variable @var{name} has the value @var{value}. The Project Manager will use this value for occurrences of @code{external(name)} when parsing the project file. -@ifclear vms If @var{name} or @var{value} includes a space, then @var{name=value} should be put between quotes. @smallexample -XOS=NT -X"user=John Doe" @end smallexample -@end ifclear -Several @option{^-X^/EXTERNAL_REFERENCE^} switches can be used simultaneously. -If several @option{^-X^/EXTERNAL_REFERENCE^} switches specify the same +Several @option{-X} switches can be used simultaneously. +If several @option{-X} switches specify the same @var{name}, only the last one is used. -An external variable specified with a @option{^-X^/EXTERNAL_REFERENCE^} switch +An external variable specified with a @option{-X} switch takes precedence over the value of the same name in the environment. -@item ^-vP^/MESSAGES_PROJECT_FILE=^@emph{x} -@cindex @option{^-vP^/MESSAGES_PROJECT_FILE^} (any project-aware tool) +@item -vP@emph{x} +@cindex @option{-vP} (any project-aware tool) Indicates the verbosity of the parsing of GNAT project files. -@ifclear vms @option{-vP0} means Default; @option{-vP1} means Medium; @option{-vP2} means High. -@end ifclear -@ifset vms -There are three possible options for this qualifier: DEFAULT, MEDIUM and -HIGH. -@end ifset -The default is ^Default^DEFAULT^: no output for syntactically correct +The default is Default: no output for syntactically correct project files. -If several @option{^-vP^/MESSAGES_PROJECT_FILE=^@emph{x}} switches are present, +If several @option{-vP@emph{x}} switches are present, only the last one is used. -@item ^-aP^/ADD_PROJECT_SEARCH_DIR=^<dir> -@cindex @option{^-aP^/ADD_PROJECT_SEARCH_DIR=^} (any project-aware tool) +@item -aP<dir> +@cindex @option{-aP} (any project-aware tool) Add directory <dir> at the beginning of the project search path, in order, after the current working directory. -@ifclear vms @item -eL @cindex @option{-eL} (any project-aware tool) Follow all symbolic links when processing project files. -@end ifclear -@item ^--subdirs^/SUBDIRS^=<subdir> -@cindex @option{^--subdirs^/SUBDIRS^=} (gnatmake and gnatclean) +@item --subdirs=<subdir> +@cindex @option{--subdirs=} (gnatmake and gnatclean) This switch is recognized by @command{gnatmake} and @command{gnatclean}. It indicate that the real directories (except the source directories) are the subdirectories <subdir> of the directories specified in the project files. @@ -12835,32 +12144,28 @@ automatically. @c --------------------------------------------- @noindent -@ifset vms -It is not currently possible to specify VMS style qualifiers in the project -files; only Unix style ^switches^switches^ may be specified. -@end ifset For each of the packages @code{Builder}, @code{Compiler}, @code{Binder}, and -@code{Linker}, you can specify a @code{^Default_Switches^Default_Switches^} +@code{Linker}, you can specify a @code{Default_Switches} attribute, a @code{Switches} attribute, or both; -as their names imply, these ^switch^switch^-related -attributes affect the ^switches^switches^ that are used for each of these GNAT +as their names imply, these switch-related +attributes affect the switches that are used for each of these GNAT components when @command{gnatmake} is invoked. As will be explained below, these -component-specific ^switches^switches^ precede -the ^switches^switches^ provided on the @command{gnatmake} command line. +component-specific switches precede +the switches provided on the @command{gnatmake} command line. -The @code{^Default_Switches^Default_Switches^} attribute is an attribute +The @code{Default_Switches} attribute is an attribute indexed by language name (case insensitive) whose value is a string list. For example: @smallexample @c projectfile @group -package Compiler is - for ^Default_Switches^Default_Switches^ ("Ada") - use ("^-gnaty^-gnaty^", - "^-v^-v^"); -end Compiler; +@b{package} Compiler @b{is} + @b{for} Default_Switches ("Ada") + @b{use} ("-gnaty", + "-v"); +@b{end} Compiler; @end group @end smallexample @@ -12871,12 +12176,12 @@ on the operating system) whose value is a string list. For example: @smallexample @c projectfile @group -package Builder is - for Switches ("main1.adb") - use ("^-O2^-O2^"); - for Switches ("main2.adb") - use ("^-g^-g^"); -end Builder; +@b{package} Builder @b{is} + @b{for} Switches ("main1.adb") + @b{use} ("-O2"); + @b{for} Switches ("main2.adb") + @b{use} ("-g"); +@b{end} Builder; @end group @end smallexample @@ -12888,35 +12193,35 @@ In each case just the file name without an explicit extension is acceptable. For each tool used in a program build (@command{gnatmake}, the compiler, the binder, and the linker), the corresponding package @dfn{contributes} a set of -^switches^switches^ for each file on which the tool is invoked, based on the -^switch^switch^-related attributes defined in the package. -In particular, the ^switches^switches^ +switches for each file on which the tool is invoked, based on the +switch-related attributes defined in the package. +In particular, the switches that each of these packages contributes for a given file @var{f} comprise: @itemize @bullet @item the value of attribute @code{Switches (@var{f})}, if it is specified in the package for the given file, -@item otherwise, the value of @code{^Default_Switches^Default_Switches^ ("Ada")}, +@item otherwise, the value of @code{Default_Switches ("Ada")}, if it is specified in the package. @end itemize @noindent If neither of these attributes is defined in the package, then the package does -not contribute any ^switches^switches^ for the given file. +not contribute any switches for the given file. -When @command{gnatmake} is invoked on a file, the ^switches^switches^ comprise +When @command{gnatmake} is invoked on a file, the switches comprise two sets, in the following order: those contributed for the file by the @code{Builder} package; and the switches passed on the command line. When @command{gnatmake} invokes a tool (compiler, binder, linker) on a file, -the ^switches^switches^ passed to the tool comprise three sets, +the switches passed to the tool comprise three sets, in the following order: @enumerate @item -the applicable ^switches^switches^ contributed for the file +the applicable switches contributed for the file by the @code{Builder} package in the project file supplied on the command line; @item @@ -12927,9 +12232,9 @@ see below) corresponding to the tool; and the applicable switches passed on the command line. @end enumerate -The term @emph{applicable ^switches^switches^} reflects the fact that -@command{gnatmake} ^switches^switches^ may or may not be passed to individual -tools, depending on the individual ^switch^switch^. +The term @emph{applicable switches} reflects the fact that +@command{gnatmake} switches may or may not be passed to individual +tools, depending on the individual switch. @command{gnatmake} may invoke the compiler on source files from different projects. The Project Manager will use the appropriate project file to @@ -12940,50 +12245,50 @@ As an example, consider the following package in a project file: @smallexample @c projectfile @group -project Proj1 is - package Compiler is - for ^Default_Switches^Default_Switches^ ("Ada") - use ("^-g^-g^"); - for Switches ("a.adb") - use ("^-O1^-O1^"); - for Switches ("b.adb") - use ("^-O2^-O2^", - "^-gnaty^-gnaty^"); - end Compiler; -end Proj1; +@b{project} Proj1 @b{is} + @b{package} Compiler @b{is} + @b{for} Default_Switches ("Ada") + @b{use} ("-g"); + @b{for} Switches ("a.adb") + @b{use} ("-O1"); + @b{for} Switches ("b.adb") + @b{use} ("-O2", + "-gnaty"); + @b{end} Compiler; +@b{end} Proj1; @end group @end smallexample @noindent If @command{gnatmake} is invoked with this project file, and it needs to compile, say, the files @file{a.adb}, @file{b.adb}, and @file{c.adb}, then -@file{a.adb} will be compiled with the ^switch^switch^ -@option{^-O1^-O1^}, -@file{b.adb} with ^switches^switches^ -@option{^-O2^-O2^} -and @option{^-gnaty^-gnaty^}, -and @file{c.adb} with @option{^-g^-g^}. - -The following example illustrates the ordering of the ^switches^switches^ +@file{a.adb} will be compiled with the switch +@option{-O1}, +@file{b.adb} with switches +@option{-O2} +and @option{-gnaty}, +and @file{c.adb} with @option{-g}. + +The following example illustrates the ordering of the switches contributed by different packages: @smallexample @c projectfile @group -project Proj2 is - package Builder is - for Switches ("main.adb") - use ("^-g^-g^", - "^-O1^-)1^", - "^-f^-f^"); - end Builder; +@b{project} Proj2 @b{is} + @b{package} Builder @b{is} + @b{for} Switches ("main.adb") + @b{use} ("-g", + "-O1", + "-f"); + @b{end} Builder; @end group @group - package Compiler is - for Switches ("main.adb") - use ("^-O2^-O2^"); - end Compiler; -end Proj2; + @b{package} Compiler @b{is} + @b{for} Switches ("main.adb") + @b{use} ("-O2"); + @b{end} Compiler; +@b{end} Proj2; @end group @end smallexample @@ -12991,32 +12296,32 @@ end Proj2; If you issue the command: @smallexample - gnatmake ^-Pproj2^/PROJECT_FILE=PROJ2^ -O0 main + gnatmake -Pproj2 -O0 main @end smallexample @noindent then the compiler will be invoked on @file{main.adb} with the following -sequence of ^switches^switches^ +sequence of switches @smallexample - ^-g -O1 -O2 -O0^-g -O1 -O2 -O0^ + -g -O1 -O2 -O0 @end smallexample @noindent -with the last @option{^-O^-O^} -^switch^switch^ having precedence over the earlier ones; -several other ^switches^switches^ -(such as @option{^-c^-c^}) are added implicitly. +with the last @option{-O} +switch having precedence over the earlier ones; +several other switches +(such as @option{-c}) are added implicitly. -The ^switches^switches^ -@option{^-g^-g^} -and @option{^-O1^-O1^} are contributed by package -@code{Builder}, @option{^-O2^-O2^} is contributed +The switches +@option{-g} +and @option{-O1} are contributed by package +@code{Builder}, @option{-O2} is contributed by the package @code{Compiler} -and @option{^-O0^-O0^} comes from the command line. +and @option{-O0} comes from the command line. -The @option{^-g^-g^} -^switch^switch^ will also be passed in the invocation of +The @option{-g} +switch will also be passed in the invocation of @command{Gnatlink.} A final example illustrates switch contributions from packages in different @@ -13024,68 +12329,68 @@ project files: @smallexample @c projectfile @group -project Proj3 is - for Source_Files use ("pack.ads", "pack.adb"); - package Compiler is - for ^Default_Switches^Default_Switches^ ("Ada") - use ("^-gnata^-gnata^"); - end Compiler; -end Proj3; +@b{project} Proj3 @b{is} + @b{for} Source_Files @b{use} ("pack.ads", "pack.adb"); + @b{package} Compiler @b{is} + @b{for} Default_Switches ("Ada") + @b{use} ("-gnata"); + @b{end} Compiler; +@b{end} Proj3; @end group @group -with "Proj3"; -project Proj4 is - for Source_Files use ("foo_main.adb", "bar_main.adb"); - package Builder is - for Switches ("foo_main.adb") - use ("^-s^-s^", - "^-g^-g^"); - end Builder; -end Proj4; +@b{with} "Proj3"; +@b{project} Proj4 @b{is} + @b{for} Source_Files @b{use} ("foo_main.adb", "bar_main.adb"); + @b{package} Builder @b{is} + @b{for} Switches ("foo_main.adb") + @b{use} ("-s", + "-g"); + @b{end} Builder; +@b{end} Proj4; @end group @group --- Ada source file: -with Pack; -procedure Foo_Main is +--@i{ Ada source file:} +@b{with} Pack; +@b{procedure} Foo_Main @b{is} @dots{} -end Foo_Main; +@b{end} Foo_Main; @end group @end smallexample @noindent If the command is @smallexample -gnatmake ^-PProj4^/PROJECT_FILE=PROJ4^ foo_main.adb -cargs -gnato +gnatmake -PProj4 foo_main.adb -cargs -gnato @end smallexample @noindent -then the ^switches^switches^ passed to the compiler for @file{foo_main.adb} are -@option{^-g^-g^} (contributed by the package @code{Proj4.Builder}) and -@option{^-gnato^-gnato^} (passed on the command line). -When the imported package @code{Pack} is compiled, the ^switches^switches^ used -are @option{^-g^-g^} from @code{Proj4.Builder}, -@option{^-gnata^-gnata^} (contributed from package @code{Proj3.Compiler}, -and @option{^-gnato^-gnato^} from the command line. +then the switches passed to the compiler for @file{foo_main.adb} are +@option{-g} (contributed by the package @code{Proj4.Builder}) and +@option{-gnato} (passed on the command line). +When the imported package @code{Pack} is compiled, the switches used +are @option{-g} from @code{Proj4.Builder}, +@option{-gnata} (contributed from package @code{Proj3.Compiler}, +and @option{-gnato} from the command line. -When using @command{gnatmake} with project files, some ^switches^switches^ or +When using @command{gnatmake} with project files, some switches or arguments may be expressed as relative paths. As the working directory where compilation occurs may change, these relative paths are converted to absolute -paths. For the ^switches^switches^ found in a project file, the relative paths +paths. For the switches found in a project file, the relative paths are relative to the project file directory, for the switches on the command line, they are relative to the directory where @command{gnatmake} is invoked. -The ^switches^switches^ for which this occurs are: -^-I^-I^, -^-A^-A^, -^-L^-L^, -^-aO^-aO^, -^-aL^-aL^, -^-aI^-aI^, as well as all arguments that are not switches (arguments to -^switch^switch^ -^-o^-o^, object files specified in package @code{Linker} or after --largs on the command line). The exception to this rule is the ^switch^switch^ -^--RTS=^--RTS=^ for which a relative path argument is never converted. +The switches for which this occurs are: +-I, +-A, +-L, +-aO, +-aL, +-aI, as well as all arguments that are not switches (arguments to +switch +-o, object files specified in package @code{Linker} or after +-largs on the command line). The exception to this rule is the switch +--RTS= for which a relative path argument is never converted. @c --------------------------------------------- @node Specifying Configuration Pragmas @@ -13124,22 +12429,22 @@ with one or several main subprograms, by specifying their source files on the command line. @smallexample - gnatmake ^-P^/PROJECT_FILE=^prj main1.adb main2.adb main3.adb + gnatmake -Pprj main1.adb main2.adb main3.adb @end smallexample @noindent Each of these needs to be a source file of the same project, except -when the switch ^-u^/UNIQUE^ is used. +when the switch -u is used. -When ^-u^/UNIQUE^ is not used, all the mains need to be sources of the +When -u is not used, all the mains need to be sources of the same project, one of the project in the tree rooted at the project specified on the command line. The package @code{Builder} of this common project, the "main project" is the one that is considered by @command{gnatmake}. -When ^-u^/UNIQUE^ is used, the specified source files may be in projects +When -u is used, the specified source files may be in projects imported directly or indirectly by the project specified on the command line. Note that if such a source file is not part of the project specified on the -command line, the ^switches^switches^ found in package @code{Builder} of the +command line, the switches found in package @code{Builder} of the project specified on the command line, if any, that are transmitted to the compiler will still be used, not those found in the project file of the source file. @@ -13151,7 +12456,7 @@ where each element in the list is the name of a source file (the file extension is optional) that contains a unit that can be a main subprogram. If the @code{Main} attribute is defined in a project file as a non-empty -string list and the switch @option{^-u^/UNIQUE^} is not used on the command +string list and the switch @option{-u} is not used on the command line, then invoking @command{gnatmake} with this project file but without any main on the command line is equivalent to invoking @command{gnatmake} with all the file names in the @code{Main} attribute on the command line. @@ -13159,16 +12464,16 @@ the file names in the @code{Main} attribute on the command line. Example: @smallexample @c projectfile @group - project Prj is - for Main use ("main1.adb", "main2.adb", "main3.adb"); - end Prj; + @b{project} Prj @b{is} + @b{for} Main @b{use} ("main1.adb", "main2.adb", "main3.adb"); + @b{end} Prj; @end group @end smallexample @noindent -With this project file, @code{"gnatmake ^-Pprj^/PROJECT_FILE=PRJ^"} +With this project file, @code{"gnatmake -Pprj"} is equivalent to -@code{"gnatmake ^-Pprj^/PROJECT_FILE=PRJ^ main1.adb main2.adb main3.adb"}. +@code{"gnatmake -Pprj main1.adb main2.adb main3.adb"}. When the project attribute @code{Main} is not specified, or is specified as an empty string list, or when the switch @option{-u} is used on the command @@ -13182,12 +12487,12 @@ main project file. When no main is specified on the command line and attribute @code{Main} exists and includes several mains, or when several mains are specified on the -command line, the default ^switches^switches^ in package @code{Builder} will -be used for all mains, even if there are specific ^switches^switches^ +command line, the default switches in package @code{Builder} will +be used for all mains, even if there are specific switches specified for one or several mains. -But the ^switches^switches^ from package @code{Binder} or @code{Linker} will be -the specific ^switches^switches^ for each main, if they are specified. +But the switches from package @code{Binder} or @code{Linker} will be +the specific switches for each main, if they are specified. @c --------------------------------------------- @node Library Project Files @@ -13199,15 +12504,15 @@ When @command{gnatmake} is invoked with a main project file that is a library project file, it is not allowed to specify one or more mains on the command line. -When a library project file is specified, switches ^-b^/ACTION=BIND^ and -^-l^/ACTION=LINK^ have special meanings. +When a library project file is specified, switches -b and +-l have special meanings. @itemize @bullet -@item ^-b^/ACTION=BIND^ is only allowed for stand-alone libraries. It indicates +@item -b is only allowed for stand-alone libraries. It indicates to @command{gnatmake} that @command{gnatbind} should be invoked for the library. -@item ^-l^/ACTION=LINK^ may be used for all library projects. It indicates +@item -l may be used for all library projects. It indicates to @command{gnatmake} that the binder generated file should be compiled (in the case of a stand-alone library) and that the library should be built. @end itemize @@ -13218,26 +12523,26 @@ When a library project file is specified, switches ^-b^/ACTION=BIND^ and @c --------------------------------------------- @noindent -A number of GNAT tools, other than @command{^gnatmake^gnatmake^} +A number of GNAT tools, other than @command{gnatmake} can benefit from project files: -(@command{^gnatbind^gnatbind^}, +(@command{gnatbind}, @ifclear FSFEDITION -@command{^gnatcheck^gnatcheck^}, +@command{gnatcheck}, @end ifclear -@command{^gnatclean^gnatclean^}, +@command{gnatclean}, @ifclear FSFEDITION -@command{^gnatelim^gnatelim^}, +@command{gnatelim}, @end ifclear -@command{^gnatfind^gnatfind^}, -@command{^gnatlink^gnatlink^}, -@command{^gnatls^gnatls^}, +@command{gnatfind}, +@command{gnatlink}, +@command{gnatls}, @ifclear FSFEDITION -@command{^gnatmetric^gnatmetric^}, -@command{^gnatpp^gnatpp^}, -@command{^gnatstub^gnatstub^}, +@command{gnatmetric}, +@command{gnatpp}, +@command{gnatstub}, @end ifclear -and @command{^gnatxref^gnatxref^}). However, none of these tools can be invoked -directly with a project file switch (@option{^-P^/PROJECT_FILE=^}). +and @command{gnatxref}). However, none of these tools can be invoked +directly with a project file switch (@option{-P}). They must be invoked through the @command{gnat} driver. The @command{gnat} driver is a wrapper that accepts a number of commands and @@ -13249,32 +12554,32 @@ On non-VMS platforms, the @command{gnat} driver accepts the following commands (case insensitive): @itemize @bullet -@item BIND to invoke @command{^gnatbind^gnatbind^} -@item CHOP to invoke @command{^gnatchop^gnatchop^} -@item CLEAN to invoke @command{^gnatclean^gnatclean^} +@item BIND to invoke @command{gnatbind} +@item CHOP to invoke @command{gnatchop} +@item CLEAN to invoke @command{gnatclean} @item COMP or COMPILE to invoke the compiler @ifclear FSFEDITION -@item ELIM to invoke @command{^gnatelim^gnatelim^} +@item ELIM to invoke @command{gnatelim} @end ifclear -@item FIND to invoke @command{^gnatfind^gnatfind^} -@item KR or KRUNCH to invoke @command{^gnatkr^gnatkr^} -@item LINK to invoke @command{^gnatlink^gnatlink^} -@item LS or LIST to invoke @command{^gnatls^gnatls^} -@item MAKE to invoke @command{^gnatmake^gnatmake^} -@item NAME to invoke @command{^gnatname^gnatname^} -@item PREP or PREPROCESS to invoke @command{^gnatprep^gnatprep^} +@item FIND to invoke @command{gnatfind} +@item KR or KRUNCH to invoke @command{gnatkr} +@item LINK to invoke @command{gnatlink} +@item LS or LIST to invoke @command{gnatls} +@item MAKE to invoke @command{gnatmake} +@item NAME to invoke @command{gnatname} +@item PREP or PREPROCESS to invoke @command{gnatprep} @ifclear FSFEDITION -@item PP or PRETTY to invoke @command{^gnatpp^gnatpp^} -@item METRIC to invoke @command{^gnatmetric^gnatmetric^} -@item STUB to invoke @command{^gnatstub^gnatstub^} +@item PP or PRETTY to invoke @command{gnatpp} +@item METRIC to invoke @command{gnatmetric} +@item STUB to invoke @command{gnatstub} @end ifclear -@item XREF to invoke @command{^gnatxref^gnatxref^} +@item XREF to invoke @command{gnatxref} @end itemize @noindent (note that the compiler is invoked using the command -@command{^gnatmake -f -u -c^gnatmake -f -u -c^}). +@command{gnatmake -f -u -c}). On non-VMS platforms, between @command{gnat} and the command, two special switches may be used: @@ -13317,176 +12622,174 @@ PP or PRETTY, STUB, @end ifclear and XREF, the project file related switches -(@option{^-P^/PROJECT_FILE^}, -@option{^-X^/EXTERNAL_REFERENCE^} and -@option{^-vP^/MESSAGES_PROJECT_FILE=^x}) may be used in addition to +(@option{-P}, +@option{-X} and +@option{-vPx}) may be used in addition to the switches of the invoking tool. @ifclear FSFEDITION When GNAT PP or GNAT PRETTY is used with a project file, but with no source -specified on the command line, it invokes @command{^gnatpp^gnatpp^} with all +specified on the command line, it invokes @command{gnatpp} with all the immediate sources of the specified project file. @end ifclear @ifclear FSFEDITION When GNAT METRIC is used with a project file, but with no source -specified on the command line, it invokes @command{^gnatmetric^gnatmetric^} +specified on the command line, it invokes @command{gnatmetric} with all the immediate sources of the specified project file and with -@option{^-d^/DIRECTORY^} with the parameter pointing to the object directory +@option{-d} with the parameter pointing to the object directory of the project. @end ifclear @ifclear FSFEDITION In addition, when GNAT PP, GNAT PRETTY or GNAT METRIC is used with a project file, no source is specified on the command line and -switch ^-U^/ALL_PROJECTS^ is specified on the command line, then -the underlying tool (^gnatpp^gnatpp^ or -^gnatmetric^gnatmetric^) is invoked for all sources of all projects, +switch -U is specified on the command line, then +the underlying tool (gnatpp or +gnatmetric) is invoked for all sources of all projects, not only for the immediate sources of the main project. -@ifclear vms (-U stands for Universal or Union of the project files of the project tree) @end ifclear -@end ifclear For each of the following commands, there is optionally a corresponding package in the main project. @itemize @bullet -@item package @code{Binder} for command BIND (invoking @code{^gnatbind^gnatbind^}) +@item package @code{Binder} for command BIND (invoking @code{gnatbind}) @ifclear FSFEDITION @item package @code{Check} for command CHECK (invoking - @code{^gnatcheck^gnatcheck^}) + @code{gnatcheck}) @end ifclear @item package @code{Compiler} for command COMP or COMPILE (invoking the compiler) @item package @code{Cross_Reference} for command XREF (invoking - @code{^gnatxref^gnatxref^}) + @code{gnatxref}) @ifclear FSFEDITION @item package @code{Eliminate} for command ELIM (invoking - @code{^gnatelim^gnatelim^}) + @code{gnatelim}) @end ifclear -@item package @code{Finder} for command FIND (invoking @code{^gnatfind^gnatfind^}) +@item package @code{Finder} for command FIND (invoking @code{gnatfind}) -@item package @code{Gnatls} for command LS or LIST (invoking @code{^gnatls^gnatls^}) +@item package @code{Gnatls} for command LS or LIST (invoking @code{gnatls}) @ifclear FSFEDITION @item package @code{Gnatstub} for command STUB - (invoking @code{^gnatstub^gnatstub^}) + (invoking @code{gnatstub}) @end ifclear -@item package @code{Linker} for command LINK (invoking @code{^gnatlink^gnatlink^}) +@item package @code{Linker} for command LINK (invoking @code{gnatlink}) @ifclear FSFEDITION @item package @code{Check} for command CHECK - (invoking @code{^gnatcheck^gnatcheck^}) + (invoking @code{gnatcheck}) @end ifclear @ifclear FSFEDITION @item package @code{Metrics} for command METRIC - (invoking @code{^gnatmetric^gnatmetric^}) + (invoking @code{gnatmetric}) @end ifclear @ifclear FSFEDITION @item package @code{Pretty_Printer} for command PP or PRETTY - (invoking @code{^gnatpp^gnatpp^}) + (invoking @code{gnatpp}) @end ifclear @end itemize @noindent Package @code{Gnatls} has a unique attribute @code{Switches}, -a simple variable with a string list value. It contains ^switches^switches^ -for the invocation of @code{^gnatls^gnatls^}. +a simple variable with a string list value. It contains switches +for the invocation of @code{gnatls}. @smallexample @c projectfile @group -project Proj1 is - package gnatls is - for Switches - use ("^-a^-a^", - "^-v^-v^"); - end gnatls; -end Proj1; +@b{project} Proj1 @b{is} + @b{package} gnatls @b{is} + @b{for} Switches + @b{use} ("-a", + "-v"); + @b{end} gnatls; +@b{end} Proj1; @end group @end smallexample @noindent All other packages have two attribute @code{Switches} and -@code{^Default_Switches^Default_Switches^}. +@code{Default_Switches}. @code{Switches} is an indexed attribute, indexed by the -source file name, that has a string list value: the ^switches^switches^ to be +source file name, that has a string list value: the switches to be used when the tool corresponding to the package is invoked for the specific source file. -@code{^Default_Switches^Default_Switches^} is an attribute, +@code{Default_Switches} is an attribute, indexed by the programming language that has a string list value. -@code{^Default_Switches^Default_Switches^ ("Ada")} contains the -^switches^switches^ for the invocation of the tool corresponding +@code{Default_Switches ("Ada")} contains the +switches for the invocation of the tool corresponding to the package, except if a specific @code{Switches} attribute is specified for the source file. @smallexample @c projectfile @group -project Proj is +@b{project} Proj @b{is} - for Source_Dirs use ("**"); + @b{for} Source_Dirs @b{use} ("**"); - package gnatls is - for Switches use - ("^-a^-a^", - "^-v^-v^"); - end gnatls; + @b{package} gnatls @b{is} + @b{for} Switches @b{use} + ("-a", + "-v"); + @b{end} gnatls; @end group @group - package Compiler is - for ^Default_Switches^Default_Switches^ ("Ada") - use ("^-gnatv^-gnatv^", - "^-gnatwa^-gnatwa^"); - end Binder; + @b{package} Compiler @b{is} + @b{for} Default_Switches ("Ada") + @b{use} ("-gnatv", + "-gnatwa"); + @b{end} Binder; @end group @group - package Binder is - for ^Default_Switches^Default_Switches^ ("Ada") - use ("^-C^-C^", - "^-e^-e^"); - end Binder; + @b{package} Binder @b{is} + @b{for} Default_Switches ("Ada") + @b{use} ("-C", + "-e"); + @b{end} Binder; @end group @group - package Linker is - for ^Default_Switches^Default_Switches^ ("Ada") - use ("^-C^-C^"); - for Switches ("main.adb") - use ("^-C^-C^", - "^-v^-v^", - "^-v^-v^"); - end Linker; + @b{package} Linker @b{is} + @b{for} Default_Switches ("Ada") + @b{use} ("-C"); + @b{for} Switches ("main.adb") + @b{use} ("-C", + "-v", + "-v"); + @b{end} Linker; @end group @group - package Finder is - for ^Default_Switches^Default_Switches^ ("Ada") - use ("^-a^-a^", - "^-f^-f^"); - end Finder; + @b{package} Finder @b{is} + @b{for} Default_Switches ("Ada") + @b{use} ("-a", + "-f"); + @b{end} Finder; @end group @group - package Cross_Reference is - for ^Default_Switches^Default_Switches^ ("Ada") - use ("^-a^-a^", - "^-f^-f^", - "^-d^-d^", - "^-u^-u^"); - end Cross_Reference; -end Proj; + @b{package} Cross_Reference @b{is} + @b{for} Default_Switches ("Ada") + @b{use} ("-a", + "-f", + "-d", + "-u"); + @b{end} Cross_Reference; +@b{end} Proj; @end group @end smallexample @@ -13494,24 +12797,24 @@ end Proj; With the above project file, commands such as @smallexample - ^gnat comp -Pproj main^GNAT COMP /PROJECT_FILE=PROJ MAIN^ - ^gnat ls -Pproj main^GNAT LIST /PROJECT_FILE=PROJ MAIN^ - ^gnat xref -Pproj main^GNAT XREF /PROJECT_FILE=PROJ MAIN^ - ^gnat bind -Pproj main.ali^GNAT BIND /PROJECT_FILE=PROJ MAIN.ALI^ - ^gnat link -Pproj main.ali^GNAT LINK /PROJECT_FILE=PROJ MAIN.ALI^ + gnat comp -Pproj main + gnat ls -Pproj main + gnat xref -Pproj main + gnat bind -Pproj main.ali + gnat link -Pproj main.ali @end smallexample @noindent will set up the environment properly and invoke the tool with the switches found in the package corresponding to the tool: -@code{^Default_Switches^Default_Switches^ ("Ada")} for all tools, +@code{Default_Switches ("Ada")} for all tools, except @code{Switches ("main.adb")} -for @code{^gnatlink^gnatlink^}. +for @code{gnatlink}. @ifclear FSFEDITION It is also possible to invoke some of the tools, -(@code{^gnatcheck^gnatcheck^}, -@code{^gnatmetric^gnatmetric^}, -and @code{^gnatpp^gnatpp^}) +(@code{gnatcheck}, +@code{gnatmetric}, +and @code{gnatpp}) on a set of project units thanks to the combination of the switches @option{-P}, @option{-U} and possibly the main unit when one is interested in its closure. For instance, @@ -13631,8 +12934,8 @@ Display Copyright and version, then exit disregarding all other options. If @option{--version} was not used, display usage, then exit disregarding all other options. -@item ^-a^/ALL_FILES^ -@cindex @option{^-a^/ALL_FILES^} (@command{gnatxref}) +@item -a +@cindex @option{-a} (@command{gnatxref}) If this switch is present, @code{gnatfind} and @code{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 @@ -13671,19 +12974,19 @@ default, which means that only the new extension will be considered. Specifies the default location of the runtime library. Same meaning as the equivalent @command{gnatmake} flag (@pxref{Switches for gnatmake}). -@item ^-d^/DERIVED_TYPES^ -@cindex @option{^-d^/DERIVED_TYPES^} (@command{gnatxref}) +@item -d +@cindex @option{-d} (@command{gnatxref}) If this switch is set @code{gnatxref} will output the parent type reference for each matching derived types. -@item ^-f^/FULL_PATHNAME^ -@cindex @option{^-f^/FULL_PATHNAME^} (@command{gnatxref}) +@item -f +@cindex @option{-f} (@command{gnatxref}) 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. -@item ^-g^/IGNORE_LOCALS^ -@cindex @option{^-g^/IGNORE_LOCALS^} (@command{gnatxref}) +@item -g +@cindex @option{-g} (@command{gnatxref}) If this switch is set, information is output only for library-level entities, ignoring local entities. The use of this switch may accelerate @code{gnatfind} and @code{gnatxref}. @@ -13704,28 +13007,26 @@ 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 @samp{^-aI^/SOURCE_SEARCH^} -and @samp{^-aO^OBJECT_SEARCH^}. -@item ^-u^/UNUSED^ +had been specified respectively by @samp{-aI} +and @samp{-aO}. +@item -u Output only unused symbols. This may be really useful if you give your main compilation unit on the command line, as @code{gnatxref} will then display every unused entity and 'with'ed package. -@ifclear vms @item -v Instead of producing the default output, @code{gnatxref} will generate a @file{tags} file that can be used by vi. For examples how to use this feature, see @ref{Examples of gnatxref Usage}. The tags file is output to the standard output, thus you will have to redirect it to a file. -@end ifclear @end table @noindent 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 @samp{gnatxref ^-ag^/ALL_FILES/IGNORE_LOCALS^} instead of -@samp{gnatxref ^-a -g^/ALL_FILES /IGNORE_LOCALS^}. +you can say @samp{gnatxref -ag} instead of +@samp{gnatxref -a -g}. @node Switches for gnatfind @section @code{gnatfind} Switches @@ -13808,8 +13109,8 @@ Display Copyright and version, then exit disregarding all other options. If @option{--version} was not used, display usage, then exit disregarding all other options. -@item ^-a^/ALL_FILES^ -@cindex @option{^-a^/ALL_FILES^} (@command{gnatfind}) +@item -a +@cindex @option{-a} (@command{gnatfind}) If this switch is present, @code{gnatfind} and @code{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 @@ -13848,25 +13149,25 @@ default, which means that only the new extension will be considered. Specifies the default location of the runtime library. Same meaning as the equivalent @command{gnatmake} flag (@pxref{Switches for gnatmake}). -@item ^-d^/DERIVED_TYPE_INFORMATION^ -@cindex @option{^-d^/DERIVED_TYPE_INFORMATION^} (@code{gnatfind}) +@item -d +@cindex @option{-d} (@code{gnatfind}) If this switch is set, then @code{gnatfind} will output the parent type reference for each matching derived types. -@item ^-e^/EXPRESSIONS^ -@cindex @option{^-e^/EXPRESSIONS^} (@command{gnatfind}) +@item -e +@cindex @option{-e} (@command{gnatfind}) By default, @code{gnatfind} accept the simple regular expression set for @samp{pattern}. If this switch is set, then the pattern will be considered as full Unix-style regular expression. -@item ^-f^/FULL_PATHNAME^ -@cindex @option{^-f^/FULL_PATHNAME^} (@command{gnatfind}) +@item -f +@cindex @option{-f} (@command{gnatfind}) 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. -@item ^-g^/IGNORE_LOCALS^ -@cindex @option{^-g^/IGNORE_LOCALS^} (@command{gnatfind}) +@item -g +@cindex @option{-g} (@command{gnatfind}) If this switch is set, information is output only for library-level entities, ignoring local entities. The use of this switch may accelerate @code{gnatfind} and @code{gnatxref}. @@ -13883,24 +13184,24 @@ 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 @samp{^-aI^/SOURCE_SEARCH^} and -@samp{^-aO^/OBJECT_SEARCH^}. +had been specified respectively by @samp{-aI} and +@samp{-aO}. -@item ^-r^/REFERENCES^ -@cindex @option{^-r^/REFERENCES^} (@command{gnatfind}) +@item -r +@cindex @option{-r} (@command{gnatfind}) By default, @code{gnatfind} will output only the information about the declaration, body or type completion of the entities. If this switch is set, the @code{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). -@item ^-s^/PRINT_LINES^ -@cindex @option{^-s^/PRINT_LINES^} (@command{gnatfind}) +@item -s +@cindex @option{-s} (@command{gnatfind}) If this switch is set, then @code{gnatfind} will output the content of the Ada source file lines were the entity was found. -@item ^-t^/TYPE_HIERARCHY^ -@cindex @option{^-t^/TYPE_HIERARCHY^} (@command{gnatfind}) +@item -t +@cindex @option{-t} (@command{gnatfind}) If this switch is set, then @code{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 @@ -13911,8 +13212,8 @@ specify more than one file. @noindent 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 @samp{gnatxref ^-ag^/ALL_FILES/IGNORE_LOCALS^} instead of -@samp{gnatxref ^-a -g^/ALL_FILES /IGNORE_LOCALS^}. +you can say @samp{gnatxref -ag} instead of +@samp{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 @@ -13924,9 +13225,7 @@ you specify @code{*} at the end of the command line. @noindent Project files allow a programmer to specify how to compile its application, where to find sources, etc. These files are used -@ifclear vms primarily by GPS, but they can also be used -@end ifclear by the two tools @code{gnatxref} and @code{gnatfind}. @@ -13945,13 +13244,13 @@ account. @table @code @item src_dir=DIR -[default: @code{"^./^[]^"}] +[default: @code{"./"}] specifies a directory where to look for source files. Multiple @code{src_dir} lines can be specified and they will be searched in the order they are specified. @item obj_dir=DIR -[default: @code{"^./^[]^"}] +[default: @code{"./"}] specifies a directory where to look for object and library files. Multiple @code{obj_dir} lines can be specified, and they will be searched in the order they are specified @@ -13979,29 +13278,14 @@ switches given to @command{gnatlink}. specifies the name of the executable for the application. This variable can be referred to in the following lines by using the @samp{$@{main@}} notation. -@ifset vms -@item comp_cmd=COMMAND -[default: @code{"GNAT COMPILE /SEARCH=$@{src_dir@} /DEBUG /TRY_SEMANTICS"}] -@end ifset -@ifclear vms @item comp_cmd=COMMAND [default: @code{"gcc -c -I$@{src_dir@} -g -gnatq"}] -@end ifclear specifies the command used to compile a single file in the application. -@ifset vms -@item make_cmd=COMMAND -[default: @code{"GNAT MAKE $@{main@} -/SOURCE_SEARCH=$@{src_dir@} /OBJECT_SEARCH=$@{obj_dir@} -/DEBUG /TRY_SEMANTICS /COMPILER_QUALIFIERS $@{comp_opt@} -/BINDER_QUALIFIERS $@{bind_opt@} /LINKER_QUALIFIERS $@{link_opt@}"}] -@end ifset -@ifclear vms @item make_cmd=COMMAND [default: @code{"gnatmake $@{main@} -aI$@{src_dir@} -aO$@{obj_dir@} -g -gnatq -cargs $@{comp_opt@} -bargs $@{bind_opt@} -largs $@{link_opt@}"}] -@end ifclear specifies the command used to recompile the whole application. @item run_cmd=COMMAND @@ -14071,14 +13355,14 @@ item ::= elmt ? -- matches elmt or nothing @group elmt ::= nschar -- matches given character elmt ::= [nschar @{nschar@}] -- matches any character listed -elmt ::= [^^^ nschar @{nschar@}] -- matches any character not listed +elmt ::= [^ nschar @{nschar@}] -- matches any character not listed elmt ::= [char - char] -- matches chars in given range elmt ::= \ char -- matches given character elmt ::= . -- matches any single character elmt ::= ( regexp ) -- parens used for grouping char ::= any character, including special characters -nschar ::= any character except ()[].*+?^^^ +nschar ::= any character except ()[].*+?^ @end group @end smallexample @@ -14111,29 +13395,29 @@ For the following examples, we will consider the following units: @group @cartouche main.ads: -1: with Bar; -2: package Main is -3: procedure Foo (B : in Integer); +1: @b{with} Bar; +2: @b{package} Main @b{is} +3: @b{procedure} Foo (B : @b{in} Integer); 4: C : Integer; -5: private +5: @b{private} 6: D : Integer; -7: end Main; +7: @b{end} Main; main.adb: -1: package body Main is -2: procedure Foo (B : in Integer) is -3: begin +1: @b{package} @b{body} Main @b{is} +2: @b{procedure} Foo (B : @b{in} Integer) @b{is} +3: @b{begin} 4: C := B; 5: D := B; 6: Bar.Print (B); 7: Bar.Print (C); -8: end Foo; -9: end Main; +8: @b{end} Foo; +9: @b{end} Main; bar.ads: -1: package Bar is -2: procedure Print (B : Integer); -3: end bar; +1: @b{package} Bar @b{is} +2: @b{procedure} Print (B : Integer); +3: @b{end} bar; @end cartouche @end group @end smallexample @@ -14197,7 +13481,6 @@ of these. @end table -@ifclear vms @subsection Using gnatxref with vi @code{gnatxref} can generate a tags file output, which can be used @@ -14216,26 +13499,25 @@ are in the search path!). From @command{vi}, you can then use the command @samp{:tag @var{entity}} (replacing @var{entity} by whatever you are looking for), and vi will display a new file with the corresponding declaration of entity. -@end ifclear @node Examples of gnatfind Usage @section Examples of @code{gnatfind} Usage @table @code -@item gnatfind ^-f^/FULL_PATHNAME^ xyz:main.adb +@item gnatfind -f xyz:main.adb Find declarations for all entities xyz referenced at least once in main.adb. The references are search in every library file in the search path. -The directories will be printed as well (as the @samp{^-f^/FULL_PATHNAME^} +The directories will be printed as well (as the @samp{-f} switch is set) The output will look like: @smallexample -^directory/^[directory]^main.ads:106:14: xyz <= declaration -^directory/^[directory]^main.adb:24:10: xyz <= body -^directory/^[directory]^foo.ads:45:23: xyz <= declaration +directory/main.ads:106:14: xyz <= declaration +directory/main.adb:24:10: xyz <= body +directory/foo.ads:45:23: xyz <= declaration @end smallexample @noindent @@ -14243,18 +13525,18 @@ that is to say, one of the entities xyz found in main.adb is declared at line 12 of main.ads (and its body is in main.adb), and another one is declared at line 45 of foo.ads -@item gnatfind ^-fs^/FULL_PATHNAME/SOURCE_LINE^ xyz:main.adb +@item gnatfind -fs xyz:main.adb This is the same command as the previous one, instead @code{gnatfind} will display the content of the Ada source file lines. The output will look like: @smallexample -^directory/^[directory]^main.ads:106:14: xyz <= declaration +directory/main.ads:106:14: xyz <= declaration procedure xyz; -^directory/^[directory]^main.adb:24:10: xyz <= body +directory/main.adb:24:10: xyz <= body procedure xyz is -^directory/^[directory]^foo.ads:45:23: xyz <= declaration +directory/foo.ads:45:23: xyz <= declaration xyz : Integer; @end smallexample @@ -14262,7 +13544,7 @@ The output will look like: This can make it easier to find exactly the location your are looking for. -@item gnatfind ^-r^/REFERENCES^ "*x*":main.ads:123 foo.adb +@item gnatfind -r "*x*":main.ads:123 foo.adb Find references to all entities containing an x that are referenced on line 123 of main.ads. The references will be searched only in main.ads and foo.adb. @@ -14273,7 +13555,7 @@ line 123 of main.ads. This is the same as @code{gnatfind "*":main.adb:123}. -@item gnatfind ^mydir/^[mydir]^main.adb:123:45 +@item gnatfind mydir/main.adb:123:45 Find the declaration for the entity referenced at column 45 in line 123 of file main.adb in directory mydir. Note that it is usual to omit the identifier name when the column is given, @@ -14297,7 +13579,7 @@ point to any character in the middle of the identifier. @end menu @noindent -^The @command{gnatpp} tool^GNAT PRETTY^ is an ASIS-based utility +The @command{gnatpp} tool is an ASIS-based utility for source reformatting / pretty-printing. It takes an Ada source file as input and generates a reformatted version as output. @@ -14349,7 +13631,7 @@ follow the GNAT file naming rules @samp{@var{gcc_switches}} is a list of switches for @command{gcc}. They will be passed on to all compiler invocations made by @command{gnatpp} to generate the ASIS trees. Here you can provide -@option{^-I^/INCLUDE_DIRS=^} switches to form the source search path, +@option{-I} switches to form the source search path, use the @option{-gnatec} switch to set the configuration file, etc. @end itemize @@ -14360,7 +13642,6 @@ use the @option{-gnatec} switch to set the configuration file, etc. The following subsections describe the various switches accepted by @command{gnatpp}, organized by category. -@ifclear vms You specify a switch by supplying a name and generally also a value. In many cases the values for a switch with a given name are incompatible with each other @@ -14374,16 +13655,7 @@ You may supply several such switches to @command{gnatpp}, but then each must be specified in full, with both the name and the value. Abbreviated forms (the name appearing once, followed by each value) are not permitted. -@end ifclear -@ifset vms -In many cases the set of options for a given qualifier are incompatible with -each other (for example the qualifier that controls the casing of a reserved -word may have exactly one option, which specifies either upper case, lower -case, or mixed case), and thus exactly one such option can be in effect for -an invocation of @command{gnatpp}. -If more than one is supplied, the last one is used. -@end ifset @menu * Alignment Control:: @@ -14408,12 +13680,12 @@ By default alignment of the following constructs is set ON: representation clauses. @table @option -@cindex @option{^-A@var{n}^/ALIGN^} (@command{gnatpp}) +@cindex @option{-A@var{n}} (@command{gnatpp}) -@item ^-A0^/ALIGN=OFF^ +@item -A0 Set alignment to OFF -@item ^-A1^/ALIGN=ON^ +@item -A1 Set alignment to ON @end table @@ -14434,115 +13706,115 @@ following an underscore, are converted to their uppercase forms; all the other letters are converted to their lowercase forms. @table @option -@cindex @option{^-a@var{x}^/ATTRIBUTE^} (@command{gnatpp}) -@item ^-aL^/ATTRIBUTE_CASING=LOWER_CASE^ +@cindex @option{-a@var{x}} (@command{gnatpp}) +@item -aL Attribute designators are lower case -@item ^-aU^/ATTRIBUTE_CASING=UPPER_CASE^ +@item -aU Attribute designators are upper case -@item ^-aM^/ATTRIBUTE_CASING=MIXED_CASE^ +@item -aM Attribute designators are mixed case (this is the default) -@cindex @option{^-k@var{x}^/KEYWORD_CASING^} (@command{gnatpp}) -@item ^-kL^/KEYWORD_CASING=LOWER_CASE^ +@cindex @option{-k@var{x}} (@command{gnatpp}) +@item -kL Keywords (technically, these are known in Ada as @emph{reserved words}) are lower case (this is the default) -@item ^-kU^/KEYWORD_CASING=UPPER_CASE^ +@item -kU Keywords are upper case -@cindex @option{^-n@var{x}^/NAME_CASING^} (@command{gnatpp}) -@item ^-nD^/NAME_CASING=AS_DECLARED^ +@cindex @option{-n@var{x}} (@command{gnatpp}) +@item -nD Name casing for defining occurrences are as they appear in the source file (this is the default) -@item ^-nU^/NAME_CASING=UPPER_CASE^ +@item -nU Names are in upper case -@item ^-nL^/NAME_CASING=LOWER_CASE^ +@item -nL Names are in lower case -@item ^-nM^/NAME_CASING=MIXED_CASE^ +@item -nM Names are in mixed case -@cindex @option{^-ne@var{x}^/ENUM_CASING^} (@command{gnatpp}) -@item ^-neD^/ENUM_CASING=AS_DECLARED^ +@cindex @option{-ne@var{x}} (@command{gnatpp}) +@item -neD Enumeration literal casing for defining occurrences are as they appear in the -source file. Overrides ^-n^/NAME_CASING^ casing setting. +source file. Overrides -n casing setting. -@item ^-neU^/ENUM_CASING=UPPER_CASE^ -Enumeration literals are in upper case. Overrides ^-n^/NAME_CASING^ casing +@item -neU +Enumeration literals are in upper case. Overrides -n casing setting. -@item ^-neL^/ENUM_CASING=LOWER_CASE^ -Enumeration literals are in lower case. Overrides ^-n^/NAME_CASING^ casing +@item -neL +Enumeration literals are in lower case. Overrides -n casing setting. -@item ^-neM^/ENUM_CASING=MIXED_CASE^ -Enumeration literals are in mixed case. Overrides ^-n^/NAME_CASING^ casing +@item -neM +Enumeration literals are in mixed case. Overrides -n casing setting. -@cindex @option{^-nt@var{x}^/TYPE_CASING^} (@command{gnatpp}) -@item ^-neD^/TYPE_CASING=AS_DECLARED^ +@cindex @option{-nt@var{x}} (@command{gnatpp}) +@item -neD Names introduced by type and subtype declarations are always cased as they appear in the declaration in the source file. -Overrides ^-n^/NAME_CASING^ casing setting. +Overrides -n casing setting. -@item ^-ntU^/TYPE_CASING=UPPER_CASE^ +@item -ntU Names introduced by type and subtype declarations are always in -upper case. Overrides ^-n^/NAME_CASING^ casing setting. +upper case. Overrides -n casing setting. -@item ^-ntL^/TYPE_CASING=LOWER_CASE^ +@item -ntL Names introduced by type and subtype declarations are always in -lower case. Overrides ^-n^/NAME_CASING^ casing setting. +lower case. Overrides -n casing setting. -@item ^-ntM^/TYPE_CASING=MIXED_CASE^ +@item -ntM Names introduced by type and subtype declarations are always in -mixed case. Overrides ^-n^/NAME_CASING^ casing setting. +mixed case. Overrides -n casing setting. -@item ^-nnU^/NUMBER_CASING=UPPER_CASE^ +@item -nnU Names introduced by number declarations are always in -upper case. Overrides ^-n^/NAME_CASING^ casing setting. +upper case. Overrides -n casing setting. -@item ^-nnL^/NUMBER_CASING=LOWER_CASE^ +@item -nnL Names introduced by number declarations are always in -lower case. Overrides ^-n^/NAME_CASING^ casing setting. +lower case. Overrides -n casing setting. -@item ^-nnM^/NUMBER_CASING=MIXED_CASE^ +@item -nnM Names introduced by number declarations are always in -mixed case. Overrides ^-n^/NAME_CASING^ casing setting. +mixed case. Overrides -n casing setting. -@cindex @option{^-p@var{x}^/PRAGMA_CASING^} (@command{gnatpp}) -@item ^-pL^/PRAGMA_CASING=LOWER_CASE^ +@cindex @option{-p@var{x}} (@command{gnatpp}) +@item -pL Pragma names are lower case -@item ^-pU^/PRAGMA_CASING=UPPER_CASE^ +@item -pU Pragma names are upper case -@item ^-pM^/PRAGMA_CASING=MIXED_CASE^ +@item -pM Pragma names are mixed case (this is the default) -@item ^-D@var{file}^/DICTIONARY=@var{file}^ -@cindex @option{^-D^/DICTIONARY^} (@command{gnatpp}) +@item -D@var{file} +@cindex @option{-D} (@command{gnatpp}) Use @var{file} as a @emph{dictionary file} that defines the casing for a set of specified names, thereby overriding the effect on these names by any explicit or implicit -^-n^/NAME_CASING^ switch. +-n switch. To supply more than one dictionary file, -use ^several @option{-D} switches^a list of files as options^. +use several @option{-D} switches. @noindent @option{gnatpp} implicitly uses a @emph{default dictionary file} to define the casing for the Ada predefined names and the names declared in the GNAT libraries. -@item ^-D-^/SPECIFIC_CASING^ -@cindex @option{^-D-^/SPECIFIC_CASING^} (@command{gnatpp}) +@item -D- +@cindex @option{-D-} (@command{gnatpp}) Do not use the default dictionary file; instead, use the casing -defined by a @option{^-n^/NAME_CASING^} switch and any explicit +defined by a @option{-n} switch and any explicit dictionary file(s) @end table @@ -14550,8 +13822,8 @@ dictionary file(s) The structure of a dictionary file, and details on the conventions used in the default dictionary file, are defined in @ref{Name Casing}. -The @option{^-D-^/SPECIFIC_CASING^} and -@option{^-D@var{file}^/DICTIONARY=@var{file}^} switches are mutually +The @option{-D-} and +@option{-D@var{file}} switches are mutually compatible. @noindent @@ -14560,21 +13832,21 @@ complex syntactic constructs. See @ref{Formatting Comments} for details on their effect. @table @option -@cindex @option{^-c@var{n}^/COMMENTS_LAYOUT^} (@command{gnatpp}) -@item ^-c0^/COMMENTS_LAYOUT=UNTOUCHED^ +@cindex @option{-c@var{n}} (@command{gnatpp}) +@item -c0 All comments remain unchanged. -@item ^-c1^/COMMENTS_LAYOUT=DEFAULT^ +@item -c1 GNAT-style comment line indentation. This is the default. -@item ^-c3^/COMMENTS_LAYOUT=GNAT_BEGINNING^ +@item -c3 GNAT-style comment beginning. -@item ^-c4^/COMMENTS_LAYOUT=REFORMAT^ +@item -c4 Fill comment blocks. -@item ^-c5^/COMMENTS_LAYOUT=KEEP_SPECIAL^ +@item -c5 Keep unchanged special form comments. This is the default. @@ -14582,51 +13854,43 @@ This is the default. @cindex @option{--comments-only} @command{gnatpp} Format just the comments. -@cindex @option{^--no-separate-is^/NO_SEPARATE_IS^} (@command{gnatpp}) -@item ^--no-separate-is^/NO_SEPARATE_IS^ +@cindex @option{--no-separate-is} (@command{gnatpp}) +@item --no-separate-is Do not place the keyword @code{is} on a separate line in a subprogram body in case if the spec occupies more than one line. -@cindex @option{^--separate-loop-then^/SEPARATE_LOOP_THEN^} (@command{gnatpp}) -@item ^--separate-loop-then^/SEPARATE_LOOP_THEN^ +@cindex @option{--separate-loop-then} (@command{gnatpp}) +@item --separate-loop-then Place the keyword @code{loop} in FOR and WHILE loop statements and the keyword @code{then} in IF statements on a separate line. -@cindex @option{^--no-separate-loop-then^/NO_SEPARATE_LOOP_THEN^} (@command{gnatpp}) -@item ^--no-separate-loop-then^/NO_SEPARATE_LOOP_THEN^ +@cindex @option{--no-separate-loop-then} (@command{gnatpp}) +@item --no-separate-loop-then Do not place the keyword @code{loop} in FOR and WHILE loop statements and the keyword @code{then} in IF statements on a separate line. This option is -incompatible with @option{^--separate-loop-then^/SEPARATE_LOOP_THEN^} option. +incompatible with @option{--separate-loop-then} option. -@cindex @option{^--use-on-new-line^/USE_ON_NEW_LINE^} (@command{gnatpp}) -@item ^--use-on-new-line^/USE_ON_NEW_LINE^ +@cindex @option{--use-on-new-line} (@command{gnatpp}) +@item --use-on-new-line Start each USE clause in a context clause from a separate line. -@cindex @option{^--insert-blank-lines^/INSERT_BLANK_LINES^} (@command{gnatpp}) -@item ^--insert-blank-lines^/INSERT_BLANK_LINES^ +@cindex @option{--insert-blank-lines} (@command{gnatpp}) +@item --insert-blank-lines Insert blank lines where appropriate (between bodies and other large constructs). -@cindex @option{^--preserve-blank-lines^/PRESERVE_BLANK_LINES^} (@command{gnatpp}) -@item ^--preserve-blank-lines^/PRESERVE_BLANK_LINES^ +@cindex @option{--preserve-blank-lines} (@command{gnatpp}) +@item --preserve-blank-lines Preserve blank lines in the input. By default, gnatpp will squeeze multiple blank lines down to one. @end table -@ifclear vms @noindent The @option{-c} switches are compatible with one another, except that the @option{-c0} switch disables all other comment formatting switches. -@end ifclear -@ifset vms -@noindent -For the @option{/COMMENTS_LAYOUT} qualifier, -The @option{GNAT_BEGINNING}, @option{REFORMAT}, and @option{DEFAULT} -options are compatible with one another. -@end ifset @node General Text Layout Control @subsection General Text Layout Control @@ -14635,16 +13899,16 @@ options are compatible with one another. These switches allow control over line length and indentation. @table @option -@item ^-M@var{nnn}^/LINE_LENGTH_MAX=@var{nnn}^ -@cindex @option{^-M^/LINE_LENGTH^} (@command{gnatpp}) +@item -M@var{nnn} +@cindex @option{-M} (@command{gnatpp}) Maximum line length, @var{nnn} from 32@dots{}256, the default value is 79 -@item ^-i@var{nnn}^/INDENTATION_LEVEL=@var{nnn}^ -@cindex @option{^-i^/INDENTATION_LEVEL^} (@command{gnatpp}) +@item -i@var{nnn} +@cindex @option{-i} (@command{gnatpp}) Indentation level, @var{nnn} from 1@dots{}9, the default value is 3 -@item ^-cl@var{nnn}^/CONTINUATION_INDENT=@var{nnn}^ -@cindex @option{^-cl^/CONTINUATION_INDENT^} (@command{gnatpp}) +@item -cl@var{nnn} +@cindex @option{-cl} (@command{gnatpp}) Indentation level for continuation lines (relative to the line being continued), @var{nnn} from 1@dots{}9. The default @@ -14674,24 +13938,24 @@ Same as @code{--decimal-grouping}, but for based literals. For example, with @code{--based-grouping=4}, @code{16#0001FFFE#} will be changed to @code{16#0001_FFFE#}. -@item ^--RM-style-spacing^/RM_STYLE_SPACING^ -@cindex @option{^--RM-style-spacing^/RM_STYLE_SPACING^} (@command{gnatpp}) +@item --RM-style-spacing +@cindex @option{--RM-style-spacing} (@command{gnatpp}) Do not insert an extra blank before various occurrences of `(' and `:'. This also turns off alignment. -@item ^-ff^/FORM_FEED_AFTER_PRAGMA_PAGE^ -@cindex @option{^-ff^/FORM_FEED_AFTER_PRAGMA_PAGE^} (@command{gnatpp}) +@item -ff +@cindex @option{-ff} (@command{gnatpp}) Insert a Form Feed character after a pragma Page. -@item ^--call_threshold=@var{nnn}^/MAX_ACT=@var{nnn}^ -@cindex @option{^--call_threshold^/MAX_ACT^} (@command{gnatpp}) +@item --call_threshold=@var{nnn} +@cindex @option{--call_threshold} (@command{gnatpp}) If the number of parameter associations is greater than @var{nnn} and if at least one association uses named notation, start each association from a new line. If @var{nnn} is 0, no check for the number of associations is made; this is the default. -@item ^--par_threshold=@var{nnn}^/MAX_PAR=@var{nnn}^ -@cindex @option{^--par_threshold^/MAX_PAR^} (@command{gnatpp}) +@item --par_threshold=@var{nnn} +@cindex @option{--par_threshold} (@command{gnatpp}) If the number of parameter specifications is greater than @var{nnn} (or equal to @var{nnn} in case of a function), start each specification from a new line. This feature is disabled by default. @@ -14705,17 +13969,17 @@ To define the search path for the input source file, @command{gnatpp} uses the same switches as the GNAT compiler, with the same effects: @table @option -@item ^-I^/SEARCH=^@var{dir} -@cindex @option{^-I^/SEARCH^} (@command{gnatpp}) +@item -I@var{dir} +@cindex @option{-I} (@command{gnatpp}) -@item ^-I-^/NOCURRENT_DIRECTORY^ -@cindex @option{^-I-^/NOCURRENT_DIRECTORY^} (@command{gnatpp}) +@item -I- +@cindex @option{-I-} (@command{gnatpp}) -@item ^-gnatec^/CONFIGURATION_PRAGMAS_FILE^=@var{path} -@cindex @option{^-gnatec^/CONFIGURATION_PRAGMAS_FILE^} (@command{gnatpp}) +@item -gnatec=@var{path} +@cindex @option{-gnatec} (@command{gnatpp}) -@item ^--RTS^/RUNTIME_SYSTEM^=@var{path} -@cindex @option{^--RTS^/RUNTIME_SYSTEM^} (@command{gnatpp}) +@item --RTS=@var{path} +@cindex @option{--RTS} (@command{gnatpp}) @end table @@ -14724,105 +13988,105 @@ uses the same switches as the GNAT compiler, with the same effects: @noindent By default the output is sent to a file whose name is obtained by appending -the ^@file{.pp}^@file{$PP}^ suffix to the name of the input file. +the @file{.pp} suffix to the name of the input file. If the file with this name already exists, it is overwritten. -Thus if the input file is @file{^my_ada_proc.adb^MY_ADA_PROC.ADB^} then -@command{gnatpp} will produce @file{^my_ada_proc.adb.pp^MY_ADA_PROC.ADB$PP^} +Thus if the input file is @file{my_ada_proc.adb} then +@command{gnatpp} will produce @file{my_ada_proc.adb.pp} as output file. The output may be redirected by the following switches: @table @option -@item ^--output-dir=@var{dir}^/OUTPUT_DIR=@var{dir}^ -@cindex @option{^--output-dir^/OUTPUT_DIR^} (@command{gnatpp}) +@item --output-dir=@var{dir} +@cindex @option{--output-dir} (@command{gnatpp}) Generate output file in directory @file{dir} with the same name as the input file. If @file{dir} is the same as the directory containing the input file, -the input file is not processed; use @option{^-rnb^/REPLACE_NO_BACKUP^} +the input file is not processed; use @option{-rnb} if you want to update the input file in place. -@item ^-pipe^/STANDARD_OUTPUT^ -@cindex @option{^-pipe^/STANDARD_OUTPUT^} (@command{gnatpp}) +@item -pipe +@cindex @option{-pipe} (@command{gnatpp}) Send the output to @code{Standard_Output} -@item ^-o @var{output_file}^/OUTPUT=@var{output_file}^ -@cindex @option{^-o^/OUTPUT^} (@code{gnatpp}) +@item -o @var{output_file} +@cindex @option{-o} (@code{gnatpp}) Write the output into @var{output_file}. If @var{output_file} already exists, @command{gnatpp} terminates without reading or processing the input file. -@item ^-of ^/FORCED_OUTPUT=^@var{output_file} -@cindex @option{^-of^/FORCED_OUTPUT^} (@command{gnatpp}) +@item -of @var{output_file} +@cindex @option{-of} (@command{gnatpp}) Write the output into @var{output_file}, overwriting the existing file (if one is present). -@item ^-r^/REPLACE^ -@cindex @option{^-r^/REPLACE^} (@command{gnatpp}) +@item -r +@cindex @option{-r} (@command{gnatpp}) Replace the input source file with the reformatted output, and copy the original input source into the file whose name is obtained by appending the -^@file{.npp}^@file{$NPP}^ suffix to the name of the input file. +@file{.npp} suffix to the name of the input file. If a file with this name already exists, @command{gnatpp} terminates without reading or processing the input file. -@item ^-rf^/OVERRIDING_REPLACE^ -@cindex @option{^-rf^/OVERRIDING_REPLACE^} (@code{gnatpp}) -Like @option{^-r^/REPLACE^} except that if the file with the specified name +@item -rf +@cindex @option{-rf} (@code{gnatpp}) +Like @option{-r} except that if the file with the specified name already exists, it is overwritten. -@item ^-rnb^/REPLACE_NO_BACKUP^ -@cindex @option{^-rnb^/REPLACE_NO_BACKUP^} (@command{gnatpp}) +@item -rnb +@cindex @option{-rnb} (@command{gnatpp}) Replace the input source file with the reformatted output without creating any backup copy of the input source. -@item ^--eol=@var{xxx}^/END_OF_LINE=@var{xxx}^ -@cindex @option{^--eol^/END_OF_LINE^} (@code{gnatpp}) +@item --eol=@var{xxx} +@cindex @option{--eol} (@code{gnatpp}) Specifies the line-ending style of the reformatted output file. The @var{xxx} -^string specified with the switch^option^ may be: +string specified with the switch may be: @itemize @bullet -@item ``@option{^dos^DOS^}'' MS DOS style, lines end with CR LF characters -@item ``@option{^crlf^CRLF^}'' -the same as @option{^dos^DOS^} -@item ``@option{^unix^UNIX^}'' UNIX style, lines end with LF character -@item ``@option{^lf^LF^}'' -the same as @option{^unix^UNIX^} +@item ``@option{dos}'' MS DOS style, lines end with CR LF characters +@item ``@option{crlf}'' +the same as @option{dos} +@item ``@option{unix}'' UNIX style, lines end with LF character +@item ``@option{lf}'' +the same as @option{unix} @end itemize -@item ^-W^/RESULT_ENCODING=^@var{e} -@cindex @option{^-W^/RESULT_ENCODING=^} (@command{gnatpp}) +@item -W@var{e} +@cindex @option{-W} (@command{gnatpp}) Specify the wide character encoding method for the input and output files. @var{e} is one of the following: @itemize @bullet -@item ^h^HEX^ +@item h Hex encoding -@item ^u^UPPER^ +@item u Upper half encoding -@item ^s^SHIFT_JIS^ +@item s Shift/JIS encoding -@item ^e^EUC^ +@item e EUC encoding -@item ^8^UTF8^ +@item 8 UTF-8 encoding -@item ^b^BRACKETS^ +@item b Brackets encoding (default value) @end itemize @end table @noindent -Options @option{^-o^/OUTPUT^} and -@option{^-of^/FORCED_OUTPUT^} are allowed only if the call to gnatpp +Options @option{-o} and +@option{-of} are allowed only if the call to gnatpp contains only one file to reformat. Option -@option{^--eol^/END_OF_LINE^} +@option{--eol} and -@option{^-W^/RESULT_ENCODING^} +@option{-W} cannot be used together -with @option{^-pipe^/STANDARD_OUTPUT^} option. +with @option{-pipe} option. @node Other gnatpp Switches @subsection Other @code{gnatpp} Switches @@ -14888,41 +14152,41 @@ of the default @code{--!pp on}. @cindex @option{--pp-old} @command{gnatpp} Use the old formatting algorithms. -@item ^-files @var{filename}^/FILES=@var{filename}^ -@cindex @option{^-files^/FILES^} (@code{gnatpp}) +@item -files @var{filename} +@cindex @option{-files} (@code{gnatpp}) Take the argument source files from the specified file. This file should be an ordinary text file containing file names separated by spaces or line breaks. You can use this switch more than once in the same call to @command{gnatpp}. You also can combine this switch with an explicit list of files. -@item ^-j^/PROCESSES=^@var{n} -@cindex @option{^-j^/PROCESSES^} (@command{gnatpp}) +@item -j@var{n} +@cindex @option{-j} (@command{gnatpp}) Without @option{--incremental}, use @var{n} processes to carry out the tree creations (internal representations of the argument sources). On a multiprocessor machine this speeds up processing of big sets of argument sources. If @var{n} is 0, then the maximum number of parallel tree creations is the number of core processors on the platform. This -option cannot be used together with @option{^-r^/REPLACE^}, -@option{^-rf^/OVERRIDING_REPLACE^} or -@option{^-rnb^/REPLACE_NO_BACKUP^} option. +option cannot be used together with @option{-r}, +@option{-rf} or +@option{-rnb} option. With @option{--incremental}, use @var{n} @command{gnatpp} processes to perform pretty-printing in parallel. @var{n} = 0 means the same as -above. In this case, @option{^-r^/REPLACE^}, -@option{^-rf^/OVERRIDING_REPLACE^} or -@option{^-rnb^/REPLACE_NO_BACKUP^} options are allowed. +above. In this case, @option{-r}, +@option{-rf} or +@option{-rnb} options are allowed. -@cindex @option{^-t^/TIME^} (@command{gnatpp}) -@item ^-t^/TIME^ +@cindex @option{-t} (@command{gnatpp}) +@item -t Print out execution time. -@item ^-v^/VERBOSE^ -@cindex @option{^-v^/VERBOSE^} (@command{gnatpp}) +@item -v +@cindex @option{-v} (@command{gnatpp}) Verbose mode -@item ^-q^/QUIET^ -@cindex @option{^-q^/QUIET^} (@command{gnatpp}) +@item -q +@cindex @option{-q} (@command{gnatpp}) Quiet mode @end table @@ -14969,13 +14233,13 @@ be followed by arbitrary additional text. For example: @smallexample @c ada @cartouche -package Interrupts is - --!pp off -- turn off pretty printing so "Interrupt_Kind" lines up - type Interrupt_Kind is +@b{package} Interrupts @b{is} + --@i{!pp off -- turn off pretty printing so "Interrupt_Kind" lines up} + @b{type} Interrupt_Kind @b{is} (Asynchronous_Interrupt_Kind, Synchronous_Interrupt_Kind, Green_Interrupt_Kind); - --!pp on -- reenable pretty printing + --@i{!pp on -- reenable pretty printing} ... @end cartouche @@ -15000,10 +14264,10 @@ The output file will contain no lines with trailing white space. By default, a sequence of one or more blank lines in the input is converted to a single blank line in the output; multiple blank lines are squeezed down to one. -The @option{^--preserve-blank-lines^/PRESERVE_BLANK_LINES^} option +The @option{--preserve-blank-lines} option turns off the squeezing; each blank line in the input is copied to the output. -The @option{^--insert-blank-lines^/INSERT_BLANK_LINES^} option +The @option{--insert-blank-lines} option causes additional blank lines to be inserted if not already present in the input (e.g. between bodies). @@ -15028,7 +14292,7 @@ with some exceptions. Comments that start in column 1 are kept there. If possible, comments are not moved so far to the right that the maximum line length is exceeded. -The @option{^-c0^/COMMENTS_LAYOUT=UNTOUCHED^} option +The @option{-c0} option turns off comment formatting. Special-form comments such as SPARK-style @code{--#...} are left alone. @@ -15037,7 +14301,7 @@ number of spaces between the end of the preceding Ada code and the beginning of the comment as appear in the original source. @noindent -The @option{^-c3^/COMMENTS_LAYOUT=GNAT_BEGINNING^} switch +The @option{-c3} switch (GNAT style comment beginning) has the following effect: @@ -15050,7 +14314,7 @@ first non-blank character of the comment. @end itemize @noindent -The @option{^-c4^/COMMENTS_LAYOUT=REFORMAT^} switch specifies that +The @option{-c4} switch specifies that whole-line comments that form a paragraph will be filled in typical word processor style (that is, moving words between lines to make the lines other than the last similar in length ). @@ -15074,53 +14338,48 @@ both. If @option{--comments-only} is given without @option{-c3} or the same casing as the corresponding defining identifier. You control the casing for defining occurrences via the -@option{^-n^/NAME_CASING^} switch. -@ifclear vms +@option{-n} switch. With @option{-nD} (``as declared'', which is the default), -@end ifclear -@ifset vms -With @option{/NAME_CASING=AS_DECLARED}, which is the default, -@end ifset defining occurrences appear exactly as in the source file where they are declared. -The other ^values for this switch^options for this qualifier^ --- -@option{^-nU^UPPER_CASE^}, -@option{^-nL^LOWER_CASE^}, -@option{^-nM^MIXED_CASE^} --- +The other values for this switch --- +@option{-nU}, +@option{-nL}, +@option{-nM} --- result in -^upper, lower, or mixed case, respectively^the corresponding casing^. +upper, lower, or mixed case, respectively. If @command{gnatpp} changes the casing of a defining occurrence, it analogously changes the casing of all the usage occurrences of this name. If the defining occurrence of a name is not in the source compilation unit currently being processed by @command{gnatpp}, the casing of each reference to -this name is changed according to the value of the @option{^-n^/NAME_CASING^} +this name is changed according to the value of the @option{-n} switch (subject to the dictionary file mechanism described below). -Thus @command{gnatpp} acts as though the @option{^-n^/NAME_CASING^} switch +Thus @command{gnatpp} acts as though the @option{-n} switch had affected the casing for the defining occurrence of the name. The options -@option{^-a@var{x}^/ATTRIBUTE^}, -@option{^-k@var{x}^/KEYWORD_CASING^}, -@option{^-ne@var{x}^/ENUM_CASING^}, -@option{^-nt@var{x}^/TYPE_CASING^}, -@option{^-nn@var{x}^/NUMBER_CASING^}, and -@option{^-p@var{x}^/PRAGMA_CASING^} +@option{-a@var{x}}, +@option{-k@var{x}}, +@option{-ne@var{x}}, +@option{-nt@var{x}}, +@option{-nn@var{x}}, and +@option{-p@var{x}} allow finer-grained control over casing for attributes, keywords, enumeration literals, types, named numbers and pragmas, respectively. -@option{^-nt@var{x}^/TYPE_CASING^} covers subtypes and +@option{-nt@var{x}} covers subtypes and task and protected bodies as well. Some names may need to be spelled with casing conventions that are not covered by the upper-, lower-, and mixed-case transformations. You can arrange correct casing by placing such names in a @emph{dictionary file}, -and then supplying a @option{^-D^/DICTIONARY^} switch. +and then supplying a @option{-D} switch. The casing of names from dictionary files overrides -any @option{^-n^/NAME_CASING^} switch. +any @option{-n} switch. To handle the casing of Ada predefined names and the names from GNAT libraries, @command{gnatpp} assumes a default dictionary file. @@ -15129,15 +14388,15 @@ for the entity in the @cite{Ada Reference Manual} (usually mixed case). The name of each entity in the GNAT libraries is spelled with the same casing as is used in the declaration of that entity. -The @w{@option{^-D-^/SPECIFIC_CASING^}} switch suppresses the use of +The @w{@option{-D-}} switch suppresses the use of the default dictionary file. Instead, the casing for predefined and GNAT-defined names will be established by the -@option{^-n^/NAME_CASING^} switch or explicit dictionary files. For +@option{-n} switch or explicit dictionary files. For example, by default the names @code{Ada.Text_IO} and @code{GNAT.OS_Lib} will appear as just shown, even in the presence of -a @option{^-nU^/NAME_CASING=UPPER_CASE^} switch. To ensure that even +a @option{-nU} switch. To ensure that even such names are rendered in uppercase, additionally supply the -@w{@option{^-D-^/SPECIFIC_CASING^}} switch (or else place these names +@w{@option{-D-}} switch (or else place these names in upper case in a dictionary file). A dictionary file is a plain text file; each line in this file can be @@ -15162,12 +14421,7 @@ The casing schema string can be followed by white space and/or an Ada-style comment; any amount of white space is allowed before the string. If a dictionary file is passed as -@ifclear vms the value of a @option{-D@var{file}} switch -@end ifclear -@ifset vms -an option to the @option{/DICTIONARY} qualifier -@end ifset then for every simple name and every identifier, @command{gnatpp} checks if the dictionary defines the casing for the name or for some of its parts (the term ``subword'' @@ -15206,14 +14460,14 @@ For example, suppose we have the following source to reformat: @smallexample @c ada @cartouche -procedure test is +@b{procedure} test @b{is} name1 : integer := 1; name4_name3_name2 : integer := 2; name2_name3_name4 : Boolean; name1_var : Float; -begin +@b{begin} name2_name3_name4 := name4_name3_name2 > name1; -end; +@b{end}; @end cartouche @end smallexample @@ -15238,12 +14492,7 @@ And suppose we have two dictionaries: If @command{gnatpp} is called with the following switches: @smallexample -@ifclear vms @command{gnatpp -nM -D dict1 -D dict2 test.adb} -@end ifclear -@ifset vms -@command{gnatpp test.adb /NAME_CASING=MIXED_CASE /DICTIONARY=(dict1, dict2)} -@end ifset @end smallexample @noindent @@ -15251,20 +14500,19 @@ then we will get the following name casing in the @command{gnatpp} output: @smallexample @c ada @cartouche -procedure Test is +@b{procedure} Test @b{is} NAME1 : Integer := 1; Name4_NAME3_Name2 : Integer := 2; Name2_NAME3_Name4 : Boolean; Name1_Var : Float; -begin +@b{begin} Name2_NAME3_Name4 := Name4_NAME3_Name2 > NAME1; -end Test; +@b{end} Test; @end cartouche @end smallexample @end ifclear @ifclear FSFEDITION -@ifclear vms @c ********************************* @node The Ada-to-XML converter gnat2xml @chapter The Ada-to-XML converter @command{gnat2xml} @@ -15728,7 +14976,6 @@ indicate that they are automatically generated, something like this: @end smallexample @end ifclear -@end ifclear @ifclear FSFEDITION @c ********************************* @@ -15738,7 +14985,7 @@ indicate that they are automatically generated, something like this: @cindex Metric tool @noindent -^The @command{gnatmetric} tool^@command{GNAT METRIC}^ is an ASIS-based utility +The @command{gnatmetric} tool is an ASIS-based utility for computing various program metrics. It takes an Ada source file as input and generates a file containing the metrics data as output. Various switches control which @@ -15795,7 +15042,7 @@ Including both a @option{-files} switch and one or more @samp{@var{gcc_switches}} is a list of switches for @command{gcc}. They will be passed on to all compiler invocations made by @command{gnatmetric} to generate the ASIS trees. Here you can provide -@option{^-I^/INCLUDE_DIRS=^} switches to form the source search path, +@option{-I} switches to form the source search path, and use the @option{-gnatec} switch to set the configuration file, use the @option{-gnat05} switch if sources should be compiled in Ada 2005 mode etc. @@ -15833,7 +15080,7 @@ containing the computed metrics, except for the case when the set of metrics specified by gnatmetric parameters consists only of metrics that are computed for the whole set of analyzed sources, but not for each Ada source. By default, the name of the file containing metric information for a source -is obtained by appending the ^@file{.metrix}^@file{$METRIX}^ suffix to the +is obtained by appending the @file{.metrix} suffix to the name of the input source file. If not otherwise specified and no project file is specified as @command{gnatmetric} option this file is placed in the same directory as where the source file is located. If @command{gnatmetric} has a @@ -15844,7 +15091,7 @@ is specified, the files are placed in the subrirectory of this directory specified by this option. All the output information generated in XML format is placed in a single -file. By default the name of this file is ^@file{metrix.xml}^@file{METRIX$XML}^. +file. By default the name of this file is @file{metrix.xml}. If not otherwise specified and if no project file is specified as @command{gnatmetric} option this file is placed in the current directory. @@ -15857,44 +15104,44 @@ can be specified with the @option{-og} switch. The following switches control the @command{gnatmetric} output: @table @option -@cindex @option{^-x^/XML^} (@command{gnatmetric}) -@item ^-x^/XML^ +@cindex @option{-x} (@command{gnatmetric}) +@item -x Generate the XML output -@cindex @option{^-xs^/XSD^} (@command{gnatmetric}) -@item ^-xs^/XSD^ +@cindex @option{-xs} (@command{gnatmetric}) +@item -xs Generate the XML output and the XML schema file that describes the structure of the XML metric report, this schema is assigned to the XML file. The schema file has the same name as the XML output file with @file{.xml} suffix replaced with @file{.xsd} -@cindex @option{^-nt^/NO_TEXT^} (@command{gnatmetric}) -@item ^-nt^/NO_TEXT^ -Do not generate the output in text form (implies @option{^-x^/XML^}) +@cindex @option{-nt} (@command{gnatmetric}) +@item -nt +Do not generate the output in text form (implies @option{-x}) -@cindex @option{^-d^/DIRECTORY^} (@command{gnatmetric}) -@item ^-d @var{output_dir}^/DIRECTORY=@var{output_dir}^ +@cindex @option{-d} (@command{gnatmetric}) +@item -d @var{output_dir} Put text files with detailed metrics into @var{output_dir} -@cindex @option{^-o^/SUFFIX_DETAILS^} (@command{gnatmetric}) -@item ^-o @var{file_suffix}^/SUFFIX_DETAILS=@var{file_suffix}^ -Use @var{file_suffix}, instead of ^@file{.metrix}^@file{$METRIX}^ +@cindex @option{-o} (@command{gnatmetric}) +@item -o @var{file_suffix} +Use @var{file_suffix}, instead of @file{.metrix} in the name of the output file. -@cindex @option{^-og^/GLOBAL_OUTPUT^} (@command{gnatmetric}) -@item ^-og @var{file_name}^/GLOBAL_OUTPUT=@var{file_name}^ +@cindex @option{-og} (@command{gnatmetric}) +@item -og @var{file_name} Put global metrics into @var{file_name} -@cindex @option{^-ox^/XML_OUTPUT^} (@command{gnatmetric}) -@item ^-ox @var{file_name}^/XML_OUTPUT=@var{file_name}^ -Put the XML output into @var{file_name} (also implies @option{^-x^/XML^}) +@cindex @option{-ox} (@command{gnatmetric}) +@item -ox @var{file_name} +Put the XML output into @var{file_name} (also implies @option{-x}) -@cindex @option{^-sfn^/SHORT_SOURCE_FILE_NAME^} (@command{gnatmetric}) -@item ^-sfn^/SHORT_SOURCE_FILE_NAME^ +@cindex @option{-sfn} (@command{gnatmetric}) +@item -sfn Use ``short'' source file names in the output. (The @command{gnatmetric} output includes the name(s) of the Ada source file(s) from which the metrics are computed. By default each name includes the absolute path. The -@option{^-sfn^/SHORT_SOURCE_FILE_NAME^} switch causes @command{gnatmetric} +@option{-sfn} switch causes @command{gnatmetric} to exclude all directory information from the file names that are output.) @end table @@ -15942,8 +15189,8 @@ Suppression of metrics computation for eligible local units can be obtained via the following switch: @table @option -@cindex @option{^-nolocal^/SUPPRESS^} (@command{gnatmetric}) -@item ^-nolocal^/SUPPRESS=LOCAL_DETAILS^ +@cindex @option{-nolocal} (@command{gnatmetric}) +@item -nolocal Do not compute detailed metrics for eligible local program units @end table @@ -16014,62 +15261,60 @@ You can use the following switches to select the specific line metrics to be computed and reported. @table @option -@cindex @option{^--lines@var{x}^/LINE_COUNT_METRICS^} (@command{gnatmetric}) +@cindex @option{--lines@var{x}} (@command{gnatmetric}) -@ifclear vms @cindex @option{--no-lines@var{x}} -@end ifclear -@item ^--lines-all^/LINE_COUNT_METRICS=ALL^ +@item --lines-all Report all the line metrics -@item ^--no-lines-all^/LINE_COUNT_METRICS=NONE^ +@item --no-lines-all Do not report any of line metrics -@item ^--lines^/LINE_COUNT_METRICS=ALL_LINES^ +@item --lines Report the number of all lines -@item ^--no-lines^/LINE_COUNT_METRICS=NOALL_LINES^ +@item --no-lines Do not report the number of all lines -@item ^--lines-code^/LINE_COUNT_METRICS=CODE_LINES^ +@item --lines-code Report the number of code lines -@item ^--no-lines-code^/LINE_COUNT_METRICS=NOCODE_LINES^ +@item --no-lines-code Do not report the number of code lines -@item ^--lines-comment^/LINE_COUNT_METRICS=COMMENT_LINES^ +@item --lines-comment Report the number of comment lines -@item ^--no-lines-comment^/LINE_COUNT_METRICS=NOCOMMENT_LINES^ +@item --no-lines-comment Do not report the number of comment lines -@item ^--lines-eol-comment^/LINE_COUNT_METRICS=CODE_COMMENT_LINES^ +@item --lines-eol-comment Report the number of code lines containing end-of-line comments -@item ^--no-lines-eol-comment^/LINE_COUNT_METRICS=NOCODE_COMMENT_LINES^ +@item --no-lines-eol-comment Do not report the number of code lines containing end-of-line comments -@item ^--lines-ratio^/LINE_COUNT_METRICS=COMMENT_PERCENTAGE^ +@item --lines-ratio Report the comment percentage in the program text -@item ^--no-lines-ratio^/LINE_COUNT_METRICS=NOCOMMENT_PERCENTAGE^ +@item --no-lines-ratio Do not report the comment percentage in the program text -@item ^--lines-blank^/LINE_COUNT_METRICS=BLANK_LINES^ +@item --lines-blank Report the number of blank lines -@item ^--no-lines-blank^/LINE_COUNT_METRICS=NOBLANK_LINES^ +@item --no-lines-blank Do not report the number of blank lines -@item ^--lines-average^/LINE_COUNT_METRICS=AVERAGE_BODY_LINES^ +@item --lines-average Report the average number of code lines in subprogram bodies, task bodies, entry bodies and statement sequences in package bodies. The metric is computed and reported for the whole set of processed Ada sources only. -@item ^--no-lines-average^/LINE_COUNT_METRICS=NOAVERAGE_BODY_LINES^ +@item --no-lines-average Do not report the average number of code lines in subprogram bodies, task bodies, entry bodies and statement sequences in package bodies. @@ -16184,64 +15429,62 @@ following switches to select specific syntax metrics. @table @option -@cindex @option{^--syntax@var{x}^/SYNTAX_METRICS^} (@command{gnatmetric}) +@cindex @option{--syntax@var{x}} (@command{gnatmetric}) -@ifclear vms @cindex @option{--no-syntax@var{x}} (@command{gnatmetric}) -@end ifclear -@item ^--syntax-all^/SYNTAX_METRICS=ALL^ +@item --syntax-all Report all the syntax metrics -@item ^--no-syntax-all^/SYNTAX_METRICS=NONE^ +@item --no-syntax-all Do not report any of syntax metrics -@item ^--declarations^/SYNTAX_METRICS=DECLARATIONS^ +@item --declarations Report the total number of declarations -@item ^--no-declarations^/SYNTAX_METRICS=NODECLARATIONS^ +@item --no-declarations Do not report the total number of declarations -@item ^--statements^/SYNTAX_METRICS=STATEMENTS^ +@item --statements Report the total number of statements -@item ^--no-statements^/SYNTAX_METRICS=NOSTATEMENTS^ +@item --no-statements Do not report the total number of statements -@item ^--public-subprograms^/SYNTAX_METRICS=PUBLIC_SUBPROGRAMS^ +@item --public-subprograms Report the number of public subprograms in a compilation unit -@item ^--no-public-subprograms^/SYNTAX_METRICS=NOPUBLIC_SUBPROGRAMS^ +@item --no-public-subprograms Do not report the number of public subprograms in a compilation unit -@item ^--all-subprograms^/SYNTAX_METRICS=ALL_SUBPROGRAMS^ +@item --all-subprograms Report the number of all the subprograms in a compilation unit -@item ^--no-all-subprograms^/SYNTAX_METRICS=NOALL_SUBPROGRAMS^ +@item --no-all-subprograms Do not report the number of all the subprograms in a compilation unit -@item ^--public-types^/SYNTAX_METRICS=PUBLIC_TYPES^ +@item --public-types Report the number of public types in a compilation unit -@item ^--no-public-types^/SYNTAX_METRICS=NOPUBLIC_TYPES^ +@item --no-public-types Do not report the number of public types in a compilation unit -@item ^--all-types^/SYNTAX_METRICS=ALL_TYPES^ +@item --all-types Report the number of all the types in a compilation unit -@item ^--no-all-types^/SYNTAX_METRICS=NOALL_TYPES^ +@item --no-all-types Do not report the number of all the types in a compilation unit -@item ^--unit-nesting^/SYNTAX_METRICS=UNIT_NESTING^ +@item --unit-nesting Report the maximal program unit nesting level -@item ^--no-unit-nesting^/SYNTAX_METRICS=UNIT_NESTING_OFF^ +@item --no-unit-nesting Do not report the maximal program unit nesting level -@item ^--construct-nesting^/SYNTAX_METRICS=CONSTRUCT_NESTING^ +@item --construct-nesting Report the maximal construct nesting level -@item ^--no-construct-nesting^/SYNTAX_METRICS=NOCONSTRUCT_NESTING^ +@item --no-construct-nesting Do not report the maximal construct nesting level @end table @@ -16307,7 +15550,7 @@ of tests needed to satisfy paths coverage testing completeness criterion. Considered from the testing point of view, a static Ada @code{loop} (that is, the @code{loop} statement having static subtype in loop parameter specification) does not add to cyclomatic complexity. By providing -@option{^--no-static-loop^NO_STATIC_LOOP^} option a user +@option{--no-static-loop} option a user may specify that such loops should not be counted when computing the cyclomatic complexity metric @@ -16319,7 +15562,7 @@ or if it contains a @code{goto} statement that transfers the control outside the operator. A selective accept statement with @code{terminate} alternative is considered as non-structural statement. When computing this metric, @code{exit} statements are treated in the same way as @code{goto} -statements unless @option{^-ne^NO_EXITS_AS_GOTOS^} option is specified. +statements unless @option{-ne} option is specified. The Ada essential complexity metric defined here is intended to quantify the extent to which the software is unstructured. It is adapted from @@ -16338,63 +15581,61 @@ For more fine-grained control you can use the following switches: @table @option -@cindex @option{^-complexity@var{x}^/COMPLEXITY_METRICS^} (@command{gnatmetric}) +@cindex @option{-complexity@var{x}} (@command{gnatmetric}) -@ifclear vms @cindex @option{--no-complexity@var{x}} -@end ifclear -@item ^--complexity-all^/COMPLEXITY_METRICS=ALL^ +@item --complexity-all Report all the complexity metrics -@item ^--no-complexity-all^/COMPLEXITY_METRICS=NONE^ +@item --no-complexity-all Do not report any of complexity metrics -@item ^--complexity-cyclomatic^/COMPLEXITY_METRICS=CYCLOMATIC^ +@item --complexity-cyclomatic Report the McCabe Cyclomatic Complexity -@item ^--no-complexity-cyclomatic^/COMPLEXITY_METRICS=NOCYCLOMATIC^ +@item --no-complexity-cyclomatic Do not report the McCabe Cyclomatic Complexity -@item ^--complexity-essential^/COMPLEXITY_METRICS=ESSENTIAL^ +@item --complexity-essential Report the Essential Complexity -@item ^--no-complexity-essential^/COMPLEXITY_METRICS=NOESSENTIAL^ +@item --no-complexity-essential Do not report the Essential Complexity -@item ^--loop-nesting^/COMPLEXITY_METRICS=LOOP_NESTING_ON^ +@item --loop-nesting Report maximal loop nesting level -@item ^--no-loop-nesting^/COMPLEXITY_METRICS=NOLOOP_NESTING^ +@item --no-loop-nesting Do not report maximal loop nesting level -@item ^--complexity-average^/COMPLEXITY_METRICS=AVERAGE_COMPLEXITY^ +@item --complexity-average Report the average McCabe Cyclomatic Complexity for all the subprogram bodies, task bodies, entry bodies and statement sequences in package bodies. The metric is computed and reported for whole set of processed Ada sources only. -@item ^--no-complexity-average^/COMPLEXITY_METRICS=NOAVERAGE_COMPLEXITY^ +@item --no-complexity-average Do not report the average McCabe Cyclomatic Complexity for all the subprogram bodies, task bodies, entry bodies and statement sequences in package bodies -@cindex @option{^-ne^/NO_EXITS_AS_GOTOS^} (@command{gnatmetric}) -@item ^-ne^/NO_EXITS_AS_GOTOS^ +@cindex @option{-ne} (@command{gnatmetric}) +@item -ne Do not consider @code{exit} statements as @code{goto}s when computing Essential Complexity -@cindex @option{^--no-static-loop^/NO_STATIC_LOOP^} (@command{gnatmetric}) -@item ^--no-static-loop^/NO_STATIC_LOOP^ +@cindex @option{--no-static-loop} (@command{gnatmetric}) +@item --no-static-loop Do not consider static loops when computing cyclomatic complexity -@item ^--extra-exit-points^/EXTRA_EXIT_POINTS^ +@item --extra-exit-points Report the extra exit points for subprogram bodies. As an exit point, this metric counts @code{return} statements and raise statements in case when the raised exception is not handled in the same body. In case of a function this metric subtracts 1 from the number of exit points, because a function body must contain at least one @code{return} statement. -@item ^--no-extra-exit-points^/NOEXTRA_EXIT_POINTS^ +@item --no-extra-exit-points Do not report the extra exit points for subprogram bodies @end table @@ -16505,42 +15746,42 @@ and control coupling metrics: @smallexample @c ada @group -package Lib_1 is - function F_1 (I : Integer) return Integer; -end Lib_1; +@b{package} Lib_1 @b{is} + @b{function} F_1 (I : Integer) @b{return} Integer; +@b{end} Lib_1; @end group @group -package Lib_2 is - type T_2 is new Integer; -end Lib_2; +@b{package} Lib_2 @b{is} + @b{type} T_2 @b{is} @b{new} Integer; +@b{end} Lib_2; @end group @group -package body Lib_1 is - function F_1 (I : Integer) return Integer is - begin - return I + 1; - end F_1; -end Lib_1; +@b{package} @b{body} Lib_1 @b{is} + @b{function} F_1 (I : Integer) @b{return} Integer @b{is} + @b{begin} + @b{return} I + 1; + @b{end} F_1; +@b{end} Lib_1; @end group @group -with Lib_2; use Lib_2; -package Pack is +@b{with} Lib_2; @b{use} Lib_2; +@b{package} Pack @b{is} Var : T_2; - function Fun (I : Integer) return Integer; -end Pack; + @b{function} Fun (I : Integer) @b{return} Integer; +@b{end} Pack; @end group @group -with Lib_1; use Lib_1; -package body Pack is - function Fun (I : Integer) return Integer is - begin - return F_1 (I); - end Fun; -end Pack; +@b{with} Lib_1; @b{use} Lib_1; +@b{package} @b{body} Pack @b{is} + @b{function} Fun (I : Integer) @b{return} Integer @b{is} + @b{begin} + @b{return} F_1 (I); + @b{end} Fun; +@b{end} Pack; @end group @end smallexample @@ -16607,42 +15848,37 @@ switches to specify the coupling metrics to be computed and reported: @table @option -@ifclear vms @cindex @option{--tagged-coupling@var{x}} (@command{gnatmetric}) @cindex @option{--hierarchy-coupling@var{x}} (@command{gnatmetric}) @cindex @option{--unit-coupling@var{x}} (@command{gnatmetric}) @cindex @option{--control-coupling@var{x}} (@command{gnatmetric}) -@end ifclear -@ifset vms -@cindex @option{/COUPLING_METRICS} (@command{gnatmetric}) -@end ifset -@item ^--coupling-all^/COUPLING_METRICS=ALL^ +@item --coupling-all Report all the coupling metrics -@item ^--tagged-coupling-out^/COUPLING_METRICS=TAGGED_OUT^ +@item --tagged-coupling-out Report tagged (class) fan-out coupling -@item ^--tagged-coupling-in^/COUPLING_METRICS=TAGGED_IN^ +@item --tagged-coupling-in Report tagged (class) fan-in coupling -@item ^--hierarchy-coupling-out^/COUPLING_METRICS=HIERARCHY_OUT^ +@item --hierarchy-coupling-out Report hierarchy (category) fan-out coupling -@item ^--hierarchy-coupling-in^/COUPLING_METRICS=HIERARCHY_IN^ +@item --hierarchy-coupling-in Report hierarchy (category) fan-in coupling -@item ^--unit-coupling-out^/COUPLING_METRICS=UNIT_OUT^ +@item --unit-coupling-out Report unit fan-out coupling -@item ^--unit-coupling-in^/COUPLING_METRICS=UNIT_IN^ +@item --unit-coupling-in Report unit fan-in coupling -@item ^--control-coupling-out^/COUPLING_METRICS=CONTROL_OUT^ +@item --control-coupling-out Report control fan-out coupling -@item ^--control-coupling-in^/COUPLING_METRICS=CONTROL_IN^ +@item --control-coupling-in Report control fan-in coupling @end table @@ -16700,33 +15936,33 @@ project objects directory. This corresponds to the @command{gnatcheck} behavior when it is called with the project file from the GNAT driver. Has no effect if no project is specified. -@item ^-files @var{filename}^/FILES=@var{filename}^ -@cindex @option{^-files^/FILES^} (@code{gnatmetric}) +@item -files @var{filename} +@cindex @option{-files} (@code{gnatmetric}) Take the argument source files from the specified file. This file should be an ordinary text file containing file names separated by spaces or line breaks. You can use this switch more than once in the same call to @command{gnatmetric}. You also can combine this switch with an explicit list of files. -@item ^-j^/PROCESSES=^@var{n} -@cindex @option{^-j^/PROCESSES^} (@command{gnatmetric}) +@item -j@var{n} +@cindex @option{-j} (@command{gnatmetric}) Use @var{n} processes to carry out the tree creations (internal representations of the argument sources). On a multiprocessor machine this speeds up processing of big sets of argument sources. If @var{n} is 0, then the maximum number of parallel tree creations is the number of core processors on the platform. -@cindex @option{^-t^/TIME^} (@command{gnatmetric}) -@item ^-t^/TIME^ +@cindex @option{-t} (@command{gnatmetric}) +@item -t Print out execution time. -@item ^-v^/VERBOSE^ -@cindex @option{^-v^/VERBOSE^} (@command{gnatmetric}) +@item -v +@cindex @option{-v} (@command{gnatmetric}) Verbose mode; @command{gnatmetric} generates version information and then a trace of sources being processed. -@item ^-q^/QUIET^ -@cindex @option{^-q^/QUIET^} (@command{gnatmetric}) +@item -q +@cindex @option{-q} (@command{gnatmetric}) Quiet mode. @end table @@ -16797,18 +16033,18 @@ Take the unit name and replace all dots by hyphens. @item If such a replacement occurs in the second character position of a name, and the first character is -^@samp{a}, @samp{g}, @samp{s}, or @samp{i}, ^@samp{A}, @samp{G}, @samp{S}, or @samp{I},^ +@samp{a}, @samp{g}, @samp{s}, or @samp{i}, then replace the dot by the character -^@samp{~} (tilde)^@samp{$} (dollar sign)^ +@samp{~} (tilde) instead of a minus. @end itemize The reason for this exception is to avoid clashes with the standard names for children of System, Ada, Interfaces, and GNAT, which use the prefixes -^@samp{s-}, @samp{a-}, @samp{i-}, and @samp{g-},^@samp{S-}, @samp{A-}, @samp{I-}, and @samp{G-},^ +@samp{s-}, @samp{a-}, @samp{i-}, and @samp{g-}, respectively. -The @option{^-gnatk^/FILE_NAME_MAX_LENGTH=^@var{nn}} +The @option{-gnatk@var{nn}} switch of the compiler activates a ``krunching'' circuit that limits file names to nn characters (where nn is a decimal integer). For example, using OpenVMS, @@ -16827,19 +16063,12 @@ a given file, when krunched to a specified maximum length. @noindent The @code{gnatkr} command has the form -@ifclear vms @smallexample @c $ gnatkr @var{name} @ovar{length} @c Expanding @ovar macro inline (explanation in macro def comments) $ gnatkr @var{name} @r{[}@var{length}@r{]} @end smallexample -@end ifclear -@ifset vms -@smallexample -$ gnatkr @var{name} /COUNT=nn -@end smallexample -@end ifset @noindent @var{name} is the uncrunched file name, derived from the name of the unit @@ -16861,7 +16090,7 @@ Note that the result is always all lower case (except on OpenVMS where it is all upper case). Characters of the other case are folded as required. @var{length} represents the length of the krunched name. The default -when no argument is given is ^8^39^ characters. A length of zero stands for +when no argument is given is 8 characters. A length of zero stands for unlimited, in other words do not chop except for system files where the implied crunching length is always eight characters. @@ -16876,10 +16105,10 @@ original argument was a file name with an extension. The initial file name is determined by the name of the unit that the file contains. The name is formed by taking the full expanded name of the unit and replacing the separating dots with hyphens and -using ^lowercase^uppercase^ +using lowercase for all letters, except that a hyphen in the second character position is -replaced by a ^tilde^dollar sign^ if the first character is -^@samp{a}, @samp{i}, @samp{g}, or @samp{s}^@samp{A}, @samp{I}, @samp{G}, or @samp{S}^. +replaced by a tilde if the first character is +@samp{a}, @samp{i}, @samp{g}, or @samp{s}. The extension is @code{.ads} for a spec and @code{.adb} for a body. Krunching does not affect the extension, but the file name is shortened to @@ -16923,21 +16152,21 @@ special prefix replacements: @table @file @item ada- -replaced by @file{^a^A^-} +replaced by @file{a-} @item gnat- -replaced by @file{^g^G^-} +replaced by @file{g-} @item interfaces- -replaced by @file{^i^I^-} +replaced by @file{i-} @item system- -replaced by @file{^s^S^-} +replaced by @file{s-} @end table These system files have a hyphen in the second character position. That is why normal user files replace such a character with a -^tilde^dollar sign^, to +tilde, to avoid confusion with system file names. As an example of this special rule, consider @@ -16973,12 +16202,10 @@ krunched name of a file. @iftex @leftskip=0cm @end iftex -@ifclear vms $ gnatkr very_long_unit_name.ads --> velounna.ads $ gnatkr grandparent-parent-child.ads --> grparchi.ads $ gnatkr Grandparent.Parent.Child.ads --> grparchi.ads $ gnatkr grandparent-parent-child --> grparchi -@end ifclear $ gnatkr very_long_unit_name.ads/count=6 --> vlunna.ads $ gnatkr very_long_unit_name.ads/count=0 --> very_long_unit_name.ads @end smallexample @@ -17052,21 +16279,21 @@ optional, and can be replaced by the use of the @option{-D} switch. @table @option @c !sort! -@item ^-b^/BLANK_LINES^ -@cindex @option{^-b^/BLANK_LINES^} (@command{gnatprep}) +@item -b +@cindex @option{-b} (@command{gnatprep}) Causes both preprocessor lines and the lines deleted by preprocessing to be replaced by blank lines in the output source file, preserving line numbers in the output file. -@item ^-c^/COMMENTS^ -@cindex @option{^-c^/COMMENTS^} (@command{gnatprep}) +@item -c +@cindex @option{-c} (@command{gnatprep}) Causes both preprocessor lines and the lines deleted by preprocessing to be retained in the output source as comments marked with the special string @code{"--! "}. This option will result in line numbers being preserved in the output file. -@item ^-C^/REPLACE_IN_COMMENTS^ -@cindex @option{^-C^/REPLACE_IN_COMMENTS^} (@command{gnatprep}) +@item -C +@cindex @option{-C} (@command{gnatprep}) Causes comments to be scanned. Normally comments are ignored by gnatprep. If this option is specified, then comments are scanned and any $symbol substitutions performed as in program text. This is particularly useful @@ -17075,57 +16302,49 @@ SPARK dialect of Ada). Note that this switch is not available when doing integrated preprocessing (it would be useless in this context since comments are ignored by the compiler in any case). -@item ^-Dsymbol=value^/ASSOCIATE="symbol=value"^ -@cindex @option{^-D^/ASSOCIATE^} (@command{gnatprep}) +@item -Dsymbol=value +@cindex @option{-D} (@command{gnatprep}) Defines a new preprocessing symbol, associated with value. If no value is given on the command line, then symbol is considered to be @code{True}. This switch can be used in place of a definition file. -@ifset vms -@item /REMOVE -@cindex @option{/REMOVE} (@command{gnatprep}) -This is the default setting which causes lines deleted by preprocessing -to be entirely removed from the output file. -@end ifset -@item ^-r^/REFERENCE^ -@cindex @option{^-r^/REFERENCE^} (@command{gnatprep}) +@item -r +@cindex @option{-r} (@command{gnatprep}) Causes a @code{Source_Reference} pragma to be generated that references the original input file, so that error messages will use the file name of this original file. The use of this switch implies that preprocessor lines are not to be removed from the file, so its -use will force @option{^-b^/BLANK_LINES^} mode if -@option{^-c^/COMMENTS^} +use will force @option{-b} mode if +@option{-c} has not been specified explicitly. Note that if the file to be preprocessed contains multiple units, then it will be necessary to @code{gnatchop} the output file from @code{gnatprep}. If a @code{Source_Reference} pragma is present in the preprocessed file, it will be respected by -@code{gnatchop ^-r^/REFERENCE^} +@code{gnatchop -r} so that the final chopped files will correctly refer to the original input source file for @code{gnatprep}. -@item ^-s^/SYMBOLS^ -@cindex @option{^-s^/SYMBOLS^} (@command{gnatprep}) +@item -s +@cindex @option{-s} (@command{gnatprep}) Causes a sorted list of symbol names and values to be listed on the standard output file. -@item ^-u^/UNDEFINED^ -@cindex @option{^-u^/UNDEFINED^} (@command{gnatprep}) +@item -u +@cindex @option{-u} (@command{gnatprep}) Causes undefined symbols to be treated as having the value FALSE in the context of a preprocessor test. In the absence of this option, an undefined symbol in a @code{#if} or @code{#elsif} test will be treated as an error. @end table -@ifclear vms @noindent Note: if neither @option{-b} nor @option{-c} is present, then preprocessor lines and deleted lines are completely removed from the output, unless -r is specified, in which case -b is assumed. -@end ifclear @node Form of Definitions File @section Form of Definitions File @@ -17339,14 +16558,14 @@ Here is a simple example of use: @smallexample $ gnatls *.o -^./^[]^demo1.o demo1 DIF demo1.adb -^./^[]^demo2.o demo2 OK demo2.adb -^./^[]^hello.o h1 OK hello.adb -^./^[]^instr-child.o instr.child MOK instr-child.adb -^./^[]^instr.o instr OK instr.adb -^./^[]^tef.o tef DIF tef.adb -^./^[]^text_io_example.o text_io_example OK text_io_example.adb -^./^[]^tgef.o tgef DIF tgef.adb +./demo1.o demo1 DIF demo1.adb +./demo2.o demo2 OK demo2.adb +./hello.o h1 OK hello.adb +./instr-child.o instr.child MOK instr-child.adb +./instr.o instr OK instr.adb +./tef.o tef DIF tef.adb +./text_io_example.o text_io_example OK text_io_example.adb +./tgef.o tgef DIF tgef.adb @end smallexample @noindent @@ -17366,7 +16585,7 @@ specified unit corresponds exactly to the actual source file. The version of the source file used for the compilation of the specified unit differs from the actual source file but not enough to require recompilation. If you use gnatmake with the qualifier -@option{^-m (minimal recompilation)^/MINIMAL_RECOMPILATION^}, a file marked +@option{-m (minimal recompilation)}, a file marked MOK will not be recompiled. @item DIF (modified) @@ -17399,52 +16618,52 @@ Display Copyright and version, then exit disregarding all other options. If @option{--version} was not used, display usage, then exit disregarding all other options. -@item ^-a^/ALL_UNITS^ -@cindex @option{^-a^/ALL_UNITS^} (@code{gnatls}) +@item -a +@cindex @option{-a} (@code{gnatls}) Consider all units, including those of the predefined Ada library. -Especially useful with @option{^-d^/DEPENDENCIES^}. +Especially useful with @option{-d}. -@item ^-d^/DEPENDENCIES^ -@cindex @option{^-d^/DEPENDENCIES^} (@code{gnatls}) +@item -d +@cindex @option{-d} (@code{gnatls}) List sources from which specified units depend on. -@item ^-h^/OUTPUT=OPTIONS^ -@cindex @option{^-h^/OUTPUT=OPTIONS^} (@code{gnatls}) +@item -h +@cindex @option{-h} (@code{gnatls}) Output the list of options. -@item ^-o^/OUTPUT=OBJECTS^ -@cindex @option{^-o^/OUTPUT=OBJECTS^} (@code{gnatls}) +@item -o +@cindex @option{-o} (@code{gnatls}) Only output information about object files. -@item ^-s^/OUTPUT=SOURCES^ -@cindex @option{^-s^/OUTPUT=SOURCES^} (@code{gnatls}) +@item -s +@cindex @option{-s} (@code{gnatls}) Only output information about source files. -@item ^-u^/OUTPUT=UNITS^ -@cindex @option{^-u^/OUTPUT=UNITS^} (@code{gnatls}) +@item -u +@cindex @option{-u} (@code{gnatls}) Only output information about compilation units. -@item ^-files^/FILES^=@var{file} -@cindex @option{^-files^/FILES^} (@code{gnatls}) +@item -files=@var{file} +@cindex @option{-files} (@code{gnatls}) Take as arguments the files listed in text file @var{file}. Text file @var{file} may contain empty lines that are ignored. Each nonempty line should contain the name of an existing file. Several such switches may be specified simultaneously. -@item ^-aO^/OBJECT_SEARCH=^@var{dir} -@itemx ^-aI^/SOURCE_SEARCH=^@var{dir} -@itemx ^-I^/SEARCH=^@var{dir} -@itemx ^-I-^/NOCURRENT_DIRECTORY^ +@item -aO@var{dir} +@itemx -aI@var{dir} +@itemx -I@var{dir} +@itemx -I- @itemx -nostdinc -@cindex @option{^-aO^/OBJECT_SEARCH^} (@code{gnatls}) -@cindex @option{^-aI^/SOURCE_SEARCH^} (@code{gnatls}) -@cindex @option{^-I^/SEARCH^} (@code{gnatls}) -@cindex @option{^-I-^/NOCURRENT_DIRECTORY^} (@code{gnatls}) +@cindex @option{-aO} (@code{gnatls}) +@cindex @option{-aI} (@code{gnatls}) +@cindex @option{-I} (@code{gnatls}) +@cindex @option{-I-} (@code{gnatls}) Source path manipulation. Same meaning as the equivalent @command{gnatmake} flags (@pxref{Switches for gnatmake}). -@item ^-aP^/ADD_PROJECT_SEARCH_DIR=^@var{dir} -@cindex @option{^-aP^/ADD_PROJECT_SEARCH_DIR=^} (@code{gnatls}) +@item -aP@var{dir} +@cindex @option{-aP} (@code{gnatls}) Add @var{dir} at the beginning of the project search dir. @item --RTS=@var{rts-path} @@ -17452,8 +16671,8 @@ Add @var{dir} at the beginning of the project search dir. Specifies the default location of the runtime library. Same meaning as the equivalent @command{gnatmake} flag (@pxref{Switches for gnatmake}). -@item ^-v^/OUTPUT=VERBOSE^ -@cindex @option{^-v^/OUTPUT=VERBOSE^} (@code{gnatls}) +@item -v +@cindex @option{-v} (@code{gnatls}) Verbose mode. Output the complete source, object and project paths. Do not use the default column layout but instead use long format giving as much as information possible on each requested units, including special @@ -17491,7 +16710,6 @@ The unit contains a pragma Remote_Call_Interface. @node Examples of gnatls Usage @section Example of @code{gnatls} Usage -@ifclear vms @noindent Example of using the verbose switch. Note how the source and @@ -17563,36 +16781,7 @@ instr.ads /home/comar/local/adainclude/s-unstyp.ads /home/comar/local/adainclude/unchconv.ads @end smallexample -@end ifclear -@ifset vms -@smallexample -GNAT LIST /DEPENDENCIES /OUTPUT=SOURCES /ALL_UNITS DEMO1.ADB - -GNU:[LIB.OPENVMS7_1.2_8_1.ADALIB]ada.ads -GNU:[LIB.OPENVMS7_1.2_8_1.ADALIB]a-finali.ads -GNU:[LIB.OPENVMS7_1.2_8_1.ADALIB]a-filico.ads -GNU:[LIB.OPENVMS7_1.2_8_1.ADALIB]a-stream.ads -GNU:[LIB.OPENVMS7_1.2_8_1.ADALIB]a-tags.ads -demo1.adb -gen_list.ads -gen_list.adb -GNU:[LIB.OPENVMS7_1.2_8_1.ADALIB]gnat.ads -GNU:[LIB.OPENVMS7_1.2_8_1.ADALIB]g-io.ads -instr.ads -GNU:[LIB.OPENVMS7_1.2_8_1.ADALIB]system.ads -GNU:[LIB.OPENVMS7_1.2_8_1.ADALIB]s-exctab.ads -GNU:[LIB.OPENVMS7_1.2_8_1.ADALIB]s-finimp.ads -GNU:[LIB.OPENVMS7_1.2_8_1.ADALIB]s-finroo.ads -GNU:[LIB.OPENVMS7_1.2_8_1.ADALIB]s-secsta.ads -GNU:[LIB.OPENVMS7_1.2_8_1.ADALIB]s-stalib.ads -GNU:[LIB.OPENVMS7_1.2_8_1.ADALIB]s-stoele.ads -GNU:[LIB.OPENVMS7_1.2_8_1.ADALIB]s-stratt.ads -GNU:[LIB.OPENVMS7_1.2_8_1.ADALIB]s-tasoli.ads -GNU:[LIB.OPENVMS7_1.2_8_1.ADALIB]s-unstyp.ads -GNU:[LIB.OPENVMS7_1.2_8_1.ADALIB]unchconv.ads -@end smallexample -@end ifset @node Cleaning Up with gnatclean @chapter Cleaning Up with @code{gnatclean} @@ -17622,15 +16811,15 @@ $ gnatclean switches @var{names} @end smallexample @noindent -@var{names} is a list of source file names. Suffixes @code{.^ads^ADS^} and -@code{^adb^ADB^} may be omitted. If a project file is specified using switch -@code{^-P^/PROJECT_FILE=^}, then @var{names} may be completely omitted. +@var{names} is a list of source file names. Suffixes @code{.ads} and +@code{adb} may be omitted. If a project file is specified using switch +@code{-P}, then @var{names} may be completely omitted. @noindent In normal mode, @code{gnatclean} delete the files produced by the compiler and, -if switch @code{^-c^/COMPILER_FILES_ONLY^} is not specified, by the binder and +if switch @code{-c} is not specified, by the binder and the linker. In informative-only mode, specified by switch -@code{^-n^/NODELETE^}, the list of files that would have been deleted in +@code{-n}, the list of files that would have been deleted in normal mode is listed, but no file is actually deleted. @node Switches for gnatclean @@ -17649,90 +16838,90 @@ Display Copyright and version, then exit disregarding all other options. If @option{--version} was not used, display usage, then exit disregarding all other options. -@item ^--subdirs^/SUBDIRS^=subdir +@item --subdirs=subdir Actual object directory of each project file is the subdirectory subdir of the object directory specified or defaulted in the project file. -@item ^--unchecked-shared-lib-imports^/UNCHECKED_SHARED_LIB_IMPORTS^ +@item --unchecked-shared-lib-imports By default, shared library projects are not allowed to import static library projects. When this switch is used on the command line, this restriction is relaxed. -@item ^-c^/COMPILER_FILES_ONLY^ -@cindex @option{^-c^/COMPILER_FILES_ONLY^} (@code{gnatclean}) +@item -c +@cindex @option{-c} (@code{gnatclean}) Only attempt to delete the files produced by the compiler, not those produced by the binder or the linker. The files that are not to be deleted are library files, interface copy files, binder generated files and executable files. -@item ^-D ^/DIRECTORY_OBJECTS=^@var{dir} -@cindex @option{^-D^/DIRECTORY_OBJECTS^} (@code{gnatclean}) +@item -D @var{dir} +@cindex @option{-D} (@code{gnatclean}) Indicate that ALI and object files should normally be found in directory @var{dir}. -@item ^-F^/FULL_PATH_IN_BRIEF_MESSAGES^ -@cindex @option{^-F^/FULL_PATH_IN_BRIEF_MESSAGES^} (@code{gnatclean}) +@item -F +@cindex @option{-F} (@code{gnatclean}) When using project files, if some errors or warnings are detected during parsing and verbose mode is not in effect (no use of switch -^-v^/VERBOSE^), then error lines start with the full path name of the project +-v), then error lines start with the full path name of the project file, rather than its simple file name. -@item ^-h^/HELP^ -@cindex @option{^-h^/HELP^} (@code{gnatclean}) -Output a message explaining the usage of @code{^gnatclean^gnatclean^}. +@item -h +@cindex @option{-h} (@code{gnatclean}) +Output a message explaining the usage of @code{gnatclean}. -@item ^-n^/NODELETE^ -@cindex @option{^-n^/NODELETE^} (@code{gnatclean}) +@item -n +@cindex @option{-n} (@code{gnatclean}) Informative-only mode. Do not delete any files. Output the list of the files that would have been deleted if this switch was not specified. -@item ^-P^/PROJECT_FILE=^@var{project} -@cindex @option{^-P^/PROJECT_FILE^} (@code{gnatclean}) +@item -P@var{project} +@cindex @option{-P} (@code{gnatclean}) Use project file @var{project}. Only one such switch can be used. When cleaning a project file, the files produced by the compilation of the immediate sources or inherited sources of the project files are to be deleted. This is not depending on the presence or not of executable names on the command line. -@item ^-q^/QUIET^ -@cindex @option{^-q^/QUIET^} (@code{gnatclean}) +@item -q +@cindex @option{-q} (@code{gnatclean}) Quiet output. If there are no errors, do not output anything, except in -verbose mode (switch ^-v^/VERBOSE^) or in informative-only mode -(switch ^-n^/NODELETE^). +verbose mode (switch -v) or in informative-only mode +(switch -n). -@item ^-r^/RECURSIVE^ -@cindex @option{^-r^/RECURSIVE^} (@code{gnatclean}) -When a project file is specified (using switch ^-P^/PROJECT_FILE=^), +@item -r +@cindex @option{-r} (@code{gnatclean}) +When a project file is specified (using switch -P), clean all imported and extended project files, recursively. If this switch is not specified, only the files related to the main project file are to be deleted. This switch has no effect if no project file is specified. -@item ^-v^/VERBOSE^ -@cindex @option{^-v^/VERBOSE^} (@code{gnatclean}) +@item -v +@cindex @option{-v} (@code{gnatclean}) Verbose mode. -@item ^-vP^/MESSAGES_PROJECT_FILE=^@emph{x} -@cindex @option{^-vP^/MESSAGES_PROJECT_FILE^} (@code{gnatclean}) +@item -vP@emph{x} +@cindex @option{-vP} (@code{gnatclean}) Indicates the verbosity of the parsing of GNAT project files. @xref{Switches Related to Project Files}. -@item ^-X^/EXTERNAL_REFERENCE=^@var{name=value} -@cindex @option{^-X^/EXTERNAL_REFERENCE^} (@code{gnatclean}) +@item -X@var{name=value} +@cindex @option{-X} (@code{gnatclean}) Indicates that external variable @var{name} has the value @var{value}. The Project Manager will use this value for occurrences of @code{external(name)} when parsing the project file. @xref{Switches Related to Project Files}. -@item ^-aO^/OBJECT_SEARCH=^@var{dir} -@cindex @option{^-aO^/OBJECT_SEARCH^} (@code{gnatclean}) +@item -aO@var{dir} +@cindex @option{-aO} (@code{gnatclean}) When searching for ALI and object files, look in directory @var{dir}. -@item ^-I^/SEARCH=^@var{dir} -@cindex @option{^-I^/SEARCH^} (@code{gnatclean}) -Equivalent to @option{^-aO^/OBJECT_SEARCH=^@var{dir}}. +@item -I@var{dir} +@cindex @option{-I} (@code{gnatclean}) +Equivalent to @option{-aO@var{dir}}. -@item ^-I-^/NOCURRENT_DIRECTORY^ -@cindex @option{^-I-^/NOCURRENT_DIRECTORY^} (@code{gnatclean}) +@item -I- +@cindex @option{-I-} (@code{gnatclean}) @cindex Source files, suppressing search Do not look for ALI or object files in the directory where @code{gnatclean} was invoked. @@ -17742,7 +16931,6 @@ where @code{gnatclean} was invoked. @c @node Examples of gnatclean Usage @c @section Examples of @code{gnatclean} Usage -@ifclear vms @node GNAT and Libraries @chapter GNAT and Libraries @cindex Library, building, installing, using @@ -17852,13 +17040,13 @@ to the specified location). Here is a simple library project file: @smallexample @c ada -project My_Lib is - for Source_Dirs use ("src1", "src2"); - for Object_Dir use "obj"; - for Library_Name use "mylib"; - for Library_Dir use "lib"; - for Library_Kind use "dynamic"; -end My_lib; +project My_Lib @b{is} + @b{for} Source_Dirs @b{use} ("src1", "src2"); + @b{for} Object_Dir @b{use} "obj"; + @b{for} Library_Name @b{use} "mylib"; + @b{for} Library_Dir @b{use} "lib"; + @b{for} Library_Kind @b{use} "dynamic"; +@b{end} My_lib; @end smallexample @noindent @@ -17887,13 +17075,13 @@ of the underlying operating system to produce the static or shared library. Here is an example of such a dummy program: @smallexample @c ada @group -with My_Lib.Service1; -with My_Lib.Service2; -with My_Lib.Service3; -procedure My_Lib_Dummy is -begin - null; -end; +@b{with} My_Lib.Service1; +@b{with} My_Lib.Service2; +@b{with} My_Lib.Service3; +@b{procedure} My_Lib_Dummy @b{is} +@b{begin} + @b{null}; +@b{end}; @end group @end smallexample @@ -17991,10 +17179,10 @@ library @code{My_Lib} shown in examples in earlier sections, you can write: @smallexample @c projectfile -with "my_lib"; -project My_Proj is +@b{with} "my_lib"; +@b{project} My_Proj @b{is} @dots{} -end My_Proj; +@b{end} My_Proj; @end smallexample Even if you have a third-party, non-Ada library, you can still use GNAT's @@ -18004,13 +17192,13 @@ third-party library @file{liba.a}: @smallexample @c projectfile @group -project Liba is - for Externally_Built use "true"; - for Source_Files use (); - for Library_Dir use "lib"; - for Library_Name use "a"; - for Library_Kind use "static"; -end Liba; +@b{project} Liba @b{is} + @b{for} Externally_Built @b{use} "true"; + @b{for} Source_Files @b{use} (); + @b{for} Library_Dir @b{use} "lib"; + @b{for} Library_Name @b{use} "a"; + @b{for} Library_Kind @b{use} "static"; +@b{end} Liba; @end group @end smallexample This is an alternative to the use of @code{pragma Linker_Options}. It is @@ -18055,7 +17243,7 @@ a pragma @code{Linker_Options} has been added to one of the sources. For example: @smallexample @c ada -pragma Linker_Options ("-lmy_lib"); +@b{pragma} Linker_Options ("-lmy_lib"); @end smallexample @end itemize @@ -18122,9 +17310,9 @@ that make a project a Library Project (@code{Library_Name} and @smallexample @c projectfile @group - for Library_Dir use "lib_dir"; - for Library_Name use "dummy"; - for Library_Interface use ("int1", "int1.child"); + @b{for} Library_Dir @b{use} "lib_dir"; + @b{for} Library_Name @b{use} "dummy"; + @b{for} Library_Interface @b{use} ("int1", "int1.child"); @end group @end smallexample @@ -18135,7 +17323,7 @@ of the project file. When a Stand-alone Library is built, first the binder is invoked to build a package whose name depends on the library name -(@file{^b~dummy.ads/b^B$DUMMY.ADS/B^} in the example above). +(@file{b~dummy.ads/b} in the example above). This binder-generated package includes initialization and finalization procedures whose names depend on the library name (@code{dummyinit} and @code{dummyfinal} @@ -18165,11 +17353,11 @@ build an encapsulated library the attribute @smallexample @c projectfile @group - for Library_Dir use "lib_dir"; - for Library_Name use "dummy"; - for Library_Kind use "dynamic"; - for Library_Interface use ("int1", "int1.child"); - for Library_Standalone use "encapsulated"; + @b{for} Library_Dir @b{use} "lib_dir"; + @b{for} Library_Name @b{use} "dummy"; + @b{for} Library_Kind @b{use} "dynamic"; + @b{for} Library_Interface @b{use} ("int1", "int1.child"); + @b{for} Library_Standalone @b{use} "encapsulated"; @end group @end smallexample @@ -18245,15 +17433,15 @@ or @code{pragma Convention}. Here is an example of simple library interface for use with C main program: @smallexample @c ada -package My_Package is +@b{package} My_Package @b{is} - procedure Do_Something; - pragma Export (C, Do_Something, "do_something"); + @b{procedure} Do_Something; + @b{pragma} Export (C, Do_Something, "do_something"); - procedure Do_Something_Else; - pragma Export (C, Do_Something_Else, "do_something_else"); + @b{procedure} Do_Something_Else; + @b{pragma} Export (C, Do_Something_Else, "do_something_else"); -end My_Package; +@b{end} My_Package; @end smallexample @noindent @@ -18660,7 +17848,6 @@ export ADA_OBJECTS_PATH all: gnatmake main_unit @end smallexample -@end ifclear @node Memory Management Issues @chapter Memory Management Issues @@ -18669,21 +17856,17 @@ all: This chapter describes some useful memory pools provided in the GNAT library and in particular the GNAT Debug Pool facility, which can be used to detect incorrect uses of access values (including ``dangling references''). -@ifclear vms @ifclear FSFEDITION It also describes the @command{gnatmem} tool, which can be used to track down ``memory leaks''. @end ifclear -@end ifclear @menu * Some Useful Memory Pools:: * The GNAT Debug Pool Facility:: -@ifclear vms @ifclear FSFEDITION * The gnatmem Tool:: @end ifclear -@end ifclear @end menu @node Some Useful Memory Pools @@ -18701,12 +17884,12 @@ pools but if they did, they could use this storage pool without any change in behavior. That is why this storage pool is used when the user manages to make the default implicit allocator explicit as in this example: @smallexample @c ada - type T1 is access Something; - -- no Storage pool is defined for T2 - type T2 is access Something_Else; - for T2'Storage_Pool use T1'Storage_Pool; - -- the above is equivalent to - for T2'Storage_Pool use System.Pool_Global.Global_Pool_Object; + @b{type} T1 @b{is} @b{access} Something; + --@i{ no Storage pool is defined for T2} + @b{type} T2 @b{is} @b{access} Something_Else; + @b{for} T2'Storage_Pool @b{use} T1'Storage_Pool; + --@i{ the above is equivalent to} + @b{for} T2'Storage_Pool @b{use} System.Pool_Global.Global_Pool_Object; @end smallexample @noindent @@ -18721,23 +17904,23 @@ scope of a given local access. As an example, the following program does not leak memory even though it does not perform explicit deallocation: @smallexample @c ada -with System.Pool_Local; -procedure Pooloc1 is - procedure Internal is - type A is access Integer; +@b{with} System.Pool_Local; +@b{procedure} Pooloc1 @b{is} + @b{procedure} Internal @b{is} + @b{type} A @b{is} @b{access} Integer; X : System.Pool_Local.Unbounded_Reclaim_Pool; - for A'Storage_Pool use X; + @b{for} A'Storage_Pool @b{use} X; v : A; - begin - for I in 1 .. 50 loop - v := new Integer; - end loop; - end Internal; -begin - for I in 1 .. 100 loop + @b{begin} + @b{for} I @b{in} 1 .. 50 @b{loop} + v := @b{new} Integer; + @b{end} @b{loop}; + @b{end} Internal; +@b{begin} + @b{for} I @b{in} 1 .. 100 @b{loop} Internal; - end loop; -end Pooloc1; + @b{end} @b{loop}; +@b{end} Pooloc1; @end smallexample @noindent @@ -18750,8 +17933,8 @@ access type is defined. This package is not intended to be used directly by the user and it is implicitly used for each such declaration: @smallexample @c ada - type T1 is access Something; - for T1'Storage_Size use 10_000; + @b{type} T1 @b{is} @b{access} Something; + @b{for} T1'Storage_Size @b{use} 10_000; @end smallexample @node The GNAT Debug Pool Facility @@ -18771,9 +17954,9 @@ In order to use the GNAT specific debugging pool, the user must associate a debug pool object with each of the access types that may be related to suspected memory problems. See Ada Reference Manual 13.11. @smallexample @c ada -type Ptr is access Some_Type; +@b{type} Ptr @b{is} @b{access} Some_Type; Pool : GNAT.Debug_Pools.Debug_Pool; -for Ptr'Storage_Pool use Pool; +@b{for} Ptr'Storage_Pool @b{use} Pool; @end smallexample @noindent @@ -18817,56 +18000,56 @@ properly allocated memory location. Here is a complete example of use of @iftex @leftskip=0cm @end iftex -with Gnat.Io; use Gnat.Io; -with Unchecked_Deallocation; -with Unchecked_Conversion; -with GNAT.Debug_Pools; -with System.Storage_Elements; -with Ada.Exceptions; use Ada.Exceptions; -procedure Debug_Pool_Test is +@b{with} Gnat.Io; @b{use} Gnat.Io; +@b{with} Unchecked_Deallocation; +@b{with} Unchecked_Conversion; +@b{with} GNAT.Debug_Pools; +@b{with} System.Storage_Elements; +@b{with} Ada.Exceptions; @b{use} Ada.Exceptions; +@b{procedure} Debug_Pool_Test @b{is} - type T is access Integer; - type U is access all T; + @b{type} T @b{is} @b{access} Integer; + @b{type} U @b{is} @b{access} @b{all} T; P : GNAT.Debug_Pools.Debug_Pool; - for T'Storage_Pool use P; + @b{for} T'Storage_Pool @b{use} P; - procedure Free is new Unchecked_Deallocation (Integer, T); - function UC is new Unchecked_Conversion (U, T); - A, B : aliased T; + @b{procedure} Free @b{is} @b{new} Unchecked_Deallocation (Integer, T); + @b{function} UC @b{is} @b{new} Unchecked_Conversion (U, T); + A, B : @b{aliased} T; - procedure Info is new GNAT.Debug_Pools.Print_Info(Put_Line); + @b{procedure} Info @b{is} @b{new} GNAT.Debug_Pools.Print_Info(Put_Line); -begin +@b{begin} Info (P); - A := new Integer; - B := new Integer; + A := @b{new} Integer; + B := @b{new} Integer; B := A; Info (P); Free (A); - begin - Put_Line (Integer'Image(B.all)); - exception - when E : others => Put_Line ("raised: " & Exception_Name (E)); - end; - begin + @b{begin} + Put_Line (Integer'Image(B.@b{all})); + @b{exception} + @b{when} E : @b{others} => Put_Line ("raised: " & Exception_Name (E)); + @b{end}; + @b{begin} Free (B); - exception - when E : others => Put_Line ("raised: " & Exception_Name (E)); - end; + @b{exception} + @b{when} E : @b{others} => Put_Line ("raised: " & Exception_Name (E)); + @b{end}; B := UC(A'Access); - begin - Put_Line (Integer'Image(B.all)); - exception - when E : others => Put_Line ("raised: " & Exception_Name (E)); - end; - begin + @b{begin} + Put_Line (Integer'Image(B.@b{all})); + @b{exception} + @b{when} E : @b{others} => Put_Line ("raised: " & Exception_Name (E)); + @b{end}; + @b{begin} Free (B); - exception - when E : others => Put_Line ("raised: " & Exception_Name (E)); - end; + @b{exception} + @b{when} E : @b{others} => Put_Line ("raised: " & Exception_Name (E)); + @b{end}; Info (P); -end Debug_Pool_Test; +@b{end} Debug_Pool_Test; @end smallexample @noindent @@ -18896,7 +18079,6 @@ Debug Pool info: High Water Mark: 8 @end smallexample -@ifclear vms @ifclear FSFEDITION @node The gnatmem Tool @section The @command{gnatmem} Tool @@ -18965,7 +18147,7 @@ $ gnatmake -g my_program -largs -lgmem As library @file{libgmem.a} contains an alternate body for package @code{System.Memory}, @file{s-memory.adb} should not be compiled and linked when an executable is linked with library @file{libgmem.a}. It is then not -recommended to use @command{gnatmake} with switch @option{^-a^/ALL_FILES^}. +recommended to use @command{gnatmake} with switch @option{-a}. @noindent When @file{my_program} is executed, the file @file{gmem.out} is produced. @@ -19095,34 +18277,34 @@ Suppose that we have the following Ada program: @smallexample @c ada @group @cartouche -with Unchecked_Deallocation; -procedure Test_Gm is +@b{with} Unchecked_Deallocation; +@b{procedure} Test_Gm @b{is} - type T is array (1..1000) of Integer; - type Ptr is access T; - procedure Free is new Unchecked_Deallocation (T, Ptr); + @b{type} T @b{is} @b{array} (1..1000) @b{of} Integer; + @b{type} Ptr @b{is} @b{access} T; + @b{procedure} Free @b{is} @b{new} Unchecked_Deallocation (T, Ptr); A : Ptr; - procedure My_Alloc is - begin - A := new T; - end My_Alloc; + @b{procedure} My_Alloc @b{is} + @b{begin} + A := @b{new} T; + @b{end} My_Alloc; - procedure My_DeAlloc is + @b{procedure} My_DeAlloc @b{is} B : Ptr := A; - begin + @b{begin} Free (B); - end My_DeAlloc; + @b{end} My_DeAlloc; -begin +@b{begin} My_Alloc; - for I in 1 .. 5 loop - for J in I .. 5 loop + @b{for} I @b{in} 1 .. 5 @b{loop} + @b{for} J @b{in} I .. 5 @b{loop} My_Alloc; - end loop; + @b{end} @b{loop}; My_Dealloc; - end loop; -end; + @b{end} @b{loop}; +@b{end}; @end cartouche @end group @end smallexample @@ -19257,7 +18439,6 @@ Allocation Root # 4 The allocation root #1 of the first example has been split in 2 roots #1 and #3 thanks to the more precise associated backtrace. @end ifclear -@end ifclear @node Stack Related Facilities @chapter Stack Related Facilities @@ -19313,7 +18494,6 @@ For the environment task, the stack size depends on system defaults and is unknown to the compiler. Stack checking may still work correctly if a fixed size stack is allocated, but this cannot be guaranteed. -@ifclear vms To ensure that a clean exception is signalled for stack overflow, set the environment variable @env{GNAT_STACK_LIMIT} to indicate the maximum @@ -19332,36 +18512,6 @@ of stack used by the environment task. If it is necessary to increase the amount of stack for the environment task, then this is an operating systems issue, and must be addressed with the appropriate operating systems commands. -@end ifclear -@ifset vms -To have a fixed size stack in the environment task, the stack must be put -in the P0 address space and its size specified. Use these switches to -create a p0 image: - -@smallexample -gnatmake my_progs -largs "-Wl,--opt=STACK=4000,/p0image" -@end smallexample - -@noindent -The quotes are required to keep case. The number after @samp{STACK=} is the -size of the environmental task stack in pagelets (512 bytes). In this example -the stack size is about 2 megabytes. - -@noindent -A consequence of the @option{/p0image} qualifier is also to makes RMS buffers -be placed in P0 space. Refer to @cite{HP OpenVMS Linker Utility Manual} for -more details about the @option{/p0image} qualifier and the @option{stack} -option. - -@noindent -On Itanium platforms, you can instead assign the @samp{GNAT_STACK_SIZE} and -@samp{GNAT_RBS_SIZE} logicals to the size of the primary and register -stack in kilobytes. For example: - -@smallexample -$ define GNAT_RBS_SIZE 1024 ! Limit the RBS size to 1MB. -@end smallexample -@end ifset @node Static Stack Usage Analysis @section Static Stack Usage Analysis @@ -19519,7 +18669,7 @@ the preprocessed source. By default, all the program unit bodies generated by @code{gnatstub} raise the predefined @code{Program_Error} exception, which will catch accidental calls of generated stubs. This behavior can be changed with -option @option{^--no-exception^/NO_EXCEPTION^} (see below). +option @option{--no-exception} (see below). @menu * Running gnatstub:: @@ -19550,7 +18700,7 @@ If the name does not follow GNAT file naming conventions and a set of seitches does not contain a project file that defines naming conventions, the name of the body file must be provided -explicitly as the value of the @option{^-o^/BODY=^@var{body-name}} option. +explicitly as the value of the @option{-o@var{body-name}} option. If the file name follows the GNAT file naming conventions and the name of the body file is not provided, @command{gnatstub} @@ -19562,7 +18712,7 @@ naming conventions. @item @samp{@var{gcc_switches}} is a list of switches for @command{gcc}. They will be passed on to all compiler invocations made by @command{gnatstub} to generate the ASIS trees. Here you can provide -@option{^-I^/INCLUDE_DIRS=^} switches to form the source search path, +@option{-I} switches to form the source search path, use the @option{-gnatec} switch to set the configuration file, use the @option{-gnat05} switch if sources should be compiled in Ada 2005 mode etc. @@ -19596,102 +18746,96 @@ Indicates that external variable @var{name} in the argument project has the value @var{value}. Has no effect if no project is specified as tool argument. -@item ^--subunits^/SUBUNITS^ -@cindex @option{^--subunits^/SUBUNITS^} (@command{gnatstub}) +@item --subunits +@cindex @option{--subunits} (@command{gnatstub}) Generate subunits for body stubs. If this switch is specified, @command{gnatstub} expects a library unit body as an agrument file, otherwise a library unit declaration is expected. If a body stub already has a corresponding subunit, @command{gnatstub} does not generate anything for it. -@item ^-f^/FULL^ -@cindex @option{^-f^/FULL^} (@command{gnatstub}) +@item -f +@cindex @option{-f} (@command{gnatstub}) If the destination directory already contains a file with the name of the body file for the argument spec file, replace it with the generated body stub. -This switch cannot be used together with @option{^--subunits^/SUBUNITS^}. +This switch cannot be used together with @option{--subunits}. -@item ^-hs^/HEADER=SPEC^ -@cindex @option{^-hs^/HEADER=SPEC^} (@command{gnatstub}) +@item -hs +@cindex @option{-hs} (@command{gnatstub}) Put the comment header (i.e., all the comments preceding the compilation unit) from the source of the library unit declaration into the body stub. -@item ^-hg^/HEADER=GENERAL^ -@cindex @option{^-hg^/HEADER=GENERAL^} (@command{gnatstub}) +@item -hg +@cindex @option{-hg} (@command{gnatstub}) Put a sample comment header into the body stub. -@item ^--header-file=@var{filename}^/FROM_HEADER_FILE=@var{filename}^ -@cindex @option{^--header-file^/FROM_HEADER_FILE=^} (@command{gnatstub}) +@item --header-file=@var{filename} +@cindex @option{--header-file} (@command{gnatstub}) Use the content of the file as the comment header for a generated body stub. -@ifclear vms @item -IDIR @cindex @option{-IDIR} (@command{gnatstub}) @itemx -I- @cindex @option{-I-} (@command{gnatstub}) -@end ifclear -@ifset vms -@item /NOCURRENT_DIRECTORY -@cindex @option{/NOCURRENT_DIRECTORY} (@command{gnatstub}) -@end ifset -^These switches have ^This switch has^ the same meaning as in calls to +These switches have the same meaning as in calls to @command{gcc}. -^They define ^It defines ^ the source search path in the call to +They define the source search path in the call to @command{gcc} issued by @command{gnatstub} to compile an argument source file. -@item ^-gnatec^/CONFIGURATION_PRAGMAS_FILE=^@var{PATH} -@cindex @option{^-gnatec^/CONFIGURATION_PRAGMAS_FILE^} (@command{gnatstub}) +@item -gnatec@var{PATH} +@cindex @option{-gnatec} (@command{gnatstub}) This switch has the same meaning as in calls to @command{gcc}. It defines the additional configuration file to be passed to the call to @command{gcc} issued by @command{gnatstub} to compile an argument source file. -@item ^-gnatyM^/MAX_LINE_LENGTH=^@var{n} -@cindex @option{^-gnatyM^/MAX_LINE_LENGTH^} (@command{gnatstub}) +@item -gnatyM@var{n} +@cindex @option{-gnatyM} (@command{gnatstub}) (@var{n} is a non-negative integer). Set the maximum line length that is allowed in a source file. The default is 79. The maximum value that can be specified is 32767. Note that in the special case of configuration pragma files, the maximum is always 32767 regardless of whether or not this switch appears. -@item ^-gnaty^/STYLE_CHECKS=^@var{n} -@cindex @option{^-gnaty^/STYLE_CHECKS=^} (@command{gnatstub}) +@item -gnaty@var{n} +@cindex @option{-gnaty} (@command{gnatstub}) (@var{n} is a non-negative integer from 1 to 9). Set the indentation level in the generated body sample to @var{n}. The default indentation is 3. -@item ^-gnatyo^/ORDERED_SUBPROGRAMS^ -@cindex @option{^-gnatyo^/ORDERED_SUBPROGRAMS^} (@command{gnatstub}) +@item -gnatyo +@cindex @option{-gnatyo} (@command{gnatstub}) Order local bodies alphabetically. (By default local bodies are ordered in the same way as the corresponding local specs in the argument spec file.) -@item ^-i^/INDENTATION=^@var{n} -@cindex @option{^-i^/INDENTATION^} (@command{gnatstub}) -Same as @option{^-gnaty^/STYLE_CHECKS=^@var{n}} +@item -i@var{n} +@cindex @option{-i} (@command{gnatstub}) +Same as @option{-gnaty@var{n}} -@item ^-k^/TREE_FILE=SAVE^ -@cindex @option{^-k^/TREE_FILE=SAVE^} (@command{gnatstub}) +@item -k +@cindex @option{-k} (@command{gnatstub}) Do not remove the tree file (i.e., the snapshot of the compiler internal structures used by @command{gnatstub}) after creating the body stub. -@item ^-l^/LINE_LENGTH=^@var{n} -@cindex @option{^-l^/LINE_LENGTH^} (@command{gnatstub}) -Same as @option{^-gnatyM^/MAX_LINE_LENGTH=^@var{n}} +@item -l@var{n} +@cindex @option{-l} (@command{gnatstub}) +Same as @option{-gnatyM@var{n}} -@item ^--no-exception^/NO_EXCEPTION^ -@cindex @option{^--no-exception^/NO_EXCEPTION^} (@command{gnatstub}) +@item --no-exception +@cindex @option{--no-exception} (@command{gnatstub}) Avoid raising PROGRAM_ERROR in the generated bodies of program unit stubs. This is not always possible for function stubs. -@item ^--no-local-header^/NO_LOCAL_HEADER^ -@cindex @option{^--no-local-header^/NO_LOCAL_HEADER^} (@command{gnatstub}) +@item --no-local-header +@cindex @option{--no-local-header} (@command{gnatstub}) Do not place local comment header with unit name before body stub for a unit. -@item ^-o ^/BODY=^@var{body-name} -@cindex @option{^-o^/BODY^} (@command{gnatstub}) +@item -o @var{body-name} +@cindex @option{-o} (@command{gnatstub}) Body file name. This should be set if the argument file name does not follow the GNAT file naming @@ -19699,57 +18843,57 @@ conventions. If this switch is omitted the default name for the body will be obtained from the argument file name according to the GNAT file naming conventions. -@item ^--dir=^/DIR=^@var{dir-name} -@cindex @option{^--dir^/DIR^} (@command{gnatstub}) +@item --dir=@var{dir-name} +@cindex @option{--dir} (@command{gnatstub}) The path to the directory to place the generated files into. If this switch is not set, the generated library unit body is placed in the current directory, and generated sununits - in the directory where the argument body is located. -@item ^-W^/RESULT_ENCODING=^@var{e} -@cindex @option{^-W^/RESULT_ENCODING=^} (@command{gnatstub}) +@item -W@var{e} +@cindex @option{-W} (@command{gnatstub}) Specify the wide character encoding method for the output body file. @var{e} is one of the following: @itemize @bullet -@item ^h^HEX^ +@item h Hex encoding -@item ^u^UPPER^ +@item u Upper half encoding -@item ^s^SHIFT_JIS^ +@item s Shift/JIS encoding -@item ^e^EUC^ +@item e EUC encoding -@item ^8^UTF8^ +@item 8 UTF-8 encoding -@item ^b^BRACKETS^ +@item b Brackets encoding (default value) @end itemize -@item ^-q^/QUIET^ -@cindex @option{^-q^/QUIET^} (@command{gnatstub}) +@item -q +@cindex @option{-q} (@command{gnatstub}) Quiet mode: do not generate a confirmation when a body is successfully created, and do not generate a message when a body is not required for an argument unit. -@item ^-r^/TREE_FILE=REUSE^ -@cindex @option{^-r^/TREE_FILE=REUSE^} (@command{gnatstub}) +@item -r +@cindex @option{-r} (@command{gnatstub}) Reuse the tree file (if it exists) instead of creating it. Instead of creating the tree file for the library unit declaration, @command{gnatstub} tries to find it in the current directory and use it for creating a body. If the tree file is not found, no body is created. This option -also implies @option{^-k^/SAVE^}, whether or not +also implies @option{-k}, whether or not the latter is set explicitly. -@item ^-t^/TREE_FILE=OVERWRITE^ -@cindex @option{^-t^/TREE_FILE=OVERWRITE^} (@command{gnatstub}) +@item -t +@cindex @option{-t} (@command{gnatstub}) Overwrite the existing tree file. If the current directory already contains the file which, according to the GNAT file naming rules should be considered as a tree file for the argument source file, @@ -19757,8 +18901,8 @@ be considered as a tree file for the argument source file, will refuse to create the tree file needed to create a sample body unless this option is set. -@item ^-v^/VERBOSE^ -@cindex @option{^-v^/VERBOSE^} (@command{gnatstub}) +@item -v +@cindex @option{-v} (@command{gnatstub}) Verbose mode: generate version information. @end table @@ -19803,9 +18947,7 @@ is installed at its default location. * Testing with Contracts:: * Additional Tests:: * Putting Tests under Version Control:: -@ifclear vms * Support for other platforms/run-times:: -@end ifclear * Current Limitations:: @end menu @@ -19839,7 +18981,7 @@ path. is a list of switches for @command{gcc}. These switches will be passed on to all compiler invocations made by @command{gnattest} to generate a set of ASIS trees. Here you can provide -@option{^-I^/INCLUDE_DIRS=^} switches to form the source search path, +@option{-I} switches to form the source search path, use the @option{-gnatec} switch to set the configuration file, use the @option{-gnat05} switch if sources should be compiled in Ada 2005 mode, etc. @@ -20381,7 +19523,6 @@ test package specs are also generated automatically each time and should not be put under version control. Option @option{--omit-sloc} may be usefull when putting test packages under VCS. -@ifclear vms @node Support for other platforms/run-times @section Support for other platforms/run-times @@ -20402,7 +19543,6 @@ the ZFP run-time library: @smallexample powerpc-elf-gnattest -Psimple.gpr -XPLATFORM=powerpc-elf -XRUNTIME=zfp @end smallexample -@end ifclear @node Current Limitations @section Current Limitations @@ -20459,8 +19599,8 @@ package, in file @file{s-dimmks.ads}. @smallexample @c ada @group - type Mks_Type is new Long_Long_Float - with + @b{type} Mks_Type @b{is} @b{new} Long_Long_Float + @b{with} Dimension_System => ( (Unit_Name => Meter, Unit_Symbol => 'm', Dim_Symbol => 'L'), (Unit_Name => Kilogram, Unit_Symbol => "kg", Dim_Symbol => 'M'), @@ -20478,9 +19618,9 @@ conventional units. For example: @smallexample @c ada @group - subtype Length is Mks_Type - with - Dimension => (Symbol => 'm', Meter => 1, others => 0); + @b{subtype} Length @b{is} Mks_Type + @b{with} + Dimension => (Symbol => 'm', Meter => 1, @b{others} => 0); @end group @end smallexample @@ -20494,10 +19634,10 @@ example: @smallexample @c ada @group - m : constant Length := 1.0; - kg : constant Mass := 1.0; - s : constant Time := 1.0; - A : constant Electric_Current := 1.0; + m : @b{constant} Length := 1.0; + kg : @b{constant} Mass := 1.0; + s : @b{constant} Time := 1.0; + A : @b{constant} Electric_Current := 1.0; @end group @end smallexample @@ -20506,10 +19646,10 @@ as well as useful multiples of these units: @smallexample @c ada @group - cm : constant Length := 1.0E-02; - g : constant Mass := 1.0E-03; - min : constant Time := 60.0; - day : constant Time := 60.0 * 24.0 * min; + cm : @b{constant} Length := 1.0E-02; + g : @b{constant} Mass := 1.0E-03; + min : @b{constant} Time := 60.0; + day : @b{constant} Time := 60.0 * 24.0 * min; ... @end group @end smallexample @@ -20522,11 +19662,11 @@ be used for output of a value of that unit: @smallexample @c ada @group - subtype Acceleration is Mks_Type - with Dimension => ("m/sec^^^2", + @b{subtype} Acceleration @b{is} Mks_Type + @b{with} Dimension => ("m/sec^2", Meter => 1, Second => -2, - others => 0); + @b{others} => 0); @end group @end smallexample @@ -20535,25 +19675,25 @@ Here is a complete example of use: @smallexample @c ada @group -with System.Dim.MKS; use System.Dim.Mks; -with System.Dim.Mks_IO; use System.Dim.Mks_IO; -with Text_IO; use Text_IO; -procedure Free_Fall is - subtype Acceleration is Mks_Type - with Dimension => ("m/sec^^^2", 1, 0, -2, others => 0); - G : constant acceleration := 9.81 * m / (s ** 2); +@b{with} System.Dim.MKS; @b{use} System.Dim.Mks; +@b{with} System.Dim.Mks_IO; @b{use} System.Dim.Mks_IO; +@b{with} Text_IO; @b{use} Text_IO; +@b{procedure} Free_Fall @b{is} + @b{subtype} Acceleration @b{is} Mks_Type + @b{with} Dimension => ("m/sec^2", 1, 0, -2, @b{others} => 0); + G : @b{constant} acceleration := 9.81 * m / (s ** 2); T : Time := 10.0*s; Distance : Length; @end group @group -begin +@b{begin} Put ("Gravitational constant: "); Put (G, Aft => 2, Exp => 0); Put_Line (""); Distance := 0.5 * G * T ** 2; Put ("distance travelled in 10 seconds of free fall "); Put (Distance, Aft => 2, Exp => 0); Put_Line (""); -end Free_Fall; +@b{end} Free_Fall; @end group @end smallexample @@ -20561,7 +19701,7 @@ end Free_Fall; Execution of this program yields: @smallexample @group -Gravitational constant: 9.81 m/sec^^^2 +Gravitational constant: 9.81 m/sec^2 distance travelled in 10 seconds of free fall 490.50 m @end group @end smallexample @@ -20795,54 +19935,54 @@ The corresponding Ada code is generated: @smallexample @c ada @group @cartouche - package Class_Carnivore is - type Carnivore is limited interface; - pragma Import (CPP, Carnivore); - - function Number_Of_Teeth (this : access Carnivore) return int is abstract; - end; - use Class_Carnivore; - - package Class_Domestic is - type Domestic is limited interface; - pragma Import (CPP, Domestic); - - procedure Set_Owner - (this : access Domestic; - Name : Interfaces.C.Strings.chars_ptr) is abstract; - end; - use Class_Domestic; - - package Class_Animal is - type Animal is tagged limited record - Age_Count : aliased int; - end record; - pragma Import (CPP, Animal); - - procedure Set_Age (this : access Animal; New_Age : int); - pragma Import (CPP, Set_Age, "_ZN6Animal7Set_AgeEi"); - end; - use Class_Animal; - - package Class_Dog is - type Dog is new Animal and Carnivore and Domestic with record - Tooth_Count : aliased int; + @b{package} Class_Carnivore @b{is} + @b{type} Carnivore @b{is} @b{limited} interface; + @b{pragma} Import (CPP, Carnivore); + + @b{function} Number_Of_Teeth (this : @b{access} Carnivore) @b{return} int @b{is} @b{abstract}; + @b{end}; + @b{use} Class_Carnivore; + + @b{package} Class_Domestic @b{is} + @b{type} Domestic @b{is} @b{limited} interface; + @b{pragma} Import (CPP, Domestic); + + @b{procedure} Set_Owner + (this : @b{access} Domestic; + Name : Interfaces.C.Strings.chars_ptr) @b{is} @b{abstract}; + @b{end}; + @b{use} Class_Domestic; + + @b{package} Class_Animal @b{is} + @b{type} Animal @b{is} @b{tagged} @b{limited} @b{record} + Age_Count : @b{aliased} int; + @b{end} @b{record}; + @b{pragma} Import (CPP, Animal); + + @b{procedure} Set_Age (this : @b{access} Animal; New_Age : int); + @b{pragma} Import (CPP, Set_Age, "_ZN6Animal7Set_AgeEi"); + @b{end}; + @b{use} Class_Animal; + + @b{package} Class_Dog @b{is} + @b{type} Dog @b{is} @b{new} Animal @b{and} Carnivore @b{and} Domestic @b{with} @b{record} + Tooth_Count : @b{aliased} int; Owner : Interfaces.C.Strings.chars_ptr; - end record; - pragma Import (CPP, Dog); + @b{end} @b{record}; + @b{pragma} Import (CPP, Dog); - function Number_Of_Teeth (this : access Dog) return int; - pragma Import (CPP, Number_Of_Teeth, "_ZN3Dog15Number_Of_TeethEv"); + @b{function} Number_Of_Teeth (this : @b{access} Dog) @b{return} int; + @b{pragma} Import (CPP, Number_Of_Teeth, "_ZN3Dog15Number_Of_TeethEv"); - procedure Set_Owner - (this : access Dog; Name : Interfaces.C.Strings.chars_ptr); - pragma Import (CPP, Set_Owner, "_ZN3Dog9Set_OwnerEPc"); + @b{procedure} Set_Owner + (this : @b{access} Dog; Name : Interfaces.C.Strings.chars_ptr); + @b{pragma} Import (CPP, Set_Owner, "_ZN3Dog9Set_OwnerEPc"); - function New_Dog return Dog; - pragma CPP_Constructor (New_Dog); - pragma Import (CPP, New_Dog, "_ZN3DogC1Ev"); - end; - use Class_Dog; + @b{function} New_Dog @b{return} Dog; + @b{pragma} CPP_Constructor (New_Dog); + @b{pragma} Import (CPP, New_Dog, "_ZN3DogC1Ev"); + @b{end}; + @b{use} Class_Dog; @end cartouche @end group @end smallexample @@ -20883,10 +20023,6 @@ environment. * The External Symbol Naming Scheme of GNAT:: * Converting Ada Files to html with gnathtml:: * Installing gnathtml:: -@ifset vms -* LSE:: -* Profiling:: -@end ifset @end menu @node Using Other Utility Programs with GNAT @@ -20898,12 +20034,10 @@ particular the debugging information uses this format. This means programs generated by GNAT can be used with existing utilities that depend on these formats. -@ifclear vms 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), @code{gdb} (the FSF debugger), and utilities such as Purify. -@end ifclear @node The External Symbol Naming Scheme of GNAT @section The External Symbol Naming Scheme of GNAT @@ -20922,9 +20056,9 @@ we have the following package spec: @smallexample @c ada @group @cartouche -package QRS is +@b{package} QRS @b{is} MN : Integer; -end QRS; +@b{end} QRS; @end cartouche @end group @end smallexample @@ -20938,12 +20072,12 @@ Of course if a @code{pragma Export} is used this may be overridden: @smallexample @c ada @group @cartouche -package Exports is +@b{package} Exports @b{is} Var1 : Integer; - pragma Export (Var1, C, External_Name => "var1_name"); + @b{pragma} Export (Var1, C, External_Name => "var1_name"); Var2 : Integer; - pragma Export (Var2, C, Link_Name => "var2_link_name"); -end Exports; + @b{pragma} Export (Var2, C, Link_Name => "var2_link_name"); +@b{end} Exports; @end cartouche @end group @end smallexample @@ -20968,7 +20102,7 @@ names. So if we have a library level procedure such as @smallexample @c ada @group @cartouche -procedure Hello (S : String); +@b{procedure} Hello (S : String); @end cartouche @end group @end smallexample @@ -20993,9 +20127,9 @@ be able to click on any identifier and go to its declaration. The command line is as follow: @smallexample -@c $ perl gnathtml.pl @ovar{^switches^options^} @var{ada-files} +@c $ perl gnathtml.pl @ovar{switches} @var{ada-files} @c Expanding @ovar macro inline (explanation in macro def comments) -$ perl gnathtml.pl @r{[}@var{^switches^options^}@r{]} @var{ada-files} +$ perl gnathtml.pl @r{[}@var{switches}@r{]} @var{ada-files} @end smallexample @noindent @@ -21003,7 +20137,7 @@ You can pass it as many Ada files as you want. @code{gnathtml} will generate an html file for every ada file, and a global file called @file{index.htm}. This file is an index of every identifier defined in the files. -The available ^switches^options^ are the following ones: +The available switches are the following ones: @table @option @item -83 @@ -21041,7 +20175,7 @@ entities too. @item -l @var{number} @cindex @option{-l} (@code{gnathtml}) -If this ^switch^option^ is provided and @var{number} is not 0, then +If this switch is provided and @var{number} is not 0, then @code{gnathtml} will number the html files every @var{number} line. @item -I @var{dir} @@ -21062,19 +20196,19 @@ a full Integrated Development Environment for compiling, checking, running and debugging applications, you may use @file{.gpr} files to give the directories where Emacs can find sources and object files. -Using this ^switch^option^, you can tell gnathtml to use these files. +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. @item -sc @var{color} @cindex @option{-sc} (@code{gnathtml}) -This ^switch^option^ allows you to change the color used for symbol +This switch allows you to change the color used for symbol definitions. The default value is red. The color argument can be any name accepted by html. @item -t @var{file} @cindex @option{-t} (@code{gnathtml}) -This ^switch^option^ provides the name of a file. This file contains a list of +This switch provides the name of a file. This file contains a list of file names to be converted, and the effect is exactly as though they had appeared explicitly on the command line. This is the recommended way to work around the command line length limit on some @@ -21106,34 +20240,7 @@ Alternatively, you may run the script using the following command line: $ perl gnathtml.pl @r{[}@var{switches}@r{]} @var{files} @end smallexample -@ifset vms -@node LSE -@section LSE -@findex LSE - -@noindent -The GNAT distribution provides an Ada 95 template for the HP Language -Sensitive Editor (LSE), a component of DECset. In order to -access it, invoke LSE with the qualifier /ENVIRONMENT=GNU:[LIB]ADA95.ENV. - -@node Profiling -@section Profiling -@findex PCA - -@noindent -GNAT supports The HP Performance Coverage Analyzer (PCA), a component -of DECset. To use it proceed as outlined under ``HELP PCA'', except for running -the collection phase with the /DEBUG qualifier. - -@smallexample -$ GNAT MAKE /DEBUG <PROGRAM_NAME> -$ DEFINE LIB$DEBUG PCA$COLLECTOR -$ RUN/DEBUG <PROGRAM_NAME> -@end smallexample -@noindent -@end ifset -@ifclear vms @c ****************************** @node Code Coverage and Profiling @chapter Code Coverage and Profiling @@ -21342,12 +20449,12 @@ gprof my_prog The complete form of the gprof command line is the following: @smallexample -gprof [^switches^options^] [executable [data-file]] +gprof [switches] [executable [data-file]] @end smallexample @noindent -@code{gprof} supports numerous ^switch^options^. The order of these -^switch^options^ does not matter. The full list of options can be found in +@code{gprof} supports numerous switch. The order of these +switch does not matter. The full list of options can be found in the GNU Profiler User's Guide documentation that comes with this documentation. The following is the subset of those switches that is most relevant: @@ -21418,7 +20525,6 @@ time-consuming functions. The call graph shows, for each subprogram, the subprograms that call it, and the subprograms that it calls. It also provides an estimate of the time spent in each of those callers/called subprograms. -@end ifclear @c ****************************** @node Running and Debugging Ada Programs @@ -21427,11 +20533,6 @@ spent in each of those callers/called subprograms. @noindent This chapter discusses how to debug Ada programs. -@ifset vms -It applies to GNAT on the Alpha OpenVMS platform; -for I64 OpenVMS please refer to the @cite{OpenVMS Debugger Manual}, -since HP has implemented Ada support in the OpenVMS debugger on I64. -@end ifset An incorrect Ada program may be handled in three ways by the GNAT compiler: @@ -21484,9 +20585,6 @@ GNAT. The latest versions of @code{GDB} are Ada-aware and can handle complex Ada data structures. @xref{Top,, Debugging with GDB, gdb, Debugging with GDB}, -@ifset vms -located in the GNU:[DOCS] directory, -@end ifset for full details on the usage of @code{GDB}, including a section on its usage on programs. This manual should be consulted for full details. The section that follows is a brief introduction to the @@ -21499,7 +20597,7 @@ separate from the generated code. It makes the object files considerably larger, but it does not add to the size of the actual executable that will be loaded into memory, and has no impact on run-time performance. The generation of debug information is triggered by the use of the -^-g^/DEBUG^ switch in the @command{gcc} or @command{gnatmake} command +-g switch in the @command{gcc} or @command{gnatmake} command used to carry out the compilations. It is important to emphasize that the use of these options does not change the generated code. @@ -21542,21 +20640,19 @@ This section describes how to initiate the debugger. @c clumsy to get the first paragraph nonindented given the conditional @c nature of the description -@ifclear vms The debugger can be launched from a @code{GPS} menu or directly from the command line. The description below covers the latter use. All the commands shown can be used in the @code{GPS} debug console window, but there are usually more GUI-based ways to achieve the same effect. -@end ifclear The command to run @code{GDB} is @smallexample -$ ^gdb program^GDB PROGRAM^ +$ gdb program @end smallexample @noindent -where @code{^program^PROGRAM^} is the name of the executable file. This +where @code{program} is the name of the executable file. This activates the debugger and results in a prompt for debugger commands. The simplest command is simply @code{run}, which causes the program to run exactly as if the debugger were not present. The following section @@ -21569,9 +20665,6 @@ describes some of the additional commands that can be given to @code{GDB}. @noindent @code{GDB} contains a large repertoire of commands. @xref{Top,, Debugging with GDB, gdb, Debugging with GDB}, -@ifset vms -located in the GNU:[DOCS] directory, -@end ifset for extensive documentation on the use of these commands, together with examples of their use. Furthermore, the command @command{help} invoked from within GDB activates a simple help @@ -21894,30 +20987,30 @@ a generic, by using the appropriate expanded names. For example, if we have @smallexample @c ada @group @cartouche -procedure g is +@b{procedure} g @b{is} - generic package k is - procedure kp (v1 : in out integer); - end k; + @b{generic} @b{package} k @b{is} + @b{procedure} kp (v1 : @b{in} @b{out} integer); + @b{end} k; - package body k is - procedure kp (v1 : in out integer) is - begin + @b{package} @b{body} k @b{is} + @b{procedure} kp (v1 : @b{in} @b{out} integer) @b{is} + @b{begin} v1 := v1 + 1; - end kp; - end k; + @b{end} kp; + @b{end} k; - package k1 is new k; - package k2 is new k; + @b{package} k1 @b{is} @b{new} k; + @b{package} k2 @b{is} @b{new} k; var : integer := 1; -begin +@b{begin} k1.kp (var); k2.kp (var); k1.kp (var); k2.kp (var); -end; +@b{end}; @end cartouche @end group @end smallexample @@ -22016,7 +21109,7 @@ terminates prematurely or goes into an infinite loop, the last error message displayed may help to pinpoint the culprit. @item -Run @command{gcc} with the @option{^-v (verbose)^/VERBOSE^} switch. In this +Run @command{gcc} with the @option{-v (verbose)} switch. In this mode, @command{gcc} produces ongoing information about the progress of the compilation and provides the name of each procedure as code is generated. This switch allows you to find which Ada procedure was being @@ -22025,7 +21118,7 @@ compiled when it encountered a code generation problem. @item @cindex @option{-gnatdc} switch Run @command{gcc} with the @option{-gnatdc} switch. This is a GNAT specific -switch that does for the front-end what @option{^-v^VERBOSE^} does +switch that does for the front-end what @option{-v} does for the back end. The system prints the name of each unit, either a compilation unit or nested unit, as it is being analyzed. @item @@ -22050,15 +21143,15 @@ brief description of its organization may be helpful: @itemize @bullet @item -Files with prefix @file{^sc^SC^} contain the lexical scanner. +Files with prefix @file{sc} contain the lexical scanner. @item -All files prefixed with @file{^par^PAR^} are components of the parser. The +All files prefixed with @file{par} are components of the parser. The numbers correspond to chapters of the Ada Reference Manual. For example, parsing of select statements can be found in @file{par-ch9.adb}. @item -All files prefixed with @file{^sem^SEM^} perform semantic analysis. The +All files prefixed with @file{sem} perform semantic analysis. The numbers correspond to chapters of the Ada standard. For example, all issues involving context clauses can be found in @file{sem_ch10.adb}. In addition, some features of the language require sufficient special processing @@ -22066,14 +21159,14 @@ to justify their own semantic files: sem_aggr for aggregates, sem_disp for dynamic dispatching, etc. @item -All files prefixed with @file{^exp^EXP^} perform normalization and +All files prefixed with @file{exp} perform normalization and expansion of the intermediate representation (abstract syntax tree, or AST). these files use the same numbering scheme as the parser and semantics files. For example, the construction of record initialization procedures is done in @file{exp_ch3.adb}. @item -The files prefixed with @file{^bind^BIND^} implement the binder, which +The files prefixed with @file{bind} implement the binder, which verifies the consistency of the compilation, determines an order of elaboration, and generates the bind file. @@ -22091,28 +21184,28 @@ all entities, computed during semantic analysis. @item Library management issues are dealt with in files with prefix -@file{^lib^LIB^}. +@file{lib}. @item @findex Ada @cindex Annex A -Ada files with the prefix @file{^a-^A-^} are children of @code{Ada}, as +Ada files with the prefix @file{a-} are children of @code{Ada}, as defined in Annex A. @item @findex Interfaces @cindex Annex B -Files with prefix @file{^i-^I-^} are children of @code{Interfaces}, as +Files with prefix @file{i-} are children of @code{Interfaces}, as defined in Annex B. @item @findex System -Files with prefix @file{^s-^S-^} are children of @code{System}. This includes +Files with prefix @file{s-} are children of @code{System}. This includes both language-defined children and GNAT run-time routines. @item @findex GNAT -Files with prefix @file{^g-^G-^} are children of @code{GNAT}. These are useful +Files with prefix @file{g-} are children of @code{GNAT}. These are useful general-purpose packages, fully documented in their specs. All the other @file{.c} files are modifications of common @command{gcc} files. @end itemize @@ -22194,21 +21287,21 @@ Here is a simple example: @smallexample @c ada @cartouche -procedure STB is +@b{procedure} STB @b{is} - procedure P1 is - begin - raise Constraint_Error; - end P1; + @b{procedure} P1 @b{is} + @b{begin} + @b{raise} Constraint_Error; + @b{end} P1; - procedure P2 is - begin + @b{procedure} P2 @b{is} + @b{begin} P1; - end P2; + @b{end} P2; -begin +@b{begin} P2; -end STB; +@b{end} STB; @end cartouche @end smallexample @@ -22291,11 +21384,9 @@ in the stack traceback: @smallexample $ gdb -nw stb -@ifclear vms @noindent Furthermore, this feature is not implemented inside Windows DLL. Only the non-symbolic traceback is reported in this case. -@end ifclear (gdb) break *0x401373 Breakpoint 1 at 0x401373: file stb.adb, line 5. @@ -22319,31 +21410,31 @@ be retrieved in an exception handler within the Ada program, by means of the Ada facilities defined in @code{Ada.Exceptions}. Here is a simple example: @smallexample @c ada -with Ada.Text_IO; -with Ada.Exceptions; +@b{with} Ada.Text_IO; +@b{with} Ada.Exceptions; -procedure STB is +@b{procedure} STB @b{is} - use Ada; - use Ada.Exceptions; + @b{use} Ada; + @b{use} Ada.Exceptions; - procedure P1 is + @b{procedure} P1 @b{is} K : Positive := 1; - begin + @b{begin} K := K - 1; - exception - when E : others => + @b{exception} + @b{when} E : @b{others} => Text_IO.Put_Line (Exception_Information (E)); - end P1; + @b{end} P1; - procedure P2 is - begin + @b{procedure} P2 @b{is} + @b{begin} P1; - end P2; + @b{end} P2; -begin +@b{begin} P2; -end STB; +@b{end} STB; @end smallexample @noindent @@ -22376,42 +21467,42 @@ the program, and we display it using @code{GNAT.Debug_Utilities.Image} to convert addresses to strings: @smallexample @c ada -with Ada.Text_IO; -with GNAT.Traceback; -with GNAT.Debug_Utilities; +@b{with} Ada.Text_IO; +@b{with} GNAT.Traceback; +@b{with} GNAT.Debug_Utilities; -procedure STB is +@b{procedure} STB @b{is} - use Ada; - use GNAT; - use GNAT.Traceback; + @b{use} Ada; + @b{use} GNAT; + @b{use} GNAT.Traceback; - procedure P1 is + @b{procedure} P1 @b{is} TB : Tracebacks_Array (1 .. 10); - -- We are asking for a maximum of 10 stack frames. + --@i{ We are asking for a maximum of 10 stack frames.} Len : Natural; - -- Len will receive the actual number of stack frames returned. - begin + --@i{ Len will receive the actual number of stack frames returned.} + @b{begin} Call_Chain (TB, Len); Text_IO.Put ("In STB.P1 : "); - for K in 1 .. Len loop + @b{for} K @b{in} 1 .. Len @b{loop} Text_IO.Put (Debug_Utilities.Image (TB (K))); Text_IO.Put (' '); - end loop; + @b{end} @b{loop}; Text_IO.New_Line; - end P1; + @b{end} P1; - procedure P2 is - begin + @b{procedure} P2 @b{is} + @b{begin} P1; - end P2; + @b{end} P2; -begin +@b{begin} P2; -end STB; +@b{end} STB; @end smallexample @smallexample @@ -22454,32 +21545,32 @@ only the non-symbolic information will be valid. @subsubsection Tracebacks From Exception Occurrences @smallexample @c ada -with Ada.Text_IO; -with GNAT.Traceback.Symbolic; +@b{with} Ada.Text_IO; +@b{with} GNAT.Traceback.Symbolic; -procedure STB is +@b{procedure} STB @b{is} - procedure P1 is - begin - raise Constraint_Error; - end P1; + @b{procedure} P1 @b{is} + @b{begin} + @b{raise} Constraint_Error; + @b{end} P1; - procedure P2 is - begin + @b{procedure} P2 @b{is} + @b{begin} P1; - end P2; + @b{end} P2; - procedure P3 is - begin + @b{procedure} P3 @b{is} + @b{begin} P2; - end P3; + @b{end} P3; -begin +@b{begin} P3; -exception - when E : others => +@b{exception} + @b{when} E : @b{others} => Ada.Text_IO.Put_Line (GNAT.Traceback.Symbolic.Symbolic_Traceback (E)); -end STB; +@b{end} STB; @end smallexample @smallexample @@ -22517,1732 +21608,37 @@ traceback, and then call @code{Symbolic_Traceback} to compute the symbolic information. Here is an example: @smallexample @c ada -with Ada.Text_IO; -with GNAT.Traceback; -with GNAT.Traceback.Symbolic; +@b{with} Ada.Text_IO; +@b{with} GNAT.Traceback; +@b{with} GNAT.Traceback.Symbolic; -procedure STB is +@b{procedure} STB @b{is} - use Ada; - use GNAT.Traceback; - use GNAT.Traceback.Symbolic; + @b{use} Ada; + @b{use} GNAT.Traceback; + @b{use} GNAT.Traceback.Symbolic; - procedure P1 is + @b{procedure} P1 @b{is} TB : Tracebacks_Array (1 .. 10); - -- We are asking for a maximum of 10 stack frames. + --@i{ We are asking for a maximum of 10 stack frames.} Len : Natural; - -- Len will receive the actual number of stack frames returned. - begin + --@i{ Len will receive the actual number of stack frames returned.} + @b{begin} Call_Chain (TB, Len); Text_IO.Put_Line (Symbolic_Traceback (TB (1 .. Len))); - end P1; + @b{end} P1; - procedure P2 is - begin + @b{procedure} P2 @b{is} + @b{begin} P1; - end P2; + @b{end} P2; -begin +@b{begin} P2; -end STB; +@b{end} STB; @end smallexample @c ****************************** -@ifset vms -@node Compatibility with HP Ada -@chapter Compatibility with HP Ada -@cindex Compatibility - -@noindent -@cindex DEC Ada -@cindex HP Ada -@cindex Compatibility between GNAT and HP Ada -This chapter compares HP Ada (formerly known as ``DEC Ada'') -for OpenVMS Alpha and GNAT for OpenVMS for Alpha and for I64. -GNAT is highly compatible -with HP Ada, and it should generally be straightforward to port code -from the HP Ada environment to GNAT. However, there are a few language -and implementation differences of which the user must be aware. These -differences are discussed in this chapter. In -addition, the operating environment and command structure for the -compiler are different, and these differences are also discussed. - -For further details on these and other compatibility issues, -see Appendix E of the HP publication -@cite{HP Ada, Technical Overview and Comparison on HP Platforms}. - -Except where otherwise indicated, the description of GNAT for OpenVMS -applies to both the Alpha and I64 platforms. - -For information on porting Ada code from GNAT on Alpha OpenVMS to GNAT on -I64 OpenVMS, see @ref{Transitioning to 64-Bit GNAT for OpenVMS}. - -The discussion in this chapter addresses specifically the implementation -of Ada 83 for HP OpenVMS Alpha Systems. In cases where the implementation -of HP Ada differs between OpenVMS Alpha Systems and OpenVMS VAX Systems, -GNAT always follows the Alpha implementation. - -For GNAT running on other than VMS systems, all the HP Ada 83 pragmas and -attributes are recognized, although only a subset of them can sensibly -be implemented. The description of pragmas in -@xref{Implementation Defined Pragmas,,, gnat_rm, GNAT Reference Manual}, -indicates whether or not they are applicable to non-VMS systems. - -@menu -* Ada Language Compatibility:: -* Differences in the Definition of Package System:: -* Language-Related Features:: -* The Package STANDARD:: -* The Package SYSTEM:: -* Tasking and Task-Related Features:: -* Pragmas and Pragma-Related Features:: -* Library of Predefined Units:: -* Bindings:: -* Main Program Definition:: -* Implementation-Defined Attributes:: -* Compiler and Run-Time Interfacing:: -* Program Compilation and Library Management:: -* Input-Output:: -* Implementation Limits:: -* Tools and Utilities:: -@end menu - -@node Ada Language Compatibility -@section Ada Language Compatibility - -@noindent -GNAT handles Ada 95 and Ada 2005 as well as Ada 83, whereas HP Ada is only -for Ada 83. Ada 95 and Ada 2005 are almost completely upwards compatible -with Ada 83, and therefore Ada 83 programs will compile -and run under GNAT with -no changes or only minor changes. The @cite{Annotated Ada Reference Manual} -provides details on specific incompatibilities. - -GNAT provides the switch @option{/83} on the @command{GNAT COMPILE} command, -as well as the pragma @code{ADA_83}, to force the compiler to -operate in Ada 83 mode. This mode does not guarantee complete -conformance to Ada 83, but in practice is sufficient to -eliminate most sources of incompatibilities. -In particular, it eliminates the recognition of the -additional Ada 95 and Ada 2005 keywords, so that their use as identifiers -in Ada 83 programs is legal, and handles the cases of packages -with optional bodies, and generics that instantiate unconstrained -types without the use of @code{(<>)}. - -@node Differences in the Definition of Package System -@section Differences in the Definition of Package @code{System} - -@noindent -An Ada compiler is allowed to add -implementation-dependent declarations to package @code{System}. -In normal mode, -GNAT does not take advantage of this permission, and the version of -@code{System} provided by GNAT exactly matches that defined in the Ada -Reference Manual. - -However, HP Ada adds an extensive set of declarations to package -@code{System}, -as fully documented in the HP Ada manuals. To minimize changes required -for programs that make use of these extensions, GNAT provides the pragma -@code{Extend_System} for extending the definition of package System. By using: -@cindex pragma @code{Extend_System} -@cindex @code{Extend_System} pragma - -@smallexample @c ada -@group -@cartouche -pragma Extend_System (Aux_DEC); -@end cartouche -@end group -@end smallexample - -@noindent -the set of definitions in @code{System} is extended to include those in -package @code{System.Aux_DEC}. -@cindex @code{System.Aux_DEC} package -@cindex @code{Aux_DEC} package (child of @code{System}) -These definitions are incorporated directly into package @code{System}, -as though they had been declared there. For a -list of the declarations added, see the spec of this package, -which can be found in the file @file{s-auxdec.ads} in the GNAT library. -@cindex @file{s-auxdec.ads} file -The pragma @code{Extend_System} is a configuration pragma, which means that -it can be placed in the file @file{gnat.adc}, so that it will automatically -apply to all subsequent compilations. See @ref{Configuration Pragmas}, -for further details. - -An alternative approach that avoids the use of the non-standard -@code{Extend_System} pragma is to add a context clause to the unit that -references these facilities: - -@smallexample @c ada -@cartouche -with System.Aux_DEC; -use System.Aux_DEC; -@end cartouche -@end smallexample - -@noindent -The effect is not quite semantically identical to incorporating -the declarations directly into package @code{System}, -but most programs will not notice a difference -unless they use prefix notation (e.g.@: @code{System.Integer_8}) -to reference the entities directly in package @code{System}. -For units containing such references, -the prefixes must either be removed, or the pragma @code{Extend_System} -must be used. - -@node Language-Related Features -@section Language-Related Features - -@noindent -The following sections highlight differences in types, -representations of types, operations, alignment, and -related topics. - -@menu -* Integer Types and Representations:: -* Floating-Point Types and Representations:: -* Pragmas Float_Representation and Long_Float:: -* Fixed-Point Types and Representations:: -* Record and Array Component Alignment:: -* Address Clauses:: -* Other Representation Clauses:: -@end menu - -@node Integer Types and Representations -@subsection Integer Types and Representations - -@noindent -The set of predefined integer types is identical in HP Ada and GNAT. -Furthermore the representation of these integer types is also identical, -including the capability of size clauses forcing biased representation. - -In addition, -HP Ada for OpenVMS Alpha systems has defined the -following additional integer types in package @code{System}: - -@itemize @bullet - -@item -@code{INTEGER_8} - -@item -@code{INTEGER_16} - -@item -@code{INTEGER_32} - -@item -@code{INTEGER_64} - -@item -@code{LARGEST_INTEGER} -@end itemize - -@noindent -In GNAT, the first four of these types may be obtained from the -standard Ada package @code{Interfaces}. -Alternatively, by use of the pragma @code{Extend_System}, identical -declarations can be referenced directly in package @code{System}. -On both GNAT and HP Ada, the maximum integer size is 64 bits. - -@node Floating-Point Types and Representations -@subsection Floating-Point Types and Representations -@cindex Floating-Point types - -@noindent -The set of predefined floating-point types is identical in HP Ada and GNAT. -Furthermore the representation of these floating-point -types is also identical. One important difference is that the default -representation for HP Ada is @code{VAX_Float}, but the default representation -for GNAT is IEEE. - -Specific types may be declared to be @code{VAX_Float} or IEEE, using the -pragma @code{Float_Representation} as described in the HP Ada -documentation. -For example, the declarations: - -@smallexample @c ada -@cartouche -type F_Float is digits 6; -pragma Float_Representation (VAX_Float, F_Float); -@end cartouche -@end smallexample - -@noindent -declares a type @code{F_Float} that will be represented in @code{VAX_Float} -format. -This set of declarations actually appears in @code{System.Aux_DEC}, -which contains -the full set of additional floating-point declarations provided in -the HP Ada version of package @code{System}. -This and similar declarations may be accessed in a user program -by using pragma @code{Extend_System}. The use of this -pragma, and the related pragma @code{Long_Float} is described in further -detail in the following section. - -@node Pragmas Float_Representation and Long_Float -@subsection Pragmas @code{Float_Representation} and @code{Long_Float} - -@noindent -HP Ada provides the pragma @code{Float_Representation}, which -acts as a program library switch to allow control over -the internal representation chosen for the predefined -floating-point types declared in the package @code{Standard}. -The format of this pragma is as follows: - -@smallexample @c ada -@cartouche -pragma Float_Representation(VAX_Float | IEEE_Float); -@end cartouche -@end smallexample - -@noindent -This pragma controls the representation of floating-point -types as follows: - -@itemize @bullet -@item -@code{VAX_Float} specifies that floating-point -types are represented by default with the VAX system hardware types -@code{F-floating}, @code{D-floating}, @code{G-floating}. -Note that the @code{H-floating} -type was available only on VAX systems, and is not available -in either HP Ada or GNAT. - -@item -@code{IEEE_Float} specifies that floating-point -types are represented by default with the IEEE single and -double floating-point types. -@end itemize - -@noindent -GNAT provides an identical implementation of the pragma -@code{Float_Representation}, except that it functions as a -configuration pragma. Note that the -notion of configuration pragma corresponds closely to the -HP Ada notion of a program library switch. - -When no pragma is used in GNAT, the default is @code{IEEE_Float}, -which is different -from HP Ada 83, where the default is @code{VAX_Float}. In addition, the -predefined libraries in GNAT are built using @code{IEEE_Float}, so it is not -advisable to change the format of numbers passed to standard library -routines, and if necessary explicit type conversions may be needed. - -The use of @code{IEEE_Float} is recommended in GNAT since it is more -efficient, and (given that it conforms to an international standard) -potentially more portable. -The situation in which @code{VAX_Float} may be useful is in interfacing -to existing code and data that expect the use of @code{VAX_Float}. -In such a situation use the predefined @code{VAX_Float} -types in package @code{System}, as extended by -@code{Extend_System}. For example, use @code{System.F_Float} -to specify the 32-bit @code{F-Float} format. - -@noindent -On OpenVMS systems, HP Ada provides the pragma @code{Long_Float} -to allow control over the internal representation chosen -for the predefined type @code{Long_Float} and for floating-point -type declarations with digits specified in the range 7 .. 15. -The format of this pragma is as follows: - -@smallexample @c ada -@cartouche -pragma Long_Float (D_FLOAT | G_FLOAT); -@end cartouche -@end smallexample - -@node Fixed-Point Types and Representations -@subsection Fixed-Point Types and Representations - -@noindent -On HP Ada for OpenVMS Alpha systems, rounding is -away from zero for both positive and negative numbers. -Therefore, @code{+0.5} rounds to @code{1}, -and @code{-0.5} rounds to @code{-1}. - -On GNAT the results of operations -on fixed-point types are in accordance with the Ada -rules. In particular, results of operations on decimal -fixed-point types are truncated. - -@node Record and Array Component Alignment -@subsection Record and Array Component Alignment - -@noindent -On HP Ada for OpenVMS Alpha, all non-composite components -are aligned on natural boundaries. For example, 1-byte -components are aligned on byte boundaries, 2-byte -components on 2-byte boundaries, 4-byte components on 4-byte -byte boundaries, and so on. The OpenVMS Alpha hardware -runs more efficiently with naturally aligned data. - -On GNAT, alignment rules are compatible -with HP Ada for OpenVMS Alpha. - -@node Address Clauses -@subsection Address Clauses - -@noindent -In HP Ada and GNAT, address clauses are supported for -objects and imported subprograms. -The predefined type @code{System.Address} is a private type -in both compilers on Alpha OpenVMS, with the same representation -(it is simply a machine pointer). Addition, subtraction, and comparison -operations are available in the standard Ada package -@code{System.Storage_Elements}, or in package @code{System} -if it is extended to include @code{System.Aux_DEC} using a -pragma @code{Extend_System} as previously described. - -Note that code that @code{with}'s both this extended package @code{System} -and the package @code{System.Storage_Elements} should not @code{use} -both packages, or ambiguities will result. In general it is better -not to mix these two sets of facilities. The Ada package was -designed specifically to provide the kind of features that HP Ada -adds directly to package @code{System}. - -The type @code{System.Address} is a 64-bit integer type in GNAT for -I64 OpenVMS. For more information, -see @ref{Transitioning to 64-Bit GNAT for OpenVMS}. - -GNAT is compatible with HP Ada in its handling of address -clauses, except for some limitations in -the form of address clauses for composite objects with -initialization. Such address clauses are easily replaced -by the use of an explicitly-defined constant as described -in the Ada Reference Manual (13.1(22)). For example, the sequence -of declarations: - -@smallexample @c ada -@cartouche -X, Y : Integer := Init_Func; -Q : String (X .. Y) := "abc"; -@dots{} -for Q'Address use Compute_Address; -@end cartouche -@end smallexample - -@noindent -will be rejected by GNAT, since the address cannot be computed at the time -that @code{Q} is declared. To achieve the intended effect, write instead: - -@smallexample @c ada -@group -@cartouche -X, Y : Integer := Init_Func; -Q_Address : constant Address := Compute_Address; -Q : String (X .. Y) := "abc"; -@dots{} -for Q'Address use Q_Address; -@end cartouche -@end group -@end smallexample - -@noindent -which will be accepted by GNAT (and other Ada compilers), and is also -compatible with Ada 83. A fuller description of the restrictions -on address specifications is found in @ref{Top, GNAT Reference Manual, -About This Guide, gnat_rm, GNAT Reference Manual}. - -@node Other Representation Clauses -@subsection Other Representation Clauses - -@noindent -GNAT implements in a compatible manner all the representation -clauses supported by HP Ada. In addition, GNAT -implements the representation clause forms that were introduced in Ada 95, -including @code{COMPONENT_SIZE} and @code{SIZE} clauses for objects. - -@node The Package STANDARD -@section The Package @code{STANDARD} - -@noindent -The package @code{STANDARD}, as implemented by HP Ada, is fully -described in the @cite{Ada Reference Manual} and in the -@cite{HP Ada Language Reference Manual}. As implemented by GNAT, the -package @code{STANDARD} is described in the @cite{Ada Reference Manual}. - -In addition, HP Ada supports the Latin-1 character set in -the type @code{CHARACTER}. GNAT supports the Latin-1 character set -in the type @code{CHARACTER} and also Unicode (ISO 10646 BMP) in -the type @code{WIDE_CHARACTER}. - -The floating-point types supported by GNAT are those -supported by HP Ada, but the defaults are different, and are controlled by -pragmas. See @ref{Floating-Point Types and Representations}, for details. - -@node The Package SYSTEM -@section The Package @code{SYSTEM} - -@noindent -HP Ada provides a specific version of the package -@code{SYSTEM} for each platform on which the language is implemented. -For the complete spec of the package @code{SYSTEM}, see -Appendix F of the @cite{HP Ada Language Reference Manual}. - -On HP Ada, the package @code{SYSTEM} includes the following conversion -functions: -@itemize @bullet -@item @code{TO_ADDRESS(INTEGER)} - -@item @code{TO_ADDRESS(UNSIGNED_LONGWORD)} - -@item @code{TO_ADDRESS(}@i{universal_integer}@code{)} - -@item @code{TO_INTEGER(ADDRESS)} - -@item @code{TO_UNSIGNED_LONGWORD(ADDRESS)} - -@item Function @code{IMPORT_VALUE return UNSIGNED_LONGWORD} and the -functions @code{IMPORT_ADDRESS} and @code{IMPORT_LARGEST_VALUE} -@end itemize - -@noindent -By default, GNAT supplies a version of @code{SYSTEM} that matches -the definition given in the @cite{Ada Reference Manual}. -This -is a subset of the HP system definitions, which is as -close as possible to the original definitions. The only difference -is that the definition of @code{SYSTEM_NAME} is different: - -@smallexample @c ada -@cartouche -type Name is (SYSTEM_NAME_GNAT); -System_Name : constant Name := SYSTEM_NAME_GNAT; -@end cartouche -@end smallexample - -@noindent -Also, GNAT adds the Ada declarations for -@code{BIT_ORDER} and @code{DEFAULT_BIT_ORDER}. - -However, the use of the following pragma causes GNAT -to extend the definition of package @code{SYSTEM} so that it -encompasses the full set of HP-specific extensions, -including the functions listed above: - -@smallexample @c ada -@cartouche -pragma Extend_System (Aux_DEC); -@end cartouche -@end smallexample - -@noindent -The pragma @code{Extend_System} is a configuration pragma that -is most conveniently placed in the @file{gnat.adc} file. @xref{Pragma -Extend_System,,, gnat_rm, GNAT Reference Manual}, for further details. - -HP Ada does not allow the recompilation of the package -@code{SYSTEM}. Instead HP Ada provides several pragmas -(@code{SYSTEM_NAME}, @code{STORAGE_UNIT}, and @code{MEMORY_SIZE}) -to modify values in the package @code{SYSTEM}. -On OpenVMS Alpha systems, the pragma -@code{SYSTEM_NAME} takes the enumeration literal @code{OPENVMS_AXP} as -its single argument. - -GNAT does permit the recompilation of package @code{SYSTEM} using -the special switch @option{-gnatg}, and this switch can be used if -it is necessary to modify the definitions in @code{SYSTEM}. GNAT does -not permit the specification of @code{SYSTEM_NAME}, @code{STORAGE_UNIT} -or @code{MEMORY_SIZE} by any other means. - -On GNAT systems, the pragma @code{SYSTEM_NAME} takes the -enumeration literal @code{SYSTEM_NAME_GNAT}. - -The definitions provided by the use of - -@smallexample @c ada -pragma Extend_System (AUX_Dec); -@end smallexample - -@noindent -are virtually identical to those provided by the HP Ada 83 package -@code{SYSTEM}. One important difference is that the name of the -@code{TO_ADDRESS} -function for type @code{UNSIGNED_LONGWORD} is changed to -@code{TO_ADDRESS_LONG}. -@xref{Address Clauses,,, gnat_rm, GNAT Reference Manual}, for a -discussion of why this change was necessary. - -@noindent -The version of @code{TO_ADDRESS} taking a @i{universal_integer} argument -is in fact -an extension to Ada 83 not strictly compatible with the reference manual. -GNAT, in order to be exactly compatible with the standard, -does not provide this capability. In HP Ada 83, the -point of this definition is to deal with a call like: - -@smallexample @c ada -TO_ADDRESS (16#12777#); -@end smallexample - -@noindent -Normally, according to Ada 83 semantics, one would expect this to be -ambiguous, since it matches both the @code{INTEGER} and -@code{UNSIGNED_LONGWORD} forms of @code{TO_ADDRESS}. -However, in HP Ada 83, there is no ambiguity, since the -definition using @i{universal_integer} takes precedence. - -In GNAT, since the version with @i{universal_integer} cannot be supplied, -it is -not possible to be 100% compatible. Since there are many programs using -numeric constants for the argument to @code{TO_ADDRESS}, the decision in -GNAT was -to change the name of the function in the @code{UNSIGNED_LONGWORD} case, -so the declarations provided in the GNAT version of @code{AUX_Dec} are: - -@smallexample @c ada -function To_Address (X : Integer) return Address; -pragma Pure_Function (To_Address); - -function To_Address_Long (X : Unsigned_Longword) return Address; -pragma Pure_Function (To_Address_Long); -@end smallexample - -@noindent -This means that programs using @code{TO_ADDRESS} for -@code{UNSIGNED_LONGWORD} must change the name to @code{TO_ADDRESS_LONG}. - -@node Tasking and Task-Related Features -@section Tasking and Task-Related Features - -@noindent -This section compares the treatment of tasking in GNAT -and in HP Ada for OpenVMS Alpha. -The GNAT description applies to both Alpha and I64 OpenVMS. -For detailed information on tasking in -HP Ada, see the @cite{HP Ada Language Reference Manual} and the -relevant run-time reference manual. - -@menu -* Implementation of Tasks in HP Ada for OpenVMS Alpha Systems:: -* Assigning Task IDs:: -* Task IDs and Delays:: -* Task-Related Pragmas:: -* Scheduling and Task Priority:: -* The Task Stack:: -* External Interrupts:: -@end menu - -@node Implementation of Tasks in HP Ada for OpenVMS Alpha Systems -@subsection Implementation of Tasks in HP Ada for OpenVMS Alpha Systems - -@noindent -On OpenVMS Alpha systems, each Ada task (except a passive -task) is implemented as a single stream of execution -that is created and managed by the kernel. On these -systems, HP Ada tasking support is based on DECthreads, -an implementation of the POSIX standard for threads. - -Also, on OpenVMS Alpha systems, HP Ada tasks and foreign -code that calls DECthreads routines can be used together. -The interaction between Ada tasks and DECthreads routines -can have some benefits. For example when on OpenVMS Alpha, -HP Ada can call C code that is already threaded. - -GNAT uses the facilities of DECthreads, -and Ada tasks are mapped to threads. - -@node Assigning Task IDs -@subsection Assigning Task IDs - -@noindent -The HP Ada Run-Time Library always assigns @code{%TASK 1} to -the environment task that executes the main program. On -OpenVMS Alpha systems, @code{%TASK 0} is often used for tasks -that have been created but are not yet activated. - -On OpenVMS Alpha systems, task IDs are assigned at -activation. On GNAT systems, task IDs are also assigned at -task creation but do not have the same form or values as -task ID values in HP Ada. There is no null task, and the -environment task does not have a specific task ID value. - -@node Task IDs and Delays -@subsection Task IDs and Delays - -@noindent -On OpenVMS Alpha systems, tasking delays are implemented -using Timer System Services. The Task ID is used for the -identification of the timer request (the @code{REQIDT} parameter). -If Timers are used in the application take care not to use -@code{0} for the identification, because cancelling such a timer -will cancel all timers and may lead to unpredictable results. - -@node Task-Related Pragmas -@subsection Task-Related Pragmas - -@noindent -Ada supplies the pragma @code{TASK_STORAGE}, which allows -specification of the size of the guard area for a task -stack. (The guard area forms an area of memory that has no -read or write access and thus helps in the detection of -stack overflow.) On OpenVMS Alpha systems, if the pragma -@code{TASK_STORAGE} specifies a value of zero, a minimal guard -area is created. In the absence of a pragma @code{TASK_STORAGE}, -a default guard area is created. - -GNAT supplies the following task-related pragma: - -@itemize -@item @code{TASK_STORAGE} - -GNAT implements pragma @code{TASK_STORAGE} in the same way as HP Ada. -Both HP Ada and GNAT supply the pragmas @code{PASSIVE}, -@code{SUPPRESS}, and @code{VOLATILE}. -@end itemize - -@node Scheduling and Task Priority -@subsection Scheduling and Task Priority - -@noindent -HP Ada implements the Ada language requirement that -when two tasks are eligible for execution and they have -different priorities, the lower priority task does not -execute while the higher priority task is waiting. The HP -Ada Run-Time Library keeps a task running until either the -task is suspended or a higher priority task becomes ready. - -On OpenVMS Alpha systems, the default strategy is round- -robin with preemption. Tasks of equal priority take turns -at the processor. A task is run for a certain period of -time and then placed at the tail of the ready queue for -its priority level. - -HP Ada provides the implementation-defined pragma @code{TIME_SLICE}, -which can be used to enable or disable round-robin -scheduling of tasks with the same priority. -See the relevant HP Ada run-time reference manual for -information on using the pragmas to control HP Ada task -scheduling. - -GNAT follows the scheduling rules of Annex D (Real-Time -Annex) of the @cite{Ada Reference Manual}. In general, this -scheduling strategy is fully compatible with HP Ada -although it provides some additional constraints (as -fully documented in Annex D). -GNAT implements time slicing control in a manner compatible with -HP Ada 83, by means of the pragma @code{Time_Slice}, whose semantics -are identical to the HP Ada 83 pragma of the same name. -Note that it is not possible to mix GNAT tasking and -HP Ada 83 tasking in the same program, since the two run-time -libraries are not compatible. - -@node The Task Stack -@subsection The Task Stack - -@noindent -In HP Ada, a task stack is allocated each time a -non-passive task is activated. As soon as the task is -terminated, the storage for the task stack is deallocated. -If you specify a size of zero (bytes) with @code{T'STORAGE_SIZE}, -a default stack size is used. Also, regardless of the size -specified, some additional space is allocated for task -management purposes. On OpenVMS Alpha systems, at least -one page is allocated. - -GNAT handles task stacks in a similar manner. In accordance with -the Ada rules, it provides the pragma @code{STORAGE_SIZE} as -an alternative method for controlling the task stack size. -The specification of the attribute @code{T'STORAGE_SIZE} is also -supported in a manner compatible with HP Ada. - -@node External Interrupts -@subsection External Interrupts - -@noindent -On HP Ada, external interrupts can be associated with task entries. -GNAT is compatible with HP Ada in its handling of external interrupts. - -@node Pragmas and Pragma-Related Features -@section Pragmas and Pragma-Related Features - -@noindent -Both HP Ada and GNAT supply all language-defined pragmas -as specified by the Ada 83 standard. GNAT also supplies all -language-defined pragmas introduced by Ada 95 and Ada 2005. -In addition, GNAT implements the implementation-defined pragmas -from HP Ada 83. - -@itemize @bullet -@item @code{AST_ENTRY} - -@item @code{COMMON_OBJECT} - -@item @code{COMPONENT_ALIGNMENT} - -@item @code{EXPORT_EXCEPTION} - -@item @code{EXPORT_FUNCTION} - -@item @code{EXPORT_OBJECT} - -@item @code{EXPORT_PROCEDURE} - -@item @code{EXPORT_VALUED_PROCEDURE} - -@item @code{FLOAT_REPRESENTATION} - -@item @code{IDENT} - -@item @code{IMPORT_EXCEPTION} - -@item @code{IMPORT_FUNCTION} - -@item @code{IMPORT_OBJECT} - -@item @code{IMPORT_PROCEDURE} - -@item @code{IMPORT_VALUED_PROCEDURE} - -@item @code{INLINE_GENERIC} - -@item @code{INTERFACE_NAME} - -@item @code{LONG_FLOAT} - -@item @code{MAIN_STORAGE} - -@item @code{PASSIVE} - -@item @code{PSECT_OBJECT} - -@item @code{SHARE_GENERIC} - -@item @code{SUPPRESS_ALL} - -@item @code{TASK_STORAGE} - -@item @code{TIME_SLICE} - -@item @code{TITLE} -@end itemize - -@noindent -These pragmas are all fully implemented, with the exception of @code{TITLE}, -@code{PASSIVE}, and @code{SHARE_GENERIC}, which are -recognized, but which have no -effect in GNAT. The effect of @code{PASSIVE} may be obtained by the -use of Ada protected objects. In GNAT, all generics are inlined. - -Unlike HP Ada, the GNAT ``@code{EXPORT_}@i{subprogram}'' pragmas require -a separate subprogram specification which must appear before the -subprogram body. - -GNAT also supplies a number of implementation-defined pragmas including the -following: - -@itemize @bullet -@item @code{ABORT_DEFER} - -@item @code{ADA_83} - -@item @code{ADA_95} - -@item @code{ADA_05} - -@item @code{Ada_2005} - -@item @code{Ada_12} - -@item @code{Ada_2012} - -@item @code{ALLOW_INTEGER_ADDRESS} - -@item @code{ANNOTATE} - -@item @code{ASSERT} - -@item @code{C_PASS_BY_COPY} - -@item @code{CPP_CLASS} - -@item @code{CPP_CONSTRUCTOR} - -@item @code{CPP_DESTRUCTOR} - -@item @code{DEBUG} - -@item @code{EXTEND_SYSTEM} - -@item @code{LINKER_ALIAS} - -@item @code{LINKER_SECTION} - -@item @code{MACHINE_ATTRIBUTE} - -@item @code{NO_RETURN} - -@item @code{PURE_FUNCTION} - -@item @code{SOURCE_FILE_NAME} - -@item @code{SOURCE_REFERENCE} - -@item @code{UNCHECKED_UNION} - -@item @code{UNIMPLEMENTED_UNIT} - -@item @code{UNIVERSAL_DATA} - -@item @code{UNSUPPRESS} - -@item @code{WARNINGS} - -@item @code{WEAK_EXTERNAL} -@end itemize - -@noindent -For full details on these and other GNAT implementation-defined pragmas, -see @ref{Implementation Defined Pragmas,,, gnat_rm, GNAT Reference -Manual}. - -@menu -* Restrictions on the Pragma INLINE:: -* Restrictions on the Pragma INTERFACE:: -* Restrictions on the Pragma SYSTEM_NAME:: -@end menu - -@node Restrictions on the Pragma INLINE -@subsection Restrictions on Pragma @code{INLINE} - -@noindent -HP Ada enforces the following restrictions on the pragma @code{INLINE}: -@itemize @bullet -@item Parameters cannot have a task type. - -@item Function results cannot be task types, unconstrained -array types, or unconstrained types with discriminants. - -@item Bodies cannot declare the following: -@itemize @bullet -@item Subprogram body or stub (imported subprogram is allowed) - -@item Tasks - -@item Generic declarations - -@item Instantiations - -@item Exceptions - -@item Access types (types derived from access types allowed) - -@item Array or record types - -@item Dependent tasks - -@item Direct recursive calls of subprogram or containing -subprogram, directly or via a renaming - -@end itemize -@end itemize - -@noindent -In GNAT, the only restriction on pragma @code{INLINE} is that the -body must occur before the call if both are in the same -unit, and the size must be appropriately small. There are -no other specific restrictions which cause subprograms to -be incapable of being inlined. - -@node Restrictions on the Pragma INTERFACE -@subsection Restrictions on Pragma @code{INTERFACE} - -@noindent -The following restrictions on pragma @code{INTERFACE} -are enforced by both HP Ada and GNAT: -@itemize @bullet -@item Languages accepted: Ada, Bliss, C, Fortran, Default. -Default is the default on OpenVMS Alpha systems. - -@item Parameter passing: Language specifies default -mechanisms but can be overridden with an @code{EXPORT} pragma. - -@itemize @bullet -@item Ada: Use internal Ada rules. - -@item Bliss, C: Parameters must be mode @code{in}; cannot be -record or task type. Result cannot be a string, an -array, or a record. - -@item Fortran: Parameters cannot have a task type. Result cannot -be a string, an array, or a record. -@end itemize -@end itemize - -@noindent -GNAT is entirely upwards compatible with HP Ada, and in addition allows -record parameters for all languages. - -@node Restrictions on the Pragma SYSTEM_NAME -@subsection Restrictions on Pragma @code{SYSTEM_NAME} - -@noindent -For HP Ada for OpenVMS Alpha, the enumeration literal -for the type @code{NAME} is @code{OPENVMS_AXP}. -In GNAT, the enumeration -literal for the type @code{NAME} is @code{SYSTEM_NAME_GNAT}. - -@node Library of Predefined Units -@section Library of Predefined Units - -@noindent -A library of predefined units is provided as part of the -HP Ada and GNAT implementations. HP Ada does not provide -the package @code{MACHINE_CODE} but instead recommends importing -assembler code. - -The GNAT versions of the HP Ada Run-Time Library (@code{ADA$PREDEFINED:}) -units are taken from the OpenVMS Alpha version, not the OpenVMS VAX -version. -The HP Ada Predefined Library units are modified to remove post-Ada 83 -incompatibilities and to make them interoperable with GNAT -(@pxref{Changes to DECLIB}, for details). -The units are located in the @file{DECLIB} directory. - -The GNAT RTL is contained in -the @file{ADALIB} directory, and -the default search path is set up to find @code{DECLIB} units in preference -to @code{ADALIB} units with the same name (@code{TEXT_IO}, -@code{SEQUENTIAL_IO}, and @code{DIRECT_IO}, for example). - -@menu -* Changes to DECLIB:: -@end menu - -@node Changes to DECLIB -@subsection Changes to @code{DECLIB} - -@noindent -The changes made to the HP Ada predefined library for GNAT and post-Ada 83 -compatibility are minor and include the following: - -@itemize @bullet -@item Adjusting the location of pragmas and record representation -clauses to obey Ada 95 (and thus Ada 2005) rules - -@item Adding the proper notation to generic formal parameters -that take unconstrained types in instantiation - -@item Adding pragma @code{ELABORATE_BODY} to package specs -that have package bodies not otherwise allowed - -@item Replacing occurrences of the identifier ``@code{PROTECTED}'' by -``@code{PROTECTD}''. -Currently these are found only in the @code{STARLET} package spec. - -@item Changing @code{SYSTEM.ADDRESS} to @code{SYSTEM.SHORT_ADDRESS} -where the address size is constrained to 32 bits. -@end itemize - -@noindent -None of the above changes is visible to users. - -@node Bindings -@section Bindings - -@noindent -On OpenVMS Alpha, HP Ada provides the following strongly-typed bindings: -@itemize @bullet - -@item Command Language Interpreter (CLI interface) - -@item DECtalk Run-Time Library (DTK interface) - -@item Librarian utility routines (LBR interface) - -@item General Purpose Run-Time Library (LIB interface) - -@item Math Run-Time Library (MTH interface) - -@item National Character Set Run-Time Library (NCS interface) - -@item Compiled Code Support Run-Time Library (OTS interface) - -@item Parallel Processing Run-Time Library (PPL interface) - -@item Screen Management Run-Time Library (SMG interface) - -@item Sort Run-Time Library (SOR interface) - -@item String Run-Time Library (STR interface) - -@item STARLET System Library -@findex Starlet - -@item X Window System Version 11R4 and 11R5 (X, XLIB interface) - -@item X Windows Toolkit (XT interface) - -@item X/Motif Version 1.1.3 and 1.2 (XM interface) -@end itemize - -@noindent -GNAT provides implementations of these HP bindings in the @code{DECLIB} -directory, on both the Alpha and I64 OpenVMS platforms. - -The X components of DECLIB compatibility package are located in a separate -library, called XDECGNAT, which is not linked with by default; this library -must be explicitly linked with any application that makes use of any X facilities, -with a command similar to - -@code{GNAT MAKE USE_X /LINK /LIBRARY=XDECGNAT} - -The X/Motif bindings used to build @code{DECLIB} are whatever versions are -in the -HP Ada @file{ADA$PREDEFINED} directory with extension @file{.ADC}. -A pragma @code{Linker_Options} has been added to packages @code{Xm}, -@code{Xt}, and @code{X_Lib} -causing the default X/Motif sharable image libraries to be linked in. This -is done via options files named @file{xm.opt}, @file{xt.opt}, and -@file{x_lib.opt} (also located in the @file{DECLIB} directory). - -It may be necessary to edit these options files to update or correct the -library names if, for example, the newer X/Motif bindings from -@file{ADA$EXAMPLES} -had been (previous to installing GNAT) copied and renamed to supersede the -default @file{ADA$PREDEFINED} versions. - -@menu -* Shared Libraries and Options Files:: -* Interfaces to C:: -@end menu - -@node Shared Libraries and Options Files -@subsection Shared Libraries and Options Files - -@noindent -When using the HP Ada -predefined X and Motif bindings, the linking with their sharable images is -done automatically by @command{GNAT LINK}. -When using other X and Motif bindings, you need -to add the corresponding sharable images to the command line for -@code{GNAT LINK}. When linking with shared libraries, or with -@file{.OPT} files, you must -also add them to the command line for @command{GNAT LINK}. - -A shared library to be used with GNAT is built in the same way as other -libraries under VMS. The VMS Link command can be used in standard fashion. - -@node Interfaces to C -@subsection Interfaces to C - -@noindent -HP Ada -provides the following Ada types and operations: - -@itemize @bullet -@item C types package (@code{C_TYPES}) - -@item C strings (@code{C_TYPES.NULL_TERMINATED}) - -@item Other_types (@code{SHORT_INT}) -@end itemize - -@noindent -Interfacing to C with GNAT, you can use the above approach -described for HP Ada or the facilities of Annex B of -the @cite{Ada Reference Manual} (packages @code{INTERFACES.C}, -@code{INTERFACES.C.STRINGS} and @code{INTERFACES.C.POINTERS}). For more -information, see @ref{Interfacing to C,,, gnat_rm, GNAT Reference Manual}. - -The @option{-gnatF} qualifier forces default and explicit -@code{External_Name} parameters in pragmas @code{Import} and @code{Export} -to be uppercased for compatibility with the default behavior -of HP C. The qualifier has no effect on @code{Link_Name} parameters. - -@node Main Program Definition -@section Main Program Definition - -@noindent -The following section discusses differences in the -definition of main programs on HP Ada and GNAT. -On HP Ada, main programs are defined to meet the -following conditions: -@itemize @bullet -@item Procedure with no formal parameters (returns @code{0} upon -normal completion) - -@item Procedure with no formal parameters (returns @code{42} when -an unhandled exception is raised) - -@item Function with no formal parameters whose returned value -is of a discrete type - -@item Procedure with one @code{out} formal of a discrete type for -which a specification of pragma @code{EXPORT_VALUED_PROCEDURE} is given. - -@end itemize - -@noindent -When declared with the pragma @code{EXPORT_VALUED_PROCEDURE}, -a main function or main procedure returns a discrete -value whose size is less than 64 bits (32 on VAX systems), -the value is zero- or sign-extended as appropriate. -On GNAT, main programs are defined as follows: -@itemize @bullet -@item Must be a non-generic, parameterless subprogram that -is either a procedure or function returning an Ada -@code{STANDARD.INTEGER} (the predefined type) - -@item Cannot be a generic subprogram or an instantiation of a -generic subprogram -@end itemize - -@node Implementation-Defined Attributes -@section Implementation-Defined Attributes - -@noindent -GNAT provides all HP Ada implementation-defined -attributes. - -@node Compiler and Run-Time Interfacing -@section Compiler and Run-Time Interfacing - -@noindent -HP Ada provides the following qualifiers to pass options to the linker -(ACS LINK): -@itemize @bullet -@item @option{/WAIT} and @option{/SUBMIT} - -@item @option{/COMMAND} - -@item @option{/@r{[}NO@r{]}MAP} - -@item @option{/OUTPUT=@var{file-spec}} - -@item @option{/@r{[}NO@r{]}DEBUG} and @option{/@r{[}NO@r{]}TRACEBACK} -@end itemize - -@noindent -To pass options to the linker, GNAT provides the following -switches: - -@itemize @bullet -@item @option{/EXECUTABLE=@var{exec-name}} - -@item @option{/VERBOSE} - -@item @option{/@r{[}NO@r{]}DEBUG} and @option{/@r{[}NO@r{]}TRACEBACK} -@end itemize - -@noindent -For more information on these switches, see -@ref{Switches for gnatlink}. -In HP Ada, the command-line switch @option{/OPTIMIZE} is available -to control optimization. HP Ada also supplies the -following pragmas: -@itemize @bullet -@item @code{OPTIMIZE} - -@item @code{INLINE} - -@item @code{INLINE_GENERIC} - -@item @code{SUPPRESS_ALL} - -@item @code{PASSIVE} -@end itemize - -@noindent -In GNAT, optimization is controlled strictly by command -line parameters, as described in the corresponding section of this guide. -The HP pragmas for control of optimization are -recognized but ignored. - -Note that in GNAT, the default is optimization off, whereas in HP Ada -the default is that optimization is turned on. - -@node Program Compilation and Library Management -@section Program Compilation and Library Management - -@noindent -HP Ada and GNAT provide a comparable set of commands to -build programs. HP Ada also provides a program library, -which is a concept that does not exist on GNAT. Instead, -GNAT provides directories of sources that are compiled as -needed. - -The following table summarizes -the HP Ada commands and provides -equivalent GNAT commands. In this table, some GNAT -equivalents reflect the fact that GNAT does not use the -concept of a program library. Instead, it uses a model -in which collections of source and object files are used -in a manner consistent with other languages like C and -Fortran. Therefore, standard system file commands are used -to manipulate these elements. Those GNAT commands are marked with -an asterisk. -Note that, unlike HP Ada, none of the GNAT commands accepts wild cards. - -@need 1500 -@multitable @columnfractions .35 .65 - -@item @emph{HP Ada Command} -@tab @emph{GNAT Equivalent / Description} - -@item @command{ADA} -@tab @command{GNAT COMPILE}@* -Invokes the compiler to compile one or more Ada source files. - -@item @command{ACS ATTACH}@* -@tab [No equivalent]@* -Switches control of terminal from current process running the program -library manager. - -@item @command{ACS CHECK} -@tab @command{GNAT MAKE /DEPENDENCY_LIST}@* -Forms the execution closure of one -or more compiled units and checks completeness and currency. - -@item @command{ACS COMPILE} -@tab @command{GNAT MAKE /ACTIONS=COMPILE}@* -Forms the execution closure of one or -more specified units, checks completeness and currency, -identifies units that have revised source files, compiles same, -and recompiles units that are or will become obsolete. -Also completes incomplete generic instantiations. - -@item @command{ACS COPY FOREIGN} -@tab Copy (*)@* -Copies a foreign object file into the program library as a -library unit body. - -@item @command{ACS COPY UNIT} -@tab Copy (*)@* -Copies a compiled unit from one program library to another. - -@item @command{ACS CREATE LIBRARY} -@tab Create /directory (*)@* -Creates a program library. - -@item @command{ACS CREATE SUBLIBRARY} -@tab Create /directory (*)@* -Creates a program sublibrary. - -@item @command{ACS DELETE LIBRARY} -@tab @* -Deletes a program library and its contents. - -@item @command{ACS DELETE SUBLIBRARY} -@tab @* -Deletes a program sublibrary and its contents. - -@item @command{ACS DELETE UNIT} -@tab Delete file (*)@* -On OpenVMS systems, deletes one or more compiled units from -the current program library. - -@item @command{ACS DIRECTORY} -@tab Directory (*)@* -On OpenVMS systems, lists units contained in the current -program library. - -@item @command{ACS ENTER FOREIGN} -@tab Copy (*)@* -Allows the import of a foreign body as an Ada library -spec and enters a reference to a pointer. - -@item @command{ACS ENTER UNIT} -@tab Copy (*)@* -Enters a reference (pointer) from the current program library to -a unit compiled into another program library. - -@item @command{ACS EXIT} -@tab [No equivalent]@* -Exits from the program library manager. - -@item @command{ACS EXPORT} -@tab Copy (*)@* -Creates an object file that contains system-specific object code -for one or more units. With GNAT, object files can simply be copied -into the desired directory. - -@item @command{ACS EXTRACT SOURCE} -@tab Copy (*)@* -Allows access to the copied source file for each Ada compilation unit - -@item @command{ACS HELP} -@tab @command{HELP GNAT}@* -Provides online help. - -@item @command{ACS LINK} -@tab @command{GNAT LINK}@* -Links an object file containing Ada units into an executable file. - -@item @command{ACS LOAD} -@tab Copy (*)@* -Loads (partially compiles) Ada units into the program library. -Allows loading a program from a collection of files into a library -without knowing the relationship among units. - -@item @command{ACS MERGE} -@tab Copy (*)@* -Merges into the current program library, one or more units from -another library where they were modified. - -@item @command{ACS RECOMPILE} -@tab @command{GNAT MAKE /ACTIONS=COMPILE}@* -Recompiles from external or copied source files any obsolete -unit in the closure. Also, completes any incomplete generic -instantiations. - -@item @command{ACS REENTER} -@tab @command{GNAT MAKE}@* -Reenters current references to units compiled after last entered -with the @command{ACS ENTER UNIT} command. - -@item @command{ACS SET LIBRARY} -@tab Set default (*)@* -Defines a program library to be the compilation context as well -as the target library for compiler output and commands in general. - -@item @command{ACS SET PRAGMA} -@tab Edit @file{gnat.adc} (*)@* -Redefines specified values of the library characteristics -@code{LONG_ FLOAT}, @code{MEMORY_SIZE}, @code{SYSTEM_NAME}, -and @code{Float_Representation}. - -@item @command{ACS SET SOURCE} -@tab Define @code{ADA_INCLUDE_PATH} path (*)@* -Defines the source file search list for the @command{ACS COMPILE} command. - -@item @command{ACS SHOW LIBRARY} -@tab Directory (*)@* -Lists information about one or more program libraries. - -@item @command{ACS SHOW PROGRAM} -@tab [No equivalent]@* -Lists information about the execution closure of one or -more units in the program library. - -@item @command{ACS SHOW SOURCE} -@tab Show logical @code{ADA_INCLUDE_PATH}@* -Shows the source file search used when compiling units. - -@item @command{ACS SHOW VERSION} -@tab Compile with @option{VERBOSE} option -Displays the version number of the compiler and program library -manager used. - -@item @command{ACS SPAWN} -@tab [No equivalent]@* -Creates a subprocess of the current process (same as @command{DCL SPAWN} -command). - -@item @command{ACS VERIFY} -@tab [No equivalent]@* -Performs a series of consistency checks on a program library to -determine whether the library structure and library files are in -valid form. -@end multitable - -@noindent - -@node Input-Output -@section Input-Output - -@noindent -On OpenVMS Alpha systems, HP Ada uses OpenVMS Record -Management Services (RMS) to perform operations on -external files. - -@noindent -HP Ada and GNAT predefine an identical set of input- -output packages. To make the use of the -generic @code{TEXT_IO} operations more convenient, HP Ada -provides predefined library packages that instantiate the -integer and floating-point operations for the predefined -integer and floating-point types as shown in the following table. - -@multitable @columnfractions .45 .55 -@item @emph{Package Name} @tab Instantiation - -@item @code{INTEGER_TEXT_IO} -@tab @code{INTEGER_IO(INTEGER)} - -@item @code{SHORT_INTEGER_TEXT_IO} -@tab @code{INTEGER_IO(SHORT_INTEGER)} - -@item @code{SHORT_SHORT_INTEGER_TEXT_IO} -@tab @code{INTEGER_IO(SHORT_SHORT_INTEGER)} - -@item @code{FLOAT_TEXT_IO} -@tab @code{FLOAT_IO(FLOAT)} - -@item @code{LONG_FLOAT_TEXT_IO} -@tab @code{FLOAT_IO(LONG_FLOAT)} -@end multitable - -@noindent -The HP Ada predefined packages and their operations -are implemented using OpenVMS Alpha files and input-output -facilities. HP Ada supports asynchronous input-output on OpenVMS Alpha. -Familiarity with the following is recommended: -@itemize @bullet -@item RMS file organizations and access methods - -@item OpenVMS file specifications and directories - -@item OpenVMS File Definition Language (FDL) -@end itemize - -@noindent -GNAT provides I/O facilities that are completely -compatible with HP Ada. The distribution includes the -standard HP Ada versions of all I/O packages, operating -in a manner compatible with HP Ada. In particular, the -following packages are by default the HP Ada (Ada 83) -versions of these packages rather than the renamings -suggested in Annex J of the Ada Reference Manual: -@itemize @bullet -@item @code{TEXT_IO} - -@item @code{SEQUENTIAL_IO} - -@item @code{DIRECT_IO} -@end itemize - -@noindent -The use of the standard child package syntax (for -example, @code{ADA.TEXT_IO}) retrieves the post-Ada 83 versions of these -packages. -GNAT provides HP-compatible predefined instantiations -of the @code{TEXT_IO} packages, and also -provides the standard predefined instantiations required -by the @cite{Ada Reference Manual}. - -For further information on how GNAT interfaces to the file -system or how I/O is implemented in programs written in -mixed languages, see @ref{Implementation of the Standard I/O,,, -gnat_rm, GNAT Reference Manual}. -This chapter covers the following: -@itemize @bullet -@item Standard I/O packages - -@item @code{FORM} strings - -@item @code{ADA.DIRECT_IO} - -@item @code{ADA.SEQUENTIAL_IO} - -@item @code{ADA.TEXT_IO} - -@item Stream pointer positioning - -@item Reading and writing non-regular files - -@item @code{GET_IMMEDIATE} - -@item Treating @code{TEXT_IO} files as streams - -@item Shared files - -@item Open modes -@end itemize - -@node Implementation Limits -@section Implementation Limits - -@noindent -The following table lists implementation limits for HP Ada -and GNAT systems. -@multitable @columnfractions .60 .20 .20 -@sp 1 -@item @emph{Compilation Parameter} -@tab @emph{HP Ada} -@tab @emph{GNAT} -@sp 1 - -@item In a subprogram or entry declaration, maximum number of -formal parameters that are of an unconstrained record type -@tab 32 -@tab No set limit -@sp 1 - -@item Maximum identifier length (number of characters) -@tab 255 -@tab 32766 -@sp 1 - -@item Maximum number of characters in a source line -@tab 255 -@tab 32766 -@sp 1 - -@item Maximum collection size (number of bytes) -@tab 2**31-1 -@tab 2**31-1 -@sp 1 - -@item Maximum number of discriminants for a record type -@tab 245 -@tab No set limit -@sp 1 - -@item Maximum number of formal parameters in an entry or -subprogram declaration -@tab 246 -@tab No set limit -@sp 1 - -@item Maximum number of dimensions in an array type -@tab 255 -@tab No set limit -@sp 1 - -@item Maximum number of library units and subunits in a compilation. -@tab 4095 -@tab No set limit -@sp 1 - -@item Maximum number of library units and subunits in an execution. -@tab 16383 -@tab No set limit -@sp 1 - -@item Maximum number of objects declared with the pragma @code{COMMON_OBJECT} -or @code{PSECT_OBJECT} -@tab 32757 -@tab No set limit -@sp 1 - -@item Maximum number of enumeration literals in an enumeration type -definition -@tab 65535 -@tab No set limit -@sp 1 - -@item Maximum number of lines in a source file -@tab 65534 -@tab No set limit -@sp 1 - -@item Maximum number of bits in any object -@tab 2**31-1 -@tab 2**31-1 -@sp 1 - -@item Maximum size of the static portion of a stack frame (approximate) -@tab 2**31-1 -@tab 2**31-1 -@end multitable - -@node Tools and Utilities -@section Tools and Utilities - -@noindent -The following table lists some of the OpenVMS development tools -available for HP Ada, and the corresponding tools for -use with @value{EDITION} on Alpha and I64 platforms. -Aside from the debugger, all the OpenVMS tools identified are part -of the DECset package. - -@iftex -@c Specify table in TeX since Texinfo does a poor job -@tex -\smallskip -\smallskip -\settabs\+Language-Sensitive Editor\quad - &Product with HP Ada\quad - &\cr -\+\it Tool - &\it Product with HP Ada - & \it Product with @value{EDITION}\cr -\smallskip -\+Code Management System - &HP CMS - & HP CMS\cr -\smallskip -\+Language-Sensitive Editor - &HP LSE - & emacs or HP LSE (Alpha)\cr -\+ - & - & HP LSE (I64)\cr -\smallskip -\+Debugger - &OpenVMS Debug - & gdb (Alpha),\cr -\+ - & - & OpenVMS Debug (I64)\cr -\smallskip -\+Source Code Analyzer / - &HP SCA - & GNAT XREF\cr -\+Cross Referencer - & - &\cr -\smallskip -\+Test Manager - &HP Digital Test - & HP DTM\cr -\+ - &Manager (DTM) - &\cr -\smallskip -\+Performance and - & HP PCA - & HP PCA\cr -\+Coverage Analyzer - & - &\cr -\smallskip -\+Module Management - & HP MMS - & Not applicable\cr -\+ System - & - &\cr -\smallskip -\smallskip -@end tex -@end iftex - -@ifnottex -@c This is the Texinfo version of the table. It renders poorly in pdf, hence -@c the TeX version above for the printed version -@flushleft -@c @multitable @columnfractions .3 .4 .4 -@multitable {Source Code Analyzer /}{Tool with HP Ada}{Tool with @value{EDITION}} -@item @i{Tool} -@tab @i{Tool with HP Ada} -@tab @i{Tool with @value{EDITION}} -@item Code Management@*System -@tab HP CMS -@tab HP CMS -@item Language-Sensitive@*Editor -@tab HP LSE -@tab emacs or HP LSE (Alpha) -@item -@tab -@tab HP LSE (I64) -@item Debugger -@tab OpenVMS Debug -@tab gdb (Alpha), -@item -@tab -@tab OpenVMS Debug (I64) -@item Source Code Analyzer /@*Cross Referencer -@tab HP SCA -@tab GNAT XREF -@item Test Manager -@tab HP Digital Test@*Manager (DTM) -@tab HP DTM -@item Performance and@*Coverage Analyzer -@tab HP PCA -@tab HP PCA -@item Module Management@*System -@tab HP MMS -@tab Not applicable -@end multitable -@end flushleft -@end ifnottex - -@end ifset @c ************************************** @node Platform-Specific Information for the Run-Time Libraries @@ -24698,11 +22094,11 @@ Comments have been added for clarification purposes. -- as a unit name in the partition, in which case some other unique -- name is used. -with System; -package ada_main is +@b{with} System; +@b{package} ada_main @b{is} Elab_Final_Code : Integer; - pragma Import (C, Elab_Final_Code, "__gnat_inside_elab_final_code"); + @b{pragma} Import (C, Elab_Final_Code, "__gnat_inside_elab_final_code"); -- The main program saves the parameters (argument count, -- argument values, environment pointer) in global variables @@ -24717,53 +22113,53 @@ package ada_main is -- is useful for some shared library situations, where there -- are problems if variables are not in the library. - pragma Import (C, gnat_argc); - pragma Import (C, gnat_argv); - pragma Import (C, gnat_envp); + @b{pragma} Import (C, gnat_argc); + @b{pragma} Import (C, gnat_argv); + @b{pragma} Import (C, gnat_envp); -- The exit status is similarly an external location gnat_exit_status : Integer; - pragma Import (C, gnat_exit_status); + @b{pragma} Import (C, gnat_exit_status); - GNAT_Version : constant String := + GNAT_Version : @b{constant} String := "GNAT Version: 6.0.0w (20061115)"; - pragma Export (C, GNAT_Version, "__gnat_version"); + @b{pragma} Export (C, GNAT_Version, "__gnat_version"); -- This is the generated adafinal routine that performs -- finalization at the end of execution. In the case where -- Ada is the main program, this main program makes a call -- to adafinal at program termination. - procedure adafinal; - pragma Export (C, adafinal, "adafinal"); + @b{procedure} adafinal; + @b{pragma} Export (C, adafinal, "adafinal"); -- This is the generated adainit routine that performs -- initialization at the start of execution. In the case -- where Ada is the main program, this main program makes -- a call to adainit at program startup. - procedure adainit; - pragma Export (C, adainit, "adainit"); + @b{procedure} adainit; + @b{pragma} Export (C, adainit, "adainit"); -- This routine is called at the start of execution. It is -- a dummy routine that is used by the debugger to breakpoint -- at the start of execution. - procedure Break_Start; - pragma Import (C, Break_Start, "__gnat_break_start"); + @b{procedure} Break_Start; + @b{pragma} Import (C, Break_Start, "__gnat_break_start"); -- This is the actual generated main program (it would be -- suppressed if the no main program switch were used). As -- required by standard system conventions, this program has -- the external name main. - function main + @b{function} main (argc : Integer; argv : System.Address; envp : System.Address) - return Integer; - pragma Export (C, main, "main"); + @b{return} Integer; + @b{pragma} Export (C, main, "main"); -- The following set of constants give the version -- identification values for every unit in the bound @@ -24772,64 +22168,64 @@ package ada_main is -- string that would be returned by use of the -- Body_Version or Version attributes. - type Version_32 is mod 2 ** 32; - u00001 : constant Version_32 := 16#7880BEB3#; - u00002 : constant Version_32 := 16#0D24CBD0#; - u00003 : constant Version_32 := 16#3283DBEB#; - u00004 : constant Version_32 := 16#2359F9ED#; - u00005 : constant Version_32 := 16#664FB847#; - u00006 : constant Version_32 := 16#68E803DF#; - u00007 : constant Version_32 := 16#5572E604#; - u00008 : constant Version_32 := 16#46B173D8#; - u00009 : constant Version_32 := 16#156A40CF#; - u00010 : constant Version_32 := 16#033DABE0#; - u00011 : constant Version_32 := 16#6AB38FEA#; - u00012 : constant Version_32 := 16#22B6217D#; - u00013 : constant Version_32 := 16#68A22947#; - u00014 : constant Version_32 := 16#18CC4A56#; - u00015 : constant Version_32 := 16#08258E1B#; - u00016 : constant Version_32 := 16#367D5222#; - u00017 : constant Version_32 := 16#20C9ECA4#; - u00018 : constant Version_32 := 16#50D32CB6#; - u00019 : constant Version_32 := 16#39A8BB77#; - u00020 : constant Version_32 := 16#5CF8FA2B#; - u00021 : constant Version_32 := 16#2F1EB794#; - u00022 : constant Version_32 := 16#31AB6444#; - u00023 : constant Version_32 := 16#1574B6E9#; - u00024 : constant Version_32 := 16#5109C189#; - u00025 : constant Version_32 := 16#56D770CD#; - u00026 : constant Version_32 := 16#02F9DE3D#; - u00027 : constant Version_32 := 16#08AB6B2C#; - u00028 : constant Version_32 := 16#3FA37670#; - u00029 : constant Version_32 := 16#476457A0#; - u00030 : constant Version_32 := 16#731E1B6E#; - u00031 : constant Version_32 := 16#23C2E789#; - u00032 : constant Version_32 := 16#0F1BD6A1#; - u00033 : constant Version_32 := 16#7C25DE96#; - u00034 : constant Version_32 := 16#39ADFFA2#; - u00035 : constant Version_32 := 16#571DE3E7#; - u00036 : constant Version_32 := 16#5EB646AB#; - u00037 : constant Version_32 := 16#4249379B#; - u00038 : constant Version_32 := 16#0357E00A#; - u00039 : constant Version_32 := 16#3784FB72#; - u00040 : constant Version_32 := 16#2E723019#; - u00041 : constant Version_32 := 16#623358EA#; - u00042 : constant Version_32 := 16#107F9465#; - u00043 : constant Version_32 := 16#6843F68A#; - u00044 : constant Version_32 := 16#63305874#; - u00045 : constant Version_32 := 16#31E56CE1#; - u00046 : constant Version_32 := 16#02917970#; - u00047 : constant Version_32 := 16#6CCBA70E#; - u00048 : constant Version_32 := 16#41CD4204#; - u00049 : constant Version_32 := 16#572E3F58#; - u00050 : constant Version_32 := 16#20729FF5#; - u00051 : constant Version_32 := 16#1D4F93E8#; - u00052 : constant Version_32 := 16#30B2EC3D#; - u00053 : constant Version_32 := 16#34054F96#; - u00054 : constant Version_32 := 16#5A199860#; - u00055 : constant Version_32 := 16#0E7F912B#; - u00056 : constant Version_32 := 16#5760634A#; - u00057 : constant Version_32 := 16#5D851835#; + @b{type} Version_32 @b{is} @b{mod} 2 ** 32; + u00001 : @b{constant} Version_32 := 16#7880BEB3#; + u00002 : @b{constant} Version_32 := 16#0D24CBD0#; + u00003 : @b{constant} Version_32 := 16#3283DBEB#; + u00004 : @b{constant} Version_32 := 16#2359F9ED#; + u00005 : @b{constant} Version_32 := 16#664FB847#; + u00006 : @b{constant} Version_32 := 16#68E803DF#; + u00007 : @b{constant} Version_32 := 16#5572E604#; + u00008 : @b{constant} Version_32 := 16#46B173D8#; + u00009 : @b{constant} Version_32 := 16#156A40CF#; + u00010 : @b{constant} Version_32 := 16#033DABE0#; + u00011 : @b{constant} Version_32 := 16#6AB38FEA#; + u00012 : @b{constant} Version_32 := 16#22B6217D#; + u00013 : @b{constant} Version_32 := 16#68A22947#; + u00014 : @b{constant} Version_32 := 16#18CC4A56#; + u00015 : @b{constant} Version_32 := 16#08258E1B#; + u00016 : @b{constant} Version_32 := 16#367D5222#; + u00017 : @b{constant} Version_32 := 16#20C9ECA4#; + u00018 : @b{constant} Version_32 := 16#50D32CB6#; + u00019 : @b{constant} Version_32 := 16#39A8BB77#; + u00020 : @b{constant} Version_32 := 16#5CF8FA2B#; + u00021 : @b{constant} Version_32 := 16#2F1EB794#; + u00022 : @b{constant} Version_32 := 16#31AB6444#; + u00023 : @b{constant} Version_32 := 16#1574B6E9#; + u00024 : @b{constant} Version_32 := 16#5109C189#; + u00025 : @b{constant} Version_32 := 16#56D770CD#; + u00026 : @b{constant} Version_32 := 16#02F9DE3D#; + u00027 : @b{constant} Version_32 := 16#08AB6B2C#; + u00028 : @b{constant} Version_32 := 16#3FA37670#; + u00029 : @b{constant} Version_32 := 16#476457A0#; + u00030 : @b{constant} Version_32 := 16#731E1B6E#; + u00031 : @b{constant} Version_32 := 16#23C2E789#; + u00032 : @b{constant} Version_32 := 16#0F1BD6A1#; + u00033 : @b{constant} Version_32 := 16#7C25DE96#; + u00034 : @b{constant} Version_32 := 16#39ADFFA2#; + u00035 : @b{constant} Version_32 := 16#571DE3E7#; + u00036 : @b{constant} Version_32 := 16#5EB646AB#; + u00037 : @b{constant} Version_32 := 16#4249379B#; + u00038 : @b{constant} Version_32 := 16#0357E00A#; + u00039 : @b{constant} Version_32 := 16#3784FB72#; + u00040 : @b{constant} Version_32 := 16#2E723019#; + u00041 : @b{constant} Version_32 := 16#623358EA#; + u00042 : @b{constant} Version_32 := 16#107F9465#; + u00043 : @b{constant} Version_32 := 16#6843F68A#; + u00044 : @b{constant} Version_32 := 16#63305874#; + u00045 : @b{constant} Version_32 := 16#31E56CE1#; + u00046 : @b{constant} Version_32 := 16#02917970#; + u00047 : @b{constant} Version_32 := 16#6CCBA70E#; + u00048 : @b{constant} Version_32 := 16#41CD4204#; + u00049 : @b{constant} Version_32 := 16#572E3F58#; + u00050 : @b{constant} Version_32 := 16#20729FF5#; + u00051 : @b{constant} Version_32 := 16#1D4F93E8#; + u00052 : @b{constant} Version_32 := 16#30B2EC3D#; + u00053 : @b{constant} Version_32 := 16#34054F96#; + u00054 : @b{constant} Version_32 := 16#5A199860#; + u00055 : @b{constant} Version_32 := 16#0E7F912B#; + u00056 : @b{constant} Version_32 := 16#5760634A#; + u00057 : @b{constant} Version_32 := 16#5D851835#; -- The following Export pragmas export the version numbers -- with symbolic names ending in B (for body) or S @@ -24837,63 +22233,63 @@ package ada_main is -- information provided here is sufficient to track down -- the exact versions of units used in a given build. - pragma Export (C, u00001, "helloB"); - pragma Export (C, u00002, "system__standard_libraryB"); - pragma Export (C, u00003, "system__standard_libraryS"); - pragma Export (C, u00004, "adaS"); - pragma Export (C, u00005, "ada__text_ioB"); - pragma Export (C, u00006, "ada__text_ioS"); - pragma Export (C, u00007, "ada__exceptionsB"); - pragma Export (C, u00008, "ada__exceptionsS"); - pragma Export (C, u00009, "gnatS"); - pragma Export (C, u00010, "gnat__heap_sort_aB"); - pragma Export (C, u00011, "gnat__heap_sort_aS"); - pragma Export (C, u00012, "systemS"); - pragma Export (C, u00013, "system__exception_tableB"); - pragma Export (C, u00014, "system__exception_tableS"); - pragma Export (C, u00015, "gnat__htableB"); - pragma Export (C, u00016, "gnat__htableS"); - pragma Export (C, u00017, "system__exceptionsS"); - pragma Export (C, u00018, "system__machine_state_operationsB"); - pragma Export (C, u00019, "system__machine_state_operationsS"); - pragma Export (C, u00020, "system__machine_codeS"); - pragma Export (C, u00021, "system__storage_elementsB"); - pragma Export (C, u00022, "system__storage_elementsS"); - pragma Export (C, u00023, "system__secondary_stackB"); - pragma Export (C, u00024, "system__secondary_stackS"); - pragma Export (C, u00025, "system__parametersB"); - pragma Export (C, u00026, "system__parametersS"); - pragma Export (C, u00027, "system__soft_linksB"); - pragma Export (C, u00028, "system__soft_linksS"); - pragma Export (C, u00029, "system__stack_checkingB"); - pragma Export (C, u00030, "system__stack_checkingS"); - pragma Export (C, u00031, "system__tracebackB"); - pragma Export (C, u00032, "system__tracebackS"); - pragma Export (C, u00033, "ada__streamsS"); - pragma Export (C, u00034, "ada__tagsB"); - pragma Export (C, u00035, "ada__tagsS"); - pragma Export (C, u00036, "system__string_opsB"); - pragma Export (C, u00037, "system__string_opsS"); - pragma Export (C, u00038, "interfacesS"); - pragma Export (C, u00039, "interfaces__c_streamsB"); - pragma Export (C, u00040, "interfaces__c_streamsS"); - pragma Export (C, u00041, "system__file_ioB"); - pragma Export (C, u00042, "system__file_ioS"); - pragma Export (C, u00043, "ada__finalizationB"); - pragma Export (C, u00044, "ada__finalizationS"); - pragma Export (C, u00045, "system__finalization_rootB"); - pragma Export (C, u00046, "system__finalization_rootS"); - pragma Export (C, u00047, "system__finalization_implementationB"); - pragma Export (C, u00048, "system__finalization_implementationS"); - pragma Export (C, u00049, "system__string_ops_concat_3B"); - pragma Export (C, u00050, "system__string_ops_concat_3S"); - pragma Export (C, u00051, "system__stream_attributesB"); - pragma Export (C, u00052, "system__stream_attributesS"); - pragma Export (C, u00053, "ada__io_exceptionsS"); - pragma Export (C, u00054, "system__unsigned_typesS"); - pragma Export (C, u00055, "system__file_control_blockS"); - pragma Export (C, u00056, "ada__finalization__list_controllerB"); - pragma Export (C, u00057, "ada__finalization__list_controllerS"); + @b{pragma} Export (C, u00001, "helloB"); + @b{pragma} Export (C, u00002, "system__standard_libraryB"); + @b{pragma} Export (C, u00003, "system__standard_libraryS"); + @b{pragma} Export (C, u00004, "adaS"); + @b{pragma} Export (C, u00005, "ada__text_ioB"); + @b{pragma} Export (C, u00006, "ada__text_ioS"); + @b{pragma} Export (C, u00007, "ada__exceptionsB"); + @b{pragma} Export (C, u00008, "ada__exceptionsS"); + @b{pragma} Export (C, u00009, "gnatS"); + @b{pragma} Export (C, u00010, "gnat__heap_sort_aB"); + @b{pragma} Export (C, u00011, "gnat__heap_sort_aS"); + @b{pragma} Export (C, u00012, "systemS"); + @b{pragma} Export (C, u00013, "system__exception_tableB"); + @b{pragma} Export (C, u00014, "system__exception_tableS"); + @b{pragma} Export (C, u00015, "gnat__htableB"); + @b{pragma} Export (C, u00016, "gnat__htableS"); + @b{pragma} Export (C, u00017, "system__exceptionsS"); + @b{pragma} Export (C, u00018, "system__machine_state_operationsB"); + @b{pragma} Export (C, u00019, "system__machine_state_operationsS"); + @b{pragma} Export (C, u00020, "system__machine_codeS"); + @b{pragma} Export (C, u00021, "system__storage_elementsB"); + @b{pragma} Export (C, u00022, "system__storage_elementsS"); + @b{pragma} Export (C, u00023, "system__secondary_stackB"); + @b{pragma} Export (C, u00024, "system__secondary_stackS"); + @b{pragma} Export (C, u00025, "system__parametersB"); + @b{pragma} Export (C, u00026, "system__parametersS"); + @b{pragma} Export (C, u00027, "system__soft_linksB"); + @b{pragma} Export (C, u00028, "system__soft_linksS"); + @b{pragma} Export (C, u00029, "system__stack_checkingB"); + @b{pragma} Export (C, u00030, "system__stack_checkingS"); + @b{pragma} Export (C, u00031, "system__tracebackB"); + @b{pragma} Export (C, u00032, "system__tracebackS"); + @b{pragma} Export (C, u00033, "ada__streamsS"); + @b{pragma} Export (C, u00034, "ada__tagsB"); + @b{pragma} Export (C, u00035, "ada__tagsS"); + @b{pragma} Export (C, u00036, "system__string_opsB"); + @b{pragma} Export (C, u00037, "system__string_opsS"); + @b{pragma} Export (C, u00038, "interfacesS"); + @b{pragma} Export (C, u00039, "interfaces__c_streamsB"); + @b{pragma} Export (C, u00040, "interfaces__c_streamsS"); + @b{pragma} Export (C, u00041, "system__file_ioB"); + @b{pragma} Export (C, u00042, "system__file_ioS"); + @b{pragma} Export (C, u00043, "ada__finalizationB"); + @b{pragma} Export (C, u00044, "ada__finalizationS"); + @b{pragma} Export (C, u00045, "system__finalization_rootB"); + @b{pragma} Export (C, u00046, "system__finalization_rootS"); + @b{pragma} Export (C, u00047, "system__finalization_implementationB"); + @b{pragma} Export (C, u00048, "system__finalization_implementationS"); + @b{pragma} Export (C, u00049, "system__string_ops_concat_3B"); + @b{pragma} Export (C, u00050, "system__string_ops_concat_3S"); + @b{pragma} Export (C, u00051, "system__stream_attributesB"); + @b{pragma} Export (C, u00052, "system__stream_attributesS"); + @b{pragma} Export (C, u00053, "ada__io_exceptionsS"); + @b{pragma} Export (C, u00054, "system__unsigned_typesS"); + @b{pragma} Export (C, u00055, "system__file_control_blockS"); + @b{pragma} Export (C, u00056, "ada__finalization__list_controllerB"); + @b{pragma} Export (C, u00057, "ada__finalization__list_controllerS"); -- BEGIN ELABORATION ORDER -- ada (spec) @@ -24955,92 +22351,92 @@ package ada_main is -- hello (body) -- END ELABORATION ORDER -end ada_main; +@b{end} ada_main; -- The following source file name pragmas allow the generated file -- names to be unique for different main programs. They are needed -- since the package name will always be Ada_Main. -pragma Source_File_Name (ada_main, Spec_File_Name => "b~hello.ads"); -pragma Source_File_Name (ada_main, Body_File_Name => "b~hello.adb"); +@b{pragma} Source_File_Name (ada_main, Spec_File_Name => "b~hello.ads"); +@b{pragma} Source_File_Name (ada_main, Body_File_Name => "b~hello.adb"); -- Generated package body for Ada_Main starts here -package body ada_main is +@b{package} @b{body} ada_main @b{is} -- The actual finalization is performed by calling the -- library routine in System.Standard_Library.Adafinal - procedure Do_Finalize; - pragma Import (C, Do_Finalize, "system__standard_library__adafinal"); + @b{procedure} Do_Finalize; + @b{pragma} Import (C, Do_Finalize, "system__standard_library__adafinal"); ------------- -- adainit -- ------------- @findex adainit - procedure adainit is + @b{procedure} adainit @b{is} -- These booleans are set to True once the associated unit has -- been elaborated. It is also used to avoid elaborating the -- same unit twice. E040 : Boolean; - pragma Import (Ada, E040, "interfaces__c_streams_E"); + @b{pragma} Import (Ada, E040, "interfaces__c_streams_E"); E008 : Boolean; - pragma Import (Ada, E008, "ada__exceptions_E"); + @b{pragma} Import (Ada, E008, "ada__exceptions_E"); E014 : Boolean; - pragma Import (Ada, E014, "system__exception_table_E"); + @b{pragma} Import (Ada, E014, "system__exception_table_E"); E053 : Boolean; - pragma Import (Ada, E053, "ada__io_exceptions_E"); + @b{pragma} Import (Ada, E053, "ada__io_exceptions_E"); E017 : Boolean; - pragma Import (Ada, E017, "system__exceptions_E"); + @b{pragma} Import (Ada, E017, "system__exceptions_E"); E024 : Boolean; - pragma Import (Ada, E024, "system__secondary_stack_E"); + @b{pragma} Import (Ada, E024, "system__secondary_stack_E"); E030 : Boolean; - pragma Import (Ada, E030, "system__stack_checking_E"); + @b{pragma} Import (Ada, E030, "system__stack_checking_E"); E028 : Boolean; - pragma Import (Ada, E028, "system__soft_links_E"); + @b{pragma} Import (Ada, E028, "system__soft_links_E"); E035 : Boolean; - pragma Import (Ada, E035, "ada__tags_E"); + @b{pragma} Import (Ada, E035, "ada__tags_E"); E033 : Boolean; - pragma Import (Ada, E033, "ada__streams_E"); + @b{pragma} Import (Ada, E033, "ada__streams_E"); E046 : Boolean; - pragma Import (Ada, E046, "system__finalization_root_E"); + @b{pragma} Import (Ada, E046, "system__finalization_root_E"); E048 : Boolean; - pragma Import (Ada, E048, "system__finalization_implementation_E"); + @b{pragma} Import (Ada, E048, "system__finalization_implementation_E"); E044 : Boolean; - pragma Import (Ada, E044, "ada__finalization_E"); + @b{pragma} Import (Ada, E044, "ada__finalization_E"); E057 : Boolean; - pragma Import (Ada, E057, "ada__finalization__list_controller_E"); + @b{pragma} Import (Ada, E057, "ada__finalization__list_controller_E"); E055 : Boolean; - pragma Import (Ada, E055, "system__file_control_block_E"); + @b{pragma} Import (Ada, E055, "system__file_control_block_E"); E042 : Boolean; - pragma Import (Ada, E042, "system__file_io_E"); + @b{pragma} Import (Ada, E042, "system__file_io_E"); E006 : Boolean; - pragma Import (Ada, E006, "ada__text_io_E"); + @b{pragma} Import (Ada, E006, "ada__text_io_E"); -- Set_Globals is a library routine that stores away the -- value of the indicated set of global values in global -- variables within the library. - procedure Set_Globals + @b{procedure} Set_Globals (Main_Priority : Integer; Time_Slice_Value : Integer; WC_Encoding : Character; @@ -25051,7 +22447,7 @@ package body ada_main is Unreserve_All_Interrupts : Integer; Exception_Tracebacks : Integer); @findex __gnat_set_globals - pragma Import (C, Set_Globals, "__gnat_set_globals"); + @b{pragma} Import (C, Set_Globals, "__gnat_set_globals"); -- SDP_Table_Build is a library routine used to build the -- exception tables. See unit Ada.Exceptions in files @@ -25062,17 +22458,17 @@ package body ada_main is @findex SDP_Table_Build @findex Zero Cost Exceptions - procedure SDP_Table_Build + @b{procedure} SDP_Table_Build (SDP_Addresses : System.Address; SDP_Count : Natural; Elab_Addresses : System.Address; Elab_Addr_Count : Natural); - pragma Import (C, SDP_Table_Build, "__gnat_SDP_Table_Build"); + @b{pragma} Import (C, SDP_Table_Build, "__gnat_SDP_Table_Build"); -- Table of Unit_Exception_Table addresses. Used for zero -- cost exception handling to build the top level table. - ST : aliased constant array (1 .. 23) of System.Address := ( + ST : @b{aliased} @b{constant} @b{array} (1 .. 23) @b{of} System.Address := ( Hello'UET_Address, Ada.Text_Io'UET_Address, Ada.Exceptions'UET_Address, @@ -25102,7 +22498,7 @@ package body ada_main is -- addresses are included in the top level procedure -- address table. - EA : aliased constant array (1 .. 23) of System.Address := ( + EA : @b{aliased} @b{constant} @b{array} (1 .. 23) @b{of} System.Address := ( adainit'Code_Address, Do_Finalize'Code_Address, Ada.Exceptions'Elab_Spec'Address, @@ -25129,7 +22525,7 @@ package body ada_main is -- Start of processing for adainit - begin + @b{begin} -- Call SDP_Table_Build to build the top level procedure -- table for zero cost exception handling (omitted in @@ -25183,99 +22579,99 @@ package body ada_main is -- implicit elaboration procedures generated by the compiler for -- each unit that requires elaboration. - if not E040 then + @b{if} @b{not} E040 @b{then} Interfaces.C_Streams'Elab_Spec; - end if; + @b{end} @b{if}; E040 := True; - if not E008 then + @b{if} @b{not} E008 @b{then} Ada.Exceptions'Elab_Spec; - end if; - if not E014 then + @b{end} @b{if}; + @b{if} @b{not} E014 @b{then} System.Exception_Table'Elab_Body; E014 := True; - end if; - if not E053 then + @b{end} @b{if}; + @b{if} @b{not} E053 @b{then} Ada.Io_Exceptions'Elab_Spec; E053 := True; - end if; - if not E017 then + @b{end} @b{if}; + @b{if} @b{not} E017 @b{then} System.Exceptions'Elab_Spec; E017 := True; - end if; - if not E030 then + @b{end} @b{if}; + @b{if} @b{not} E030 @b{then} System.Stack_Checking'Elab_Spec; - end if; - if not E028 then + @b{end} @b{if}; + @b{if} @b{not} E028 @b{then} System.Soft_Links'Elab_Body; E028 := True; - end if; + @b{end} @b{if}; E030 := True; - if not E024 then + @b{if} @b{not} E024 @b{then} System.Secondary_Stack'Elab_Body; E024 := True; - end if; - if not E035 then + @b{end} @b{if}; + @b{if} @b{not} E035 @b{then} Ada.Tags'Elab_Spec; - end if; - if not E035 then + @b{end} @b{if}; + @b{if} @b{not} E035 @b{then} Ada.Tags'Elab_Body; E035 := True; - end if; - if not E033 then + @b{end} @b{if}; + @b{if} @b{not} E033 @b{then} Ada.Streams'Elab_Spec; E033 := True; - end if; - if not E046 then + @b{end} @b{if}; + @b{if} @b{not} E046 @b{then} System.Finalization_Root'Elab_Spec; - end if; + @b{end} @b{if}; E046 := True; - if not E008 then + @b{if} @b{not} E008 @b{then} Ada.Exceptions'Elab_Body; E008 := True; - end if; - if not E048 then + @b{end} @b{if}; + @b{if} @b{not} E048 @b{then} System.Finalization_Implementation'Elab_Spec; - end if; - if not E048 then + @b{end} @b{if}; + @b{if} @b{not} E048 @b{then} System.Finalization_Implementation'Elab_Body; E048 := True; - end if; - if not E044 then + @b{end} @b{if}; + @b{if} @b{not} E044 @b{then} Ada.Finalization'Elab_Spec; - end if; + @b{end} @b{if}; E044 := True; - if not E057 then + @b{if} @b{not} E057 @b{then} Ada.Finalization.List_Controller'Elab_Spec; - end if; + @b{end} @b{if}; E057 := True; - if not E055 then + @b{if} @b{not} E055 @b{then} System.File_Control_Block'Elab_Spec; E055 := True; - end if; - if not E042 then + @b{end} @b{if}; + @b{if} @b{not} E042 @b{then} System.File_Io'Elab_Body; E042 := True; - end if; - if not E006 then + @b{end} @b{if}; + @b{if} @b{not} E006 @b{then} Ada.Text_Io'Elab_Spec; - end if; - if not E006 then + @b{end} @b{if}; + @b{if} @b{not} E006 @b{then} Ada.Text_Io'Elab_Body; E006 := True; - end if; + @b{end} @b{if}; Elab_Final_Code := 0; - end adainit; + @b{end} adainit; -------------- -- adafinal -- -------------- @findex adafinal - procedure adafinal is - begin + @b{procedure} adafinal @b{is} + @b{begin} Do_Finalize; - end adafinal; + @b{end} adafinal; ---------- -- main -- @@ -25287,12 +22683,12 @@ package body ada_main is -- pointer. @findex Main Program - function main + @b{function} main (argc : Integer; argv : System.Address; envp : System.Address) - return Integer - is + @b{return} Integer + @b{is} -- The initialize routine performs low level system -- initialization using a standard library routine which -- sets up signal handling and performs any other @@ -25300,8 +22696,8 @@ package body ada_main is -- a-init.c. @findex __gnat_initialize - procedure initialize; - pragma Import (C, initialize, "__gnat_initialize"); + @b{procedure} initialize; + @b{pragma} Import (C, initialize, "__gnat_initialize"); -- The finalize routine performs low level system -- finalization using a standard library routine. The @@ -25310,8 +22706,8 @@ package body ada_main is -- really this is a hook for special user finalization. @findex __gnat_finalize - procedure finalize; - pragma Import (C, finalize, "__gnat_finalize"); + @b{procedure} finalize; + @b{pragma} Import (C, finalize, "__gnat_finalize"); -- We get to the main program of the partition by using -- pragma Import because if we try to with the unit and @@ -25320,12 +22716,12 @@ package body ada_main is -- switches (e.g.@: identifier character set) to be used -- to compile it. - procedure Ada_Main_Program; - pragma Import (Ada, Ada_Main_Program, "_ada_hello"); + @b{procedure} Ada_Main_Program; + @b{pragma} Import (Ada, Ada_Main_Program, "_ada_hello"); -- Start of processing for main - begin + @b{begin} -- Save global variables gnat_argc := argc; @@ -25358,8 +22754,8 @@ package body ada_main is Finalize; -- Return the proper exit status - return (gnat_exit_status); - end; + @b{return} (gnat_exit_status); + @b{end}; -- This section is entirely comments, so it has no effect on the -- compilation of the Ada_Main package. It provides the list of @@ -25381,7 +22777,7 @@ package body ada_main is -- /usr/local/gnat/lib/gcc-lib/i686-pc-linux-gnu/2.8.1/adalib/libgnat.a -- END Object file/option list -end ada_main; +@b{end} ada_main; @end smallexample @noindent @@ -25487,8 +22883,8 @@ of that unit before elaborating the unit doing the @code{with}'ing: @smallexample @c ada @group @cartouche -with Unit_1; -package Unit_2 is @dots{} +@b{with} Unit_1; +@b{package} Unit_2 @b{is} @dots{} @end cartouche @end group @end smallexample @@ -25521,9 +22917,9 @@ The elaboration code of the body of @code{Unit_1} also contains: @smallexample @c ada @group @cartouche -if expression_1 = 1 then +@b{if} expression_1 = 1 @b{then} Q := Unit_2.Func_2; -end if; +@b{end} @b{if}; @end cartouche @end group @end smallexample @@ -25546,9 +22942,9 @@ The elaboration code of the body of @code{Unit_2} also contains: @smallexample @c ada @group @cartouche -if expression_2 = 2 then +@b{if} expression_2 = 2 @b{then} Q := Unit_1.Func_1; -end if; +@b{end} @b{if}; @end cartouche @end group @end smallexample @@ -25709,14 +23105,14 @@ Thus if we have a such a package, as in: @smallexample @c ada @group @cartouche -package Definitions is - generic - type m is new integer; - package Subp is - type a is array (1 .. 10) of m; - type b is array (1 .. 20) of m; - end Subp; -end Definitions; +@b{package} Definitions @b{is} + @b{generic} + @b{type} m @b{is} @b{new} integer; + @b{package} Subp @b{is} + @b{type} a @b{is} @b{array} (1 .. 10) @b{of} m; + @b{type} b @b{is} @b{array} (1 .. 20) @b{of} m; + @b{end} Subp; +@b{end} Definitions; @end cartouche @end group @end smallexample @@ -25928,14 +23324,14 @@ example writing: @smallexample @c ada @group @cartouche -function One return Float; +@b{function} One @b{return} Float; Q : Float := One; -function One return Float is -begin - return 1.0; -end One; +@b{function} One @b{return} Float @b{is} +@b{begin} + @b{return} 1.0; +@b{end} One; @end cartouche @end group @end smallexample @@ -25985,12 +23381,12 @@ would prevent this reordering, and if we write: @smallexample @c ada @group @cartouche -function One return Float; +@b{function} One @b{return} Float; -function One return Float is -begin - return 1.0; -end One; +@b{function} One @b{return} Float @b{is} +@b{begin} + @b{return} 1.0; +@b{end} One; Q : Float := One; @end cartouche @@ -26006,16 +23402,16 @@ Things are more complicated when a chain of subprograms is executed: @smallexample @c ada @group @cartouche -function A return Integer; -function B return Integer; -function C return Integer; +@b{function} A @b{return} Integer; +@b{function} B @b{return} Integer; +@b{function} C @b{return} Integer; -function B return Integer is begin return A; end; -function C return Integer is begin return B; end; +@b{function} B @b{return} Integer @b{is} @b{begin} @b{return} A; @b{end}; +@b{function} C @b{return} Integer @b{is} @b{begin} @b{return} B; @b{end}; X : Integer := C; -function A return Integer is begin return 1; end; +@b{function} A @b{return} Integer @b{is} @b{begin} @b{return} 1; @b{end}; @end cartouche @end group @end smallexample @@ -26071,14 +23467,14 @@ For example, if the body of @code{B} said @smallexample @c ada @group @cartouche -function B return Integer is -begin - if some-condition-depending-on-input-data then - return A; - else - return 1; - end if; -end B; +@b{function} B @b{return} Integer @b{is} +@b{begin} + @b{if} some-condition-depending-on-input-data @b{then} + @b{return} A; + @b{else} + @b{return} 1; + @b{end} @b{if}; +@b{end} B; @end cartouche @end group @end smallexample @@ -26140,28 +23536,28 @@ Consider the following: @smallexample @c ada @cartouche @group -package Math is - function Sqrt (Arg : Float) return Float; -end Math; +@b{package} Math @b{is} + @b{function} Sqrt (Arg : Float) @b{return} Float; +@b{end} Math; -package body Math is - function Sqrt (Arg : Float) return Float is - begin +@b{package} @b{body} Math @b{is} + @b{function} Sqrt (Arg : Float) @b{return} Float @b{is} + @b{begin} @dots{} - end Sqrt; -end Math; + @b{end} Sqrt; +@b{end} Math; @end group @group -with Math; -package Stuff is +@b{with} Math; +@b{package} Stuff @b{is} X : Float := Math.Sqrt (0.5); -end Stuff; +@b{end} Stuff; -with Stuff; -procedure Main is -begin +@b{with} Stuff; +@b{procedure} Main @b{is} +@b{begin} @dots{} -end Main; +@b{end} Main; @end group @end cartouche @end smallexample @@ -26207,15 +23603,15 @@ that is not a general rule that can be followed in all cases. Consider @smallexample @c ada @group @cartouche -package X is @dots{} +@b{package} X @b{is} @dots{} -package Y is @dots{} +@b{package} Y @b{is} @dots{} -with X; -package body Y is @dots{} +@b{with} X; +@b{package} @b{body} Y @b{is} @dots{} -with Y; -package body X is @dots{} +@b{with} Y; +@b{package} @b{body} X @b{is} @dots{} @end cartouche @end group @end smallexample @@ -26297,10 +23693,10 @@ Consider the following source program: @smallexample @c ada @group @cartouche -with k; -package j is +@b{with} k; +@b{package} j @b{is} m : integer := k.r; -end; +@b{end}; @end cartouche @end group @end smallexample @@ -26354,7 +23750,7 @@ the @option{-gnatE} switch on the compiler (@command{gcc} or @command{gnatmake}) command, or by the use of the configuration pragma: @smallexample @c ada -pragma Elaboration_Checks (DYNAMIC); +@b{pragma} Elaboration_Checks (DYNAMIC); @end smallexample @noindent @@ -26443,48 +23839,48 @@ This can definitely result in unexpected circularities. Consider the following example @smallexample @c ada -package Decls is - task Lib_Task is - entry Start; - end Lib_Task; +@b{package} Decls @b{is} + @b{task} Lib_Task @b{is} + @b{entry} Start; + @b{end} Lib_Task; - type My_Int is new Integer; + @b{type} My_Int @b{is} @b{new} Integer; - function Ident (M : My_Int) return My_Int; -end Decls; + @b{function} Ident (M : My_Int) @b{return} My_Int; +@b{end} Decls; -with Utils; -package body Decls is - task body Lib_Task is - begin - accept Start; +@b{with} Utils; +@b{package} @b{body} Decls @b{is} + @b{task} @b{body} Lib_Task @b{is} + @b{begin} + @b{accept} Start; Utils.Put_Val (2); - end Lib_Task; - - function Ident (M : My_Int) return My_Int is - begin - return M; - end Ident; -end Decls; - -with Decls; -package Utils is - procedure Put_Val (Arg : Decls.My_Int); -end Utils; - -with Text_IO; -package body Utils is - procedure Put_Val (Arg : Decls.My_Int) is - begin + @b{end} Lib_Task; + + @b{function} Ident (M : My_Int) @b{return} My_Int @b{is} + @b{begin} + @b{return} M; + @b{end} Ident; +@b{end} Decls; + +@b{with} Decls; +@b{package} Utils @b{is} + @b{procedure} Put_Val (Arg : Decls.My_Int); +@b{end} Utils; + +@b{with} Text_IO; +@b{package} @b{body} Utils @b{is} + @b{procedure} Put_Val (Arg : Decls.My_Int) @b{is} + @b{begin} Text_IO.Put_Line (Decls.My_Int'Image (Decls.Ident (Arg))); - end Put_Val; -end Utils; + @b{end} Put_Val; +@b{end} Utils; -with Decls; -procedure Main is -begin +@b{with} Decls; +@b{procedure} Main @b{is} +@b{begin} Decls.Lib_Task.Start; -end; +@b{end}; @end smallexample @noindent @@ -26586,52 +23982,52 @@ other declarations as much as possible. Let us look at a variation on the above program. @smallexample @c ada -package Decls1 is - task Lib_Task is - entry Start; - end Lib_Task; -end Decls1; - -with Utils; -package body Decls1 is - task body Lib_Task is - begin - accept Start; +@b{package} Decls1 @b{is} + @b{task} Lib_Task @b{is} + @b{entry} Start; + @b{end} Lib_Task; +@b{end} Decls1; + +@b{with} Utils; +@b{package} @b{body} Decls1 @b{is} + @b{task} @b{body} Lib_Task @b{is} + @b{begin} + @b{accept} Start; Utils.Put_Val (2); - end Lib_Task; -end Decls1; - -package Decls2 is - type My_Int is new Integer; - function Ident (M : My_Int) return My_Int; -end Decls2; - -with Utils; -package body Decls2 is - function Ident (M : My_Int) return My_Int is - begin - return M; - end Ident; -end Decls2; - -with Decls2; -package Utils is - procedure Put_Val (Arg : Decls2.My_Int); -end Utils; - -with Text_IO; -package body Utils is - procedure Put_Val (Arg : Decls2.My_Int) is - begin + @b{end} Lib_Task; +@b{end} Decls1; + +@b{package} Decls2 @b{is} + @b{type} My_Int @b{is} @b{new} Integer; + @b{function} Ident (M : My_Int) @b{return} My_Int; +@b{end} Decls2; + +@b{with} Utils; +@b{package} @b{body} Decls2 @b{is} + @b{function} Ident (M : My_Int) @b{return} My_Int @b{is} + @b{begin} + @b{return} M; + @b{end} Ident; +@b{end} Decls2; + +@b{with} Decls2; +@b{package} Utils @b{is} + @b{procedure} Put_Val (Arg : Decls2.My_Int); +@b{end} Utils; + +@b{with} Text_IO; +@b{package} @b{body} Utils @b{is} + @b{procedure} Put_Val (Arg : Decls2.My_Int) @b{is} + @b{begin} Text_IO.Put_Line (Decls2.My_Int'Image (Decls2.Ident (Arg))); - end Put_Val; -end Utils; + @b{end} Put_Val; +@b{end} Utils; -with Decls1; -procedure Main is -begin +@b{with} Decls1; +@b{procedure} Main @b{is} +@b{begin} Decls1.Lib_Task.Start; -end; +@b{end}; @end smallexample @noindent @@ -26653,53 +24049,53 @@ packages from the task type declaration, many elaboration problems are avoided. Here is another modified example of the example program: @smallexample @c ada -package Decls is - task type Lib_Task_Type is - entry Start; - end Lib_Task_Type; +@b{package} Decls @b{is} + @b{task} @b{type} Lib_Task_Type @b{is} + @b{entry} Start; + @b{end} Lib_Task_Type; - type My_Int is new Integer; + @b{type} My_Int @b{is} @b{new} Integer; - function Ident (M : My_Int) return My_Int; -end Decls; + @b{function} Ident (M : My_Int) @b{return} My_Int; +@b{end} Decls; -with Utils; -package body Decls is - task body Lib_Task_Type is - begin - accept Start; +@b{with} Utils; +@b{package} @b{body} Decls @b{is} + @b{task} @b{body} Lib_Task_Type @b{is} + @b{begin} + @b{accept} Start; Utils.Put_Val (2); - end Lib_Task_Type; - - function Ident (M : My_Int) return My_Int is - begin - return M; - end Ident; -end Decls; - -with Decls; -package Utils is - procedure Put_Val (Arg : Decls.My_Int); -end Utils; - -with Text_IO; -package body Utils is - procedure Put_Val (Arg : Decls.My_Int) is - begin + @b{end} Lib_Task_Type; + + @b{function} Ident (M : My_Int) @b{return} My_Int @b{is} + @b{begin} + @b{return} M; + @b{end} Ident; +@b{end} Decls; + +@b{with} Decls; +@b{package} Utils @b{is} + @b{procedure} Put_Val (Arg : Decls.My_Int); +@b{end} Utils; + +@b{with} Text_IO; +@b{package} @b{body} Utils @b{is} + @b{procedure} Put_Val (Arg : Decls.My_Int) @b{is} + @b{begin} Text_IO.Put_Line (Decls.My_Int'Image (Decls.Ident (Arg))); - end Put_Val; -end Utils; + @b{end} Put_Val; +@b{end} Utils; -with Decls; -package Declst is +@b{with} Decls; +@b{package} Declst @b{is} Lib_Task : Decls.Lib_Task_Type; -end Declst; +@b{end} Declst; -with Declst; -procedure Main is -begin +@b{with} Declst; +@b{procedure} Main @b{is} +@b{begin} Declst.Lib_Task.Start; -end; +@b{end}; @end smallexample @noindent @@ -26950,51 +24346,51 @@ require increasing programmer care in their application. Consider the following program: @smallexample @c adanocomment -package Pack1 is - function F1 return Integer; +@b{package} Pack1 @b{is} + @b{function} F1 @b{return} Integer; X1 : Integer; -end Pack1; +@b{end} Pack1; -package Pack2 is - function F2 return Integer; - function Pure (x : integer) return integer; +@b{package} Pack2 @b{is} + @b{function} F2 @b{return} Integer; + @b{function} Pure (x : integer) @b{return} integer; -- pragma Suppress (Elaboration_Check, On => Pure); -- (3) -- pragma Suppress (Elaboration_Check); -- (4) -end Pack2; - -with Pack2; -package body Pack1 is - function F1 return Integer is - begin - return 100; - end F1; +@b{end} Pack2; + +@b{with} Pack2; +@b{package} @b{body} Pack1 @b{is} + @b{function} F1 @b{return} Integer @b{is} + @b{begin} + @b{return} 100; + @b{end} F1; Val : integer := Pack2.Pure (11); -- Elab. call (1) -begin - declare +@b{begin} + @b{declare} -- pragma Suppress(Elaboration_Check, Pack2.F2); -- (1) -- pragma Suppress(Elaboration_Check); -- (2) - begin + @b{begin} X1 := Pack2.F2 + 1; -- Elab. call (2) - end; -end Pack1; - -with Pack1; -package body Pack2 is - function F2 return Integer is - begin - return Pack1.F1; - end F2; - function Pure (x : integer) return integer is - begin - return x ** 3 - 3 * x; - end; -end Pack2; - -with Pack1, Ada.Text_IO; -procedure Proc3 is -begin + @b{end}; +@b{end} Pack1; + +@b{with} Pack1; +@b{package} @b{body} Pack2 @b{is} + @b{function} F2 @b{return} Integer @b{is} + @b{begin} + @b{return} Pack1.F1; + @b{end} F2; + @b{function} Pure (x : integer) @b{return} integer @b{is} + @b{begin} + @b{return} x ** 3 - 3 * x; + @b{end}; +@b{end} Pack2; + +@b{with} Pack1, Ada.Text_IO; +@b{procedure} Proc3 @b{is} +@b{begin} Ada.Text_IO.Put_Line(Pack1.X1'Img); -- 101 -end Proc3; +@b{end} Proc3; @end smallexample In the absence of any pragmas, an attempt to bind this program produces the following diagnostics: @@ -27052,7 +24448,7 @@ information messages generated with the @option{-gnatel} switch can be useful) must be used to ensure that the program is free of errors. One switch that is useful in this testing is the -@option{^-p (pessimistic elaboration order)^/PESSIMISTIC_ELABORATION_ORDER^} +@option{-p (pessimistic elaboration order)} switch for @code{gnatbind}. Normally the binder tries to find an order that has the best chance @@ -27155,35 +24551,35 @@ of avoiding elaboration errors, but rather from extra-lingual logic requirements. Consider this example: @smallexample @c ada -with Init_Constants; -package Constants is +@b{with} Init_Constants; +@b{package} Constants @b{is} X : Integer := 0; Y : Integer := 0; -end Constants; +@b{end} Constants; -package Init_Constants is - procedure P; -- require a body -end Init_Constants; +@b{package} Init_Constants @b{is} + @b{procedure} P; --@i{ require a body} +@b{end} Init_Constants; -with Constants; -package body Init_Constants is - procedure P is begin null; end; -begin +@b{with} Constants; +@b{package} @b{body} Init_Constants @b{is} + @b{procedure} P @b{is} @b{begin} @b{null}; @b{end}; +@b{begin} Constants.X := 3; Constants.Y := 4; -end Init_Constants; +@b{end} Init_Constants; -with Constants; -package Calc is +@b{with} Constants; +@b{package} Calc @b{is} Z : Integer := Constants.X + Constants.Y; -end Calc; +@b{end} Calc; -with Calc; -with Text_IO; use Text_IO; -procedure Main is -begin +@b{with} Calc; +@b{with} Text_IO; @b{use} Text_IO; +@b{procedure} Main @b{is} +@b{begin} Put_Line (Calc.Z'Img); -end Main; +@b{end} Main; @end smallexample @noindent @@ -27229,7 +24625,7 @@ this, it is important to specify the order required. In this particular case, that could have been achieved by adding to the spec of Calc: @smallexample @c ada -pragma Elaborate_All (Constants); +@b{pragma} Elaborate_All (Constants); @end smallexample @noindent @@ -27251,7 +24647,7 @@ in which a pragma Elaborate_Body is usually desirable, and GNAT will generate a warning that suggests this addition if it detects this situation. The @code{gnatbind} -@option{^-p^/PESSIMISTIC_ELABORATION^} switch may be useful in smoking +@option{-p} switch may be useful in smoking out problems. This switch causes bodies to be elaborated as late as possible instead of as early as possible. In the example above, it would have forced the choice of the first elaboration order. If you get different results @@ -27508,7 +24904,7 @@ Furthermore, when using Ada 2012's preconditions and other assertion forms, another issue arises. Consider: @smallexample @c ada - procedure P (A, B : Integer) with + @b{procedure} P (A, B : Integer) @b{with} Pre => A + B <= Integer'Last; @end smallexample @@ -27529,7 +24925,7 @@ up to the implementation. The situation is worse in a case such as the following: @smallexample @c ada - procedure Q (A, B, C : Integer) with + @b{procedure} Q (A, B, C : Integer) @b{with} Pre => A + B + C <= Integer'Last; @end smallexample @@ -27591,7 +24987,7 @@ The three modes are: enough, consider the following example: @smallexample @c ada - procedure R (A, B, C, D : Integer) with + @b{procedure} R (A, B, C, D : Integer) @b{with} Pre => (A**2 * B**2) / (C**2 * D**2) <= 10; @end smallexample @@ -27666,7 +25062,7 @@ The pragma has the form @cindex pragma @code{Overflow_Mode} @smallexample @c ada - pragma Overflow_Mode ([General =>] MODE [, [Assertions =>] MODE]); + @b{pragma} Overflow_Mode ([General =>] MODE [, [Assertions =>] MODE]); @end smallexample @noindent @@ -27689,7 +25085,7 @@ are present, then @code{General} applies to expressions outside assertions, and @code{Assertions} applies to expressions within assertions. For example: @smallexample @c ada - pragma Overflow_Mode + @b{pragma} Overflow_Mode (General => Minimized, Assertions => Eliminated); @end smallexample @@ -27738,10 +25134,10 @@ As with the pragma, if only one digit appears then it applies to all cases; if two digits are given, then the first applies outside assertions, and the second within assertions. Thus the equivalent of the example pragma above would be -@option{^-gnato23^/OVERFLOW_CHECKS=23^}. +@option{-gnato23}. If no digits follow the @option{-gnato}, then it is equivalent to -@option{^-gnato11^/OVERFLOW_CHECKS=11^}, +@option{-gnato11}, causing all intermediate operations to be computed using the base type (@code{STRICT} mode). @@ -27892,11 +25288,11 @@ constants to control which code is executed. @smallexample @c ada @group -FP_Initialize_Required : constant Boolean := True; +FP_Initialize_Required : @b{constant} Boolean := True; @dots{} -if FP_Initialize_Required then +@b{if} FP_Initialize_Required @b{then} @dots{} -end if; +@b{end} @b{if}; @end group @end smallexample @@ -27916,11 +25312,11 @@ something like: @smallexample @c ada @group -package Config is - FP_Initialize_Required : constant Boolean := True; - Reset_Available : constant Boolean := False; +@b{package} Config @b{is} + FP_Initialize_Required : @b{constant} Boolean := True; + Reset_Available : @b{constant} Boolean := False; @dots{} -end Config; +@b{end} Config; @end group @end smallexample @@ -27943,9 +25339,9 @@ is active: @smallexample @c ada @group -if Debugging then +@b{if} Debugging @b{then} Put_Line ("got to the first stage!"); -end if; +@b{end} @b{if}; @end group @end smallexample @@ -27954,9 +25350,9 @@ or @smallexample @c ada @group -if Debugging and then Temperature > 999.0 then - raise Temperature_Crazy; -end if; +@b{if} Debugging @b{and} @b{then} Temperature > 999.0 @b{then} + @b{raise} Temperature_Crazy; +@b{end} @b{if}; @end group @end smallexample @@ -27972,14 +25368,14 @@ The use of pragma @code{Assert} is described in example, the last test could be written: @smallexample @c ada -pragma Assert (Temperature <= 999.0, "Temperature Crazy"); +@b{pragma} Assert (Temperature <= 999.0, "Temperature Crazy"); @end smallexample @noindent or simply @smallexample @c ada -pragma Assert (Temperature <= 999.0); +@b{pragma} Assert (Temperature <= 999.0); @end smallexample @noindent @@ -28003,7 +25399,7 @@ For the example above with the @code{Put_Line}, the GNAT-specific pragma @cindex pragma @code{Debug} @smallexample @c ada -pragma Debug (Put_Line ("got to the first stage!")); +@b{pragma} Debug (Put_Line ("got to the first stage!")); @end smallexample @noindent @@ -28039,12 +25435,12 @@ to add a @code{null} statement. @smallexample @c ada @group -if @dots{} then +@b{if} @dots{} @b{then} @dots{} -- some statements -else - pragma Assert (Num_Cases < 10); - null; -end if; +@b{else} + @b{pragma} Assert (Num_Cases < 10); + @b{null}; +@b{end} @b{if}; @end group @end smallexample @@ -28062,19 +25458,19 @@ by conditional constants: @smallexample @c ada @group -if Small_Machine then - declare +@b{if} Small_Machine @b{then} + @b{declare} X : Bit_String (1 .. 10); - begin + @b{begin} @dots{} - end; -else - declare + @b{end}; +@b{else} + @b{declare} X : Large_Bit_String (1 .. 1000); - begin + @b{begin} @dots{} - end; -end if; + @b{end}; +@b{end} @b{if}; @end group @end smallexample @@ -28089,9 +25485,9 @@ that are parameterized by these constants. For example @smallexample @c ada @group -for Rec use - Field1 at 0 range Boolean'Pos (Little_Endian) * 10 .. Bits_Per_Word; -end record; +@b{for} Rec @b{use} + Field1 @b{at} 0 @b{range} Boolean'Pos (Little_Endian) * 10 .. Bits_Per_Word; +@b{end} @b{record}; @end group @end smallexample @@ -28100,9 +25496,9 @@ If @code{Bits_Per_Word} is set to 32, this generates either @smallexample @c ada @group -for Rec use - Field1 at 0 range 0 .. 32; -end record; +@b{for} Rec @b{use} + Field1 @b{at} 0 @b{range} 0 .. 32; +@b{end} @b{record}; @end group @end smallexample @@ -28111,9 +25507,9 @@ for the big endian case, or @smallexample @c ada @group -for Rec use record - Field1 at 0 range 10 .. 32; -end record; +@b{for} Rec @b{use} @b{record} + Field1 @b{at} 0 @b{range} 10 .. 32; +@b{end} @b{record}; @end group @end smallexample @@ -28151,11 +25547,11 @@ to compile with an Ada 95 compiler. Conceptually you want to say: @smallexample @c ada @group -if Ada_2005 then +@b{if} Ada_2005 @b{then} @dots{} neat Ada 2005 code -else +@b{else} @dots{} not quite as neat Ada 95 code -end if; +@b{end} @b{if}; @end group @end smallexample @@ -28171,7 +25567,7 @@ introduced in Ada 2005, it will be illegal in Ada 95.) So instead we write @smallexample @c ada -procedure Insert is separate; +@b{procedure} Insert @b{is} @b{separate}; @end smallexample @noindent @@ -28418,11 +25814,11 @@ the Inline Assembler facility. @smallexample @c ada @group -with System.Machine_Code; use System.Machine_Code; -procedure Nothing is -begin +@b{with} System.Machine_Code; @b{use} System.Machine_Code; +@b{procedure} Nothing @b{is} +@b{begin} Asm ("nop"); -end Nothing; +@b{end} Nothing; @end group @end smallexample @@ -28522,19 +25918,19 @@ statements. @smallexample @c ada @group -with Interfaces; use Interfaces; -with Ada.Text_IO; use Ada.Text_IO; -with System.Machine_Code; use System.Machine_Code; -procedure Get_Flags is +@b{with} Interfaces; @b{use} Interfaces; +@b{with} Ada.Text_IO; @b{use} Ada.Text_IO; +@b{with} System.Machine_Code; @b{use} System.Machine_Code; +@b{procedure} Get_Flags @b{is} Flags : Unsigned_32; - use ASCII; -begin - Asm ("pushfl" & LF & HT & -- push flags on stack - "popl %%eax" & LF & HT & -- load eax with flags - "movl %%eax, %0", -- store flags in variable + @b{use} ASCII; +@b{begin} + Asm ("pushfl" & LF & HT & --@i{ push flags on stack} + "popl %%eax" & LF & HT & --@i{ load eax with flags} + "movl %%eax, %0", --@i{ store flags in variable} Outputs => Unsigned_32'Asm_Output ("=g", Flags)); Put_Line ("Flags register:" & Flags'Img); -end Get_Flags; +@b{end} Get_Flags; @end group @end smallexample @@ -28666,9 +26062,9 @@ through the @code{%}@emph{n} notation, where @emph{n} is a non-negative integer. Thus in @smallexample @c ada @group -Asm ("pushfl" & LF & HT & -- push flags on stack - "popl %%eax" & LF & HT & -- load eax with flags - "movl %%eax, %0", -- store flags in variable +Asm ("pushfl" & LF & HT & --@i{ push flags on stack} + "popl %%eax" & LF & HT & --@i{ load eax with flags} + "movl %%eax, %0", --@i{ store flags in variable} Outputs => Unsigned_32'Asm_Output ("=g", Flags)); @end group @end smallexample @@ -28692,9 +26088,9 @@ For example: Asm ("movl %%eax, %0" & LF & HT & "movl %%ebx, %1" & LF & HT & "movl %%ecx, %2", - Outputs => (Unsigned_32'Asm_Output ("=g", Var_A), -- %0 = Var_A - Unsigned_32'Asm_Output ("=g", Var_B), -- %1 = Var_B - Unsigned_32'Asm_Output ("=g", Var_C))); -- %2 = Var_C + Outputs => (Unsigned_32'Asm_Output ("=g", Var_A), --@i{ %0 = Var_A} + Unsigned_32'Asm_Output ("=g", Var_B), --@i{ %1 = Var_B} + Unsigned_32'Asm_Output ("=g", Var_C))); --@i{ %2 = Var_C} @end group @end smallexample @noindent @@ -28708,18 +26104,18 @@ variable, instead of including the store instruction explicitly in the @smallexample @c ada @group -with Interfaces; use Interfaces; -with Ada.Text_IO; use Ada.Text_IO; -with System.Machine_Code; use System.Machine_Code; -procedure Get_Flags_2 is +@b{with} Interfaces; @b{use} Interfaces; +@b{with} Ada.Text_IO; @b{use} Ada.Text_IO; +@b{with} System.Machine_Code; @b{use} System.Machine_Code; +@b{procedure} Get_Flags_2 @b{is} Flags : Unsigned_32; - use ASCII; -begin - Asm ("pushfl" & LF & HT & -- push flags on stack - "popl %%eax", -- save flags in eax + @b{use} ASCII; +@b{begin} + Asm ("pushfl" & LF & HT & --@i{ push flags on stack} + "popl %%eax", --@i{ save flags in eax} Outputs => Unsigned_32'Asm_Output ("=a", Flags)); Put_Line ("Flags register:" & Flags'Img); -end Get_Flags_2; +@b{end} Get_Flags_2; @end group @end smallexample @@ -28746,18 +26142,18 @@ more simply, we could just pop the flags directly into the program variable: @smallexample @c ada @group -with Interfaces; use Interfaces; -with Ada.Text_IO; use Ada.Text_IO; -with System.Machine_Code; use System.Machine_Code; -procedure Get_Flags_3 is +@b{with} Interfaces; @b{use} Interfaces; +@b{with} Ada.Text_IO; @b{use} Ada.Text_IO; +@b{with} System.Machine_Code; @b{use} System.Machine_Code; +@b{procedure} Get_Flags_3 @b{is} Flags : Unsigned_32; - use ASCII; -begin - Asm ("pushfl" & LF & HT & -- push flags on stack - "pop %0", -- save flags in Flags + @b{use} ASCII; +@b{begin} + Asm ("pushfl" & LF & HT & --@i{ push flags on stack} + "pop %0", --@i{ save flags in Flags} Outputs => Unsigned_32'Asm_Output ("=g", Flags)); Put_Line ("Flags register:" & Flags'Img); -end Get_Flags_3; +@b{end} Get_Flags_3; @end group @end smallexample @@ -28772,28 +26168,28 @@ The program simply increments its input value by 1: @smallexample @c ada @group -with Interfaces; use Interfaces; -with Ada.Text_IO; use Ada.Text_IO; -with System.Machine_Code; use System.Machine_Code; -procedure Increment is +@b{with} Interfaces; @b{use} Interfaces; +@b{with} Ada.Text_IO; @b{use} Ada.Text_IO; +@b{with} System.Machine_Code; @b{use} System.Machine_Code; +@b{procedure} Increment @b{is} - function Incr (Value : Unsigned_32) return Unsigned_32 is + @b{function} Incr (Value : Unsigned_32) @b{return} Unsigned_32 @b{is} Result : Unsigned_32; - begin + @b{begin} Asm ("incl %0", Outputs => Unsigned_32'Asm_Output ("=a", Result), Inputs => Unsigned_32'Asm_Input ("a", Value)); - return Result; - end Incr; + @b{return} Result; + @b{end} Incr; Value : Unsigned_32; -begin +@b{begin} Value := 5; Put_Line ("Value before is" & Value'Img); Value := Incr (Value); Put_Line ("Value after is" & Value'Img); -end Increment; +@b{end} Increment; @end group @end smallexample @@ -28854,29 +26250,29 @@ Here is the resulting program: @smallexample @c ada @group -with Interfaces; use Interfaces; -with Ada.Text_IO; use Ada.Text_IO; -with System.Machine_Code; use System.Machine_Code; -procedure Increment_2 is +@b{with} Interfaces; @b{use} Interfaces; +@b{with} Ada.Text_IO; @b{use} Ada.Text_IO; +@b{with} System.Machine_Code; @b{use} System.Machine_Code; +@b{procedure} Increment_2 @b{is} - function Incr (Value : Unsigned_32) return Unsigned_32 is + @b{function} Incr (Value : Unsigned_32) @b{return} Unsigned_32 @b{is} Result : Unsigned_32; - begin + @b{begin} Asm ("incl %0", Outputs => Unsigned_32'Asm_Output ("=a", Result), Inputs => Unsigned_32'Asm_Input ("a", Value)); - return Result; - end Incr; - pragma Inline (Increment); + @b{return} Result; + @b{end} Incr; + @b{pragma} Inline (Increment); Value : Unsigned_32; -begin +@b{begin} Value := 5; Put_Line ("Value before is" & Value'Img); Value := Increment (Value); Put_Line ("Value after is" & Value'Img); -end Increment_2; +@b{end} Increment_2; @end group @end smallexample @@ -29032,14 +26428,9 @@ applications developed in other Ada environments. * Implementation-dependent characteristics:: * Compatibility with Other Ada Systems:: * Representation Clauses:: -@ifclear vms @c Brief section is only in non-VMS version @c Full chapter is in VMS version * Compatibility with HP Ada 83:: -@end ifclear -@ifset vms -* Transitioning to 64-Bit GNAT for OpenVMS:: -@end ifset @end menu @node Compatibility with Ada 83 @@ -29079,7 +26470,7 @@ Some uses of character literals are ambiguous. Since Ada 95 has introduced character literals that were legal in Ada 83 are illegal in Ada 95. For example: @smallexample @c ada - for Char in 'A' .. 'Z' loop @dots{} end loop; + @b{for} Char @b{in} 'A' .. 'Z' @b{loop} @dots{} @b{end} @b{loop}; @end smallexample @noindent @@ -29087,7 +26478,7 @@ The problem is that @code{'A'} and @code{'Z'} could be from either @code{Character} or @code{Wide_Character}. The simplest correction is to make the type explicit; e.g.: @smallexample @c ada - for Char in Character range 'A' .. 'Z' loop @dots{} end loop; + @b{for} Char @b{in} Character @b{range} 'A' .. 'Z' @b{loop} @dots{} @b{end} @b{loop}; @end smallexample @item New reserved words @@ -29105,10 +26496,6 @@ appears too late, and the appropriate corrective action is to move the item nearer to the declaration of the entity to which it refers. A particular case is that representation pragmas -@ifset vms -(including the -extended HP Ada 83 compatibility pragmas such as @code{Export_Procedure}) -@end ifset cannot be applied to a subprogram body. If necessary, a separate subprogram declaration must be introduced to which the pragma can be applied. @@ -29505,8 +26892,8 @@ type). These thin pointers are indeed the same size as a System.Address value. To specify a thin pointer, use a size clause for the type, for example: @smallexample @c ada -type X is access all String; -for X'Size use Standard'Address_Size; +@b{type} X @b{is} @b{access} @b{all} String; +@b{for} X'Size @b{use} Standard'Address_Size; @end smallexample @noindent @@ -29526,7 +26913,6 @@ full discussion of possible problems using this attribute in conjunction with thin pointers. @end table -@ifclear vms @c This brief section is only in the non-VMS version @c The complete chapter on HP Ada is in the VMS version @node Compatibility with HP Ada 83 @@ -29590,12 +26976,12 @@ to change the name of the function in the UNSIGNED_LONGWORD case, so the declarations provided in the GNAT version of AUX_Dec are: @smallexample @c ada -function To_Address (X : Integer) return Address; -pragma Pure_Function (To_Address); +@b{function} To_Address (X : Integer) @b{return} Address; +@b{pragma} Pure_Function (To_Address); -function To_Address_Long (X : Unsigned_Longword) - return Address; -pragma Pure_Function (To_Address_Long); +@b{function} To_Address_Long (X : Unsigned_Longword) + @b{return} Address; +@b{pragma} Pure_Function (To_Address_Long); @end smallexample @noindent @@ -29618,418 +27004,7 @@ attributes are recognized, although only a subset of them can sensibly be implemented. The description of pragmas in @ref{Implementation Defined Pragmas,,, gnat_rm, GNAT Reference Manual} indicates whether or not they are applicable to non-VMS systems. -@end ifclear - -@ifset vms -@node Transitioning to 64-Bit GNAT for OpenVMS -@section Transitioning to 64-Bit @value{EDITION} for OpenVMS - -@noindent -This section is meant to assist users of pre-2006 @value{EDITION} -for Alpha OpenVMS who are transitioning to 64-bit @value{EDITION}, -the version of the GNAT technology supplied in 2006 and later for -OpenVMS on both Alpha and I64. - -@menu -* Introduction to transitioning:: -* Migration of 32 bit code:: -* Taking advantage of 64 bit addressing:: -* Technical details:: -@end menu - -@node Introduction to transitioning -@subsection Introduction - -@noindent -64-bit @value{EDITION} for Open VMS has been designed to meet -three main goals: - -@enumerate -@item -Providing a full conforming implementation of Ada 95 and Ada 2005 - -@item -Allowing maximum backward compatibility, thus easing migration of existing -Ada source code - -@item -Supplying a path for exploiting the full 64-bit address range -@end enumerate - -@noindent -Ada's strong typing semantics has made it -impractical to have different 32-bit and 64-bit modes. As soon as -one object could possibly be outside the 32-bit address space, this -would make it necessary for the @code{System.Address} type to be 64 bits. -In particular, this would cause inconsistencies if 32-bit code is -called from 64-bit code that raises an exception. - -This issue has been resolved by always using 64-bit addressing -at the system level, but allowing for automatic conversions between -32-bit and 64-bit addresses where required. Thus users who -do not currently require 64-bit addressing capabilities, can -recompile their code with only minimal changes (and indeed -if the code is written in portable Ada, with no assumptions about -the size of the @code{Address} type, then no changes at all are necessary). -At the same time, -this approach provides a simple, gradual upgrade path to future -use of larger memories than available for 32-bit systems. -Also, newly written applications or libraries will by default -be fully compatible with future systems exploiting 64-bit -addressing capabilities. - -@ref{Migration of 32 bit code}, will focus on porting applications -that do not require more than 2 GB of -addressable memory. This code will be referred to as -@emph{32-bit code}. -For applications intending to exploit the full 64-bit address space, -@ref{Taking advantage of 64 bit addressing}, -will consider further changes that may be required. -Such code will be referred to below as @emph{64-bit code}. - -@node Migration of 32 bit code -@subsection Migration of 32-bit code - -@menu -* Address types:: -* Access types and 32/64-bit allocation:: -* Unchecked conversions:: -* Predefined constants:: -* Interfacing with C:: -* 32/64-bit descriptors:: -* Experience with source compatibility:: -@end menu - -@node Address types -@subsubsection Address types - -@noindent -To solve the problem of mixing 64-bit and 32-bit addressing, -while maintaining maximum backward compatibility, the following -approach has been taken: - -@itemize @bullet -@item -@code{System.Address} always has a size of 64 bits -@cindex @code{System.Address} size -@cindex @code{Address} size - -@item -@code{System.Short_Address} is a 32-bit subtype of @code{System.Address} -@cindex @code{System.Short_Address} size -@cindex @code{Short_Address} size -@end itemize - -@noindent -Since @code{System.Short_Address} is a subtype of @code{System.Address}, -a @code{Short_Address} -may be used where an @code{Address} is required, and vice versa, without -needing explicit type conversions. -By virtue of the Open VMS parameter passing conventions, -even imported -and exported subprograms that have 32-bit address parameters are -compatible with those that have 64-bit address parameters. -(See @ref{Making code 64 bit clean} for details.) - -The areas that may need attention are those where record types have -been defined that contain components of the type @code{System.Address}, and -where objects of this type are passed to code expecting a record layout with -32-bit addresses. - -Different compilers on different platforms cannot be -expected to represent the same type in the same way, -since alignment constraints -and other system-dependent properties affect the compiler's decision. -For that reason, Ada code -generally uses representation clauses to specify the expected -layout where required. - -If such a representation clause uses 32 bits for a component having -the type @code{System.Address}, 64-bit @value{EDITION} for OpenVMS -will detect that error and produce a specific diagnostic message. -The developer should then determine whether the representation -should be 64 bits or not and make either of two changes: -change the size to 64 bits and leave the type as @code{System.Address}, or -leave the size as 32 bits and change the type to @code{System.Short_Address}. -Since @code{Short_Address} is a subtype of @code{Address}, no changes are -required in any code setting or accessing the field; the compiler will -automatically perform any needed conversions between address -formats. - -@node Access types and 32/64-bit allocation -@subsubsection Access types and 32/64-bit allocation -@cindex 32-bit allocation -@cindex 64-bit allocation - -@noindent -By default, objects designated by access values are always allocated in -the 64-bit address space, and access values themselves are represented -in 64 bits. If these defaults are not appropriate, and 32-bit allocation -is required (for example if the address of an allocated object is assigned -to a @code{Short_Address} variable), then several alternatives are available: - -@itemize @bullet -@item -A pool-specific access type (ie, an @w{Ada 83} access type, whose -definition is @code{access T} versus @code{access all T} or -@code{access constant T}), may be declared with a @code{'Size} representation -clause that establishes the size as 32 bits. -In such circumstances allocations for that type will -be from the 32-bit heap. Such a clause is not permitted -for a general access type (declared with @code{access all} or -@code{access constant}) as values of such types must be able to refer -to any object of the designated type, including objects residing outside -the 32-bit address range. Existing @w{Ada 83} code will not contain such -type definitions, however, since general access types were introduced -in @w{Ada 95}. - -@item -Switches for @command{GNAT BIND} control whether the internal GNAT -allocation routine @code{__gnat_malloc} uses 64-bit or 32-bit allocations. -@cindex @code{__gnat_malloc} -The switches are respectively @option{-H64} (the default) and -@option{-H32}. -@cindex @option{-H32} (@command{gnatbind}) -@cindex @option{-H64} (@command{gnatbind}) - -@item -The environment variable (logical name) @code{GNAT$NO_MALLOC_64} -@cindex @code{GNAT$NO_MALLOC_64} environment variable -may be used to force @code{__gnat_malloc} to use 32-bit allocation. -If this variable is left -undefined, or defined as @code{"DISABLE"}, @code{"FALSE"}, or @code{"0"}, -then the default (64-bit) allocation is used. -If defined as @code{"ENABLE"}, @code{"TRUE"}, or @code{"1"}, -then 32-bit allocation is used. The gnatbind qualifiers described above -override this logical name. - -@item -A ^gcc switch^gcc switch^ for OpenVMS, @option{-mno-malloc64}, operates -@cindex @option{-mno-malloc64} (^gcc^gcc^) -at a low level to convert explicit calls to @code{malloc} and related -functions from the C run-time library so that they perform allocations -in the 32-bit heap. -Since all internal allocations from GNAT use @code{__gnat_malloc}, -this switch is not required unless the program makes explicit calls on -@code{malloc} (or related functions) from interfaced C code. -@end itemize - - -@node Unchecked conversions -@subsubsection Unchecked conversions - -@noindent -In the case of an @code{Unchecked_Conversion} where the source type is a -64-bit access type or the type @code{System.Address}, and the target -type is a 32-bit type, the compiler will generate a warning. -Even though the generated code will still perform the required -conversions, it is highly recommended in these cases to use -respectively a 32-bit access type or @code{System.Short_Address} -as the source type. -@node Predefined constants -@subsubsection Predefined constants - -@noindent -The following table shows the correspondence between pre-2006 versions of -@value{EDITION} on Alpha OpenVMS (``Old'') and 64-bit @value{EDITION} -(``New''): - -@multitable {@code{System.Short_Memory_Size}} {2**32} {2**64} -@item @b{Constant} @tab @b{Old} @tab @b{New} -@item @code{System.Word_Size} @tab 32 @tab 64 -@item @code{System.Memory_Size} @tab 2**32 @tab 2**64 -@item @code{System.Short_Memory_Size} @tab 2**32 @tab 2**32 -@item @code{System.Address_Size} @tab 32 @tab 64 -@end multitable - -@noindent -If you need to refer to the specific -memory size of a 32-bit implementation, instead of the -actual memory size, use @code{System.Short_Memory_Size} -rather than @code{System.Memory_Size}. -Similarly, references to @code{System.Address_Size} may need -to be replaced by @code{System.Short_Address'Size}. -The program @command{gnatfind} may be useful for locating -references to the above constants, so that you can verify that they -are still correct. - -@node Interfacing with C -@subsubsection Interfacing with C - -@noindent -In order to minimize the impact of the transition to 64-bit addresses on -legacy programs, some fundamental types in the @code{Interfaces.C} -package hierarchy continue to be represented in 32 bits. -These types are: @code{ptrdiff_t}, @code{size_t}, and @code{chars_ptr}. -This eases integration with the default HP C layout choices, for example -as found in the system routines in @code{DECC$SHR.EXE}. -Because of this implementation choice, the type fully compatible with -@code{chars_ptr} is now @code{Short_Address} and not @code{Address}. -Depending on the context the compiler will issue a -warning or an error when type @code{Address} is used, alerting the user to a -potential problem. Otherwise 32-bit programs that use -@code{Interfaces.C} should normally not require code modifications - -The other issue arising with C interfacing concerns pragma @code{Convention}. -For VMS 64-bit systems, there is an issue of the appropriate default size -of C convention pointers in the absence of an explicit size clause. The HP -C compiler can choose either 32 or 64 bits depending on compiler options. -GNAT chooses 32-bits rather than 64-bits in the default case where no size -clause is given. This proves a better choice for porting 32-bit legacy -applications. In order to have a 64-bit representation, it is necessary to -specify a size representation clause. For example: - -@smallexample @c ada -type int_star is access Interfaces.C.int; -pragma Convention(C, int_star); -for int_star'Size use 64; -- Necessary to get 64 and not 32 bits -@end smallexample - -@node 32/64-bit descriptors -@subsubsection 32/64-bit descriptors - -@noindent -By default, GNAT uses a 64-bit descriptor mechanism. For an imported -subprogram (i.e., a subprogram identified by pragma @code{Import_Function}, -@code{Import_Procedure}, or @code{Import_Valued_Procedure}) that specifies -@code{Short_Descriptor} as its mechanism, a 32-bit descriptor is used. -@cindex @code{Short_Descriptor} mechanism for imported subprograms - -If the configuration pragma @code{Short_Descriptors} is supplied, then -all descriptors will be 32 bits. -@cindex pragma @code{Short_Descriptors} - -@node Experience with source compatibility -@subsubsection Experience with source compatibility - -@noindent -The Security Server and STARLET on I64 provide an interesting ``test case'' -for source compatibility issues, since it is in such system code -where assumptions about @code{Address} size might be expected to occur. -Indeed, there were a small number of occasions in the Security Server -file @file{jibdef.ads} -where a representation clause for a record type specified -32 bits for a component of type @code{Address}. -All of these errors were detected by the compiler. -The repair was obvious and immediate; to simply replace @code{Address} by -@code{Short_Address}. - -In the case of STARLET, there were several record types that should -have had representation clauses but did not. In these record types -there was an implicit assumption that an @code{Address} value occupied -32 bits. -These compiled without error, but their usage resulted in run-time error -returns from STARLET system calls. -Future GNAT technology enhancements may include a tool that detects and flags -these sorts of potential source code porting problems. - -@c **************************************** -@node Taking advantage of 64 bit addressing -@subsection Taking advantage of 64-bit addressing - -@menu -* Making code 64 bit clean:: -* Allocating memory from the 64 bit storage pool:: -* Restrictions on use of 64 bit objects:: -* STARLET and other predefined libraries:: -@end menu - -@node Making code 64 bit clean -@subsubsection Making code 64-bit clean - -@noindent -In order to prevent problems that may occur when (parts of) a -system start using memory outside the 32-bit address range, -we recommend some additional guidelines: - -@itemize @bullet -@item -For imported subprograms that take parameters of the -type @code{System.Address}, ensure that these subprograms can -indeed handle 64-bit addresses. If not, or when in doubt, -change the subprogram declaration to specify -@code{System.Short_Address} instead. - -@item -Resolve all warnings related to size mismatches in -unchecked conversions. Failing to do so causes -erroneous execution if the source object is outside -the 32-bit address space. - -@item -(optional) Explicitly use the 32-bit storage pool -for access types used in a 32-bit context, or use -generic access types where possible -(@pxref{Restrictions on use of 64 bit objects}). -@end itemize - -@noindent -If these rules are followed, the compiler will automatically insert -any necessary checks to ensure that no addresses or access values -passed to 32-bit code ever refer to objects outside the 32-bit -address range. -Any attempt to do this will raise @code{Constraint_Error}. - -@node Allocating memory from the 64 bit storage pool -@subsubsection Allocating memory from the 64-bit storage pool - -@noindent -By default, all allocations -- for both pool-specific and general -access types -- use the 64-bit storage pool. To override -this default, for an individual access type or globally, see -@ref{Access types and 32/64-bit allocation}. - -@node Restrictions on use of 64 bit objects -@subsubsection Restrictions on use of 64-bit objects - -@noindent -Taking the address of an object allocated from a 64-bit storage pool, -and then passing this address to a subprogram expecting -@code{System.Short_Address}, -or assigning it to a variable of type @code{Short_Address}, will cause -@code{Constraint_Error} to be raised. In case the code is not 64-bit clean -(@pxref{Making code 64 bit clean}), or checks are suppressed, -no exception is raised and execution -will become erroneous. - -@node STARLET and other predefined libraries -@subsubsection STARLET and other predefined libraries - -@noindent -All code that comes as part of GNAT is 64-bit clean, but the -restrictions given in @ref{Restrictions on use of 64 bit objects}, -still apply. Look at the package -specs to see in which contexts objects allocated -in 64-bit address space are acceptable. - -@node Technical details -@subsection Technical details - -@noindent -64-bit @value{EDITION} for Open VMS takes advantage of the freedom given in the -Ada standard with respect to the type of @code{System.Address}. Previous -versions of @value{EDITION} have defined this type as private and implemented it as a -modular type. - -In order to allow defining @code{System.Short_Address} as a proper subtype, -and to match the implicit sign extension in parameter passing, -in 64-bit @value{EDITION} for Open VMS, @code{System.Address} is defined as a -visible (i.e., non-private) integer type. -Standard operations on the type, such as the binary operators ``+'', ``-'', -etc., that take @code{Address} operands and return an @code{Address} result, -have been hidden by declaring these -@code{abstract}, a feature introduced in Ada 95 that helps avoid the potential -ambiguities that would otherwise result from overloading. -(Note that, although @code{Address} is a visible integer type, -good programming practice dictates against exploiting the type's -integer properties such as literals, since this will compromise -code portability.) - -Defining @code{Address} as a visible integer type helps achieve -maximum compatibility for existing Ada code, -without sacrificing the capabilities of the 64-bit architecture. -@end ifset @c ************************************************ @node Microsoft Windows Topics @@ -30374,8 +27349,8 @@ should be imported from Ada as follows: @smallexample @c ada @group -function Get_Val (V : Interfaces.C.long) return Interfaces.C.int; -pragma Import (C, Get_Val, External_Name => "get_val"); +@b{function} Get_Val (V : Interfaces.C.long) @b{return} Interfaces.C.int; +@b{pragma} Import (C, Get_Val, External_Name => "get_val"); @end group @end smallexample @@ -30422,9 +27397,9 @@ should be imported from Ada as follows: @smallexample @c ada @group -function Get_Val (V : Interfaces.C.long) return Interfaces.C.int; -pragma Import (Stdcall, Get_Val); --- On the x86 a long is 4 bytes, so the Link_Name is "_get_val@@4" +@b{function} Get_Val (V : Interfaces.C.long) @b{return} Interfaces.C.int; +@b{pragma} Import (Stdcall, Get_Val); +--@i{ On the x86 a long is 4 bytes, so the Link_Name is "_get_val@@4"} @end group @end smallexample @@ -30435,8 +27410,8 @@ case. If instead of writing the above import pragma you write: @smallexample @c ada @group -function Get_Val (V : Interfaces.C.long) return Interfaces.C.int; -pragma Import (Stdcall, Get_Val, External_Name => "retrieve_val"); +@b{function} Get_Val (V : Interfaces.C.long) @b{return} Interfaces.C.int; +@b{pragma} Import (Stdcall, Get_Val, External_Name => "retrieve_val"); @end group @end smallexample @@ -30447,8 +27422,8 @@ of specifying the @code{External_Name} parameter you specify the @smallexample @c ada @group -function Get_Val (V : Interfaces.C.long) return Interfaces.C.int; -pragma Import (Stdcall, Get_Val, Link_Name => "retrieve_val"); +@b{function} Get_Val (V : Interfaces.C.long) @b{return} Interfaces.C.int; +@b{pragma} Import (Stdcall, Get_Val, Link_Name => "retrieve_val"); @end group @end smallexample @@ -30477,7 +27452,7 @@ then, to access this variable from Ada you should write: @smallexample @c ada @group My_Var : Interfaces.C.int; -pragma Import (Stdcall, My_Var); +@b{pragma} Import (Stdcall, My_Var); @end group @end smallexample @@ -30641,7 +27616,7 @@ Note that if the Ada package spec for @file{API.dll} contains the following pragma @smallexample @c ada -pragma Linker_Options ("-lAPI"); +@b{pragma} Linker_Options ("-lAPI"); @end smallexample @noindent @@ -30679,17 +27654,17 @@ then the equivalent Ada spec could be: @smallexample @c ada @group @cartouche -with Interfaces.C.Strings; -package API is - use Interfaces; +@b{with} Interfaces.C.Strings; +@b{package} API @b{is} + @b{use} Interfaces; Some_Var : C.int; - function Get (Str : C.Strings.Chars_Ptr) return C.int; + @b{function} Get (Str : C.Strings.Chars_Ptr) @b{return} C.int; -private - pragma Import (C, Get); - pragma Import (DLL, Some_Var); -end API; +@b{private} + @b{pragma} Import (C, Get); + @b{pragma} Import (DLL, Some_Var); +@b{end} API; @end cartouche @end group @end smallexample @@ -31048,20 +28023,20 @@ variable: @smallexample @c ada @group @cartouche -with Interfaces.C; use Interfaces; -package API is +@b{with} Interfaces.C; @b{use} Interfaces; +@b{package} API @b{is} Count : C.int := 0; - function Factorial (Val : C.int) return C.int; - - procedure Initialize_API; - procedure Finalize_API; - -- Initialization & Finalization routines. More in the next section. -private - pragma Export (C, Initialize_API); - pragma Export (C, Finalize_API); - pragma Export (C, Count); - pragma Export (C, Factorial); -end API; + @b{function} Factorial (Val : C.int) @b{return} C.int; + + @b{procedure} Initialize_API; + @b{procedure} Finalize_API; + --@i{ Initialization & Finalization routines. More in the next section.} +@b{private} + @b{pragma} Export (C, Initialize_API); + @b{pragma} Export (C, Finalize_API); + @b{pragma} Export (C, Count); + @b{pragma} Export (C, Factorial); +@b{end} API; @end cartouche @end group @end smallexample @@ -31069,31 +28044,31 @@ end API; @smallexample @c ada @group @cartouche -package body API is - function Factorial (Val : C.int) return C.int is +@b{package} @b{body} API @b{is} + @b{function} Factorial (Val : C.int) @b{return} C.int @b{is} Fact : C.int := 1; - begin + @b{begin} Count := Count + 1; - for K in 1 .. Val loop + @b{for} K @b{in} 1 .. Val @b{loop} Fact := Fact * K; - end loop; - return Fact; - end Factorial; - - procedure Initialize_API is - procedure Adainit; - pragma Import (C, Adainit); - begin + @b{end} @b{loop}; + @b{return} Fact; + @b{end} Factorial; + + @b{procedure} Initialize_API @b{is} + @b{procedure} Adainit; + @b{pragma} Import (C, Adainit); + @b{begin} Adainit; - end Initialize_API; + @b{end} Initialize_API; - procedure Finalize_API is - procedure Adafinal; - pragma Import (C, Adafinal); - begin + @b{procedure} Finalize_API @b{is} + @b{procedure} Adafinal; + @b{pragma} Import (C, Adafinal); + @b{begin} Adafinal; - end Finalize_API; -end API; + @b{end} Finalize_API; +@b{end} API; @end cartouche @end group @end smallexample @@ -31107,14 +28082,14 @@ follows: @smallexample @c ada @group @cartouche -package API is +@b{package} API @b{is} Count : Integer := 0; - function Factorial (Val : Integer) return Integer; + @b{function} Factorial (Val : Integer) @b{return} Integer; - procedure Initialize_API; - procedure Finalize_API; - -- Initialization and Finalization routines. -end API; + @b{procedure} Initialize_API; + @b{procedure} Finalize_API; + --@i{ Initialization and Finalization routines.} +@b{end} API; @end cartouche @end group @end smallexample @@ -31122,20 +28097,20 @@ end API; @smallexample @c ada @group @cartouche -package body API is - function Factorial (Val : Integer) return Integer is +@b{package} @b{body} API @b{is} + @b{function} Factorial (Val : Integer) @b{return} Integer @b{is} Fact : Integer := 1; - begin + @b{begin} Count := Count + 1; - for K in 1 .. Val loop + @b{for} K @b{in} 1 .. Val @b{loop} Fact := Fact * K; - end loop; - return Fact; - end Factorial; + @b{end} @b{loop}; + @b{return} Fact; + @b{end} Factorial; @dots{} - -- The remainder of this package body is unchanged. -end API; + --@i{ The remainder of this package body is unchanged.} +@b{end} API; @end cartouche @end group @end smallexample @@ -31222,11 +28197,11 @@ example consider a DLL comprising the following package @code{API}: @smallexample @c ada @group @cartouche -package API is +@b{package} API @b{is} Count : Integer := 0; @dots{} - -- Remainder of the package omitted. -end API; + --@i{ Remainder of the package omitted.} +@b{end} API; @end cartouche @end group @end smallexample @@ -31239,10 +28214,10 @@ DLL is: @smallexample @c ada @group @cartouche -package API is +@b{package} API @b{is} Count : Integer; - pragma Import (DLL, Count); -end API; + @b{pragma} Import (DLL, Count); +@b{end} API; @end cartouche @end group @end smallexample diff --git a/gcc/ada/gnatsym.adb b/gcc/ada/gnatsym.adb deleted file mode 100644 index 5a88994..0000000 --- a/gcc/ada/gnatsym.adb +++ /dev/null @@ -1,359 +0,0 @@ ------------------------------------------------------------------------------- --- -- --- GNAT COMPILER COMPONENTS -- --- -- --- G N A T S Y M -- --- -- --- B o d y -- --- -- --- Copyright (C) 2003-2010, Free Software Foundation, Inc. -- --- -- --- GNAT is free software; you can redistribute it and/or modify it under -- --- terms of the GNU General Public License as published by the Free Soft- -- --- ware Foundation; either version 3, or (at your option) any later ver- -- --- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- --- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -- --- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License -- --- for more details. You should have received a copy of the GNU General -- --- Public License distributed with GNAT; see file COPYING3. If not, go to -- --- http://www.gnu.org/licenses for a complete copy of the license. -- --- -- --- GNAT was originally developed by the GNAT team at New York University. -- --- Extensive contributions were provided by Ada Core Technologies Inc. -- --- -- ------------------------------------------------------------------------------- - --- This utility application creates symbol files in a format that is --- platform-dependent. - --- A symbol file is a text file that lists the symbols to be exported from --- a shared library. The format of a symbol file depends on the platform; --- it may be a simple enumeration of the symbol (one per line) or a more --- elaborate format (on VMS, for example). A symbol file may be used as an --- input to the platform linker when building a shared library. - --- This utility is not available on all platforms. It is currently supported --- only on OpenVMS. - --- gnatsym takes as parameters: --- - the name of the symbol file to create --- - (optional) the policy to create the symbol file --- - (optional) the name of the reference symbol file --- - the names of one or more object files where the symbols are found - -with Gnatvsn; use Gnatvsn; -with Osint; use Osint; -with Output; use Output; -with Symbols; use Symbols; -with Table; - -with Ada.Exceptions; use Ada.Exceptions; -with Ada.Text_IO; use Ada.Text_IO; - -with GNAT.Command_Line; use GNAT.Command_Line; -with GNAT.Directory_Operations; use GNAT.Directory_Operations; -with GNAT.OS_Lib; use GNAT.OS_Lib; - -procedure Gnatsym is - - Empty_String : aliased String := ""; - Empty : constant String_Access := Empty_String'Unchecked_Access; - -- To initialize variables Reference and Version_String - - Copyright_Displayed : Boolean := False; - -- A flag to prevent multiple display of the Copyright notice - - Success : Boolean := True; - - Symbol_Policy : Policy := Autonomous; - - Verbose : Boolean := False; - -- True when -v switch is used - - Quiet : Boolean := False; - -- True when -q switch is used - - Symbol_File_Name : String_Access := null; - -- The name of the symbol file - - Reference_Symbol_File_Name : String_Access := Empty; - -- The name of the reference symbol file - - Version_String : String_Access := Empty; - -- The version of the library (used on VMS) - - type Object_File_Data is record - Path : String_Access; - Name : String_Access; - end record; - - package Object_Files is new Table.Table - (Table_Component_Type => Object_File_Data, - Table_Index_Type => Natural, - Table_Low_Bound => 0, - Table_Initial => 10, - Table_Increment => 100, - Table_Name => "Gnatsymb.Object_Files"); - -- A table to store the object file names - - Object_File : Natural := 0; - -- An index to traverse the Object_Files table - - procedure Display_Copyright; - -- Display Copyright notice - - procedure Parse_Cmd_Line; - -- Parse the command line switches and file names - - procedure Usage; - -- Display the usage - - ----------------------- - -- Display_Copyright -- - ----------------------- - - procedure Display_Copyright is - begin - if not Copyright_Displayed then - Write_Eol; - Write_Str ("GNATSYMB "); - Write_Str (Gnat_Version_String); - Write_Eol; - Write_Str ("Copyright 2003-2004 Free Software Foundation, Inc"); - Write_Eol; - Copyright_Displayed := True; - end if; - end Display_Copyright; - - -------------------- - -- Parse_Cmd_Line -- - -------------------- - - procedure Parse_Cmd_Line is - begin - loop - case GNAT.Command_Line.Getopt ("c C D q r: R s: v V:") is - when ASCII.NUL => - exit; - - when 'c' => - Symbol_Policy := Compliant; - - when 'C' => - Symbol_Policy := Controlled; - - when 'D' => - Symbol_Policy := Direct; - - when 'q' => - Quiet := True; - - when 'r' => - Reference_Symbol_File_Name := - new String'(GNAT.Command_Line.Parameter); - - when 'R' => - Symbol_Policy := Restricted; - - when 's' => - Symbol_File_Name := new String'(GNAT.Command_Line.Parameter); - - when 'v' => - Verbose := True; - - when 'V' => - Version_String := new String'(GNAT.Command_Line.Parameter); - - when others => - Fail ("invalid switch: " & Full_Switch); - end case; - end loop; - - -- Get the object file names and put them in the table in alphabetical - -- order of base names. - - loop - declare - S : constant String_Access := - new String'(GNAT.Command_Line.Get_Argument); - - begin - exit when S'Length = 0; - - Object_Files.Increment_Last; - - declare - Base : constant String := Base_Name (S.all); - Last : constant Positive := Object_Files.Last; - J : Positive; - - begin - J := 1; - while J < Last loop - if Object_Files.Table (J).Name.all > Base then - Object_Files.Table (J + 1 .. Last) := - Object_Files.Table (J .. Last - 1); - exit; - end if; - - J := J + 1; - end loop; - - Object_Files.Table (J) := (S, new String'(Base)); - end; - end; - end loop; - exception - when Invalid_Switch => - Usage; - Fail ("invalid switch : " & Full_Switch); - end Parse_Cmd_Line; - - ----------- - -- Usage -- - ----------- - - procedure Usage is - begin - Write_Line ("gnatsym [options] object_file {object_file}"); - Write_Eol; - Write_Line (" -c Compliant symbol policy"); - Write_Line (" -C Controlled symbol policy"); - Write_Line (" -q Quiet mode"); - Write_Line (" -r<ref> Reference symbol file name"); - Write_Line (" -R Restricted symbol policy"); - Write_Line (" -s<sym> Symbol file name"); - Write_Line (" -v Verbose mode"); - Write_Line (" -V<ver> Version"); - Write_Eol; - Write_Line ("Specifying a symbol file with -s<sym> is compulsory"); - Write_Eol; - end Usage; - --- Start of processing of Gnatsym - -begin - -- Initialize Object_Files table - - Object_Files.Set_Last (0); - - -- Parse the command line - - Parse_Cmd_Line; - - if Verbose then - Display_Copyright; - end if; - - -- If there is no symbol file or no object files on the command line, - -- display the usage and exit with an error status. - - if Symbol_File_Name = null or else Object_Files.Last = 0 then - Usage; - OS_Exit (1); - - -- When symbol policy is direct, simply copy the reference symbol file to - -- the symbol file. - - elsif Symbol_Policy = Direct then - declare - File_In : Ada.Text_IO.File_Type; - File_Out : Ada.Text_IO.File_Type; - Line : String (1 .. 1_000); - Last : Natural; - - begin - begin - Open (File_In, In_File, Reference_Symbol_File_Name.all); - - exception - when X : others => - if not Quiet then - Put_Line - ("could not open """ & - Reference_Symbol_File_Name.all - & """"); - Put_Line (Exception_Message (X)); - end if; - - OS_Exit (1); - end; - - begin - Create (File_Out, Out_File, Symbol_File_Name.all); - - exception - when X : others => - if not Quiet then - Put_Line - ("could not create """ & Symbol_File_Name.all & """"); - Put_Line (Exception_Message (X)); - end if; - - OS_Exit (1); - end; - - while not End_Of_File (File_In) loop - Get_Line (File_In, Line, Last); - Put_Line (File_Out, Line (1 .. Last)); - end loop; - - Close (File_In); - Close (File_Out); - end; - - else - if Verbose then - Write_Str ("Initializing symbol file """); - Write_Str (Symbol_File_Name.all); - Write_Line (""""); - end if; - - -- Initialize symbol file and, if specified, read reference file - - Symbols.Initialize - (Symbol_File => Symbol_File_Name.all, - Reference => Reference_Symbol_File_Name.all, - Symbol_Policy => Symbol_Policy, - Quiet => Quiet, - Version => Version_String.all, - Success => Success); - - -- Process the object files in order. Stop as soon as there is - -- something wrong. - - Object_File := 0; - - while Success and then Object_File < Object_Files.Last loop - Object_File := Object_File + 1; - - if Verbose then - Write_Str ("Processing object file """); - Write_Str (Object_Files.Table (Object_File).Path.all); - Write_Line (""""); - end if; - - Processing.Process - (Object_Files.Table (Object_File).Path.all, - Success); - end loop; - - -- Finalize the symbol file - - if Success then - if Verbose then - Write_Str ("Finalizing """); - Write_Str (Symbol_File_Name.all); - Write_Line (""""); - end if; - - Finalize (Quiet, Success); - end if; - - -- Fail if there was anything wrong - - if not Success then - Fail ("unable to build symbol file"); - end if; - end if; -end Gnatsym; diff --git a/gcc/ada/makeutl.adb b/gcc/ada/makeutl.adb index 9dde6cb..cbfd01e 100644 --- a/gcc/ada/makeutl.adb +++ b/gcc/ada/makeutl.adb @@ -777,7 +777,7 @@ package body Makeutl is Flush_Messages : Boolean := True) is begin - if Flush_Messages and then not No_Exit_Message then + if Flush_Messages and not No_Exit_Message then if Total_Errors_Detected /= 0 or else Warnings_Detected /= 0 then Errutil.Finalize; end if; diff --git a/gcc/ada/makeutl.ads b/gcc/ada/makeutl.ads index ff7b492..e946df6 100644 --- a/gcc/ada/makeutl.ads +++ b/gcc/ada/makeutl.ads @@ -81,8 +81,8 @@ package Makeutl is No_Exit_Message_Option : constant String := "--no-exit-message"; -- Switch to suppress exit error message when there are compilation - -- failures. This is useful when a tool, such as gnatprove, call silently - -- the builder and do not want to pollute its output with error messages + -- failures. This is useful when a tool, such as gnatprove, silently calls + -- the builder and does not want to pollute its output with error messages -- coming from the builder. This is an internal switch. Load_Standard_Base : Boolean := True; diff --git a/gcc/ada/opt.ads b/gcc/ada/opt.ads index bdbdf0a..e2cc76a 100644 --- a/gcc/ada/opt.ads +++ b/gcc/ada/opt.ads @@ -1941,7 +1941,7 @@ package Opt is No_Exit_Message : Boolean := False; -- GNATMAKE, GPRBUILD -- Set with switch --no-exit-message. When True, if there are compilation - -- failure, the builder does not issue an exit error message. + -- failures, the builder does not issue an exit error message. Optimize_Alignment_Config : Character; -- GNAT diff --git a/gcc/ada/projects.texi b/gcc/ada/projects.texi index 54a43e0..65939c0 100644 --- a/gcc/ada/projects.texi +++ b/gcc/ada/projects.texi @@ -41,7 +41,7 @@ project files allow you to specify: @item The directory in which the compiler's output (@file{ALI} files, object files, tree files, etc.) is to be placed @item The directory in which the executable programs are to be placed -@item ^Switch^Switch^ settings for any of the project-enabled tools; +@item Switch settings for any of the project-enabled tools; you can apply these settings either globally or to individual compilation units. @item The source files containing the main subprogram(s) to be built @item The source programming language(s) @@ -68,7 +68,7 @@ Subsystems}). More generally, the Project Manager lets you structure large development efforts into hierarchical subsystems, where build decisions are delegated to the subsystem level, and thus different compilation environments - (^switch^switch^ settings) used for different subsystems. + (switch settings) used for different subsystems. @item You can organize GNAT projects in a hierarchy: a child project can extend a parent project, inheriting the parent's source files and optionally overriding any of them with alternative versions @@ -80,8 +80,8 @@ Subsystems}). Several tools support project files, generally in addition to specifying the information on the command line itself). They share common switches to control the loading of the project (in particular -@option{^-P^/PROJECT_FILE=^@emph{projectfile}} and -@option{^-X^/EXTERNAL_REFERENCE=^@emph{vbl}=@emph{value}}). +@option{-P@emph{projectfile}} and +@option{-X@emph{vbl}=@emph{value}}). The Project Manager supports a wide range of development strategies, for systems of all sizes. Here are some typical practices that are @@ -89,7 +89,7 @@ easily handled: @itemize @bullet @item Using a common set of source files and generating object files in different - directories via different ^switch^switch^ settings. It can be used for instance, for + directories via different switch settings. It can be used for instance, for generating separate sets of object files for debugging and for production. @item Using a mostly-shared set of source files with different versions of some units or subunits. It can be used for instance, for grouping and hiding @@ -185,19 +185,19 @@ following examples. The Ada source files @file{pack.ads}, @file{pack.adb}, and @file{proc.adb} are in the @file{common/} directory. The file @file{proc.adb} contains an Ada main subprogram @code{Proc} that @code{with}s package @code{Pack}. We want to compile -these source files with the ^switch^switch^ -@option{^-O2^-O2^}, and put the resulting files in +these source files with the switch +@option{-O2}, and put the resulting files in the directory @file{obj/}. @smallexample @group -^common/^[COMMON]^ +common/ pack.ads pack.adb proc.adb @end group @group -^common/release/^[COMMON.RELEASE]^ +common/release/ proc.ali, proc.o pack.ali, pack.o @end group @end smallexample @@ -450,7 +450,7 @@ Its value is the path to the object directory, either absolute or relative to the directory containing the project file. This directory must already exist and be readable and writable, although some tools have a switch to create the directory if needed (See -the switch @code{^-p^/CREATE_MISSING_DIRS^} for @command{gnatmake} +the switch @code{-p} for @command{gnatmake} and @command{gprbuild}). If the attribute @code{Object_Dir} is not specified, it defaults to @@ -540,7 +540,7 @@ If this attribute is defined in the project, then spawning the builder with a command such as @smallexample - gnatmake ^-Pbuild^/PROJECT_FILE=build^ + gnatmake -Pbuild @end smallexample @noindent @@ -617,13 +617,13 @@ packages would be involved in the build process. @noindent Let's first examine the compiler switches. As stated in the initial description -of the example, we want to compile all files with @option{^-O2^-O2^}. This is a +of the example, we want to compile all files with @option{-O2}. This is a compiler switch, although it is usual, on the command line, to pass it to the builder which then passes it to the compiler. It is recommended to use directly the right package, which will make the setup easier to understand for other people. -Several attributes can be used to specify the ^switches^switches^: +Several attributes can be used to specify the switches: @table @asis @item @b{Default_Switches}: @@ -636,22 +636,22 @@ Several attributes can be used to specify the ^switches^switches^: likely be used for each language, and each compiler has its own set of switches). The value of the attribute is a list of switches. - In this example, we want to compile all Ada source files with the ^switch^switch^ - @option{^-O2^-O2^}, and the resulting project file is as follows + In this example, we want to compile all Ada source files with the switch + @option{-O2}, and the resulting project file is as follows (only the @code{Compiler} package is shown): @smallexample @b{package} Compiler @b{is} - @b{for} Default_Switches ("Ada") @b{use} ("^-O2^-O2^"); + @b{for} Default_Switches ("Ada") @b{use} ("-O2"); @b{end} Compiler; @end smallexample -@item @b{^Switches^Switches^}: -@cindex @code{^Switches^Switches^} - in some cases, we might want to use specific ^switches^switches^ +@item @b{Switches}: +@cindex @code{Switches} + in some cases, we might want to use specific switches for one or more files. For instance, compiling @file{proc.adb} might not be possible at high level of optimization because of a compiler issue. - In such a case, the @emph{^Switches^Switches^} + In such a case, the @emph{Switches} attribute (indexed on the file name) can be used and will override the switches defined by @emph{Default_Switches}. Our project file would become: @@ -659,30 +659,30 @@ Several attributes can be used to specify the ^switches^switches^: @smallexample package Compiler is for Default_Switches ("Ada") - use ("^-O2^-O2^"); - for ^Switches^Switches^ ("proc.adb") - use ("^-O0^-O0^"); + use ("-O2"); + for Switches ("proc.adb") + use ("-O0"); end Compiler; @end smallexample @noindent - @code{^Switches^Switches^} may take a pattern as an index, such as in: + @code{Switches} may take a pattern as an index, such as in: @smallexample package Compiler is for Default_Switches ("Ada") - use ("^-O2^-O2^"); - for ^Switches^Switches^ ("pkg*") - use ("^-O0^-O0^"); + use ("-O2"); + for Switches ("pkg*") + use ("-O0"); end Compiler; @end smallexample @noindent - Sources @file{pkg.adb} and @file{pkg-child.adb} would be compiled with ^-O0^-O0^, - not ^-O2^-O2^. + Sources @file{pkg.adb} and @file{pkg-child.adb} would be compiled with -O0, + not -O2. @noindent - @code{^Switches^Switches^} can also be given a language name as index instead of a file + @code{Switches} can also be given a language name as index instead of a file name in which case it has the same semantics as @emph{Default_Switches}. However, indexes with wild cards are never valid for language name. @@ -696,7 +696,7 @@ Several attributes can be used to specify the ^switches^switches^: @end table The switches for the other tools are defined in a similar manner through the -@b{Default_Switches} and @b{^Switches^Switches^} attributes, respectively in the +@b{Default_Switches} and @b{Switches} attributes, respectively in the @emph{Builder} package (for @command{gnatmake} and @command{gprbuild}), the @emph{Binder} package (binding Ada executables) and the @emph{Linker} package (for linking executables). @@ -711,7 +711,7 @@ Now that our project files are written, let's build our executable. Here is the command we would use from the command line: @smallexample - gnatmake ^-Pbuild^/PROJECT_FILE=build^ + gnatmake -Pbuild @end smallexample @noindent @@ -727,7 +727,7 @@ same way: create the file @file{utils.c} in the @file{common} directory, set the attribute @emph{Languages} to @code{"(Ada, C)"}, and run @smallexample - gprbuild ^-Pbuild^/PROJECT_FILE=build^ + gprbuild -Pbuild @end smallexample @noindent @@ -784,12 +784,12 @@ on Windows), we could configure our project file to build "proc1" (resp proc1.exe) with the following addition: @smallexample @c projectfile - project Build is - ... -- same as before - package Builder is - for Executable ("proc.adb") use "proc1"; - end Builder - end Build; + @b{project} Build @b{is} + ... --@i{ same as before} + @b{package} Builder @b{is} + @b{for} Executable ("proc.adb") @b{use} "proc1"; + @b{end} Builder + @b{end} Build; @end smallexample @noindent @@ -815,18 +815,18 @@ To illustrate some other project capabilities, here is a slightly more complex project using similar sources and a main program in C: @smallexample @c projectfile -project C_Main is - for Languages use ("Ada", "C"); - for Source_Dirs use ("common"); - for Object_Dir use "obj"; - for Main use ("main.c"); - package Compiler is +@b{project} C_Main @b{is} + @b{for} Languages @b{use} ("Ada", "C"); + @b{for} Source_Dirs @b{use} ("common"); + @b{for} Object_Dir @b{use} "obj"; + @b{for} Main @b{use} ("main.c"); + @b{package} Compiler @b{is} C_Switches := ("-pedantic"); - for Default_Switches ("C") use C_Switches; - for Default_Switches ("Ada") use ("^-gnaty^-gnaty^"); - for ^Switches^Switches^ ("main.c") use C_Switches & ("-g"); - end Compiler; -end C_Main; + @b{for} Default_Switches ("C") @b{use} C_Switches; + @b{for} Default_Switches ("Ada") @b{use} ("-gnaty"); + @b{for} Switches ("main.c") @b{use} C_Switches & ("-g"); + @b{end} Compiler; +@b{end} C_Main; @end smallexample @noindent @@ -848,7 +848,7 @@ In this specific situation the use of a variable could have been replaced by a reference to the @code{Default_Switches} attribute: @smallexample @c projectfile - for ^Switches^Switches^ ("c_main.c") use Compiler'Default_Switches ("C") & ("-g"); + @b{for} Switches ("c_main.c") @b{use} Compiler'Default_Switches ("C") & ("-g"); @end smallexample @noindent @@ -940,7 +940,7 @@ The following attributes can be defined in package @code{Naming}: @code{Specification_Exceptions}. If @code{Spec_Suffix ("Ada")} is not specified, then the default is - @code{"^.ads^.ADS^"}. + @code{".ads"}. A non empty value must satisfy the following requirements: @@ -969,7 +969,7 @@ The following attributes can be defined in package @code{Naming}: In addition, they must be different from any of the values in @code{Spec_Suffix}. If @code{Body_Suffix ("Ada")} is not specified, then the default is - @code{"^.adb^.ADB^"}. + @code{".adb"}. If @code{Body_Suffix ("Ada")} and @code{Spec_Suffix ("Ada")} end with the same string, then a file name that ends with the longest of these two @@ -1029,39 +1029,20 @@ The following attributes can be defined in package @code{Naming}: @end table -@ifclear vms +@set unw For example, the following package models the Apex file naming rules: @smallexample @c projectfile @group - package Naming is - for Casing use "lowercase"; - for Dot_Replacement use "."; - for Spec_Suffix ("Ada") use ".1.ada"; - for Body_Suffix ("Ada") use ".2.ada"; - end Naming; + @b{package} Naming @b{is} + @b{for} Casing @b{use} "lowercase"; + @b{for} Dot_Replacement @b{use} "."; + @b{for} Spec_Suffix ("Ada") @b{use} ".1.ada"; + @b{for} Body_Suffix ("Ada") @b{use} ".2.ada"; + @b{end} Naming; @end group @end smallexample -@end ifclear -@ifset vms -For example, the following package models the DEC Ada file naming rules: - -@smallexample @c projectfile -@group - package Naming is - for Casing use "lowercase"; - for Dot_Replacement use "__"; - for Spec_Suffix ("Ada") use "_.ada"; - for Body_Suffix ("Ada") use ".ada"; - end Naming; -@end group -@end smallexample - -@noindent -(Note that @code{Casing} is @code{"lowercase"} because GNAT gets the file -names in lower case) -@end ifset @c --------------------------------------------- @node Installation @@ -1186,11 +1167,11 @@ This is easily solved by adding the following @b{with} clauses at the beginning of our project: @smallexample @c projectfile - with "gtkada.gpr"; - with "a/b/logging.gpr"; - project Build is - ... -- as before - end Build; + @b{with} "gtkada.gpr"; + @b{with} "a/b/logging.gpr"; + @b{project} Build @b{is} + ... --@i{ as before} + @b{end} Build; @end smallexample @noindent @@ -1219,7 +1200,7 @@ project files rather than packages. Each literal string after @code{with} is the path (absolute or relative) to a project file. The @code{.gpr} extension is optional, although we recommend adding it. If no extension is specified, -and no project file with the @file{^.gpr^.GPR^} extension is found, then +and no project file with the @file{.gpr} extension is found, then the file is searched for exactly as written in the @code{with} clause, that is with no extension. @@ -1245,7 +1226,7 @@ the search stops: @cindex @code{GPR_PROJECT_PATH} @cindex @code{ADA_PROJECT_PATH} Then it is searched relative to all the directories specified in the - ^environment variables^logical names^ @b{GPR_PROJECT_PATH_FILE}, + environment variables @b{GPR_PROJECT_PATH_FILE}, @b{GPR_PROJECT_PATH} and @b{ADA_PROJECT_PATH} (in that order) if they exist. The value of @b{GPR_PROJECT_PATH_FILE}, when defined, is the path name of a text file that contains project directory path names, one per line. @@ -1371,11 +1352,11 @@ There are two main approaches to avoiding this duplication: @smallexample @c projectfile project Logging is package Compiler is - for ^Switches^Switches^ ("Ada") - use ("^-O2^-O2^"); + for Switches ("Ada") + use ("-O2"); end Compiler; package Binder is - for ^Switches^Switches^ ("Ada") + for Switches ("Ada") use ("-E"); end Binder; end Logging; @@ -1384,7 +1365,7 @@ There are two main approaches to avoiding this duplication: project Build is package Compiler renames Logging.Compiler; package Binder is - for ^Switches^Switches^ ("Ada") use Logging.Binder'Switches ("Ada"); + for Switches ("Ada") use Logging.Binder'Switches ("Ada"); end Binder; end Build; @end smallexample @@ -1416,8 +1397,8 @@ There are two main approaches to avoiding this duplication: abstract project Shared is for Source_Files use (); -- no sources package Compiler is - for ^Switches^Switches^ ("Ada") - use ("^-O2^-O2^"); + for Switches ("Ada") + use ("-O2"); end Compiler; end Shared; @@ -1503,7 +1484,7 @@ information, when the second will focus on improving code optimization). Let's enhance our example to support a debug and a release modes.The issue is to let the user choose what kind of system he is building: -use @option{-g} as compiler switches in debug mode and @option{^-O2^-O2^} +use @option{-g} as compiler switches in debug mode and @option{-O2} in release mode. We will also setup the projects so that we do not share the same object directory in both modes, otherwise switching from one to the other might trigger more recompilations than needed or mix objects from the 2 modes. @@ -1532,10 +1513,10 @@ order of priority): or gnatmake -Pbuild.gpr -Xmode=release @end smallexample -@item @b{^Environment variables^Logical names^}: +@item @b{Environment variables}: When the external value does not come from the command line, it can come from - the value of ^environment variables^logical names^ of the appropriate name. - In our case, if ^an environment variable^a logical name^ called "mode" + the value of environment variables of the appropriate name. + In our case, if an environment variable called "mode" exist, its value will be taken into account. @item @b{External function second parameter} @@ -1549,10 +1530,10 @@ the external. For instance, we could setup the object directory to point to either @file{obj/debug} or @file{obj/release} by changing our project to @smallexample @c projectfile - project Build is - for Object_Dir use "obj/" & external ("mode", "debug"); - ... -- as before - end Build; + @b{project} Build @b{is} + @b{for} Object_Dir @b{use} "obj/" & @b{external} ("mode", "debug"); + ... --@i{ as before} + @b{end} Build; @end smallexample @noindent @@ -1570,21 +1551,21 @@ Such a variable can then be used in a @b{case construction} and create condition sections in the project. The following example shows how this can be done: @smallexample @c projectfile - project Build is - type Mode_Type is ("debug", "release"); -- all possible values - Mode : Mode_Type := external ("mode", "debug"); -- a typed variable - - package Compiler is - case Mode is - when "debug" => - for ^Switches^Switches^ ("Ada") - use ("-g"); - when "release" => - for ^Switches^Switches^ ("Ada") - use ("^-O2^-O2^"); - end case; - end Compiler; - end Build; + @b{project} Build @b{is} + @b{type} Mode_Type @b{is} ("debug", "release"); --@i{ all possible values} + Mode : Mode_Type := @b{external} ("mode", "debug"); --@i{ a typed variable} + + @b{package} Compiler @b{is} + @b{case} Mode @b{is} + @b{when} "debug" => + @b{for} Switches ("Ada") + @b{use} ("-g"); + @b{when} "release" => + @b{for} Switches ("Ada") + @b{use} ("-O2"); + @b{end} @b{case}; + @b{end} Compiler; + @b{end} Build; @end smallexample @noindent @@ -1684,11 +1665,11 @@ front of the @code{project} keyword. Here is the new version of @file{logging.gpr} that makes it a library: @smallexample @c projectfile -library project Logging is -- "library" is optional - for Library_Name use "logging"; -- will create "liblogging.a" on Unix - for Object_Dir use "obj"; - for Library_Dir use "lib"; -- different from object_dir -end Logging; +library @b{project} Logging @b{is} --@i{ "library" is optional} + @b{for} Library_Name @b{use} "logging"; --@i{ will create "liblogging.a" on Unix} + @b{for} Object_Dir @b{use} "obj"; + @b{for} Library_Dir @b{use} "lib"; --@i{ different from object_dir} +@b{end} Logging; @end smallexample @noindent @@ -1740,13 +1721,13 @@ Other library-related attributes can be used to change the defaults: @smallexample @c projectfile @group - project Logging is + @b{project} Logging @b{is} Version := "1"; - for Library_Dir use "lib"; - for Library_Name use "logging"; - for Library_Kind use "dynamic"; - for Library_Version use "liblogging.so." & Version; - end Logging; + @b{for} Library_Dir @b{use} "lib"; + @b{for} Library_Name @b{use} "logging"; + @b{for} Library_Kind @b{use} "dynamic"; + @b{for} Library_Version @b{use} "liblogging.so." & Version; + @b{end} Logging; @end group @end smallexample @@ -1840,21 +1821,20 @@ All @file{ALI} files will also be copied from the object directory to the library directory. To build executables, @command{gnatmake} will use the library rather than the individual object files. -@ifclear vms Library projects can also be useful to describe a library that need to be used but, for some reason, cannot be rebuilt. For instance, it is the case when some of the library sources are not available. Such library projects need simply to use the @code{Externally_Built} attribute as in the example below: @smallexample @c projectfile -library project Extern_Lib is - for Languages use ("Ada", "C"); - for Source_Dirs use ("lib_src"); - for Library_Dir use "lib2"; - for Library_Kind use "dynamic"; - for Library_Name use "l2"; - for Externally_Built use "true"; -- <<<< -end Extern_Lib; +library @b{project} Extern_Lib @b{is} + @b{for} Languages @b{use} ("Ada", "C"); + @b{for} Source_Dirs @b{use} ("lib_src"); + @b{for} Library_Dir @b{use} "lib2"; + @b{for} Library_Kind @b{use} "dynamic"; + @b{for} Library_Name @b{use} "l2"; + @b{for} Externally_Built @b{use} "true"; --@i{ <<<<} +@b{end} Extern_Lib; @end smallexample @noindent @@ -1874,7 +1854,6 @@ In such a situation, it is better to use the externally built library project so that all other subsystems depending on it can declare this dependency thanks to a project @code{with} clause, which in turn will trigger the builder to find the proper order of libraries in the final link command. -@end ifclear @c --------------------------------------------- @node Stand-alone Library Projects @@ -1914,9 +1893,9 @@ language and takes a list of sources as parameter. @smallexample @c projectfile @group - for Library_Dir use "lib"; - for Library_Name use "loggin"; - for Library_Interface use ("lib1", "lib2"); -- unit names + @b{for} Library_Dir @b{use} "lib"; + @b{for} Library_Name @b{use} "loggin"; + @b{for} Library_Interface @b{use} ("lib1", "lib2"); --@i{ unit names} @end group @end smallexample @@ -1944,11 +1923,11 @@ language and takes a list of sources as parameter. @smallexample @c projectfile @group - for Library_Dir use "lib"; - for Library_Name use "loggin"; - for Library_Kind use "dynamic"; - for Library_Interface use ("lib1", "lib2"); -- unit names - for Library_Standalone use "encapsulated"; + @b{for} Library_Dir @b{use} "lib"; + @b{for} Library_Name @b{use} "loggin"; + @b{for} Library_Kind @b{use} "dynamic"; + @b{for} Library_Interface @b{use} ("lib1", "lib2"); --@i{ unit names} + @b{for} Library_Standalone @b{use} "encapsulated"; @end group @end smallexample @@ -1956,7 +1935,7 @@ language and takes a list of sources as parameter. In order to include the elaboration code in the stand-alone library, the binder is invoked on the closure of the library units creating a package whose name -depends on the library name (^b~logging.ads/b^B$LOGGING.ADS/B^ in the example). +depends on the library name (b~logging.ads/b in the example). This binder-generated package includes @b{initialization} and @b{finalization} procedures whose names depend on the library name (@code{logginginit} and @code{loggingfinal} in the example). The object corresponding to this package is @@ -2125,8 +2104,8 @@ ones is also possible. Here is an example on how to extend the project @code{Build} from previous examples: @smallexample @c projectfile - project Work extends "../bld/build.gpr" is - end Work; + @b{project} Work @b{extends} "../bld/build.gpr" @b{is} + @b{end} Work; @end smallexample @noindent @@ -2240,18 +2219,18 @@ create several extending projects: @noindent @smallexample @c projectfile - project A_Ext extends "a.gpr" is - for Source_Files use ("a1.adb", "a1.ads"); - end A_Ext; - - with "a_ext.gpr"; - project B_Ext extends "b.gpr" is - end B_Ext; - - with "b_ext.gpr"; - project C_Ext extends "c.gpr" is - for Source_Files use ("c1.adb"); - end C_Ext; + @b{project} A_Ext @b{extends} "a.gpr" @b{is} + @b{for} Source_Files @b{use} ("a1.adb", "a1.ads"); + @b{end} A_Ext; + + @b{with} "a_ext.gpr"; + @b{project} B_Ext @b{extends} "b.gpr" @b{is} + @b{end} B_Ext; + + @b{with} "b_ext.gpr"; + @b{project} C_Ext @b{extends} "c.gpr" @b{is} + @b{for} Source_Files @b{use} ("c1.adb"); + @b{end} C_Ext; @end smallexample @noindent @@ -2292,14 +2271,14 @@ Thus, in our example we could create the following projects instead: @noindent @smallexample @c projectfile - project A_Ext extends "a.gpr" is - for Source_Files use ("a1.adb", "a1.ads"); - end A_Ext; - - with "a_ext.gpr"; - project C_Ext extends all "c.gpr" is - for Source_Files use ("c1.adb"); - end C_Ext; + @b{project} A_Ext @b{extends} "a.gpr" @b{is} + @b{for} Source_Files @b{use} ("a1.adb", "a1.ads"); + @b{end} A_Ext; + + @b{with} "a_ext.gpr"; + @b{project} C_Ext @b{extends} @b{all} "c.gpr" @b{is} + @b{for} Source_Files @b{use} ("c1.adb"); + @b{end} C_Ext; @end smallexample @noindent @@ -2369,9 +2348,9 @@ and C. Then, when you build with this will build all mains from A, B and C. @smallexample @c projectfile - aggregate project Agg is - for Project_Files use ("a.gpr", "b.gpr", "c.gpr"); - end Agg; + aggregate @b{project} Agg @b{is} + @b{for} Project_Files @b{use} ("a.gpr", "b.gpr", "c.gpr"); + @b{end} Agg; @end smallexample If B or C do not define any main program (through their Main @@ -2442,25 +2421,25 @@ make sure all your user have a consistent environment when building. The syntax looks like @smallexample @c projectfile - aggregate project Agg is - for Project_Files use ("A.gpr", "B.gpr"); - for Project_Path use ("../dir1", "../dir1/dir2"); - for External ("BUILD") use "PRODUCTION"; - - package Builder is - for ^Switches^Switches^ ("Ada") use ("-q"); - end Builder; - end Agg; + aggregate @b{project} Agg @b{is} + @b{for} Project_Files @b{use} ("A.gpr", "B.gpr"); + @b{for} Project_Path @b{use} ("../dir1", "../dir1/dir2"); + @b{for} External ("BUILD") @b{use} "PRODUCTION"; + + @b{package} Builder @b{is} + @b{for} Switches ("Ada") @b{use} ("-q"); + @b{end} Builder; + @b{end} Agg; @end smallexample One of the often requested features in projects is to be able to reference external variables in @code{with} statements, as in @smallexample @c projectfile - with external("SETUP") & "path/prj.gpr"; -- ILLEGAL - project MyProject is + @b{with} @b{external}("SETUP") & "path/prj.gpr"; --@i{ ILLEGAL} + @b{project} MyProject @b{is} ... - end MyProject; + @b{end} MyProject; @end smallexample For various reasons, this isn't authorized. But using aggregate @@ -2468,15 +2447,15 @@ projects provide an elegant solution. For instance, you could use a project file like: @smallexample @c projectfile -aggregate project Agg is - for Project_Path use (external("SETUP") & "path"); - for Project_Files use ("myproject.gpr"); -end Agg; +aggregate @b{project} Agg @b{is} + @b{for} Project_Path @b{use} (@b{external}("SETUP") & "path"); + @b{for} Project_Files @b{use} ("myproject.gpr"); +@b{end} Agg; -with "prj.gpr"; -- searched on Agg'Project_Path -project MyProject is +@b{with} "prj.gpr"; --@i{ searched on Agg'Project_Path} +@b{project} MyProject @b{is} ... -end MyProject; +@b{end} MyProject; @end smallexample @c -------------------------------------------- @@ -2586,11 +2565,11 @@ number of system calls that are needed. Here are a few valid examples: @smallexample @c projectfile - for Project_Files use ("a.gpr", "subdir/b.gpr"); - -- two specific projects relative to the directory of agg.gpr + @b{for} Project_Files @b{use} ("a.gpr", "subdir/b.gpr"); + --@i{ two specific projects relative to the directory of agg.gpr} - for Project_Files use ("**/*.gpr"); - -- all projects recursively + @b{for} Project_Files @b{use} ("**/*.gpr"); + --@i{ all projects recursively} @end smallexample @item @b{Project_Path}: @@ -2660,7 +2639,7 @@ Directories are relative to the location of the aggregate project file. Here are a few valid examples: @smallexample @c projectfile - for Project_Path use ("/usr/local/gpr", "gpr/"); + @b{for} Project_Path @b{use} ("/usr/local/gpr", "gpr/"); @end smallexample @item @b{External}: @@ -2718,8 +2697,8 @@ an aggregate project. In this package, only the following attributes are valid: @table @asis -@item @b{^Switches^Switches^}: -@cindex @code{^Switches^Switches^} +@item @b{Switches}: +@cindex @code{Switches} This attribute gives the list of switches to use for @command{gprbuild}. Because no mains can be specified for aggregate projects, the only possible index for attribute @code{Switches} is @code{others}. All other indexes will @@ -2728,7 +2707,7 @@ be ignored. Example: @smallexample @c projectfile -for ^Switches^Switches^ (others) use ("-v", "-k", "-j8"); +@b{for} Switches (@b{others}) @b{use} ("-v", "-k", "-j8"); @end smallexample These switches are only read from the main aggregate project (the @@ -2744,8 +2723,8 @@ This attribute gives the list of compiler switches for the various languages. For instance, @smallexample @c projectfile -for Global_Compilation_Switches ("Ada") use ("^O1^-O1^", "-g"); -for Global_Compilation_Switches ("C") use ("^-O2^-O2^"); +@b{for} Global_Compilation_Switches ("Ada") @b{use} ("O1", "-g"); +@b{for} Global_Compilation_Switches ("C") @b{use} ("-O2"); @end smallexample This attribute is only taken into account in the aggregate project @@ -2764,57 +2743,57 @@ instance, aggregate project Agg groups the projects A and B, that both depend on C. Here is an extra for all of these projects: @smallexample @c projectfile - aggregate project Agg is - for Project_Files use ("a.gpr", "b.gpr"); - package Builder is - for Global_Compilation_Switches ("Ada") use ("^-O2^-O2^"); - end Builder; - end Agg; - - with "c.gpr"; - project A is - package Builder is - for Global_Compilation_Switches ("Ada") use ("^-O1^-O1^"); - -- ignored - end Builder; - - package Compiler is - for Default_Switches ("Ada") - use ("^-O1^-O1^", "-g"); - for ^Switches^Switches^ ("a_file1.adb") - use ("^-O0^-O0^"); - end Compiler; - end A; - - with "c.gpr"; - project B is - package Compiler is - for Default_Switches ("Ada") use ("^-O0^-O0^"); - end Compiler; - end B; - - project C is - package Compiler is - for Default_Switches ("Ada") - use ("^-O3^-O3^", - "^-gnatn^-gnatn^"); - for ^Switches^Switches^ ("c_file1.adb") - use ("^-O0^-O0^", "-g"); - end Compiler; - end C; + aggregate @b{project} Agg @b{is} + @b{for} Project_Files @b{use} ("a.gpr", "b.gpr"); + @b{package} Builder @b{is} + @b{for} Global_Compilation_Switches ("Ada") @b{use} ("-O2"); + @b{end} Builder; + @b{end} Agg; + + @b{with} "c.gpr"; + @b{project} A @b{is} + @b{package} Builder @b{is} + @b{for} Global_Compilation_Switches ("Ada") @b{use} ("-O1"); + --@i{ ignored} + @b{end} Builder; + + @b{package} Compiler @b{is} + @b{for} Default_Switches ("Ada") + @b{use} ("-O1", "-g"); + @b{for} Switches ("a_file1.adb") + @b{use} ("-O0"); + @b{end} Compiler; + @b{end} A; + + @b{with} "c.gpr"; + @b{project} B @b{is} + @b{package} Compiler @b{is} + @b{for} Default_Switches ("Ada") @b{use} ("-O0"); + @b{end} Compiler; + @b{end} B; + + @b{project} C @b{is} + @b{package} Compiler @b{is} + @b{for} Default_Switches ("Ada") + @b{use} ("-O3", + "-gnatn"); + @b{for} Switches ("c_file1.adb") + @b{use} ("-O0", "-g"); + @b{end} Compiler; + @b{end} C; @end smallexample then the following switches are used: @itemize @bullet @item all files from project A except a_file1.adb are compiled - with "^-O2^-O2^ -g", since the aggregate project has priority. + with "-O2 -g", since the aggregate project has priority. @item the file a_file1.adb is compiled with - "^-O0^-O0^", since the Compiler.Switches has priority + "-O0", since the Compiler.Switches has priority @item all files from project B are compiled with - "^-O2^-O2^", since the aggregate project has priority -@item all files from C are compiled with "^-O2^-O2^ -gnatn", except for - c_file1.adb which is compiled with "^-O0^-O0^ -g" + "-O2", since the aggregate project has priority +@item all files from C are compiled with "-O2 -gnatn", except for + c_file1.adb which is compiled with "-O0 -g" @end itemize Even though C is seen through two paths (through A and through @@ -2875,11 +2854,11 @@ For example, we can define an aggregate project Agg that groups A, B and C: @smallexample @c projectfile - aggregate library project Agg is - for Project_Files use ("a.gpr", "b.gpr", "c.gpr"); - for Library_Name use ("agg"); - for Library_Dir use ("lagg"); - end Agg; + aggregate library @b{project} Agg @b{is} + @b{for} Project_Files @b{use} ("a.gpr", "b.gpr", "c.gpr"); + @b{for} Library_Name @b{use} ("agg"); + @b{for} Library_Dir @b{use} ("lagg"); + @b{end} Agg; @end smallexample Then, when you build with: @@ -2899,16 +2878,16 @@ required to create relocatable object files, a Builder package in the aggregate library project may be used: @smallexample @c projectfile - aggregate library project Agg is - for Project_Files use ("a.gpr", "b.gpr", "c.gpr"); - for Library_Name use ("agg"); - for Library_Dir use ("lagg"); - for Library_Kind use "relocatable"; - - package Builder is - for Global_Compilation_Switches ("Ada") use ("-fPIC"); - end Builder; - end Agg; + aggregate library @b{project} Agg @b{is} + @b{for} Project_Files @b{use} ("a.gpr", "b.gpr", "c.gpr"); + @b{for} Library_Name @b{use} ("agg"); + @b{for} Library_Dir @b{use} ("lagg"); + @b{for} Library_Kind @b{use} "relocatable"; + + @b{package} Builder @b{is} + @b{for} Global_Compilation_Switches ("Ada") @b{use} ("-fPIC"); + @b{end} Builder; + @b{end} Agg; @end smallexample With the above aggregate library Builder package, the @code{-fPIC} @@ -2991,8 +2970,8 @@ Project files have an Ada-like syntax. The minimal project file is: @smallexample @c projectfile @group -project Empty is -end Empty; +@b{project} Empty @b{is} +@b{end} Empty; @end group @end smallexample @@ -3059,9 +3038,9 @@ in the cycle is a @b{limited with}. @c ??? Need more details here @smallexample @c projectfile -with "other_project.gpr"; -project My_Project extends "extended.gpr" is -end My_Project; +@b{with} "other_project.gpr"; +@b{project} My_Project @b{extends} "extended.gpr" @b{is} +@b{end} My_Project; @end smallexample @noindent @@ -3196,28 +3175,28 @@ The following packages are currently supported in project files @item Cross_Reference This package specifies the options used when calling the library tool @command{gnatxref} via the @command{gnat} driver. Its attributes - @b{Default_Switches} and @b{^Switches^Switches^} have the same semantics as for the + @b{Default_Switches} and @b{Switches} have the same semantics as for the package @code{Builder}. @ifclear FSFEDITION @item Eliminate This package specifies the options used when calling the tool @command{gnatelim} via the @command{gnat} driver. Its attributes - @b{Default_Switches} and @b{^Switches^Switches^} have the same semantics as for the + @b{Default_Switches} and @b{Switches} have the same semantics as for the package @code{Builder}. @end ifclear @item Finder This package specifies the options used when calling the search tool @command{gnatfind} via the @command{gnat} driver. Its attributes - @b{Default_Switches} and @b{^Switches^Switches^} have the same semantics as for the + @b{Default_Switches} and @b{Switches} have the same semantics as for the package @code{Builder}. -@item ^Gnatls^Gnatls^ +@item Gnatls This package specifies the options to use when invoking @command{gnatls} via the @command{gnat} driver. @ifclear FSFEDITION -@item ^Gnatstub^Gnatstub^ +@item Gnatstub This package specifies the options used when calling the tool @command{gnatstub} via the @command{gnat} driver. Its attributes - @b{Default_Switches} and @b{^Switches^Switches^} have the same semantics as for the + @b{Default_Switches} and @b{Switches} have the same semantics as for the package @code{Builder}. @end ifclear @item IDE @@ -3233,7 +3212,7 @@ The following packages are currently supported in project files @item Metrics This package specifies the options used when calling the tool @command{gnatmetric} via the @command{gnat} driver. Its attributes - @b{Default_Switches} and @b{^Switches^Switches^} have the same semantics as for the + @b{Default_Switches} and @b{Switches} have the same semantics as for the package @code{Builder}. @end ifclear @item Naming @@ -3246,7 +3225,7 @@ The following packages are currently supported in project files @item Pretty_Printer This package specifies the options used when calling the formatting tool @command{gnatpp} via the @command{gnat} driver. Its attributes - @b{Default_Switches} and @b{^Switches^Switches^} have the same semantics as for the + @b{Default_Switches} and @b{Switches} have the same semantics as for the package @code{Builder}. @end ifclear @item Remote @@ -3255,7 +3234,7 @@ The following packages are currently supported in project files @item Stack This package specifies the options used when calling the tool @command{gnatstack} via the @command{gnat} driver. Its attributes - @b{Default_Switches} and @b{^Switches^Switches^} have the same semantics as for the + @b{Default_Switches} and @b{Switches} have the same semantics as for the package @code{Builder}. @item Synchronize This package specifies the options used when calling the tool @@ -3267,10 +3246,10 @@ In its simplest form, a package may be empty: @smallexample @c projectfile @group -project Simple is - package Builder is - end Builder; -end Simple; +@b{project} Simple @b{is} + @b{package} Builder @b{is} + @b{end} Builder; +@b{end} Simple; @end group @end smallexample @@ -3376,9 +3355,9 @@ strings is involved, the result of the concatenation is a list of strings. The following Ada declarations show the existing operators: @smallexample @c ada - function "&" (X : String; Y : String) return String; - function "&" (X : String_List; Y : String) return String_List; - function "&" (X : String_List; Y : String_List) return String_List; + @b{function} "&" (X : String; Y : String) @b{return} String; + @b{function} "&" (X : String_List; Y : String) @b{return} String_List; + @b{function} "&" (X : String_List; Y : String_List) @b{return} String_List; @end smallexample @noindent @@ -3386,10 +3365,10 @@ Here are some specific examples: @smallexample @c projectfile @group - List := () & File_Name; -- One string in this list - List2 := List & (File_Name & ".orig"); -- Two strings - Big_List := List & Lists2; -- Three strings - Illegal := "gnat.adc" & List2; -- Illegal, must start with list + List := () & File_Name; --@i{ One string in this list} + List2 := List & (File_Name & ".orig"); --@i{ Two strings} + Big_List := List & Lists2; --@i{ Three strings} + Illegal := "gnat.adc" & List2; --@i{ Illegal, must start with list} @end group @end smallexample @@ -3419,9 +3398,9 @@ if present, is the default to use if there is no specification for this external value either on the command line or in the environment. Typically, the external value will either exist in the -^environment variables^logical name^ +environment variables or be specified on the command line through the -@option{^-X^/EXTERNAL_REFERENCE=^@emph{vbl}=@emph{value}} switch. If both +@option{-X@emph{vbl}=@emph{value}} switch. If both are specified, then the command line value is used, so that a user can more easily override the value. @@ -3464,14 +3443,14 @@ last separator and the end are components of the string list. @end smallexample @noindent -If the external value is "^-O2^-O2^,-g", -the result is ("^-O2^-O2^", "-g"). +If the external value is "-O2,-g", +the result is ("-O2", "-g"). -If the external value is ",^-O2^-O2^,-g,", -the result is also ("^-O2^-O2^", "-g"). +If the external value is ",-O2,-g,", +the result is also ("-O2", "-g"). -if the external value is "^-gnatv^-gnatv^", -the result is ("^-gnatv^-gnatv^"). +if the external value is "-gnatv", +the result is ("-gnatv"). If the external value is ",,", the result is (""). @@ -3500,7 +3479,7 @@ They may include any graphic characters allowed in Ada, including spaces. Here is an example of a string type declaration: @smallexample @c projectfile - type OS is ("NT", "nt", "Unix", "GNU/Linux", "other OS"); + @b{type} OS @b{is} ("NT", "nt", "Unix", "GNU/Linux", "other OS"); @end smallexample @noindent @@ -3555,8 +3534,8 @@ Here are some examples of variable declarations: @smallexample @c projectfile @group - This_OS : OS := external ("OS"); -- a typed variable declaration - That_OS := "GNU/Linux"; -- an untyped variable declaration + This_OS : OS := @b{external} ("OS"); --@i{ a typed variable declaration} + That_OS := "GNU/Linux"; --@i{ an untyped variable declaration} Name := "readme.txt"; Save_Name := Name & ".saved"; @@ -3641,23 +3620,23 @@ Here is a typical example: @smallexample @c projectfile @group -project MyProj is - type OS_Type is ("GNU/Linux", "Unix", "NT", "VMS"); - OS : OS_Type := external ("OS", "GNU/Linux"); - - package Compiler is - case OS is - when "GNU/Linux" | "Unix" => - for ^Switches^Switches^ ("Ada") - use ("-gnath"); - when "NT" => - for ^Switches^Switches^ ("Ada") - use ("^-gnatP^-gnatP^"); - when others => - null; - end case; - end Compiler; -end MyProj; +@b{project} MyProj @b{is} + @b{type} OS_Type @b{is} ("GNU/Linux", "Unix", "NT", "VMS"); + OS : OS_Type := @b{external} ("OS", "GNU/Linux"); + + @b{package} Compiler @b{is} + @b{case} OS @b{is} + @b{when} "GNU/Linux" | "Unix" => + @b{for} Switches ("Ada") + @b{use} ("-gnath"); + @b{when} "NT" => + @b{for} Switches ("Ada") + @b{use} ("-gnatP"); + @b{when} @b{others} => + @b{null}; + @b{end} @b{case}; + @b{end} Compiler; +@b{end} MyProj; @end group @end smallexample @@ -3680,9 +3659,9 @@ end MyProj; * Package Eliminate Attributes:: @end ifclear * Package Finder Attributes:: -* Package ^gnatls^gnatls^ Attributes:: +* Package gnatls Attributes:: @ifclear FSFEDITION -* Package ^gnatstub^gnatstub^ Attributes:: +* Package gnatstub Attributes:: @end ifclear * Package IDE Attributes:: * Package Install Attributes:: @@ -3735,20 +3714,20 @@ attribute, and replaces the previous setting. Here are some examples of attribute declarations: @smallexample @c projectfile - -- simple attributes - for Object_Dir use "objects"; - for Source_Dirs use ("units", "test/drivers"); - - -- indexed attributes - for Body ("main") use "Main.ada"; - for ^Switches^Switches^ ("main.ada") - use ("-v", "^-gnatv^-gnatv^"); - for ^Switches^Switches^ ("main.ada") use Builder'Switches ("main.ada") & "-g"; - - -- indexed attributes copy (from package Builder in project Default) - -- The package name must always be specified, even if it is the current - -- package. - for Default_Switches use Default.Builder'Default_Switches; + --@i{ simple attributes} + @b{for} Object_Dir @b{use} "objects"; + @b{for} Source_Dirs @b{use} ("units", "test/drivers"); + + --@i{ indexed attributes} + @b{for} Body ("main") @b{use} "Main.ada"; + @b{for} Switches ("main.ada") + @b{use} ("-v", "-gnatv"); + @b{for} Switches ("main.ada") @b{use} Builder'Switches ("main.ada") & "-g"; + + --@i{ indexed attributes copy (from package Builder in project Default)} + --@i{ The package name must always be specified, even if it is the current} + --@i{ package.} + @b{for} Default_Switches @b{use} Default.Builder'Default_Switches; @end smallexample @noindent @@ -3769,7 +3748,7 @@ attribute_prefix ::= @i{project} Examples are: @smallexample @c projectfile - project'Object_Dir + @b{project}'Object_Dir Naming'Dot_Replacement Imported_Project'Source_Dirs Imported_Project.Naming'Casing @@ -4248,9 +4227,9 @@ sources of runtime libraries are located. @item @b{Default_Switches}: list, indexed, case-insensitive index Index is a language name. Value is the list of switches to be used when binding -code of the language, if there is no applicable attribute ^Switches^Switches^. +code of the language, if there is no applicable attribute Switches. -@item @b{^Switches^Switches^}: list, optional index, indexed, +@item @b{Switches}: list, optional index, indexed, case-insensitive index, others allowed Index is either a language name or a source file name. Value is the list of @@ -4305,7 +4284,7 @@ Index is a language name. Value is the list of builder switches to be used when building an executable of the language, if there is no applicable attribute Switches. -@item @b{^Switches^Switches^}: list, optional index, indexed, case-insensitive index, +@item @b{Switches}: list, optional index, indexed, case-insensitive index, others allowed Index is either a language name or a source file name. Value is the list of @@ -4352,9 +4331,9 @@ project tree. Index is a language name. Value is a list of switches to be used when invoking @code{gnatcheck} for a source of the language, if there is no applicable -attribute ^Switches^Switches^. +attribute Switches. -@item @b{^Switches^Switches^}: list, optional index, indexed, case-insensitive index, +@item @b{Switches}: list, optional index, indexed, case-insensitive index, others allowed Index is a source file name. Value is the list of switches to be used when @@ -4368,7 +4347,7 @@ invoking @code{gnatcheck} for the source. @itemize @bullet -@item @b{^Switches^Switches^}: list +@item @b{Switches}: list Value is a list of switches to be used by the cleaning application. @@ -4411,7 +4390,7 @@ Index is a language name. Value is a list of switches to be used when invoking the compiler for the language for a source of the project, if there is no applicable attribute Switches. -@item @b{^Switches^Switches^}: list, optional index, indexed, case-insensitive index, +@item @b{Switches}: list, optional index, indexed, case-insensitive index, others allowed Index is a source file name or a language name. Value is the list of switches @@ -4645,7 +4624,7 @@ Index is a language name. Value is a list of switches to be used when invoking @code{gnatxref} for a source of the language, if there is no applicable attribute Switches. -@item @b{^Switches^Switches^}: list, optional index, indexed, case-insensitive index, +@item @b{Switches}: list, optional index, indexed, case-insensitive index, others allowed Index is a source file name. Value is the list of switches to be used when @@ -4665,7 +4644,7 @@ Index is a language name. Value is a list of switches to be used when invoking @code{gnatelim} for a source of the language, if there is no applicable attribute Switches. -@item @b{^Switches^Switches^}: list, optional index, indexed, case-insensitive index, +@item @b{Switches}: list, optional index, indexed, case-insensitive index, others allowed Index is a source file name. Value is the list of switches to be used when @@ -4685,7 +4664,7 @@ Index is a language name. Value is a list of switches to be used when invoking @code{gnatfind} for a source of the language, if there is no applicable attribute Switches. -@item @b{^Switches^Switches^}: list, optional index, indexed, case-insensitive index, +@item @b{Switches}: list, optional index, indexed, case-insensitive index, others allowed Index is a source file name. Value is the list of switches to be used when @@ -4693,20 +4672,20 @@ invoking @code{gnatfind} for the source. @end itemize -@node Package ^gnatls^gnatls^ Attributes -@subsubsection Package ^gnatls^gnatls^ Attributes +@node Package gnatls Attributes +@subsubsection Package gnatls Attributes @itemize @bullet -@item @b{^Switches^Switches^}: list +@item @b{Switches}: list Value is a list of switches to be used when invoking @code{gnatls}. @end itemize @ifclear FSFEDITION -@node Package ^gnatstub^gnatstub^ Attributes -@subsubsection Package ^gnatstub^gnatstub^ Attributes +@node Package gnatstub Attributes +@subsubsection Package gnatstub Attributes @itemize @bullet @@ -4714,9 +4693,9 @@ Value is a list of switches to be used when invoking @code{gnatls}. Index is a language name. Value is a list of switches to be used when invoking @code{gnatstub} for a source of the language, if there is no applicable -attribute ^Switches^Switches^. +attribute Switches. -@item @b{^Switches^Switches^}: list, optional index, indexed, case-insensitive index, +@item @b{Switches}: list, optional index, indexed, case-insensitive index, others allowed Index is a source file name. Value is the list of switches to be used when @@ -4764,11 +4743,11 @@ the handling of switches. Value is a string that specifies the name of the debugger to be used, such as gdb, powerpc-wrs-vxworks-gdb or gdb-4. -@item @b{^gnatlist^gnatlist^}: single +@item @b{gnatlist}: single -Value is a string that specifies the name of the @command{^gnatls^gnatls^} utility +Value is a string that specifies the name of the @command{gnatls} utility to be used to retrieve information about the predefined path; for example, -@code{"^gnatls^gnatls^"}, @code{"powerpc-wrs-vxworks-gnatls"}. +@code{"gnatls"}, @code{"powerpc-wrs-vxworks-gnatls"}. @item @b{VCS_Kind}: single @@ -4854,7 +4833,7 @@ Index is a source file name or a language name. Value is the list of switches to be used at the beginning of the command line when invoking the linker to build an executable for the source or for its language. -@item @b{^Switches^Switches^}: list, optional index, indexed, case-insensitive index, +@item @b{Switches}: list, optional index, indexed, case-insensitive index, others allowed Index is a source file name or a language name. Value is the list of switches @@ -4928,7 +4907,7 @@ Index is a language name. Value is a list of switches to be used when invoking @code{gnatmetric} for a source of the language, if there is no applicable attribute Switches. -@item @b{^Switches^Switches^}: list, optional index, indexed, case-insensitive index, +@item @b{Switches}: list, optional index, indexed, case-insensitive index, others allowed Index is a source file name. Value is the list of switches to be used when @@ -5018,7 +4997,7 @@ Index is a language name. Value is a list of switches to be used when invoking @code{gnatpp} for a source of the language, if there is no applicable attribute Switches. -@item @b{^Switches^Switches^}: list, optional index, indexed, case-insensitive index, +@item @b{Switches}: list, optional index, indexed, case-insensitive index, others allowed Index is a source file name. Value is the list of switches to be used when @@ -5063,7 +5042,7 @@ Value is the root directory used by the slave machines. @itemize @bullet -@item @b{^Switches^Switches^}: list +@item @b{Switches}: list Value is the list of switches to be used when invoking @code{gnatstack}. @@ -5080,11 +5059,10 @@ Index is a language name. Value is a list of switches to be used when invoking @code{gnatsync} for a source of the language, if there is no applicable attribute Switches. -@item @b{^Switches^Switches^}: list, optional index, indexed, case-insensitive index, +@item @b{Switches}: list, optional index, indexed, case-insensitive index, others allowed Index is a source file name. Value is the list of switches to be used when invoking @code{gnatsync} for the source. @end itemize - diff --git a/gcc/ada/xgnatugn.adb b/gcc/ada/xgnatugn.adb index 4706701..496ebb3 100644 --- a/gcc/ada/xgnatugn.adb +++ b/gcc/ada/xgnatugn.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2003-2013, Free Software Foundation, Inc. -- +-- Copyright (C) 2003-2014, Free Software Foundation, Inc. -- -- -- -- GNAT is free software; you can redistribute it and/or modify it under -- -- terms of the GNU General Public License as published by the Free Soft- -- @@ -20,1067 +20,36 @@ -- -- ------------------------------------------------------------------------------ --- This utility is used to process the source of gnat_ugn.texi to make a --- version suitable for running through standard Texinfo processor. It is --- invoked as follows: +-- This is a temporary version whose only purpose is to work with +-- Makefile.gnat6 +-- Its main previous purpose (to handle VMS-specific wording in +-- gnat_ugn.texi and projects.texi) is not applicable, since there is +-- no longer a VMS-specific version of the User's Guide. --- xgnatugn <target> <in-file> <word-list> [ <out-file> [ <warnings> ] ] +-- The program is invoked as follows: --- 1. <target> is the target type of the manual, which is one of: +-- xgnatugn <target> <in-file> <word-list> <out-file> --- unw Unix and Windows platforms --- vms OpenVMS - --- 2. <in-file> is the file name of the Texinfo file to be --- preprocessed. - --- 3. <word-list> is the name of the word list file. This file is used for --- rewriting the VMS edition. Each line contains a word mapping: The source --- word in the first column, the target word in the second column. The --- columns are separated by a '^' character. When preprocessing for VMS, the --- first word is replaced with the second. (Words consist of letters, --- digits, and the four characters "?-_~". A sequence of multiple words can --- be replaced if they are listed in the first column, separated by a single --- space character. If multiple words are to be replaced, there must be a --- replacement for each prefix.) - --- 4. <out-file> (optional) is the name of the output file. It defaults to --- gnat_ugn_unw.texi or gnat_ugn_vms.texi, depending on the target. - --- 5. <warnings> (optional, and allowed only if <out-file> is explicit) --- can be any string. If present, it indicates that warning messages are --- to be output to Standard_Error. If absent, no warning messages are --- generated. - --- The following steps are performed: - --- In VMS mode - --- Any occurrences of ^alpha^beta^ are replaced by beta. The sequence --- must fit on a single line, and there can only be one occurrence on a --- line. - --- Any occurrences of a word in the Ug_Words list are replaced by the --- appropriate vms equivalents. Note that replacements do not occur --- within ^alpha^beta^ sequences. - --- Any occurrence of [filename].extension, where extension one of the --- following: - --- "o", "ads", "adb", "ali", "ada", "atb", "ats", "adc", "c" - --- replaced by the appropriate VMS names (all upper case with .o --- replaced .OBJ). Note that replacements do not occur within --- ^alpha^beta^ sequences. - --- In UNW mode - --- Any occurrences of ^alpha^beta^ are replaced by alpha. The sequence --- must fit on a single line. - --- In both modes - --- The sequence ^^^ is replaced by a single ^. This escape sequence --- must be used if the literal character ^ is to appear in the --- output. A line containing this escape sequence may not also contain --- a ^alpha^beta^ sequence. +-- In this temporary version, the program simply copies <in-file> +-- to <out-file> and ignores the <target> and <word-list> arguments with Ada.Command_Line; use Ada.Command_Line; -with Ada.Strings; use Ada.Strings; -with Ada.Strings.Fixed; use Ada.Strings.Fixed; -with Ada.Strings.Unbounded; use Ada.Strings.Unbounded; -with Ada.Strings.Maps; use Ada.Strings.Maps; -with Ada.Strings.Maps.Constants; use Ada.Strings.Maps.Constants; -with Ada.Streams.Stream_IO; use Ada.Streams.Stream_IO; with Ada.Text_IO; use Ada.Text_IO; -with GNAT.Spitbol; use GNAT.Spitbol; -with GNAT.Spitbol.Table_VString; use GNAT.Spitbol.Table_VString; - procedure Xgnatugn is - procedure Usage; - -- Print usage information. Invoked if an invalid command line is - -- encountered. - - subtype Sfile is Ada.Streams.Stream_IO.File_Type; - - Output_File : Sfile; - -- The preprocessed output is written to this file - - type Input_File is record - Name : VString; - Data : Ada.Text_IO.File_Type; - Line : Natural := 0; - end record; - -- Records information on an input file. Name and Line are used - -- in error messages, Line is updated automatically by Get_Line. - - function Get_Line (Input : access Input_File) return String; - -- Returns a line from Input and performs the necessary - -- line-oriented checks (length, character set, trailing spaces). - - procedure Put_Line (F : Sfile; S : String); - -- Local version of Put_Line ensures Unix style line endings - - First_Time : Boolean := True; - Number_Of_Warnings : Natural := 0; - Number_Of_Errors : Natural := 0; - Warnings_Enabled : Boolean; - - procedure Error - (Input : Input_File; - At_Character : Natural; - Message : String); - procedure Error - (Input : Input_File; - Message : String); - -- Prints a message reporting an error on line Input.Line. If - -- At_Character is not 0, indicate the exact character at which - -- the error occurs. - - procedure Warning - (Input : Input_File; - At_Character : Natural; - Message : String); - - Dictionary_File : aliased Input_File; - procedure Read_Dictionary_File; - -- Dictionary_File is opened using the name given on the command - -- line. It contains the replacements for the Ug_Words list. - -- Read_Dictionary_File reads Dictionary_File and fills the - -- Ug_Words table. - - Source_File : aliased Input_File; - procedure Process_Source_File; - -- Source_File is opened using the name given on the command line. - -- It contains the Texinfo source code. Process_Source_File - -- performs the necessary replacements. - - type Flag_Type is (UNW, VMS, FSFEDITION, PROEDITION, GPLEDITION); - -- The flags permitted in @ifset or @ifclear commands: - -- - -- Targets for preprocessing - -- UNW (Unix and Windows) or VMS - -- - -- Editions of the manual - -- FSFEDITION, PROEDITION, or GPLEDITION - -- - -- Conditional commands for target are processed by xgnatugn - -- - -- Conditional commands for edition are passed through unchanged - - subtype Target_Type is Flag_Type range UNW .. VMS; - - Target : Target_Type; - -- The Target variable is initialized using the command line - - Valid_Characters : constant Character_Set := To_Set (Span => (' ', '~')); - -- This array controls which characters are permitted in the input - -- file (after line breaks have been removed). Valid characters - -- are all printable ASCII characters and the space character. - - Word_Characters : constant Character_Set := - (To_Set (Ranges => - (('0', '9'), ('a', 'z'), ('A', 'Z'))) - or To_Set ("?-_~")); - -- The characters which are permitted in words. Other (valid) - -- characters are assumed to be delimiters between words. Note that - -- this set has to include all characters of the source words of the - -- Ug_Words dictionary. - - Reject_Trailing_Spaces : constant Boolean := True; - -- Controls whether Xgnatug rejects superfluous space characters - -- at the end of lines. - - Maximum_Line_Length : constant Positive := 79; - Fatal_Line_Length_Limit : constant Positive := 5000; - Fatal_Line_Length : exception; - -- If Maximum_Line_Length is exceeded in an input file, an error - -- message is printed. If Fatal_Line_Length is exceeded, - -- execution terminates with a Fatal_Line_Length exception. - - VMS_Escape_Character : constant Character := '^'; - -- The character used to mark VMS alternatives (^alpha^beta^) - - Extensions : GNAT.Spitbol.Table_VString.Table (20); - procedure Initialize_Extensions; - -- This table records extensions and their replacement for - -- rewriting filenames in the VMS version of the manual. - - function Is_Extension (Extension : String) return Boolean; - function Get_Replacement_Extension (Extension : String) return String; - -- These functions query the replacement table. Is_Extension - -- checks if the given string is a known extension. - -- Get_Replacement returns the replacement extension. - - Ug_Words : GNAT.Spitbol.Table_VString.Table (200); - function Is_Known_Word (Word : String) return Boolean; - function Get_Replacement_Word (Word : String) return String; - -- The Ug_Words table lists replacement words for the VMS version - -- of the manual. Is_Known_Word and Get_Replacement_Word query - -- this table. The table is filled using Read_Dictionary_File. - - function Rewrite_Source_Line (Line : String) return String; - -- This subprogram takes a line and rewrites it according to Target. - -- It relies on information in Source_File to generate error messages. - - ----------- - -- Usage -- - ----------- - - procedure Usage is - begin - Put_Line (Standard_Error, - "usage: xgnatugn TARGET SOURCE DICTIONARY [OUTFILE [WARNINGS]]"); - New_Line; - Put_Line (Standard_Error, "TARGET is one of:"); - - for T in Target_Type'Range loop - Put_Line (Standard_Error, " " & Target_Type'Image (T)); - end loop; - - New_Line; - Put_Line (Standard_Error, "SOURCE is the source file to process."); - New_Line; - Put_Line (Standard_Error, "DICTIONARY is the name of a file " - & "that contains word replacements"); - Put_Line (Standard_Error, "for the VMS version."); - New_Line; - Put_Line (Standard_Error, - "OUT-FILE, if present, is the output file to be created;"); - Put_Line (Standard_Error, - "If OUT-FILE is absent, the output file is either " & - "gnat_ugn_unw.texi, "); - Put_Line (Standard_Error, - "or gnat_ugn_vms.texi, depending on TARGET."); - New_Line; - Put_Line (Standard_Error, - "WARNINGS, if present, is any string;"); - Put_Line (Standard_Error, - "it will result in warning messages (e.g., line too long))"); - Put_Line (Standard_Error, - "being output to Standard_Error."); - end Usage; - - -------------- - -- Get_Line -- - -------------- - - function Get_Line (Input : access Input_File) return String is - Line_Buffer : String (1 .. Fatal_Line_Length_Limit); - Last : Natural; - - begin - Input.Line := Input.Line + 1; - Get_Line (Input.Data, Line_Buffer, Last); - - if Last = Line_Buffer'Last then - Error (Input.all, "line exceeds fatal line length limit"); - raise Fatal_Line_Length; - end if; - - declare - Line : String renames Line_Buffer (Line_Buffer'First .. Last); - - begin - for J in Line'Range loop - if not Is_In (Line (J), Valid_Characters) then - Error (Input.all, J, "invalid character"); - exit; - end if; - end loop; - - if Line'Length > Maximum_Line_Length then - Warning (Input.all, Maximum_Line_Length + 1, "line too long"); - end if; - - if Reject_Trailing_Spaces - and then Line'Length > 0 - and then Line (Line'Last) = ' ' - then - Error (Input.all, Line'Last, "trailing space character"); - end if; - - return Trim (Line, Right); - end; - end Get_Line; - - -------------- - -- Put_Line -- - -------------- - - procedure Put_Line (F : Sfile; S : String) is - begin - String'Write (Stream (F), S); - Character'Write (Stream (F), ASCII.LF); - end Put_Line; - - ----------- - -- Error -- - ----------- - - procedure Error - (Input : Input_File; - Message : String) - is - begin - Error (Input, 0, Message); - end Error; - - procedure Error - (Input : Input_File; - At_Character : Natural; - Message : String) - is - Line_Image : constant String := Integer'Image (Input.Line); - At_Character_Image : constant String := Integer'Image (At_Character); - -- These variables are required because we have to drop the leading - -- space character. - - begin - Number_Of_Errors := Number_Of_Errors + 1; - - if At_Character > 0 then - Put_Line (Standard_Error, - S (Input.Name) & ':' - & Line_Image (Line_Image'First + 1 .. Line_Image'Last) & ':' - & At_Character_Image (At_Character_Image'First + 1 - .. At_Character_Image'Last) - & ": " - & Message); - else - Put_Line (Standard_Error, - S (Input.Name) & ':' - & Line_Image (Line_Image'First + 1 .. Line_Image'Last) - & ": " - & Message); - end if; - end Error; - - ------------- - -- Warning -- - ------------- - - procedure Warning - (Input : Input_File; - At_Character : Natural; - Message : String) - is - Line_Image : constant String := Integer'Image (Input.Line); - At_Character_Image : constant String := Integer'Image (At_Character); - -- These variables are required because we have to drop the leading - -- space character. - - begin - if not Warnings_Enabled then - return; - end if; - - Number_Of_Warnings := Number_Of_Warnings + 1; - - if At_Character > 0 then - Put_Line (Standard_Error, - S (Input.Name) & ':' - & Line_Image (Line_Image'First + 1 .. Line_Image'Last) & ':' - & At_Character_Image (At_Character_Image'First + 1 - .. At_Character_Image'Last) - & ": warning: " - & Message); - else - Put_Line (Standard_Error, - S (Input.Name) & ':' - & Line_Image (Line_Image'First + 1 .. Line_Image'Last) - & ": warning: " - & Message); - end if; - end Warning; - - -------------------------- - -- Read_Dictionary_File -- - -------------------------- - - procedure Read_Dictionary_File is - begin - while not End_Of_File (Dictionary_File.Data) loop - declare - Line : constant String := - Get_Line (Dictionary_File'Access); - Split : constant Natural := - Index (Line, (1 => VMS_Escape_Character)); - - begin - if Line'Length = 0 then - Error (Dictionary_File, "empty line in dictionary file"); - - elsif Line (Line'First) = ' ' then - Error (Dictionary_File, 1, "line starts with space character"); - - elsif Split = 0 then - Error (Dictionary_File, "line does not contain " - & VMS_Escape_Character & " character"); - else - declare - Source : constant String := - Trim (Line (1 .. Split - 1), Both); - Target : constant String := - Trim (Line (Split + 1 .. Line'Last), Both); - - Two_Spaces : constant Natural := Index (Source, " "); - - Non_Word_Character : constant Natural := - Index (Source, - Word_Characters or - To_Set (" ."), - Outside); - - begin - if Two_Spaces /= 0 then - Error (Dictionary_File, Two_Spaces, - "multiple space characters in source word"); - end if; - - if Non_Word_Character /= 0 then - Error (Dictionary_File, Non_Word_Character, - "illegal character in source word"); - end if; - - if Source'Length = 0 then - Error (Dictionary_File, "source is empty"); - - elsif Target'Length = 0 then - Error (Dictionary_File, "target is empty"); - - else - Set (Ug_Words, Source, V (Target)); - - -- Ensure that if Source is a sequence of words - -- "WORD1 WORD2 ...", we already have a mapping for - -- "WORD1". - - for J in Source'Range loop - if Source (J) = ' ' then - declare - Prefix : String renames - Source (Source'First .. J - 1); - begin - if not Is_Known_Word (Prefix) then - Error (Dictionary_File, - "prefix '" & Prefix - & "' not known at this point"); - end if; - end; - end if; - end loop; - end if; - end; - end if; - end; - end loop; - end Read_Dictionary_File; - - ------------------------- - -- Rewrite_Source_Line -- - ------------------------- - - function Rewrite_Source_Line (Line : String) return String is - - -- We use a simple lexer to split the line into tokens: - - -- Word consisting entirely of Word_Characters - -- VMS_Alternative ^alpha^beta^ replacement (but not ^^^) - -- Space a space character - -- Other everything else (sequence of non-word characters) - -- VMS_Error incomplete VMS alternative - -- End_Of_Line no more characters on this line - - -- A sequence of three VMS_Escape_Characters is automatically - -- collapsed to an Other token. - - type Token_Span is record - First, Last : Positive; - end record; - -- The character range covered by a token in Line - - type Token_Kind is (End_Of_Line, Word, Other, - VMS_Alternative, VMS_Error); - type Token_Record (Kind : Token_Kind := End_Of_Line) is record - First : Positive; - case Kind is - when Word | Other => - Span : Token_Span; - when VMS_Alternative => - Non_VMS, VMS : Token_Span; - when VMS_Error | End_Of_Line => - null; - end case; - end record; - - Input_Position : Positive := Line'First; - Token : Token_Record; - -- The position of the next character to be processed by Next_Token - - procedure Next_Token; - -- Returns the next token in Line, starting at Input_Position - - Rewritten_Line : VString; - -- Collects the line as it is rewritten - - procedure Rewrite_Word; - -- The current token is assumed to be a Word. When processing the VMS - -- version of the manual, additional tokens are gathered to check if - -- we have a file name or a sequence of known words. - - procedure Maybe_Rewrite_Extension; - -- The current token is assumed to be Other. When processing the VMS - -- version of the manual and the token represents a single dot ".", - -- the following word is rewritten according to the rules for - -- extensions. - - VMS_Token_Seen : Boolean := False; - -- This is set to true if a VMS_Alternative has been encountered, or a - -- ^^^ token. - - ---------------- - -- Next_Token -- - ---------------- - - procedure Next_Token is - Remaining_Line : String renames Line (Input_Position .. Line'Last); - Last_Character : Natural; - - begin - if Remaining_Line'Length = 0 then - Token := (End_Of_Line, Remaining_Line'First); - return; - end if; - - -- ^alpha^beta^, the VMS_Alternative case - - if Remaining_Line (Remaining_Line'First) = VMS_Escape_Character then - declare - VMS_Second_Character, VMS_Third_Character : Natural; - - begin - if VMS_Token_Seen then - Error (Source_File, Remaining_Line'First, - "multiple " & VMS_Escape_Character - & " characters on a single line"); - else - VMS_Token_Seen := True; - end if; - - -- Find the second and third escape character. If one of - -- them is not present, generate an error token. - - VMS_Second_Character := - Index (Remaining_Line (Remaining_Line'First + 1 - .. Remaining_Line'Last), - (1 => VMS_Escape_Character)); - - if VMS_Second_Character = 0 then - Input_Position := Remaining_Line'Last + 1; - Token := (VMS_Error, Remaining_Line'First); - return; - end if; - - VMS_Third_Character := - Index (Remaining_Line (VMS_Second_Character + 1 - .. Remaining_Line'Last), - (1 => VMS_Escape_Character)); - - if VMS_Third_Character = 0 then - Input_Position := Remaining_Line'Last + 1; - Token := (VMS_Error, Remaining_Line'First); - return; - end if; - - -- Consume all the characters we are about to include in - -- the token. - - Input_Position := VMS_Third_Character + 1; - - -- Check if we are in a ^^^ situation, and return an Other - -- token in this case. - - if Remaining_Line'First + 1 = VMS_Second_Character - and then Remaining_Line'First + 2 = VMS_Third_Character - then - Token := (Other, Remaining_Line'First, - (Remaining_Line'First, Remaining_Line'First)); - return; - end if; - - Token := (VMS_Alternative, Remaining_Line'First, - (Remaining_Line'First + 1, VMS_Second_Character - 1), - (VMS_Second_Character + 1, VMS_Third_Character - 1)); - return; - end; - end if; - - -- The Word case. Search for characters not in Word_Characters. - -- We have found a word if the first non-word character is not - -- the first character in Remaining_Line, i.e. if Remaining_Line - -- starts with a word character. - - Last_Character := Index (Remaining_Line, Word_Characters, Outside); - if Last_Character /= Remaining_Line'First then - - -- If we haven't found a character which is not in - -- Word_Characters, all remaining characters are part of the - -- current Word token. - - if Last_Character = 0 then - Last_Character := Remaining_Line'Last + 1; - end if; - - Input_Position := Last_Character; - Token := (Word, Remaining_Line'First, - (Remaining_Line'First, Last_Character - 1)); - return; - end if; - - -- Remaining characters are in the Other category. To speed - -- up processing, we collect them together if there are several - -- of them. - - Input_Position := Last_Character + 1; - Token := (Other, - Remaining_Line'First, - (Remaining_Line'First, Last_Character)); - end Next_Token; - - ------------------ - -- Rewrite_Word -- - ------------------ - - procedure Rewrite_Word is - First_Word : String - renames Line (Token.Span.First .. Token.Span.Last); - - begin - -- We do not perform any error checking below, so we can just skip - -- all processing for the non-VMS version. - - if Target /= VMS then - Append (Rewritten_Line, First_Word); - Next_Token; - return; - end if; - - if Is_Known_Word (First_Word) then - - -- If we have a word from the dictionary, we look for the - -- longest possible sequence we can rewrite. - - declare - Seq : Token_Span := Token.Span; - Lost_Space : Boolean := False; - - begin - Next_Token; - loop - if Token.Kind = Other - and then Line (Token.Span.First .. Token.Span.Last) = " " - then - Next_Token; - - if Token.Kind /= Word - or else not Is_Known_Word (Line (Seq.First - .. Token.Span.Last)) - then - -- When we reach this point, the following conditions - -- are true: - - -- Seq is a known word - - -- The previous token was a space character - - -- Seq extended to the current token is not a - -- known word. - - Lost_Space := True; - exit; - - else - -- Extend Seq to cover the current (known) word - - Seq.Last := Token.Span.Last; - Next_Token; - end if; - - else - -- When we reach this point, the following conditions - -- are true: - - -- Seq is a known word - - -- The previous token was a word - - -- The current token is not a space character. - - exit; - end if; - end loop; - - -- Rewrite Seq, and add the lost space if necessary - - Append (Rewritten_Line, - Get_Replacement_Word (Line (Seq.First .. Seq.Last))); - if Lost_Space then - Append (Rewritten_Line, ' '); - end if; - - -- The unknown token will be processed during the - -- next iteration of the main loop. - return; - end; - end if; - - Next_Token; - - if Token.Kind = Other - and then Line (Token.Span.First .. Token.Span.Last) = "." - then - -- Deal with extensions - - Next_Token; - if Token.Kind = Word - and then - Is_Extension (Line (Token.Span.First .. Token.Span.Last)) - then - -- We have discovered a file extension. Convert the file - -- name to upper case. - - Append (Rewritten_Line, - Translate (First_Word, Upper_Case_Map) & '.'); - Append (Rewritten_Line, - Get_Replacement_Extension - (Line (Token.Span.First .. Token.Span.Last))); - Next_Token; - else - -- We already have: Word ".", followed by an unknown token - - Append (Rewritten_Line, First_Word & '.'); - - -- The unknown token will be processed during the next - -- iteration of the main loop. - end if; - - else - -- We have an unknown Word, followed by an unknown token. - -- The unknown token will be processed by the outer loop. - - Append (Rewritten_Line, First_Word); - end if; - end Rewrite_Word; - - ----------------------------- - -- Maybe_Rewrite_Extension -- - ----------------------------- - - procedure Maybe_Rewrite_Extension is - begin - -- Again, we need no special processing in the non-VMS case - - if Target = VMS - and then Line (Token.Span.First .. Token.Span.Last) = "." - then - -- This extension is not preceded by a word, otherwise - -- Rewrite_Word would have handled it. - - Next_Token; - - if Token.Kind = Word - and then Is_Extension (Line (Token.Span.First - .. Token.Span.Last)) - then - Append (Rewritten_Line, '.' & Get_Replacement_Extension - (Line (Token.Span.First .. Token.Span.Last))); - Next_Token; - else - Append (Rewritten_Line, '.'); - end if; - - else - Append (Rewritten_Line, Line (Token.Span.First - .. Token.Span.Last)); - Next_Token; - end if; - end Maybe_Rewrite_Extension; - - -- Start of processing for Process_Source_Line - - begin - -- The following parser recognizes the following special token - -- sequences: - - -- Word "." Word rewrite as file name if second word is extension - -- Word " " Word rewrite as a single word using Ug_Words table - - Next_Token; - loop - case Token.Kind is - when End_Of_Line => - exit; - - when Word => - Rewrite_Word; - - when Other => - Maybe_Rewrite_Extension; - - when VMS_Alternative => - if Target = VMS then - Append (Rewritten_Line, Line (Token.VMS.First - .. Token.VMS.Last)); - else - Append (Rewritten_Line, Line (Token.Non_VMS.First - .. Token.Non_VMS.Last)); - end if; - - Next_Token; - - when VMS_Error => - Error (Source_File, Token.First, "invalid VMS alternative"); - Next_Token; - end case; - end loop; - - return S (Rewritten_Line); - end Rewrite_Source_Line; - - ------------------------- - -- Process_Source_File -- - ------------------------- - - procedure Process_Source_File is - begin - while not End_Of_File (Source_File.Data) loop - declare - Line : constant String := Get_Line (Source_File'Access); - - Rewritten : constant String := Rewrite_Source_Line (Line); - -- We unconditionally rewrite the line so that we can check the - -- syntax of all lines, and not only those which are actually - -- included in the output. - - begin - if First_Time - and then Line'Length > 3 and then Line (1 .. 3) = "@if" - then - Put_Line (Output_File, "@set " & Argument (1)); - First_Time := False; - end if; - - Put_Line (Output_File, Rewritten); - end; - end loop; - end Process_Source_File; - - --------------------------- - -- Initialize_Extensions -- - --------------------------- - - procedure Initialize_Extensions is - - procedure Add (Extension : String); - -- Adds an extension which is replaced with itself (in upper case) - - procedure Add (Extension, Replacement : String); - -- Adds an extension with a custom replacement - - --------- - -- Add -- - --------- - - procedure Add (Extension : String) is - begin - Add (Extension, Translate (Extension, Upper_Case_Map)); - end Add; - - procedure Add (Extension, Replacement : String) is - begin - Set (Extensions, Extension, V (Replacement)); - end Add; - - -- Start of processing for Initialize_Extensions - - begin - -- To avoid performance degradation, increase the constant in the - -- definition of Extensions above if you add more extensions here. - - Add ("o", "OBJ"); - Add ("ads"); - Add ("adb"); - Add ("ali"); - Add ("ada"); - Add ("atb"); - Add ("ats"); - Add ("adc"); - Add ("c"); - end Initialize_Extensions; - - ------------------ - -- Is_Extension -- - ------------------ - - function Is_Extension (Extension : String) return Boolean is - begin - return Present (Extensions, Extension); - end Is_Extension; - - ------------------------------- - -- Get_Replacement_Extension -- - ------------------------------- - - function Get_Replacement_Extension (Extension : String) return String is - begin - return S (Get (Extensions, Extension)); - end Get_Replacement_Extension; - - ------------------- - -- Is_Known_Word -- - ------------------- - - function Is_Known_Word (Word : String) return Boolean is - begin - return Present (Ug_Words, Word); - end Is_Known_Word; - - -------------------------- - -- Get_Replacement_Word -- - -------------------------- - - function Get_Replacement_Word (Word : String) return String is - begin - return S (Get (Ug_Words, Word)); - end Get_Replacement_Word; - --- Start of processing for Xgnatugn - - Valid_Command_Line : Boolean; - Output_File_Name : VString; + Max_Line_Length : constant := 5000; + Line : String (1 .. Max_Line_Length); + Last : Natural; + File1, File2 : File_Type; begin - Initialize_Extensions; - Valid_Command_Line := Argument_Count in 3 .. 5; - - -- First argument: Target - - if Valid_Command_Line then - begin - Target := Flag_Type'Value (Argument (1)); - - if not Target'Valid then - Valid_Command_Line := False; - end if; - - exception - when Constraint_Error => - Valid_Command_Line := False; - end; - end if; - - -- Second argument: Source_File - - if Valid_Command_Line then - begin - Source_File.Name := V (Argument (2)); - Open (Source_File.Data, In_File, Argument (2)); - - exception - when Ada.Text_IO.Name_Error => - Valid_Command_Line := False; - end; - end if; - - -- Third argument: Dictionary_File - - if Valid_Command_Line then - begin - Dictionary_File.Name := V (Argument (3)); - Open (Dictionary_File.Data, In_File, Argument (3)); - - exception - when Ada.Text_IO.Name_Error => - Valid_Command_Line := False; - end; - end if; - - -- Fourth argument: Output_File - - if Valid_Command_Line then - if Argument_Count in 4 .. 5 then - Output_File_Name := V (Argument (4)); - else - case Target is - when UNW => - Output_File_Name := V ("gnat_ugn_unw.texi"); - when VMS => - Output_File_Name := V ("gnat_ugn_vms.texi"); - end case; - end if; - - Warnings_Enabled := Argument_Count = 5; - - begin - Create (Output_File, Out_File, S (Output_File_Name)); - - exception - when Ada.Text_IO.Name_Error | Ada.Text_IO.Use_Error => - Valid_Command_Line := False; - end; - end if; - - if not Valid_Command_Line then - Usage; - Set_Exit_Status (Failure); - - else - Read_Dictionary_File; - Close (Dictionary_File.Data); - - -- Main processing starts here - - Process_Source_File; - Close (Output_File); - Close (Source_File.Data); - - New_Line (Standard_Error); - - if Number_Of_Warnings = 0 then - Put_Line (Standard_Error, " NO Warnings"); - - else - Put (Standard_Error, Integer'Image (Number_Of_Warnings)); - Put (Standard_Error, " Warning"); - - if Number_Of_Warnings > 1 then - Put (Standard_Error, "s"); - end if; - - New_Line (Standard_Error); - end if; - - if Number_Of_Errors = 0 then - Put_Line (Standard_Error, " NO Errors"); - - else - Put (Standard_Error, Integer'Image (Number_Of_Errors)); - Put (Standard_Error, " Error"); - - if Number_Of_Errors > 1 then - Put (Standard_Error, "s"); - end if; - New_Line (Standard_Error); - end if; + Open (File1, Mode => In_File, Name => Argument (2)); + Create (File2, Mode => Out_File, Name => Argument (4)); - if Number_Of_Errors /= 0 then - Set_Exit_Status (Failure); - else - Set_Exit_Status (Success); - end if; - end if; + while not End_Of_File (File1) loop + Get_Line (File1, Line, Last); + Put_Line (File2, Line (1 .. Last)); + end loop; end Xgnatugn; |