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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
-- C62002A.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 THE COMPONENTS OF ACCESS IN PARAMETERS CAN BE USED AS THE
26
--   TARGET OF AN ASSIGNMENT STATEMENT OR AS AN ACTUAL PARAMETER OF
27
--   ANY MODE.  SUBTESTS ARE:
28
--        (A) INTEGER ACCESS TYPE.
29
--        (B) ARRAY ACCESS TYPE.
30
--        (C) RECORD ACCESS TYPE.
31
 
32
-- DAS  1/23/81
33
-- SPS 10/26/82
34
 
35
WITH REPORT;
36
PROCEDURE C62002A IS
37
 
38
     USE REPORT;
39
 
40
BEGIN
41
 
42
     TEST ("C62002A", "CHECK THAT COMPONENTS OF ACCESS IN PARAMETERS" &
43
                      " MAY BE USED IN ASSIGNMENT CONTEXTS");
44
 
45
     --------------------------------------------------
46
 
47
     DECLARE   -- (A)
48
 
49
          TYPE PTRINT IS ACCESS INTEGER;
50
          PI   : PTRINT;
51
 
52
          PROCEDURE PROCA (PI : IN PTRINT) IS
53
 
54
               PROCEDURE PROCA1 (I : OUT INTEGER) IS
55
               BEGIN
56
                    I := 7;
57
               END PROCA1;
58
 
59
               PROCEDURE PROCA2 (I : IN OUT INTEGER) IS
60
               BEGIN
61
                    I := I + 1;
62
               END PROCA2;
63
          BEGIN
64
 
65
               PROCA1 (PI.ALL);
66
               PROCA2 (PI.ALL);
67
               PI.ALL := PI.ALL + 1;
68
               IF (PI.ALL /= 9) THEN
69
                    FAILED ("ASSIGNMENT TO COMPONENT OF INTEGER" &
70
                            " ACCESS PARAMETER FAILED");
71
               END IF;
72
          END PROCA;
73
 
74
     BEGIN     -- (A)
75
 
76
          PI := NEW INTEGER '(0);
77
          PROCA (PI);
78
 
79
     END;      -- (A)
80
 
81
     ---------------------------------------------
82
 
83
     DECLARE   -- (B)
84
 
85
          TYPE TBL IS ARRAY (1..3) OF INTEGER;
86
          TYPE PTRTBL IS ACCESS TBL;
87
          PT   : PTRTBL;
88
 
89
          PROCEDURE PROCB (PT : IN PTRTBL) IS
90
 
91
               PROCEDURE PROCB1 (I : OUT INTEGER) IS
92
               BEGIN
93
                    I := 7;
94
               END  PROCB1;
95
 
96
               PROCEDURE PROCB2 (I : IN OUT INTEGER) IS
97
               BEGIN
98
                    I := I + 1;
99
               END PROCB2;
100
 
101
               PROCEDURE PROCB3 (T : OUT TBL) IS
102
               BEGIN
103
                    T := (1,2,3);
104
               END PROCB3;
105
 
106
               PROCEDURE PROCB4 (T : IN OUT TBL) IS
107
               BEGIN
108
                    T(3) := T(3) - 1;
109
               END PROCB4;
110
 
111
          BEGIN
112
 
113
               PROCB3 (PT.ALL);         -- (1,2,3)
114
               PROCB4 (PT.ALL);         -- (1,2,2)
115
               PROCB1 (PT(2));          -- (1,7,2)
116
               PROCB2 (PT(1));          -- (2,7,2)
117
               PT(3) := PT(3) + 7;      -- (2,7,9)
118
               IF (PT.ALL /= (2,7,9)) THEN
119
                    FAILED ("ASSIGNMENT TO COMPONENT OF ARRAY" &
120
                            " ACCESS PARAMETER FAILED");
121
               END IF;
122
          END PROCB;
123
 
124
     BEGIN     -- (B)
125
 
126
          PT := NEW TBL '(0,0,0);
127
          PROCB (PT);
128
 
129
     END;      -- (B)
130
 
131
     ---------------------------------------------
132
 
133
     DECLARE   -- (C)
134
 
135
          TYPE REC IS
136
               RECORD
137
                    I1   : INTEGER;
138
                    I2   : INTEGER;
139
                    I3   : INTEGER;
140
               END RECORD;
141
          TYPE PTRREC IS ACCESS REC;
142
          PR   : PTRREC;
143
 
144
          PROCEDURE PROCC (PR : IN PTRREC) IS
145
 
146
               PROCEDURE PROCC1 (I : OUT INTEGER) IS
147
               BEGIN
148
                    I := 7;
149
               END  PROCC1;
150
 
151
               PROCEDURE PROCC2 (I : IN OUT INTEGER) IS
152
               BEGIN
153
                    I := I + 1;
154
               END PROCC2;
155
 
156
               PROCEDURE PROCC3 (R : OUT REC) IS
157
               BEGIN
158
                    R := (1,2,3);
159
               END PROCC3;
160
 
161
               PROCEDURE PROCC4 (R : IN OUT REC) IS
162
               BEGIN
163
                    R.I3 := R.I3 - 1;
164
               END PROCC4;
165
 
166
          BEGIN
167
 
168
               PROCC3 (PR.ALL);         -- (1,2,3)
169
               PROCC4 (PR.ALL);         -- (1,2,2)
170
               PROCC1 (PR.I2);          -- (1,7,2)
171
               PROCC2 (PR.I1);          -- (2,7,2)
172
               PR.I3 := PR.I3 + 7;      -- (2,7,9)
173
               IF (PR.ALL /= (2,7,9)) THEN
174
                    FAILED ("ASSIGNMENT TO COMPONENT OF RECORD" &
175
                            " ACCESS PARAMETER FAILED");
176
               END IF;
177
          END PROCC;
178
 
179
     BEGIN     -- (C)
180
 
181
          PR := NEW REC '(0,0,0);
182
          PROCC (PR);
183
 
184
     END;      -- (C)
185
 
186
     ---------------------------------------------
187
 
188
     RESULT;
189
 
190
END C62002A;

powered by: WebSVN 2.1.0

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