<> <> <> <> DIRECTORY RavenControl USING [PaperTray, PaperStacking], RavenEngine USING [Job, JobHandle], RavenSequence USING []; RavenSequenceImpl: CEDAR PROGRAM EXPORTS RavenSequence = BEGIN <> firstPage, lastPage: PUBLIC CARDINAL; -- zero-relative number in paper sequence (including all copies) pageCount: PUBLIC CARDINAL; -- total pages (all copies, with any or all banner sheets) <> jobHandle: RavenEngine.JobHandle; -- this and jobInternal set in call to Set jobInternal: RavenEngine.Job; globalFeedingTop: BOOLEAN _ FALSE; -- for alternateBottomAndTop globalStacking: RavenControl.PaperStacking _ aligned; paperSequence: RECORD [first, last: CARDINAL, length: CARDINAL]; -- page numbers are zero-relative , length = pageCount plateSequence: RECORD [first, last, length: CARDINAL]; -- relates to pages in one copy (includes banner page) <> GetBandlist: PUBLIC PROCEDURE [page: CARDINAL] RETURNS [bandlist: CARDINAL] = BEGIN <> <> <<(plates and pages relate to print order)>> SELECT jobHandle.printOrder FROM firstPageOutFirst => SELECT jobHandle.banner FROM oncePerDocument, oncePerJob => IF Banner[page: page] THEN RETURN[0] -- banner page from bandlist 0 ELSE RETURN[jobHandle.firstPage + Plate[page: page]]; suppressed => RETURN[jobHandle.firstPage + Plate[page: page]]; ENDCASE; lastPageOutFirst => SELECT jobHandle.banner FROM oncePerDocument, oncePerJob => IF Banner[page: page] THEN RETURN[0] ELSE RETURN[1 + jobHandle.lastPage - Plate[page: page]]; suppressed => RETURN[jobHandle.lastPage - Plate[page: page]]; ENDCASE; ENDCASE; END; GetPaperTray: PUBLIC PROCEDURE [page: CARDINAL] RETURNS [feeder: RavenControl.PaperTray] = BEGIN <> SELECT jobHandle.paperFeed FROM fromBottom, fromBottomOrTop => RETURN[bottom]; fromBottomBannerFromTop => RETURN[IF Banner[page: page] THEN top ELSE bottom]; fromTop => RETURN[top]; alternateBottomAndTop => RETURN[IF (globalFeedingTop _ NOT globalFeedingTop) THEN top ELSE bottom]; ENDCASE; END; GetPaperStacking: PUBLIC PROCEDURE [page: CARDINAL] RETURNS [stacking: RavenControl.PaperStacking] = BEGIN <> RETURN[ IF jobHandle.paperStacking = documentOffset THEN IF OddCopyCount[copyCount: CopyCount[page: page]] THEN globalStacking -- i.e. if page is in an odd-numbered copy, use global stacking ELSE ReverseStacking[] ELSE globalStacking]; -- otherwise reverse the stacking END; Set: PUBLIC PROCEDURE [job: RavenEngine.JobHandle] RETURNS [valid: BOOLEAN] = BEGIN IF job.document = NIL OR job.document.pages = 0 OR job.copyCount = 0 THEN RETURN[FALSE]; IF job.banner # suppressed AND job.document.pages = 0 THEN BEGIN <> job.banner _ suppressed; job.copyCount _ 1; IF job.paperFeed = fromBottomBannerFromTop THEN job.paperFeed _ fromTop; job.firstPage _ job.lastPage _ 0; END ELSE job.lastPage _ MIN[LONG[job.lastPage], job.document.pages - 1 - (IF job.banner # suppressed THEN 1 ELSE 0)]; < job.lastPage THEN RETURN[FALSE];** removed to fix AR>> <> plateSequence.length _ job.lastPage - job.firstPage + 1 + (IF job.banner # suppressed THEN 1 ELSE 0); plateSequence.last _ plateSequence.length - 1; plateSequence.first _ 0; <> pageCount _ paperSequence.length _ SELECT job.banner FROM oncePerDocument, suppressed => job.copyCount * plateSequence.length, ENDCASE => 1 + job.copyCount * (plateSequence.length - 1); lastPage _ paperSequence.last _ paperSequence.length - 1; firstPage _ paperSequence.first _ 0; <> IF job.paperStacking # aligned THEN globalStacking _ ReverseStacking[]; IF jobInternal.paperStacking = documentOffset AND NOT OddCopyCount[copyCount: jobInternal.copyCount] THEN globalStacking _ ReverseStacking[]; jobHandle _ job; jobInternal _ job^; RETURN[TRUE]; END; <> Banner: PROCEDURE [page: CARDINAL] RETURNS [banner: BOOLEAN] = BEGIN <> SELECT jobHandle.banner FROM oncePerDocument => SELECT jobHandle.printOrder FROM firstPageOutFirst => -- banner is page 0 RETURN[page MOD plateSequence.length = plateSequence.first]; lastPageOutFirst => -- banner is plateSequence.length + 1 RETURN[page MOD plateSequence.length = plateSequence.last]; ENDCASE; oncePerJob => SELECT jobHandle.printOrder FROM firstPageOutFirst => RETURN[page = paperSequence.first]; lastPageOutFirst => RETURN[page = paperSequence.last]; ENDCASE; suppressed => RETURN[FALSE]; ENDCASE; END; CopyCount: PROCEDURE [page: CARDINAL] RETURNS [copyCount: CARDINAL] = BEGIN <> SELECT jobHandle.banner FROM oncePerDocument, suppressed => copyCount _ page / plateSequence.length; oncePerJob => SELECT jobHandle.printOrder FROM firstPageOutFirst => copyCount _ IF page < plateSequence.length THEN 0 ELSE 1 + (page - plateSequence.length) / (plateSequence.length - 1); lastPageOutFirst => copyCount _ IF page = paperSequence.last THEN jobHandle.copyCount ELSE page / (plateSequence.length - 1); ENDCASE; ENDCASE; RETURN[copyCount]; END; OddCopyCount: PROCEDURE [copyCount: CARDINAL] RETURNS [odd: BOOLEAN] = INLINE BEGIN RETURN[copyCount MOD 2 = 1]; END; Plate: PROCEDURE [page: CARDINAL] RETURNS [plate: CARDINAL] = BEGIN <> <> SELECT jobHandle.banner FROM oncePerDocument, suppressed => RETURN[page MOD plateSequence.length]; oncePerJob => IF plateSequence.length = 1 THEN RETURN[plateSequence.first] ELSE SELECT jobHandle.printOrder FROM firstPageOutFirst => IF page < plateSequence.length THEN RETURN[page] ELSE RETURN[1 + (page - 1) MOD (plateSequence.length - 1)]; lastPageOutFirst => IF page = paperSequence.last THEN RETURN[plateSequence.last] ELSE RETURN[page MOD (plateSequence.length - 1)]; ENDCASE; ENDCASE; END; ReverseStacking: PROCEDURE RETURNS [stacking: RavenControl.PaperStacking] = INLINE BEGIN RETURN[IF globalStacking = aligned THEN offset ELSE aligned]; END; END... LOG When / Who / What 1981/Claude Pany/Created. 21-Jan-83 14:49:15 - Trowell - removed check on last vs. first page numbers in Set to avoid AR ##### 8-Oct-82 16:20:12 - Trowell - added documentation 14-Dec-83 18:29:58 - Strickberger - Updated for PS 8.0 interfaces 6-Feb-84 11:43:02 - Strickberger - Add implementation for PaperFeed: alternateBottomAndTop. Delete some INLINE attributes. 9-Apr-85 17:44:01 - Strickberger - Update for Raven engine driver redesign. 19-Jul-85 2:43:40 - Strickberger - Add copyright. FixArrows.