with Ada.Unchecked_Conversion;
with Ada.Unchecked_Deallocation;
+
with System; use type System.Address;
package body Ada.Containers.Multiway_Trees is
if Object.Container /= null then
declare
B : Natural renames Object.Container.all.Busy;
-
begin
B := B - 1;
end;
if Object.Container /= null then
declare
B : Natural renames Object.Container.all.Busy;
-
begin
B := B - 1;
end;
is
N : constant Tree_Node_Access :=
Find_In_Children (Root_Node (Container), Item);
-
begin
if N = null then
return No_Element;
+ else
+ return Cursor'(Container'Unrestricted_Access, N);
end if;
-
- return Cursor'(Container'Unrestricted_Access, N);
end Find;
-----------
function Has_Element (Position : Cursor) return Boolean is
begin
- if Position = No_Element then
- return False;
- end if;
-
- return Position.Node.Parent /= null;
+ return (if Position = No_Element then False
+ else Position.Node.Parent /= null);
end Has_Element;
------------------
function Is_Leaf (Position : Cursor) return Boolean is
begin
- if Position = No_Element then
- return False;
- end if;
-
- return Position.Node.Children.First = null;
+ return (if Position = No_Element then False
+ else Position.Node.Children.First = null);
end Is_Leaf;
------------------
function Is_Root (Position : Cursor) return Boolean is
begin
- if Position.Container = null then
- return False;
- end if;
-
- return Position = Root (Position.Container.all);
+ return (if Position.Container = null then False
+ else Position = Root (Position.Container.all));
end Is_Root;
-------------
B : Natural renames Container'Unrestricted_Access.all.Busy;
RC : constant Cursor :=
(Container'Unrestricted_Access, Root_Node (Container));
-
begin
return It : constant Iterator :=
Iterator'(Limited_Controlled with
return Tree_Iterator_Interfaces.Reversible_Iterator'Class
is
B : Natural renames Container'Unrestricted_Access.all.Busy;
-
begin
return It : constant Child_Iterator :=
Child_Iterator'(Limited_Controlled with
return Tree_Iterator_Interfaces.Forward_Iterator'Class
is
B : Natural renames Position.Container'Unrestricted_Access.all.Busy;
-
begin
return It : constant Iterator :=
Iterator'(Limited_Controlled with
begin
if Is_Leaf (Position) then
- -- If sibling is present, return it.
+ -- If sibling is present, return it
if N.Next /= null then
return (Object.Container, N.Next);
begin
while Par.Next = null loop
- -- If we are back at the root the iteration is complete.
+ -- If we are back at the root the iteration is complete
if Par = Root_Node (T) then
return No_Element;
end if;
else
- -- If an internal node, return its first child.
+ -- If an internal node, return its first child
return (Object.Container, N.Children.First);
end if;
for J in Count_Type'(2) .. Count loop
- -- Reclaim other nodes if Storage_Error. ???
+ -- Reclaim other nodes if Storage_Error???
Last.Next := new Tree_Node_Type'(Parent => Parent.Node,
Prev => Last,
C : Children_Type renames Subtree.Parent.Children;
begin
- -- This is a utility operation to remove a subtree
- -- node from its parent's list of children.
+ -- This is a utility operation to remove a subtree node from its
+ -- parent's list of children.
if C.First = Subtree then
pragma Assert (Subtree.Prev = null);
with Ada.Containers.Generic_Array_Sort;
with Ada.Unchecked_Deallocation;
+
with System; use type System.Address;
package body Ada.Containers.Vectors is
if Object.Container /= null then
declare
B : Natural renames Object.Container.all.Busy;
-
begin
B := B - 1;
end;
J : Index_Type'Base;
begin
-
-- The semantics of Merge changed slightly per AI05-0021. It was
-- originally the case that if Target and Source denoted the same
-- container object, then the GNAT implementation of Merge did
K : Index_Type'Base;
begin
- -- We next copy the source items that follow the space we
- -- inserted. Index value K is the first index of that portion of the
+ -- We next copy the source items that follow the space we inserted.
+ -- Index value K is the first index of that portion of the
-- destination that receives this slice of the source. (For the
-- reasons given above, this slice is guaranteed to be non-empty.)
Bod : constant Node_Id := Next (After);
begin
+ -- The presence of a body freezes all entities previously
+ -- declared in the current list of declarations, but this
+ -- does not apply if the body does not come from source.
+ -- A type invariant is transformed into a subprogram body
+ -- which is placed at the end of the private part of the
+ -- current package, but this body does not freeze incomplete
+ -- types that may be declared in this private part.
+
if (Nkind_In (Bod, N_Subprogram_Body,
N_Entry_Body,
N_Package_Body,
N_Task_Body)
or else Nkind (Bod) in N_Body_Stub)
and then
- List_Containing (After) = List_Containing (Parent (E))
+ List_Containing (After) = List_Containing (Parent (E))
and then Comes_From_Source (Bod)
then
Error_Msg_Sloc := Sloc (Next (After));