The Ada Reference Manual contains in Annex A a full description of an extensive set of standard library routines that can be used in any Ada program, and which must be provided by all Ada compilers. They are analogous to the standard C library used by C programs.
GNAT implements all of the facilities described in annex A, and for most purposes the description in the Ada Reference Manual, or appropriate Ada text book, will be sufficient for making use of these facilities.
In the case of the input-output facilities, See The Implementation of Standard I/O, gives details on exactly how GNAT interfaces to the file system. For the remaining packages, the Ada Reference Manual should be sufficient. The following is a list of the packages included, together with a brief description of the functionality that is provided.
For completeness, references are included to other predefined library routines defined in other sections of the Ada Reference Manual (these are cross-indexed from Annex A). For further details see the relevant package declarations in the run-time library. In particular, a few units are not implemented, as marked by the presence of pragma Unimplemented_Unit, and in this case the package declaration contains comments explaining why the unit is not implemented.
Ada (A.2)
Ada.Assertions (11.4.2)
Assertions
provides the Assert
subprograms, and also
the declaration of the Assertion_Error
exception.
Ada.Asynchronous_Task_Control (D.11)
Asynchronous_Task_Control
provides low level facilities for task
synchronization. It is typically not implemented. See package spec for details.
Ada.Calendar (9.6)
Calendar
provides time of day access, and routines for
manipulating times and durations.
Ada.Calendar.Arithmetic (9.6.1)
Calendar
.
Ada.Calendar.Formatting (9.6.1)
Calendar
.
Ada.Calendar.Time_Zones (9.6.1)
Calendar
facilities
for handling time zones.
Ada.Characters (A.3.1)
Ada.Characters.Conversions (A.3.2)
Ada.Characters.Handling (A.3.2)
Ada.Characters.Latin_1 (A.3.3)
UC_E_Acute
in this package. Then your program
will print in an understandable manner even if your environment does not
support these extended characters.
Ada.Command_Line (A.15)
argc
and argv
in C), and also allows the exit status for the program to be set in a
system-independent manner.
Ada.Complex_Text_IO (G.1.3)
Ada.Containers (A.18.1)
Ada.Containers.Bounded_Priority_Queues (A.18.31)
Ada.Containers.Bounded_Synchronized_Queues (A.18.29)
Ada.Containers.Doubly_Linked_Lists (A.18.3)
Ada.Containers.Generic_Array_Sort (A.18.26)
Ada.Containers.Generic_Constrained_Array_Sort (A.18.26)
Ada.Containers.Generic_Sort (A.18.26)
Ada.Containers.Hashed_Maps (A.18.5)
Ada.Containers.Hashed_Sets (A.18.8)
Ada.Containers.Indefinite_Doubly_Linked_Lists (A.18.12)
Ada.Containers.Indefinite_Hashed_Maps (A.18.13)
Ada.Containers.Indefinite_Hashed_Sets (A.18.15)
Ada.Containers.Indefinite_Holders (A.18.18)
Ada.Containers.Indefinite_Multiway_Trees (A.18.17)
Ada.Containers.Indefinite_Ordered_Maps (A.18.14)
Ada.Containers.Indefinite_Ordered_Sets (A.18.16)
Ada.Containers.Indefinite_Vectors (A.18.11)
Ada.Containers.Multiway_Trees (A.18.10)
Ada.Containers.Ordered_Maps (A.18.6)
Ada.Containers.Ordered_Sets (A.18.9)
Ada.Containers.Synchronized_Queue_Interfaces (A.18.27)
Ada.Containers.Unbounded_Priority_Queues (A.18.30)
Ada.Containers.Unbounded_Synchronized_Queues (A.18.28)
Ada.Containers.Vectors (A.18.2)
Ada.Directories (A.16)
Ada.Directories.Hierarchical_File_Names (A.16.1)
Ada.Directories.Information (A.16)
Ada.Decimal (F.2)
Ada.Direct_IO (A.8.4)
Ada.Dispatching (D.2.1)
Ada.Dispatching.EDF (D.2.6)
Ada.Dispatching.Non_Preemptive (D.2.4)
Ada.Dispatching.Round_Robin (D.2.5)
Ada.Dynamic_Priorities (D.5)
Ada.Environment_Variables (A.17)
Ada.Exceptions (11.4.1)
Ada.Execution_Time (D.14)
Ada.Execution_Time.Group_Budgets (D.14.2)
Ada.Execution_Time.Timers (D.14.1)'
Ada.Finalization (7.6)
Ada.Float_Text_IO (A.10.9)
Ada.Float_Wide_Text_IO (A.10.9)
Ada.Float_Wide_Wide_Text_IO (A.10.9)
Ada.Integer_Text_IO (A.10.9)
Ada.Integer_Wide_Text_IO (A.10.9)
Ada.Integer_Wide_Wide_Text_IO (A.10.9)
Ada.Interrupts (C.3.2)
Ada.Interrupts.Names (C.3.2)
Ada.IO_Exceptions (A.13)
Ada.Iterator_Interfaces (5.5.1)
Ada.Locales (A.19)
Ada.Numerics
Ada.Numerics.Complex_Arrays (G.3.2)
Ada.Numerics.Complex_Elementary_Functions
Float
and the Complex
and Imaginary
types
created by the package Numerics.Complex_Types
.
Ada.Numerics.Complex_Types
Numerics.Generic_Complex_Types
using Standard.Float
to
build the type Complex
and Imaginary
.
Ada.Numerics.Discrete_Random
Ada.Numerics.Float_Random
Ada.Numerics.Generic_Complex_Elementary_Functions
The following predefined instantiations of this package are provided:
Short_Float
Ada.Numerics.Short_Complex_Elementary_Functions
Float
Ada.Numerics.Complex_Elementary_Functions
Long_Float
Ada.Numerics.Long_Complex_Elementary_Functions
Ada.Numerics.Generic_Complex_Types
The following predefined instantiations of this package exist
Short_Float
Ada.Numerics.Short_Complex_Complex_Types
Float
Ada.Numerics.Complex_Complex_Types
Long_Float
Ada.Numerics.Long_Complex_Complex_Types
Ada.Numerics.Generic_Elementary_Functions
The following predefined instantiations of this package exist
Short_Float
Ada.Numerics.Short_Elementary_Functions
Float
Ada.Numerics.Elementary_Functions
Long_Float
Ada.Numerics.Long_Elementary_Functions
Ada.Numerics.Generic_Real_Arrays (G.3.1)
Ada.Numerics.Real_Arrays (G.3.1)
Ada.Real_Time (D.8)
Calendar
, but
operating with a finer clock suitable for real time control. Note that
annex D requires that there be no backward clock jumps, and GNAT generally
guarantees this behavior, but of course if the external clock on which
the GNAT runtime depends is deliberately reset by some external event,
then such a backward jump may occur.
Ada.Real_Time.Timing_Events (D.15)
Ada.Sequential_IO (A.8.1)
Ada.Storage_IO (A.9)
Ada.Streams (13.13.1)
Input
,
Output
, Read
and Write
).
Ada.Streams.Stream_IO (A.12.1)
Streams
defined in
package Streams
together with a set of operations providing
Stream_IO capability. The Stream_IO model permits both random and
sequential access to a file which can contain an arbitrary set of values
of one or more Ada types.
Ada.Strings (A.4.1)
Ada.Strings.Bounded (A.4.4)
Ada.Strings.Bounded.Equal_Case_Insensitive (A.4.10)
Ada.Strings.Bounded.Hash (A.4.9)
Ada.Strings.Bounded.Hash_Case_Insensitive (A.4.9)
Ada.Strings.Bounded.Less_Case_Insensitive (A.4.10)
Ada.Strings.Fixed (A.4.3)
Ada.Strings.Fixed.Equal_Case_Insensitive (A.4.10)
Ada.Strings.Fixed.Hash_Case_Insensitive (A.4.9)
Ada.Strings.Fixed.Less_Case_Insensitive (A.4.10)
Ada.Strings.Hash (A.4.9) This package provides a hash function for strings.
Ada.Strings.Hash_Case_Insensitive (A.4.9)
This package provides a hash function for strings that is case insensitive.
The string is converted to lower case before computing the hash.
Ada.Strings.Less_Case_Insensitive (A.4.10)
Ada.Strings.Maps (A.4.2)
Ada.Strings.Maps.Constants (A.4.6)
Ada.Strings.Unbounded (A.4.5)
Ada.Strings.Unbounded.Equal_Case_Insensitive (A.4.10)
Ada.Strings.Unbounded.Hash (A.4.9)
Ada.Strings.Unbounded.Hash_Case_Insensitive (A.4.9)
Ada.Strings.Unbounded.Less_Case_Insensitive (A.4.10)
Ada.Strings.UTF_Encoding (A.4.11)
Ada.Strings.UTF_Encoding.Conversions (A.4.11)
Ada.Strings.UTF_Encoding.Strings (A.4.11)
Ada.Strings.UTF_Encoding.Wide_Strings (A.4.11)
Ada.Strings.UTF_Encoding.Wide_Wide_Strings (A.4.11)
Ada.Strings.Wide_Bounded (A.4.7)
Ada.Strings.Wide_Fixed (A.4.7)
Ada.Strings.Wide_Maps (A.4.7)
Ada.Strings.Wide_Unbounded (A.4.7)
Wide_String
and Wide_Character
instead of String
and Character
. Versions of all the child packages are available.
Ada.Strings.Wide_Wide_Bounded (A.4.7)
Ada.Strings.Wide_Wide_Fixed (A.4.7)
Ada.Strings.Wide_Wide_Maps (A.4.7)
Ada.Strings.Wide_Wide_Unbounded (A.4.7)
Wide_Wide_String
and Wide_Wide_Character
instead
of String
and Character
.
Ada.Synchronous_Barriers (D.10.1)
Ada.Synchronous_Task_Control (D.10)
Ada.Synchronous_Task_Control.EDF (D.10)
Ada.Tags
Ada.Tags.Generic_Dispatching_Constructor (3.9)
Ada.Task_Attributes (C.7.2)
Ada.Task_Identifification (C.7.1)
Ada.Task_Termination (C.7.3)
Ada.Text_IO
Ada.Text_IO.Decimal_IO
Ada.Text_IO.Enumeration_IO
Ada.Text_IO.Fixed_IO
Ada.Text_IO.Float_IO
Short_Float
Short_Float_Text_IO
Float
Float_Text_IO
Long_Float
Long_Float_Text_IO
Ada.Text_IO.Integer_IO
Short_Short_Integer
Ada.Short_Short_Integer_Text_IO
Short_Integer
Ada.Short_Integer_Text_IO
Integer
Ada.Integer_Text_IO
Long_Integer
Ada.Long_Integer_Text_IO
Long_Long_Integer
Ada.Long_Long_Integer_Text_IO
Ada.Text_IO.Modular_IO
Ada.Text_IO.Bounded_IO (A.10.11)
Ada.Text_IO.Complex_IO (G.1.3)
Ada.Text_IO.Editing (F.3.3)
Ada.Text_IO.Text_Streams (A.12.2)
Ada.Text_IO.Unbounded_IO (A.10.12)
Ada.Unchecked_Conversion (13.9)
If the types have the same Size (more accurately the same Value_Size), then the effect is simply to transfer the bits from the source to the target type without any modification. This usage is well defined, and for simple types whose representation is typically the same across all implementations, gives a portable method of performing such conversions.
If the types do not have the same size, then the result is implementation defined, and thus may be non-portable. The following describes how GNAT handles such unchecked conversion cases.
If the types are of different sizes, and are both discrete types, then the effect is of a normal type conversion without any constraint checking. In particular if the result type has a larger size, the result will be zero or sign extended. If the result type has a smaller size, the result will be truncated by ignoring high order bits.
If the types are of different sizes, and are not both discrete types, then the conversion works as though pointers were created to the source and target, and the pointer value is converted. The effect is that bits are copied from successive low order storage units and bits of the source up to the length of the target type.
A warning is issued if the lengths differ, since the effect in this case is implementation dependent, and the above behavior may not match that of some other compiler.
A pointer to one type may be converted to a pointer to another type using unchecked conversion. The only case in which the effect is undefined is when one or both pointers are pointers to unconstrained array types. In this case, the bounds information may get incorrectly transferred, and in particular, GNAT uses double size pointers for such types, and it is meaningless to convert between such pointer types. GNAT will issue a warning if the alignment of the target designated type is more strict than the alignment of the source designated type (since the result may be unaligned in this case).
A pointer other than a pointer to an unconstrained array type may be
converted to and from System.Address. Such usage is common in Ada 83
programs, but note that Ada.Address_To_Access_Conversions is the
preferred method of performing such conversions in Ada 95 and Ada 2005.
Neither
unchecked conversion nor Ada.Address_To_Access_Conversions should be
used in conjunction with pointers to unconstrained objects, since
the bounds information cannot be handled correctly in this case.
Ada.Unchecked_Deallocation (13.11.2)
Ada.Wide_Text_IO (A.11)
Ada.Text_IO
, except that the external
file supports wide character representations, and the internal types are
Wide_Character
and Wide_String
instead of Character
and String
. The corresponding set of nested packages and child
packages are defined.
Ada.Wide_Wide_Text_IO (A.11)
Ada.Text_IO
, except that the external
file supports wide character representations, and the internal types are
Wide_Character
and Wide_String
instead of Character
and String
. The corresponding set of nested packages and child
packages are defined.
For packages in Interfaces and System, all the RM defined packages are available in GNAT, see the Ada 2012 RM for full details.