![]() |
|
![]() |
| CloseReport | CompleteCurrentPage | ||
| FreeReportLine | InitReportLine | OpenReport | PrepareLines |
| PrintLine | ResetLineCounts | STRPrintLine |
//* // AscRptLib - Library of routines to write reports in ASCII format to a file. // // // 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 = 1000;
type
ReportLineType = array [0 .. ReportLineMax - 1] of char;
ReportLinePtrType = ^ReportLineType;
ReportStyleType = (Letter,
IndexCard);
HeaderProcType = procedure
(const ReportLinePtr : ReportLinePtrType;
const TheSize : cardinal); stdcall;
FooterProcType = procedure
(const ReportLinePtr : ReportLinePtrType;
const TheSize : cardinal); stdcall;
ReportHandleType = pointer;
procedure InitReportLine
(var LinePtr : ReportLinePtrType); stdcall;
exports InitReportLine name 'AscRptLib_InitReportLine';
//*
// 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); stdcall;
exports FreeReportLine name 'AscRptLib_FreeReportLine';
//*
// 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 : ReportHandleType;
const ReportStyle : ReportStyleType;
const reportFile : string;
const HeaderLines : cardinal;
const FooterLines : cardinal); stdcall;
exports OpenReport name 'AscRptLib_OpenReport';
//*
// 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 : ReportHandleType;
const numLines : cardinal;
const HeaderProc : HeaderProcType;
const FooterProc : FooterProcType); stdcall;
exports PrepareLines name 'AscRptLib_PrepareLines';
//*
// 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
(var ReportHandle : ReportHandleType;
const line : array of char); overload; stdcall;
exports PrintLine (var ReportHandle : ReportHandleType;
const line : array of char) name 'AscRptLib_PrintLine';
//*
// 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 PrintLine
(var ReportHandle : ReportHandleType;
const line : string); overload; stdcall;
exports PrintLine (var ReportHandle : ReportHandleType;
const line : string) name 'AscRptLib_STRPrintLine';
//*
// STRPrintLine - See documentation of PrintLine.
//
procedure CompleteCurrentPage
(var ReportHandle : ReportHandleType;
const PrintHeaderIfNone : boolean;
const HeaderProc : HeaderProcType;
const FooterProc : FooterProcType); stdcall;
exports CompleteCurrentPage name 'AscRptLib_CompleteCurrentPage';
//*
// 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 : ReportHandleType;
const HeaderLines : cardinal;
const FooterLines : cardinal); stdcall;
exports ResetLineCounts name 'AscRptLib_ResetLineCounts';
//*
// 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
(var ReportHandle : ReportHandleType;
const FooterProc : FooterProcType); stdcall;
exports CloseReport name 'AscRptLib_CloseReport';
//*
// 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