Jump to content

[[:Template:BOOKNAME]]/Libraries/Ada.Containers.Unbounded_Synchronized_Queues

From Wikibooks, open books for an open world


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

Permission is granted to copy, distribute, and/or modify this document under the terms of the Creative Commons Attribution-ShareAlike 3.0 License.



Ada Programming/Libraries/Ada.Assertions

[edit | edit source]

Ada. Time-tested, safe and secure.
Ada. Time-tested, safe and secure.

This language feature is only available from Ada 2005 on.

Ada.Assertions is a unit of the Predefined Language Environment since Ada 2005.

Specification

[edit | edit source]
--                     Standard Ada library specification
--   Copyright (c) 2003-2018 Maxim Reznik <reznikmm@gmail.com>
--   Copyright (c) 2004-2016 AXE Consultants
--   Copyright (c) 2004, 2005, 2006 Ada-Europe
--   Copyright (c) 2000 The MITRE Corporation, Inc.
--   Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc.
--   SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual
-- -------------------------------------------------------------------------

package Ada.Assertions is

   pragma Pure (Assertions);

   Assertion_Error : exception;

   procedure Assert (Check : in Boolean);

   procedure Assert (Check : in Boolean; Message : in String);

end Ada.Assertions;

See also

[edit | edit source]

Wikibook

[edit | edit source]

External examples

[edit source]

Ada Reference Manual

[edit | edit source]

Ada 2005

[edit | edit source]

Ada 2012

[edit | edit source]

Open-Source Implementations

[edit | edit source]

FSF GNAT

drake


Ada Programming/Libraries/Ada.Asynchronous Task Control

[edit | edit source]

Ada. Time-tested, safe and secure.
Ada. Time-tested, safe and secure.

This language feature is available from Ada 95 on.

Ada.Asynchronous_Task_Control is a unit of the Predefined Language Environment since Ada 95.

Specification

[edit | edit source]
--                     Standard Ada library specification
--   Copyright (c) 2003-2018 Maxim Reznik <reznikmm@gmail.com>
--   Copyright (c) 2004-2016 AXE Consultants
--   Copyright (c) 2004, 2005, 2006 Ada-Europe
--   Copyright (c) 2000 The MITRE Corporation, Inc.
--   Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc.
--   SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual
-- -------------------------------------------------------------------------

with Ada.Task_Identification;

package Ada.Asynchronous_Task_Control is

   pragma Preelaborate (Asynchronous_Task_Control);

   procedure Hold (T : in Ada.Task_Identification.Task_Id);

   procedure Continue (T : in Ada.Task_Identification.Task_Id);

   function Is_Held (T : in Ada.Task_Identification.Task_Id) return Boolean;

end Ada.Asynchronous_Task_Control;

See also

[edit | edit source]

Wikibook

[edit | edit source]

External examples

[edit source]

Ada Reference Manual

[edit | edit source]

Ada 95

[edit | edit source]

Ada 2005

[edit | edit source]

Ada 2012

[edit | edit source]

Open-Source Implementations

[edit | edit source]

FSF GNAT

drake


Ada Programming/Libraries/Ada.Calendar

[edit | edit source]

Ada. Time-tested, safe and secure.
Ada. Time-tested, safe and secure.

This language feature is available from Ada 95 on.

Ada.Calendar is a unit of the Predefined Language Environment since Ada 95.

Specification

[edit | edit source]
--                     Standard Ada library specification
--   Copyright (c) 2003-2018 Maxim Reznik <reznikmm@gmail.com>
--   Copyright (c) 2004-2016 AXE Consultants
--   Copyright (c) 2004, 2005, 2006 Ada-Europe
--   Copyright (c) 2000 The MITRE Corporation, Inc.
--   Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc.
--   SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual
-- -------------------------------------------------------------------------

package Ada.Calendar is
   type Time is private;

   subtype Year_Number  is Integer range 1901 .. 2399;
   subtype Month_Number is Integer range 1 .. 12;
   subtype Day_Number   is Integer range 1 .. 31;
   subtype Day_Duration is Duration range 0.0 .. 86_400.0;

   function Clock return Time;

   function Year   (Date : Time) return Year_Number;
   function Month  (Date : Time) return Month_Number;
   function Day    (Date : Time) return Day_Number;
   function Seconds(Date : Time) return Day_Duration;

   procedure Split (Date  : in Time;
                    Year    : out Year_Number;
                    Month   : out Month_Number;
                    Day     : out Day_Number;
                    Seconds : out Day_Duration);

   function Time_Of(Year  : Year_Number;
                    Month   : Month_Number;
                    Day     : Day_Number;
                    Seconds : Day_Duration := 0.0)
                   return Time;

   function "+" (Left : Time;   Right : Duration) return Time;
   function "+" (Left : Duration; Right : Time) return Time;
   function "-" (Left : Time;   Right : Duration) return Time;
   function "-" (Left : Time;   Right : Time) return Duration;

   function "<" (Left, Right : Time) return Boolean;
   function "<="(Left, Right : Time) return Boolean;
   function ">" (Left, Right : Time) return Boolean;
   function ">="(Left, Right : Time) return Boolean;

   Time_Error : exception;

private

   pragma Import (Ada, Time);

end Ada.Calendar;

See also

[edit | edit source]

Wikibook

[edit | edit source]

External examples

[edit source]

Ada Reference Manual

[edit | edit source]

Ada 95

[edit | edit source]

Ada 2005

[edit | edit source]

Ada 2012

[edit | edit source]

Open-Source Implementations

[edit | edit source]

FSF GNAT

drake


Ada Programming/Libraries/Ada.Calendar.Arithmetic

[edit | edit source]

Ada. Time-tested, safe and secure.
Ada. Time-tested, safe and secure.

This language feature is only available from Ada 2005 on.

Ada.Calendar.Arithmetic is a unit of the Predefined Language Environment since Ada 2005.

Specification

[edit | edit source]
--                     Standard Ada library specification
--   Copyright (c) 2003-2018 Maxim Reznik <reznikmm@gmail.com>
--   Copyright (c) 2004-2016 AXE Consultants
--   Copyright (c) 2004, 2005, 2006 Ada-Europe
--   Copyright (c) 2000 The MITRE Corporation, Inc.
--   Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc.
--   SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual
-- -------------------------------------------------------------------------

package Ada.Calendar.Arithmetic is

   --   Arithmetic on days:

   type Day_Count is
     range -366 * (1 + Year_Number'Last - Year_Number'First)
       ..  366 * (1 + Year_Number'Last - Year_Number'First);

   subtype Leap_Seconds_Count is Integer range -2047 .. 2047;

   procedure Difference (Left         : in     Time;
                         Right        : in     Time;
                         Days         :    out Day_Count;
                         Seconds      :    out Duration;
                         Leap_Seconds :    out Leap_Seconds_Count);

   function "+" (Left  : in Time;
                 Right : in Day_Count)
                return Time;

   function "+" (Left  : in Day_Count;
                 Right : in Time)
                return Time;

   function "-" (Left  : in Time;
                 Right : in Day_Count)
                return Time;

   function "-" (Left  : in Time;
                 Right : in Time)
                return Day_Count;

end Ada.Calendar.Arithmetic;

See also

[edit | edit source]

Wikibook

[edit | edit source]

External examples

[edit source]

Ada Reference Manual

[edit | edit source]

Ada 2005

[edit | edit source]

Ada 2012

[edit | edit source]

Open-Source Implementations

[edit | edit source]

FSF GNAT

drake


Ada Programming/Libraries/Ada.Calendar.Formatting

[edit | edit source]

Ada. Time-tested, safe and secure.
Ada. Time-tested, safe and secure.

This language feature is only available from Ada 2005 on.

Ada.Calendar.Formatting is a unit of the Predefined Language Environment since Ada 2005.

Specification

[edit | edit source]
--                     Standard Ada library specification
--   Copyright (c) 2003-2018 Maxim Reznik <reznikmm@gmail.com>
--   Copyright (c) 2004-2016 AXE Consultants
--   Copyright (c) 2004, 2005, 2006 Ada-Europe
--   Copyright (c) 2000 The MITRE Corporation, Inc.
--   Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc.
--   SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual
-- -------------------------------------------------------------------------

with Ada.Calendar.Time_Zones;

