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/] [c2/] [c250002.aw] - Blame information for rev 294

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 294 jeremybenn
-- C250002.AW
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
--
26
-- OBJECTIVE:
27
--      Check that characters in Latin-1 above ASCII.Del can be used in
28
--      identifiers, character literals and strings.
29
--
30
-- TEST DESCRIPTION:
31
--      This test utilizes the brackets scheme for representing Latin-1
32
--      character values in transportable 7 bit ASCII as proposed by
33
--      Robert Dewar; this test defines Character and String objects,
34
--      assigns and tests several sample values.  Several Identifiers
35
--      used in this test also include Characters via the bracket escape
36
--      sequence scheme.
37
--
38
--      Note that C250001 checks Wide_Characters and Wide_Strings.
39
--
40
-- SPECIAL REQUIREMENTS:
41
--
42
--      This file must be preprocessed before it can be executed as a test.
43
--
44
--      This test requires that all occurrences of the bracket escaped
45
--      characters be replaced with the corresponding 8 bit character.
46
--
47
--      Characters above ASCII.Del are represented by a 6 character sequence:
48
--
49
--          ["xx"]
50
--
51
--      where the character code represented is specified by two hexadecimal
52
--      digits () upper case. For example the Latin-1 character with the
53
--      code 16#AB# is represented by the six character sequence:
54
--
55
--          ["AB"]
56
--
57
--      None of the values used in this test should be interpreted as
58
--      a control character.
59
--
60
--      The following function documents the translation algorithm:
61
--
62
--     function To_Char( S:String ) return Character is
63
--       Numerical : Natural := 0;
64
--       type Xlate is array(Character range '0'..'F') of Natural;
65
--       Xlation : Xlate
66
--               := ('0' =>  0, '1' =>  1, '2' =>  2, '3' =>  3, '4' =>  4,
67
--                   '5' =>  5, '6' =>  6, '7' =>  7, '8' =>  8, '9' =>  9,
68
--                   'A' => 10, 'B' => 11, 'C' => 12, 'D' => 13, 'E' => 14,
69
--                   'F' => 15,  others => 0 );
70
--     begin
71
--       for I in S'Range loop
72
--         Numerical := Numerical * 16 + Xlation(S(I));
73
--       end loop;
74
--       return Character'Val(Numerical);
75
--     end To_Char;
76
--
77
--
78
-- CHANGE HISTORY:
79
--      10 JAN 96   SAIC   Initial version
80
--      12 NOV 96   SAIC   Changed file extension to .AW
81
--
82
--!
83
 
84
----------------------------------------------------------------- C250002_0
85
 
86
package C250002_0 is
87
 
88
  -- The extended characters used in this test start with
89
  -- the character '["A1"]' 16#A1# and increase from there
90
 
91
  type Tagged_["C0"]_Id is tagged record
92
    Length, Width: Natural;
93
  end record;
94
 
95
  X_Char_A2 : constant Character := '["A2"]';
96
 
97
  X_Char_A3_Through_A9 : constant String :=
98
               "["A3"]["A4"]["A5"]["A6"]["A7"]["A8"]["A9"]";
99
 
100
  X_Char_AA_AB : constant String := "["AA"]["AB"]";
101
 
102
end C250002_0;
103
 
104
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
105
 
106
-- no package body C250002_0 is required or allowed
107
 
108
----------------------------------------------------------------- C250002_X
109
 
110
with Ada.Characters.Latin_1;
111
package C250002_["C1"] is
112
 
113
  type Enum is ( Item, 'A', '["AD"]', AE_["C6"]["E6"]_ae,
114
                 '["2D"]', '["FF"]' );
115
 
116
  task type C2_["C2"] is
117
    entry C2_["C3"];
118
  end C2_["C2"];
119
 
120
end C250002_["C1"];
121
 
122
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
123
 
124
package body C250002_["C1"] is
125
 
126
  task body C2_["C2"] is
127
  begin
128
    accept C2_["C3"];
129
  end C2_["C2"];
130
 
131
end C250002_["C1"];
132
 
133
------------------------------------------------------------------- C250002
134
 
135
with Report;
136
with C250002_0;
137
with C250002_["C1"];
138
 
139
with Ada.Tags;
140
 
141
procedure C250002 is
142
  use C250002_0;
143
 
144
  My_Task: C250002_["C1"].C2_["C2"];
145
 
146
  function Hex( N: Natural ) return String is
147
    S : String := "xx";
148
    T : String := "0123456789ABCDEF";
149
  begin
150
    S(1) := T(N  /  16 +1);
151
    S(2) := T(N mod 16 +1);
152
    return S;
153
  end Hex;
154
 
155
  procedure Match( Check : Character; Matching : Natural ) is
156
  begin
157
    if Check /= Character'Val( Matching ) then
158
      Report.Failed( "Didn't match for " & Hex(Matching) );
159
    end if;
160
  end Match;
161
 
162
  type Value_List is array(Positive range <>) of Natural;
163
 
164
  procedure Match( Check : String; Matching : Value_List ) is
165
  begin
166
    if Check'Length /= Matching'Length then
167
      Report.Failed( "Check'Length /= Matching'Length" );
168
    else
169
      for I in Check'Range loop
170
        Match( Check(I), Matching(I - Check'First + Matching'First) );
171
      end loop;
172
    end if;
173
  end Match;
174
 
175
  TC_Count : Natural := 0;
176
 
177
begin  -- Main test procedure.
178
 
179
  Report.Test ("C250002", "Check that characters above ASCII.Del can be " &
180
                          "used in identifiers, character literals and " &
181
                          "strings" );
182
 
183
  Report.Comment( Ada.Tags.Expanded_Name(Tagged_["C0"]_Id'Tag) );
184
 
185
  for Specials in C250002_["C1"].Enum loop
186
    TC_Count := TC_Count +1;
187
  end loop;
188
 
189
  if TC_Count /= 6 then
190
    Report.Failed("Expected 6 literals in Enum");
191
  end if;
192
 
193
  Match( X_Char_A2, 16#A2# );
194
 
195
  Match(X_Char_A3_Through_A9,
196
         (16#A3#,16#A4#,16#A5#,16#A6#,16#A7#,16#A8#,16#A9#) );
197
 
198
  -- check catenations
199
 
200
  Match( X_Char_A2 & X_Char_A2, (16#A2#,16#A2#) );
201
 
202
  Match( X_Char_A2 & X_Char_AA_AB, (16#A2#,16#AA#,16#AB#) );
203
 
204
  Match( X_Char_AA_AB & X_Char_A2, (16#AA#,16#AB#,16#A2#) );
205
 
206
  Match( X_Char_AA_AB & X_Char_AA_AB,
207
         (16#AA#,16#AB#,16#AA#,16#AB#) );
208
 
209
  My_Task.C2_["C3"];
210
 
211
  Report.Result;
212
 
213
end C250002;

powered by: WebSVN 2.1.0

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