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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [ada/] [acats/] [tests/] [a/] [a49027b.ada] - Blame information for rev 294

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 294 jeremybenn
-- A49027B.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 A SUBTYPE CAN BE NONSTATIC IN A GENERIC TEMPLATE
27
--   AND STATIC IN THE CORRESPONDING INSTANCE.
28
 
29
--   CHECK THAT IF A GENERIC PARAMETER IS A STATIC EXPRESSION AND THE
30
--   CORRESPONDING (IN) PARAMETER HAS A STATIC SUBTYPE IN THE INSTANCE,
31
--   THEN EACH USE OF THE FORMAL PARAMETERS IN THE INSTANCE IS SAID TO
32
--   BE STATIC.
33
--
34
--   A NAME DENOTING A CONSTANT DECLARED IN A GENERIC INSTANCE IS
35
--   ALLOWED AS A PRIMARY IN A STATIC EXPRESSION IF THE CONSTANT
36
--   IS DECLARED BY A CONSTANT DECLARATION WITH A STATIC SUBTYPE
37
--   AND INITIALIZED WITH A STATIC EXPRESSION.
38
--
39
--   THIS IS A TEST BASED ON AI-00505/03-BI-WA.
40
 
41
-- HISTORY:
42
--         EDWARD V. BERARD, 27 AUGUST 1990
43
--         DAS   8 OCT 90   ADDED CODE TO MATCH EXAMPLE 1 IN
44
--                          AI-00505.
45
--         JRL 05/29/92  CORRECTED MINOR PROBLEM IN REPORT.TEST STRING.
46
--         JRL 02/18/93  EXPANDED TEXT OF REPORT.TEST STRING.
47
--         PWN 04/14/95  CORRECTED MINOR COPYRIGHT COMMENT PROBLEM.
48
 
49
 
50
WITH REPORT ;
51
 
52
PROCEDURE A49027B IS
53
 
54
BEGIN  -- A49027B
55
 
56
     REPORT.TEST ("A49027B", "CHECK THAT IF A GENERIC ACTUAL " &
57
                  "PARAMETER IS A STATIC EXPRESSION AND THE " &
58
                  "CORRESPONDING FORMAL PARAMETER HAS A STATIC " &
59
                  "SUBTYPE IN THE INSTANCE, THEN EACH USE OF THE " &
60
                  "FORMAL PARAMETER IN THE INSTANCE IS SAID TO BE " &
61
                  "STATIC. CHECK THAT A NAME DENOTING A CONSTANT " &
62
                  "DECLARED IN A GENERIC INSTANCE IS ALLOWED AS " &
63
                  "A PRIMARY IN A STATIC EXPRESSION IF THE " &
64
                  "CONSTANT IS DECLARED BY A CONSTANT DECLARATION " &
65
                  "WITH A STATIC SUBTYPE AND INITIALIZED WITH A " &
66
                  "STATIC EXPRESSION. (AI-00505)");
67
 
68
     LOCAL_BLOCK:
69
 
70
     DECLARE
71
 
72
          TYPE NUMBER IS RANGE 1 .. 10 ;
73
          TYPE COLOR IS (RED, ORANGE, YELLOW, GREEN, BLUE) ;
74
          MIDDLE_COLOR : CONSTANT COLOR := GREEN ;
75
 
76
          ENUMERATED_VALUE : COLOR := COLOR'LAST ;
77
 
78
          GENERIC
79
 
80
               TYPE NUMBER_TYPE IS RANGE <> ;
81
               X : INTEGER ;
82
               TYPE ENUMERATED IS (<>) ;
83
 
84
               FIRST_NUMBER            : IN NUMBER_TYPE ;
85
               SECOND_NUMBER           : IN NUMBER_TYPE ;
86
               THIRD_NUMBER            : IN NUMBER_TYPE ;
87
               FIRST_ENUMERATED        : IN ENUMERATED ;
88
               SECOND_ENUMERATED       : IN ENUMERATED ;
89
               THIRD_ENUMERATED        : IN ENUMERATED ;
90
 
91
               FIRST_INTEGER_VALUE     : IN INTEGER ;
