DIRECTORY IO USING [STREAM], MailBasics USING [RName, Timestamp], Rope USING [ROPE], ViewerTools USING [TiogaContents], WalnutKernelDefs USING [LogEntry, MsgLogEntry, LogEntryObject]; WalnutStream: CEDAR DEFINITIONS = BEGIN ROPE: TYPE = Rope.ROPE; STREAM: TYPE = IO.STREAM; LogEntry: TYPE = WalnutKernelDefs.LogEntry; LogEntryObject: TYPE = WalnutKernelDefs.LogEntryObject; MsgLogEntry: TYPE = WalnutKernelDefs.MsgLogEntry; Open: PROC[name: ROPE, readOnly: BOOL ¬ FALSE, pages: INT ¬ 200, useOldIfFound: BOOL ¬ FALSE, exclusive: BOOL ¬ FALSE] RETURNS [strm: STREAM]; Aborted: PROC [strm: STREAM] RETURNS [aborted: BOOL]; AbortStream: PROC [strm: STREAM]; FlushStream: PROC[strm: STREAM, setCreateDate: BOOL¬ FALSE]; SetHighWaterMark: PROC[ strm: STREAM, hwmBytes: INT, numPages: INT, setCreateDate: BOOL ¬ FALSE]; SetPosition: PROC[strm: STREAM, index: INT] RETURNS[ok: BOOL]; ReadRope: PROC[strm: STREAM, len: INT] RETURNS[ROPE]; FindNextEntry: PROC[strm: STREAM] RETURNS[startPos: INT]; ReadEntry: PROC[strm: STREAM, quick: BOOL ¬ FALSE] RETURNS[le: LogEntry, length: INT]; PeekEntry: PROC[strm: STREAM, quick: BOOL] RETURNS[ident: ATOM, msgID: ROPE, length: INT]; WriteEntry: PROC[strm: STREAM, le: LogEntry, pos: INT ¬ -1] RETURNS[startPos: INT]; logInfoRef: LogInfoRef; LogInfoRef: TYPE = REF LogInfoArray; LogInfoArray: TYPE = RECORD[ logFileInfo: REF LogFileInfo LogEntryObject, createMsg: REF CreateMsg LogEntryObject, expungeMsgs: REF ExpungeMsgs LogEntryObject, writeExpungeLog: REF WriteExpungeLog LogEntryObject, createMsgSet: REF CreateMsgSet LogEntryObject, emptyMsgSet: REF EmptyMsgSet LogEntryObject, destroyMsgSet: REF DestroyMsgSet LogEntryObject, addMsg: REF AddMsg LogEntryObject, removeMsg: REF RemoveMsg LogEntryObject, moveMsg: REF MoveMsg LogEntryObject, hasbeenRead: REF HasBeenRead LogEntryObject, recordNewMailInfo: REF RecordNewMailInfo LogEntryObject, startCopyNewMail: REF StartCopyNewMail LogEntryObject, endCopyNewMailInfo: REF EndCopyNewMailInfo LogEntryObject, acceptNewMail: REF AcceptNewMail LogEntryObject, startReadArchiveFile: REF StartReadArchiveFile LogEntryObject, endReadArchiveFile: REF EndReadArchiveFile LogEntryObject, startCopyReadArchive: REF StartCopyReadArchive LogEntryObject, endCopyReadArchiveInfo: REF EndCopyReadArchiveInfo LogEntryObject, endOfLog: REF EndOfLog LogEntryObject ]; WriteMsgBody: PROC[strm: STREAM, body: ViewerTools.TiogaContents]; Overwrite: PROC[to, from: STREAM, startPos: INT, fromPos: INT¬ -1]; CopyBytes: PROC[from, to: STREAM, num: INT]; MsgEntryInfoFromStream: PROC[strm: STREAM, mle: MsgLogEntry]; IdOnFileWithSender: PROC[ts: MailBasics.Timestamp, sender: MailBasics.RName] RETURNS[idOnFile: ROPE]; MsgNameFromIdOnFile: PROC[strm: STREAM] RETURNS[msg: ROPE]; END.  WalnutStream.Mesa Copyright Ó 1984, 1988, 1992 by Xerox Corporation. All rights reserved. Willie-Sue, December 13, 1988 11:54:24 am PST Contents: types and procedures which take an explicit stream parameter Opening streams (log files are assumed to be on alpine servers, but that is enforced by the higher levels) if exclusive then an file is opened in [$write, $fail] mode (not used by WalnutRoot) Miscellaneous stream operations flushes the stream and sets the create date to BasicTime.Now if requested sets the high water mark and length for an alpine file; if the length of the file is more than numPages, then it is truncated to that length; if numPages = -1, don't change the page count set the index on the stream, returns FALSE if index is beyond EndOfStream; if index = -1 then position to end reads a ROPE from strm, starting at the current position; returns NIL IF EndOfStream was encountered Reading and writing log entries find the next entry, starting at the current position of the stream, returns -1 if there are no more entries returns NIL if there is not a valid entry at pos, and doesn't change the log position. The stream will be positioned just beyond the entry. If the entry contains a log position, logicalStart is added to it. If quick is TRUE, a message does not get its headers parsed; the length of the headers is returned instead. returns ident = NIL if there is not a valid entry at the current log position. The stream index is NOT advanced by this operation. The length is the length of the entire entry, not just that portion of it read in this operation. Does not check if ident is for a legal log entry, allowing parsing of "illegal" logs if quick then don't return msgID (so don't have to make a rope) startPos (of the entry just written) is needed by the code which reads messages from grapevine WalnutStream provides a set of pre-allocated LogEntry records that can be filled in for use with WriteEntry writes body on at the end of strm, followed by a CR if startPos is -1 then writing is done at the end of to, if fromPos is -1 then don't reposition from copies num bytes from from to to parses the headers (that walnut is interested in) of a msg directly from stream procedures for trafficking in the various possible representations of an entity name Êÿ•NewlineDelimiter –(cedarcode) style™codešÏn™Kšœ Ïeœ=™HK™-—K˜KšœF™FK˜šÏk ˜ KšŸœŸœŸœ˜Kšœ Ÿœ˜$KšœŸœŸœ˜Kšœ Ÿœ˜"KšœŸœ)˜?K˜—KšœŸœŸ œ˜!K˜KšŸ˜˜KšŸœŸœŸœ˜KšŸœŸœŸœŸœ˜Kšœ Ÿœ˜+KšœŸœ#˜7Kšœ Ÿœ ˜1—K˜K™j™šœŸœŸœ ŸœŸœ ŸœŸœŸœ ŸœŸœŸœŸœ˜KšœT™T—K™—™K˜Kš œŸœŸœŸœ Ÿœ˜5K˜Kš œŸœŸœ˜!K˜š œŸœŸœŸœŸœ˜KšÏcm™m—K˜š œŸœŸœŸœŸœŸœ˜5KšœŸœ6ŸœŸœ™d—K™—™K˜š œŸœŸœŸœ Ÿœ˜9Kš l™l—K˜š œŸœŸœ ŸœŸœ˜2KšœŸœŸœ˜$Kšœ¾™¾—K˜š œŸœŸœŸœ˜*Kš œŸœŸœ Ÿœ Ÿœ˜0Kšœæ™æKšœT™TKšœ?™?—K˜š œŸœŸœŸœŸœ Ÿœ˜SK™_—K˜—™kK˜Kšœ˜K˜Kšœ ŸœŸœ˜$šœŸœŸœ˜Kšœ Ÿœ˜,Kšœ Ÿœ˜(Kšœ Ÿœ˜,KšœŸœ ˜4K˜KšœŸœ˜.Kšœ Ÿœ˜,KšœŸœ˜0KšœŸœ˜"Kšœ Ÿœ˜(Kšœ Ÿœ˜$Kšœ Ÿœ˜,K˜KšœŸœ"˜8KšœŸœ!˜6KšœŸœ#˜:KšœŸœ˜0K˜KšœŸœ%˜>KšœŸœ#˜:KšœŸœ%˜>KšœŸœ'˜BKšœ Ÿœ˜%K˜—K˜š œŸœŸœ#˜BK™3—K˜š œŸœ Ÿœ Ÿœ Ÿœ˜CKšœd™d—K™š œŸœ ŸœŸœ˜,Kšœ ™ —K˜šœŸœŸœ˜=K™O—K™—šœT™TK˜š œŸœŸœ%Ÿœ Ÿœ˜eK˜—š œŸœŸœŸœŸœ˜;K˜——K˜KšŸœ˜—…— Üã