GriffinToIPImpl.mesa
Copyright © 1985 by Xerox Corporation. All rights reserved.
Eric Nickell, September 5, 1985 9:45:33 am PDT
DIRECTORY
Commander USING [CommandProc, Register],
CommandTool USING [ArgumentVector, Parse],
FS USING [Error],
GriffinImageUtils USING [GriffinToImagerCalls, ReadGriffinImage],
Imager USING [Context, metersPerMica, ScaleT, SetStrokeEnd, SetStrokeJoint],
ImagerBackdoor USING [SetInt],
ImagerInterpress USING [Close, Create, DoPage, Ref],
Rope USING [Cat, Equal, ROPE];
GriffinToIPImpl: CEDAR PROGRAM
IMPORTS Commander, CommandTool, FS, GriffinImageUtils, Imager, ImagerBackdoor, ImagerInterpress, Rope
~
BEGIN
Context: TYPE ~ Imager.Context;
ROPE: TYPE ~ Rope.ROPE;
griffinToIPMessage: ROPE ~ "Convert Griffin file to Interpress (output ← input)";
GriffinToIP: Commander.CommandProc ~ {
args: CommandTool.ArgumentVector ← CommandTool.Parse[cmd];
IF args.argc#4 OR ~Rope.Equal[args[2], "←"] THEN RETURN [result: $Failure, msg: griffinToIPMessage]
ELSE {
ImageGriffin:
PROC [context: Context] ~ {
ImagerBackdoor.SetInt[context: context, key: priorityImportant, val: 1];
Imager.SetStrokeEnd[context: context, strokeEnd: round];
Imager.SetStrokeJoint[context: context, strokeJoint: round];
Imager.ScaleT[context, Imager.metersPerMica];
GriffinImageUtils.GriffinToImagerCalls[context, GriffinImageUtils.ReadGriffinImage[args[3]]];
};
ref: ImagerInterpress.Ref ~ ImagerInterpress.Create[fileName: args[1]];
ImagerInterpress.DoPage[ref, ImageGriffin !
FS.Error => {
IF error.group=user
THEN {
msg ← Rope.Cat[args[3], " not found."];
GOTO Fail;
};
}];
ImagerInterpress.Close[ref];
};
EXITS
Fail => {result ← $Failure};
};
Commander.Register[key: "GriffinToIP", proc: GriffinToIP, doc: griffinToIPMessage];
END.