2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / ada / acats / tests / c3 / c390a030.a
blob51554a49adcc75abdb8d8a75b134d686480d73a7
1 -- C390A030.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 -- OBJECTIVE:
27 -- See C390A031.AM.
29 -- TEST DESCRIPTION:
30 -- See C390A031.AM.
31 --
32 -- TEST FILES:
33 -- This test consists of the following files:
35 -- F390A00.A
36 -- => C390A030.A
37 -- C390A031.AM
40 -- CHANGE HISTORY:
41 -- 06 Dec 94 SAIC ACVC 2.0
42 -- 04 Jun 96 SAIC ACVC 2.1: Modified prologue.
44 --!
46 with F390A00; -- Alert system abstraction.
47 package C390A030 is
50 type Low_Alert_Type is new F390A00.Alert_Type -- Private extension of
51 with private; -- root tagged type.
53 -- Inherits procedure Display from Alert_Type.
55 procedure Handle (LA : in out Low_Alert_Type); -- Override parent's
56 -- primitive subprog.
58 function Level_Of (LA : in Low_Alert_Type) -- To be inherited by
59 return Integer; -- all derivatives.
62 -- The following two functions are needed to verify the values of the
63 -- extension's private components.
65 function Initial_Values_Okay (LA : in Low_Alert_Type)
66 return Boolean;
68 function Bad_Final_Values (LA : in Low_Alert_Type)
69 return Boolean;
72 -- Declarations used by private extension component.
74 type Person_Enum is (Nobody, Duty_Officer,
75 Watch_Commander, Commanding_Officer);
78 type Medium_Alert_Type is new Low_Alert_Type -- Private extension of
79 with private; -- private extension.
81 -- Inherits (inherited) procedure Display from Low_Alert_Type.
82 -- Inherits function Level_Of from Low_Alert_Type.
84 procedure Handle (MA : in out Medium_Alert_Type); -- Override parent's
85 -- primitive subprog.
87 procedure Assign_Officer (MA : in out Medium_Alert_Type;
88 To : in Person_Enum);
91 -- The following two functions are needed to verify the values of the
92 -- extension's private components.
94 function Initial_Values_Okay (MA : in Medium_Alert_Type)
95 return Boolean; -- Override parent's
96 -- operation.
98 function Bad_Final_Values (MA : in Medium_Alert_Type)
99 return Boolean; -- Override parent's
100 -- operation.
102 private
104 type Low_Alert_Type is new F390A00.Alert_Type with record
105 Level : Integer := 0;
106 end record;
109 type Medium_Alert_Type is new Low_Alert_Type with record
110 Action_Officer : Person_Enum := Nobody;
111 end record;
113 end C390A030;
116 --==================================================================--
119 package body C390A030 is
121 use F390A00; -- Alert system abstraction.
124 function Level_Of (LA : in Low_Alert_Type) return Integer is
125 begin
126 return (LA.Level + 1);
127 end Level_Of;
130 procedure Handle (LA : in out Low_Alert_Type) is
131 begin
132 Handle (Alert_Type (LA)); -- Call parent's operation (type conversion).
133 LA.Level := Level_Of (LA); -- Call newly declared operation.
134 LA.Display_On := Teletype;
135 Display (LA); -- Call inherited operation.
136 end Handle;
139 function Initial_Values_Okay (LA : in Low_Alert_Type) return Boolean is
140 begin
141 return (LA = (Arrival_Time => Default_Time, -- Check "=" operator
142 Display_On => Null_Device, -- availability.
143 Level => 0)); -- Aggregate with
144 end Initial_Values_Okay; -- named associations.
147 function Bad_Final_Values (LA : in Low_Alert_Type) return Boolean is
148 begin
149 return (LA /= (Alert_Time, Teletype, 1)); -- Check "/=" operator
150 -- availability.
151 end Bad_Final_Values; -- Aggregate with
152 -- positional assoc.
154 procedure Assign_Officer (MA : in out Medium_Alert_Type;
155 To : in Person_Enum) is
156 begin
157 MA.Action_Officer := To;
158 end Assign_Officer;
161 procedure Handle (MA : in out Medium_Alert_Type) is
162 begin
163 Handle (Low_Alert_Type (MA)); -- Call parent's op (type conversion).
164 MA.Level := Level_Of (MA); -- Call inherited operation.
165 Assign_Officer (MA, Duty_Officer); -- Call newly declared operation.
166 MA.Display_On := Console;
167 Display (MA); -- Call twice-inherited operation.
168 end Handle;
171 function Initial_Values_Okay (MA : in Medium_Alert_Type) return Boolean is
172 begin
173 -- Call parent's operation (type conversion).
174 return (Initial_Values_Okay (Low_Alert_Type (MA)) and
175 MA.Action_Officer = Nobody);
176 end Initial_Values_Okay;
179 function Bad_Final_Values (MA : in Medium_Alert_Type) return Boolean is
180 begin
181 return not (MA = (Arrival_Time => Alert_Time, -- Check "=" operator
182 Display_On => Console, -- availability.
183 Level => 2, -- Aggregate with
184 Action_Officer => Duty_Officer));-- named associations.
185 end Bad_Final_Values;
188 end C390A030;