PupDebug.mesa
Copyright © 1986 by Xerox Corporation. All rights reserved.
Hal Murray, January 4, 1986 5:35:38 pm PST
DIRECTORY
AMBridge USING [TVToLC],
AMTypes USING [IndexToTV, TV],
IO USING [PutF],
PrincOps USING [zEXCH],
PrintTV USING [RegisterRefPrintProc, RegisterTVPrintProc, RefPrintProc, TVPrintProc],
PupTypes USING [PupAddress, PupHostID, PupNetID, PupSocketID];
PupDebug:
CEDAR
PROGRAM
IMPORTS AMBridge, AMTypes, IO, PrintTV= {
Flip: PROC [PupTypes.PupSocketID] RETURNS [LONG CARDINAL] = TRUSTED MACHINE CODE {PrincOps.zEXCH};
PupAddress: TYPE = PupTypes.PupAddress;
PrintRefPupAddress: PrintTV.RefPrintProc = {
[ref: REF READONLY ANY, data: REF ANY, stream: STREAM, depth: INT ← 4, width: INT ← 32, verbose: BOOL ← FALSE] RETURNS [useOld: BOOL ← FALSE]
foo: REF READONLY PupAddress ← NARROW[ref];
socket: LONG CARDINAL ← Flip[foo.socket];
IO.PutF[stream, "%B#%B#%B", [integer[foo.net]], [integer[foo.host]], [cardinal[socket]] ];
};
PrintTVPupAddress: PrintTV.TVPrintProc =
TRUSTED {
[tv: TV, data: REF ANY, stream: STREAM, depth: INT ← 4, width: INT ← 32, verbose: BOOL ← FALSE] RETURNS [useOld: BOOL ← FALSE]
foo: PupAddress;
socket: LONG CARDINAL;
netTV: AMTypes.TV ← AMTypes.IndexToTV[tv, 1];
hostTV: AMTypes.TV ← AMTypes.IndexToTV[tv, 2];
socketTV: AMTypes.TV ← AMTypes.IndexToTV[tv, 3];
socketTVa: AMTypes.TV ← AMTypes.IndexToTV[socketTV, 1];
socketTVb: AMTypes.TV ← AMTypes.IndexToTV[socketTV, 2];
foo.net ← [AMBridge.TVToLC[netTV]];
foo.host ← [AMBridge.TVToLC[hostTV]];
foo.socket.a ← AMBridge.TVToLC[socketTVa];
foo.socket.b ← AMBridge.TVToLC[socketTVb];
socket ← Flip[foo.socket];
IO.PutF[stream, "%B#%B#%B", [cardinal[foo.net]], [cardinal[foo.host]], [cardinal[socket]] ];
};
PrintTV.RegisterRefPrintProc[CODE[PupAddress], PrintRefPupAddress];
PrintTV.RegisterTVPrintProc[CODE[PupAddress], PrintTVPupAddress];