-- CA11006.A
|
-- CA11006.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.
|
--*
|
--*
|
--
|
--
|
-- OBJECTIVE:
|
-- OBJECTIVE:
|
-- Check that the private part of a child library unit can utilize
|
-- Check that the private part of a child library unit can utilize
|
-- its parent unit's private definition.
|
-- its parent unit's private definition.
|
--
|
--
|
-- TEST DESCRIPTION:
|
-- TEST DESCRIPTION:
|
-- Declare a package and public child package, both with private
|
-- Declare a package and public child package, both with private
|
-- parts. The child package will have a private extension of a type
|
-- parts. The child package will have a private extension of a type
|
-- declared in the parent's private part. In addition, the private
|
-- declared in the parent's private part. In addition, the private
|
-- part of the child package specification will make use of some of
|
-- part of the child package specification will make use of some of
|
-- the components declared in the private part of the parent.
|
-- the components declared in the private part of the parent.
|
--
|
--
|
--
|
--
|
-- CHANGE HISTORY:
|
-- CHANGE HISTORY:
|
-- 06 Dec 94 SAIC ACVC 2.0
|
-- 06 Dec 94 SAIC ACVC 2.0
|
-- 15 Nov 95 SAIC Update and repair for ACVC 2.0.1
|
-- 15 Nov 95 SAIC Update and repair for ACVC 2.0.1
|
--
|
--
|
--!
|
--!
|
|
|
package CA11006_0 is -- Package File_Package
|
package CA11006_0 is -- Package File_Package
|
|
|
type File_Descriptor is private;
|
type File_Descriptor is private;
|
type File_Mode is (Read_Only, Write_Only, Read_Write);
|
type File_Mode is (Read_Only, Write_Only, Read_Write);
|
type File_Type is tagged private;
|
type File_Type is tagged private;
|
|
|
function Next_Available_File return File_Descriptor;
|
function Next_Available_File return File_Descriptor;
|
|
|
private
|
private
|
|
|
type File_Measure is range 0 .. 1000;
|
type File_Measure is range 0 .. 1000;
|
type File_Descriptor is new Integer;
|
type File_Descriptor is new Integer;
|
|
|
Null_File : constant File_Descriptor := 0;
|
Null_File : constant File_Descriptor := 0;
|
Default_Mode : constant File_Mode := Read_Write;
|
Default_Mode : constant File_Mode := Read_Write;
|
|
|
type File_Type is tagged
|
type File_Type is tagged
|
record
|
record
|
Descriptor : File_Descriptor := Null_File;
|
Descriptor : File_Descriptor := Null_File;
|
Mode : File_Mode := Default_Mode;
|
Mode : File_Mode := Default_Mode;
|
end record;
|
end record;
|
|
|
System_File : File_Type;
|
System_File : File_Type;
|
|
|
end CA11006_0; -- Package File_Package
|
end CA11006_0; -- Package File_Package
|
|
|
--=================================================================--
|
--=================================================================--
|
|
|
package body CA11006_0 is -- Package File_Package
|
package body CA11006_0 is -- Package File_Package
|
|
|
File_Count : Integer := 0;
|
File_Count : Integer := 0;
|
|
|
function Next_Available_File return File_Descriptor is
|
function Next_Available_File return File_Descriptor is
|
begin
|
begin
|
File_Count := File_Count + 1;
|
File_Count := File_Count + 1;
|
return File_Descriptor (File_Count);
|
return File_Descriptor (File_Count);
|
end Next_Available_File;
|
end Next_Available_File;
|
|
|
end CA11006_0; -- Package File_Package
|
end CA11006_0; -- Package File_Package
|
|
|
--=================================================================--
|
--=================================================================--
|
|
|
package CA11006_0.CA11006_1 is -- Child package File_Package.Operations
|
package CA11006_0.CA11006_1 is -- Child package File_Package.Operations
|
|
|
type File_Length_Type is private;
|
type File_Length_Type is private;
|
type Extended_File_Type is new File_Type with private;
|
type Extended_File_Type is new File_Type with private;
|
|
|
System_Extended_File : constant Extended_File_Type;
|
System_Extended_File : constant Extended_File_Type;
|
|
|
procedure Create_File (Mode : in File_Mode;
|
procedure Create_File (Mode : in File_Mode;
|
File : out Extended_File_Type);
|
File : out Extended_File_Type);
|
|
|
procedure Compress_File (Original : in Extended_File_Type;
|
procedure Compress_File (Original : in Extended_File_Type;
|
Compressed_File : out Extended_File_Type);
|
Compressed_File : out Extended_File_Type);
|
|
|
function Validate (File : in Extended_File_Type) return Boolean;
|
function Validate (File : in Extended_File_Type) return Boolean;
|
|
|
function Validate_Compression (File : in Extended_File_Type)
|
function Validate_Compression (File : in Extended_File_Type)
|
return Boolean;
|
return Boolean;
|
-- These two validation functions provide
|
-- These two validation functions provide
|
-- the capability to check the private
|
-- the capability to check the private
|
-- components defined in the parent and
|
-- components defined in the parent and
|
-- child packages from within the client
|
-- child packages from within the client
|
-- program.
|
-- program.
|
private
|
private
|
|
|
type File_Length_Type is new File_Measure; -- Parent private type.
|
type File_Length_Type is new File_Measure; -- Parent private type.
|
|
|
Min_File_Size : File_Length_Type := File_Length_Type'First;
|
Min_File_Size : File_Length_Type := File_Length_Type'First;
|
Max_File_Size : File_Length_Type := File_Length_Type'Last;
|
Max_File_Size : File_Length_Type := File_Length_Type'Last;
|
|
|
type Extended_File_Type is new File_Type with -- Parent type.
|
type Extended_File_Type is new File_Type with -- Parent type.
|
record
|
record
|
Blocks : File_Length_Type := Min_File_Size;
|
Blocks : File_Length_Type := Min_File_Size;
|
end record;
|
end record;
|
|
|
System_Extended_File : constant Extended_File_Type :=
|
System_Extended_File : constant Extended_File_Type :=
|
(Descriptor => System_File.Descriptor, -- Parent private object.
|
(Descriptor => System_File.Descriptor, -- Parent private object.
|
Mode => Read_Only, -- Parent enumeration literal.
|
Mode => Read_Only, -- Parent enumeration literal.
|
Blocks => Min_File_Size);
|
Blocks => Min_File_Size);
|
|
|
|
|
end CA11006_0.CA11006_1; -- Child Package File_Package.Operations
|
end CA11006_0.CA11006_1; -- Child Package File_Package.Operations
|
|
|
--=================================================================--
|
--=================================================================--
|
|
|
-- Child package body File_Package.Operations
|
-- Child package body File_Package.Operations
|
package body CA11006_0.CA11006_1 is
|
package body CA11006_0.CA11006_1 is
|
|
|
procedure Create_File
|
procedure Create_File
|
(Mode : in File_Mode;
|
(Mode : in File_Mode;
|
File : out Extended_File_Type) is
|
File : out Extended_File_Type) is
|
begin
|
begin
|
File.Descriptor := Next_Available_File; -- Parent subprogram.
|
File.Descriptor := Next_Available_File; -- Parent subprogram.
|
File.Mode := Default_Mode; -- Parent private constant.
|
File.Mode := Default_Mode; -- Parent private constant.
|
File.Blocks := Max_File_Size;
|
File.Blocks := Max_File_Size;
|
end Create_File;
|
end Create_File;
|
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
procedure Compress_File (Original : in Extended_File_Type;
|
procedure Compress_File (Original : in Extended_File_Type;
|
Compressed_File : out Extended_File_Type) is
|
Compressed_File : out Extended_File_Type) is
|
begin
|
begin
|
Compressed_File.Descriptor := Next_Available_File;
|
Compressed_File.Descriptor := Next_Available_File;
|
Compressed_File.Mode := Read_Only;
|
Compressed_File.Mode := Read_Only;
|
Compressed_File.Blocks := Original.Blocks / 2; -- Simulated file
|
Compressed_File.Blocks := Original.Blocks / 2; -- Simulated file
|
end Compress_File; -- compression.
|
end Compress_File; -- compression.
|
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
function Validate (File : in Extended_File_Type) return Boolean is
|
function Validate (File : in Extended_File_Type) return Boolean is
|
begin
|
begin
|
if ((File.Descriptor /= System_Extended_File.Descriptor) and
|
if ((File.Descriptor /= System_Extended_File.Descriptor) and
|
(File.Mode = Read_Write) and
|
(File.Mode = Read_Write) and
|
(File.Blocks = Max_File_Size)) then
|
(File.Blocks = Max_File_Size)) then
|
return True;
|
return True;
|
else
|
else
|
return False;
|
return False;
|
end if;
|
end if;
|
end Validate;
|
end Validate;
|
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
function Validate_Compression (File : in Extended_File_Type)
|
function Validate_Compression (File : in Extended_File_Type)
|
return Boolean is
|
return Boolean is
|
begin
|
begin
|
if ((File.Descriptor /= System_File.Descriptor) and
|
if ((File.Descriptor /= System_File.Descriptor) and
|
(File.Mode = Read_Only) and
|
(File.Mode = Read_Only) and
|
(File.Blocks = Max_File_Size/2)) then
|
(File.Blocks = Max_File_Size/2)) then
|
return True;
|
return True;
|
else
|
else
|
return False;
|
return False;
|
end if;
|
end if;
|
end Validate_Compression;
|
end Validate_Compression;
|
|
|
end CA11006_0.CA11006_1; -- Child package body File_Package.Operations
|
end CA11006_0.CA11006_1; -- Child package body File_Package.Operations
|
|
|
--=================================================================--
|
--=================================================================--
|
|
|
with CA11006_0.CA11006_1; -- with Child package File_Package.Operations
|
with CA11006_0.CA11006_1; -- with Child package File_Package.Operations
|
with Report;
|
with Report;
|
|
|
procedure CA11006 is
|
procedure CA11006 is
|
|
|
package File renames CA11006_0;
|
package File renames CA11006_0;
|
package File_Ops renames CA11006_0.CA11006_1;
|
package File_Ops renames CA11006_0.CA11006_1;
|
|
|
Validation_File_Mode : File.File_Mode := File.Read_Only;
|
Validation_File_Mode : File.File_Mode := File.Read_Only;
|
Validation_File,
|
Validation_File,
|
Storage_Copy : File_Ops.Extended_File_Type;
|
Storage_Copy : File_Ops.Extended_File_Type;
|
|
|
begin
|
begin
|
|
|
Report.Test ("CA11006", "Check that the private part of a child " &
|
Report.Test ("CA11006", "Check that the private part of a child " &
|
"library unit can utilize its parent " &
|
"library unit can utilize its parent " &
|
"unit's private definition");
|
"unit's private definition");
|
|
|
File_Ops.Create_File (Validation_File_Mode, Validation_File);
|
File_Ops.Create_File (Validation_File_Mode, Validation_File);
|
|
|
if not File_Ops.Validate (Validation_File) then
|
if not File_Ops.Validate (Validation_File) then
|
Report.Failed ("Incorrect initialization of file");
|
Report.Failed ("Incorrect initialization of file");
|
end if;
|
end if;
|
|
|
File_Ops.Compress_File (Validation_File, Storage_Copy);
|
File_Ops.Compress_File (Validation_File, Storage_Copy);
|
|
|
if not (File_Ops.Validate (Validation_File) and
|
if not (File_Ops.Validate (Validation_File) and
|
File_Ops.Validate_Compression (Storage_Copy))
|
File_Ops.Validate_Compression (Storage_Copy))
|
then
|
then
|
Report.Failed ("Incorrect compression of file");
|
Report.Failed ("Incorrect compression of file");
|
end if;
|
end if;
|
|
|
Report.Result;
|
Report.Result;
|
|
|
end CA11006;
|
end CA11006;
|
|
|