WalnutParseMsg.mesa - Types for Parsing messages
Copyright © 1984, 1985 by Xerox Corporation. All rights reserved.
Willie-Sue on: December 6, 1984 2:01:58 pm PST
Russ Atkinson (RRA) March 21, 1985 0:13:10 am PST
DIRECTORY
IO USING [STREAM],
Rope USING [ROPE];
WalnutParseMsg: CEDAR DEFINITIONS = BEGIN OPEN IO, Rope;
Global types
Qualification: TYPE = {unqualified, dotQualified, arpaQualified};
MessageFieldIndex: TYPE = {   -- order is significant
replyToF, senderF, fromF, toF, ccF, cF, bccF, dateF, subjectF, categoriesF,
inReplyToF, voiceF};
MessageFType: TYPE = {simpleRope, rCatList, rNameList};
MessageInfo: TYPE = RECORD[name: ROPE, fType: MessageFType];
messageParseArray: ARRAY MessageFieldIndex OF MessageInfo;
ParseStatus: TYPE = {ok, syntaxError};
SendParseStatus: TYPE = {ok, includesPublicDL, includesPrivateDL, fieldNotAllowed, syntaxError};
types and procedures for parsing messages
MsgHeaders: TYPE = LIST OF MsgHeaderItem;
MsgHeaderItem: TYPE = RECORD[fieldName, value: ROPE];
ParseProc: TYPE = PROC[fieldName: ROPE] RETURNS[wantThisOne, continue: BOOL];
ParseMsgFromStream: PROC[strm: STREAM, len: INT, proc: ParseProc] RETURNS[msgHeaders: MsgHeaders];
proc is called for each fieldName encountered in the message (which starts at the current pos and is no more than len characters long). If EndOfStream is encountered, the parsing is exited cleanly
Parse: PROC[text: ROPE] RETURNS[status: SendParseStatus, sPos, mPos: INT, rList: LIST OF ROPE];
CanonicalName: PROC[simpleName, registry: ROPE] RETURNS[name: ROPE];
END.