ImagerCompileImpl.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Michael Plass, October 21, 1985 5:34:55 pm PDT
DIRECTORY Imager, ImagerCompile, ImagerMemory;
ImagerCompileImpl: CEDAR PROGRAM
IMPORTS Imager, ImagerMemory
EXPORTS ImagerCompile
~
BEGIN
Context:
TYPE ~ Imager.Context;
CompiledImage: TYPE ~ REF CompiledImageRep;
CompiledImageRep:
PUBLIC
TYPE ~
RECORD [
memory: Context
];
CachedDataRep: TYPE ~ RECORD [
kindOfContext: ATOM,
. . .
];
MakeCompiledImage:
PUBLIC
PROC [action:
PROC [Context]]
RETURNS [CompiledImage] ~ {
context: Context ~ ImagerMemory.NewMemoryContext[];
action[context];
RETURN [NEW[CompiledImageRep ← [memory: context]]]
};
Execute:
PUBLIC
PROC [context: Imager.Context, compiledImage: CompiledImage] ~ {
IF compiledImage.memory = NIL THEN ERROR Imager.Error[[$ClientBug, "Attempt to execute compiled image that has been destroyed"]];
ImagerMemory.Replay[c: compiledImage.memory, into: context];
};
Destroy:
PUBLIC
PROC [compiledImage: CompiledImage] ~ {
compiledImage.memory ← NIL;
};
END.