-- C393011.A
|
-- C393011.A
|
--
|
--
|
-- Grant of Unlimited Rights
|
-- Grant of Unlimited Rights
|
--
|
--
|
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
|
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
|
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
|
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
|
-- unlimited rights in the software and documentation contained herein.
|
-- unlimited rights in the software and documentation contained herein.
|
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
|
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
|
-- this public release, the Government intends to confer upon all
|
-- this public release, the Government intends to confer upon all
|
-- recipients unlimited rights equal to those held by the Government.
|
-- recipients unlimited rights equal to those held by the Government.
|
-- These rights include rights to use, duplicate, release or disclose the
|
-- These rights include rights to use, duplicate, release or disclose the
|
-- released technical data and computer software in whole or in part, in
|
-- released technical data and computer software in whole or in part, in
|
-- any manner and for any purpose whatsoever, and to have or permit others
|
-- any manner and for any purpose whatsoever, and to have or permit others
|
-- to do so.
|
-- to do so.
|
--
|
--
|
-- DISCLAIMER
|
-- DISCLAIMER
|
--
|
--
|
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
|
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
|
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
|
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
|
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
|
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
|
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
|
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
|
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
|
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
|
-- PARTICULAR PURPOSE OF SAID MATERIAL.
|
-- PARTICULAR PURPOSE OF SAID MATERIAL.
|
--*
|
--*
|
--
|
--
|
-- TEST OBJECTIVE:
|
-- TEST OBJECTIVE:
|
-- Check that an abstract extended type can be derived from an abstract
|
-- Check that an abstract extended type can be derived from an abstract
|
-- type, and that a a non-abstract type may then be derived from the
|
-- type, and that a a non-abstract type may then be derived from the
|
-- second abstract type.
|
-- second abstract type.
|
--
|
--
|
-- TEST DESCRIPTION:
|
-- TEST DESCRIPTION:
|
-- Define an abstract type with three primitive operations, two of them
|
-- Define an abstract type with three primitive operations, two of them
|
-- abstract. Derive an extended type from it, inheriting the non-
|
-- abstract. Derive an extended type from it, inheriting the non-
|
-- abstract operation, overriding one of the abstract operations with
|
-- abstract operation, overriding one of the abstract operations with
|
-- a non-abstract operation, and overriding the other abstract operation
|
-- a non-abstract operation, and overriding the other abstract operation
|
-- with an abstract operation. The extended type is therefore abstract;
|
-- with an abstract operation. The extended type is therefore abstract;
|
-- derive an extended type from it. Override the abstract operation with
|
-- derive an extended type from it. Override the abstract operation with
|
-- a non-abstract operation; inherit one operation from the original
|
-- a non-abstract operation; inherit one operation from the original
|
-- abstract type, and inherit one operation from the intermediate
|
-- abstract type, and inherit one operation from the intermediate
|
-- abstract type.
|
-- abstract type.
|
--
|
--
|
--
|
--
|
-- CHANGE HISTORY:
|
-- CHANGE HISTORY:
|
-- 06 Dec 94 SAIC ACVC 2.0
|
-- 06 Dec 94 SAIC ACVC 2.0
|
--
|
--
|
--!
|
--!
|
|
|
Package C393011_0 is
|
Package C393011_0 is
|
-- Definitions
|
-- Definitions
|
|
|
type Status_Enum is (None, Unhandled, Pending, Handled);
|
type Status_Enum is (None, Unhandled, Pending, Handled);
|
type Serial_Type is new Integer range 0 .. Integer'Last;
|
type Serial_Type is new Integer range 0 .. Integer'Last;
|
subtype Priority_Type is Integer range 0..10;
|
subtype Priority_Type is Integer range 0..10;
|
|
|
type Display_Enum is (Bit_Bucket, TTY, Console, Big_Screen);
|
type Display_Enum is (Bit_Bucket, TTY, Console, Big_Screen);
|
|
|
Next : Serial_Type := 1;
|
Next : Serial_Type := 1;
|
Display_Device : Display_Enum := Bit_Bucket;
|
Display_Device : Display_Enum := Bit_Bucket;
|
|
|
end C393011_0;
|
end C393011_0;
|
-- Definitions;
|
-- Definitions;
|
|
|
--=======================================================================--
|
--=======================================================================--
|
|
|
with C393011_0;
|
with C393011_0;
|
-- Definitions
|
-- Definitions
|
|
|
Package C393011_1 is
|
Package C393011_1 is
|
-- Alert
|
-- Alert
|
|
|
package Definitions renames C393011_0;
|
package Definitions renames C393011_0;
|
|
|
type Alert_Type is abstract tagged record
|
type Alert_Type is abstract tagged record
|
Status : Definitions.Status_Enum := Definitions.None;
|
Status : Definitions.Status_Enum := Definitions.None;
|
Serial_Num : Definitions.Serial_Type := 0;
|
Serial_Num : Definitions.Serial_Type := 0;
|
Priority : Definitions.Priority_Type;
|
Priority : Definitions.Priority_Type;
|
end record;
|
end record;
|
-- Alert_Type is an abstract type with
|
-- Alert_Type is an abstract type with
|
-- two operations to be overridden
|
-- two operations to be overridden
|
|
|
procedure Set_Status ( A : in out Alert_Type; -- not abstract
|
procedure Set_Status ( A : in out Alert_Type; -- not abstract
|
To : Definitions.Status_Enum);
|
To : Definitions.Status_Enum);
|
|
|
procedure Set_Serial ( A : in out Alert_Type) is abstract;
|
procedure Set_Serial ( A : in out Alert_Type) is abstract;
|
procedure Display ( A : Alert_Type) is abstract;
|
procedure Display ( A : Alert_Type) is abstract;
|
|
|
end C393011_1;
|
end C393011_1;
|
-- Alert
|
-- Alert
|
|
|
--=======================================================================--
|
--=======================================================================--
|
|
|
with C393011_0;
|
with C393011_0;
|
package body C393011_1 is
|
package body C393011_1 is
|
-- Alert
|
-- Alert
|
procedure Set_Status ( A : in out Alert_Type;
|
procedure Set_Status ( A : in out Alert_Type;
|
To : Definitions.Status_Enum) is
|
To : Definitions.Status_Enum) is
|
begin
|
begin
|
A.Status := To;
|
A.Status := To;
|
end Set_Status;
|
end Set_Status;
|
|
|
end C393011_1;
|
end C393011_1;
|
-- Alert;
|
-- Alert;
|
|
|
--=======================================================================--
|
--=======================================================================--
|
|
|
with C393011_0,
|
with C393011_0,
|
-- Definitions,
|
-- Definitions,
|
C393011_1,
|
C393011_1,
|
-- Alert,
|
-- Alert,
|
Calendar;
|
Calendar;
|
|
|
Package C393011_3 is
|
Package C393011_3 is
|
-- New_Alert
|
-- New_Alert
|
|
|
type New_Alert_Type is abstract new C393011_1.Alert_Type with record
|
type New_Alert_Type is abstract new C393011_1.Alert_Type with record
|
Display_Dev : C393011_0.Display_Enum := C393011_0.TTY;
|
Display_Dev : C393011_0.Display_Enum := C393011_0.TTY;
|
end record;
|
end record;
|
|
|
-- procedure Set_Status is inherited
|
-- procedure Set_Status is inherited
|
|
|
procedure Set_Serial ( A : in out New_Alert_Type); -- override/see body
|
procedure Set_Serial ( A : in out New_Alert_Type); -- override/see body
|
|
|
procedure Display ( A : New_Alert_Type) is abstract;
|
procedure Display ( A : New_Alert_Type) is abstract;
|
-- override is abstract
|
-- override is abstract
|
-- still can't declare objects of New_Alert_Type
|
-- still can't declare objects of New_Alert_Type
|
|
|
end C393011_3;
|
end C393011_3;
|
-- New_Alert
|
-- New_Alert
|
|
|
--=======================================================================--
|
--=======================================================================--
|
|
|
with C393011_0;
|
with C393011_0;
|
Package Body C393011_3 is
|
Package Body C393011_3 is
|
-- New_Alert
|
-- New_Alert
|
|
|
package Definitions renames C393011_0;
|
package Definitions renames C393011_0;
|
|
|
procedure Set_Serial (A : in out New_Alert_Type) is
|
procedure Set_Serial (A : in out New_Alert_Type) is
|
use type Definitions.Serial_Type;
|
use type Definitions.Serial_Type;
|
begin
|
begin
|
A.Serial_Num := Definitions.Next;
|
A.Serial_Num := Definitions.Next;
|
Definitions.Next := Definitions."+"( Definitions.Next, 1);
|
Definitions.Next := Definitions."+"( Definitions.Next, 1);
|
end Set_Serial;
|
end Set_Serial;
|
|
|
End C393011_3;
|
End C393011_3;
|
-- New_Alert;
|
-- New_Alert;
|
|
|
--=======================================================================--
|
--=======================================================================--
|
|
|
with C393011_0,
|
with C393011_0,
|
-- Definitions
|
-- Definitions
|
C393011_3;
|
C393011_3;
|
-- New_Alert -- package Alert is not visible
|
-- New_Alert -- package Alert is not visible
|
package C393011_4 is
|
package C393011_4 is
|
|
|
package New_Alert renames C393011_3;
|
package New_Alert renames C393011_3;
|
package Definitions renames C393011_0;
|
package Definitions renames C393011_0;
|
|
|
type Final_Alert_Type is new New_Alert.New_Alert_Type with null record;
|
type Final_Alert_Type is new New_Alert.New_Alert_Type with null record;
|
-- inherits Set_Status including body
|
-- inherits Set_Status including body
|
-- inherits Set_Serial including body
|
-- inherits Set_Serial including body
|
-- must override Display since inherited Display is abstract
|
-- must override Display since inherited Display is abstract
|
procedure Display(FA : in Final_Alert_Type);
|
procedure Display(FA : in Final_Alert_Type);
|
procedure Handle (FA : in out Final_Alert_Type);
|
procedure Handle (FA : in out Final_Alert_Type);
|
|
|
end C393011_4;
|
end C393011_4;
|
|
|
package body C393011_4 is
|
package body C393011_4 is
|
|
|
procedure Display (FA : in Final_Alert_Type) is
|
procedure Display (FA : in Final_Alert_Type) is
|
begin
|
begin
|
Definitions.Display_Device := FA.Display_Dev;
|
Definitions.Display_Device := FA.Display_Dev;
|
end Display;
|
end Display;
|
|
|
procedure Handle (FA : in out Final_Alert_Type) is
|
procedure Handle (FA : in out Final_Alert_Type) is
|
begin
|
begin
|
Set_Status (FA, Definitions.Handled);
|
Set_Status (FA, Definitions.Handled);
|
Set_Serial (FA);
|
Set_Serial (FA);
|
Display (FA);
|
Display (FA);
|
end Handle;
|
end Handle;
|
end C393011_4;
|
end C393011_4;
|
|
|
with C393011_0,
|
with C393011_0,
|
-- Definitions
|
-- Definitions
|
C393011_3;
|
C393011_3;
|
-- New_Alert -- package Alert is not visible
|
-- New_Alert -- package Alert is not visible
|
with C393011_4;
|
with C393011_4;
|
with Report;
|
with Report;
|
procedure C393011 is
|
procedure C393011 is
|
use C393011_4;
|
use C393011_4;
|
use Definitions;
|
use Definitions;
|
|
|
FA : Final_Alert_Type;
|
FA : Final_Alert_Type;
|
|
|
begin
|
begin
|
|
|
Report.Test ("C393011", "Check that an extended type can be derived " &
|
Report.Test ("C393011", "Check that an extended type can be derived " &
|
"from an abstract type");
|
"from an abstract type");
|
|
|
if (Definitions.Display_Device /= Definitions.Bit_Bucket)
|
if (Definitions.Display_Device /= Definitions.Bit_Bucket)
|
or (Definitions.Next /= 1)
|
or (Definitions.Next /= 1)
|
or (FA.Status /= Definitions.None)
|
or (FA.Status /= Definitions.None)
|
or (FA.Serial_Num /= 0)
|
or (FA.Serial_Num /= 0)
|
or (FA.Display_Dev /= TTY) then
|
or (FA.Display_Dev /= TTY) then
|
Report.Failed ("Incorrect initial conditions");
|
Report.Failed ("Incorrect initial conditions");
|
end if;
|
end if;
|
|
|
Handle (FA);
|
Handle (FA);
|
if (Definitions.Display_Device /= Definitions.TTY)
|
if (Definitions.Display_Device /= Definitions.TTY)
|
or (Definitions.Next /= 2)
|
or (Definitions.Next /= 2)
|
or (FA.Status /= Definitions.Handled)
|
or (FA.Status /= Definitions.Handled)
|
or (FA.Serial_Num /= 1)
|
or (FA.Serial_Num /= 1)
|
or (FA.Display_Dev /= TTY) then
|
or (FA.Display_Dev /= TTY) then
|
Report.Failed ("Incorrect results from Handle");
|
Report.Failed ("Incorrect results from Handle");
|
end if;
|
end if;
|
|
|
Report.Result;
|
Report.Result;
|
|
|
end C393011;
|
end C393011;
|
|
|
|
|