aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/a-comutr.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2011-08-05 17:50:24 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2011-08-05 17:50:24 +0200
commit993f8920f402a8292fae58b22c03e31f3a308cf8 (patch)
tree65a3f7febd2b18b1496fce3f32191972afd0c06e /gcc/ada/a-comutr.adb
parent9b3956ddfccf087a37c4ed3abb034e12096fdcd1 (diff)
downloadgcc-993f8920f402a8292fae58b22c03e31f3a308cf8.zip
gcc-993f8920f402a8292fae58b22c03e31f3a308cf8.tar.gz
gcc-993f8920f402a8292fae58b22c03e31f3a308cf8.tar.bz2
[multiple changes]
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. From-SVN: r177461
Diffstat (limited to 'gcc/ada/a-comutr.adb')
-rw-r--r--gcc/ada/a-comutr.adb126
1 files changed, 63 insertions, 63 deletions
diff --git a/gcc/ada/a-comutr.adb b/gcc/ada/a-comutr.adb
index dfe50c1..f3c77ed 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 --
------------------