Debian Codegraph @

gcc/testsuite/ada/acats/tests/c3/c3900062.a

raw
1 -- C3900062.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 -- OBJECTIVE:
27 -- See C3900063.AM.
28 --
29 -- TEST DESCRIPTION:
30 -- See C3900063.AM.
31 --
32 -- TEST FILES:
33 -- This test consists of the following files:
34 --
35 -- C3900060.A
36 -- C3900061.A
37 -- => C3900062.A
38 -- C3900063.AM
39 --
40 --
41 -- CHANGE HISTORY:
42 -- 06 Dec 94 SAIC ACVC 2.0
43 -- 04 Jun 96 SAIC ACVC 2.1: Modified prologue. Added pragma Elaborate
44 -- for Ada.Calendar.
45 --
46 --!
47
48 with C3900061; -- Extended alert system abstraction.
49 package C3900062 is -- Further extended alert system abstraction.
50
51
52 -- Declarations used by component Action_Officer;
53
54 type Person_Enum is (Nobody, Duty_Officer,
55 Watch_Commander, Commanding_Officer);
56
57
58 type Medium_Alert_Type is new C3900061.Low_Alert_Type
59 with record -- Record extension of
60 Action_Officer : Person_Enum := Nobody; -- private extension.
61 end record;
62
63
64 -- Inherits (inherited) procedure Display from Low_Alert_Type.
65 -- Inherits function Level_Of from Low_Alert_Type.
66
67 procedure Handle (MA : in out Medium_Alert_Type); -- Override parent's
68 -- primitive subprog.
69
70 procedure Assign_Officer (MA : in out Medium_Alert_Type;
71 To : in Person_Enum);
72
73
74 -- The following functions are needed to verify the values of the
75 -- extension's private components.
76
77 function Initial_Values_Okay (MA : in Medium_Alert_Type)
78 return Boolean; -- Override parent's
79 -- primitive subprog.
80
81 function Bad_Final_Values (MA: in Medium_Alert_Type) -- Override parent's
82 return Boolean; -- primitive subprog.
83
84
85 end C3900062;
86
87
88 --==================================================================--
89
90
91 with C3900060; -- Basic alert abstraction.
92
93 with Ada.Calendar;
94 pragma Elaborate (Ada.Calendar);
95
96 package body C3900062 is
97
98 use C3900060; -- Enumeration values directly visible.
99 use C3900061; -- Extended alert system abstraction.
100
101
102 procedure Assign_Officer (MA : in out Medium_Alert_Type;
103 To : in Person_Enum) is
104 begin
105 MA.Action_Officer := To;
106 end Assign_Officer;
107
108
109 procedure Handle (MA : in out Medium_Alert_Type) is
110 begin
111 Handle (Low_Alert_Type (MA)); -- Call parent's op (type conversion).
112 Set_Level (MA, 2); -- Call inherited operation.
113 Assign_Officer (MA, Duty_Officer); -- Call newly declared operation.
114 Set_Display (MA, Console); -- Call inherited operation.
115 Display (MA); -- Call doubly inherited operation.
116 end Handle;
117
118
119 function Initial_Values_Okay (MA : in Medium_Alert_Type) return Boolean is
120 begin
121 -- Call parent's operation (type conversion).
122 return (Initial_Values_Okay (Low_Alert_Type (MA)) and
123 MA.Action_Officer = Nobody);
124 end Initial_Values_Okay;
125
126
127 function Bad_Final_Values (MA : in Medium_Alert_Type) return Boolean is
128 use type Ada.Calendar.Time;
129 begin
130 return (Get_Time(MA) /= Alert_Time or
131 Get_Display(MA) /= Console or
132 Get_Level(MA) /= 2 or
133 MA.Action_Officer /= Duty_Officer);
134 end Bad_Final_Values;
135
136
137 end C3900062;