WalnutMiscLog.Mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Willie-Sue, June 17, 1986 11:37:33 am PDT
Contents: procedures for managing the newmail and readArchive logs
DIRECTORY
IO USING [STREAM],
Rope USING [ROPE];
WalnutMiscLog: CEDAR DEFINITIONS =
BEGIN
Types
ROPE: TYPE = Rope.ROPE;
STREAM: TYPE = IO.STREAM;
TiogaControlItemType: INT = 525;  --1015B
walnutItemFixedLength: INT = 20;  -- magic
Writing and Reading NewMail/ReadArchive files
GetNewMailLog: PROC[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;
closes the NewMailLog & updates local data structures
CreateReadArchiveLog: PROC[
fileToRead: STREAM, msgSet: ROPE, reportProc: PROC[msg1, msg2, msg3: ROPENIL]]
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;
closes the readArchiveLog & updates local data structures
ArchiveReader: PROC[archiveStream, fileToRead: STREAM, msgSet: ROPE,
reportProc: PROC[msg1, msg2, msg3: ROPENIL],
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
MiscShutdown: PROC;
clear any local variables
END.