From 3e05da6849f5548db51ffa15030b1fc8aacb8d9c Mon Sep 17 00:00:00 2001 From: Bob Duff Date: Thu, 3 Dec 2020 12:40:05 -0500 Subject: [PATCH] [Ada] Ada2020: AI12-0400 Ambiguities associated with Vector gcc/ada/ * libgnat/a-cbdlli.adb, libgnat/a-cbdlli.ads, libgnat/a-cdlili.adb, libgnat/a-cdlili.ads, libgnat/a-cidlli.adb, libgnat/a-cidlli.ads, libgnat/a-cobove.adb, libgnat/a-cobove.ads, libgnat/a-coinve.adb, libgnat/a-coinve.ads, libgnat/a-convec.adb, libgnat/a-convec.ads: Add *_Vector operations, remove default for Count, rename Append_One to be Append. --- gcc/ada/libgnat/a-cbdlli.adb | 10 ++--- gcc/ada/libgnat/a-cbdlli.ads | 6 +-- gcc/ada/libgnat/a-cdlili.adb | 10 ++--- gcc/ada/libgnat/a-cdlili.ads | 6 +-- gcc/ada/libgnat/a-cidlli.adb | 10 ++--- gcc/ada/libgnat/a-cidlli.ads | 6 +-- gcc/ada/libgnat/a-cobove.adb | 73 +++++++++++++++++--------------- gcc/ada/libgnat/a-cobove.ads | 44 ++++++++++++++++---- gcc/ada/libgnat/a-coinve.adb | 64 +++++++++++++++-------------- gcc/ada/libgnat/a-coinve.ads | 43 +++++++++++++++---- gcc/ada/libgnat/a-convec.adb | 80 ++++++++++++++++++++---------------- gcc/ada/libgnat/a-convec.ads | 78 ++++++++++++++++++++++++----------- 12 files changed, 261 insertions(+), 169 deletions(-) diff --git a/gcc/ada/libgnat/a-cbdlli.adb b/gcc/ada/libgnat/a-cbdlli.adb index a0c356d3ada..948b70689f9 100644 --- a/gcc/ada/libgnat/a-cbdlli.adb +++ b/gcc/ada/libgnat/a-cbdlli.adb @@ -199,23 +199,19 @@ is procedure Append (Container : in out List; New_Item : Element_Type; - Count : Count_Type := 1) + Count : Count_Type) is begin Insert (Container, No_Element, New_Item, Count); end Append; - --------------- - -- Append_One -- - --------------- - - procedure Append_One + procedure Append (Container : in out List; New_Item : Element_Type) is begin Insert (Container, No_Element, New_Item, 1); - end Append_One; + end Append; ------------ -- Assign -- diff --git a/gcc/ada/libgnat/a-cbdlli.ads b/gcc/ada/libgnat/a-cbdlli.ads index 183c01e26dc..4574aa65afd 100644 --- a/gcc/ada/libgnat/a-cbdlli.ads +++ b/gcc/ada/libgnat/a-cbdlli.ads @@ -57,7 +57,7 @@ is Default_Iterator => Iterate, Iterator_Element => Element_Type, Aggregate => (Empty => Empty, - Add_Unnamed => Append_One); + Add_Unnamed => Append); pragma Preelaborable_Initialization (List); type Cursor is private; @@ -151,9 +151,9 @@ is procedure Append (Container : in out List; New_Item : Element_Type; - Count : Count_Type := 1); + Count : Count_Type); - procedure Append_One + procedure Append (Container : in out List; New_Item : Element_Type); diff --git a/gcc/ada/libgnat/a-cdlili.adb b/gcc/ada/libgnat/a-cdlili.adb index f07190ec2f4..08c29f2bcb6 100644 --- a/gcc/ada/libgnat/a-cdlili.adb +++ b/gcc/ada/libgnat/a-cdlili.adb @@ -158,23 +158,19 @@ is procedure Append (Container : in out List; New_Item : Element_Type; - Count : Count_Type := 1) + Count : Count_Type) is begin Insert (Container, No_Element, New_Item, Count); end Append; - --------------- - -- Append_One -- - --------------- - - procedure Append_One + procedure Append (Container : in out List; New_Item : Element_Type) is begin Insert (Container, No_Element, New_Item, 1); - end Append_One; + end Append; ------------ -- Assign -- diff --git a/gcc/ada/libgnat/a-cdlili.ads b/gcc/ada/libgnat/a-cdlili.ads index 35c4352c8ca..53de78b4e51 100644 --- a/gcc/ada/libgnat/a-cdlili.ads +++ b/gcc/ada/libgnat/a-cdlili.ads @@ -58,7 +58,7 @@ is Default_Iterator => Iterate, Iterator_Element => Element_Type, Aggregate => (Empty => Empty, - Add_Unnamed => Append_One); + Add_Unnamed => Append); pragma Preelaborable_Initialization (List); @@ -154,9 +154,9 @@ is procedure Append (Container : in out List; New_Item : Element_Type; - Count : Count_Type := 1); + Count : Count_Type); - procedure Append_One + procedure Append (Container : in out List; New_Item : Element_Type); diff --git a/gcc/ada/libgnat/a-cidlli.adb b/gcc/ada/libgnat/a-cidlli.adb index a62338f9665..79df5a940b2 100644 --- a/gcc/ada/libgnat/a-cidlli.adb +++ b/gcc/ada/libgnat/a-cidlli.adb @@ -179,23 +179,19 @@ is procedure Append (Container : in out List; New_Item : Element_Type; - Count : Count_Type := 1) + Count : Count_Type) is begin Insert (Container, No_Element, New_Item, Count); end Append; - --------------- - -- Append_One -- - --------------- - - procedure Append_One + procedure Append (Container : in out List; New_Item : Element_Type) is begin Insert (Container, No_Element, New_Item, 1); - end Append_One; + end Append; ------------ -- Assign -- diff --git a/gcc/ada/libgnat/a-cidlli.ads b/gcc/ada/libgnat/a-cidlli.ads index 5e63cf22e89..c75e5af7858 100644 --- a/gcc/ada/libgnat/a-cidlli.ads +++ b/gcc/ada/libgnat/a-cidlli.ads @@ -57,7 +57,7 @@ is Default_Iterator => Iterate, Iterator_Element => Element_Type, Aggregate => (Empty => Empty, - Add_Unnamed => Append_One); + Add_Unnamed => Append); pragma Preelaborable_Initialization (List); @@ -147,9 +147,9 @@ is procedure Append (Container : in out List; New_Item : Element_Type; - Count : Count_Type := 1); + Count : Count_Type); - procedure Append_One + procedure Append (Container : in out List; New_Item : Element_Type); diff --git a/gcc/ada/libgnat/a-cobove.adb b/gcc/ada/libgnat/a-cobove.adb index 0408741b44f..8a8b279a9c0 100644 --- a/gcc/ada/libgnat/a-cobove.adb +++ b/gcc/ada/libgnat/a-cobove.adb @@ -321,9 +321,13 @@ package body Ada.Containers.Bounded_Vectors is -- Append -- ------------ - procedure Append (Container : in out Vector; New_Item : Vector) is + procedure Append + (Container : in out Vector; + New_Item : Element_Type; + Count : Count_Type) + is begin - if New_Item.Is_Empty then + if Count = 0 then return; end if; @@ -331,16 +335,16 @@ package body Ada.Containers.Bounded_Vectors is raise Constraint_Error with "vector is already at its maximum length"; end if; - Container.Insert (Container.Last + 1, New_Item); + Container.Insert (Container.Last + 1, New_Item, Count); end Append; - procedure Append - (Container : in out Vector; - New_Item : Element_Type; - Count : Count_Type := 1) - is + ------------------- + -- Append_Vector -- + ------------------- + + procedure Append_Vector (Container : in out Vector; New_Item : Vector) is begin - if Count = 0 then + if New_Item.Is_Empty then return; end if; @@ -348,19 +352,19 @@ package body Ada.Containers.Bounded_Vectors is raise Constraint_Error with "vector is already at its maximum length"; end if; - Container.Insert (Container.Last + 1, New_Item, Count); - end Append; + Container.Insert_Vector (Container.Last + 1, New_Item); + end Append_Vector; - ---------------- - -- Append_One -- - ---------------- + ------------ + -- Append -- + ------------ - procedure Append_One (Container : in out Vector; - New_Item : Element_Type) + procedure Append (Container : in out Vector; + New_Item : Element_Type) is begin Insert (Container, Last_Index (Container) + 1, New_Item, 1); - end Append_One; + end Append; -------------- -- Capacity -- @@ -1243,7 +1247,7 @@ package body Ada.Containers.Bounded_Vectors is end if; end Insert; - procedure Insert + procedure Insert_Vector (Container : in out Vector; Before : Extended_Index; New_Item : Vector) @@ -1309,9 +1313,9 @@ package body Ada.Containers.Bounded_Vectors is Container.Elements (B + N - Src'Length .. B + N - 1) := Src; end; - end Insert; + end Insert_Vector; - procedure Insert + procedure Insert_Vector (Container : in out Vector; Before : Cursor; New_Item : Vector) @@ -1343,10 +1347,10 @@ package body Ada.Containers.Bounded_Vectors is Index := Before.Index; end if; - Insert (Container, Index, New_Item); - end Insert; + Insert_Vector (Container, Index, New_Item); + end Insert_Vector; - procedure Insert + procedure Insert_Vector (Container : in out Vector; Before : Cursor; New_Item : Vector; @@ -1387,10 +1391,10 @@ package body Ada.Containers.Bounded_Vectors is Index := Before.Index; end if; - Insert (Container, Index, New_Item); + Insert_Vector (Container, Index, New_Item); Position := Cursor'(Container'Unchecked_Access, Index); - end Insert; + end Insert_Vector; procedure Insert (Container : in out Vector; @@ -2028,23 +2032,24 @@ package body Ada.Containers.Bounded_Vectors is -- Prepend -- ------------- - procedure Prepend (Container : in out Vector; New_Item : Vector) is - begin - Insert (Container, Index_Type'First, New_Item); - end Prepend; - procedure Prepend (Container : in out Vector; New_Item : Element_Type; Count : Count_Type := 1) is begin - Insert (Container, - Index_Type'First, - New_Item, - Count); + Insert (Container, Index_Type'First, New_Item, Count); end Prepend; + -------------------- + -- Prepend_Vector -- + -------------------- + + procedure Prepend_Vector (Container : in out Vector; New_Item : Vector) is + begin + Insert_Vector (Container, Index_Type'First, New_Item); + end Prepend_Vector; + -------------- -- Previous -- -------------- diff --git a/gcc/ada/libgnat/a-cobove.ads b/gcc/ada/libgnat/a-cobove.ads index ab4ce4e2f99..324ca840378 100644 --- a/gcc/ada/libgnat/a-cobove.ads +++ b/gcc/ada/libgnat/a-cobove.ads @@ -61,7 +61,7 @@ package Ada.Containers.Bounded_Vectors is Default_Iterator => Iterate, Iterator_Element => Element_Type, Aggregate => (Empty => Empty, - Add_Unnamed => Append_One, + Add_Unnamed => Append, New_Indexed => New_Vector, Assign_Indexed => Replace_Element); @@ -190,22 +190,41 @@ package Ada.Containers.Bounded_Vectors is procedure Move (Target : in out Vector; Source : in out Vector); - procedure Insert + procedure Insert_Vector (Container : in out Vector; Before : Extended_Index; New_Item : Vector); procedure Insert + (Container : in out Vector; + Before : Extended_Index; + New_Item : Vector) renames Insert_Vector; + -- Retained for now for compatibility; AI12-0400 will remove this. + + procedure Insert_Vector (Container : in out Vector; Before : Cursor; New_Item : Vector); procedure Insert + (Container : in out Vector; + Before : Cursor; + New_Item : Vector) renames Insert_Vector; + -- Retained for now for compatibility; AI12-0400 will remove this. + + procedure Insert_Vector (Container : in out Vector; Before : Cursor; New_Item : Vector; Position : out Cursor); + procedure Insert + (Container : in out Vector; + Before : Cursor; + New_Item : Vector; + Position : out Cursor) renames Insert_Vector; + -- Retained for now for compatibility; AI12-0400 will remove this. + procedure Insert (Container : in out Vector; Before : Extended_Index; @@ -236,27 +255,36 @@ package Ada.Containers.Bounded_Vectors is Position : out Cursor; Count : Count_Type := 1); - procedure Prepend + procedure Prepend_Vector (Container : in out Vector; New_Item : Vector); + procedure Prepend + (Container : in out Vector; + New_Item : Vector) renames Prepend_Vector; + -- Retained for now for compatibility; AI12-0400 will remove this. + procedure Prepend (Container : in out Vector; New_Item : Element_Type; Count : Count_Type := 1); - procedure Append + procedure Append_Vector (Container : in out Vector; New_Item : Vector); + procedure Append + (Container : in out Vector; + New_Item : Vector) renames Append_Vector; + -- Retained for now for compatibility; AI12-0400 will remove this. + procedure Append (Container : in out Vector; New_Item : Element_Type; - Count : Count_Type := 1); + Count : Count_Type); - procedure Append_One (Container : in out Vector; - New_Item : Element_Type); - -- Ada_2020 aggregate operation. + procedure Append (Container : in out Vector; + New_Item : Element_Type); procedure Insert_Space (Container : in out Vector; diff --git a/gcc/ada/libgnat/a-coinve.adb b/gcc/ada/libgnat/a-coinve.adb index 10711ffeca9..051aa711d6a 100644 --- a/gcc/ada/libgnat/a-coinve.adb +++ b/gcc/ada/libgnat/a-coinve.adb @@ -67,8 +67,8 @@ is begin return Result : Vector do Reserve_Capacity (Result, Length (Left) + Length (Right)); - Append (Result, Left); - Append (Result, Right); + Append_Vector (Result, Left); + Append_Vector (Result, Right); end return; end "&"; @@ -76,7 +76,7 @@ is begin return Result : Vector do Reserve_Capacity (Result, Length (Left) + 1); - Append (Result, Left); + Append_Vector (Result, Left); Append (Result, Right); end return; end "&"; @@ -86,7 +86,7 @@ is return Result : Vector do Reserve_Capacity (Result, 1 + Length (Right)); Append (Result, Left); - Append (Result, Right); + Append_Vector (Result, Right); end return; end "&"; @@ -176,25 +176,25 @@ is end; end Adjust; - ------------ - -- Append -- - ------------ + ------------------- + -- Append_Vector -- + ------------------- - procedure Append (Container : in out Vector; New_Item : Vector) is + procedure Append_Vector (Container : in out Vector; New_Item : Vector) is begin if Is_Empty (New_Item) then return; elsif Checks and then Container.Last = Index_Type'Last then raise Constraint_Error with "vector is already at its maximum length"; else - Insert (Container, Container.Last + 1, New_Item); + Insert_Vector (Container, Container.Last + 1, New_Item); end if; - end Append; + end Append_Vector; procedure Append (Container : in out Vector; New_Item : Element_Type; - Count : Count_Type := 1) + Count : Count_Type) is begin -- In the general case, we pass the buck to Insert, but for efficiency, @@ -229,16 +229,16 @@ is end if; end Append; - ---------------- - -- Append_One -- - ---------------- + ------------ + -- Append -- + ------------ - procedure Append_One (Container : in out Vector; + procedure Append (Container : in out Vector; New_Item : Element_Type) is begin Insert (Container, Last_Index (Container) + 1, New_Item, 1); - end Append_One; + end Append; ---------------------- -- Append_Slow_Path -- @@ -269,7 +269,7 @@ is return; else Target.Clear; - Target.Append (Source); + Target.Append_Vector (Source); end if; end Assign; @@ -1619,7 +1619,7 @@ is end; end Insert; - procedure Insert + procedure Insert_Vector (Container : in out Vector; Before : Extended_Index; New_Item : Vector) @@ -1766,9 +1766,9 @@ is Dst_Index := Dst_Index + 1; end loop; end; - end Insert; + end Insert_Vector; - procedure Insert + procedure Insert_Vector (Container : in out Vector; Before : Cursor; New_Item : Vector) @@ -1798,10 +1798,10 @@ is Index := Before.Index; end if; - Insert (Container, Index, New_Item); - end Insert; + Insert_Vector (Container, Index, New_Item); + end Insert_Vector; - procedure Insert + procedure Insert_Vector (Container : in out Vector; Before : Cursor; New_Item : Vector; @@ -1838,10 +1838,10 @@ is Index := Before.Index; end if; - Insert (Container, Index, New_Item); + Insert_Vector (Container, Index, New_Item); Position := (Container'Unrestricted_Access, Index); - end Insert; + end Insert_Vector; procedure Insert (Container : in out Vector; @@ -2559,11 +2559,6 @@ is -- Prepend -- ------------- - procedure Prepend (Container : in out Vector; New_Item : Vector) is - begin - Insert (Container, Index_Type'First, New_Item); - end Prepend; - procedure Prepend (Container : in out Vector; New_Item : Element_Type; @@ -2573,6 +2568,15 @@ is Insert (Container, Index_Type'First, New_Item, Count); end Prepend; + ------------- + -- Prepend_Vector -- + ------------- + + procedure Prepend_Vector (Container : in out Vector; New_Item : Vector) is + begin + Insert_Vector (Container, Index_Type'First, New_Item); + end Prepend_Vector; + -------------- -- Previous -- -------------- diff --git a/gcc/ada/libgnat/a-coinve.ads b/gcc/ada/libgnat/a-coinve.ads index 593b63e8dca..c9364c7a3e3 100644 --- a/gcc/ada/libgnat/a-coinve.ads +++ b/gcc/ada/libgnat/a-coinve.ads @@ -64,7 +64,7 @@ is Default_Iterator => Iterate, Iterator_Element => Element_Type, Aggregate => (Empty => Empty_Vector, - Add_Unnamed => Append_One, + Add_Unnamed => Append, New_Indexed => New_Vector, Assign_Indexed => Replace_Element); @@ -195,22 +195,41 @@ is procedure Move (Target : in out Vector; Source : in out Vector); - procedure Insert + procedure Insert_Vector (Container : in out Vector; Before : Extended_Index; New_Item : Vector); procedure Insert + (Container : in out Vector; + Before : Extended_Index; + New_Item : Vector) renames Insert_Vector; + -- Retained for now for compatibility; AI12-0400 will remove this. + + procedure Insert_Vector (Container : in out Vector; Before : Cursor; New_Item : Vector); procedure Insert + (Container : in out Vector; + Before : Cursor; + New_Item : Vector) renames Insert_Vector; + -- Retained for now for compatibility; AI12-0400 will remove this. + + procedure Insert_Vector (Container : in out Vector; Before : Cursor; New_Item : Vector; Position : out Cursor); + procedure Insert + (Container : in out Vector; + Before : Cursor; + New_Item : Vector; + Position : out Cursor) renames Insert_Vector; + -- Retained for now for compatibility; AI12-0400 will remove this. + procedure Insert (Container : in out Vector; Before : Extended_Index; @@ -230,26 +249,36 @@ is Position : out Cursor; Count : Count_Type := 1); - procedure Prepend + procedure Prepend_Vector (Container : in out Vector; New_Item : Vector); + procedure Prepend + (Container : in out Vector; + New_Item : Vector) renames Prepend_Vector; + -- Retained for now for compatibility; AI12-0400 will remove this. + procedure Prepend (Container : in out Vector; New_Item : Element_Type; Count : Count_Type := 1); - procedure Append + procedure Append_Vector (Container : in out Vector; New_Item : Vector); + procedure Append + (Container : in out Vector; + New_Item : Vector) renames Append_Vector; + -- Retained for now for compatibility; AI12-0400 will remove this. + procedure Append (Container : in out Vector; New_Item : Element_Type; - Count : Count_Type := 1); + Count : Count_Type); - procedure Append_One (Container : in out Vector; - New_Item : Element_Type); + procedure Append (Container : in out Vector; + New_Item : Element_Type); procedure Insert_Space (Container : in out Vector; diff --git a/gcc/ada/libgnat/a-convec.adb b/gcc/ada/libgnat/a-convec.adb index a43be970e34..fec72cc21b3 100644 --- a/gcc/ada/libgnat/a-convec.adb +++ b/gcc/ada/libgnat/a-convec.adb @@ -64,8 +64,8 @@ is begin return Result : Vector do Reserve_Capacity (Result, Length (Left) + Length (Right)); - Append (Result, Left); - Append (Result, Right); + Append_Vector (Result, Left); + Append_Vector (Result, Right); end return; end "&"; @@ -73,7 +73,7 @@ is begin return Result : Vector do Reserve_Capacity (Result, Length (Left) + 1); - Append (Result, Left); + Append_Vector (Result, Left); Append (Result, Right); end return; end "&"; @@ -83,7 +83,7 @@ is return Result : Vector do Reserve_Capacity (Result, 1 + Length (Right)); Append (Result, Left); - Append (Result, Right); + Append_Vector (Result, Right); end return; end "&"; @@ -167,21 +167,10 @@ is -- Append -- ------------ - procedure Append (Container : in out Vector; New_Item : Vector) is - begin - if Is_Empty (New_Item) then - return; - elsif Checks and then Container.Last = Index_Type'Last then - raise Constraint_Error with "vector is already at its maximum length"; - else - Insert (Container, Container.Last + 1, New_Item); - end if; - end Append; - procedure Append (Container : in out Vector; New_Item : Element_Type; - Count : Count_Type := 1) + Count : Count_Type) is begin -- In the general case, we pass the buck to Insert, but for efficiency, @@ -210,16 +199,31 @@ is end if; end Append; - ---------------- - -- Append_One -- - ---------------- + ------------------- + -- Append_Vector -- + ------------------- + + procedure Append_Vector (Container : in out Vector; New_Item : Vector) is + begin + if Is_Empty (New_Item) then + return; + elsif Checks and then Container.Last = Index_Type'Last then + raise Constraint_Error with "vector is already at its maximum length"; + else + Insert_Vector (Container, Container.Last + 1, New_Item); + end if; + end Append_Vector; + + ------------ + -- Append -- + ------------ - procedure Append_One (Container : in out Vector; - New_Item : Element_Type) + procedure Append (Container : in out Vector; + New_Item : Element_Type) is begin Insert (Container, Last_Index (Container) + 1, New_Item, 1); - end Append_One; + end Append; ---------------------- -- Append_Slow_Path -- @@ -250,7 +254,7 @@ is return; else Target.Clear; - Target.Append (Source); + Target.Append_Vector (Source); end if; end Assign; @@ -1310,7 +1314,7 @@ is end; end Insert; - procedure Insert + procedure Insert_Vector (Container : in out Vector; Before : Extended_Index; New_Item : Vector) @@ -1429,9 +1433,9 @@ is Container.Elements.EA (K .. J) := Src; end; - end Insert; + end Insert_Vector; - procedure Insert + procedure Insert_Vector (Container : in out Vector; Before : Cursor; New_Item : Vector) @@ -1461,10 +1465,10 @@ is Index := Before.Index; end if; - Insert (Container, Index, New_Item); - end Insert; + Insert_Vector (Container, Index, New_Item); + end Insert_Vector; - procedure Insert + procedure Insert_Vector (Container : in out Vector; Before : Cursor; New_Item : Vector; @@ -1501,10 +1505,10 @@ is Index := Before.Index; end if; - Insert (Container, Index, New_Item); + Insert_Vector (Container, Index, New_Item); Position := (Container'Unrestricted_Access, Index); - end Insert; + end Insert_Vector; procedure Insert (Container : in out Vector; @@ -2266,11 +2270,6 @@ is -- Prepend -- ------------- - procedure Prepend (Container : in out Vector; New_Item : Vector) is - begin - Insert (Container, Index_Type'First, New_Item); - end Prepend; - procedure Prepend (Container : in out Vector; New_Item : Element_Type; @@ -2280,6 +2279,15 @@ is Insert (Container, Index_Type'First, New_Item, Count); end Prepend; + -------------------- + -- Prepend_Vector -- + -------------------- + + procedure Prepend_Vector (Container : in out Vector; New_Item : Vector) is + begin + Insert_Vector (Container, Index_Type'First, New_Item); + end Prepend_Vector; + -------------- -- Previous -- -------------- diff --git a/gcc/ada/libgnat/a-convec.ads b/gcc/ada/libgnat/a-convec.ads index f969e6f691e..1d257a05bed 100644 --- a/gcc/ada/libgnat/a-convec.ads +++ b/gcc/ada/libgnat/a-convec.ads @@ -95,7 +95,7 @@ is Default_Iterator => Iterate, Iterator_Element => Element_Type, Aggregate => (Empty => Empty, - Add_Unnamed => Append_One, + Add_Unnamed => Append, New_Indexed => New_Vector, Assign_Indexed => Replace_Element); @@ -334,36 +334,48 @@ is with Pre => First = Index_Type'First; -- Ada_2020 aggregate operation. - procedure Insert + procedure Insert_Vector (Container : in out Vector; Before : Extended_Index; New_Item : Vector); -- If Before is not in the range First_Index (Container) .. Last_Index -- (Container) + 1, then Constraint_Error is propagated. If - -- Length(New_Item) is 0, then Insert does nothing. Otherwise, it computes - -- the new length NL as the sum of the current length and Length + -- Length(New_Item) is 0, then Insert_Vector does nothing. Otherwise, it + -- computes the new length NL as the sum of the current length and Length -- (New_Item); if the value of Last appropriate for length NL would be -- greater than Index_Type'Last then Constraint_Error is propagated. -- -- If the current vector capacity is less than NL, Reserve_Capacity - -- (Container, NL) is called to increase the vector capacity. Then Insert - -- slides the elements in the range Before .. Last_Index (Container) up by - -- Length(New_Item) positions, and then copies the elements of New_Item to - -- the positions starting at Before. Any exception raised during the - -- copying is propagated. + -- (Container, NL) is called to increase the vector capacity. Then + -- Insert_Vector slides the elements in the range Before .. Last_Index + -- (Container) up by Length(New_Item) positions, and then copies the + -- elements of New_Item to the positions starting at Before. Any exception + -- raised during the copying is propagated. procedure Insert + (Container : in out Vector; + Before : Extended_Index; + New_Item : Vector) renames Insert_Vector; + -- Retained for now for compatibility; AI12-0400 will remove this. + + procedure Insert_Vector (Container : in out Vector; Before : Cursor; New_Item : Vector); -- If Before is not No_Element, and does not designate an element in -- Container, then Program_Error is propagated. Otherwise, if - -- Length(New_Item) is 0, then Insert does nothing. If Before is - -- No_Element, then the call is equivalent to Insert (Container, Last_Index - -- (Container) + 1, New_Item); otherwise the call is equivalent to Insert - -- (Container, To_Index (Before), New_Item); + -- Length(New_Item) is 0, then Insert_Vector does nothing. If Before is + -- No_Element, then the call is equivalent to Insert_Vector (Container, + -- Last_Index (Container) + 1, New_Item); otherwise the call is equivalent + -- to Insert_Vector (Container, To_Index (Before), New_Item); procedure Insert + (Container : in out Vector; + Before : Cursor; + New_Item : Vector) renames Insert_Vector; + -- Retained for now for compatibility; AI12-0400 will remove this. + + procedure Insert_Vector (Container : in out Vector; Before : Cursor; New_Item : Vector; @@ -371,22 +383,31 @@ is -- If Before is not No_Element, and does not designate an element in -- Container, then Program_Error is propagated. If Before equals -- No_Element, then let T be Last_Index (Container) + 1; otherwise, let T - -- be To_Index (Before). Insert (Container, T, New_Item) is called, and - -- then Position is set to To_Cursor (Container, T). + -- be To_Index (Before). Insert_Vector (Container, T, New_Item) is called, + -- and then Position is set to To_Cursor (Container, T). + + procedure Insert + (Container : in out Vector; + Before : Cursor; + New_Item : Vector; + Position : out Cursor) renames Insert_Vector; + -- Retained for now for compatibility; AI12-0400 will remove this. procedure Insert (Container : in out Vector; Before : Extended_Index; New_Item : Element_Type; Count : Count_Type := 1); - -- Equivalent to Insert (Container, Before, To_Vector (New_Item, Count)); + -- Equivalent to: + -- Insert_Vector (Container, Before, To_Vector (New_Item, Count)); procedure Insert (Container : in out Vector; Before : Cursor; New_Item : Element_Type; Count : Count_Type := 1); - -- Equivalent to Insert (Container, Before, To_Vector (New_Item, Count)); + -- Equivalent to: + -- Insert_Vector (Container, Before, To_Vector (New_Item, Count)); procedure Insert (Container : in out Vector; @@ -395,7 +416,7 @@ is Position : out Cursor; Count : Count_Type := 1); -- Equivalent to - -- Insert (Container, Before, To_Vector (New_Item, Count), Position); + -- Insert_Vector (Container, Before, To_Vector (New_Item, Count), Position) procedure Insert (Container : in out Vector; @@ -425,11 +446,16 @@ is -- be To_Index (Before). Insert (Container, T, Count) is called, and then -- Position is set to To_Cursor (Container, T). - procedure Prepend + procedure Prepend_Vector (Container : in out Vector; New_Item : Vector); -- Equivalent to Insert (Container, First_Index (Container), New_Item). + procedure Prepend + (Container : in out Vector; + New_Item : Vector) renames Prepend_Vector; + -- Retained for now for compatibility; AI12-0400 will remove this. + procedure Prepend (Container : in out Vector; New_Item : Element_Type; @@ -437,21 +463,25 @@ is -- Equivalent to Insert (Container, First_Index (Container), New_Item, -- Count). - procedure Append + procedure Append_Vector (Container : in out Vector; New_Item : Vector); -- Equivalent to Insert (Container, Last_Index (Container) + 1, New_Item). + procedure Append + (Container : in out Vector; + New_Item : Vector) renames Append_Vector; + -- Retained for now for compatibility; AI12-0400 will remove this. + procedure Append (Container : in out Vector; New_Item : Element_Type; - Count : Count_Type := 1); + Count : Count_Type); -- Equivalent to Insert (Container, Last_Index (Container) + 1, New_Item, -- Count). - procedure Append_One (Container : in out Vector; - New_Item : Element_Type); - -- Ada_2020 aggregate operation. + procedure Append (Container : in out Vector; + New_Item : Element_Type); procedure Insert_Space (Container : in out Vector; -- 2.30.2