NiceImpl.mesa
Copyright © 1986 by Xerox Corporation. All rights reserved.
Last Edited by: Swinehart, May 9, 1986 11:26:34 am PDT
DIRECTORY
Atom, IO, VoiceUtils, Nice, -- PrettyPrinTV, PrinTV, -- Rope, PrincOpsUtils, VBag, ViewRec, ViewerClasses;
NiceImpl:
CEDAR
PROGRAM
IMPORTS Atom, IO, VoiceUtils, 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 ← VoiceUtils.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[LOOPHOLE[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[LOOPHOLE[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[
LOOPHOLE[ViewRec.SetBehavior]]
THEN ViewRec.SetBehavior[newBehavior: [delayParms: [min: 1000]]];
-- Reduce sampling load
};
}.