![]() |
|
![]() |
| CloseReport | CompleteCurrentPage | FreeReportLine | |
| InitReportLine | OpenReport | PrepareLines | PrintLine |
| ResetLineCounts |
--
-- This package encapulates some general use routines that will
-- help with producing a report style output to an Ascii file.
-- These routines track the number of lines being used and a
-- unique feature of this package is that user defined header
-- and footer routines can be called when a new header or
-- footer is being requested. This is done by calling the
-- PrepareLines routine just ahead of the actual write each
-- time that a line is going to be output.
--
LetterLineMax : constant := 132;
MaxLetterLines : constant := 62;
CardLineMax : constant := 132;
MaxCardLines : constant := 13;
ReportLineMax : constant := 32_000;
type ReportLineType is string (1 .. ReportLineMax);
type ReportLinePtrType is access ReportLineType;
type ReportStyleType is (Letter,
IndexCard);
type HeaderProcType is access
procedure (ReportHandle : in ReportLinePtrType;
numLines : in ModSys.S_Natural);
type FooterProcType is access
procedure (ReportHandle : in ReportLinePtrType;
numLines : in ModSys.S_Natural);
procedure InitReportLine
(LinePtr : in out ReportLinePtrType);
--*
-- InitReportLine - Initialize the report handle.
--
--
-- This procedure initializes the report handle so it is ready
-- to be used by the other routines in the package.
--
-- CALLING SEQUENCE -
--
-- InitReportLine (LinePtr)
--
-- ENTRY -
--
-- LinePtr : ReportLinePtrType
-- An internal handle used by this package.
--
procedure FreeReportLine
(LinePtr : in out ReportLinePtrType);
--*
-- FreeReportLine - Release the report handle after its use.
--
--
-- This procedure releases any allocated memory and clears
-- out the report handle after its use is completed.
--
-- CALLING SEQUENCE -
--
-- FreeReportLine (LinePtr)
--
-- ENTRY -
--
-- LinePtr : ReportLinePtrType
-- An internal handle used by this package.
--
procedure OpenReport
(ReportHandle : in out BufIO.FileBF;
ReportStyle : in ReportStyleType;
reportFile : in string;
HeaderLines : in ModSys.S_Natural;
FooterLines : in ModSys.S_Natural);
--*
-- OpenReport - Setup handle values to use during reporting.
--
--
-- This procedure sets up the handle to use during the report
-- generation process. This also defines the number of header and
-- footer lines to reserve leaving the number of possible data
-- lines that a page will have to use.
--
-- CALLING SEQUENCE -
--
-- OpenReport (ReportHandle, ReportStyle, reportFile,
-- HeaderLines, FooterLines)
--
-- ENTRY -
--
-- ReportHandle : BufIO.FileBF
-- A BufIO handle to the output file. This should not have been
-- opened yet, this routine will open it.
--
-- ReportStyle : ReportStyleType
-- The type of report desired.
--
-- ReportFile : string
-- The name of the report file that output is to go into.
--
-- HeaderLines : ModSys.S_Natural
-- The number of lines to reserve for the header.
--
-- FooterLines : ModSys.S_Natural
-- The number of lines to reserve for the footer.
--
procedure PrepareLines
(ReportHandle : in out BufIO.FileBF;
numLines : in ModSys.S_Natural;
HeaderProc : in HeaderProcType;
FooterProc : in FooterProcType);
--*
-- PrepareLines - Set up to handle printing the next numLines.
--
--
-- This procedure prepares to print the next NumLines lines of report
-- data. If the current page is too close the bottom to print that
-- many more lines as a group then the FooterProc is called to finish
-- this page and then the HeaderProc is called to start a new page.
-- For example if this routine is called with a value of 5 for NumLines
-- then immediately following this routine should be 5 consecutive
-- calls to the PrintLine routine.
--
-- CALLING SEQUENCE -
--
-- PrepareLines (ReportHandle, numLines, HeaderProc, FooterProc)
--
-- ENTRY -
--
-- ReportHandle : BufIO.FileBF
-- A BufIO handle to the output file.
--
-- numLines : ModSys.S_Natural
-- The number of lines that will be given in the next set of printing.
--
-- HeaderProc : HeaderProcType
-- The proc to call to get header data lines.
--
-- FooterProc : FooterProcType
-- The proc to call to get footer data lines.
--
procedure PrintLine
(ReportHandle : in out BufIO.FileBF;
line : in string);
--*
-- PrintLine - Output the next data line of the report.
--
--
-- This procedure sends a line of data out to the report. Prior to this
-- call the PrepareLines routine should have been called so that space for
-- this data was prepared.
--
-- CALLING SEQUENCE -
--
-- PrintLine (ReportHandle, line)
--
-- ENTRY -
--
-- ReportHandle : BufIO.FileBF
-- A BufIO handle to the output file.
--
-- line : string
-- A line of report data.
--
procedure CompleteCurrentPage
(ReportHandle : in out BufIO.FileBF;
PrintHeaderIfNone : in boolean;
HeaderProc : in HeaderProcType;
FooterProc : in FooterProcType);
--*
-- CompleteCurrentPage - Finish out the current page including footer.
--
--
-- This procedure continues from the current position with blank lines
-- to the point that a footer is needed. It then calls the FooterProc
-- to get the footer data and finish out the page.
--
-- CALLING SEQUENCE -
--
-- CompleteCurrentPage (ReportHandle, PrintHeaderIfNone,
-- HeaderProc, FooterProc)
--
-- ENTRY -
--
-- ReportHandle : BufIO.FileBF
-- A BufIO handle to the output file.
--
-- PrintHeaderIfNone : boolean
-- True - If the current page has not even been started print a header
-- anyway.
-- False - Do not print a header for the current page if it does not have
-- one yet.
--
-- HeaderProc : HeaderProcType
-- The proc to call to get header data lines.
--
-- FooterProc : FooterProcType
-- The proc to call to get footer data lines.
--
procedure ResetLineCounts
(ReportHandle : in out BufIO.FileBF;
HeaderLines : in ModSys.S_Natural;
FooterLines : in ModSys.S_Natural);
--*
-- ResetLineCounts - Reset head/foot line counts to new values.
--
--
-- This procedure resets the header/footer line counters so that
-- when a header or footer is next needed it will be this number
-- of lines instead of any value before this.
--
-- CALLING SEQUENCE -
--
-- ResetLineCounts (ReportHandle, HeaderLines, FooterLines)
--
-- ENTRY -
--
-- ReportHandle : BufIO.FileBF
-- A BufIO handle to the output file.
--
-- HeaderLines : ModSys.S_Natural
-- The number of lines to use when printing a header.
--
-- FootLines : ModSys.S_Natural
-- The number of lines to use when printing a footer.
--
procedure CloseReport
(ReportHandle : in out BufIO.FileBF;
FooterProc : in FooterProcType);
--*
-- CloseReport - Close the report to further output.
--
--
-- This procedure closes out the report handle and closes the
-- output file to further writing. If the current page
-- contains data then the FooterProc is called to finish
-- out the page.
--
-- CALLING SEQUENCE -
--
-- CloseReport (ReportHandle, FooterProc)
--
-- ENTRY -
--
-- ReportHandle : BufIO.FileBF
-- A BufIO handle to the output file.
--
-- FootProc : FooterProcType
-- The proc to call to get footer data lines.
--
Send mail to
warren.merrill@inl.gov
with questions or comments about this web site.
Copyright © 1989-2006 Battelle Energy Alliance