Dump:
PUBLIC
PROC [s:
IO.
STREAM, showContent:
BOOLEAN ←
TRUE] ~ {
Description of the procedure.
IO.PutRope[s, "6085 "];
DumpZone[data.myZone, s, showContent];
IO.PutRope[s, "Sparc "];
DumpZone[data.hisZone, s, showContent];
};
DumpZone:
PUBLIC
PROC [z: Zone, s:
IO.
STREAM, showContent:
BOOLEAN ←
TRUE] ~
TRUSTED {
Description of the procedure.
r: REF TEXT ← NEW[TEXT[2048]];
IO.PutF[s, "Zone: %x\n", IO.card[z.a]];
IO.PutF[s, "lastWritten: %d\n", [cardinal[SoftcardUtil.GetCard32[[z.a+lastWritten]]]]];
IO.PutF[s, "lastRed : %d\n", [cardinal[SoftcardUtil.GetCard32[[z.a+lastRed]]]]];
FOR i:
CARD32
IN [0..maxHeaders)
DO
hr: HeaderRec ← GetHeaderRec[z, i];
IO.PutF[s, "msg #%d: ", IO.card[i]];
IO.PutF[s, "b: %d, l: %d, t:%d, d1: %d, d2: %d\n", IO.card[hr.b], IO.card[hr.size], IO.card[hr.type], IO.card[hr.data1], IO.card[hr.data2]];
IF showContent
AND hr.size>0
THEN {
bufHead, bufTail: Block;
r.length ← hr.size;
bufHead ← hr.b;
bufTail ← IF bufHead+hr.size>bufSize THEN hr.size-bufSize+bufHead ELSE bufHead+hr.size;
IF bufHead<=bufTail
THEN {
SoftcardUtil.CopyFrom[r, 0, hr.size, [z+buffer+bufHead/2]];
}
ELSE {
SoftcardUtil.CopyFrom[r, 0, bufSize-bufHead, [z+buffer+bufHead/2]];
SoftcardUtil.CopyFrom[r, bufSize-bufHead, bufTail, [z+buffer]];
};
IO.PutF[s, "\t\t Contents: %g\n", IO.text[r]];
};
ENDLOOP;
};