package Ada.Calendar.Formatting is

   --   Day of the week:

   type Day_Name is
     (Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday);

   function Day_of_Week (Date : in Time) return Day_Name;

   --   Hours:Minutes:Seconds access:

   subtype Hour_Number     is Natural range 0 .. 23;
   subtype Minute_Number   is Natural range 0 .. 59;
   subtype Second_Number   is Natural range 0 .. 59;
   subtype Second_Duration is Day_Duration range 0.0 .. 1.0;

   function Year (Date      : in Time;
                  Time_Zone : in Time_Zones.Time_Offset := 0)
     return Year_Number;

   function Month (Date      : in Time;
                   Time_Zone : in Time_Zones.Time_Offset := 0)
     return Month_Number;

   function Day (Date      : in Time;
                 Time_Zone : in Time_Zones.Time_Offset := 0)
     return Day_Number;

   function Hour (Date      : in Time;
                  Time_Zone : in Time_Zones.Time_Offset := 0)
     return Hour_Number;

   function Minute (Date      : in Time;
                    Time_Zone : in Time_Zones.Time_Offset := 0)
     return Minute_Number;

   function Second (Date : in Time) return Second_Number;

   function Sub_Second (Date : in Time) return Second_Duration;

   function Seconds_Of (Hour       : in Hour_Number;
                        Minute     : in Minute_Number;
                        Second     : in Second_Number   := 0;
                        Sub_Second : in Second_Duration := 0.0)
     return Day_Duration;

   procedure Split (Seconds    : in     Day_Duration;
                    Hour       :    out Hour_Number;
                    Minute     :    out Minute_Number;
                    Second     :    out Second_Number;
                    Sub_Second :    out Second_Duration);

   function Time_Of (Year        : in Year_Number;
                     Month       : in Month_Number;
                     Day         : in Day_Number;
                     Hour        : in Hour_Number;
                     Minute      : in Minute_Number;
                     Second      : in Second_Number;
                     Sub_Second  : in Second_Duration        := 0.0;
                     Leap_Second : in Boolean                := False;
                     Time_Zone   : in Time_Zones.Time_Offset := 0)
     return Time;

   function Time_Of (Year        : in Year_Number;
                     Month       : in Month_Number;
                     Day         : in Day_Number;
                     Seconds     : in Day_Duration           := 0.0;
                     Leap_Second : in Boolean                := False;
                     Time_Zone   : in Time_Zones.Time_Offset := 0)
     return Time;

   procedure Split (Date       : in     Time;
                    Year       :    out Year_Number;
                    Month      :    out Month_Number;
                    Day        :    out Day_Number;
                    Hour       :    out Hour_Number;
                    Minute     :    out Minute_Number;
                    Second     :    out Second_Number;
                    Sub_Second :    out Second_Duration;
                    Time_Zone  : in     Time_Zones.Time_Offset := 0);

   procedure Split (Date        : in     Time;
                    Year        :    out Year_Number;
                    Month       :    out Month_Number;
                    Day         :    out Day_Number;
                    Hour        :    out Hour_Number;
                    Minute      :    out Minute_Number;
                    Second      :    out Second_Number;
                    Sub_Second  :    out Second_Duration;
                    Leap_Second :    out Boolean;
                    Time_Zone   : in     Time_Zones.Time_Offset := 0);

   procedure Split (Date        : in     Time;
                    Year        :    out Year_Number;
                    Month       :    out Month_Number;
                    Day         :    out Day_Number;
                    Seconds     :    out Day_Duration;
                    Leap_Second :    out Boolean;
                    Time_Zone   : in     Time_Zones.Time_Offset := 0);

   --   Simple image and value:

   function Image (Date                  : in Time;
                   Include_Time_Fraction : in Boolean := False;
                   Time_Zone             : in Time_Zones.Time_Offset := 0)
     return String;

   function Value (Date      : in String;
                   Time_Zone : in Time_Zones.Time_Offset := 0)
     return Time;

   function Image (Elapsed_Time          : in Duration;
                   Include_Time_Fraction : in Boolean := False)
     return String;

   function Value (Elapsed_Time : in String) return Duration;

end Ada.Calendar.Formatting;

See also

[edit | edit source]

Wikibook

[edit | edit source]

External examples

[edit source]

Ada Reference Manual

[edit | edit source]

Ada 2005

[edit | edit source]

Ada 2012

[edit | edit source]

Open-Source Implementations

[edit | edit source]

FSF GNAT

drake


Ada Programming/Libraries/Ada.Calendar.Time Zones

[edit | edit source]

Ada. Time-tested, safe and secure.
Ada. Time-tested, safe and secure.

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.

Specification

[edit | edit source]
--                     Standard Ada library specification
--   Copyright (c) 2003-2018 Maxim Reznik <reznikmm@gmail.com>
--   Copyright (c) 2004-2016 AXE Consultants
--   Copyright (c) 2004, 2005, 2006 Ada-Europe
--   Copyright (c) 2000 The MITRE Corporation, Inc.
--   Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc.
--   SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual
-- -------------------------------------------------------------------------

package Ada.Calendar.Time_Zones is

   --   Time zone manipulation:

   type Time_Offset is range -28 * 60 .. 28 * 60;

   Unknown_Zone_Error : exception;

   function UTC_Time_Offset (Date : in Time := Clock) return Time_Offset;

end Ada.Calendar.Time_Zones;

See also

[edit | edit source]

Wikibook

[edit | edit source]

External examples

[edit source]

Ada Reference Manual

[edit | edit source]

Ada 2005

[edit | edit source]

Ada 2012

[edit | edit source]

Open-Source Implementations

[edit | edit source]

FSF GNAT

drake


Ada Programming/Libraries/Ada.Characters

[edit | edit source]

Ada. Time-tested, safe and secure.
Ada. Time-tested, safe and secure.

This language feature is available from Ada 95 on.

Ada.Characters is a unit of the Predefined Language Environment since Ada 95.

Specification

[edit | edit source]
--                     Standard Ada library specification
--   Copyright (c) 2003-2018 Maxim Reznik <reznikmm@gmail.com>
--   Copyright (c) 2004-2016 AXE Consultants
--   Copyright (c) 2004, 2005, 2006 Ada-Europe
--   Copyright (c) 2000 The MITRE Corporation, Inc.
--   Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc.
--   SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual
-- -------------------------------------------------------------------------

package Ada.Characters is
   pragma Pure (Characters);
end Ada.Characters;


See also

[edit | edit source]

Wikibook

[edit | edit source]

External examples

[edit source]

Ada Reference Manual

[edit | edit source]

Ada 95

[edit | edit source]

Ada 2005

[edit | edit source]

Ada 2012

[edit | edit source]

Open-Source Implementations

[edit | edit source]

FSF GNAT


drake


Ada Programming/Libraries/Ada.Characters.Conversions

[edit | edit source]

Ada. Time-tested, safe and secure.
Ada. Time-tested, safe and secure.

This language feature is only available from Ada 2005 on.

Ada.Characters.Conversions is a unit of the Predefined Language Environment since Ada 2005.

Specification

[edit | edit source]
--                     Standard Ada library specification
--   Copyright (c) 2003-2018 Maxim Reznik <reznikmm@gmail.com>
--   Copyright (c) 2004-2016 AXE Consultants
--   Copyright (c) 2004, 2005, 2006 Ada-Europe
--   Copyright (c) 2000 The MITRE Corporation, Inc.
--   Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc.
--   SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual
-- -------------------------------------------------------------------------

package Ada.Characters.Conversions is

   pragma Pure (Conversions);

   function Is_Character (Item : in Wide_Character) return Boolean;

   function Is_String (Item : in Wide_String) return Boolean;

   function Is_Character (Item : in Wide_Wide_Character) return Boolean;

   function Is_String (Item : in Wide_Wide_String) return Boolean;

   function Is_Wide_Character (Item : in Wide_Wide_Character) return Boolean;

   function Is_Wide_String (Item : in Wide_Wide_String) return Boolean;

   function To_Wide_Character (Item : in Character) return Wide_Character;

   function To_Wide_String (Item : in String) return Wide_String;

   function To_Wide_Wide_Character (Item : in Character)
                                   return Wide_Wide_Character;

   function To_Wide_Wide_String (Item : in String) return Wide_Wide_String;

   function To_Wide_Wide_Character (Item : in Wide_Character)
                                   return Wide_Wide_Character;

   function To_Wide_Wide_String (Item : in Wide_String)
                                return Wide_Wide_String;

   function To_Character (Item       : in Wide_Character;
                          Substitute : in Character := ' ')
                         return Character;

   function To_String (Item       : in Wide_String;
                       Substitute : in Character := ' ')
                      return String;

   function To_Character (Item       : in Wide_Wide_Character;
                          Substitute : in Character := ' ')
                         return Character;

   function To_String (Item       : in Wide_Wide_String;
                       Substitute : in Character := ' ')
                      return String;

   function To_Wide_Character (Item       : in Wide_Wide_Character;
                               Substitute : in Wide_Character := ' ')
                              return Wide_Character;

   function To_Wide_String (Item       : in Wide_Wide_String;
                            Substitute : in Wide_Character := ' ')
                           return Wide_String;

end Ada.Characters.Conversions;

See also

[edit | edit source]

Wikibook

[edit | edit source]

External examples

[edit source]

Ada Reference Manual

[edit | edit source]

Ada 2005

[edit | edit source]

Ada 2012

[edit | edit source]


Ada Programming/Libraries/Ada.Characters.Handling

[edit | edit source]

Ada. Time-tested, safe and secure.
Ada. Time-tested, safe and secure.

This language feature is available from Ada 95 on.

Ada.Characters.Handling is a unit of the Predefined Language Environment since Ada 95.

Specification

[edit | edit source]
--                     Standard Ada library specification
--   Copyright (c) 2003-2018 Maxim Reznik <reznikmm@gmail.com>
--   Copyright (c) 2004-2016 AXE Consultants
--   Copyright (c) 2004, 2005, 2006 Ada-Europe
--   Copyright (c) 2000 The MITRE Corporation, Inc.
--   Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc.
--   SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual
-- -------------------------------------------------------------------------

with Ada.Characters.Conversions;

