# Ada Libraries

The current, editable version of this book is available in Wikibooks, the open-content textbooks collection, at
https://en.wikibooks.org/wiki/Ada_Libraries

# Ada Programming/Libraries/Ada.Assertions

This language feature is only available from Ada 2005 on.
Ada.Assertions is a unit of the Predefined Language Environment since Ada 2005.

## See also
### Wikibook

* Ada Programming/Libraries/Ada

### External examples

* Search for examples of Ada_Libraries in: Rosetta Code, GitHub (gists), any Alire crate or this Wikibook.
* Search for posts related to Ada_Libraries in: Stack Overflow, comp.lang.ada or any Ada related page.

### Ada Reference Manual
#### Ada 2005

* 11.4.2: Pragmas Assert and Assertion_Policy

#### Ada 2012

* 11.4.2: Pragmas Assert and Assertion_Policy

### Open-Source Implementations

FSF GNAT
* Specification: a-assert.ads
* Body: a-assert.adb
drake
* Specification: a-assert.ads
* Body: a-assert.adb

# Ada Programming/Libraries/Ada.Asynchronous Task Control

This language feature is available from Ada 95 on.
Ada.Asynchronous_Task_Control is a unit of the Predefined Language Environment since Ada 95.

## See also
### Wikibook

* Ada Programming/Libraries/Ada

### External examples

* Search for examples of Ada_Libraries in: Rosetta Code, GitHub (gists), any Alire crate or this Wikibook.
* Search for posts related to Ada_Libraries in: Stack Overflow, comp.lang.ada or any Ada related page.

### Ada Reference Manual
#### Ada 95

* D.11: Asynchronous Task Control

#### Ada 2005

* D.11: Asynchronous Task Control

#### Ada 2012

* D.11: Asynchronous Task Control

### Open-Source Implementations

FSF GNAT
* Specification: a-astaco.ads
* Body: a-astaco.adb
drake
* Specification: tasking/a-astaco.ads

# Ada Programming/Libraries/Ada.Calendar

This language feature is available from Ada 95 on.
Ada.Calendar is a unit of the Predefined Language Environment since Ada 95.

## See also
### Wikibook

* Ada Programming/Libraries/Ada

### External examples

* Search for examples of Ada_Libraries in: Rosetta Code, GitHub (gists), any Alire crate or this Wikibook.
* Search for posts related to Ada_Libraries in: Stack Overflow, comp.lang.ada or any Ada related page.

### Ada Reference Manual
#### Ada 95

* 9.6: Delay Statements, Duration, and Time

#### Ada 2005

* 9.6: Delay Statements, Duration, and Time

#### Ada 2012

* 9.6: Delay Statements, Duration, and Time

### Open-Source Implementations

FSF GNAT
* Specification: a-calend.ads
* Body: a-calend.adb
drake
* Specification: calendar/a-calend.ads
* Body: calendar/a-calend.adb

# Ada Programming/Libraries/Ada.Calendar.Arithmetic

This language feature is only available from Ada 2005 on.
Ada.Calendar.Arithmetic is a unit of the Predefined Language Environment since Ada 2005.

## See also
### Wikibook

* Ada Programming/Libraries/Ada

### External examples

* Search for examples of Ada_Libraries in: Rosetta Code, GitHub (gists), any Alire crate or this Wikibook.
* Search for posts related to Ada_Libraries in: Stack Overflow, comp.lang.ada or any Ada related page.

### Ada Reference Manual
#### Ada 2005

* 9.6.1: Formatting, Time Zones, and other operations for Time

#### Ada 2012

* 9.6.1: Formatting, Time Zones, and other operations for Time

### Open-Source Implementations

FSF GNAT
* Specification: a-calari.ads
* Body: a-calari.adb
drake
* Specification: calendar/a-calari.ads
* Body: calendar/a-calari.adb

# Ada Programming/Libraries/Ada.Calendar.Formatting

This language feature is only available from Ada 2005 on.
Ada.Calendar.Formatting is a unit of the Predefined Language Environment since Ada 2005.

## See also
### Wikibook

* Ada Programming/Libraries/Ada

### External examples

* Search for examples of Ada_Libraries in: Rosetta Code, GitHub (gists), any Alire crate or this Wikibook.
* Search for posts related to Ada_Libraries in: Stack Overflow, comp.lang.ada or any Ada related page.

