Mercurial > hg > CbC > CbC_gcc
comparison gcc/ada/libgnat/a-cbmutr.adb @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | 84e7813d76e9 |
children |
comparison
equal
deleted
inserted
replaced
131:84e7813d76e9 | 145:1830386684a0 |
---|---|
4 -- -- | 4 -- -- |
5 -- ADA.CONTAINERS.BOUNDED_MULTIWAY_TREES -- | 5 -- ADA.CONTAINERS.BOUNDED_MULTIWAY_TREES -- |
6 -- -- | 6 -- -- |
7 -- B o d y -- | 7 -- B o d y -- |
8 -- -- | 8 -- -- |
9 -- Copyright (C) 2011-2018, Free Software Foundation, Inc. -- | 9 -- Copyright (C) 2011-2019, Free Software Foundation, Inc. -- |
10 -- -- | 10 -- -- |
11 -- GNAT is free software; you can redistribute it and/or modify it under -- | 11 -- GNAT is free software; you can redistribute it and/or modify it under -- |
12 -- terms of the GNU General Public License as published by the Free Soft- -- | 12 -- terms of the GNU General Public License as published by the Free Soft- -- |
13 -- ware Foundation; either version 3, or (at your option) any later ver- -- | 13 -- ware Foundation; either version 3, or (at your option) any later ver- -- |
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- | 14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- -- |
598 begin | 598 begin |
599 return R : constant Constant_Reference_Type := | 599 return R : constant Constant_Reference_Type := |
600 (Element => Container.Elements (Position.Node)'Access, | 600 (Element => Container.Elements (Position.Node)'Access, |
601 Control => (Controlled with TC)) | 601 Control => (Controlled with TC)) |
602 do | 602 do |
603 Lock (TC.all); | 603 Busy (TC.all); |
604 end return; | 604 end return; |
605 end; | 605 end; |
606 end Constant_Reference; | 606 end Constant_Reference; |
607 | 607 |
608 -------------- | 608 -------------- |
623 | 623 |
624 function Copy | 624 function Copy |
625 (Source : Tree; | 625 (Source : Tree; |
626 Capacity : Count_Type := 0) return Tree | 626 Capacity : Count_Type := 0) return Tree |
627 is | 627 is |
628 C : Count_Type; | 628 C : constant Count_Type := |
629 | 629 (if Capacity = 0 then Source.Count |
630 begin | 630 else Capacity); |
631 if Capacity = 0 then | 631 begin |
632 C := Source.Count; | 632 if Checks and then C < Source.Count then |
633 elsif Capacity >= Source.Count then | 633 raise Capacity_Error with "Capacity too small"; |
634 C := Capacity; | |
635 elsif Checks then | |
636 raise Capacity_Error with "Capacity value too small"; | |
637 end if; | 634 end if; |
638 | 635 |
639 return Target : Tree (Capacity => C) do | 636 return Target : Tree (Capacity => C) do |
640 Initialize_Root (Target); | 637 Initialize_Root (Target); |
641 | 638 |
1765 | 1762 |
1766 function Is_Reachable | 1763 function Is_Reachable |
1767 (Container : Tree; | 1764 (Container : Tree; |
1768 From, To : Count_Type) return Boolean | 1765 From, To : Count_Type) return Boolean |
1769 is | 1766 is |
1770 Idx : Count_Type; | 1767 Idx : Count_Type'Base := From; |
1771 | 1768 begin |
1772 begin | |
1773 Idx := From; | |
1774 while Idx >= 0 loop | 1769 while Idx >= 0 loop |
1775 if Idx = To then | 1770 if Idx = To then |
1776 return True; | 1771 return True; |
1777 end if; | 1772 end if; |
1778 | 1773 |
2294 (Container : aliased Tree'Class) return Reference_Control_Type | 2289 (Container : aliased Tree'Class) return Reference_Control_Type |
2295 is | 2290 is |
2296 TC : constant Tamper_Counts_Access := Container.TC'Unrestricted_Access; | 2291 TC : constant Tamper_Counts_Access := Container.TC'Unrestricted_Access; |
2297 begin | 2292 begin |
2298 return R : constant Reference_Control_Type := (Controlled with TC) do | 2293 return R : constant Reference_Control_Type := (Controlled with TC) do |
2299 Lock (TC.all); | 2294 Busy (TC.all); |
2300 end return; | 2295 end return; |
2301 end Pseudo_Reference; | 2296 end Pseudo_Reference; |
2302 | 2297 |
2303 ------------------- | 2298 ------------------- |
2304 -- Query_Element -- | 2299 -- Query_Element -- |
2493 begin | 2488 begin |
2494 return R : constant Reference_Type := | 2489 return R : constant Reference_Type := |
2495 (Element => Container.Elements (Position.Node)'Access, | 2490 (Element => Container.Elements (Position.Node)'Access, |
2496 Control => (Controlled with TC)) | 2491 Control => (Controlled with TC)) |
2497 do | 2492 do |
2498 Lock (TC.all); | 2493 Busy (TC.all); |
2499 end return; | 2494 end return; |
2500 end; | 2495 end; |
2501 end Reference; | 2496 end Reference; |
2502 | 2497 |
2503 -------------------- | 2498 -------------------- |