diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-08-05 15:50:24 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-08-05 15:50:24 +0000 |
commit | 656b25b9ecb0f0322fb46de4aeb8ba340f113fe3 (patch) | |
tree | 65a3f7febd2b18b1496fce3f32191972afd0c06e /gcc/ada/a-comutr.adb | |
parent | 8f1fc867e5a31662664758fc405b82017e74cfbc (diff) | |
download | gcc-656b25b9ecb0f0322fb46de4aeb8ba340f113fe3.tar.gz |
2011-08-05 Matthew Heaney <heaney@adacore.com>
* a-comutr.adb, a-cimutr.adb, a-cbmutr.adb (Child_Count, Child_Depth):
subprogram bodies declared out-of-order.
2011-08-05 Yannick Moy <moy@adacore.com>
* sem_util.adb (Unique_Name): only prefix with "standard" the names of
entities directly in package Standard, otherwise skip the standard
prefix.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@177461 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/a-comutr.adb')
-rw-r--r-- | gcc/ada/a-comutr.adb | 126 |
1 files changed, 63 insertions, 63 deletions
diff --git a/gcc/ada/a-comutr.adb b/gcc/ada/a-comutr.adb index dfe50c18f4e..f3c77ed6211 100644 --- a/gcc/ada/a-comutr.adb +++ b/gcc/ada/a-comutr.adb @@ -291,6 +291,69 @@ package body Ada.Containers.Multiway_Trees is Target.Count := Source_Count; end Assign; + ----------------- + -- Child_Count -- + ----------------- + + function Child_Count (Parent : Cursor) return Count_Type is + begin + if Parent = No_Element then + return 0; + end if; + + return Child_Count (Parent.Node.Children); + end Child_Count; + + function Child_Count (Children : Children_Type) return Count_Type is + Result : Count_Type; + Node : Tree_Node_Access; + + begin + Result := 0; + Node := Children.First; + while Node /= null loop + Result := Result + 1; + Node := Node.Next; + end loop; + + return Result; + end Child_Count; + + ----------------- + -- Child_Depth -- + ----------------- + + function Child_Depth (Parent, Child : Cursor) return Count_Type is + Result : Count_Type; + N : Tree_Node_Access; + + begin + if Parent = No_Element then + raise Constraint_Error with "Parent cursor has no element"; + end if; + + if Child = No_Element then + raise Constraint_Error with "Child cursor has no element"; + end if; + + if Parent.Container /= Child.Container then + raise Program_Error with "Parent and Child in different containers"; + end if; + + Result := 0; + N := Child.Node; + while N /= Parent.Node loop + Result := Result + 1; + N := N.Parent; + + if N = null then + raise Program_Error with "Parent is not ancestor of Child"; + end if; + end loop; + + return Result; + end Child_Depth; + ----------- -- Clear -- ----------- @@ -413,69 +476,6 @@ package body Ada.Containers.Multiway_Trees is Parent.Children := CC; end Copy_Children; - ----------------- - -- Child_Count -- - ----------------- - - function Child_Count (Parent : Cursor) return Count_Type is - begin - if Parent = No_Element then - return 0; - end if; - - return Child_Count (Parent.Node.Children); - end Child_Count; - - function Child_Count (Children : Children_Type) return Count_Type is - Result : Count_Type; - Node : Tree_Node_Access; - - begin - Result := 0; - Node := Children.First; - while Node /= null loop - Result := Result + 1; - Node := Node.Next; - end loop; - - return Result; - end Child_Count; - - ----------------- - -- Child_Depth -- - ----------------- - - function Child_Depth (Parent, Child : Cursor) return Count_Type is - Result : Count_Type; - N : Tree_Node_Access; - - begin - if Parent = No_Element then - raise Constraint_Error with "Parent cursor has no element"; - end if; - - if Child = No_Element then - raise Constraint_Error with "Child cursor has no element"; - end if; - - if Parent.Container /= Child.Container then - raise Program_Error with "Parent and Child in different containers"; - end if; - - Result := 0; - N := Child.Node; - while N /= Parent.Node loop - Result := Result + 1; - N := N.Parent; - - if N = null then - raise Program_Error with "Parent is not ancestor of Child"; - end if; - end loop; - - return Result; - end Child_Depth; - ------------------ -- Copy_Subtree -- ------------------ |