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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [ada/] [acats/] [tests/] [cc/] [cc1304b.ada] - Blame information for rev 816

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
-- CC1304B.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
-- OBJECTIVE:
26
--     CHECK THAT GENERIC FORMAL SUBPROGRAMS MAY HAVE A PARAMETER
27
--     OF A GENERIC FORMAL TYPE, AND MAY RETURN A GENERIC FORMAL
28
--     TYPE.  CHECK MODES IN OUT AND OUT.
29
 
30
-- HISTORY:
31
--     BCB 08/04/88  CREATED ORIGINAL TEST.
32
 
33
WITH REPORT; USE REPORT;
34
 
35
PROCEDURE CC1304B IS
36
 
37
BEGIN
38
     TEST ("CC1304B", "GENERIC FORMAL SUBPROGRAMS MAY HAVE A " &
39
                      "PARAMETER OF A GENERIC FORMAL TYPE, AND MAY  " &
40
                      "RETURN A GENERIC FORMAL TYPE.  CHECK MODES IN " &
41
                      "OUT AND OUT");
42
 
43
     DECLARE
44
          GENERIC
45
               TYPE T IS ( <> );
46
               WITH PROCEDURE S (P : OUT T);
47
               WITH PROCEDURE P (P : IN OUT T);
48
               WITH FUNCTION L RETURN T;
49
          PROCEDURE PR (PARM1, PARM2, PARM3 : IN OUT T);
50
 
51
          PROCEDURE PR (PARM1, PARM2, PARM3 : IN OUT T) IS
52
          BEGIN
53
               S (P => PARM1);
54
               P (P => PARM2);
55
               PARM3 := L;
56
          END PR;
57
     BEGIN
58
          DECLARE
59
               C : CHARACTER := 'A';
60
               C1 : CHARACTER := 'Y';
61
               C2 : CHARACTER := 'I';
62
               B : BOOLEAN := FALSE;
63
               B1 : BOOLEAN := TRUE;
64
               B2 : BOOLEAN := FALSE;
65
               I : INTEGER := 5;
66
               I1 : INTEGER := 10;
67
               I2 : INTEGER := 0;
68
               TYPE ENUM IS (E1, E2, E3);
69
               F : ENUM := E2;
70
               F1 : ENUM := E1;
71
               F2 : ENUM := E2;
72
 
73
               PROCEDURE FC (P : OUT CHARACTER) IS
74
               BEGIN
75
                    P := 'B';
76
               END FC;
77
 
78
               PROCEDURE FB (P : OUT BOOLEAN) IS
79
               BEGIN
80
                    P := NOT B;
81
               END FB;
82
 
83
               PROCEDURE FI (P : OUT INTEGER) IS
84
               BEGIN
85
                    P :=  I + 1;
86
               END FI;
87
 
88
               PROCEDURE FE (P : OUT ENUM) IS
89
               BEGIN
90
                    P := ENUM'SUCC (F);
91
               END FE;
92
 
93
               PROCEDURE  PC (P : IN OUT CHARACTER) IS
94
               BEGIN
95
                    P := 'Z';
96
               END PC;
97
 
98
               PROCEDURE PB (P : IN OUT BOOLEAN) IS
99
               BEGIN
100
                    P := NOT B1;
101
               END PB;
102
 
103
               PROCEDURE PI (P : IN OUT INTEGER) IS
104
               BEGIN
105
                   P := I1 + 1;
106
               END PI;
107
 
108
               PROCEDURE PE (P : IN OUT ENUM) IS
109
               BEGIN
110
                    P := ENUM'SUCC (F1);
111
               END PE;
112
 
113
               FUNCTION LC RETURN CHARACTER IS
114
               BEGIN
115
                    RETURN 'J';
116
               END LC;
117
 
118
               FUNCTION LB RETURN BOOLEAN IS
119
               BEGIN
120
                    RETURN TRUE;
121
               END LB;
122
 
123
               FUNCTION LI RETURN INTEGER IS
124
               BEGIN
125
                    RETURN IDENT_INT(5);
126
               END LI;
127
 
128
               FUNCTION LE RETURN ENUM IS
129
               BEGIN
130
                    RETURN ENUM'SUCC(F2);
131
               END LE;
132
 
133
               PACKAGE PKG2 IS
134
                    PROCEDURE P1 IS NEW PR (CHARACTER, FC, PC, LC);
135
                    PROCEDURE P2 IS NEW PR (BOOLEAN, FB, PB, LB);
136
                    PROCEDURE P3 IS NEW PR (INTEGER, FI, PI, LI);
137
                    PROCEDURE P4 IS NEW PR (ENUM, FE, PE, LE);
138
               END PKG2;
139
 
140
               PACKAGE BODY PKG2 IS
141
               BEGIN
142
                    P1 (C,C1,C2);
143
                    P2 (B,B1,B2);
144
                    P3 (I,I1,I2);
145
                    P4 (F,F1,F2);
146
               END  PKG2;
147
          BEGIN
148
               IF C /= 'B' OR B /= TRUE OR I /= 6 OR F /= E3 THEN
149
                    FAILED ("SUBPROGRAM PARAMETERS OF FORMAL TYPES - " &
150
                            "MODE OUT");
151
               END IF;
152
 
153
               IF C1 /= 'Z' OR B1 /= FALSE OR I1 /= 11 OR F1 /= E2 THEN
154
                    FAILED ("SUBPROGRAM PARAMETERS OF FORMAL TYPES - " &
155
                            "MODE IN OUT");
156
               END IF;
157
 
158
               IF C2 /= 'J' OR B2 /= TRUE OR I2 /= 5 OR F2 /= E3 THEN
159
                    FAILED ("GENERIC FORMAL SUBPROGRAMS RETURNING A " &
160
                            "GENERIC FORMAL TYPE");
161
               END IF;
162
          END;
163
     END;
164
 
165
     RESULT;
166
END CC1304B;

powered by: WebSVN 2.1.0

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