| 1 |
-- FC70C00.A |
| 2 |
-- |
| 3 |
-- Grant of Unlimited Rights |
| 4 |
-- |
| 5 |
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687, |
| 6 |
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained |
| 7 |
-- unlimited rights in the software and documentation contained herein. |
| 8 |
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making |
| 9 |
-- this public release, the Government intends to confer upon all |
| 10 |
-- recipients unlimited rights equal to those held by the Government. |
| 11 |
-- These rights include rights to use, duplicate, release or disclose the |
| 12 |
-- released technical data and computer software in whole or in part, in |
| 13 |
-- any manner and for any purpose whatsoever, and to have or permit others |
| 14 |
-- to do so. |
| 15 |
-- |
| 16 |
-- DISCLAIMER |
| 17 |
-- |
| 18 |
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR |
| 19 |
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED |
| 20 |
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE |
| 21 |
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE |
| 22 |
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A |
| 23 |
-- PARTICULAR PURPOSE OF SAID MATERIAL. |
| 24 |
--* |
| 25 |
-- |
| 26 |
-- FOUNDATION DESCRIPTION: |
| 27 |
-- This foundation defines a generic list abstraction in two packages. |
| 28 |
-- The first package declares the types, the second declares the |
| 29 |
-- operations. List elements can be of any (nonlimited) type. Lists are |
| 30 |
-- implemented as singly linked lists. Access to list elements is |
| 31 |
-- sequential. For each list, pointers are maintained to the first and |
| 32 |
-- last elements in the list, as well as the next element to be accessed. |
| 33 |
-- |
| 34 |
-- CHANGE HISTORY: |
| 35 |
-- 06 Dec 94 SAIC ACVC 2.0 |
| 36 |
-- |
| 37 |
--! |
| 38 |
|
| 39 |
generic |
| 40 |
type Element_Type is private; -- List elems may be of any nonlimited type. |
| 41 |
package FC70C00_0 is -- List abstraction. |
| 42 |
|
| 43 |
type Node_Type; |
| 44 |
type Node_Pointer is access Node_Type; |
| 45 |
|
| 46 |
type Node_Type is record |
| 47 |
Item : Element_Type; |
| 48 |
Next : Node_Pointer; |
| 49 |
end record; |
| 50 |
|
| 51 |
type List_Type is record |
| 52 |
First : Node_Pointer; |
| 53 |
Current : Node_Pointer; |
| 54 |
Last : Node_Pointer; |
| 55 |
end record; |
| 56 |
|
| 57 |
end FC70C00_0; |
| 58 |
|
| 59 |
|
| 60 |
--==================================================================-- |
| 61 |
|
| 62 |
|
| 63 |
-- No body for FC70C00_0; |
| 64 |
|
| 65 |
|
| 66 |
--==================================================================-- |
| 67 |
|
| 68 |
|
| 69 |
with FC70C00_0; -- List abstraction. |
| 70 |
generic |
| 71 |
with package List_Mgr is new FC70C00_0 (<>); |
| 72 |
package FC70C00_1 is -- Basic list operations. |
| 73 |
|
| 74 |
-- Return true if current element is last in the list. |
| 75 |
function End_Of_List (L : List_Mgr.List_Type) return Boolean; |
| 76 |
|
| 77 |
-- Set "current" pointer to first list element. |
| 78 |
procedure Reset (L : in out List_Mgr.List_Type); |
| 79 |
|
| 80 |
end FC70C00_1; |
| 81 |
|
| 82 |
|
| 83 |
--==================================================================-- |
| 84 |
|
| 85 |
|
| 86 |
package body FC70C00_1 is |
| 87 |
|
| 88 |
function End_Of_List (L : List_Mgr.List_Type) return Boolean is |
| 89 |
use List_Mgr; -- Renders "=" directly visible. |
| 90 |
begin |
| 91 |
return (L.Current = null); |
| 92 |
end End_Of_List; |
| 93 |
|
| 94 |
|
| 95 |
procedure Reset (L : in out List_Mgr.List_Type) is |
| 96 |
begin |
| 97 |
L.Current := L.First; -- Set "current" pointer to first |
| 98 |
end Reset; -- list element. |
| 99 |
|
| 100 |
end FC70C00_1; |