package Ada.Characters.Handling is
   pragma Pure (Handling);

   --   Character classification functions

   function Is_Control           (Item : in Character) return Boolean;
   function Is_Graphic           (Item : in Character) return Boolean;
   function Is_Letter            (Item : in Character) return Boolean;
   function Is_Lower             (Item : in Character) return Boolean;
   function Is_Upper             (Item : in Character) return Boolean;
   function Is_Basic             (Item : in Character) return Boolean;
   function Is_Digit             (Item : in Character) return Boolean;
   function Is_Decimal_Digit     (Item : in Character) return Boolean
     renames Is_Digit;
   function Is_Hexadecimal_Digit (Item : in Character) return Boolean;
   function Is_Alphanumeric      (Item : in Character) return Boolean;
   function Is_Special           (Item : in Character) return Boolean;

   --   Conversion functions for Character and String

   function To_Lower (Item : in Character) return Character;
   function To_Upper (Item : in Character) return Character;
   function To_Basic (Item : in Character) return Character;

   function To_Lower (Item : in String) return String;
   function To_Upper (Item : in String) return String;
   function To_Basic (Item : in String) return String;

   --   Classifications of and conversions between Character and ISO 646

   subtype ISO_646 is
     Character range Character'Val(0) .. Character'Val(127);

   function Is_ISO_646 (Item : in Character) return Boolean;
   function Is_ISO_646 (Item : in String)    return Boolean;

   function To_ISO_646 (Item       : in Character;
                        Substitute : in ISO_646 := ' ')
                       return ISO_646;

   function To_ISO_646 (Item       : in String;
                        Substitute : in ISO_646 := ' ')
                       return String;

   --   The functions Is_Character, Is_String, To_Character, To_String,
   --   To_Wide_Character  and To_Wide_String are obsolescent; see J.14.

   function Is_Character (Item : in Wide_Character) return Boolean
     renames Conversions.Is_Character;
   function Is_String    (Item : in Wide_String)    return Boolean
     renames Conversions.Is_String;

   function To_Character (Item       : in Wide_Character;
                          Substitute : in Character := ' ')
                         return Character
     renames Conversions.To_Character;

   function To_String    (Item       : in Wide_String;
                          Substitute : in Character := ' ')
                         return String
     renames Conversions.To_String;

   function To_Wide_Character (Item : in Character) return Wide_Character
     renames Conversions.To_Wide_Character;

   function To_Wide_String    (Item : in String)    return Wide_String
     renames Conversions.To_Wide_String;

end Ada.Characters.Handling;

See also

[edit | edit source]

Wikibook

[edit | edit source]

External examples

[edit source]

Ada Reference Manual

[edit | edit source]

Ada 95

[edit | edit source]

Ada 2005

[edit | edit source]

Ada 2012

[edit | edit source]


Ada Programming/Libraries/Ada.Characters.Latin 1

[edit | edit source]

Ada. Time-tested, safe and secure.
Ada. Time-tested, safe and secure.

This language feature is available from Ada 95 on.

Ada.Characters.Latin_1 is a unit of the Predefined Language Environment since Ada 95.

Specification

[edit | edit source]
--                     Standard Ada library specification
--   Copyright (c) 2003-2018 Maxim Reznik <reznikmm@gmail.com>
--   Copyright (c) 2004-2016 AXE Consultants
--   Copyright (c) 2004, 2005, 2006 Ada-Europe
--   Copyright (c) 2000 The MITRE Corporation, Inc.
--   Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc.
--   SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual
-- -------------------------------------------------------------------------

