Next: The Implementation of Standard I/O, Previous: Representation Clauses and Pragmas, Up: Top
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).
Ada (A.2)
Ada.Calendar (9.6)
Calendar
provides time of day access, and routines for
manipulating times and durations.
Ada.Characters (A.3.1)
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.Decimal (F.2)
Ada.Direct_IO (A.8.4)
Ada.Dynamic_Priorities (D.5)
Ada.Exceptions (11.4.1)
Ada.Finalization (7.6)
Ada.Interrupts (C.3.2)
Ada.Interrupts.Names (C.3.2)
Ada.IO_Exceptions (A.13)
Ada.Numerics
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.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.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.Fixed (A.4.3)
Ada.Strings.Maps (A.4.2)
Ada.Strings.Maps.Constants (A.4.6)
Ada.Strings.Unbounded (A.4.5)
Ada.Strings.Wide_Bounded (A.4.7)
Ada.Strings.Wide_Fixed (A.4.7)
Ada.Strings.Wide_Maps (A.4.7)
Ada.Strings.Wide_Maps.Constants (A.4.7)
Ada.Strings.Wide_Unbounded (A.4.7)
Wide_String
and Wide_Character
instead of String
and Character
.
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_Maps.Constants (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_Task_Control (D.10)
Ada.Tags
Ada.Task_Attributes
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.Complex_IO (G.1.3)
Ada.Text_IO.Editing (F.3.3)
Ada.Text_IO.Text_Streams (A.12.2)
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
. It contains generic subpackages listed next.
Ada.Wide_Text_IO.Decimal_IO
Ada.Wide_Text_IO.Enumeration_IO
Ada.Wide_Text_IO.Fixed_IO
Ada.Wide_Text_IO.Float_IO
Short_Float
Short_Float_Wide_Text_IO
Float
Float_Wide_Text_IO
Long_Float
Long_Float_Wide_Text_IO
Ada.Wide_Text_IO.Integer_IO
Short_Short_Integer
Ada.Short_Short_Integer_Wide_Text_IO
Short_Integer
Ada.Short_Integer_Wide_Text_IO
Integer
Ada.Integer_Wide_Text_IO
Long_Integer
Ada.Long_Integer_Wide_Text_IO
Long_Long_Integer
Ada.Long_Long_Integer_Wide_Text_IO
Ada.Wide_Text_IO.Modular_IO
Ada.Wide_Text_IO.Complex_IO (G.1.3)
Ada.Text_IO.Complex_IO
, except that the
external file supports wide character representations.
Ada.Wide_Text_IO.Editing (F.3.4)
Ada.Text_IO.Editing
, except that the
types are Wide_Character
and Wide_String
instead of
Character
and String
.
Ada.Wide_Text_IO.Streams (A.12.3)
Ada.Text_IO.Streams
, except that the
types are Wide_Character
and Wide_String
instead of
Character
and String
.
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
. It contains generic subpackages listed next.
Ada.Wide_Wide_Text_IO.Decimal_IO
Ada.Wide_Wide_Text_IO.Enumeration_IO
Ada.Wide_Wide_Text_IO.Fixed_IO
Ada.Wide_Wide_Text_IO.Float_IO
Short_Float
Short_Float_Wide_Wide_Text_IO
Float
Float_Wide_Wide_Text_IO
Long_Float
Long_Float_Wide_Wide_Text_IO
Ada.Wide_Wide_Text_IO.Integer_IO
Short_Short_Integer
Ada.Short_Short_Integer_Wide_Wide_Text_IO
Short_Integer
Ada.Short_Integer_Wide_Wide_Text_IO
Integer
Ada.Integer_Wide_Wide_Text_IO
Long_Integer
Ada.Long_Integer_Wide_Wide_Text_IO
Long_Long_Integer
Ada.Long_Long_Integer_Wide_Wide_Text_IO
Ada.Wide_Wide_Text_IO.Modular_IO
Ada.Wide_Wide_Text_IO.Complex_IO (G.1.3)
Ada.Text_IO.Complex_IO
, except that the
external file supports wide character representations.
Ada.Wide_Wide_Text_IO.Editing (F.3.4)
Ada.Text_IO.Editing
, except that the
types are Wide_Character
and Wide_String
instead of
Character
and String
.
Ada.Wide_Wide_Text_IO.Streams (A.12.3)
Ada.Text_IO.Streams
, except that the
types are Wide_Character
and Wide_String
instead of
Character
and String
.