![]() |
|
![]() |
| 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.
*)
CONST
LetterLineMax = 132;
MaxLetterLines = 62;
CardLineMax = 132;
MaxCardLines = 13;
ReportLineMax = 32000;
TYPE
ReportLineType = ARRAY [0 .. ReportLineMax - 1] OF CHAR;
ReportLinePtrType = POINTER TO ReportLineType;
ReportStyleType = (Letter,
IndexCard);
HeaderProcType = PROCEDURE (CONST ReportLinePtrType,
CONST CARDINAL);
FooterProcType = PROCEDURE (CONST ReportLinePtrType,
CONST CARDINAL);
PROCEDURE InitReportLine
(VAR LinePtr : 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
(VAR LinePtr : 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
(VAR ReportHandle : BufIO.FileBF;
CONST ReportStyle : ReportStyleType;
CONST reportFile : ARRAY OF CHAR;
CONST HeaderLines : CARDINAL;
CONST FooterLines : CARDINAL);
(**
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 : ARRAY OF CHAR
The name of the report file that output is to go into.
HeaderLines : CARDINAL
The number of lines to reserve for the header.
FooterLines : CARDINAL
The number of lines to reserve for the footer.
*)
PROCEDURE PrepareLines
(VAR ReportHandle : BufIO.FileBF;
CONST numLines : CARDINAL;
CONST HeaderProc : HeaderProcType;
CONST FooterProc : 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 : CARDINAL
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
(VAR ReportHandle : BufIO.FileBF;
CONST line : ARRAY OF CHAR);
(**
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 : ARRAY OF CHAR
A line of report data.
*)
PROCEDURE CompleteCurrentPage
(VAR ReportHandle : BufIO.FileBF;
CONST PrintHeaderIfNone : BOOLEAN;
CONST HeaderProc : HeaderProcType;
CONST FooterProc : 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
(VAR ReportHandle : BufIO.FileBF;
CONST HeaderLines : CARDINAL;
CONST FooterLines : CARDINAL);
(**
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 : CARDINAL
The number of lines to use when printing a header.
FootLines : CARDINAL
The number of lines to use when printing a footer.
*)
PROCEDURE CloseReport
(VAR ReportHandle : BufIO.FileBF;
CONST FooterProc : 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