MailFormatP1516V3AuxImpl:
CEDAR
PROGRAM
IMPORTS Convert, Rope, MailTransportP17V5Aux
EXPORTS MailFormatP1516V3Aux ~ {
OPEN MailFormatP1516V3, MailFormatP1516V3Aux;
ROPE: TYPE ~ Rope.ROPE;
ExposeAttribute:
PUBLIC
PROC [arg: Attribute, level:
NAT]
RETURNS [res:
ROPE] ~ {
res ¬ "[";
res ¬ Rope.Cat[res, "type~", Convert.RopeFromCard[arg.type], ", "];
res ¬ Rope.Cat[res, "value~", ExposeVal[arg.value, (level+1)], "]"];
};
ExposeForwardedHeadings:
PUBLIC
PROC [arg: ForwardedHeadings, level:
NAT]
RETURNS [res:
ROPE] ~ {
res ¬ "[";
FOR i:
CARDINAL
IN [0..arg.length)
DO
res ¬ Rope.Cat[res, IF i>0 THEN ", " ELSE NIL, ExposeForwardedMessageInfo[arg.body[i], (level+1)]];
ENDLOOP;
res ¬ Rope.Concat[res, "]"];
};
ExposeHeadingAtt:
PUBLIC
PROC [arg: HeadingAtt, level:
NAT]
RETURNS [res:
ROPE] ~ {
res ¬ "[";
FOR i:
CARDINAL
IN [0..arg.length)
DO
res ¬ Rope.Cat[res, IF i>0 THEN ", " ELSE NIL, ExposeAttribute[arg.body[i], (level+1)]];
ENDLOOP;
res ¬ Rope.Concat[res, "]"];
};
ExposeVal:
PUBLIC
PROC [arg: Val, level:
NAT]
RETURNS [res:
ROPE] ~ {
res ¬ "[";
FOR i:
CARDINAL
IN [0..arg.length)
DO
res ¬ Rope.Cat[res, IF i>0 THEN ", " ELSE NIL, Convert.RopeFromCard[arg.body[i]]];
ENDLOOP;
res ¬ Rope.Concat[res, "]"];
};
ExposeNullRecord:
PUBLIC
PROC [arg: NullRecord, level:
NAT]
RETURNS [res:
ROPE] ~ {
res ¬ "[]";
};
ExposeSensitivity:
PUBLIC
PROC [arg: Sensitivity, level:
NAT]
RETURNS [res:
ROPE] ~ {
SELECT arg
FROM
personal => res ¬ "personal";
private => res ¬ "private";
companyConfidential => res ¬ "companyConfidential";
ENDCASE => ERROR
};
ExposeIPMessageIDList:
PUBLIC
PROC [arg: IPMessageIDList, level:
NAT]
RETURNS [res:
ROPE] ~ {
res ¬ "[";
FOR i:
CARDINAL
IN [0..arg.length)
DO
res ¬ Rope.Cat[res, IF i>0 THEN ", " ELSE NIL, ExposeIPMessageID[arg.body[i], (level+1)]];
ENDLOOP;
res ¬ Rope.Concat[res, "]"];
};
ExposeIPMessageID:
PUBLIC
PROC [arg: IPMessageID, level:
NAT]
RETURNS [res:
ROPE] ~ {
res ¬ "[";
res ¬ Rope.Cat[res, "originator~", MailTransportP17V5Aux.ExposeRName[arg.originator, (level+1)], ", "];
res ¬ Rope.Cat[res, "uniqueString~", arg.uniqueString, "]"];
};
ExposeImmutable:
PUBLIC
PROC [arg: Immutable, level:
NAT]
RETURNS [res:
ROPE] ~ {
res ¬ "[]";
};
ExposeHeadingBodyPart:
PUBLIC
PROC [arg: HeadingBodyPart, level:
NAT]
RETURNS [res:
ROPE] ~ {
res ¬ "[";
FOR i:
CARDINAL
IN [0..arg.length)
DO
res ¬ Rope.Cat[res, IF i>0 THEN ", " ELSE NIL, ExposeAttribute[arg.body[i], (level+1)]];
ENDLOOP;
res ¬ Rope.Concat[res, "]"];
};
ExposeassocBP:
PUBLIC
PROC [arg: assocBP, level:
NAT]
RETURNS [res:
ROPE] ~ {
res ¬ "[";
FOR i:
CARDINAL
IN [0..arg.length)
DO
res ¬ Rope.Cat[res, IF i>0 THEN ", " ELSE NIL, Convert.RopeFromCard[arg.body[i]]];
ENDLOOP;
res ¬ Rope.Concat[res, "]"];
};
ExposeForwardedMessageInfo:
PUBLIC
PROC [arg: ForwardedMessageInfo, level:
NAT]
RETURNS [res:
ROPE] ~ {
res ¬ "[";
res ¬ Rope.Cat[res, "envelope~", ExposeEnvelopeAtt[arg.envelope, (level+1)], ", "];
res ¬ Rope.Cat[res, "heading~", ExposeHeadingAtt[arg.heading, (level+1)], ", "];
res ¬ Rope.Cat[res, "associatedBodyParts~", ExposeassocBP[arg.associatedBodyParts, (level+1)], ", "];
res ¬ Rope.Cat[res, "indexOfParentHeading~", ExposeIndexOfParentHeading[arg.indexOfParentHeading, (level+1)], "]"];
};
ExposeRNameList:
PUBLIC
PROC [arg: RNameList, level:
NAT]
RETURNS [res:
ROPE] ~ {
res ¬ "[";
FOR i:
CARDINAL
IN [0..arg.length)
DO
res ¬ Rope.Cat[res, IF i>0 THEN ", " ELSE NIL, MailTransportP17V5Aux.ExposeRName[arg.body[i], (level+1)]];
ENDLOOP;
res ¬ Rope.Concat[res, "]"];
};
ExposeImportance:
PUBLIC
PROC [arg: Importance, level:
NAT]
RETURNS [res:
ROPE] ~ {
SELECT arg
FROM
low => res ¬ "low";
normal => res ¬ "normal";
high => res ¬ "high";
ENDCASE => ERROR
};
ExposeEnvelopeAtt:
PUBLIC
PROC [arg: EnvelopeAtt, level:
NAT]
RETURNS [res:
ROPE] ~ {
res ¬ "[";
FOR i:
CARDINAL
IN [0..arg.length)
DO
res ¬ Rope.Cat[res, IF i>0 THEN ", " ELSE NIL, MailTransportP17V5Aux.ExposeEnvelopeItem[arg.body[i], (level+1)]];
ENDLOOP;
res ¬ Rope.Concat[res, "]"];
};
ExposeIndexOfParentHeadingKind:
PUBLIC
PROC [arg: IndexOfParentHeadingKind, level:
NAT]
RETURNS [res:
ROPE] ~ {
SELECT arg
FROM
null => res ¬ "null";
nested => res ¬ "nested";
ENDCASE => ERROR
};
ExposeIndexOfParentHeading:
PUBLIC
PROC [arg: IndexOfParentHeading, level:
NAT]
RETURNS [res:
ROPE] ~ {
res ¬ Rope.Cat["IndexOfParentHeading(", ExposeIndexOfParentHeadingKind[arg.type, (level+1)], "): "];
WITH arg
SELECT
FROM
it:
REF IndexOfParentHeadingObject.null => {
res ¬ Rope.Concat[res, ExposeNullRecord[it.null, (level+1)]] };
it:
REF IndexOfParentHeadingObject.nested => {
res ¬ Rope.Concat[res, ExposeNestedIndex[it.nested, (level+1)]] };
ENDCASE => ERROR
};
ExposeNestedIndex:
PUBLIC
PROC [arg: NestedIndex, level:
NAT]
RETURNS [res:
ROPE] ~ {
res ¬ "[";
res ¬ Rope.Cat[res, "index~", Convert.RopeFromCard[arg.index], "]"];
};
}...