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/] [cc1304a.ada] - Blame information for rev 816

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
-- CC1304A.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 GENERIC FORMAL SUBPROGRAMS MAY HAVE A PARAMETER
26
-- OF A GENERIC FORMAL TYPE, AND MAY RETURN A GENERIC FORMAL
27
-- TYPE.
28
 
29
-- DAT 8/27/81
30
 
31
WITH REPORT; USE REPORT;
32
 
33
PROCEDURE CC1304A IS
34
BEGIN
35
     TEST ("CC1304A", "GENERIC FORMAL SUBPROGRAMS MAY HAVE PARAMETERS"
36
          & " OF (AND RETURN) A FORMAL TYPE");
37
 
38
     DECLARE
39
          GENERIC
40
               TYPE T IS ( <> );
41
               WITH FUNCTION S (P : T) RETURN T;
42
               WITH PROCEDURE P (P : T);
43
          PROCEDURE PR (PARM : T);
44
 
45
          PROCEDURE PR (PARM: T) IS
46
          BEGIN
47
               P(P=>S(P=>PARM));
48
          END PR;
49
     BEGIN
50
          DECLARE
51
               C : CHARACTER := 'A';
52
               B : BOOLEAN := FALSE;
53
               I : INTEGER := 5;
54
               TYPE ENUM IS (E1, E2, E3);
55
               E : ENUM := E2;
56
 
57
               FUNCTION FC (P : CHARACTER) RETURN CHARACTER IS
58
               BEGIN
59
                    RETURN 'B';
60
               END FC;
61
 
62
               FUNCTION FB (P : BOOLEAN) RETURN BOOLEAN IS
63
               BEGIN
64
                    RETURN NOT P;
65
               END FB;
66
 
67
               FUNCTION FI (P : INTEGER) RETURN INTEGER IS
68
               BEGIN
69
                    RETURN P + 1;
70
               END FI;
71
 
72
               FUNCTION FE (P : ENUM) RETURN ENUM IS
73
               BEGIN
74
                    RETURN ENUM'SUCC (P);
75
               END FE;
76
 
77
               PROCEDURE  PC (P : CHARACTER) IS
78
               BEGIN
79
                    C := P;
80
               END PC;
81
 
82
               PROCEDURE PB (P : BOOLEAN) IS
83
               BEGIN
84
                    B := P;
85
               END PB;
86
 
87
               PROCEDURE PI (P : INTEGER) IS
88
               BEGIN
89
                   I := P;
90
               END PI;
91
 
92
               PROCEDURE PE (P : ENUM) IS
93
               BEGIN
94
                    E := P;
95
               END PE;
96
 
97
               PACKAGE PKG2 IS
98
                    PROCEDURE P1 IS NEW PR (CHARACTER, FC, PC);
99
                    PROCEDURE P2 IS NEW PR (BOOLEAN, FB, PB);
100
                    PROCEDURE P3 IS NEW PR (INTEGER, FI, PI);
101
                    PROCEDURE P4 IS NEW PR (ENUM, FE, PE);
102
               END PKG2;
103
 
104
               PACKAGE BODY PKG2 IS
105
               BEGIN
106
                    P1 (C);
107
                    P2 (B);
108
                    P3 (I);
109
                    P4 (E);
110
               END  PKG2;
111
          BEGIN
112
               IF C /= 'B'
113
               OR B /= TRUE
114
               OR I /= 6
115
               OR E /= E3 THEN
116
                    FAILED ("SUBPROGRAM PARAMETERS OF FORMAL TYPES");
117
               END IF;
118
          END;
119
     END;
120
 
121
     RESULT;
122
END CC1304A;

powered by: WebSVN 2.1.0

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