TJaMControlImpl.mesa
Copyright Ó 1985, 1986, 1991, 1992 by Xerox Corporation. All rights reserved.
Maureen Stone, February 14, 1985 7:32:14 pm PST
Doug Wyatt, December 27, 1992 1:46 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, data: REF] ~ {
found: BOOL; dict: Dict;
[found, dict] ¬ Where[frame, name];
IF found THEN WITH Get[dict, name] SELECT FROM
cmd: Cmd => { cmd.proc ¬ proc; cmd.data ¬ data };
ENDCASE;
Def[frame, name, NEW[CmdRep ¬ [proc: proc, data: data, name: name]]];
};
SysDict: PUBLIC PROC [frame: Frame] RETURNS [Dict] ~ {
impl: FrameImpl ~ frame.impl;
RETURN[impl.sysDict];
};
ApplyTrue: CommandProc ~ { PushBool[frame, TRUE] };
ApplyFalse: CommandProc ~ { PushBool[frame, FALSE] };
ApplySysDict: CommandProc ~ { PushDict[frame, SysDict[frame]] };
RegisterPrimitive[".true", ApplyTrue];
RegisterPrimitive[".false", ApplyFalse];
RegisterPrimitive[".sysdict", ApplySysDict];
END.