<> <> <> <<>> 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.