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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [ada/] [acats/] [support/] [f392c00.a] - Blame information for rev 750

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

Line No. Rev Author Line
1 720 jeremybenn
-- F392C00.A
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
-- FOUNDATION DESCRIPTION:
27
--      This foundation provides a basis for tagged type and dispatching
28
--      tests.  Each test describes the utilizations.
29
--
30
-- CHANGE HISTORY:
31
--      06 Dec 94   SAIC    ACVC 2.0
32
--      24 OCT 95   SAIC    Updated for ACVC 2.0.1
33
--
34
--!
35
 
36
package F392C00_1 is  -- Switches
37
 
38
  type Toggle is tagged private;    ---------------------------------- Toggle
39
 
40
  function Create return Toggle;
41
  procedure Flip   ( It : in out Toggle );
42
  function On      ( It : Toggle'Class ) return Boolean;
43
  function Off     ( It : Toggle'Class ) return Boolean;
44
 
45
  type Dimmer is new Toggle with private;    ------------------------- Dimmer
46
 
47
  type Luminance is range 0..100;
48
 
49
  function  Create return Dimmer;
50
  procedure Flip    ( It : in out Dimmer );
51
  procedure Brighten( It : in out Dimmer;
52
                      By : in Luminance := 10 );
53
  procedure Dim     ( It : in out Dimmer;
54
                      By : in Luminance := 10 );
55
  function Intensity( It : Dimmer ) return Luminance;
56
 
57
  type Auto_Dimmer is new Dimmer with private;    --------------- Auto_Dimmer
58
 
59
  function  Create return Auto_Dimmer;
60
  procedure Flip      ( It: in out Auto_Dimmer );
61
  procedure Set_Auto  ( It: in out Auto_Dimmer );
62
  procedure Clear_Auto( It: in out Auto_Dimmer );
63
  -- procedure Set_Manual( It: in out Auto_Dimmer ) renames Clear_Auto;
64
  procedure Set_Cutin ( It: in out Auto_Dimmer; Lumens: in Luminance );
65
  procedure Set_Cutout( It: in out Auto_Dimmer; Lumens: in Luminance );
66
 
67
  function Auto            ( It: Auto_Dimmer ) return Boolean;
68
  function Cutout_Threshold( It: Auto_Dimmer ) return Luminance;
69
  function Cutin_Threshold ( It: Auto_Dimmer ) return Luminance;
70
 
71
  function TC_CW_TI( Key : Character ) return Toggle'Class;
72
 
73
  function TC_Non_Disp( It: Toggle ) return Boolean;
74
  function TC_Non_Disp( It: Dimmer ) return Boolean;
75
  function TC_Non_Disp( It: Auto_Dimmer ) return Boolean;
76
 
77
private
78
 
79
  type Toggle is tagged record
80
    On : Boolean := False;
81
  end record;
82
 
83
  type Dimmer is new Toggle with record
84
    Intensity : Luminance := 100;
85
  end record;
86
 
87
  type Auto_Dimmer is new Dimmer with record
88
    Cutout_Threshold : Luminance := 60;
89
    Cutin_Threshold  : Luminance := 40;
90
    Auto_Engaged     : Boolean := False;
91
  end record;
92
 
93
end F392C00_1;
94
 
95
with TCTouch;
96
package body F392C00_1 is
97
 
98
  function Create return Toggle is
99
  begin
100
    TCTouch.Touch( '1' );  ------------------------------------------------ 1
101
    return Toggle'( On => True );
102
  end Create;
103
 
104
  function Create return Dimmer is
105
  begin
106
    TCTouch.Touch( '2' );  ------------------------------------------------ 2
107
    return Dimmer'( On => True, Intensity => 75 );
108
  end Create;
109
 
110
  function Create return Auto_Dimmer is
111
  begin
112
    TCTouch.Touch( '3' );  ------------------------------------------------ 3
113
    return  Auto_Dimmer'( On => True, Intensity => 25,
114
                          Cutout_Threshold | Cutin_Threshold => 50,
115
                          Auto_Engaged => True );
116
  end Create;
117
 
118
  procedure Flip   ( It : in out Toggle ) is
119
  begin
120
    TCTouch.Touch( 'A' );  ------------------------------------------------ A
121
    It.On := not It.On;
122
  end Flip;
123
 
124
  function On( It : Toggle'Class ) return Boolean is
125
  begin
126
    TCTouch.Touch( 'B' );  ------------------------------------------------ B
127
    return It.On;
128
  end On;
129
 
130
  function Off( It : Toggle'Class ) return Boolean is
131
  begin
132
    TCTouch.Touch( 'C' );  ------------------------------------------------ C
133
    return not It.On;
134
  end Off;
135
 
136
  procedure Brighten( It : in out Dimmer;
137
                      By : in Luminance := 10 ) is
138
  begin
139
    TCTouch.Touch( 'D' );  ------------------------------------------------ D
140
    if (It.Intensity+By) <= Luminance'Last then
141
      It.Intensity := It.Intensity+By;
142
    else
143
      It.Intensity := Luminance'Last;
144
    end if;
145
  end Brighten;
146
 
147
  procedure Dim     ( It : in out Dimmer;
148
                      By : in Luminance := 10 ) is
149
  begin
150
    TCTouch.Touch( 'E' );  ------------------------------------------------ E
151
    if (It.Intensity-By) >= Luminance'First then
152
      It.Intensity := It.Intensity-By;
153
    else
154
      It.Intensity := Luminance'First;
155
    end if;
156
  end Dim;
157
 
158
  function Intensity( It : Dimmer ) return Luminance is
159
  begin
160
    TCTouch.Touch( 'F' );  ------------------------------------------------ F
161
    if On(It) then
162
      return It.Intensity;
163
    else
164
      return Luminance'First;
165
    end if;
166
  end Intensity;
167
 
168
  procedure Flip    ( It : in out Dimmer ) is
169
  begin
170
    TCTouch.Touch( 'G' );  ------------------------------------------------ G
171
    if On( It ) and (It.Intensity < 50) then
172
      It.Intensity := Luminance'Last - It.Intensity;
173
    else
174
      Flip( Toggle( It ) );
175
    end if;
176
  end Flip;
177
 
178
  procedure Set_Auto  ( It: in out Auto_Dimmer ) is
179
  begin
180
    TCTouch.Touch( 'H' );  ------------------------------------------------ H
181
    It.Auto_Engaged := True;
182
  end Set_Auto;
183
 
184
  procedure Clear_Auto( It: in out Auto_Dimmer ) is
185
  begin
186
    TCTouch.Touch( 'I' );  ------------------------------------------------ I
187
    It.Auto_Engaged := False;
188
  end Clear_Auto;
189
 
190
  function  Auto           ( It: Auto_Dimmer ) return Boolean is
191
  begin
192
    TCTouch.Touch( 'J' );  ------------------------------------------------ J
193
    return It.Auto_Engaged;
194
  end Auto;
195
 
196
  procedure Flip     ( It: in out Auto_Dimmer ) is
197
  begin
198
    TCTouch.Touch( 'K' );  ------------------------------------------------ K
199
    if It.Auto_Engaged then
200
      if Off(It) then
201
       Flip( Dimmer( It ) );
202
      else
203
       It.Auto_Engaged := False;
204
      end if;
205
    else
206
      Flip( Dimmer( It ) );
207
    end if;
208
  end Flip;
209
 
210
  procedure Set_Cutin ( It : in out Auto_Dimmer;
211
                        Lumens : in Luminance) is
212
  begin
213
    TCTouch.Touch( 'L' );  ------------------------------------------------ L
214
    It.Cutin_Threshold := Lumens;
215
  end Set_Cutin;
216
 
217
  procedure Set_Cutout( It : in out Auto_Dimmer;
218
                        Lumens : in Luminance) is
219
  begin
220
    TCTouch.Touch( 'M' );  ------------------------------------------------ M
221
    It.Cutout_Threshold := Lumens;
222
  end Set_Cutout;
223
 
224
  function Cutout_Threshold( It : Auto_Dimmer ) return Luminance is
225
  begin
226
    TCTouch.Touch( 'N' );  ------------------------------------------------ N
227
    return It.Cutout_Threshold;
228
  end Cutout_Threshold;
229
 
230
  function Cutin_Threshold ( It : Auto_Dimmer ) return Luminance is
231
  begin
232
    TCTouch.Touch( 'O' );  ------------------------------------------------ O
233
    return It.Cutin_Threshold;
234
  end Cutin_Threshold;
235
 
236
  function TC_CW_TI( Key : Character ) return Toggle'Class is
237
  begin
238
    TCTouch.Touch( 'W' );  ------------------------------------------------ W
239
    case Key is
240
      when 'T' | 't' => return Toggle'( On => True );
241
      when 'D' | 'd' => return Dimmer'( On => True, Intensity => 75 );
242
      when 'A' | 'a' => return Auto_Dimmer'( On => True, Intensity => 25,
243
                                 Cutout_Threshold | Cutin_Threshold => 50,
244
                                 Auto_Engaged => True );
245
      when others => null;
246
    end case;
247
  end TC_CW_TI;
248
 
249
  function TC_Non_Disp( It: Toggle ) return Boolean is
250
  begin
251
    TCTouch.Touch( 'X' );  ------------------------------------------------ X
252
    return It.On;
253
  end TC_Non_Disp;
254
 
255
  function TC_Non_Disp( It: Dimmer ) return Boolean is
256
  begin
257
    TCTouch.Touch( 'Y' );  ------------------------------------------------ Y
258
    return It.On;
259
  end TC_Non_Disp;
260
 
261
  function TC_Non_Disp( It: Auto_Dimmer ) return Boolean is
262
  begin
263
    TCTouch.Touch( 'Z' );  ------------------------------------------------ Z
264
    return It.On;
265
  end TC_Non_Disp;
266
 
267
end F392C00_1;

powered by: WebSVN 2.1.0

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