OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [ada/] [acats/] [tests/] [a/] [a87b59a.ada] - Blame information for rev 294

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 294 jeremybenn
-- A87B59A.ADA
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
-- CHECK THAT BECAUSE A GENERIC ACTUAL PROGRAM PARAMETER MUST BE A 
26
-- SUBPROGRAM, AN ENUMERATION LITERAL, OR AN ENTRY WITH THE SAME 
27
-- PARAMETER AND RESULT TYPE PROFILE AS THE FORMAL PARAMETER, AN 
28
-- OVERLOADED NAME APPEARING AS AN ACTUAL PARAMETER CAN BE RESOLVED.
29
 
30
-- R.WILLIAMS 9/24/86
31
 
32
WITH REPORT; USE REPORT;
33
PROCEDURE A87B59A IS
34
 
35
BEGIN
36
     TEST ( "A87B59A", "CHECK THAT BECAUSE A GENERIC ACTUAL PROGRAM " &
37
                       "PARAMETER MUST BE A SUBPROGRAM, AN " &
38
                       "ENUMERATION LITERAL, OR AN ENTRY WITH THE " &
39
                       "SAME PARAMETER AND RESULT TYPE PROFILE AS " &
40
                       "THE FORMAL PARAMETER, AN OVERLOADED NAME " &
41
                       "APPEARING AS AN ACTUAL PARAMETER CAN BE " &
42
                       "RESOLVED" );
43
 
44
     DECLARE -- A.
45
          FUNCTION F1 RETURN INTEGER IS
46
          BEGIN
47
               RETURN IDENT_INT (0);
48
          END F1;
49
 
50
          FUNCTION F1 RETURN BOOLEAN IS
51
          BEGIN
52
               RETURN IDENT_BOOL (TRUE);
53
          END F1;
54
 
55
          GENERIC
56
               TYPE T IS (<>);
57
               WITH FUNCTION F RETURN T;
58
          PROCEDURE P;
59
 
60
          PROCEDURE P IS
61
          BEGIN
62
               NULL;
63
          END P;
64
 
65
          PROCEDURE P1 IS NEW P (INTEGER, F1);
66
          PROCEDURE P2 IS NEW P (BOOLEAN, F1);
67
 
68
     BEGIN
69
          P1;
70
          P2;
71
     END; -- A.
72
 
73
     DECLARE -- B.
74
          FUNCTION F1 (X : INTEGER; B : BOOLEAN) RETURN INTEGER IS
75
          BEGIN
76
               RETURN IDENT_INT (X);
77
          END F1;
78
 
79
          FUNCTION F1 (X : INTEGER; B : BOOLEAN) RETURN BOOLEAN IS
80
          BEGIN
81
               RETURN IDENT_BOOL (B);
82
          END F1;
83
 
84
          FUNCTION F1 (B : BOOLEAN; X : INTEGER) RETURN BOOLEAN IS
85
          BEGIN
86
               RETURN IDENT_BOOL (B);
87
          END F1;
88
 
89
          GENERIC
90
               TYPE T1 IS (<>);
91
               TYPE T2 IS (<>);
92
               WITH FUNCTION F (A : T1; B : T2) RETURN T1;
93
          PROCEDURE P1;
94
 
95
          PROCEDURE P1 IS
96
          BEGIN
97
               NULL;
98
          END P1;
99
 
100
          GENERIC
101
               TYPE T1 IS (<>);
102
               TYPE T2 IS (<>);
103
               WITH FUNCTION F (A : T1; B : T2) RETURN T2;
104
          PROCEDURE P2;
105
 
106
          PROCEDURE P2 IS
107
          BEGIN
108
               NULL;
109
          END P2;
110
 
111
          PROCEDURE PROC1 IS NEW P1 (INTEGER, BOOLEAN, F1);
112
          PROCEDURE PROC2 IS NEW P1 (BOOLEAN, INTEGER, F1);
113
          PROCEDURE PROC3 IS NEW P2 (INTEGER, BOOLEAN, F1);
114
 
115
     BEGIN
116
          PROC1;
117
          PROC2;
118
     END; -- B.
119
 
120
     DECLARE -- C.
121
          TYPE COLOR IS (RED, YELLOW, BLUE);
122
          C : COLOR;
123
 
124
          TYPE LIGHT IS (RED, YELLOW, GREEN);
125
          L : LIGHT;
126
 
127
          GENERIC
128
               TYPE T IS (<>);