### Ada Reference Manual
#### Ada 2005

* 9.6.1: Formatting, Time Zones, and other operations for Time

#### Ada 2012

* 9.6.1: Formatting, Time Zones, and other operations for Time

### Open-Source Implementations

FSF GNAT
* Specification: a-calfor.ads
* Body: a-calfor.adb
drake
* Specification: calendar/a-calfor.ads
* Body: calendar/a-calfor.adb

# Ada Programming/Libraries/Ada.Calendar.Time Zones

This language feature is only available from Ada 2005 on.
Ada.Calendar.Time_Zones is a unit of the Predefined Language Environment since Ada 2005.

## See also
### Wikibook

* Ada Programming/Libraries/Ada

### External examples

* Search for examples of Ada_Libraries in: Rosetta Code, GitHub (gists), any Alire crate or this Wikibook.
* Search for posts related to Ada_Libraries in: Stack Overflow, comp.lang.ada or any Ada related page.

### Ada Reference Manual
#### Ada 2005

* 9.6.1: Formatting, Time Zones, and other operations for Time

#### Ada 2012

* 9.6.1: Formatting, Time Zones, and other operations for Time

### Open-Source Implementations

FSF GNAT
* Specification: a-catizo.ads
* Body: a-catizo.adb
drake
* Specification: calendar/a-catizo.ads
* Body: calendar/a-catizo.adb

# Ada Programming/Libraries/Ada.Characters

This language feature is available from Ada 95 on.
Ada.Characters is a unit of the Predefined Language Environment since Ada 95.

## See also
### Wikibook

* Ada Programming/Libraries/Ada

### External examples

* Search for examples of Ada_Libraries in: Rosetta Code, GitHub (gists), any Alire crate or this Wikibook.
* Search for posts related to Ada_Libraries in: Stack Overflow, comp.lang.ada or any Ada related page.

### Ada Reference Manual
#### Ada 95

* A.3.1: The Package Characters

#### Ada 2005

* A.3.1: The Packages Characters, Wide_Characters, and Wide_Wide_Characters

#### Ada 2012

* A.3.1: The Packages Characters, Wide_Characters, and Wide_Wide_Characters

### Open-Source Implementations

FSF GNAT
* Specification: a-charac.ads
drake
* Specification: strings/a-charac.ads

# Ada Programming/Libraries/Ada.Characters.Conversions

This language feature is only available from Ada 2005 on.
Ada.Characters.Conversions is a unit of the Predefined Language Environment since Ada 2005.

## See also
### Wikibook

* Ada Programming/Libraries/Ada

### External examples

* Search for examples of Ada_Libraries in: Rosetta Code, GitHub (gists), any Alire crate or this Wikibook.
* Search for posts related to Ada_Libraries in: Stack Overflow, comp.lang.ada or any Ada related page.

### Ada Reference Manual
#### Ada 2005

* A.3.4: The Package Characters.Conversions

#### Ada 2012

* A.3.4: The Package Characters.Conversions

# Ada Programming/Libraries/Ada.Characters.Handling

This language feature is available from Ada 95 on.
Ada.Characters.Handling is a unit of the Predefined Language Environment since Ada 95.

## See also
### Wikibook

* Ada Programming/Libraries/Ada

### External examples

* Search for examples of Ada_Libraries in: Rosetta Code, GitHub (gists), any Alire crate or this Wikibook.
* Search for posts related to Ada_Libraries in: Stack Overflow, comp.lang.ada or any Ada related page.

### Ada Reference Manual
#### Ada 95

* A.3.2: The Package Characters.Handling

#### Ada 2005

* A.3.2: The Package Characters.Handling

#### Ada 2012

* A.3.2: The Package Characters.Handling

# Ada Programming/Libraries/Ada.Characters.Latin 1

This language feature is available from Ada 95 on.
Ada.Characters.Latin_1 is a unit of the Predefined Language Environment since Ada 95.

## See also
### Wikibook

* Ada Programming/Libraries/Ada

### External examples

* Search for examples of Ada_Libraries in: Rosetta Code, GitHub (gists), any Alire crate or this Wikibook.
* Search for posts related to Ada_Libraries in: Stack Overflow, comp.lang.ada or any Ada related page.

