JaMIShowIPImpl.mesa
Copyright Ó 1992 by Xerox Corporation. All rights reserved.
Mik Lamming - May 21, 1987 3:30:00 pm PDT
Bier, September 15, 1992 5:11 pm PDT
DIRECTORY
InterpressInterpreter, Rope, JaM, Imager, JaMIPrivate;
JaMIShowIPImpl: CEDAR PROGRAM
IMPORTS InterpressInterpreter, JaM, Imager, JaMIPrivate, Rope
EXPORTS JaMIPrivate ~ BEGIN
IpOpenFailed: ERROR[msg: Rope.ROPE] = CODE;
LogError: InterpressInterpreter.LogProc ~ {
ERROR IpOpenFailed[Rope.Concat["Interpress error: ", explanation]];
};
ApplyShowIP: PROC [self: JaM.State] ~ {
GetContext: PROC [self: JaM.State] RETURNS [Imager.Context] ~ {
info: JaMIPrivate.Info ¬ JaMIPrivate.GetInfo[self];
IF info = NIL THEN ERROR;
IF info.ipenabled THEN RETURN [info.ipdc];
RETURN[info.vdc];
};
Action: PROC ~ {
Log : InterpressInterpreter.LogProc ~ {
ERROR JaM.Error[type: InvalidArgs, msg: explanation] -- just resume
};
Imager.ScaleT[context, 1.0/Imager.metersPerPoint];
InterpressInterpreter.DoPage[master: master, page: page, context: context, log: Log]
};
info: JaMIPrivate.Info ¬ JaMIPrivate.GetInfo[self];
context: Imager.Context ~ GetContext[self];
file: Rope.ROPE ¬ JaM.PopRope[self];
page: INT ¬ JaM.PopInt[self];
master: InterpressInterpreter.Master;
master ¬ InterpressInterpreter.Open[file, LogError ! IpOpenFailed => {
ERROR JaM.Error[type: OpenFailed, msg: msg]
}];
page ¬ MAX[1, MIN[page, master.pages]];
Imager.DoSaveAll[context, Action];
};
RegisterShowIP: PUBLIC PROC [self: JaM.State] ~ {
JaM.Register[self, ".showip", ApplyShowIP];
};
END.