111
|
1 -- F340A000.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 -- => F340A000.A
|
|
34 -- F340A001.A
|
|
35 --
|
|
36 -- CHANGE HISTORY:
|
|
37 -- 06 Dec 94 SAIC ACVC 2.0
|
|
38 -- 12 Jun 96 SAIC ACVC 2.1: Modified prologue. Added pragma
|
|
39 -- Elaborate_Body.
|
|
40 --
|
|
41 --!
|
|
42
|
|
43 generic -- Singly-linked list abstraction.
|
|
44 type Parent_Type is tagged private; -- Actual is parent
|
|
45 package F340A000 is -- tagged type.
|
|
46
|
|
47 pragma Elaborate_Body;
|
|
48
|
|
49
|
|
50 -- Declarations for visible linked list nodes:
|
|
51
|
|
52 type Node_Type;
|
|
53
|
|
54 type Node_Ptr is access Node_Type;
|
|
55
|
|
56 type Node_Type is new Parent_Type with record -- Record extension
|
|
57 Next : Node_Ptr := null; -- of parent type.
|
|
58 end record;
|
|
59
|
|
60
|
|
61 -- Inherits primitive operations of actual type corresponding
|
|
62 -- to Parent_Type.
|
|
63
|
|
64 -- Add node at head of list.
|
|
65 procedure Add (Item : in Node_Ptr;
|
|
66 Head : in out Node_Ptr);
|
|
67
|
|
68 -- Remove node from head of list and return it.
|
|
69 procedure Remove (Head : in out Node_Ptr;
|
|
70 Item : out Node_Ptr);
|
|
71
|
|
72
|
|
73
|
|
74 -- Declarations for private linked list nodes:
|
|
75
|
|
76 type Priv_Node_Type is new Parent_Type with private; -- Private extension
|
|
77 -- of parent type.
|
|
78
|
|
79 -- Inherits primitive operations of actual parameter corresponding
|
|
80 -- to Parent_Type.
|
|
81
|
|
82
|
|
83 type Priv_Node_Ptr is access Priv_Node_Type;
|
|
84
|
|
85
|
|
86 -- Add node at head of list.
|
|
87 procedure Add (Item : in Priv_Node_Ptr;
|
|
88 Head : in out Priv_Node_Ptr);
|
|
89
|
|
90 -- Remove node from head of list and return it.
|
|
91 procedure Remove (Head : in out Priv_Node_Ptr;
|
|
92 Item : out Priv_Node_Ptr);
|
|
93
|
|
94
|
|
95 private
|
|
96
|
|
97 type Priv_Node_Type is new Parent_Type with record
|
|
98 Next : Priv_Node_Ptr := null;
|
|
99 end record;
|
|
100
|
|
101 end F340A000;
|
|
102
|
|
103
|
|
104 --==================================================================--
|
|
105
|
|
106
|
|
107 package body F340A000 is -- Singly-linked list abstraction.
|
|
108
|
|
109 procedure Add (Item : in Node_Ptr;
|
|
110 Head : in out Node_Ptr) is
|
|
111 begin
|
|
112 if Item /= null then
|
|
113 Item.Next := Head;
|
|
114 Head := Item;
|
|
115 end if;
|
|
116 end Add;
|
|
117
|
|
118
|
|
119 procedure Remove (Head : in out Node_Ptr;
|
|
120 Item : out Node_Ptr) is
|
|
121 begin
|
|
122 Item := Head;
|
|
123 if Head /= null then
|
|
124 Head := Head.Next;
|
|
125 end if;
|
|
126 end Remove;
|
|
127
|
|
128
|
|
129 procedure Add (Item : in Priv_Node_Ptr;
|
|
130 Head : in out Priv_Node_Ptr) is
|
|
131 begin
|
|
132 if Item /= null then
|
|
133 Item.Next := Head;
|
|
134 Head := Item;
|
|
135 end if;
|
|
136 end Add;
|
|
137
|
|
138
|
|
139 procedure Remove (Head : in out Priv_Node_Ptr;
|
|
140 Item : out Priv_Node_Ptr) is
|
|
141 begin
|
|
142 Item := Head;
|
|
143 if Head /= null then
|
|
144 Head := Head.Next;
|
|
145 end if;
|
|
146 end Remove;
|
|
147
|
|
148
|
|
149 end F340A000;
|