RavenSequenceImpl.mesa
Copyright (C) Xerox Corporation 1981, 1982, 1983, 1984, 1985, 1986. All rights reserved.
Last edited by Strickberger 19-Jul-85 2:43:40
Tim Diebert: October 3, 1986 11:25:53 am PDT
DIRECTORY
RavenControl USING [PaperTray, PaperStacking],
RavenEngine USING [Job, JobHandle],
RavenSequence USING [];
RavenSequenceImpl: CEDAR PROGRAM EXPORTS RavenSequence = BEGIN
PUBLIC Variables:
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)
PRIVATE Variables:
jobHandle: RavenEngine.JobHandle; -- this and jobInternal set in call to Set
jobInternal: RavenEngine.Job;
globalFeedingTop: BOOLEANFALSE; -- 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)
PUBLIC PROCEDUREs:
GetBandlist: PUBLIC PROCEDURE [page: CARDINAL] RETURNS [bandlist: CARDINAL] = BEGIN
returns correct index into bandlist sequence for page number passed
bandlists correspond to doc. page order, not print order
(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
returns correct source, top or bottom (as designated in paperFeed field of job record and possibly depending on page number)
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
returns correct index into bandlist sequence for page number passed
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
sole page in job is banner page
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)];
IF job.firstPage > job.lastPage THEN RETURN[FALSE];** removed to fix AR
set up plateSequence fields (pertaining to pages in a single copy)
plateSequence.length ← job.lastPage - job.firstPage + 1 + (IF job.banner # suppressed THEN 1 ELSE 0);
plateSequence.last ← plateSequence.length - 1;
plateSequence.first ← 0;
set up paperSequence and globals (pertaining to all pages in job)
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;
reverse the stacking value if job is to be offset
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;
PRIVATE INLINE PROCEDUREs:
Banner: PROCEDURE [page: CARDINAL] RETURNS [banner: BOOLEAN] = BEGIN
returns TRUE if page is a banner, FALSE otherwise
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
returns number indicating which copy the page is in
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
returns number of plate given page number
in the first or only copy, page and plate number are the same, except for
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.