annotate gcc/testsuite/ada/acats/tests/c3/c393007.a @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 -- C393007.A
kono
parents:
diff changeset
2 --
kono
parents:
diff changeset
3 -- Grant of Unlimited Rights
kono
parents:
diff changeset
4 --
kono
parents:
diff changeset
5 -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
kono
parents:
diff changeset
6 -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
kono
parents:
diff changeset
7 -- unlimited rights in the software and documentation contained herein.
kono
parents:
diff changeset
8 -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
kono
parents:
diff changeset
9 -- this public release, the Government intends to confer upon all
kono
parents:
diff changeset
10 -- recipients unlimited rights equal to those held by the Government.
kono
parents:
diff changeset
11 -- These rights include rights to use, duplicate, release or disclose the
kono
parents:
diff changeset
12 -- released technical data and computer software in whole or in part, in
kono
parents:
diff changeset
13 -- any manner and for any purpose whatsoever, and to have or permit others
kono
parents:
diff changeset
14 -- to do so.
kono
parents:
diff changeset
15 --
kono
parents:
diff changeset
16 -- DISCLAIMER
kono
parents:
diff changeset
17 --
kono
parents:
diff changeset
18 -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
kono
parents:
diff changeset
19 -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
kono
parents:
diff changeset
20 -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
kono
parents:
diff changeset
21 -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
kono
parents:
diff changeset
22 -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
kono
parents:
diff changeset
23 -- PARTICULAR PURPOSE OF SAID MATERIAL.
kono
parents:
diff changeset
24 --*
kono
parents:
diff changeset
25 --
kono
parents:
diff changeset
26 -- TEST OBJECTIVE:
kono
parents:
diff changeset
27 -- Check that an extended type can be derived from an abstract type,
kono
parents:
diff changeset
28 -- where the abstract type is defined in a package, and the type derived
kono
parents:
diff changeset
29 -- from it is defined in a distinct library package.
kono
parents:
diff changeset
30 --
kono
parents:
diff changeset
31 -- TEST DESCRIPTION:
kono
parents:
diff changeset
32 -- Declare an private (abstract) type; declare two primitive operations
kono
parents:
diff changeset
33 -- of the type that are explicitly abstract.
kono
parents:
diff changeset
34 -- Derive an extended type from the (private) abstract type, overriding
kono
parents:
diff changeset
35 -- both of the primitive operations.
kono
parents:
diff changeset
36 -- This test also checks to see that name overloading between abstract
kono
parents:
diff changeset
37 -- and non-abstract functions is resolved correctly.
kono
parents:
diff changeset
38 --
kono
parents:
diff changeset
39 --
kono
parents:
diff changeset
40 -- CHANGE HISTORY:
kono
parents:
diff changeset
41 -- 06 Dec 94 SAIC ACVC 2.0
kono
parents:
diff changeset
42 --
kono
parents:
diff changeset
43 --!
kono
parents:
diff changeset
44
kono
parents:
diff changeset
45 package C393007_0 is
kono
parents:
diff changeset
46 -- Alert_System
kono
parents:
diff changeset
47
kono
parents:
diff changeset
48 type DT_Type is new Integer;
kono
parents:
diff changeset
49
kono
parents:
diff changeset
50 type Alert_Type is abstract tagged record
kono
parents:
diff changeset
51 Time_Of_Arrival : DT_Type;
kono
parents:
diff changeset
52 end record;
kono
parents:
diff changeset
53
kono
parents:
diff changeset
54 type Log_File_Type is range 0 .. 100;
kono
parents:
diff changeset
55
kono
parents:
diff changeset
56 Procedure Handle (A : in out Alert_type) is abstract;
kono
parents:
diff changeset
57
kono
parents:
diff changeset
58 procedure Log (A : Alert_Type;
kono
parents:
diff changeset
59 L : in out Log_File_Type) is abstract;
kono
parents:
diff changeset
60
kono
parents:
diff changeset
61 procedure Set_Time (A : in out Alert_Type);
kono
parents:
diff changeset
62
kono
parents:
diff changeset
63 function Correct_Time_Stamp (A : Alert_Type) return Boolean;
kono
parents:
diff changeset
64
kono
parents:
diff changeset
65 Day_Time : DT_Type := 100;
kono
parents:
diff changeset
66
kono
parents:
diff changeset
67 end C393007_0;
kono
parents:
diff changeset
68 -- Alert_System;
kono
parents:
diff changeset
69
kono
parents:
diff changeset
70 --=======================================================================--
kono
parents:
diff changeset
71
kono
parents:
diff changeset
72 package body C393007_0 is
kono
parents:
diff changeset
73 -- Alert_System
kono
parents:
diff changeset
74
kono
parents:
diff changeset
75 function Time_Stamp return DT_Type is
kono
parents:
diff changeset
76 begin
kono
parents:
diff changeset
77 Day_Time := Day_Time + 1;
kono
parents:
diff changeset
78 return Day_Time;
kono
parents:
diff changeset
79 end Time_Stamp;
kono
parents:
diff changeset
80
kono
parents:
diff changeset
81 procedure Set_Time (A : in out Alert_Type) is
kono
parents:
diff changeset
82 begin
kono
parents:
diff changeset
83 A.Time_Of_Arrival := Time_Stamp;
kono
parents:
diff changeset
84 end Set_time;
kono
parents:
diff changeset
85
kono
parents:
diff changeset
86 function Correct_Time_Stamp ( A : Alert_Type) return Boolean is
kono
parents:
diff changeset
87 begin
kono
parents:
diff changeset
88 return (A.Time_Of_Arrival = Day_Time);
kono
parents:
diff changeset
89 end Correct_Time_Stamp;
kono
parents:
diff changeset
90
kono
parents:
diff changeset
91 end C393007_0;
kono
parents:
diff changeset
92 -- Alert_System;
kono
parents:
diff changeset
93
kono
parents:
diff changeset
94 --=======================================================================--
kono
parents:
diff changeset
95
kono
parents:
diff changeset
96 with Report;
kono
parents:
diff changeset
97 with C393007_0;
kono
parents:
diff changeset
98 -- Alert_system;
kono
parents:
diff changeset
99
kono
parents:
diff changeset
100 package C393007_1 is
kono
parents:
diff changeset
101
kono
parents:
diff changeset
102 type Normal_Alert_Type is
kono
parents:
diff changeset
103 new C393007_0.Alert_Type
kono
parents:
diff changeset
104 with null record;
kono
parents:
diff changeset
105
kono
parents:
diff changeset
106 Log_File: C393007_0.Log_File_Type := C393007_0.Log_File_Type'First;
kono
parents:
diff changeset
107
kono
parents:
diff changeset
108 procedure Handle (A : in out Normal_Alert_Type); -- Override is required
kono
parents:
diff changeset
109
kono
parents:
diff changeset
110 procedure Log (A : Normal_Alert_Type; -- Override is required
kono
parents:
diff changeset
111 L : in out C393007_0.Log_File_Type);
kono
parents:
diff changeset
112 end C393007_1;
kono
parents:
diff changeset
113
kono
parents:
diff changeset
114 package body C393007_1 is
kono
parents:
diff changeset
115 use type C393007_0.Log_File_Type;
kono
parents:
diff changeset
116
kono
parents:
diff changeset
117 procedure Handle (A : in out Normal_Alert_Type) is
kono
parents:
diff changeset
118 begin
kono
parents:
diff changeset
119 Set_Time (A);
kono
parents:
diff changeset
120 Log (A, Log_File);
kono
parents:
diff changeset
121 end Handle;
kono
parents:
diff changeset
122
kono
parents:
diff changeset
123 procedure Log (A : Normal_Alert_Type;
kono
parents:
diff changeset
124 L : in out C393007_0.Log_File_Type) is
kono
parents:
diff changeset
125 begin
kono
parents:
diff changeset
126 L := C393007_0."+"(L, 1);
kono
parents:
diff changeset
127 end Log;
kono
parents:
diff changeset
128
kono
parents:
diff changeset
129 end C393007_1;
kono
parents:
diff changeset
130
kono
parents:
diff changeset
131 with Report;
kono
parents:
diff changeset
132 with C393007_0;
kono
parents:
diff changeset
133 with C393007_1;
kono
parents:
diff changeset
134 -- Alert_system;
kono
parents:
diff changeset
135
kono
parents:
diff changeset
136 procedure C393007 is
kono
parents:
diff changeset
137 use C393007_0;
kono
parents:
diff changeset
138 use C393007_1;
kono
parents:
diff changeset
139
kono
parents:
diff changeset
140 Alert_One : C393007_1.Normal_Alert_Type;
kono
parents:
diff changeset
141
kono
parents:
diff changeset
142 begin
kono
parents:
diff changeset
143 Report.Test ("C393007", "Check that an extended type can be derived " &
kono
parents:
diff changeset
144 "from an abstract type");
kono
parents:
diff changeset
145
kono
parents:
diff changeset
146 Handle (Alert_One);
kono
parents:
diff changeset
147 if not Correct_Time_Stamp (Alert_One) then
kono
parents:
diff changeset
148 Report.Failed ("Wrong results from procedure Handle");
kono
parents:
diff changeset
149 end if;
kono
parents:
diff changeset
150
kono
parents:
diff changeset
151 if Log_File /=1 then
kono
parents:
diff changeset
152 Report.Failed ("Wrong results");
kono
parents:
diff changeset
153 end if;
kono
parents:
diff changeset
154
kono
parents:
diff changeset
155 Report.Result;
kono
parents:
diff changeset
156
kono
parents:
diff changeset
157 end C393007;