|
|
DataMuseum.dkPresents historical artifacts from the history of: Rational R1000/400 Tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about Rational R1000/400 Tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: B T
Length: 14826 (0x39ea)
Types: TextFile
Names: »B«
└─⟦180fe333a⟧ Bits:30000405 8mm tape, Rational 1000, SW CATALOG, 10_20_0
└─⟦180fe333a⟧ Bits:30000537 8mm tape, Rational 1000, SW Catalog 10_20_0
└─⟦5cb1d1d7f⟧ »DATA«
└─⟦3b1ee7bd8⟧
└─⟦this⟧
with Type_Definitions, String_Pkg, Simple_Paginated_Output, Text_Io;
with Calendar, Time_Library_1, Time_Library_2;
---------------------------
package body Report_Library is
--| Ada Test and Evaluation Tools Report Lib
---------------------------
--| Overview
--| NOSC_Report_Library is a library of procedures common to all of the
--| NOSC Ada Test and Evaluation Tool Set (ATETS) report generators.
--| N/A: Raises, Requires, Modifies, Errors
use Type_Definitions; --| Global type declarations common to all
--| Ada Testing and Analysis Tools
use Simple_Paginated_Output; --| Output writer uses Text_IO;
use String_Pkg; --| String handling package for String_Types;
Report_Options : Options; --| Report formatting options;
Header : Variable_String_Array (1 .. 7);
------------------
function String_Of (--| Convert an integer to a string of length 1..Width
Int : in Integer; --| The Integer to be converted
Width : in Natural :=
0 --| The width of the string to be returned
) return String is
--| Effects
--| Converts the integer Int to a string of length Width. If Width = 0
--| then the length of the string is equal to the number of digits in
--| INT. If Width is greater than the number of digits in Int then the
--| integer is right justified in the string and padded with blanks.
package Int_Io is new Text_Io.Integer_Io (Integer);
Str : String (1 .. 20);
Index : Natural;
begin
Int_Io.Put (Str, Int);
if Width > Str'Last then
Index := Str'First;
elsif Width = 0 then
for I in reverse Str'Range loop
exit when Str (I) = ' ';
Index := I;
end loop;
else
Index := Str'Last - Width + 1;
end if;
return Str (Index .. Str'Last);
end String_Of;
----------------
function Replace (--| Replace characters in S1 at position Pos with S2
S1 : in String_Type;
--| String_Type with characters to be replaced
S2 : in String_Type;
--| String_Type to be inserted into copy of S2
Pos : in Natural
--| Position in S1 at which S2 is to be inserted
) return String_Type is
--| Effects
--| Returns Substr( S1, 1, Pos-1 ) & S2 &
--| Substr( S1, Pos+Length(S2), Length(S1)-Pos-Len(S2) )
--| N/A: Raises, Requires, Modifies, Errors
begin
return Insert (Splice (S1, Pos, Length (S2)), S2, Pos);
end Replace;
----------------
function Replace (--| Replace characters in S1 at position Pos with S2
S1 : in String_Type;
--| String_Type with characters to be replaced
S2 : in String;
--| String to be inserted into copy of S2
Pos : in Natural
--| Position in S1 at which S2 is to be inserted
) return String_Type is
--| Effects
--| Returns Substr( S1, 1, Pos-1 ) & S2 &
--| Substr( S1, Pos+Length(S2), Length(S1)-Pos-Len(S2) )
--| N/A: Raises, Requires, Modifies, Errors
begin
return Insert (Splice (S1, Pos, Length (Create (S2))), S2, Pos);
end Replace;
---------------
function Center
( --| Center text on header line
Text : in String; --| The text to be centered
Cpl : in
Characters_Per_Line --| Length of header text, in characters,
--| to be created
)
return Header_Text is
--| Effects
--| Returns a Header_Text line of length CPL with the input Text string
--| centered on the line.
--| N/A: Raises, Requires, Modifies, Errors
Header_Line : Header_Text;
begin
Header_Line := Make_Persistent (Text);
for I in 1 .. ((Cpl - Length (Header_Line)) / 2) loop
Header_Line := Insert (Header_Line, " ", 1);
end loop;
return Header_Line;
end Center;
--------------------------
procedure Open_Report_File
(--| Open the report file and set up formatting
Report : in out Paginated_File_Handle;
--| A "handle" for the report file
Report_File_Name : in
Filename; --| The name of the report file
Format_Options : in Options --| Report formatting options
) is
--| Effects
--| This procedure opens the report file for output and sets up the
--| report formatting options. If the report file already exists then
--| it is overwritten. A "handle" for the report file is returned to
--| the calling program. All output to the report file is performed via
--| the package Pagenated_Output. Report formatting options for the
--| output writer are set up according to the parameters specified in
--| Format_Options. Although no exceptions are raised by this procedure,
--| any Text_IO or Pagenated_Output exceptions that may be raised are
--| allowed to pass, unhandled, back to the calling program.
--| N/A: Raises, Requires, Modifies, Errors
Header_Size : constant Integer := 7;
Footer_Size : constant Integer := 3;
begin
--| Create the report file.
Create_Paginated_File (Value (Report_File_Name), Report,
Format_Options.Page_Size, Header_Size);
--| Save the report formatting options for later
Report_Options := Format_Options;
end Open_Report_File;
-----------------------------------------
procedure Print_Test_Configuration_Report
(
--| Print test configuration data to report file
Report : in out
Paginated_File_Handle; --| Output report file handle
Program_Name : in
Ada_Name; --| The name of the program under test
Log_File_Name : in Filename; --| Name of the log file
Test_Date : in
Calendar.Time; --| Date the log file was created
Test_Ident : in
Test_Identifier --| Test id specified by the user
) is
--| Effects
--| This procedure prints configuration information obtained from
--| the command line parameters and the Execution Log File on the
--| first page of the report file. All output to the report file
--| is performed via the package Pagenated_Output. No logfile is specified
--| as access to the logfile is not visible to the calling program.
--| The following information is printed on the configuration page
--| of the report file:
--|
--| Program Name: name of program under test
--| Test Date: date of log file generation
--| Test Time: time of log file generation
--| Report Date: date of report generation
--| Report Time: time of report generation
--| Logfile: log file name
--| Test ID: the test ID obtained from the log file
--| N/A: Raises, Requires, Modifies, Errors
use Calendar, Time_Library_1, Time_Library_2;
Dashes : constant String (1 .. Maximum_Cpl) :=
(1 .. Maximum_Cpl => '-');
Blanks : constant String (1 .. Maximum_Cpl) :=
(1 .. Maximum_Cpl => ' ');
Path_Title : constant String := "Ada Path Analyzer";
Autopath_Title : constant String := "Ada Automatic Path Analyzer";
Profile_Title : constant String := "Ada Performance Analyzer";
Smart_Title : constant String :=
"Ada Self Metric Analysis " & "and Reporting Tool";
Report_Title : constant String := " - Test Configuration Report";
Test_Time : String (1 .. 11); -- the time of the test
begin
--| Create 7 header lines. Lines 1 and 5 are initially created
--| with a length of 132 characters. Line 1 includes the day of the
--| week and escape sequences for Paginated_Output to print the
--| calendar date (~c), the time (~t), and the page number (~p).
String_Pkg.Mark;
Header (1) := Make_Persistent (Blanks);
Header (1) := Replace (Header (1), Weekday_Of (Clock), 85);
Header (1) := Replace (Header (1), "~d ~t Page: ~p", 98);
Header (2) := Make_Persistent (" ");
Header (3) := Make_Persistent (" ");
--| Center the name of the tool and the report title on line 4
case Report_Options.Tool_Name is
when Path_Tool =>
Header (4) := Center (Path_Title & Report_Title,
Report_Options.Cpl);
when Autopath_Tool =>
Header (4) := Center (Autopath_Title & Report_Title,
Report_Options.Cpl);
when Profile_Tool =>
Header (4) := Center (Profile_Title & Report_Title,
Report_Options.Cpl);
when Smart_Tool =>
Header (4) := Center (Smart_Title & Report_Title,
Report_Options.Cpl);
when others =>
null;
end case;
Header (5) := Make_Persistent (Dashes);
Header (6) := Make_Persistent (" ");
Header (7) := Make_Persistent (" ");
--| Set header lines 1 & 5 to the number of Character per line (CPL)
--| specified in Report_Options
Header (1) := Substr
(Header (1), Maximum_Cpl - Report_Options.Cpl + 1,
Report_Options.Cpl - 14); -- ~d and ~t add 14 chars
Header (5) := Substr (Header (5), Maximum_Cpl - Report_Options.Cpl + 1,
Report_Options.Cpl);
--| Insert the tool version number into the first header line
Header (1) := Replace (Header (1), Report_Options.Tool_Version, 1);
--| Print the report
Test_Time := Wall_Clock_Of (Seconds (Test_Date));
Set_Header (Report, Header); --| Set up the new header
Put (Report, " Program Under Test: ");
Put_Line (Report, Value (Program_Name));
Skip_Line (Report, 1);
Put (Report, " Test Date: ");
Put_Line (Report, Date_Of (Test_Date));
Skip_Line (Report, 1);
Put (Report, " Test Day: ");
Put_Line (Report, Weekday_Of (Test_Date));
Skip_Line (Report, 1);
Put (Report, " Test Time: ");
Put_Line (Report, Test_Time (1 .. 8));
Skip_Line (Report, 1);
Put (Report, " Log File: ");
Put_Line (Report, Value (Log_File_Name));
Skip_Line (Report, 1);
Put (Report, " Test ID: ");
Put_Line (Report, Value (Test_Ident));
String_Pkg.Release;
end Print_Test_Configuration_Report;
-------------------------------------
procedure Put_Test_Configuration_Data
(
--| Put log file test configuration data to current output
Program_Name : in
Ada_Name; --| The name of the program under test
Test_Date : in
Calendar.Time; --| Date the log file was created
Test_Ident : in
Test_Identifier --| Test id specified by the user
) is
--| Effects
--| This procedure puts test configuration information obtained from
--| the Execution Log File to current output. The following information
--| is output:
--|
--| Program Under Test: name of program under test
--| Test Date: date of log file generation
--| Test Time: time of log file generation
--| Test ID: the test ID obtained from the log file
--|
--| N/A: Raises, Requires, Modifies, Errors
use Calendar, Time_Library_1;
Test_Time : String (1 .. 11); --| the time of the test
begin
Test_Time := Wall_Clock_Of (Seconds (Test_Date));
Text_Io.New_Line;
Text_Io.Put ("Program Under Test: ");
Text_Io.Put_Line (Value (Program_Name));
Text_Io.Put ("Test Date: ");
Text_Io.Put_Line (Date_Of (Test_Date));
Text_Io.Put ("Test Time: ");
Text_Io.Put_Line (Test_Time (1 .. 8));
Text_Io.Put ("Test ID: ");
Text_Io.Put_Line (Value (Test_Ident));
Text_Io.New_Line;
end Put_Test_Configuration_Data;
--------------
function Query (--| Put a Yes or No question and get a response
Question : in String --| A query to be answered Y or N
) return Boolean is
--| Effects
--| The user is then prompted with Question. The user's response is then
--| tested for Y or N. Only the first character input is tested and
--| case is not significant. If Y is input then Response is returned
--| true. In N is input then Response is returned false. If Neither
--| Y nor N then the user is prompted again with Query.
--| N/A: Raises, Requires, Modifies, Errors
Answer : String (1 .. 80); --| temporary string for user's answer
Last : Natural; --| temporary variable used by Text_IO to
--| return the index of the last character
--| input by the user
begin
loop
Text_Io.Put (Question);
Text_Io.Get_Line (Answer, Last);
Text_Io.New_Line;
Text_Io.New_Line;
if Last > 0 then
case Answer (1) is
when 'Y' | 'y' =>
return True;
when 'N' | 'n' =>
return False;
when others =>
null;
end case;
end if;
end loop;
end Query;
end Report_Library;