DIRECTORY Convert, JaM, JaMIPrivate, Imager, ImagerInterpress, Rope ; JaMIInterpressImpl: CEDAR PROGRAM IMPORTS Convert, Imager, JaM, JaMIPrivate, ImagerInterpress, Rope EXPORTS JaMIPrivate ~ BEGIN ROPE: TYPE ~ Rope.ROPE; ApplyDoPage: PUBLIC PROC [self: JaM.State] ~ { OPEN JaM; info: JaMIPrivate.Info _ JaMIPrivate.GetInfo[self]; rope: ROPE ~ PopRope[self]; x: Any ~ Pop[self]; action: PROC [dc: Imager.Context] ~ { Imager.ScaleT[dc, 0.0254/72]; info.ipenabled_ TRUE; info.ipdc_ dc; Execute[self, x]; info.ipenabled_ FALSE; }; ref: ImagerInterpress.Ref = ImagerInterpress.Create[rope]; IF info = NIL THEN ERROR; ImagerInterpress.DoPage[ref, action ! UNWIND => info.ipenabled_ FALSE]; ImagerInterpress.Close[ref]; }; ApplyWriteInterpress: PUBLIC PROC [self: JaM.State] ~ { OPEN JaM; info: JaMIPrivate.Info _ JaMIPrivate.GetInfo[self]; x: Any _ Pop[self]; decl: Array ~ PopArray[self]; rope: ROPE ~ PopRope[self]; quit: INT _ 0; pageNumber: INT _ 1; action: PROC [dc: Imager.Context] ~ { Imager.ScaleT[dc, 0.0254/72]; info.ipenabled_ TRUE; info.ipdc_ dc; JaM.PushInt[self, pageNumber]; Execute[self, x]; quit _ JaM.PopInt[self]; info.ipenabled_ FALSE; }; ref: ImagerInterpress.Ref = ImagerInterpress.Create[rope]; IF info = NIL THEN ERROR; FOR i: NAT IN [decl.start..decl.start+decl.length) DO d: Any _ JaM.AGet[decl, i]; WITH d SELECT FROM font: Imager.Font => ImagerInterpress.DeclareFont[ref, font]; color: Imager.Color => ImagerInterpress.DeclareColor[ref, color]; pixelArray: Imager.PixelArray => ImagerInterpress.DeclarePixelArray[ref, pixelArray]; colorOperator: Imager.ColorOperator => ImagerInterpress.DeclareColorOperator[ref, colorOperator]; ENDCASE => ERROR JaM.Error[WrongType, Rope.Cat["wrong type: element ", Convert.RopeFromInt[i], " of declaration"]]; ENDLOOP; UNTIL quit # 0 DO ImagerInterpress.DoPage[ref, action ! UNWIND => info.ipenabled _ FALSE]; pageNumber _ pageNumber + 1; ENDLOOP; ImagerInterpress.Close[ref]; }; RegisterInterpress: PUBLIC PROC [self: JaM.State] ~ { JaM.Register[self, ".makeinterpress", ApplyDoPage]; JaM.Register[self, ".writeinterpress", ApplyWriteInterpress]; }; END. ΄JaMIInterpressImpl.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Tim Diebert: July 23, 1985 5:02:46 pm PDT Michael Plass, March 13, 1986 11:24:24 am PST ΚΕ˜™Icodešœ Οmœ1™