92
               SECOND_INTEGER_VALUE    : IN INTEGER ;
93
 
94
          PACKAGE STATIC_TEST IS
95
 
96
               Y : CONSTANT INTEGER := X;
97
               Z : CONSTANT NUMBER_TYPE := 5;
98
 
99
               SUBTYPE FIRST_NUMBER_SUBTYPE IS NUMBER_TYPE
100
                   RANGE FIRST_NUMBER .. SECOND_NUMBER ;
101
               SUBTYPE SECOND_NUMBER_SUBTYPE IS NUMBER_TYPE
102
                   RANGE FIRST_NUMBER .. THIRD_NUMBER ;
103
 
104
               SUBTYPE FIRST_ENUMERATED_SUBTYPE IS ENUMERATED
105
                   RANGE FIRST_ENUMERATED .. SECOND_ENUMERATED ;
106
               SUBTYPE SECOND_ENUMERATED_SUBTYPE IS ENUMERATED
107
                   RANGE FIRST_ENUMERATED .. THIRD_ENUMERATED ;
108
 
109
               SUBTYPE THIRD_NUMBER_TYPE IS INTEGER
110
                   RANGE FIRST_INTEGER_VALUE .. SECOND_INTEGER_VALUE ;
111
 
112
          END STATIC_TEST ;
113
 
114
          PACKAGE NEW_STATIC_TEST IS NEW STATIC_TEST
115
                   (NUMBER_TYPE            => NUMBER,
116
                    X                      => 3,
117
                    ENUMERATED             => COLOR,
118
                    FIRST_NUMBER           => NUMBER'FIRST,
119
                    SECOND_NUMBER          => NUMBER'LAST,
120
                    THIRD_NUMBER           => NUMBER'SUCC(NUMBER'FIRST),
121
                    FIRST_ENUMERATED       => RED,
122
                    SECOND_ENUMERATED      => MIDDLE_COLOR,
123
                    THIRD_ENUMERATED       => COLOR'VAL (1),
124
                    FIRST_INTEGER_VALUE    => COLOR'POS (YELLOW),
125
                    SECOND_INTEGER_VALUE   => NUMBER'POS (5)) ;
126
 
127
          TYPE T1 IS RANGE 1 .. NEW_STATIC_TEST.Y;
128
          TYPE T2 IS RANGE 1 .. NEW_STATIC_TEST.Z;
129
 
130
          TYPE ANOTHER_NUMBER IS RANGE
131
                   NEW_STATIC_TEST.FIRST_NUMBER_SUBTYPE'FIRST ..
132
                   NEW_STATIC_TEST.FIRST_NUMBER_SUBTYPE'LAST ;
133
 
134
          TYPE YET_ANOTHER_NUMBER IS RANGE
135
                   NEW_STATIC_TEST.SECOND_NUMBER_SUBTYPE'FIRST ..
136
                   NEW_STATIC_TEST.SECOND_NUMBER_SUBTYPE'LAST ;
137
 
138
          TYPE STILL_ANOTHER_NUMBER IS RANGE
139
                   NEW_STATIC_TEST.THIRD_NUMBER_TYPE'FIRST ..
140
                   NEW_STATIC_TEST.THIRD_NUMBER_TYPE'LAST ;
141
 
142
     BEGIN  -- LOCAL_BLOCK
143
 
144
          CASE ENUMERATED_VALUE IS
145
                WHEN YELLOW      => NULL ;
146
                WHEN NEW_STATIC_TEST.FIRST_ENUMERATED_SUBTYPE'FIRST
147
                                 => NULL ;
148
                WHEN NEW_STATIC_TEST.FIRST_ENUMERATED_SUBTYPE'LAST
149
                                 => NULL ;
150
                WHEN NEW_STATIC_TEST.SECOND_ENUMERATED_SUBTYPE'LAST
151
                                 => NULL ;
152
                WHEN COLOR'LAST  => NULL ;
153
          END CASE ;
154
 
155
     END LOCAL_BLOCK ;
156
 
157
     REPORT.RESULT ;
158
 
159
END A49027B ;

powered by: WebSVN 2.1.0

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