SetPupChecksum:
PUBLIC
PROC [b: BufferDefs.PupBuffer] =
{
size: CARDINAL ← (b.pupLength - 1)/2;
checksumLoc: LONG POINTER ← @b.pupLength + size;
SELECT checksum
FROM
princOps => { checksumLoc^ ← Checksum.ComputeChecksum[0, size, @b.pupLength]; };
none => { checksumLoc^ ← 177777B; };
ENDCASE => ERROR;
};
TestPupChecksum:
PUBLIC
PROC [b: BufferDefs.PupBuffer]
RETURNS [
BOOLEAN] =
{
size: CARDINAL ← ((LOOPHOLE[b.pupLength - 1, CARDINAL])/2);
checksumLoc: LONG POINTER ← @b.pupLength + size;
cs: CARDINAL;
IF checksumLoc^ = 177777B THEN RETURN[TRUE];
SELECT checksum
FROM
princOps =>
{
BEWARE: The stack must be empty. Dont try RETURN[xx^=PupChecksum[xxx]];
cs ← Checksum.ComputeChecksum[0, size, @b.pupLength];
};
none => { RETURN[TRUE]; };
ENDCASE => ERROR;
RETURN[checksumLoc^ = cs];
};
}.