### Ada Reference Manual
#### Ada 95

* A.3.3: The Package Characters.Latin_1

#### Ada 2005

* A.3.3: The Package Characters.Latin_1

#### Ada 2012

* A.3.3: The Package Characters.Latin_1

### Open-Source Implementations

FSF GNAT
* Specification: a-chlat1.ads
drake
* Specification: strings/a-chlat1.ads

# Ada Programming/Libraries/Ada.Command Line

This language feature is available from Ada 95 on.
Ada.Command_Line is a unit of the Predefined Language Environment since Ada 95.

## Introduction

The Ada.Command_Line package enables the Ada program to access the command line arguments set by the command that invoked the program. It is the Ada version of the C argv and argc[n] system.
If the environment supports it, it is also possible to set the Ada program's exit status with Ada.Command_Line.
It is important to note, that all the code in this article is compiled and executed on a Slackware Linux system. The compiler used is GNATMAKE GPL 2008 (20080521) and the shell is BASH. This is important because the reference manual clearly states that:
If the external execution environment supports passing arguments to a program, then Argument_Count returns the number of arguments passed to the program invoking the function. Otherwise, it returns 0. The meaning of “number of arguments” is implementation defined.
Note the closing sentence: The meaning of “number of arguments” is implementation defined. What this means, is that you cannot trust a given argument string to yield the same result for all environments. Argument_Count is highly dependent on factors such as operating system, shell, and compiler.

## Using Ada.Command_Line

The program we'll be using throughout this article doesn't actually do anything, except report the various arguments we've used when invoking the program. The basic program looks like this:
When executing the above program with no arguments given, you should get the following output:
Let's quickly go over the program: On lines 1 and 2 we add the Text_IO and Command_Line packages to the program. On lines 5 and 6 we rename those packages to the shorter IO and CLI and finally on line 8 we output the current argument count. And that is really all that is required to enable access to the command line arguments given to the program.
The full specification of the Command_Line package is about as simple as such specifications can be.
We've already encountered the Argument_Count function in the Args program, but lets see what happens when we invoke the Args program with some arguments.

### Ada.Command_Line.Argument_Count

The specification for Argument_Count looks like this:
The basic Args program already use the Argument_Count function, so to see how it works, all we have to do is supply the program with a variety of arguments:
A pattern should've emerged by now. Of particular interest is the last example: Because the whitespace is escaped, the entire string is treated as one argument. One could easily imagine that another environment might treat such an argument differently and perhaps ignore the backslash. The same holds for the double quotes example ("Thomas Løcke"). Other shells/environments might very well treat "Thomas Løcke" as two separate arguments because of the whitespace. The key thing is to be aware of such details when using Ada.Command_Line.

### Ada.Command_Line.Argument

The specification for Argument looks like this:
Argument returns a String argument corresponding to the relative position Number. Note that Number is of type Positive. This means that the valid range of Number is 1 .. Argument_Count. If Number is outside this range, a Constraint_Error is raised.
To see how it works, we add 3 more lines to our small Args program:
If we run Args with the same arguments as given in the Argument_Count example, we get these results:
There are no big surprises here.
If no arguments are given when running the program, you will end up with a null range loop: (1 .. 0). This is perfectly valid and the result is as expected: The loop is terminated immediately.

### Ada.Command_Line.Command_Name

The specification for Command_Name looks like this:
Command_Name returns the string command used to invoke the program. As is the case with Argument_Count, this is implementation-defined, so Command_Name might return X on system A, Y on system B and null on system C. You cannot rely on this value being the same across all combinations of compilers, shells, and operating systems.
To see how it works, add this line to the Args program:
If we execute the program, without any arguments, from within GNAT Studio (using Shift+F2), the result will be this:
Notice how GNAT Studio uses the full path to the Args program to invoke it.
If I change directory to /home/thomas/wiki_examples/Args/, and execute the Args program from the commandline, I get this:
If I use the common ./ syntax to execute the program, I get this:
As you can see, in an environment that supports argument passing, the Command_Name function returns the exact string used to invoke the program.

### Ada.Command_Line.Set_Exit_Status

