LookPrettyImpl.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Michael Plass, March 20, 1985 11:03:57 am PST
DIRECTORY TextLooks, AMBridge, AMTypes, IO, PrintTV, Rope, SafeStorage;
LookPrettyImpl: CEDAR PROGRAM
IMPORTS AMBridge, AMTypes, IO, PrintTV = BEGIN
TV: TYPE ~ AMTypes.TV;
recursive: BOOLFALSE;
TVPrint: PrintTV.TVPrintProc ~ TRUSTED {
cc: CHAR ← TextLooks.Look.FIRST;
true: TV ~ AMBridge.TVForReferent[NEW[BOOLTRUE]];
false: TV ~ AMBridge.TVForReferent[NEW[BOOLFALSE]];
IF AMBridge.IsRemote[tv] THEN RETURN [useOld: TRUE];
IF recursive THEN RETURN [useOld: TRUE];
recursive ← TRUE;
IO.PutRope[stream, "LOOKS["];
FOR c: TV ← AMTypes.First[AMTypes.Domain[looksType]], AMTypes.Next[c] UNTIL c = NIL DO
b: TV ← AMTypes.Apply[tv, c];
IF AMTypes.TVEqual[b, true] THEN IO.PutChar[stream, cc]
ELSE IF AMTypes.TVEqual[b, false] THEN NULL
ELSE ERROR;
IF cc # TextLooks.Look.LAST THEN cc ← cc.SUCC;
ENDLOOP;
IO.PutRope[stream, "]"];
recursive ← FALSE;
RETURN [useOld: FALSE];
};
looksType: SafeStorage.Type ← [CODE[TextLooks.Looks]];
try: TextLooks.Looks ← TextLooks.noLooks;
try['d] ← TRUE;
try['e] ← TRUE;
try['f] ← TRUE;
try['i] ← TRUE;
try['n] ← TRUE;
PrintTV.RegisterTVPrintProc[looksType, TVPrint];
END.