| 1 |
-- F730A000.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 file simulates a generic linked list abstraction for use in tests |
| 28 |
-- covering tagged types and type extensions. |
| 29 |
-- |
| 30 |
-- TEST FILES: |
| 31 |
-- This foundation consists of the following files: |
| 32 |
-- |
| 33 |
-- => F730A000.A |
| 34 |
-- F730A001.A |
| 35 |
-- |
| 36 |
-- CHANGE HISTORY: |
| 37 |
-- 06 Dec 94 SAIC ACVC 2.0 |
| 38 |
-- 03 Aug 96 SAIC ACVC 2.1: Modified prologue. Added pragma |
| 39 |
-- Elaborate_Body. Removed extraneous record |
| 40 |
-- extension. |
| 41 |
-- |
| 42 |
--! |
| 43 |
|
| 44 |
generic -- Singly-linked list abstraction. |
| 45 |
type Parent_Type is tagged private; -- Actual is parent |
| 46 |
package F730A000 is -- tagged type. |
| 47 |
|
| 48 |
pragma Elaborate_Body; |
| 49 |
|
| 50 |
|
| 51 |
-- Declarations for private linked list nodes: |
| 52 |
|
| 53 |
type Priv_Node_Type is new Parent_Type with private; -- Private extension |
| 54 |
-- of parent type. |
| 55 |
|
| 56 |
-- Inherits primitive operations of actual parameter corresponding |
| 57 |
-- to Parent_Type. |
| 58 |
|
| 59 |
|
| 60 |
type Priv_Node_Ptr is access Priv_Node_Type; |
| 61 |
|
| 62 |
|
| 63 |
-- Add node at head of list. |
| 64 |
procedure Add (Item : in Priv_Node_Ptr; |
| 65 |
Head : in out Priv_Node_Ptr); |
| 66 |
|
| 67 |
-- Remove node from head of list and return it. |
| 68 |
procedure Remove (Head : in out Priv_Node_Ptr; |
| 69 |
Item : out Priv_Node_Ptr); |
| 70 |
|
| 71 |
|
| 72 |
private |
| 73 |
|
| 74 |
type Priv_Node_Type is new Parent_Type with record |
| 75 |
Next : Priv_Node_Ptr := null; |
| 76 |
end record; |
| 77 |
|
| 78 |
end F730A000; |
| 79 |
|
| 80 |
|
| 81 |
--==================================================================-- |
| 82 |
|
| 83 |
|
| 84 |
package body F730A000 is -- Singly-linked list abstraction. |
| 85 |
|
| 86 |
|
| 87 |
procedure Add (Item : in Priv_Node_Ptr; |
| 88 |
Head : in out Priv_Node_Ptr) is |
| 89 |
begin |
| 90 |
if Item /= null then |
| 91 |
Item.Next := Head; |
| 92 |
Head := Item; |
| 93 |
end if; |
| 94 |
end Add; |
| 95 |
|
| 96 |
|
| 97 |
procedure Remove (Head : in out Priv_Node_Ptr; |
| 98 |
Item : out Priv_Node_Ptr) is |
| 99 |
begin |
| 100 |
Item := Head; |
| 101 |
if Head /= null then |
| 102 |
Head := Head.Next; |
| 103 |
end if; |
| 104 |
end Remove; |
| 105 |
|
| 106 |
|
| 107 |
end F730A000; |