The specification for Set_Exit_Status looks like this:
If the environment supports the return of an task completion code, Set_Exit_Status allows you to set an exit status for the program. If you look at the specification for Ada.Command_Line, you will notice the type Exit_Status and the two variables Success and Failure. These two are defined as 0 and 1, respectively, but it is entirely possible to define your own exit status codes.
To see how that works, add this to the specification of the Args program:
And this to the body of the program:
What we do here is set the exit status depending on the number of arguments given to the program. This is what happens when we execute the program with various arguments:
echo $? outputs the exit code of the most recently executed program. On the first execution, we get a failure because no arguments are given. On the second execution, we get a success because exactly one argument is given. On the third execution, we get the special exit code 3 because more than one argument is given.

## See also
### Wikibook

* Ada Programming/Libraries/Ada

### External examples

* Search for examples of Ada_Libraries in: Rosetta Code, GitHub (gists), any Alire crate or this Wikibook.
* Search for posts related to Ada_Libraries in: Stack Overflow, comp.lang.ada or any Ada related page.

### Ada Reference Manual
#### Ada 95

* A.15: The Package Command_Line

#### Ada 2005

* A.15: The Package Command_Line

#### Ada 2012

* A.15: The Package Command_Line

### Open-Source Implementations

FSF GNAT
* Specification: a-comlin.ads
* Body: a-comlin.adb
drake
* Specification: environment/a-comlin.ads
* Body: environment/a-comlin.adb

# Ada Programming/Libraries/Ada.Complex Text IO

This language feature is only available from Ada 2005 on.
Ada.Complex_Text_IO is a unit of the Predefined Language Environment since Ada 2005.

## See also
### Wikibook

* Ada Programming/Libraries/Ada

### External examples

* Search for examples of Ada_Libraries in: Rosetta Code, GitHub (gists), any Alire crate or this Wikibook.
* Search for posts related to Ada_Libraries in: Stack Overflow, comp.lang.ada or any Ada related page.

### Ada Reference Manual
#### Ada 2005

* G.1.3: Complex Input-Output

#### Ada 2012

* G.1.3: Complex Input-Output

### Open-Source Implementations

FSF GNAT
* Specification: a-coteio.ads
drake
* Specification: textio/a-coteio.ads

# Ada Programming/Libraries/Ada.Containers

This language feature is only available from Ada 2005 on.
Ada.Containers is a unit of the Predefined Language Environment since Ada 2005.

## Specification

A typical —almost empty— root package. All the interesting stuff happens inside the child packages.

## See also
### Child units

   * Ada.Containers.Bounded_Doubly_Linked_Lists (Ada 2012)
   * Ada.Containers.Bounded_Hashed_Maps (Ada 2012)
   * Ada.Containers.Bounded_Hashed_Sets (Ada 2012)
   * Ada.Containers.Bounded_Indefinite_Holders (Ada 2022)
   * Ada.Containers.Bounded_Multiway_Trees (Ada 2012)
   * Ada.Containers.Bounded_Ordered_Maps (Ada 2012)
   * Ada.Containers.Bounded_Ordered_Sets (Ada 2012)
   * Ada.Containers.Bounded_Priority_Queues (Ada 2012)
   * Ada.Containers.Bounded_Synchronized_Queues (Ada 2012)
   * Ada.Containers.Bounded_Vectors (Ada 2012)
   * Ada.Containers.Doubly_Linked_Lists (Ada 2005)
   * Ada.Containers.Generic_Array_Sort (generic procedure) (Ada 2005)
   * Ada.Containers.Generic_Constrained_Array_Sort (generic procedure) (Ada 2005)
   * Ada.Containers.Hashed_Maps (Ada 2005)
   * Ada.Containers.Hashed_Sets (Ada 2005)
   * Ada.Containers.Indefinite_Doubly_Linked_Lists (Ada 2005)
   * Ada.Containers.Indefinite_Hashed_Maps (Ada 2005)
   * Ada.Containers.Indefinite_Hashed_Sets (Ada 2005)
   * Ada.Containers.Indefinite_Holders (Ada 2012)
   * Ada.Containers.Indefinite_Multiway_Trees (Ada 2012)
   * Ada.Containers.Indefinite_Ordered_Maps (Ada 2005)
   * Ada.Containers.Indefinite_Ordered_Sets (Ada 2005)
   * Ada.Containers.Indefinite_Vectors (Ada 2005)
   * Ada.Containers.Multiway_Trees (Ada 2012)
   * Ada.Containers.Ordered_Maps (Ada 2005)
   * Ada.Containers.Ordered_Sets (Ada 2005)
   * Ada.Containers.Synchronized_Queue_Interfaces (Ada 2012)
   * Ada.Containers.Unbounded_Priority_Queues (Ada 2012)
   * Ada.Containers.Unbounded_Synchronized_Queues (Ada 2012)
   * Ada.Containers.Vectors (Ada 2005)

