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[32*1024-1]];
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]];
};
IF r.length<dumpAbLimit THEN IO.PutF[s, "\t\t Content: %g\n", IO.text[r]]
ELSE {
totalLength: CARD ← r.length;
r.length ← 48;
IO.PutF[s, "\t\t Ab. content: %g /.../ ", IO.text[r]];
FOR i:
CARD32
IN [totalLength-24..totalLength)
DO
IO.PutChar[s, r[i]];
ENDLOOP;
IO.PutChar[s, '\n];
};
};
ENDLOOP;
};