-- File: PupPrint.mesa, Last Edit: HGM March 3, 1980 4:47 PM

-- Copyright Xerox Corporation 1979, 1980

DIRECTORY
IODefs: FROM "IODefs" USING [CR, NewLine, WriteChar, WriteString, WriteOctal],
PupDefs: FROM "PupDefs" USING [PupBuffer, GetPupContentsBytes, AppendPupAddress],
PupTypes: FROM "PupTypes" USING [PupAddress];

PupPrint: PROGRAM
IMPORTS
IODefs, PupDefs
EXPORTS PupDefs =
BEGIN


PrintErrorPup: PUBLIC PROCEDURE [b: PupDefs.PupBuffer] =
BEGIN OPEN IODefs;
i, len: CARDINAL;
IF ~NewLine[] THEN WriteChar[CR];
IF b.pupType=error THEN
BEGIN
WriteString["[Error Pup, code="L];
WriteOctal[b.errorCode];
WriteString[", from: "L];
PrintPupAddress[b.source];
WriteString["] "L];
len ← PupDefs.GetPupContentsBytes[b];
FOR i IN [0..len-2*(10+1+1)) DO WriteChar[b.errorText[i]]; ENDLOOP;
END
ELSE
BEGIN
WriteString["***** Funny PupType = "L];
WriteOctal[b.pupType];
WriteString["
*****"L];
E
ND;
WriteChar[CR];
END;

PrintPupAddress: PUBLIC PROCEDURE [a: PupTypes.PupAddress] =
BEGIN
buffer: STRING ← [50];
PupDefs.AppendPupAddress[buffer,a];
IODefs.WriteString[buffer];
END;

-- initialization
END.