129
               WITH FUNCTION F RETURN T;
130
          FUNCTION GF RETURN T;
131
 
132
          FUNCTION GF RETURN T IS
133
          BEGIN
134
               RETURN T'VAL (IDENT_INT (T'POS (F)));
135
          END GF;
136
 
137
          FUNCTION F1 IS NEW GF (COLOR, RED);
138
          FUNCTION F2 IS NEW GF (LIGHT, YELLOW);
139
     BEGIN
140
          C := F1;
141
          L := F2;
142
     END; -- C.
143
 
144
     DECLARE -- D.
145
          TASK TK IS
146
               ENTRY E (X : INTEGER);
147
               ENTRY E (X : BOOLEAN);
148
               ENTRY E (X : INTEGER; Y : BOOLEAN);
149
               ENTRY E (X : BOOLEAN; Y : INTEGER);
150
          END TK;
151
 
152
          TASK BODY TK IS
153
          BEGIN
154
               LOOP
155
                    SELECT
156
                         ACCEPT E (X : INTEGER);
157
                    OR
158
                         ACCEPT E (X : BOOLEAN);
159
                    OR
160
                         ACCEPT E (X : INTEGER; Y : BOOLEAN);
161
                    OR
162
                         ACCEPT E (X : BOOLEAN; Y : INTEGER);
163
                    OR
164
                         TERMINATE;
165
                    END SELECT;
166
               END LOOP;
167
          END TK;
168
 
169
          GENERIC
170
               TYPE T1 IS (<>);
171
               TYPE T2 IS (<>);
172
               WITH PROCEDURE P1 (X : T1);
173
               WITH PROCEDURE P2 (X : T1; Y : T2);
174
          PACKAGE PKG IS
175
               PROCEDURE P;
176
          END PKG;
177
 
178
          PACKAGE BODY PKG IS
179
               PROCEDURE P IS
180
               BEGIN
181
                    IF EQUAL (3, 3) THEN
182
                         P1 (T1'VAL (1));
183
                         P2 (T1'VAL (0), T2'VAL (1));
184
                    END IF;
185
               END P;
186
          END PKG;
187
 
188
          PACKAGE PK1 IS NEW PKG (INTEGER, BOOLEAN, TK.E, TK.E);
189
          PACKAGE PK2 IS NEW PKG (BOOLEAN, INTEGER, TK.E, TK.E);
190
 
191
     BEGIN
192
          PK1.P;
193
          PK2.P;
194
     END; -- D.
195
 
196
     DECLARE -- E.
197
          FUNCTION "+" (X, Y : BOOLEAN) RETURN BOOLEAN IS
198
          BEGIN
199
               RETURN IDENT_BOOL (X OR Y);
200
          END "+";
201
 
202
          GENERIC
203
               TYPE T IS (<>);
204
               WITH FUNCTION "+" (X, Y : T) RETURN T;
205
          PROCEDURE P;
206
 
207
          PROCEDURE P IS
208
               S : T;
209
          BEGIN
210
               S := "+" (T'VAL (0), T'VAL (1));
211
          END P;
212
 
213
          PROCEDURE P1 IS NEW P (BOOLEAN, "+");
214
          PROCEDURE P2 IS NEW P (INTEGER, "+");
215
 
216
     BEGIN
217
          P1;
218
          P2;
219
     END; -- E.
220
 
221
     DECLARE -- F.
222
          TYPE ADD_OPS IS ('+', '-', '&');
223
 
224
          GENERIC
225
               TYPE T1 IS (<>);
226
               TYPE T2 IS (<>);
227
               TYPE T3 IS ARRAY (POSITIVE RANGE <> ) OF T2;
228
               X2 : T2;
229
               X3 : T3;
230
               WITH FUNCTION F1 RETURN T1;
231
               WITH FUNCTION F2 (X : T2; Y : T3) RETURN T3;
232
          PROCEDURE P;
233
 
234
          PROCEDURE P IS
235
               A : T1;
236
               S : T3 (IDENT_INT (1) .. IDENT_INT (2));
237
          BEGIN
238
               A := F1;
239
               S := F2 (X2, X3);
240
          END P;
241
 
242
          PROCEDURE P1 IS NEW P (ADD_OPS, CHARACTER, STRING,
243
                                 '&', "&", '&', "&");
244
 
245
     BEGIN
246
          P1;
247
     END; -- F.
248
 
249
     RESULT;
250
END A87B59A;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.