WalnutMiscLog.Mesa
Copyright Ó 1985, 1987, 1992 by Xerox Corporation. All rights reserved.
Willie-Sue, February 26, 1988 10:51:06 am PST
Contents: procedures for managing the newmail and readArchive logs
DIRECTORY
IO USING [STREAM],
Rope USING [ROPE],
WalnutDefs USING [CheckReportProc, WalnutOpsHandle];
WalnutMiscLog: CEDAR DEFINITIONS =
BEGIN
Types
ROPE: TYPE = Rope.ROPE;
STREAM: TYPE = IO.STREAM;
TiogaControlItemType: INT = 525;  --1015B
walnutItemFixedLength: INT = 20;  -- magic
CheckReportProc: TYPE = WalnutDefs.CheckReportProc;
WalnutOpsHandle: TYPE = WalnutDefs.WalnutOpsHandle;
Writing and Reading NewMail/ReadArchive files
GetNewMailLog: PROC[opsH: WalnutOpsHandle, lengthRequired: INT, pagesWanted: INT]
RETURNS[strm: STREAM];
opens the NewMailLog (aborting any current stream that might be open); truncates it to the required length; returns NIL if the log is shorter than required, or if the file could not be acquired or opened
CloseNewMailLog: PROC[opsH: WalnutOpsHandle];
closes the NewMailLog & updates local data structures
CreateReadArchiveLog: PROC[opsH: WalnutOpsHandle, fileToRead: STREAM, msgSet: ROPE, reportProc: CheckReportProc]
RETURNS[ok: BOOL, reason: ROPE];
reads fileToRead from the beginning and writes the readArchiveLog; returns TRUE if all went well; leaves the readArchiveLog closed, fileToRead open. If ok is FALSE, then reason describes what went wrong
CloseReadArchiveLog: PROC[opsH: WalnutOpsHandle];
closes the readArchiveLog & updates local data structures
ArchiveReader: PROC[opsH: WalnutOpsHandle, archiveStream, fileToRead: STREAM, msgSet: ROPE, reportProc: CheckReportProc, posToStartInFileToRead: INT]
RETURNS[ok: BOOL, lastCommitPosInFileToRead: INT];
given an archiveStream to write on and a file to read, this creates a readArchiveLog that can be appended to the current log
END.