2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / ada / acats / support / f340a000.a
bloba3daf96b5519ca1bba08837a5c7f656142c6e799
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.
16 -- DISCLAIMER
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 --*
26 -- FOUNDATION DESCRIPTION:
27 -- This file simulates a generic linked list abstraction for use in tests
28 -- covering tagged types and type extensions.
30 -- TEST FILES:
31 -- This foundation consists of the following files:
33 -- => F340A000.A
34 -- F340A001.A
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.
41 --!
43 generic -- Singly-linked list abstraction.
44 type Parent_Type is tagged private; -- Actual is parent
45 package F340A000 is -- tagged type.
47 pragma Elaborate_Body;
50 -- Declarations for visible linked list nodes:
52 type Node_Type;
54 type Node_Ptr is access Node_Type;
56 type Node_Type is new Parent_Type with record -- Record extension
57 Next : Node_Ptr := null; -- of parent type.
58 end record;
61 -- Inherits primitive operations of actual type corresponding
62 -- to Parent_Type.
64 -- Add node at head of list.
65 procedure Add (Item : in Node_Ptr;
66 Head : in out Node_Ptr);
68 -- Remove node from head of list and return it.
69 procedure Remove (Head : in out Node_Ptr;
70 Item : out Node_Ptr);
74 -- Declarations for private linked list nodes:
76 type Priv_Node_Type is new Parent_Type with private; -- Private extension
77 -- of parent type.
79 -- Inherits primitive operations of actual parameter corresponding
80 -- to Parent_Type.
83 type Priv_Node_Ptr is access Priv_Node_Type;
86 -- Add node at head of list.
87 procedure Add (Item : in Priv_Node_Ptr;
88 Head : in out Priv_Node_Ptr);
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);
95 private
97 type Priv_Node_Type is new Parent_Type with record
98 Next : Priv_Node_Ptr := null;
99 end record;
101 end F340A000;
104 --==================================================================--
107 package body F340A000 is -- Singly-linked list abstraction.
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;
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;
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;
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;
149 end F340A000;