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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
-- C74401Q.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 OUT PARAMETERS HAVING A LIMITED PRIVATE TYPE CAN BE
26
-- DECLARED FOR A GENERIC SUBPROGRAM IN A PACKAGE SPECIFICATION,
27
-- INCLUDING WITHIN PACKAGES NESTED IN A VISIBLE PART.
28
 
29
-- JBG 5/1/85
30
 
31
WITH REPORT; USE REPORT;
32
PROCEDURE C74401Q IS
33
 
34
     PACKAGE PKG IS
35
          TYPE LP IS LIMITED PRIVATE;
36
 
37
          GENERIC
38
          PROCEDURE P20 (X : OUT LP);        -- OK.
39
          PROCEDURE RESET (X : OUT LP);
40
          FUNCTION EQ (L, R : LP) RETURN BOOLEAN;
41
          VAL1 : CONSTANT LP;
42
 
43
          PACKAGE NESTED IS
44
               GENERIC
45
               PROCEDURE NEST1 (X : OUT LP);
46
          PRIVATE
47
               GENERIC
48
               PROCEDURE NEST2 (X : OUT LP);
49
          END NESTED;
50
     PRIVATE
51
          TYPE LP IS NEW INTEGER;
52
          VAL1 : CONSTANT LP := LP(IDENT_INT(3));
53
     END PKG;
54
 
55
     VAR : PKG.LP;
56
 
57
     PACKAGE BODY PKG IS
58
          PROCEDURE P20 (X : OUT LP) IS
59
          BEGIN
60
               X := 3;
61
          END P20;
62
 
63
          PROCEDURE RESET (X : OUT LP) IS
64
          BEGIN
65
               X := 0;
66
          END RESET;
67
 
68
          FUNCTION EQ (L, R : LP) RETURN BOOLEAN IS
69
          BEGIN
70
               RETURN L = R;
71
          END EQ;
72
 
73
          PACKAGE BODY NESTED IS
74
               PROCEDURE NEST1 (X : OUT LP) IS
75
               BEGIN
76
                    X := 3;
77
               END NEST1;
78
 
79
               PROCEDURE NEST2 (X : OUT LP) IS
80
               BEGIN
81
                    X := LP(IDENT_INT(3));
82
               END NEST2;
83
          END NESTED;
84
     BEGIN
85
          VAR := LP(IDENT_INT(0));
86
     END PKG;
87
 
88
     PACKAGE INSTANCES IS
89
          PROCEDURE NP20 IS NEW PKG.P20;
90
          PROCEDURE NNEST1 IS NEW PKG.NESTED.NEST1;
91
     END INSTANCES;
92
     USE INSTANCES;
93
 
94
     PACKAGE PKG1 IS
95
          PROCEDURE P21 (X : OUT PKG.LP) RENAMES INSTANCES.NP20;
96
     END PKG1;
97
 
98
BEGIN
99
 
100
     TEST ("C74401Q", "CHECK THAT A PROCEDURE CAN HAVE AN OUT " &
101
                      "PARAMETER WITH A LIMITED PRIVATE TYPE");
102
 
103
     PKG.RESET (VAR);
104
     NP20 (VAR);
105
 
106
     IF NOT PKG.EQ (VAR, PKG.VAL1) THEN
107
          FAILED ("DIRECT CALL NOT CORRECT");
108
     END IF;
109
 
110
     PKG.RESET (VAR);
111
     PKG1.P21 (VAR);
112
 
113
     IF NOT PKG.EQ (VAR, PKG.VAL1) THEN
114
          FAILED ("RENAMED CALL NOT CORRECT");
115
     END IF;
116
 
117
     RESULT;
118
 
119
END C74401Q;

powered by: WebSVN 2.1.0

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