3 -- Grant of Unlimited Rights
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
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.
27 -- Check that structures nesting discriminated records as
28 -- components in record extension are correctly supported.
29 -- Check that record extensions inherit all the visible components
30 -- of their ancestor types.
31 -- Check that discriminants are correctly inherited.
34 -- This test defines a simple class hierarchy, where the final
35 -- derivations exercise the different possible "permissions" available
36 -- to a designer. Extension aggregates for discriminated types are used
37 -- to set values of these final types. The key difference between
38 -- this test and C391001 is that the types are visible, and allow the
39 -- creation of complex discriminated extension aggregates. Another
40 -- layer of derivation is present to more robustly check that the
41 -- inheritance is correctly supported.
45 -- 06 Dec 94 SAIC ACVC 2.0
46 -- 16 Dec 94 SAIC Removed offending parenthesis in aggregate
47 -- extensions, corrected typo: TC_MC SB TC_PC,
48 -- corrected visibility errors for literals,
49 -- added qualification for aggregate expressions
50 -- used in extension aggregates, corrected parameter
51 -- order in call to Communications.Creator
52 -- 01 MAY 95 SAIC Removed "limited" from the definition of Mil_Comm
53 -- 14 OCT 95 SAIC Fixed some value bugs for ACVC 2.0.1
54 -- 04 MAR 96 SAIC Altered 3 overambitious extension aggregates
55 -- 11 APR 96 SAIC Updated documentation for 2.1
56 -- 27 FEB 97 PWB.CTA Deleted extra (illegal) component association
59 ----------------------------------------------------------------- C391002_1
63 type Object
is tagged private;
65 -- Constructor operation
66 procedure Create
( The_Plaque
: in out Object
);
68 -- Selector operations
69 function TC_Match
( Left_Plaque
: Object
; Right_Natural
: Natural )
72 function Serial_Number
( A_Plaque
: Object
) return Natural;
74 Unserialized
: exception; -- Serial_Number called before Create
75 Reserialized
: exception; -- Create called twice
78 type Object
is tagged record
79 Serial_Number
: Natural := 0;
83 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
85 package body C391002_1
is
87 Counter
: Natural := 0;
89 procedure Create
( The_Plaque
: in out Object
) is
91 if The_Plaque
.Serial_Number
= 0 then
92 Counter
:= Counter
+1;
93 The_Plaque
.Serial_Number
:= Counter
;
99 function TC_Match
( Left_Plaque
: Object
; Right_Natural
: Natural )
102 return (Left_Plaque
.Serial_Number
= Right_Natural
);
105 function Serial_Number
( A_Plaque
: Object
) return Natural is
107 if A_Plaque
.Serial_Number
= 0 then
110 return A_Plaque
.Serial_Number
;
114 ----------------------------------------------------------------- C391002_2
117 package C391002_2
is -- package Boards is
119 package Plaque
renames C391002_1
;
121 type Modes
is (Receiving
, Transmitting
, Standby
);
122 type Link
(Mode
: Modes
:= Standby
) is record
124 when Receiving
=> TC_R
: Integer := 100;
125 when Transmitting
=> TC_T
: Integer := 200;
126 when Standby
=> TC_S
: Integer := 300; -- TGA, TSA, SSA
130 type Data_Formats
is (S_Band
, KU_Band
, UHF
);
132 type Transceiver
(Band
: Data_Formats
) is tagged record
136 when S_Band
=> TC_S_Band_Data
: Integer := 1; -- TGA, SSA, Milnet
137 when KU_Band
=> TC_KU_Band_Data
: Integer := 2; -- TSA, Usenet
138 when UHF
=> TC_UHF_Data
: Integer := 3; -- Gossip
143 ----------------------------------------------------------------- C391002_3
147 package C391002_3
is -- package Modules
149 package Plaque
renames C391002_1
;
150 package Boards
renames C391002_2
;
151 use type Boards
.Modes
;
152 use type Boards
.Data_Formats
;
154 type Command_Formats
is ( Set_Compression_Code
,
158 type Electronics_Module
(EBand
: Boards
.Data_Formats
;
159 The_Command
: Command_Formats
)
160 is new Boards
.Transceiver
(EBand
) with record
162 when Set_Compression_Code
=> TC_SCC
: Integer := 10; -- SSA, Gossip
163 when Set_Data_Rate
=> TC_SDR
: Integer := 20; -- TGA, Usenet
164 when Set_Power_State
=> TC_SPS
: Integer := 30; -- TSA, Milnet
169 ----------------------------------------------------------------- C391002_4
172 package C391002_4
is -- Communications
173 package Modules
renames C391002_3
;
175 type Public_Comm
is new Modules
.Electronics_Module
with
180 type Private_Comm
is new Modules
.Electronics_Module
with private;
182 type Mil_Comm
is new Modules
.Electronics_Module
with private;
184 procedure Creator
( Plugs
: in Modules
.Electronics_Module
;
185 Gives
: out Mil_Comm
);
187 function Creator
( Key
: Integer; Plugs
: in Modules
.Electronics_Module
)
190 procedure Setup
( It
: in out Public_Comm
; Value
: in Integer );
191 procedure Setup
( It
: in out Private_Comm
; Value
: in Integer );
192 procedure Setup
( It
: in out Mil_Comm
; Value
: in Integer );
194 function Selector
( It
: Public_Comm
) return Integer;
195 function Selector
( It
: Private_Comm
) return Integer;
196 function Selector
( It
: Mil_Comm
) return Integer;
199 type Private_Comm
is new Modules
.Electronics_Module
with
204 type Mil_Comm
is new Modules
.Electronics_Module
with
208 end C391002_4
; -- Communications
210 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
214 package body C391002_4
is -- Communications
216 procedure Creator
( Plugs
: in Modules
.Electronics_Module
;
217 Gives
: out Mil_Comm
) is
219 Gives
:= ( Plugs
with TC_MC
=> -1 );
222 function Creator
( Key
: Integer; Plugs
: in Modules
.Electronics_Module
)
223 return Private_Comm
is
225 return ( Plugs
with TC_PC
=> Key
);
228 procedure Setup
( It
: in out Public_Comm
; Value
: in Integer ) is
231 TCTouch
.Assert
( Value
= 1, "Public_Comm");
234 procedure Setup
( It
: in out Private_Comm
; Value
: in Integer ) is
237 TCTouch
.Assert
( Value
= 2, "Private_Comm");
240 procedure Setup
( It
: in out Mil_Comm
; Value
: in Integer ) is
243 TCTouch
.Assert
( Value
= 3, "Private_Comm");
246 function Selector
( It
: Public_Comm
) return Integer is
251 function Selector
( It
: Private_Comm
) return Integer is
256 function Selector
( It
: Mil_Comm
) return Integer is
261 end C391002_4
; -- Communications
263 ------------------------------------------------------------------- C391002
273 package Plaque
renames C391002_1
;
274 package Boards
renames C391002_2
;
275 package Modules
renames C391002_3
;
276 package Communications
renames C391002_4
;
278 procedure Assert
( Condition
: Boolean; Message
: String )
279 renames TCTouch
.Assert
;
281 use type Boards
.Modes
;
282 use type Boards
.Data_Formats
;
283 use type Modules
.Command_Formats
;
285 type Azimuth
is range 0..359;
287 type Ground_Antenna
(The_Band
: Boards
.Data_Formats
;
288 The_Command
: Modules
.Command_Formats
) is
291 Electronics
: Modules
.Electronics_Module
(The_Band
,The_Command
);
295 type Space_Antenna
(The_Band
: Boards
.Data_Formats
:= Boards
.KU_Band
;
296 The_Command
: Modules
.Command_Formats
297 := Modules
.Set_Power_State
)
301 Electronics
: Modules
.Electronics_Module
(The_Band
,The_Command
);
304 The_Ground_Antenna
: Ground_Antenna
(Boards
.S_Band
,
305 Modules
.Set_Data_Rate
);
306 The_Space_Antenna
: Space_Antenna
;
307 Space_Station_Antenna
: Space_Antenna
(Boards
.UHF
,
308 Modules
.Set_Compression_Code
);
310 Gossip
: Communications
.Public_Comm
(Boards
.UHF
,
311 Modules
.Set_Compression_Code
);
312 Usenet
: Communications
.Private_Comm
(Boards
.KU_Band
,
313 Modules
.Set_Data_Rate
);
314 Milnet
: Communications
.Mil_Comm
(Boards
.S_Band
,
315 Modules
.Set_Power_State
);
320 Report
.Test
("C391002", "Check nested tagged discriminated"
321 & " record structures");
323 Plaque
.Create
( The_Ground_Antenna
.ID
); -- 1
324 Plaque
.Create
( The_Ground_Antenna
.Electronics
.ID
); -- 2
325 Plaque
.Create
( The_Space_Antenna
.ID
); -- 3
326 Plaque
.Create
( The_Space_Antenna
.Electronics
.ID
); -- 4
327 Plaque
.Create
( Space_Station_Antenna
.ID
); -- 5
328 Plaque
.Create
( Space_Station_Antenna
.Electronics
.ID
);-- 6
330 The_Ground_Antenna
:= ( The_Band
=> Boards
.S_Band
,
331 The_Command
=> Modules
.Set_Data_Rate
,
332 ID
=> The_Ground_Antenna
.ID
,
334 ( Boards
.Transceiver
'(
335 Band => Boards.S_Band,
336 ID => The_Ground_Antenna.Electronics.ID,
337 The_Link => ( Mode => Boards.Transmitting,
339 TC_S_Band_Data => 8 )
340 with EBand => Boards.S_Band,
341 The_Command => Modules.Set_Data_Rate,
345 The_Space_Antenna := ( The_Band => Boards.S_Band,
346 The_Command => Modules.Set_Data_Rate,
347 ID => The_Space_Antenna.ID,
349 ( Boards.Transceiver'(
350 Band
=> Boards
.S_Band
,
351 ID
=> The_Space_Antenna
.Electronics
.ID
,
352 The_Link
=> ( Mode
=> Boards
.Transmitting
,
354 TC_S_Band_Data
=> 88 )
356 EBand
=> Boards
.S_Band
,
357 The_Command
=> Modules
.Set_Data_Rate
,
361 Space_Station_Antenna
:= ( Boards
.UHF
, Modules
.Set_Compression_Code
,
362 Space_Station_Antenna
.ID
,
363 ( Boards
.Transceiver
'(
365 Space_Station_Antenna.Electronics.ID,
366 ( Boards.Transmitting, 202 ),
369 Modules.Set_Compression_Code,
373 Assert( The_Ground_Antenna.The_Band = Boards.S_Band, "TGA disc 1" );
374 Assert( The_Ground_Antenna.The_Command = Modules.Set_Data_Rate,
376 Assert( Plaque.TC_Match(The_Ground_Antenna.ID,1), "TGA comp 3" );
377 Assert( The_Ground_Antenna.Electronics.EBand = Boards.S_Band,
378 "TGA comp 2.disc 1" );
379 Assert( The_Ground_Antenna.Electronics.The_Command
380 = Modules.Set_Data_Rate,
381 "TGA comp 2.disc 2" );
382 Assert( The_Ground_Antenna.Electronics.TC_SDR = 11,
384 Assert( Plaque.TC_Match( The_Ground_Antenna.Electronics.ID, 2 ),
385 "TGA comp 2.inher.1" );
386 Assert( The_Ground_Antenna.Electronics.The_Link.Mode = Boards.Transmitting,
387 "TGA comp 2.inher.2.disc" );
388 Assert( The_Ground_Antenna.Electronics.The_Link.TC_T = 222,
389 "TGA comp 2.inher.2.1" );
390 Assert( The_Ground_Antenna.Electronics.TC_S_Band_Data = 8,
391 "TGA comp 2.inher.3" );
392 Assert( The_Ground_Antenna.Pointing = 270, "TGA comp 3" );
394 Assert( The_Space_Antenna.The_Band = Boards.S_Band, "TSA disc 1");
395 Assert( The_Space_Antenna.The_Command = Modules.Set_Data_Rate,
397 Assert( Plaque.TC_Match(The_Space_Antenna.ID,3),
399 Assert( The_Space_Antenna.Electronics.EBand = Boards.S_Band,
400 "TSA comp 2.disc 1");
401 Assert( The_Space_Antenna.Electronics.The_Command = Modules.Set_Data_Rate,
402 "TSA comp 2.disc 2");
403 Assert( The_Space_Antenna.Electronics.TC_SDR = 42,
405 Assert( Plaque.TC_Match(The_Space_Antenna.Electronics.ID,4),
406 "TSA comp 2.inher.1");
407 Assert( The_Space_Antenna.Electronics.The_Link.Mode = Boards.Transmitting,
408 "TSA comp 2.inher.2.disc");
409 Assert( The_Space_Antenna.Electronics.The_Link.TC_T = 456,
410 "TSA comp 2.inher.2.1");
411 Assert( The_Space_Antenna.Electronics.TC_S_Band_Data = 88,
412 "TSA comp 2.inher.3");
414 Assert( Space_Station_Antenna.The_Band = Boards.UHF, "SSA disc 1");
415 Assert( Space_Station_Antenna.The_Command = Modules.Set_Compression_Code,
417 Assert( Plaque.TC_Match(Space_Station_Antenna.ID,5),
419 Assert( Space_Station_Antenna.Electronics.EBand = Boards.UHF,
420 "SSA comp 2.disc 1");
421 Assert( Space_Station_Antenna.Electronics.The_Command
422 = Modules.Set_Compression_Code,
423 "SSA comp 2.disc 2");
424 Assert( Space_Station_Antenna.Electronics.TC_SCC = 101,
426 Assert( Plaque.TC_Match(Space_Station_Antenna.Electronics.ID,6),
427 "SSA comp 2.inher.1");
428 Assert( Space_Station_Antenna.Electronics.The_Link.Mode
429 = Boards.Transmitting,
430 "SSA comp 2.inher.2.disc");
431 Assert( Space_Station_Antenna.Electronics.The_Link.TC_T = 202,
432 "SSA comp 2.inher.2.1");
433 Assert( Space_Station_Antenna.Electronics.TC_UHF_Data = 42,
434 "SSA comp 2.inher.3");
437 The_Space_Antenna := ( The_Band => Boards.S_Band,
438 The_Command => Modules.Set_Power_State,
439 ID => The_Space_Antenna.ID,
441 ( Boards.Transceiver'(
442 Band
=> Boards
.S_Band
,
443 ID
=> The_Space_Antenna
.Electronics
.ID
,
444 The_Link
=> ( Mode
=> Boards
.Transmitting
,
446 TC_S_Band_Data
=> 5 )
448 EBand
=> Boards
.S_Band
,
449 The_Command
=> Modules
.Set_Power_State
,
453 Communications
.Creator
( The_Space_Antenna
.Electronics
, Milnet
);
454 Assert
( Communications
.Selector
( Milnet
) = -1, "Milnet creator" );
456 Usenet
:= Communications
.Creator
( -2,
457 ( Boards
.Transceiver
'(
458 Band => Boards.KU_Band,
459 ID => The_Space_Antenna.Electronics.ID,
460 The_Link => ( Boards.Transmitting, TC_T => 101 ),
461 TC_KU_Band_Data => 395 )
462 with Boards.KU_Band, Modules.Set_Data_Rate, 66 ) );
464 Assert( Communications.Selector( Usenet ) = -2, "Usenet creator" );
467 Modules.Electronics_Module'(
470 ID => The_Space_Antenna.Electronics.ID,
471 The_Link => ( Boards.Transmitting, TC_T => 101 ),
474 Boards.UHF, Modules.Set_Compression_Code, 66 )
478 Assert( Gossip.TC_VC = -3, "Gossip Aggregate" );
480 Communications.Setup( Gossip, 1 ); -- (Boards.UHF,
481 -- Modules.Set_Compression_Code)
482 Communications.Setup( Usenet, 2 ); -- (Boards.KU_Band,
483 -- Modules.Set_Data_Rate)
484 Communications.Setup( Milnet, 3 ); -- (Boards.S_Band,
485 -- Modules.Set_Power_State)
487 Assert( Communications.Selector( Gossip ) = 1, "Gossip Setup" );
488 Assert( Communications.Selector( Usenet ) = 2, "Usenet Setup" );
489 Assert( Communications.Selector( Milnet ) = 3, "Milnet Setup" );