package Ada.Characters.Latin_1 is

   pragma Pure (Latin_1);

   --  Control characters:

   NUL                  : constant Character := Character'Val(0);
   SOH                  : constant Character := Character'Val(1);
   STX                  : constant Character := Character'Val(2);
   ETX                  : constant Character := Character'Val(3);
   EOT                  : constant Character := Character'Val(4);
   ENQ                  : constant Character := Character'Val(5);
   ACK                  : constant Character := Character'Val(6);
   BEL                  : constant Character := Character'Val(7);
   BS                   : constant Character := Character'Val(8);
   HT                   : constant Character := Character'Val(9);
   LF                   : constant Character := Character'Val(10);
   VT                   : constant Character := Character'Val(11);
   FF                   : constant Character := Character'Val(12);
   CR                   : constant Character := Character'Val(13);
   SO                   : constant Character := Character'Val(14);
   SI                   : constant Character := Character'Val(15);

   DLE                  : constant Character := Character'Val(16);
   DC1                  : constant Character := Character'Val(17);
   DC2                  : constant Character := Character'Val(18);
   DC3                  : constant Character := Character'Val(19);
   DC4                  : constant Character := Character'Val(20);
   NAK                  : constant Character := Character'Val(21);
   SYN                  : constant Character := Character'Val(22);
   ETB                  : constant Character := Character'Val(23);
   CAN                  : constant Character := Character'Val(24);
   EM                   : constant Character := Character'Val(25);
   SUB                  : constant Character := Character'Val(26);
   ESC                  : constant Character := Character'Val(27);
   FS                   : constant Character := Character'Val(28);
   GS                   : constant Character := Character'Val(29);
   RS                   : constant Character := Character'Val(30);
   US                   : constant Character := Character'Val(31);

   --  ISO 646 graphic characters:

   Space
     : constant Character := ' ';  --  Character'Val(32)
   Exclamation
     : constant Character := '|';  --  Character'Val(33)
   Quotation
     : constant Character := '"';  --  Character'Val(34)
   Number_Sign
     : constant Character := '#';  --  Character'Val(35)
   Dollar_Sign
     : constant Character := '$';  --  Character'Val(36)
   Percent_Sign
     : constant Character := '%';  --  Character'Val(37)
   Ampersand
     : constant Character := '&';  --  Character'Val(38)
   Apostrophe
     : constant Character := ''';  --  Character'Val(39)
   Left_Parenthesis
     : constant Character := '(';  --  Character'Val(40)
   Right_Parenthesis
     : constant Character := ')';  --  Character'Val(41)
   Asterisk
     : constant Character := '*';  --  Character'Val(42)
   Plus_Sign
     : constant Character := '+';  --  Character'Val(43)
   Comma
     : constant Character := ',';  --  Character'Val(44)
   Hyphen
     : constant Character := '-';  --  Character'Val(45)
   Minus_Sign           : Character renames Hyphen;
   Full_Stop
     : constant Character := '.';  --  Character'Val(46)
   Solidus
     : constant Character := '/';  --  Character'Val(47)

   --  Decimal digits '0' though '9' are at positions 48 through 57

   Colon
     : constant Character := ':';  --  Character'Val(58)
   Semicolon
     : constant Character := ';';  --  Character'Val(59)
   Less_Than_Sign
     : constant Character := '<';  --  Character'Val(60)
   Equals_Sign
     : constant Character := '=';  --  Character'Val(61)
   Greater_Than_Sign
     : constant Character := '>';  --  Character'Val(62)
   Question
     : constant Character := '?';  --  Character'Val(63)
   Commercial_At
     : constant Character := '@';  --  Character'Val(64)

   --  Letters 'A' through 'Z' are at positions 65 through 90

   Left_Square_Bracket
     : constant Character := '[';  --  Character'Val(91)
   Reverse_Solidus
     : constant Character := '\';  --  Character'Val(92)
   Right_Square_Bracket
     : constant Character := ']';  --  Character'Val(93)
   Circumflex
     : constant Character := '^';  --  Character'Val(94)
   Low_Line
     : constant Character := '_';  --  Character'Val(95)

   Grave
     : constant Character := '`';  --  Character'Val(96)
   LC_A
     : constant Character := 'a';  --  Character'Val(97)
   LC_B
     : constant Character := 'b';  --  Character'Val(98)
   LC_C
     : constant Character := 'c';  --  Character'Val(99)
   LC_D
     : constant Character := 'd';  --  Character'Val(100)
   LC_E
     : constant Character := 'e';  --  Character'Val(101)
   LC_F
     : constant Character := 'f';  --  Character'Val(102)
   LC_G
     : constant Character := 'g';  --  Character'Val(103)
   LC_H
     : constant Character := 'h';  --  Character'Val(104)
   LC_I
     : constant Character := 'i';  --  Character'Val(105)
   LC_J
     : constant Character := 'j';  --  Character'Val(106)
   LC_K
     : constant Character := 'k';  --  Character'Val(107)
   LC_L
     : constant Character := 'l';  --  Character'Val(108)
   LC_M
     : constant Character := 'm';  --  Character'Val(109)
   LC_N
     : constant Character := 'n';  --  Character'Val(110)
   LC_O
     : constant Character := 'o';  --  Character'Val(111)

   LC_P
     : constant Character := 'p';  --  Character'Val(112)
   LC_Q
     : constant Character := 'q';  --  Character'Val(113)
   LC_R
     : constant Character := 'r';  --  Character'Val(114)
   LC_S
     : constant Character := 's';  --  Character'Val(115)
   LC_T
     : constant Character := 't';  --  Character'Val(116)
   LC_U
     : constant Character := 'u';  --  Character'Val(117)
   LC_V
     : constant Character := 'v';  --  Character'Val(118)
   LC_W
     : constant Character := 'w';  --  Character'Val(119)
   LC_X
     : constant Character := 'x';  --  Character'Val(120)
   LC_Y
     : constant Character := 'y';  --  Character'Val(121)
   LC_Z
     : constant Character := 'z';  --  Character'Val(122)
   Left_Curly_Bracket
     : constant Character := '{';  --  Character'Val(123)
   Vertical_Line
     : constant Character := '|';  --  Character'Val(124)
   Right_Curly_Bracket
     : constant Character := '}';  --  Character'Val(125)
   Tilde
     : constant Character := '~';  --  Character'Val(126)
   DEL                  : constant Character := Character'Val(127);

   --  ISO 6429 control characters:

   IS4                  : Character renames FS;
   IS3                  : Character renames GS;
   IS2                  : Character renames RS;
   IS1                  : Character renames US;

   Reserved_128         : constant Character := Character'Val(128);
   Reserved_129         : constant Character := Character'Val(129);
   BPH                  : constant Character := Character'Val(130);
   NBH                  : constant Character := Character'Val(131);
   Reserved_132         : constant Character := Character'Val(132);
   NEL                  : constant Character := Character'Val(133);
   SSA                  : constant Character := Character'Val(134);
   ESA                  : constant Character := Character'Val(135);
   HTS                  : constant Character := Character'Val(136);
   HTJ                  : constant Character := Character'Val(137);
   VTS                  : constant Character := Character'Val(138);
   PLD                  : constant Character := Character'Val(139);
   PLU                  : constant Character := Character'Val(140);
   RI                   : constant Character := Character'Val(141);
   SS2                  : constant Character := Character'Val(142);
   SS3                  : constant Character := Character'Val(143);

   DCS                  : constant Character := Character'Val(144);
   PU1                  : constant Character := Character'Val(145);
   PU2                  : constant Character := Character'Val(146);
   STS                  : constant Character := Character'Val(147);
   CCH                  : constant Character := Character'Val(148);
   MW                   : constant Character := Character'Val(149);
   SPA                  : constant Character := Character'Val(150);
   EPA                  : constant Character := Character'Val(151);

   SOS                  : constant Character := Character'Val(152);
   Reserved_153         : constant Character := Character'Val(153);
   SCI                  : constant Character := Character'Val(154);
   CSI                  : constant Character := Character'Val(155);
   ST                   : constant Character := Character'Val(156);
   OSC                  : constant Character := Character'Val(157);
   PM                   : constant Character := Character'Val(158);
   APC                  : constant Character := Character'Val(159);

   --  Other graphic characters:

   --  Character positions 160 (16#A0#) .. 175 (16#AF#):
   No_Break_Space
     : constant Character := ' ';  -- Character'Val(160)
   NBSP                        : Character renames No_Break_Space;
   Inverted_Exclamation
     : constant Character := '¡';  -- Character'Val(161)
   Cent_Sign
     : constant Character := '¢';  -- Character'Val(162)
   Pound_Sign
     : constant Character := '£';  -- Character'Val(163)
   Currency_Sign
     : constant Character := '¤';  -- Character'Val(164)
   Yen_Sign
     : constant Character := '¥';  -- Character'Val(165)
   Broken_Bar
     : constant Character := '¦';  -- Character'Val(166)
   Section_Sign
     : constant Character := '§';  -- Character'Val(167)
   Diaeresis
     : constant Character := '¨';  -- Character'Val(168)
   Copyright_Sign
     : constant Character := '©';  -- Character'Val(169)
   Feminine_Ordinal_Indicator
     : constant Character := 'ª';  -- Character'Val(170)
   Left_Angle_Quotation
     : constant Character := '«';  -- Character'Val(171)
   Not_Sign
     : constant Character := '¬';  -- Character'Val(172)
   Soft_Hyphen
     : constant Character := '­';  -- Character'Val(173)
   Registered_Trade_Mark_Sign
     : constant Character := '®';  -- Character'Val(174)
   Macron
     : constant Character := '¯';  -- Character'Val(175)

   --  Character positions 176 (16#B0#) .. 191 (16#BF#):
   Degree_Sign
     : constant Character := '°';  -- Character'Val(176)
   Ring_Above                  : Character renames Degree_Sign;
   Plus_Minus_Sign
     : constant Character := '±';  -- Character'Val(177)
   Superscript_Two
     : constant Character := '²';  -- Character'Val(178)
   Superscript_Three
     : constant Character := '³';  -- Character'Val(179)
   Acute
     : constant Character := '´';  -- Character'Val(180)
   Micro_Sign
     : constant Character := 'µ';  -- Character'Val(181)
   Pilcrow_Sign
     : constant Character := '';  -- Character'Val(182)
   Paragraph_Sign              : Character renames Pilcrow_Sign;
   Middle_Dot
     : constant Character := '·';  -- Character'Val(183)
   Cedilla
     : constant Character := '¸';  -- Character'Val(184)
   Superscript_One
     : constant Character := '¹';  -- Character'Val(185)
   Masculine_Ordinal_Indicator
     : constant Character := 'º';  -- Character'Val(186)
   Right_Angle_Quotation
     : constant Character := '»';  -- Character'Val(187)
   Fraction_One_Quarter
     : constant Character := '¼';  -- Character'Val(188)
   Fraction_One_Half
     : constant Character := '½';  -- Character'Val(189)
   Fraction_Three_Quarters
     : constant Character := '¾';  -- Character'Val(190)
   Inverted_Question
     : constant Character := '¿';  -- Character'Val(191)

   --  Character positions 192 (16#C0#) .. 207 (16#CF#):
   UC_A_Grave
     : constant Character := 'À';  -- Character'Val(192)
   UC_A_Acute
     : constant Character := 'Á';  -- Character'Val(193)
   UC_A_Circumflex
     : constant Character := 'Â';  -- Character'Val(194)
   UC_A_Tilde
     : constant Character := 'Ã';  -- Character'Val(195)
   UC_A_Diaeresis
     : constant Character := 'Ä';  -- Character'Val(196)
   UC_A_Ring
     : constant Character := 'Å';  -- Character'Val(197)
   UC_AE_Diphthong
     : constant Character := 'Æ';  -- Character'Val(198)
   UC_C_Cedilla
     : constant Character := 'Ç';  -- Character'Val(199)
   UC_E_Grave
     : constant Character := 'È';  -- Character'Val(200)
   UC_E_Acute
     : constant Character := 'É';  -- Character'Val(201)
   UC_E_Circumflex
     : constant Character := 'Ê';  -- Character'Val(202)
   UC_E_Diaeresis
     : constant Character := 'Ë';  -- Character'Val(203)
   UC_I_Grave
     : constant Character := 'Ì';  -- Character'Val(204)
   UC_I_Acute
     : constant Character := 'Í';  -- Character'Val(205)
   UC_I_Circumflex
     : constant Character := 'Î';  -- Character'Val(206)
   UC_I_Diaeresis
     : constant Character := 'Ï';  -- Character'Val(207)

   --  Character positions 208 (16#D0#) .. 223 (16#DF#):
   UC_Icelandic_Eth
     : constant Character := 'Ð';  -- Character'Val(208)
   UC_N_Tilde
     : constant Character := 'Ñ';  -- Character'Val(209)
   UC_O_Grave
     : constant Character := 'Ò';  -- Character'Val(210)
   UC_O_Acute
     : constant Character := 'Ó';  -- Character'Val(211)
   UC_O_Circumflex
     : constant Character := 'Ô';  -- Character'Val(212)
   UC_O_Tilde
     : constant Character := 'Õ';  -- Character'Val(213)
   UC_O_Diaeresis
     : constant Character := 'Ö';  -- Character'Val(214)
   Multiplication_Sign
     : constant Character := '×';  -- Character'Val(215)
   UC_O_Oblique_Stroke
     : constant Character := 'Ø';  -- Character'Val(216)
   UC_U_Grave
     : constant Character := 'Ù';  -- Character'Val(217)
   UC_U_Acute
     : constant Character := 'Ú';  -- Character'Val(218)
   UC_U_Circumflex
     : constant Character := 'Û';  -- Character'Val(219)
   UC_U_Diaeresis
     : constant Character := 'Ü';  -- Character'Val(220)
   UC_Y_Acute
     : constant Character := 'Ý';  -- Character'Val(221)
   UC_Icelandic_Thorn
     : constant Character := 'Þ';  -- Character'Val(222)
   LC_German_Sharp_S
     : constant Character := 'ß';  -- Character'Val(223)

   --  Character positions 224 (16#E0#) .. 239 (16#EF#):
   LC_A_Grave
     : constant Character := 'à';  -- Character'Val(224)
   LC_A_Acute
     : constant Character := 'á';  -- Character'Val(225)
   LC_A_Circumflex
     : constant Character := 'â';  -- Character'Val(226)
   LC_A_Tilde
     : constant Character := 'ã';  -- Character'Val(227)
   LC_A_Diaeresis
     : constant Character := 'ä';  -- Character'Val(228)
   LC_A_Ring
     : constant Character := 'å';  -- Character'Val(229)
   LC_AE_Diphthong
     : constant Character := 'æ';  -- Character'Val(230)
   LC_C_Cedilla
     : constant Character := 'ç';  -- Character'Val(231)
   LC_E_Grave
     : constant Character := 'è';  -- Character'Val(232)
   LC_E_Acute
     : constant Character := 'é';  -- Character'Val(233)
   LC_E_Circumflex
     : constant Character := 'ê';  -- Character'Val(234)
   LC_E_Diaeresis
     : constant Character := 'ë';  -- Character'Val(235)
   LC_I_Grave
     : constant Character := 'ì';  -- Character'Val(236)
   LC_I_Acute
     : constant Character := 'í';  -- Character'Val(237)
   LC_I_Circumflex
     : constant Character := 'î';  -- Character'Val(238)
   LC_I_Diaeresis
     : constant Character := 'ï';  -- Character'Val(239)

   --  Character positions 240 (16#F0#) .. 255 (16#FF#):
   LC_Icelandic_Eth
     : constant Character := 'ð';  -- Character'Val(240)
   LC_N_Tilde
     : constant Character := 'ñ';  -- Character'Val(241)
   LC_O_Grave
     : constant Character := 'ò';  -- Character'Val(242)
   LC_O_Acute
     : constant Character := 'ó';  -- Character'Val(243)
   LC_O_Circumflex
     : constant Character := 'ô';  -- Character'Val(244)
   LC_O_Tilde
     : constant Character := 'õ';  -- Character'Val(245)
   LC_O_Diaeresis
     : constant Character := 'ö';  -- Character'Val(246)
   Division_Sign
     : constant Character := '÷';  -- Character'Val(247)
   LC_O_Oblique_Stroke
     : constant Character := 'ø';  -- Character'Val(248)
   LC_U_Grave
     : constant Character := 'ù';  -- Character'Val(249)
   LC_U_Acute
     : constant Character := 'ú';  -- Character'Val(250)
   LC_U_Circumflex
     : constant Character := 'û';  -- Character'Val(251)
   LC_U_Diaeresis
     : constant Character := 'ü';  -- Character'Val(252)
   LC_Y_Acute
     : constant Character := 'ý';  -- Character'Val(253)
   LC_Icelandic_Thorn
     : constant Character := 'þ';  -- Character'Val(254)
   LC_Y_Diaeresis
     : constant Character := 'ÿ';  -- Character'Val(255)
end Ada.Characters.Latin_1;

See also

[edit | edit source]

Wikibook

[edit | edit source]

External examples

[edit source]

Ada Reference Manual

[edit | edit source]

Ada 95

[edit | edit source]

Ada 2005

[edit | edit source]

Ada 2012

[edit | edit source]

Open-Source Implementations

[edit | edit source]

FSF GNAT


drake


Ada Programming/Libraries/Ada.Command Line

[edit | edit source]

Ada. Time-tested, safe and secure.
Ada. Time-tested, safe and secure.

This language feature is available from Ada 95 on.


Ada.Command_Line is a unit of the Predefined Language Environment since Ada 95.

Introduction

[edit | edit source]

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

[edit | edit source]

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:

with Ada.Text_IO;
with Ada.Command_Line;
 
procedure Args is
   package IO renames Ada.Text_IO;
   package CLI renames Ada.Command_Line;
begin
   IO.Put_Line (Item => "Argument Count:" & CLI.Argument_Count'Img);
end Args;

When executing the above program with no arguments given, you should get the following output:

 Argument Count: 0

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

[edit | edit source]

The specification for Argument_Count looks like this:

function Argument_Count return Natural;

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:

 $ ./args --option=value
 Argument Count: 1
 
 $ ./args --option=value --foo=bar
 Argument Count: 2
 
 $ ./args --name=Thomas Løcke
 Argument Count: 2
 
 $ ./args --option="Thomas Løcke"
 Argument Count: 1
 
 $ ./args /path/to/file with spaces in name
 Argument Count: 5
 
 $ ./args /path/to/file with spaces in name
 Argument Count: 1

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

[edit | edit source]

The specification for Argument looks like this:

function Argument (Number : Positive) return String;

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:

for i in 1 .. CLI.Argument_Count loop
   IO.Put_Line (Item => CLI.Argument (Number => i));
end loop;

If we run Args with the same arguments as given in the Argument_Count example, we get these results:

 $ ./args --option=value
 Argument Count: 1
 1: --option=value
 
 $ ./args --option=value --foo=bar
 Argument Count: 2
 1: --option=value
 2: --foo=bar
 
 $ ./args --name=Thomas Løcke
 Argument Count: 2
 1: --name=Thomas
 2: Løcke
 
 $ ./args --option="Thomas Løcke"
 Argument Count: 1
 1: --option=Thomas Løcke
 
 $ ./args /path/to/file with spaces in name
 Argument Count: 5
 1: /path/to/file
 2: with
 3: spaces
 4: in
 5: name
 
 $ ./args /path/to/file with spaces in name
 Argument Count: 1
 1: /path/to/file with spaces in name

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.

with Ada.Text_IO;
with Ada.Command_Line;
 
procedure Args is
   package IO renames Ada.Text_IO;
   package CLI renames Ada.Command_Line;
begin
   IO.Put_Line (Item => "Argument Count:" & CLI.Argument_Count'Img);
   for i in 1 .. CLI.Argument_Count loop
      IO.Put (Item => i'Img & ": ");
      IO.Put_Line (Item => CLI.Argument (Number => i));
   end loop;
end Args;

Ada.Command_Line.Command_Name

[edit | edit source]

The specification for Command_Name looks like this:

function Command_Name return String;

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:

IO.Put_Line (CLI.Command_Name);

If we execute the program, without any arguments, from within GNAT Studio (using Shift+F2), the result will be this:

 Argument Count: 0
 /home/thomas/wiki_examples/Args/args

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:

 $ args
 Argument Count: 0
 args

If I use the common ./ syntax to execute the program, I get this:

 $ ./args
 Argument Count: 0
 ./args

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

[edit | edit source]

The specification for Set_Exit_Status looks like this:

procedure Set_Exit_Status (Code : Exit_Status);

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:

More_Than_One_Arg : constant CLI.Exit_Status := 3;

And this to the body of the program:

if CLI.Argument_Count = 0 then
   CLI.Set_Exit_Status (Code => CLI.Failure);
elsif CLI.Argument_Count = 1 then
   CLI.Set_Exit_Status (Code => CLI.Success);
else
   CLI.Set_Exit_Status (Code => More_Than_One_Arg);
end if; 

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:

 $ ./args
 Argument Count: 0
 $ echo $?
 1
 
 $ ./args one
 Argument Count: 1
 $ echo $?
 0
 
 $ ./args one two
 Argument Count: 2
 $ echo $?
 3

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.

with Ada.Text_IO;
with Ada.Command_Line;

procedure Args is
   package IO renames Ada.Text_IO;
   package CLI renames Ada.Command_Line;
   More_Than_One_Arg : constant CLI.Exit_Status := 3;
begin
   IO.Put_Line (Item => "Argument Count:" & CLI.Argument_Count'Img);
   if CLI.Argument_Count = 0 then
      CLI.Set_Exit_Status (Code => CLI.Failure);
   elsif CLI.Argument_Count = 1 then
      CLI.Set_Exit_Status (Code => CLI.Success);
   else
      CLI.Set_Exit_Status (Code => More_Than_One_Arg);
   end if; 
end Args;

Specification

[edit | edit source]
--                     Standard Ada library specification
--   Copyright (c) 2003-2018 Maxim Reznik <reznikmm@gmail.com>
--   Copyright (c) 2004-2016 AXE Consultants
--   Copyright (c) 2004, 2005, 2006 Ada-Europe
--   Copyright (c) 2000 The MITRE Corporation, Inc.
--   Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc.
--   SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual
-- -------------------------------------------------------------------------

package Ada.Command_Line is
   pragma Preelaborate (Command_Line);

   function Argument_Count return Natural;

   function Argument (Number : in Positive) return String;

   function Command_Name return String;

   type Exit_Status is range implementation_defined .. implementation_defined;

   Success : constant Exit_Status;
   Failure : constant Exit_Status;

   procedure Set_Exit_Status (Code : in Exit_Status);

private

   pragma Import (Ada, Success);
   pragma Import (Ada, Failure);

end Ada.Command_Line;

See also

[edit | edit source]

Wikibook

[edit | edit source]

External examples

[edit source]

Ada Reference Manual

[edit | edit source]

Ada 95

[edit | edit source]

Ada 2005

[edit | edit source]

Ada 2012

[edit | edit source]

Open-Source Implementations

[edit | edit source]

FSF GNAT

drake


Ada Programming/Libraries/Ada.Complex Text IO

[edit | edit source]

Ada. Time-tested, safe and secure.
Ada. Time-tested, safe and secure.

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.

Specification

[edit | edit source]
--                     Standard Ada library specification
--   Copyright (c) 2003-2018 Maxim Reznik <reznikmm@gmail.com>
--   Copyright (c) 2004-2016 AXE Consultants
--   Copyright (c) 2004, 2005, 2006 Ada-Europe
--   Copyright (c) 2000 The MITRE Corporation, Inc.
--   Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc.
--   SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual
-- -------------------------------------------------------------------------

with Ada.Numerics.Complex_Types;
with Ada.Text_IO.Complex_IO;

package Ada.Complex_Text_IO is
  new Ada.Text_IO.Complex_IO (Ada.Numerics.Complex_Types);

See also

[edit | edit source]

Wikibook

[edit | edit source]

External examples

[edit source]

Ada Reference Manual

[edit | edit source]

Ada 2005

[edit | edit source]

Ada 2012

[edit | edit source]

Open-Source Implementations

[edit | edit source]

FSF GNAT


drake


Ada Programming/Libraries/Ada.Containers

[edit | edit source]

Ada. Time-tested, safe and secure.
Ada. Time-tested, safe and secure.

This language feature is only available from Ada 2005 on.

Ada.Containers is a unit of the Predefined Language Environment since Ada 2005.

Specification

[edit | edit source]

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

package Ada.Containers is

   pragma Pure (Containers);

   type Hash_Type is mod implementation_defined;

   type Count_Type is range 0 .. implementation_defined;

end Ada.Containers;

See also

[edit | edit source]

Child units

[edit | edit source]

Wikibook

[edit | edit source]

External examples

[edit source]

Ada Reference Manual

[edit | edit source]

Ada 2005

[edit | edit source]

Ada 2012

[edit | edit source]
[edit | edit source]


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

[edit | edit source]

Ada. Time-tested, safe and secure.
Ada. Time-tested, safe and secure.

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.

Specification

[edit | edit source]
--                     Standard Ada library specification
--   Copyright (c) 2004-2016 AXE Consultants
--   Copyright (c) 2004, 2005, 2006 Ada-Europe
--   Copyright (c) 2000 The MITRE Corporation, Inc.
--   Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc.
--   SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual
-- -------------------------------------------------------------------------


with Ada.Iterator_Interfaces;
generic
   type Element_Type is private;
   with function "=" (Left, Right : Element_Type)
      return Boolean is <>;
package Ada.Containers.Bounded_Doubly_Linked_Lists is
   pragma Pure(Bounded_Doubly_Linked_Lists);
   pragma Remote_Types(Bounded_Doubly_Linked_Lists);

  type List (Capacity : Count_Type) is tagged private
      with Constant_Indexing => Constant_Reference,
           Variable_Indexing => Reference,
           Default_Iterator  => Iterate,
           Iterator_Element  => Element_Type;
   pragma Preelaborable_Initialization(List);

   type Cursor is private;
   pragma Preelaborable_Initialization(Cursor);

   Empty_List : constant List;

   No_Element : constant Cursor;

   function Has_Element (Position : Cursor) return Boolean;

   package List_Iterator_Interfaces is new
       Ada.Iterator_Interfaces (Cursor, Has_Element);

   function "=" (Left, Right : List) return Boolean;

   function Length (Container : List) return Count_Type;

   function Is_Empty (Container : List) return Boolean;

   procedure Clear (Container : in out List);

   function Element (Position : Cursor)
      return Element_Type;

   procedure Replace_Element (Container : in out List;
                              Position  : in     Cursor;
                              New_Item  : in     Element_Type);

   procedure Query_Element
     (Position : in Cursor;
      Process  : not null access procedure (Element : in Element_Type));

   procedure Update_Element
     (Container : in out List;
      Position  : in     Cursor;
      Process   : not null access procedure
                      (Element : in out Element_Type));

   type Constant_Reference_Type
         (Element : not null access constant Element_Type) is private
      with Implicit_Dereference => Element;

   type Reference_Type (Element : not null access Element_Type) is private
      with Implicit_Dereference => Element;

   function Constant_Reference (Container : aliased in List;
                                Position  : in Cursor)
      return Constant_Reference_Type;

   function Reference (Container : aliased in out List;
                       Position  : in Cursor)
      return Reference_Type;

   procedure Assign (Target : in out List; Source : in List);

   function Copy (Source : List; Capacity : Count_Type := 0)
      return List;

   procedure Move (Target : in out List;
                   Source : in out List);

   procedure Insert (Container : in out List;
                     Before    : in     Cursor;
                     New_Item  : in     Element_Type;
                     Count     : in     Count_Type := 1);

   procedure Insert (Container : in out List;
                     Before    : in     Cursor;
                     New_Item  : in     Element_Type;
                     Position  :    out Cursor;
                     Count     : in     Count_Type := 1);

   procedure Insert (Container : in out List;
                     Before    : in     Cursor;
                     Position  :    out Cursor;
                     Count     : in     Count_Type := 1);

   procedure Prepend (Container : in out List;
                      New_Item  : in     Element_Type;
                      Count     : in     Count_Type := 1);

   procedure Append (Container : in out List;
                     New_Item  : in     Element_Type;
                     Count     : in     Count_Type := 1);

   procedure Delete (Container : in out List;
                     Position  : in out Cursor;
                     Count     : in     Count_Type := 1);

   procedure Delete_First (Container : in out List;
                           Count     : in     Count_Type := 1);

   procedure Delete_Last (Container : in out List;
                          Count     : in     Count_Type := 1);

   procedure Reverse_Elements (Container : in out List);

   procedure Swap (Container : in out List;
                   I, J      : in     Cursor);

   procedure Swap_Links (Container : in out List;
                         I, J      : in     Cursor);

   procedure Splice (Target   : in out List;
                     Before   : in     Cursor;
                     Source   : in out List);

   procedure Splice (Target   : in out List;
                     Before   : in     Cursor;
                     Source   : in out List;
                     Position : in out Cursor);

   procedure Splice (Container: in out List;
                     Before   : in     Cursor;
                     Position : in     Cursor);

   function First (Container : List) return Cursor;

   function First_Element (Container : List)
      return Element_Type;

   function Last (Container : List) return Cursor;

   function Last_Element (Container : List)
      return Element_Type;

   function Next (Position : Cursor) return Cursor;

   function Previous (Position : Cursor) return Cursor;

   procedure Next (Position : in out Cursor);

   procedure Previous (Position : in out Cursor);

   function Find (Container : List;
                  Item      : Element_Type;
                  Position  : Cursor := No_Element)
      return Cursor;

   function Reverse_Find (Container : List;
                          Item      : Element_Type;
                          Position  : Cursor := No_Element)
      return Cursor;

   function Contains (Container : List;
                      Item      : Element_Type) return Boolean;

   procedure Iterate
     (Container : in List;
      Process   : not null access procedure (Position : in Cursor));

   procedure Reverse_Iterate
     (Container : in List;
      Process   : not null access procedure (Position : in Cursor));

   function Iterate (Container : in List)
      return List_Iterator_Interfaces.Reversible_Iterator'Class;

   function Iterate (Container : in List; Start : in Cursor)
      return List_Iterator_Interfaces.Reversible_Iterator'Class;

   generic
      with function "<" (Left, Right : Element_Type)
         return Boolean is <>;
   package Generic_Sorting is

      function Is_Sorted (Container : List) return Boolean;

      procedure Sort (Container : in out List);

      procedure Merge (Target  : in out List;
                       Source  : in out List);

   end Generic_Sorting;

private

   --  not specified by the language

end Ada.Containers.Bounded_Doubly_Linked_Lists;

See also

[edit | edit source]

Wikibook

[edit | edit source]

External examples

[edit source]

Ada Reference Manual

[edit | edit source]

Ada 2012

[edit | edit source]

Open-Source Implementations

[edit | edit source]

FSF GNAT


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

[edit | edit source]

Warning: Display title "Ada Libraries/Libraries/Ada.Containers.Bounded_Hashed_Maps" overrides earlier display title "Ada Libraries/Libraries/Ada.Containers.Bounded_Doubly_Linked_Lists".


Ada. Time-tested, safe and secure.
Ada. Time-tested, safe and secure.

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.

Specification

[edit | edit source]
--                     Standard Ada library specification
--   Copyright (c) 2004-2016 AXE Consultants
--   Copyright (c) 2004, 2005, 2006 Ada-Europe
--   Copyright (c) 2000 The MITRE Corporation, Inc.
--   Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc.
--   SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual
-- -------------------------------------------------------------------------


with Ada.Iterator_Interfaces;
generic
   type Key_Type is private;
   type Element_Type is private;
   with function Hash (Key : Key_Type) return Hash_Type;
   with function Equivalent_Keys (Left, Right : Key_Type)
      return Boolean;
   with function "=" (Left, Right : Element_Type)
      return Boolean is <>;
package Ada.Containers.Bounded_Hashed_Maps is
   pragma Preelaborate(Bounded_Hashed_Maps);
   pragma Remote_Types(Bounded_Hashed_Maps);

  type Map (Capacity : Count_Type;
            Modulus  : Hash_Type) is tagged private
      with Constant_Indexing => Constant_Reference,
           Variable_Indexing => Reference,
           Default_Iterator  => Iterate,
           Iterator_Element  => Element_Type;
   pragma Preelaborable_Initialization(Map);

   type Cursor is private;
   pragma Preelaborable_Initialization(Cursor);

   Empty_Map : constant Map;

   No_Element : constant Cursor;

   function Has_Element (Position : Cursor) return Boolean;

   package Map_Iterator_Interfaces is new
       Ada.Iterator_Interfaces (Cursor, Has_Element);

   function "=" (Left, Right : Map) return Boolean;

   function Capacity (Container : Map) return Count_Type;

   procedure Reserve_Capacity (Container : in out Map;
                               Capacity  : in     Count_Type);

   function Default_Modulus (Capacity : Count_Type) return Hash_Type;
   
   function Length (Container : Map) return Count_Type;

   function Is_Empty (Container : Map) return Boolean;

   procedure Clear (Container : in out Map);

   function Key (Position : Cursor) return Key_Type;

   function Element (Position : Cursor) return Element_Type;

   procedure Replace_Element (Container : in out Map;
                              Position  : in     Cursor;
                              New_Item  : in     Element_Type);

   procedure Query_Element
     (Position : in Cursor;
      Process  : not null access procedure (Key     : in Key_Type;
                                            Element : in Element_Type));

   procedure Update_Element
     (Container : in out Map;
      Position  : in     Cursor;
      Process   : not null access procedure
                      (Key     : in     Key_Type;
                       Element : in out Element_Type));

   type Constant_Reference_Type
         (Element : not null access constant Element_Type) is private
      with Implicit_Dereference => Element;

   type Reference_Type (Element : not null access Element_Type) is private
      with Implicit_Dereference => Element;

   function Constant_Reference (Container : aliased in Map;
                                Position  : in Cursor)
      return Constant_Reference_Type;

   function Reference (Container : aliased in out Map;
                       Position  : in Cursor)
      return Reference_Type;

   function Constant_Reference (Container : aliased in Map;
                                Key       : in Key_Type)
      return Constant_Reference_Type;

   function Reference (Container : aliased in out Map;
                       Key       : in Key_Type)
      return Reference_Type;

   procedure Assign (Target : in out Map; Source : in Map);

   function Copy (Source   : Map;
                  Capacity : Count_Type := 0;
                  Modulus  : Hash_Type := 0) return Map;

   procedure Move (Target : in out Map;
                   Source : in out Map);

   procedure Insert (Container : in out Map;
                     Key       : in     Key_Type;
                     New_Item  : in     Element_Type;
                     Position  :    out Cursor;
                     Inserted  :    out Boolean);

   procedure Insert (Container : in out Map;
                     Key       : in     Key_Type;
                     Position  :    out Cursor;
                     Inserted  :    out Boolean);

   procedure Insert (Container : in out Map;
                     Key       : in     Key_Type;
                     New_Item  : in     Element_Type);

   procedure Include (Container : in out Map;
                      Key       : in     Key_Type;
                      New_Item  : in     Element_Type);

   procedure Replace (Container : in out Map;
                      Key       : in     Key_Type;
                      New_Item  : in     Element_Type);

   procedure Exclude (Container : in out Map;
                      Key       : in     Key_Type);

   procedure Delete (Container : in out Map;
                     Key       : in     Key_Type);

   procedure Delete (Container : in out Map;
                     Position  : in out Cursor);

   function First (Container : Map)
      return Cursor;

   function Next (Position  : Cursor) return Cursor;

   procedure Next (Position  : in out Cursor);

   function Find (Container : Map;
                  Key       : Key_Type)
      return Cursor;

   function Element (Container : Map;
                     Key       : Key_Type)
      return Element_Type;

   function Contains (Container : Map;
                      Key       : Key_Type) return Boolean;

   function Equivalent_Keys (Left, Right : Cursor)
      return Boolean;

   function Equivalent_Keys (Left  : Cursor;
                             Right : Key_Type)
      return Boolean;

   function Equivalent_Keys (Left  : Key_Type;
                             Right : Cursor)
      return Boolean;

   procedure Iterate
     (Container : in Map;
      Process   : not null access procedure (Position : in Cursor));

   function Iterate (Container : in Map)
      return Map_Iterator_Interfaces.Forward_Iterator'Class;

private

   --  not specified by the language

end Ada.Containers.Bounded_Hashed_Maps;

See also

[edit | edit source]

Wikibook

[edit | edit source]

External examples

[edit source]

Ada Reference Manual

[edit | edit source]

Ada 2012

[edit | edit source]

Open-Source Implementations

[edit | edit source]

FSF GNAT


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

[edit | edit source]

Warning: Display title "Ada Libraries/Libraries/Ada.Containers.Bounded_Hashed_Sets" overrides earlier display title "Ada Libraries/Libraries/Ada.Containers.Bounded_Hashed_Maps".


Ada. Time-tested, safe and secure.
Ada. Time-tested, safe and secure.

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.

Specification

[edit | edit source]
--                     Standard Ada library specification
--   Copyright (c) 2004-2016 AXE Consultants
--   Copyright (c) 2004, 2005, 2006 Ada-Europe
--   Copyright (c) 2000 The MITRE Corporation, Inc.
--   Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc.
--   SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual
-- -------------------------------------------------------------------------

with Ada.Iterator_Interfaces;
generic
   type Element_Type is private;
   with function Hash (Element : Element_Type) return Hash_Type;
   with function Equivalent_Elements (Left, Right : Element_Type)
                 return Boolean;
   with function "=" (Left, Right : Element_Type) return Boolean is <>;
package Ada.Containers.Bounded_Hashed_Sets is
   pragma Preelaborate(Bounded_Hashed_Sets);
   pragma Remote_Types(Bounded_Hashed_Sets);

  type Set (Capacity : Count_Type;
            Modulus  : Hash_Type) is tagged private
      with Constant_Indexing => Constant_Reference,
           Default_Iterator  => Iterate,
           Iterator_Element  => Element_Type;
   pragma Preelaborable_Initialization(Set);

   type Cursor is private;
   pragma Preelaborable_Initialization(Cursor);

   Empty_Set : constant Set;

   No_Element : constant Cursor;

   function Has_Element (Position : Cursor) return Boolean;

   package Set_Iterator_Interfaces is new
       Ada.Iterator_Interfaces (Cursor, Has_Element);

   function "=" (Left, Right : Set) return Boolean;

   function Equivalent_Sets (Left, Right : Set) return Boolean;

   function To_Set (New_Item : Element_Type) return Set;

   function Capacity (Container : Set) return Count_Type;

   procedure Reserve_Capacity (Container : in out Set;
                               Capacity  : in     Count_Type);

   function Default_Modulus (Capacity : Count_Type) return Hash_Type;

   function Length (Container : Set) return Count_Type;

   function Is_Empty (Container : Set) return Boolean;

   procedure Clear (Container : in out Set);

   function Element (Position : Cursor) return Element_Type;

   procedure Replace_Element (Container : in out Set;
                              Position  : in     Cursor;
                              New_Item  : in     Element_Type);

   procedure Query_Element
     (Position : in Cursor;
      Process  : not null access procedure (Element : in Element_Type));

   type Constant_Reference_Type
         (Element : not null access constant Element_Type) is private
      with Implicit_Dereference => Element;

   function Constant_Reference (Container : aliased in Set;
                                Position  : in Cursor)
      return Constant_Reference_Type;

   procedure Assign (Target : in out Set; Source : in Set);

   function Copy (Source   : Set;
                  Capacity : Count_Type := 0;
                  Modulus  : Hash_Type := 0) return Set;
   
   procedure Move (Target : in out Set;
                   Source : in out Set);

   procedure Insert (Container : in out Set;
                     New_Item  : in     Element_Type;
                     Position  :    out Cursor;
                     Inserted  :    out Boolean);

   procedure Insert (Container : in out Set;
                     New_Item  : in     Element_Type);

   procedure Include (Container : in out Set;
                      New_Item  : in     Element_Type);

   procedure Replace (Container : in out Set;
                      New_Item  : in     Element_Type);

   procedure Exclude (Container : in out Set;
                      Item      : in     Element_Type);

   procedure Delete (Container : in out Set;
                     Item      : in     Element_Type);

   procedure Delete (Container : in out Set;
                     Position  : in out Cursor);

   procedure Union (Target : in out Set;
                    Source : in     Set);

   function Union (Left, Right : Set) return Set;

   function "or" (Left, Right : Set) return Set renames Union;

   procedure Intersection (Target : in out Set;
                           Source : in     Set);

   function Intersection (Left, Right : Set) return Set;

   function "and" (Left, Right : Set) return Set renames Intersection;

   procedure Difference (Target : in out Set;
                         Source : in     Set);

   function Difference (Left, Right : Set) return Set;

   function "-" (Left, Right : Set) return Set renames Difference;

   procedure Symmetric_Difference (Target : in out Set;
                                   Source : in     Set);

   function Symmetric_Difference (Left, Right : Set) return Set;

   function "xor" (Left, Right : Set) return Set
     renames Symmetric_Difference;

   function Overlap (Left, Right : Set) return Boolean;

   function Is_Subset (Subset : Set;
                       Of_Set : Set) return Boolean;

   function First (Container : Set) return Cursor;

   function Next (Position : Cursor) return Cursor;

   procedure Next (Position : in out Cursor);

   function Find (Container : Set;
                  Item      : Element_Type) return Cursor;

   function Contains (Container : Set;
                      Item      : Element_Type) return Boolean;



   function Equivalent_Elements (Left, Right : Cursor)
     return Boolean;

   function Equivalent_Elements (Left  : Cursor;
                                 Right : Element_Type)
     return Boolean;

   function Equivalent_Elements (Left  : Element_Type;
                                 Right : Cursor)
     return Boolean;

   procedure Iterate
     (Container : in Set;
      Process   : not null access procedure (Position : in Cursor));

   function Iterate (Container : in Set)
      return Set_Iterator_Interfaces.Forward_Iterator'Class;

   generic
      type Key_Type (<>) is private;
      with function Key (Element : Element_Type) return Key_Type;
      with function Hash (Key : Key_Type) return Hash_Type;
      with function Equivalent_Keys (Left, Right : Key_Type)
                                     return Boolean;
   package Generic_Keys is

      function Key (Position : Cursor) return Key_Type;

      function Element (Container : Set;
                        Key       : Key_Type)
        return Element_Type;

      procedure Replace (Container : in out Set;
                         Key       : in     Key_Type;
                         New_Item  : in     Element_Type);

      procedure Exclude (Container : in out Set;
                         Key       : in     Key_Type);

      procedure Delete (Container : in out Set;
                        Key       : in     Key_Type);

      function Find (Container : Set;
                     Key       : Key_Type)
         return Cursor;

      function Contains (Container : Set;
                         Key       : Key_Type)
         return Boolean;

      procedure Update_Element_Preserving_Key
        (Container : in out Set;
         Position  : in     Cursor;
         Process   : not null access procedure
                         (Element : in out Element_Type));

      type Reference_Type
            (Element : not null access Element_Type) is private
         with Implicit_Dereference => Element;

      function Reference_Preserving_Key (Container : aliased in out Set;
                                         Position  : in Cursor)
         return Reference_Type;

      function Constant_Reference (Container : aliased in Set;
                                   Key       : in Key_Type)
         return Constant_Reference_Type;

      function Reference_Preserving_Key (Container : aliased in out Set;
                                         Key       : in Key_Type)
         return Reference_Type;

   end Generic_Keys;

private

    --  not specified by the language

end Ada.Containers.Bounded_Hashed_Sets;

See also

[edit | edit source]

Wikibook

[edit | edit source]

External examples

[edit source]

Ada Reference Manual

[edit | edit source]

Ada 2012

[edit | edit source]

Open-Source Implementations

[edit | edit source]

FSF GNAT



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

[edit | edit source]

Warning: Display title "Ada Libraries/Libraries/Ada.Containers.Bounded_Ordered_Maps" overrides earlier display title "Ada Libraries/Libraries/Ada.Containers.Bounded_Hashed_Sets".


Ada. Time-tested, safe and secure.
Ada. Time-tested, safe and secure.

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.

Specification

[edit | edit source]
--                     Standard Ada library specification
--   Copyright (c) 2004-2016 AXE Consultants
--   Copyright (c) 2004, 2005, 2006 Ada-Europe
--   Copyright (c) 2000 The MITRE Corporation, Inc.
--   Copyright (c) 1992, 1993, 1994, 1995 Intermetrics, Inc.
--   SPDX-License-Identifier: BSD-3-Clause and LicenseRef-AdaReferenceManual
-- -------------------------------------------------------------------------

with Ada.Iterator_Interfaces;
generic
   type Key_Type is private;
   type Element_Type is private;
   with function "<" (Left, Right : Key_Type) return Boolean is <>;
   with function "=" (Left, Right : Element_Type) return Boolean is <>;
package Ada.Containers.Bounded_Ordered_Maps is
   pragma Pure(Bounded_Ordered_Maps);
   pragma Remote_Types(Bounded_Ordered_Maps);

   function Equivalent_Keys (Left, Right : Key_Type) return Boolean;

  type Map (Capacity : Count_Type) is tagged private
      with Constant_Indexing => Constant_Reference,
           Variable_Indexing => Reference,
           Default_Iterator  => Iterate,
           Iterator_Element  => Element_Type;
   pragma Preelaborable_Initialization(Map);

   type Cursor is private;
   pragma Preelaborable_Initialization(Cursor);

   Empty_Map : constant Map;

   No_Element : constant Cursor;

   function Has_Element (Position : Cursor) return Boolean;

   package Map_Iterator_Interfaces is new
       Ada.Iterator_Interfaces (Cursor, Has_Element);

   function "=" (Left, Right : Map) return Boolean;

   function Length (Container : Map) return Count_Type;

   function Is_Empty (Container : Map) return Boolean;

   procedure Clear (Container : in out Map);

   function Key (Position : Cursor) return Key_Type;

   function Element (Position : Cursor) return Element_Type;

   procedure Replace_Element (Container : in out Map;
                              Position  : in     Cursor;
                              New_Item  : in     Element_Type);

   procedure Query_Element
     (Position : in Cursor;
      Process  : not null access procedure (Key     : in Key_Type;
                                            Element : in Element_Type));

   procedure Update_Element
     (Container : in out Map;
      Position  : in     Cursor;
      Process   : not null access procedure
                      (Key     : in     Key_Type;
                       Element : in out Element_Type));

   type Constant_Reference_Type
         (Element : not null access constant Element_Type) is private
      with Implicit_Dereference => Element;

   type Reference_Type (Element : not null access Element_Type) is private
      with Implicit_Dereference => Element;

   function Constant_Reference (Container : aliased in Map;
                                Position  : in Cursor)
      return Constant_Reference_Type;

   function Reference (Container : aliased in out Map;
                       Position  : in Cursor)
      return Reference_Type;

   function Constant_Reference (Container : aliased in Map;
                                Key       : in Key_Type)
      return Constant_Reference_Type;

   function Reference (Container : aliased in out Map;
                       Key       : in Key_Type)
      return Reference_Type;

   procedure Assign (Target : in out Map; Source : in Map);

   function Copy (Source   : Map;
                  Capacity : Count_Type := 0) return Map;

   procedure Move (Target : in out Map;
                   Source : in out Map);

   procedure Insert (Container : in out Map;
                     Key       : in     Key_Type;
                     New_Item  : in     Element_Type;
                     Position  :    out Cursor;
                     Inserted  :    out Boolean);

   procedure Insert (Container : in out Map;
                     Key       : in     Key_Type;
                     Position  :    out Cursor;
                     Inserted  :    out Boolean);

   procedure Insert (Container : in out Map;
                     Key       : in     Key_Type;
                     New_Item  : in     Element_Type);

   procedure Include (Container : in out Map;
                      Key       : in     Key_Type;
                      New_Item  : in     Element_Type);

   procedure Replace (Container : in out Map;
                      Key       : in     Key_Type;
                      New_Item  : in     Element_Type);

   procedure Exclude (Container : in out Map;
                      Key       : in     Key_Type);

   procedure Delete (Container : in out Map;
                     Key       : in     Key_Type);

   procedure Delete (Container : in out Map;
                     Position  : in out Cursor);

   procedure Delete_First (Container : in out Map);

   procedure Delete_Last (Container : in out Map);

   function First (Container : Map) return Cursor;

   function First_Element (Container : Map) return Element_Type;

   function First_Key (Container : Map) return Key_Type;

   function Last (Container : Map) return Cursor;

   function Last_Element (Container : Map) return Element_Type;

   function Last_Key (Container : Map) return Key_Type;

   function Next (Position : Cursor) return Cursor;

   procedure Next (Position : in out Cursor);

   function Previous (Position : Cursor) return Cursor;

   procedure Previous (Position : in out Cursor);

   function Find (Container : Map;
                  Key       : Key_Type) return Cursor;

   function Element (Container : Map;
                     Key       : Key_Type) return Element_Type;

   function Floor (Container : Map;
                   Key       : Key_Type) return Cursor;

   function Ceiling (Container : Map;
                     Key       : Key_Type) return Cursor;

   function Contains (Container : Map;
                      Key       : Key_Type) return Boolean;



   function "<" (Left, Right : Cursor) return Boolean;

   function ">" (Left, Right : Cursor) return Boolean;

   function "<" (Left : Cursor; Right : Key_Type) return Boolean;

   function ">" (Left : Cursor; Right : Key_Type) return Boolean;

   function "<" (Left : Key_Type; Right : Cursor) return Boolean;

   function ">" (Left : Key_Type; Right : Cursor) return Boolean;

   procedure Iterate
     (Container : in Map;
      Process   : not null access procedure (Position : in Cursor));

   procedure Reverse_Iterate
     (Container : in Map;
      Process   : not null access procedure (Position : in Cursor));

   function Iterate (Container : in Map)
      return Map_Iterator_Interfaces.Reversible_Iterator'Class;

   function Iterate (Container : in Map; Start : in Cursor)
      return Map_Iterator_Interfaces.Reversible_Iterator'Class;

private

   --  not specified by the language

end Ada.Containers.Bounded_Ordered_Maps;

See also

[edit | edit source]

Wikibook

[edit | edit source]

External examples

[edit source]

Ada Reference Manual

[edit | edit source]

Ada 2012

[edit | edit source]

Open-Source Implementations

[edit | edit source]

FSF GNAT


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

[edit | edit source]

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

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

[edit | edit source]

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

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

[edit | edit source]

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

Ada Programming/Libraries/Ada.Containers.Bounded Vectors

[edit | edit source]

Ada Programming/Libraries/Ada.Containers.Bounded Vectors

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

[edit | edit source]

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

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

[edit | edit source]

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

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

[edit | edit source]

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

Ada Programming/Libraries/Ada.Containers.Generic Sort

[edit | edit source]

Ada Programming/Libraries/Ada.Containers.Generic Sort

Ada Programming/Libraries/Ada.Containers.Hashed Maps

[edit | edit source]

Ada Programming/Libraries/Ada.Containers.Hashed Maps

Ada Programming/Libraries/Ada.Containers.Hashed Sets

[edit | edit source]

Ada Programming/Libraries/Ada.Containers.Hashed Sets

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

[edit | edit source]

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

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

[edit | edit source]

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

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

[edit | edit source]

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

Ada Programming/Libraries/Ada.Containers.Indefinite Holders

[edit | edit source]

Ada Programming/Libraries/Ada.Containers.Indefinite Holders

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

[edit | edit source]

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

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

[edit | edit source]

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

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

[edit | edit source]

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

Ada Programming/Libraries/Ada.Containers.Indefinite Vectors

[edit | edit source]

Ada Programming/Libraries/Ada.Containers.Indefinite Vectors

Ada Programming/Libraries/Ada.Containers.Multiway Trees

[edit | edit source]

Ada Programming/Libraries/Ada.Containers.Multiway Trees

Ada Programming/Libraries/Ada.Containers.Ordered Maps

[edit | edit source]

Ada Programming/Libraries/Ada.Containers.Ordered Maps

Ada Programming/Libraries/Ada.Containers.Ordered Sets

[edit | edit source]

Ada Programming/Libraries/Ada.Containers.Ordered Sets

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

[edit | edit source]

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

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

[edit | edit source]

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

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

[edit | edit source]

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

Ada Programming/Libraries/Ada.Containers.Vectors

[edit | edit source]

Ada Programming/Libraries/Ada.Containers.Vectors