NiceImpl.mesa
Last Edited by: Swinehart, June 15, 1984 0:40:21 am PDT
DIRECTORY
Atom, IO, Log, Nice, -- PrettyPrinTV, PrinTV, -- Rope, RPCPkt, PrincOpsUtils, VBag, ViewRec, ViewerClasses;
NiceImpl:
CEDAR
PROGRAM
IMPORTS Atom, IO, Log, PrincOpsUtils,
-- PrinTV, PrettyPrinTV,-- VBag, ViewRec
EXPORTS Nice
SHARES VBag = {
BeNiceDo:
PROC[r:
REF, d:
INT, how:
ATOM←$System, howD:
REF←
NIL] =
TRUSTED {
out: IO.STREAM ← Log.FindWhere[how, howD];
out.Put[IO.refAny[r]];
<< This is what is meant to happen! Wait for PrettyPrint to reappear >>
put: PrinTV.PutClosure ← PrettyPrinTV.StreamToPrettyPutClosure[out, 60];
PrinTV.Print[
tv: AMBridge.TVForReferent[r], put: put, depth: d, maxLength: 32, verbose: FALSE];
PrettyPrinTV.Flush[put];
};
ViewDo:
PROC[r:
REF, name: Rope.
ROPE] =
TRUSTED {
IF ~PrincOpsUtils.IsBound[VBag.Start] THEN RETURN;
IF recTable=NIL THEN recTable←VBag.Create["Program Management Variables"];
[]←VBag.Start[recTable, r, name];
};
ViewOne:
PUBLIC
PROC[r:
REF, name: Rope.
ROPE←
NIL, iconic:
BOOL←
FALSE] = {
IF ~PrincOpsUtils.IsBound[ViewRec.ViewRef] THEN RETURN;
[]←ViewRec.ViewRef[agg: r, viewerInit: [name: name, iconic: iconic]];
};
Procedure for debugging only
Ref: PUBLIC UNSAFE PROC[whatever: LONG CARDINAL] RETURNS [REF] = UNCHECKED {RETURN[LOOPHOLE[whatever]]};
recTable: ViewerClasses.Viewer←NIL;
Atom.PutProp[$Interfaces, $BeNice, NEW[Nice.BeNiceProcNiceDo]];
Atom.PutProp[$Interfaces, $View, NEW[Nice.ViewProc←ViewDo]];
TRUSTED {
IF PrincOpsUtils.IsBound[ViewRec.SetBehavior]
THEN ViewRec.SetBehavior[newBehavior: [delayParms: [min: 1000]]];
-- Reduce sampling load
};
}.