### Wikibook

* Ada Programming
* Ada Programming/Containers
* Ada Programming/Libraries
* Ada Programming/Libraries/Ada

### External examples

* Search for examples of Ada_Libraries in: Rosetta Code, GitHub (gists), any Alire crate or this Wikibook.
* Search for posts related to Ada_Libraries in: Stack Overflow, comp.lang.ada or any Ada related page.

### Ada Reference Manual
#### Ada 2005

* A.18.1: The Package Containers

#### Ada 2012

* A.18.1: The Package Containers

## External links

* An Index to Ada.Containers

# Ada Programming/Libraries/Ada.Containers.Bounded Doubly Linked Lists

This language feature has been introduced in Ada 2012.
Ada.Containers.Bounded_Doubly_Linked_Lists is a unit of the Predefined Language Environment since Ada 2012.

## See also
### Wikibook

* Ada Programming/Libraries/Ada
* Ada Programming/Libraries/Ada.Containers

### External examples

* Search for examples of Ada_Libraries in: Rosetta Code, GitHub (gists), any Alire crate or this Wikibook.
* Search for posts related to Ada_Libraries in: Stack Overflow, comp.lang.ada or any Ada related page.

### Ada Reference Manual
#### Ada 2012

* A.18.20: The Generic Package Containers.Bounded_Doubly_Linked_Lists

### Open-Source Implementations

FSF GNAT
* Specification: a-cbdlli.ads
* Body: a-cbdlli.adb

# Ada Programming/Libraries/Ada.Containers.Bounded Hashed Maps

This language feature has been introduced in Ada 2012.
Ada.Containers.Bounded_Hashed_Maps is a unit of the Predefined Language Environment since Ada 2012.

## See also
### Wikibook

* Ada Programming/Libraries/Ada
* Ada Programming/Libraries/Ada.Containers

### External examples

* Search for examples of Ada_Libraries in: Rosetta Code, GitHub (gists), any Alire crate or this Wikibook.
* Search for posts related to Ada_Libraries in: Stack Overflow, comp.lang.ada or any Ada related page.

### Ada Reference Manual
#### Ada 2012

* A.18.21: The Generic Package Containers.Bounded_Hashed_Maps

### Open-Source Implementations

FSF GNAT
* Specification: a-cbhama.ads
* Body: a-cbhama.adb

# Ada Programming/Libraries/Ada.Containers.Bounded Hashed Sets

This language feature has been introduced in Ada 2012.
Ada.Containers.Bounded_Hashed_Sets is a unit of the Predefined Language Environment since Ada 2012.

## See also
### Wikibook

* Ada Programming/Libraries/Ada
* Ada Programming/Libraries/Ada.Containers

### External examples

* Search for examples of Ada_Libraries in: Rosetta Code, GitHub (gists), any Alire crate or this Wikibook.
* Search for posts related to Ada_Libraries in: Stack Overflow, comp.lang.ada or any Ada related page.

### Ada Reference Manual
#### Ada 2012

* A.18.23: The Generic Package Containers.Bounded_Hashed_Sets

### Open-Source Implementations

FSF GNAT
* Specification: a-cbhase.ads
* Body: a-cbhase.adb

# Ada Programming/Libraries/Ada.Containers.Bounded Ordered Maps

This language feature has been introduced in Ada 2012.
Ada.Containers.Bounded_Ordered_Maps is a unit of the Predefined Language Environment since Ada 2012.

## See also
### Wikibook

* Ada Programming/Libraries/Ada
* Ada Programming/Libraries/Ada.Containers

### External examples

* Search for examples of Ada_Libraries in: Rosetta Code, GitHub (gists), any Alire crate or this Wikibook.
* Search for posts related to Ada_Libraries in: Stack Overflow, comp.lang.ada or any Ada related page.

