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/] [c7/] [c74401d.ada] - Blame information for rev 154

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
-- C74401D.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 AN OUT PARAMETER HAVING A LIMITED TYPE IS ALLOWED FOR
26
-- FORMAL SUBPROGRAM PARAMETERS.  (ONLY THE CASE OF PRACTICAL INTEREST,
27
-- NAMELY, LIMITED PRIVATE TYPES, IS CHECKED HERE.)
28
 
29
-- CHECK THAT AN OUT PARAMETER IN A RENAMING DECLARATION CAN HAVE A
30
-- LIMITED PRIVATE TYPE WHEN IT RENAMES A GENERIC FORMAL SUBPROGRAM.
31
 
32
-- JBG 5/1/85
33
 
34
WITH REPORT; USE REPORT;
35
PROCEDURE C74401D IS
36
 
37
     PACKAGE P IS
38
          TYPE LP IS LIMITED PRIVATE;
39
          PROCEDURE P1 (X : OUT LP);
40
          PROCEDURE P2 (X : OUT LP);
41
          FUNCTION EQ (L, R : LP) RETURN BOOLEAN;
42
          VAL1 : CONSTANT LP;
43
          VAL2 : CONSTANT LP;
44
     PRIVATE
45
          TYPE LP IS NEW INTEGER;
46
          VAL1 : CONSTANT LP := LP(IDENT_INT(3));
47
          VAL2 : CONSTANT LP := LP(IDENT_INT(-3));
48
     END P;
49
 
50
     PACKAGE BODY P IS
51
          PROCEDURE P1 (X : OUT LP) IS
52
          BEGIN
53
               X := 3;
54
          END P1;
55
 
56
          PROCEDURE P2 (X : OUT LP) IS
57
          BEGIN
58
               X := -3;
59
          END P2;
60
 
61
          FUNCTION EQ (L, R : LP) RETURN BOOLEAN IS
62
          BEGIN
63
               RETURN L = R;
64
          END EQ;
65
     END P;
66
 
67
     GENERIC
68
          WITH PROCEDURE P3 (Y : OUT P.LP);
69
          TYPE GLP IS LIMITED PRIVATE;
70
          WITH PROCEDURE P4 (Y : OUT GLP);
71
          VAL_P3 : IN OUT P.LP;
72
          VAL_P4 : IN OUT GLP;
73
     PACKAGE GPACK IS
74
          PROCEDURE RENAMED (X : OUT GLP) RENAMES P4;   -- OK. RENAMING.
75
     END GPACK;
76
 
77
     PACKAGE BODY GPACK IS
78
     BEGIN
79
          P3 (VAL_P3);
80
          P4 (VAL_P4);
81
     END GPACK;
82
 
83
BEGIN
84
 
85
     TEST ("C74401D", "CHECK THAT GENERIC FORMAL SUBPROGRAMS CAN HAVE "&
86
                      "LIMITED PRIVATE OUT PARAMETERS");
87
 
88
     DECLARE
89
          VAR1 : P.LP;
90
          VAR2 : P.LP;
91
          PACKAGE PACK IS NEW GPACK (P.P1, P.LP, P.P2, VAR1, VAR2);
92
     BEGIN
93
          IF NOT P.EQ (VAR1, P.VAL1) THEN
94
               FAILED ("P1 INVOCATION INCORRECT");
95
          END IF;
96
 
97
          IF NOT P.EQ (VAR2, P.VAL2) THEN
98
               FAILED ("P2 INVOCATION INCORRECT");
99
          END IF;
100
 
101
          P.P1 (VAR2);        -- RESET VALUE OF VAR2.
102
          PACK.RENAMED (VAR2);
103
 
104
          IF NOT P.EQ (VAR2, P.VAL2) THEN
105
               FAILED ("RENAMED INVOCATION INCORRECT");
106
          END IF;
107
     END;
108
 
109
     RESULT;
110
 
111
END C74401D;

powered by: WebSVN 2.1.0

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