TJaMControlImpl.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Maureen Stone, February 14, 1985 7:32:14 pm PST
Doug Wyatt, March 25, 1985 4:50:10 pm PST
DIRECTORY
TJaM,
TJaMPrivate;
TJaMControlImpl: CEDAR PROGRAM
IMPORTS TJaM, TJaMPrivate
EXPORTS TJaM
~ BEGIN OPEN TJaM, TJaMPrivate;
FrameImplRep: PUBLIC TYPE ~ TJaMPrivate.FrameImplRep;
NewFrame:
PUBLIC
PROC
RETURNS[Frame] ~ {
stack: Stack ~ NewStack[200];
dictStack: DictStack ~ NewDictStack[20];
sysDict: Dict ~ NewDict[17];
impl: FrameImpl ~ NEW[FrameImplRep ← [stack: stack, dictStack: dictStack, sysDict: sysDict]];
frame: Frame ~ NEW[FrameRep ← [impl: impl]];
Begin[frame, sysDict];
RETURN[frame];
};
Register:
PUBLIC
PROC[frame: Frame, name:
ATOM, proc: CommandProc] ~ {
found: BOOL; dict: Dict;
[found, dict] ← Where[frame, name];
IF found
THEN
WITH Get[dict, name]
SELECT
FROM
cmd: Cmd => cmd.proc ← proc;
ENDCASE;
Def[frame, name, NEW[CmdRep ← [proc: proc, name: name]]];
};
ApplyTrue: PROC[frame: Frame] ~ { PushBool[frame, TRUE] };
ApplyFalse: PROC[frame: Frame] ~ { PushBool[frame, FALSE] };
ApplySysDict:
PROC[frame: Frame] ~ {
impl: FrameImpl ~ frame.impl;
PushDict[frame, impl.sysDict];
};
RegisterPrimitive[".true", ApplyTrue];
RegisterPrimitive[".false", ApplyFalse];
RegisterPrimitive[".sysdict", ApplySysDict];
END.