### Ada Reference Manual
#### Ada 2012

* A.18.22: The Generic Package Containers.Bounded_Ordered_Maps

### Open-Source Implementations

FSF GNAT
* Specification: a-cborma.ads
* Body: a-cborma.adb

# Ada Programming/Libraries/Ada.Containers.Bounded Ordered Sets

Ada Programming/Libraries/Ada.Containers.Bounded Ordered Sets

# Ada Programming/Libraries/Ada.Containers.Bounded Priority Queues

Ada Programming/Libraries/Ada.Containers.Bounded Priority Queues

# Ada Programming/Libraries/Ada.Containers.Bounded Synchronized Queues

Ada Programming/Libraries/Ada.Containers.Bounded Synchronized Queues

# Ada Programming/Libraries/Ada.Containers.Bounded Vectors

Ada Programming/Libraries/Ada.Containers.Bounded Vectors

# Ada Programming/Libraries/Ada.Containers.Doubly Linked Lists

Ada Programming/Libraries/Ada.Containers.Doubly Linked Lists

# Ada Programming/Libraries/Ada.Containers.Generic Array Sort

Ada Programming/Libraries/Ada.Containers.Generic Array Sort

# Ada Programming/Libraries/Ada.Containers.Generic Constrained Array Sort

Ada Programming/Libraries/Ada.Containers.Generic Constrained Array Sort

# Ada Programming/Libraries/Ada.Containers.Generic Sort

Ada Programming/Libraries/Ada.Containers.Generic Sort

# Ada Programming/Libraries/Ada.Containers.Hashed Maps

Ada Programming/Libraries/Ada.Containers.Hashed Maps

# Ada Programming/Libraries/Ada.Containers.Hashed Sets

Ada Programming/Libraries/Ada.Containers.Hashed Sets

# Ada Programming/Libraries/Ada.Containers.Indefinite Doubly Linked Lists

Ada Programming/Libraries/Ada.Containers.Indefinite Doubly Linked Lists

# Ada Programming/Libraries/Ada.Containers.Indefinite Hashed Maps

Ada Programming/Libraries/Ada.Containers.Indefinite Hashed Maps

# Ada Programming/Libraries/Ada.Containers.Indefinite Hashed Sets

Ada Programming/Libraries/Ada.Containers.Indefinite Hashed Sets

# Ada Programming/Libraries/Ada.Containers.Indefinite Holders

Ada Programming/Libraries/Ada.Containers.Indefinite Holders

# Ada Programming/Libraries/Ada.Containers.Indefinite Multiway Trees

Ada Programming/Libraries/Ada.Containers.Indefinite Multiway Trees

# Ada Programming/Libraries/Ada.Containers.Indefinite Ordered Maps

Ada Programming/Libraries/Ada.Containers.Indefinite Ordered Maps

# Ada Programming/Libraries/Ada.Containers.Indefinite Ordered Sets

Ada Programming/Libraries/Ada.Containers.Indefinite Ordered Sets

# Ada Programming/Libraries/Ada.Containers.Indefinite Vectors

Ada Programming/Libraries/Ada.Containers.Indefinite Vectors

# Ada Programming/Libraries/Ada.Containers.Multiway Trees

Ada Programming/Libraries/Ada.Containers.Multiway Trees

# Ada Programming/Libraries/Ada.Containers.Ordered Maps

Ada Programming/Libraries/Ada.Containers.Ordered Maps

# Ada Programming/Libraries/Ada.Containers.Ordered Sets

Ada Programming/Libraries/Ada.Containers.Ordered Sets

# Ada Programming/Libraries/Ada.Containers.Synchronized Queue Interfaces

Ada Programming/Libraries/Ada.Containers.Synchronized Queue Interfaces

# Ada Programming/Libraries/Ada.Containers.Unbounded Priority Queues

Ada Programming/Libraries/Ada.Containers.Unbounded Priority Queues

# Ada Programming/Libraries/Ada.Containers.Unbounded Synchronized Queues

Ada Programming/Libraries/Ada.Containers.Unbounded Synchronized Queues

# Ada Programming/Libraries/Ada.Containers.Vectors

Ada Programming/Libraries/Ada.Containers.Vectors